aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/qconf.cc
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2010-05-10 04:33:41 -0400
committerMichal Marek <mmarek@suse.cz>2010-06-02 09:10:33 -0400
commit39a4897c1bb66e8a36043c105d7fd73d8b32b480 (patch)
tree59f1133eb708907da8a9e37cce8e4f3f0c7b93a8 /scripts/kconfig/qconf.cc
parent120d63e63319aceea5d127f0de93bd7fe1cbaba1 (diff)
xconfig: add support to show hidden options which have prompts
This feature has been supported in menuconfig and gconfig, so here add it to xconfig. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/kconfig/qconf.cc')
-rw-r--r--scripts/kconfig/qconf.cc69
1 files changed, 50 insertions, 19 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 5e01af2f41ac..820df2d1217b 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -148,7 +148,7 @@ void ConfigItem::updateMenu(void)
148 case S_TRISTATE: 148 case S_TRISTATE:
149 char ch; 149 char ch;
150 150
151 if (!sym_is_changable(sym) && !list->showAll) { 151 if (!sym_is_changable(sym) && list->optMode == normalOpt) {
152 setPixmap(promptColIdx, 0); 152 setPixmap(promptColIdx, 0);
153 setText(noColIdx, QString::null); 153 setText(noColIdx, QString::null);
154 setText(modColIdx, QString::null); 154 setText(modColIdx, QString::null);
@@ -319,7 +319,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
319 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),
320 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), 320 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
321 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),
322 showAll(false), showName(false), showRange(false), showData(false), 322 showName(false), showRange(false), showData(false), optMode(normalOpt),
323 rootEntry(0), headerPopup(0) 323 rootEntry(0), headerPopup(0)
324{ 324{
325 int i; 325 int i;
@@ -336,10 +336,10 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
336 336
337 if (name) { 337 if (name) {
338 configSettings->beginGroup(name); 338 configSettings->beginGroup(name);
339 showAll = configSettings->readBoolEntry("/showAll", false);
340 showName = configSettings->readBoolEntry("/showName", false); 339 showName = configSettings->readBoolEntry("/showName", false);
341 showRange = configSettings->readBoolEntry("/showRange", false); 340 showRange = configSettings->readBoolEntry("/showRange", false);
342 showData = configSettings->readBoolEntry("/showData", false); 341 showData = configSettings->readBoolEntry("/showData", false);
342 optMode = (enum optionMode)configSettings->readNumEntry("/optionMode", false);
343 configSettings->endGroup(); 343 configSettings->endGroup();
344 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); 344 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
345 } 345 }
@@ -351,6 +351,17 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
351 reinit(); 351 reinit();
352} 352}
353 353
354bool 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
354void ConfigList::reinit(void) 365void ConfigList::reinit(void)
355{ 366{
356 removeColumn(dataColIdx); 367 removeColumn(dataColIdx);
@@ -379,7 +390,7 @@ void ConfigList::saveSettings(void)
379 configSettings->writeEntry("/showName", showName); 390 configSettings->writeEntry("/showName", showName);
380 configSettings->writeEntry("/showRange", showRange); 391 configSettings->writeEntry("/showRange", showRange);
381 configSettings->writeEntry("/showData", showData); 392 configSettings->writeEntry("/showData", showData);
382 configSettings->writeEntry("/showAll", showAll); 393 configSettings->writeEntry("/optionMode", (int)optMode);
383 configSettings->endGroup(); 394 configSettings->endGroup();
384 } 395 }
385} 396}
@@ -605,7 +616,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
605 } 616 }
606 617
607 visible = menu_is_visible(child); 618 visible = menu_is_visible(child);
608 if (showAll || visible) { 619 if (!menuSkip(child)) {
609 if (!child->sym && !child->list && !child->prompt) 620 if (!child->sym && !child->list && !child->prompt)
610 continue; 621 continue;
611 if (!item || item->menu != child) 622 if (!item || item->menu != child)
@@ -834,7 +845,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
834 e->ignore(); 845 e->ignore();
835} 846}
836 847
837ConfigView* ConfigView::viewList; 848ConfigView*ConfigView::viewList;
849QAction *ConfigView::showNormalAction;
850QAction *ConfigView::showAllAction;
851QAction *ConfigView::showPromptAction;
838 852
839ConfigView::ConfigView(QWidget* parent, const char *name) 853ConfigView::ConfigView(QWidget* parent, const char *name)
840 : Parent(parent, name) 854 : Parent(parent, name)
@@ -859,13 +873,16 @@ ConfigView::~ConfigView(void)
859 } 873 }
860} 874}
861 875
862void ConfigView::setShowAll(bool b) 876void ConfigView::setOptionMode(QAction *act)
863{ 877{
864 if (list->showAll != b) { 878 if (act == showNormalAction)
865 list->showAll = b; 879 list->optMode = normalOpt;
866 list->updateListAll(); 880 else if (act == showAllAction)
867 emit showAllChanged(b); 881 list->optMode = allOpt;
868 } 882 else
883 list->optMode = promptOpt;
884
885 list->updateListAll();
869} 886}
870 887
871void ConfigView::setShowName(bool b) 888void ConfigView::setShowName(bool b)
@@ -1320,11 +1337,24 @@ ConfigMainWindow::ConfigMainWindow(void)
1320 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); 1337 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
1321 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); 1338 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
1322 showDataAction->setOn(configList->showData); 1339 showDataAction->setOn(configList->showData);
1323 QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this); 1340
1324 showAllAction->setToggleAction(TRUE); 1341 QActionGroup *optGroup = new QActionGroup(this);
1325 connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool))); 1342 optGroup->setExclusive(TRUE);
1326 connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool))); 1343 connect(optGroup, SIGNAL(selected(QAction *)), configView,
1327 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
1328 QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this); 1358 QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
1329 showDebugAction->setToggleAction(TRUE); 1359 showDebugAction->setToggleAction(TRUE);
1330 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); 1360 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
@@ -1367,7 +1397,8 @@ ConfigMainWindow::ConfigMainWindow(void)
1367 showRangeAction->addTo(optionMenu); 1397 showRangeAction->addTo(optionMenu);
1368 showDataAction->addTo(optionMenu); 1398 showDataAction->addTo(optionMenu);
1369 optionMenu->insertSeparator(); 1399 optionMenu->insertSeparator();
1370 showAllAction->addTo(optionMenu); 1400 optGroup->addTo(optionMenu);
1401 optionMenu->insertSeparator();
1371 showDebugAction->addTo(optionMenu); 1402 showDebugAction->addTo(optionMenu);
1372 1403
1373 // create help menu 1404 // create help menu
@@ -1462,7 +1493,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
1462 ConfigList* list = NULL; 1493 ConfigList* list = NULL;
1463 ConfigItem* item; 1494 ConfigItem* item;
1464 1495
1465 if (!menu_is_visible(menu) && !configView->showAll()) 1496 if (configList->menuSkip(menu))
1466 return; 1497 return;
1467 1498
1468 switch (configList->mode) { 1499 switch (configList->mode) {