diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2010-05-10 04:33:41 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-06-02 09:10:33 -0400 |
commit | 39a4897c1bb66e8a36043c105d7fd73d8b32b480 (patch) | |
tree | 59f1133eb708907da8a9e37cce8e4f3f0c7b93a8 | |
parent | 120d63e63319aceea5d127f0de93bd7fe1cbaba1 (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>
-rw-r--r-- | scripts/kconfig/qconf.cc | 69 | ||||
-rw-r--r-- | scripts/kconfig/qconf.h | 16 |
2 files changed, 62 insertions, 23 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 | ||
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 | |||
354 | void ConfigList::reinit(void) | 365 | void 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 | ||
837 | ConfigView* ConfigView::viewList; | 848 | ConfigView*ConfigView::viewList; |
849 | QAction *ConfigView::showNormalAction; | ||
850 | QAction *ConfigView::showAllAction; | ||
851 | QAction *ConfigView::showPromptAction; | ||
838 | 852 | ||
839 | ConfigView::ConfigView(QWidget* parent, const char *name) | 853 | ConfigView::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 | ||
862 | void ConfigView::setShowAll(bool b) | 876 | void 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 | ||
871 | void ConfigView::setShowName(bool b) | 888 | void 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) { |
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 54775ae38250..636a74b23bf9 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h | |||
@@ -44,6 +44,9 @@ enum colIdx { | |||
44 | enum listMode { | 44 | enum listMode { |
45 | singleMode, menuMode, symbolMode, fullMode, listMode | 45 | singleMode, menuMode, symbolMode, fullMode, listMode |
46 | }; | 46 | }; |
47 | enum optionMode { | ||
48 | normalOpt = 0, allOpt, promptOpt | ||
49 | }; | ||
47 | 50 | ||
48 | class ConfigList : public QListView { | 51 | class ConfigList : public QListView { |
49 | Q_OBJECT | 52 | Q_OBJECT |
@@ -115,6 +118,8 @@ public: | |||
115 | void setAllOpen(bool open); | 118 | void setAllOpen(bool open); |
116 | void setParentMenu(void); | 119 | void setParentMenu(void); |
117 | 120 | ||
121 | bool menuSkip(struct menu *); | ||
122 | |||
118 | template <class P> | 123 | template <class P> |
119 | void updateMenuList(P*, struct menu*); | 124 | void updateMenuList(P*, struct menu*); |
120 | 125 | ||
@@ -124,8 +129,9 @@ public: | |||
124 | QPixmap choiceYesPix, choiceNoPix; | 129 | QPixmap choiceYesPix, choiceNoPix; |
125 | QPixmap menuPix, menuInvPix, menuBackPix, voidPix; | 130 | QPixmap menuPix, menuInvPix, menuBackPix, voidPix; |
126 | 131 | ||
127 | bool showAll, showName, showRange, showData; | 132 | bool showName, showRange, showData; |
128 | enum listMode mode; | 133 | enum listMode mode; |
134 | enum optionMode optMode; | ||
129 | struct menu *rootEntry; | 135 | struct menu *rootEntry; |
130 | QColorGroup disabledColorGroup; | 136 | QColorGroup disabledColorGroup; |
131 | QColorGroup inactivedColorGroup; | 137 | QColorGroup inactivedColorGroup; |
@@ -222,17 +228,15 @@ public: | |||
222 | static void updateList(ConfigItem* item); | 228 | static void updateList(ConfigItem* item); |
223 | static void updateListAll(void); | 229 | static void updateListAll(void); |
224 | 230 | ||
225 | bool showAll(void) const { return list->showAll; } | ||
226 | bool showName(void) const { return list->showName; } | 231 | bool showName(void) const { return list->showName; } |
227 | bool showRange(void) const { return list->showRange; } | 232 | bool showRange(void) const { return list->showRange; } |
228 | bool showData(void) const { return list->showData; } | 233 | bool showData(void) const { return list->showData; } |
229 | public slots: | 234 | public slots: |
230 | void setShowAll(bool); | ||
231 | void setShowName(bool); | 235 | void setShowName(bool); |
232 | void setShowRange(bool); | 236 | void setShowRange(bool); |
233 | void setShowData(bool); | 237 | void setShowData(bool); |
238 | void setOptionMode(QAction *); | ||
234 | signals: | 239 | signals: |
235 | void showAllChanged(bool); | ||
236 | void showNameChanged(bool); | 240 | void showNameChanged(bool); |
237 | void showRangeChanged(bool); | 241 | void showRangeChanged(bool); |
238 | void showDataChanged(bool); | 242 | void showDataChanged(bool); |
@@ -242,6 +246,10 @@ public: | |||
242 | 246 | ||
243 | static ConfigView* viewList; | 247 | static ConfigView* viewList; |
244 | ConfigView* nextView; | 248 | ConfigView* nextView; |
249 | |||
250 | static QAction *showNormalAction; | ||
251 | static QAction *showAllAction; | ||
252 | static QAction *showPromptAction; | ||
245 | }; | 253 | }; |
246 | 254 | ||
247 | class ConfigInfoView : public QTextBrowser { | 255 | class ConfigInfoView : public QTextBrowser { |