This feature has been supported in menuconfig and gconfig, so here add it to xconfig.
Showing the changes to scripts (2 of 2 files). Show all
Unified · Split
| @@ -148,7 +148,7 @@ void ConfigItem::updateMenu(void) · 147 unmodified lines | ||
| 148 | 148 | case S_TRISTATE: |
| 149 | 149 | char ch; |
| 150 | 150 | |
| 151 | − if (!sym_is_changable(sym) && !list->showAll) { | |
| 151 | + if (!sym_is_changable(sym) && list->optMode == normalOpt) { | |
| 152 | 152 | setPixmap(promptColIdx, 0); |
| 153 | 153 | setText(noColIdx, QString::null); |
| 154 | 154 | setText(modColIdx, QString::null); |
| @@ -319,7 +319,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) · 164 unmodified lines | ||
| 319 | 319 | symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), |
| 320 | 320 | choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), |
| 321 | 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 | 323 | rootEntry(0), headerPopup(0) |
| 324 | 324 | { |
| 325 | 325 | int i; |
| @@ -336,10 +336,10 @@ ConfigList::ConfigList(ConfigView* p, const char *name) · 10 unmodified lines | ||
| 336 | 336 | |
| 337 | 337 | if (name) { |
| 338 | 338 | configSettings->beginGroup(name); |
| 339 | − showAll = configSettings->readBoolEntry("/showAll", false); | |
| 340 | 339 | showName = configSettings->readBoolEntry("/showName", false); |
| 341 | 340 | showRange = configSettings->readBoolEntry("/showRange", false); |
| 342 | 341 | showData = configSettings->readBoolEntry("/showData", false); |
| 342 | + optMode = (enum optionMode)configSettings->readNumEntry("/optionMode", false); | |
| 343 | 343 | configSettings->endGroup(); |
| 344 | 344 | connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); |
| 345 | 345 | } |
| @@ -351,6 +351,17 @@ ConfigList::ConfigList(ConfigView* p, const char *name) · 5 unmodified lines | ||
| 351 | 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 | 365 | void ConfigList::reinit(void) |
| 355 | 366 | { |
| 356 | 367 | removeColumn(dataColIdx); |
| @@ -379,7 +390,7 @@ void ConfigList::saveSettings(void) · 22 unmodified lines | ||
| 379 | 390 | configSettings->writeEntry("/showName", showName); |
| 380 | 391 | configSettings->writeEntry("/showRange", showRange); |
| 381 | 392 | configSettings->writeEntry("/showData", showData); |
| 382 | − configSettings->writeEntry("/showAll", showAll); | |
| 393 | + configSettings->writeEntry("/optionMode", (int)optMode); | |
| 383 | 394 | configSettings->endGroup(); |
| 384 | 395 | } |
| 385 | 396 | } |
| @@ -605,7 +616,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) · 219 unmodified lines | ||
| 605 | 616 | } |
| 606 | 617 | |
| 607 | 618 | visible = menu_is_visible(child); |
| 608 | − if (showAll || visible) { | |
| 619 | + if (!menuSkip(child)) { | |
| 609 | 620 | if (!child->sym && !child->list && !child->prompt) |
| 610 | 621 | continue; |
| 611 | 622 | if (!item || item->menu != child) |
| @@ -834,7 +845,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) · 222 unmodified lines | ||
| 834 | 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 | 853 | ConfigView::ConfigView(QWidget* parent, const char *name) |
| 840 | 854 | : Parent(parent, name) |
| @@ -859,13 +873,16 @@ ConfigView::~ConfigView(void) · 18 unmodified lines | ||
| 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) { | |
| 865 | − list->showAll = b; | |
| 866 | − list->updateListAll(); | |
| 867 | − emit showAllChanged(b); | |
| 868 | − } | |
| 878 | + if (act == showNormalAction) | |
| 879 | + list->optMode = normalOpt; | |
| 880 | + else if (act == showAllAction) | |
| 881 | + list->optMode = allOpt; | |
| 882 | + else | |
| 883 | + list->optMode = promptOpt; | |
| 884 | + | |
| 885 | + list->updateListAll(); | |
| 869 | 886 | } |
| 870 | 887 | |
| 871 | 888 | void ConfigView::setShowName(bool b) |
| @@ -1320,11 +1337,24 @@ ConfigMainWindow::ConfigMainWindow(void) · 448 unmodified lines | ||
| 1320 | 1337 | connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); |
| 1321 | 1338 | connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); |
| 1322 | 1339 | showDataAction->setOn(configList->showData); |
| 1323 | − QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this); | |
| 1324 | − showAllAction->setToggleAction(TRUE); | |
| 1325 | − connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool))); | |
| 1326 | − connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool))); | |
| 1327 | − showAllAction->setOn(configList->showAll); | |
| 1340 | + | |
| 1341 | + QActionGroup *optGroup = new QActionGroup(this); | |
| 1342 | + optGroup->setExclusive(TRUE); | |
| 1343 | + connect(optGroup, SIGNAL(selected(QAction *)), configView, | |
| 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 | 1358 | QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this); |
| 1329 | 1359 | showDebugAction->setToggleAction(TRUE); |
| 1330 | 1360 | connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); |
| @@ -1367,7 +1397,8 @@ ConfigMainWindow::ConfigMainWindow(void) · 36 unmodified lines | ||
| 1367 | 1397 | showRangeAction->addTo(optionMenu); |
| 1368 | 1398 | showDataAction->addTo(optionMenu); |
| 1369 | 1399 | optionMenu->insertSeparator(); |
| 1370 | − showAllAction->addTo(optionMenu); | |
| 1400 | + optGroup->addTo(optionMenu); | |
| 1401 | + optionMenu->insertSeparator(); | |
| 1371 | 1402 | showDebugAction->addTo(optionMenu); |
| 1372 | 1403 | |
| 1373 | 1404 | // create help menu |
| @@ -1462,7 +1493,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) · 88 unmodified lines | ||
| 1462 | 1493 | ConfigList* list = NULL; |
| 1463 | 1494 | ConfigItem* item; |
| 1464 | 1495 | |
| 1465 | − if (!menu_is_visible(menu) && !configView->showAll()) | |
| 1496 | + if (configList->menuSkip(menu)) | |
| 1466 | 1497 | return; |
| 1467 | 1498 | |
| 1468 | 1499 | switch (configList->mode) { |
| @@ -44,6 +44,9 @@ enum colIdx { · 43 unmodified lines | ||
| 44 | 44 | enum listMode { |
| 45 | 45 | singleMode, menuMode, symbolMode, fullMode, listMode |
| 46 | 46 | }; |
| 47 | +enum optionMode { | |
| 48 | + normalOpt = 0, allOpt, promptOpt | |
| 49 | +}; | |
| 47 | 50 | |
| 48 | 51 | class ConfigList : public QListView { |
| 49 | 52 | Q_OBJECT |
| @@ -115,6 +118,8 @@ public: · 65 unmodified lines | ||
| 115 | 118 | void setAllOpen(bool open); |
| 116 | 119 | void setParentMenu(void); |
| 117 | 120 | |
| 121 | + bool menuSkip(struct menu *); | |
| 122 | + | |
| 118 | 123 | template <class P> |
| 119 | 124 | void updateMenuList(P*, struct menu*); |
| 120 | 125 | |
| @@ -124,8 +129,9 @@ public: · 3 unmodified lines | ||
| 124 | 129 | QPixmap choiceYesPix, choiceNoPix; |
| 125 | 130 | QPixmap menuPix, menuInvPix, menuBackPix, voidPix; |
| 126 | 131 | |
| 127 | − bool showAll, showName, showRange, showData; | |
| 132 | + bool showName, showRange, showData; | |
| 128 | 133 | enum listMode mode; |
| 134 | + enum optionMode optMode; | |
| 129 | 135 | struct menu *rootEntry; |
| 130 | 136 | QColorGroup disabledColorGroup; |
| 131 | 137 | QColorGroup inactivedColorGroup; |
| @@ -222,17 +228,15 @@ public: · 90 unmodified lines | ||
| 222 | 228 | static void updateList(ConfigItem* item); |
| 223 | 229 | static void updateListAll(void); |
| 224 | 230 | |
| 225 | − bool showAll(void) const { return list->showAll; } | |
| 226 | 231 | bool showName(void) const { return list->showName; } |
| 227 | 232 | bool showRange(void) const { return list->showRange; } |
| 228 | 233 | bool showData(void) const { return list->showData; } |
| 229 | 234 | public slots: |
| 230 | − void setShowAll(bool); | |
| 231 | 235 | void setShowName(bool); |
| 232 | 236 | void setShowRange(bool); |
| 233 | 237 | void setShowData(bool); |
| 238 | + void setOptionMode(QAction *); | |
| 234 | 239 | signals: |
| 235 | − void showAllChanged(bool); | |
| 236 | 240 | void showNameChanged(bool); |
| 237 | 241 | void showRangeChanged(bool); |
| 238 | 242 | void showDataChanged(bool); |
| @@ -242,6 +246,10 @@ public: · 3 unmodified lines | ||
| 242 | 246 | |
| 243 | 247 | static ConfigView* viewList; |
| 244 | 248 | ConfigView* nextView; |
| 249 | + | |
| 250 | + static QAction *showNormalAction; | |
| 251 | + static QAction *showAllAction; | |
| 252 | + static QAction *showPromptAction; | |
| 245 | 253 | }; |
| 246 | 254 | |
| 247 | 255 | class ConfigInfoView : public QTextBrowser { |