Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 204841
b: refs/heads/master
c: 39a4897
h: refs/heads/master
i:
  204839: 40f5054
v: v3
  • Loading branch information
Li Zefan authored and Michal Marek committed Jun 2, 2010
1 parent b9e1518 commit 2b7bfeb
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 120d63e63319aceea5d127f0de93bd7fe1cbaba1
refs/heads/master: 39a4897c1bb66e8a36043c105d7fd73d8b32b480
69 changes: 50 additions & 19 deletions trunk/scripts/kconfig/qconf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void ConfigItem::updateMenu(void)
case S_TRISTATE:
char ch;

if (!sym_is_changable(sym) && !list->showAll) {
if (!sym_is_changable(sym) && list->optMode == normalOpt) {
setPixmap(promptColIdx, 0);
setText(noColIdx, QString::null);
setText(modColIdx, QString::null);
Expand Down Expand Up @@ -319,7 +319,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void),
showAll(false), showName(false), showRange(false), showData(false),
showName(false), showRange(false), showData(false), optMode(normalOpt),
rootEntry(0), headerPopup(0)
{
int i;
Expand All @@ -336,10 +336,10 @@ ConfigList::ConfigList(ConfigView* p, const char *name)

if (name) {
configSettings->beginGroup(name);
showAll = configSettings->readBoolEntry("/showAll", false);
showName = configSettings->readBoolEntry("/showName", false);
showRange = configSettings->readBoolEntry("/showRange", false);
showData = configSettings->readBoolEntry("/showData", false);
optMode = (enum optionMode)configSettings->readNumEntry("/optionMode", false);
configSettings->endGroup();
connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
}
Expand All @@ -351,6 +351,17 @@ ConfigList::ConfigList(ConfigView* p, const char *name)
reinit();
}

bool ConfigList::menuSkip(struct menu *menu)
{
if (optMode == normalOpt && menu_is_visible(menu))
return false;
if (optMode == promptOpt && menu_has_prompt(menu))
return false;
if (optMode == allOpt)
return false;
return true;
}

void ConfigList::reinit(void)
{
removeColumn(dataColIdx);
Expand Down Expand Up @@ -379,7 +390,7 @@ void ConfigList::saveSettings(void)
configSettings->writeEntry("/showName", showName);
configSettings->writeEntry("/showRange", showRange);
configSettings->writeEntry("/showData", showData);
configSettings->writeEntry("/showAll", showAll);
configSettings->writeEntry("/optionMode", (int)optMode);
configSettings->endGroup();
}
}
Expand Down Expand Up @@ -605,7 +616,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
}

visible = menu_is_visible(child);
if (showAll || visible) {
if (!menuSkip(child)) {
if (!child->sym && !child->list && !child->prompt)
continue;
if (!item || item->menu != child)
Expand Down Expand Up @@ -834,7 +845,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
e->ignore();
}

ConfigView* ConfigView::viewList;
ConfigView*ConfigView::viewList;
QAction *ConfigView::showNormalAction;
QAction *ConfigView::showAllAction;
QAction *ConfigView::showPromptAction;

ConfigView::ConfigView(QWidget* parent, const char *name)
: Parent(parent, name)
Expand All @@ -859,13 +873,16 @@ ConfigView::~ConfigView(void)
}
}

void ConfigView::setShowAll(bool b)
void ConfigView::setOptionMode(QAction *act)
{
if (list->showAll != b) {
list->showAll = b;
list->updateListAll();
emit showAllChanged(b);
}
if (act == showNormalAction)
list->optMode = normalOpt;
else if (act == showAllAction)
list->optMode = allOpt;
else
list->optMode = promptOpt;

list->updateListAll();
}

void ConfigView::setShowName(bool b)
Expand Down Expand Up @@ -1320,11 +1337,24 @@ ConfigMainWindow::ConfigMainWindow(void)
connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
showDataAction->setOn(configList->showData);
QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this);
showAllAction->setToggleAction(TRUE);
connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool)));
connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool)));
showAllAction->setOn(configList->showAll);

QActionGroup *optGroup = new QActionGroup(this);
optGroup->setExclusive(TRUE);
connect(optGroup, SIGNAL(selected(QAction *)), configView,
SLOT(setOptionMode(QAction *)));
connect(optGroup, SIGNAL(selected(QAction *)), menuView,
SLOT(setOptionMode(QAction *)));

configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup);
configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup);
configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup);
configView->showNormalAction->setToggleAction(TRUE);
configView->showNormalAction->setOn(configList->optMode == normalOpt);
configView->showAllAction->setToggleAction(TRUE);
configView->showAllAction->setOn(configList->optMode == allOpt);
configView->showPromptAction->setToggleAction(TRUE);
configView->showPromptAction->setOn(configList->optMode == promptOpt);

QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
showDebugAction->setToggleAction(TRUE);
connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
Expand Down Expand Up @@ -1367,7 +1397,8 @@ ConfigMainWindow::ConfigMainWindow(void)
showRangeAction->addTo(optionMenu);
showDataAction->addTo(optionMenu);
optionMenu->insertSeparator();
showAllAction->addTo(optionMenu);
optGroup->addTo(optionMenu);
optionMenu->insertSeparator();
showDebugAction->addTo(optionMenu);

// create help menu
Expand Down Expand Up @@ -1462,7 +1493,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
ConfigList* list = NULL;
ConfigItem* item;

if (!menu_is_visible(menu) && !configView->showAll())
if (configList->menuSkip(menu))
return;

switch (configList->mode) {
Expand Down
16 changes: 12 additions & 4 deletions trunk/scripts/kconfig/qconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ enum colIdx {
enum listMode {
singleMode, menuMode, symbolMode, fullMode, listMode
};
enum optionMode {
normalOpt = 0, allOpt, promptOpt
};

class ConfigList : public QListView {
Q_OBJECT
Expand Down Expand Up @@ -115,6 +118,8 @@ public slots:
void setAllOpen(bool open);
void setParentMenu(void);

bool menuSkip(struct menu *);

template <class P>
void updateMenuList(P*, struct menu*);

Expand All @@ -124,8 +129,9 @@ public slots:
QPixmap choiceYesPix, choiceNoPix;
QPixmap menuPix, menuInvPix, menuBackPix, voidPix;

bool showAll, showName, showRange, showData;
bool showName, showRange, showData;
enum listMode mode;
enum optionMode optMode;
struct menu *rootEntry;
QColorGroup disabledColorGroup;
QColorGroup inactivedColorGroup;
Expand Down Expand Up @@ -222,17 +228,15 @@ class ConfigView : public QVBox {
static void updateList(ConfigItem* item);
static void updateListAll(void);

bool showAll(void) const { return list->showAll; }
bool showName(void) const { return list->showName; }
bool showRange(void) const { return list->showRange; }
bool showData(void) const { return list->showData; }
public slots:
void setShowAll(bool);
void setShowName(bool);
void setShowRange(bool);
void setShowData(bool);
void setOptionMode(QAction *);
signals:
void showAllChanged(bool);
void showNameChanged(bool);
void showRangeChanged(bool);
void showDataChanged(bool);
Expand All @@ -242,6 +246,10 @@ public slots:

static ConfigView* viewList;
ConfigView* nextView;

static QAction *showNormalAction;
static QAction *showAllAction;
static QAction *showPromptAction;
};

class ConfigInfoView : public QTextBrowser {
Expand Down

0 comments on commit 2b7bfeb

Please sign in to comment.