Skip to content

Commit

Permalink
kconfig: qconf: move setOptionMode() to ConfigList from ConfigView
Browse files Browse the repository at this point in the history
ConfigView::setOptionMode() only gets access to the 'list' member.

Move it to the more relevant ConfigList class.

Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
masahir0y committed Aug 14, 2020
1 parent fa8de0a commit d4bbe8a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
46 changes: 23 additions & 23 deletions scripts/kconfig/qconf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,18 @@ void ConfigList::reinit(void)
updateListAll();
}

void ConfigList::setOptionMode(QAction *action)
{
if (action == showNormalAction)
optMode = normalOpt;
else if (action == showAllAction)
optMode = allOpt;
else
optMode = promptOpt;

updateListAll();
}

void ConfigList::saveSettings(void)
{
if (!objectName().isEmpty()) {
Expand Down Expand Up @@ -901,9 +913,9 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
}

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

ConfigView::ConfigView(QWidget* parent, const char *name)
: Parent(parent)
Expand Down Expand Up @@ -934,18 +946,6 @@ ConfigView::~ConfigView(void)
}
}

void ConfigView::setOptionMode(QAction *act)
{
if (act == showNormalAction)
list->optMode = normalOpt;
else if (act == showAllAction)
list->optMode = allOpt;
else
list->optMode = promptOpt;

list->updateListAll();
}

void ConfigView::setShowName(bool b)
{
if (list->showName != b) {
Expand Down Expand Up @@ -1488,17 +1488,17 @@ ConfigMainWindow::ConfigMainWindow(void)

QActionGroup *optGroup = new QActionGroup(this);
optGroup->setExclusive(true);
connect(optGroup, SIGNAL(triggered(QAction*)), configView,
connect(optGroup, SIGNAL(triggered(QAction*)), configList,
SLOT(setOptionMode(QAction *)));
connect(optGroup, SIGNAL(triggered(QAction *)), menuView,
connect(optGroup, SIGNAL(triggered(QAction *)), menuList,
SLOT(setOptionMode(QAction *)));

configView->showNormalAction = new QAction("Show Normal Options", optGroup);
configView->showAllAction = new QAction("Show All Options", optGroup);
configView->showPromptAction = new QAction("Show Prompt Options", optGroup);
configView->showNormalAction->setCheckable(true);
configView->showAllAction->setCheckable(true);
configView->showPromptAction->setCheckable(true);
ConfigList::showNormalAction = new QAction("Show Normal Options", optGroup);
ConfigList::showNormalAction->setCheckable(true);
ConfigList::showAllAction = new QAction("Show All Options", optGroup);
ConfigList::showAllAction->setCheckable(true);
ConfigList::showPromptAction = new QAction("Show Prompt Options", optGroup);
ConfigList::showPromptAction->setCheckable(true);

QAction *showDebugAction = new QAction("Show Debug Info", this);
showDebugAction->setCheckable(true);
Expand Down
9 changes: 4 additions & 5 deletions scripts/kconfig/qconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ public slots:
void changeValue(ConfigItem* item);
void updateSelection(void);
void saveSettings(void);
void setOptionMode(QAction *action);

signals:
void menuChanged(struct menu *menu);
void menuSelected(struct menu *menu);
Expand Down Expand Up @@ -105,6 +107,8 @@ public slots:
QPalette disabledColorGroup;
QPalette inactivedColorGroup;
QMenu* headerPopup;

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

class ConfigItem : public QTreeWidgetItem {
Expand Down Expand Up @@ -196,7 +200,6 @@ public slots:
void setShowName(bool);
void setShowRange(bool);
void setShowData(bool);
void setOptionMode(QAction *);
signals:
void showNameChanged(bool);
void showRangeChanged(bool);
Expand All @@ -207,10 +210,6 @@ 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 d4bbe8a

Please sign in to comment.