diff options
Diffstat (limited to 'scripts/kconfig/qconf.cc')
-rw-r--r-- | scripts/kconfig/qconf.cc | 106 |
1 files changed, 54 insertions, 52 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 00c51507cfcc..820df2d1217b 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -58,11 +58,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) | |||
58 | { | 58 | { |
59 | QValueList<int> result; | 59 | QValueList<int> result; |
60 | QStringList entryList = readListEntry(key, ok); | 60 | QStringList entryList = readListEntry(key, ok); |
61 | if (ok) { | 61 | QStringList::Iterator it; |
62 | QStringList::Iterator it; | 62 | |
63 | for (it = entryList.begin(); it != entryList.end(); ++it) | 63 | for (it = entryList.begin(); it != entryList.end(); ++it) |
64 | result.push_back((*it).toInt()); | 64 | result.push_back((*it).toInt()); |
65 | } | ||
66 | 65 | ||
67 | return result; | 66 | return result; |
68 | } | 67 | } |
@@ -149,7 +148,7 @@ void ConfigItem::updateMenu(void) | |||
149 | case S_TRISTATE: | 148 | case S_TRISTATE: |
150 | char ch; | 149 | char ch; |
151 | 150 | ||
152 | if (!sym_is_changable(sym) && !list->showAll) { | 151 | if (!sym_is_changable(sym) && list->optMode == normalOpt) { |
153 | setPixmap(promptColIdx, 0); | 152 | setPixmap(promptColIdx, 0); |
154 | setText(noColIdx, QString::null); | 153 | setText(noColIdx, QString::null); |
155 | setText(modColIdx, QString::null); | 154 | setText(modColIdx, QString::null); |
@@ -320,7 +319,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) | |||
320 | symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), | 319 | symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), |
321 | choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), | 320 | choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), |
322 | menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), | 321 | menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), |
323 | showAll(false), showName(false), showRange(false), showData(false), | 322 | showName(false), showRange(false), showData(false), optMode(normalOpt), |
324 | rootEntry(0), headerPopup(0) | 323 | rootEntry(0), headerPopup(0) |
325 | { | 324 | { |
326 | int i; | 325 | int i; |
@@ -337,10 +336,10 @@ ConfigList::ConfigList(ConfigView* p, const char *name) | |||
337 | 336 | ||
338 | if (name) { | 337 | if (name) { |
339 | configSettings->beginGroup(name); | 338 | configSettings->beginGroup(name); |
340 | showAll = configSettings->readBoolEntry("/showAll", false); | ||
341 | showName = configSettings->readBoolEntry("/showName", false); | 339 | showName = configSettings->readBoolEntry("/showName", false); |
342 | showRange = configSettings->readBoolEntry("/showRange", false); | 340 | showRange = configSettings->readBoolEntry("/showRange", false); |
343 | showData = configSettings->readBoolEntry("/showData", false); | 341 | showData = configSettings->readBoolEntry("/showData", false); |
342 | optMode = (enum optionMode)configSettings->readNumEntry("/optionMode", false); | ||
344 | configSettings->endGroup(); | 343 | configSettings->endGroup(); |
345 | connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); | 344 | connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); |
346 | } | 345 | } |
@@ -352,6 +351,17 @@ ConfigList::ConfigList(ConfigView* p, const char *name) | |||
352 | reinit(); | 351 | reinit(); |
353 | } | 352 | } |
354 | 353 | ||
354 | bool ConfigList::menuSkip(struct menu *menu) | ||
355 | { | ||
356 | if (optMode == normalOpt && menu_is_visible(menu)) | ||
357 | return false; | ||
358 | if (optMode == promptOpt && menu_has_prompt(menu)) | ||
359 | return false; | ||
360 | if (optMode == allOpt) | ||
361 | return false; | ||
362 | return true; | ||
363 | } | ||
364 | |||
355 | void ConfigList::reinit(void) | 365 | void ConfigList::reinit(void) |
356 | { | 366 | { |
357 | removeColumn(dataColIdx); | 367 | removeColumn(dataColIdx); |
@@ -380,7 +390,7 @@ void ConfigList::saveSettings(void) | |||
380 | configSettings->writeEntry("/showName", showName); | 390 | configSettings->writeEntry("/showName", showName); |
381 | configSettings->writeEntry("/showRange", showRange); | 391 | configSettings->writeEntry("/showRange", showRange); |
382 | configSettings->writeEntry("/showData", showData); | 392 | configSettings->writeEntry("/showData", showData); |
383 | configSettings->writeEntry("/showAll", showAll); | 393 | configSettings->writeEntry("/optionMode", (int)optMode); |
384 | configSettings->endGroup(); | 394 | configSettings->endGroup(); |
385 | } | 395 | } |
386 | } | 396 | } |
@@ -606,7 +616,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) | |||
606 | } | 616 | } |
607 | 617 | ||
608 | visible = menu_is_visible(child); | 618 | visible = menu_is_visible(child); |
609 | if (showAll || visible) { | 619 | if (!menuSkip(child)) { |
610 | if (!child->sym && !child->list && !child->prompt) | 620 | if (!child->sym && !child->list && !child->prompt) |
611 | continue; | 621 | continue; |
612 | if (!item || item->menu != child) | 622 | if (!item || item->menu != child) |
@@ -835,7 +845,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) | |||
835 | e->ignore(); | 845 | e->ignore(); |
836 | } | 846 | } |
837 | 847 | ||
838 | ConfigView* ConfigView::viewList; | 848 | ConfigView*ConfigView::viewList; |
849 | QAction *ConfigView::showNormalAction; | ||
850 | QAction *ConfigView::showAllAction; | ||
851 | QAction *ConfigView::showPromptAction; | ||
839 | 852 | ||
840 | ConfigView::ConfigView(QWidget* parent, const char *name) | 853 | ConfigView::ConfigView(QWidget* parent, const char *name) |
841 | : Parent(parent, name) | 854 | : Parent(parent, name) |
@@ -860,13 +873,16 @@ ConfigView::~ConfigView(void) | |||
860 | } | 873 | } |
861 | } | 874 | } |
862 | 875 | ||
863 | void ConfigView::setShowAll(bool b) | 876 | void ConfigView::setOptionMode(QAction *act) |
864 | { | 877 | { |
865 | if (list->showAll != b) { | 878 | if (act == showNormalAction) |
866 | list->showAll = b; | 879 | list->optMode = normalOpt; |
867 | list->updateListAll(); | 880 | else if (act == showAllAction) |
868 | emit showAllChanged(b); | 881 | list->optMode = allOpt; |
869 | } | 882 | else |
883 | list->optMode = promptOpt; | ||
884 | |||
885 | list->updateListAll(); | ||
870 | } | 886 | } |
871 | 887 | ||
872 | void ConfigView::setShowName(bool b) | 888 | void ConfigView::setShowName(bool b) |
@@ -964,34 +980,6 @@ void ConfigInfoView::setInfo(struct menu *m) | |||
964 | menuInfo(); | 980 | menuInfo(); |
965 | } | 981 | } |
966 | 982 | ||
967 | void ConfigInfoView::setSource(const QString& name) | ||
968 | { | ||
969 | const char *p = name.latin1(); | ||
970 | |||
971 | menu = NULL; | ||
972 | sym = NULL; | ||
973 | |||
974 | switch (p[0]) { | ||
975 | case 'm': | ||
976 | struct menu *m; | ||
977 | |||
978 | if (sscanf(p, "m%p", &m) == 1 && menu != m) { | ||
979 | menu = m; | ||
980 | menuInfo(); | ||
981 | emit menuSelected(menu); | ||
982 | } | ||
983 | break; | ||
984 | case 's': | ||
985 | struct symbol *s; | ||
986 | |||
987 | if (sscanf(p, "s%p", &s) == 1 && sym != s) { | ||
988 | sym = s; | ||
989 | symbolInfo(); | ||
990 | } | ||
991 | break; | ||
992 | } | ||
993 | } | ||
994 | |||
995 | void ConfigInfoView::symbolInfo(void) | 983 | void ConfigInfoView::symbolInfo(void) |
996 | { | 984 | { |
997 | QString str; | 985 | QString str; |
@@ -1349,11 +1337,24 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1349 | connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); | 1337 | connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); |
1350 | connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); | 1338 | connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); |
1351 | showDataAction->setOn(configList->showData); | 1339 | showDataAction->setOn(configList->showData); |
1352 | QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this); | 1340 | |
1353 | showAllAction->setToggleAction(TRUE); | 1341 | QActionGroup *optGroup = new QActionGroup(this); |
1354 | connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool))); | 1342 | optGroup->setExclusive(TRUE); |
1355 | connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool))); | 1343 | connect(optGroup, SIGNAL(selected(QAction *)), configView, |
1356 | showAllAction->setOn(configList->showAll); | 1344 | SLOT(setOptionMode(QAction *))); |
1345 | connect(optGroup, SIGNAL(selected(QAction *)), menuView, | ||
1346 | SLOT(setOptionMode(QAction *))); | ||
1347 | |||
1348 | configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup); | ||
1349 | configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup); | ||
1350 | configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup); | ||
1351 | configView->showNormalAction->setToggleAction(TRUE); | ||
1352 | configView->showNormalAction->setOn(configList->optMode == normalOpt); | ||
1353 | configView->showAllAction->setToggleAction(TRUE); | ||
1354 | configView->showAllAction->setOn(configList->optMode == allOpt); | ||
1355 | configView->showPromptAction->setToggleAction(TRUE); | ||
1356 | configView->showPromptAction->setOn(configList->optMode == promptOpt); | ||
1357 | |||
1357 | QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this); | 1358 | QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this); |
1358 | showDebugAction->setToggleAction(TRUE); | 1359 | showDebugAction->setToggleAction(TRUE); |
1359 | connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); | 1360 | connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); |
@@ -1396,7 +1397,8 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1396 | showRangeAction->addTo(optionMenu); | 1397 | showRangeAction->addTo(optionMenu); |
1397 | showDataAction->addTo(optionMenu); | 1398 | showDataAction->addTo(optionMenu); |
1398 | optionMenu->insertSeparator(); | 1399 | optionMenu->insertSeparator(); |
1399 | showAllAction->addTo(optionMenu); | 1400 | optGroup->addTo(optionMenu); |
1401 | optionMenu->insertSeparator(); | ||
1400 | showDebugAction->addTo(optionMenu); | 1402 | showDebugAction->addTo(optionMenu); |
1401 | 1403 | ||
1402 | // create help menu | 1404 | // create help menu |
@@ -1491,7 +1493,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) | |||
1491 | ConfigList* list = NULL; | 1493 | ConfigList* list = NULL; |
1492 | ConfigItem* item; | 1494 | ConfigItem* item; |
1493 | 1495 | ||
1494 | if (!menu_is_visible(menu) && !configView->showAll()) | 1496 | if (configList->menuSkip(menu)) |
1495 | return; | 1497 | return; |
1496 | 1498 | ||
1497 | switch (configList->mode) { | 1499 | switch (configList->mode) { |