History

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.

Li Zefan committed 16 years ago

Commit 39a48971 parent 120d63e2 files · +62 −23Browse files

Showing the changes to scripts (2 of 2 files). Show all

Unified · Split

2 files
  1. scripts/kconfig/qconf.cc +50 −19
  2. scripts/kconfig/qconf.h +12 −4
scripts/kconfig/qconf.cc+50−19
@@ -148,7 +148,7 @@ void ConfigItem::updateMenu(void) · 147 unmodified lines
148148 case S_TRISTATE:
149149 char ch;
150150
151− if (!sym_is_changable(sym) && !list->showAll) {
151+ if (!sym_is_changable(sym) && list->optMode == normalOpt) {
152152 setPixmap(promptColIdx, 0);
153153 setText(noColIdx, QString::null);
154154 setText(modColIdx, QString::null);
@@ -319,7 +319,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) · 164 unmodified lines
319319 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
320320 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
321321 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),
323323 rootEntry(0), headerPopup(0)
324324 {
325325 int i;
@@ -336,10 +336,10 @@ ConfigList::ConfigList(ConfigView* p, const char *name) · 10 unmodified lines
336336
337337 if (name) {
338338 configSettings->beginGroup(name);
339− showAll = configSettings->readBoolEntry("/showAll", false);
340339 showName = configSettings->readBoolEntry("/showName", false);
341340 showRange = configSettings->readBoolEntry("/showRange", false);
342341 showData = configSettings->readBoolEntry("/showData", false);
342+ optMode = (enum optionMode)configSettings->readNumEntry("/optionMode", false);
343343 configSettings->endGroup();
344344 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
345345 }
@@ -351,6 +351,17 @@ ConfigList::ConfigList(ConfigView* p, const char *name) · 5 unmodified lines
351351 reinit();
352352 }
353353
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+
354365 void ConfigList::reinit(void)
355366 {
356367 removeColumn(dataColIdx);
@@ -379,7 +390,7 @@ void ConfigList::saveSettings(void) · 22 unmodified lines
379390 configSettings->writeEntry("/showName", showName);
380391 configSettings->writeEntry("/showRange", showRange);
381392 configSettings->writeEntry("/showData", showData);
382− configSettings->writeEntry("/showAll", showAll);
393+ configSettings->writeEntry("/optionMode", (int)optMode);
383394 configSettings->endGroup();
384395 }
385396 }
@@ -605,7 +616,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) · 219 unmodified lines
605616 }
606617
607618 visible = menu_is_visible(child);
608− if (showAll || visible) {
619+ if (!menuSkip(child)) {
609620 if (!child->sym && !child->list && !child->prompt)
610621 continue;
611622 if (!item || item->menu != child)
@@ -834,7 +845,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) · 222 unmodified lines
834845 e->ignore();
835846 }
836847
837−ConfigView* ConfigView::viewList;
848+ConfigView*ConfigView::viewList;
849+QAction *ConfigView::showNormalAction;
850+QAction *ConfigView::showAllAction;
851+QAction *ConfigView::showPromptAction;
838852
839853 ConfigView::ConfigView(QWidget* parent, const char *name)
840854 : Parent(parent, name)
@@ -859,13 +873,16 @@ ConfigView::~ConfigView(void) · 18 unmodified lines
859873 }
860874 }
861875
862−void ConfigView::setShowAll(bool b)
876+void ConfigView::setOptionMode(QAction *act)
863877 {
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();
869886 }
870887
871888 void ConfigView::setShowName(bool b)
@@ -1320,11 +1337,24 @@ ConfigMainWindow::ConfigMainWindow(void) · 448 unmodified lines
13201337 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
13211338 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
13221339 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+
13281358 QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
13291359 showDebugAction->setToggleAction(TRUE);
13301360 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
@@ -1367,7 +1397,8 @@ ConfigMainWindow::ConfigMainWindow(void) · 36 unmodified lines
13671397 showRangeAction->addTo(optionMenu);
13681398 showDataAction->addTo(optionMenu);
13691399 optionMenu->insertSeparator();
1370− showAllAction->addTo(optionMenu);
1400+ optGroup->addTo(optionMenu);
1401+ optionMenu->insertSeparator();
13711402 showDebugAction->addTo(optionMenu);
13721403
13731404 // create help menu
@@ -1462,7 +1493,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) · 88 unmodified lines
14621493 ConfigList* list = NULL;
14631494 ConfigItem* item;
14641495
1465− if (!menu_is_visible(menu) && !configView->showAll())
1496+ if (configList->menuSkip(menu))
14661497 return;
14671498
14681499 switch (configList->mode) {
scripts/kconfig/qconf.h+12−4
@@ -44,6 +44,9 @@ enum colIdx { · 43 unmodified lines
4444 enum listMode {
4545 singleMode, menuMode, symbolMode, fullMode, listMode
4646 };
47+enum optionMode {
48+ normalOpt = 0, allOpt, promptOpt
49+};
4750
4851 class ConfigList : public QListView {
4952 Q_OBJECT
@@ -115,6 +118,8 @@ public: · 65 unmodified lines
115118 void setAllOpen(bool open);
116119 void setParentMenu(void);
117120
121+ bool menuSkip(struct menu *);
122+
118123 template <class P>
119124 void updateMenuList(P*, struct menu*);
120125
@@ -124,8 +129,9 @@ public: · 3 unmodified lines
124129 QPixmap choiceYesPix, choiceNoPix;
125130 QPixmap menuPix, menuInvPix, menuBackPix, voidPix;
126131
127− bool showAll, showName, showRange, showData;
132+ bool showName, showRange, showData;
128133 enum listMode mode;
134+ enum optionMode optMode;
129135 struct menu *rootEntry;
130136 QColorGroup disabledColorGroup;
131137 QColorGroup inactivedColorGroup;
@@ -222,17 +228,15 @@ public: · 90 unmodified lines
222228 static void updateList(ConfigItem* item);
223229 static void updateListAll(void);
224230
225− bool showAll(void) const { return list->showAll; }
226231 bool showName(void) const { return list->showName; }
227232 bool showRange(void) const { return list->showRange; }
228233 bool showData(void) const { return list->showData; }
229234 public slots:
230− void setShowAll(bool);
231235 void setShowName(bool);
232236 void setShowRange(bool);
233237 void setShowData(bool);
238+ void setOptionMode(QAction *);
234239 signals:
235− void showAllChanged(bool);
236240 void showNameChanged(bool);
237241 void showRangeChanged(bool);
238242 void showDataChanged(bool);
@@ -242,6 +246,10 @@ public: · 3 unmodified lines
242246
243247 static ConfigView* viewList;
244248 ConfigView* nextView;
249+
250+ static QAction *showNormalAction;
251+ static QAction *showAllAction;
252+ static QAction *showPromptAction;
245253 };
246254
247255 class ConfigInfoView : public QTextBrowser {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t