summaryrefslogtreecommitdiff
path: root/scripts/kconfig/qconf.cc
Side-by-side diff
Diffstat (limited to 'scripts/kconfig/qconf.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--scripts/kconfig/qconf.cc274
1 files changed, 202 insertions, 72 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index feefa1c..bed541d 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -19,2 +19,6 @@
#include <qregexp.h>
+#if QT_VERSION >= 300
+#include <qsettings.h>
+#endif
+
#include <stdlib.h>
@@ -28,2 +32,5 @@
static QApplication *configApp;
+#if QT_VERSION >= 300
+static QSettings *configSettings;
+#endif
@@ -75,5 +82,13 @@ static void updateMenuList(P* parent, struct menu* menu)
if (!item || item->menu != child)
- item = new ConfigItem(parent, last, child);
- item->visible = visible;
- item->updateMenu();
+ item = new ConfigItem(parent, last, child, visible);
+ else {
+ item->visible = visible;
+ if (item->updateNeeded()) {
+ ConfigItem* i = (ConfigItem*)child->data;
+ for (; i; i = i->nextItem) {
+ i->updateMenu();
+ }
+ } else if (list->updateAll)
+ item->updateMenu();
+ }
@@ -122,10 +137,4 @@ void ConfigItem::updateMenu(void)
tristate expr;
- bool update;
list = listView();
- update = doInit;
- if (update)
- doInit = false;
- else
- update = list->updateAll;
@@ -133,11 +142,9 @@ void ConfigItem::updateMenu(void)
if (!sym) {
- if (update) {
- setText(promptColIdx, menu_get_prompt(menu));
- ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
- if ((ptype == P_ROOTMENU || ptype == P_MENU) &&
- (list->mode == singleMode || list->mode == symbolMode))
- setPixmap(promptColIdx, list->menuPix);
- else
- setPixmap(promptColIdx, 0);
- }
+ setText(promptColIdx, menu_get_prompt(menu));
+ ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
+ if ((ptype == P_ROOTMENU || ptype == P_MENU) &&
+ (list->mode == singleMode || list->mode == symbolMode))
+ setPixmap(promptColIdx, list->menuPix);
+ else
+ setPixmap(promptColIdx, 0);
return;
@@ -145,9 +152,3 @@ void ConfigItem::updateMenu(void)
- sym_calc_value(sym);
- if (!(sym->flags & SYMBOL_CHANGED) && !update)
- return;
-
- sym->flags &= ~SYMBOL_CHANGED;
-
- setText(nameColIdx, menu->sym->name);
+ setText(nameColIdx, sym->name);
@@ -206,3 +207,5 @@ void ConfigItem::updateMenu(void)
#if QT_VERSION >= 300
- setRenameEnabled(list->mapIdx(dataColIdx), TRUE);
+ int i = list->mapIdx(dataColIdx);
+ if (i >= 0)
+ setRenameEnabled(i, TRUE);
#endif
@@ -220,2 +223,14 @@ void ConfigItem::updateMenu(void)
+bool ConfigItem::updateNeeded(void)
+{
+ struct symbol* sym = menu->sym;
+ if (sym)
+ sym_calc_value(sym);
+ if (menu->flags & MENU_CHANGED) {
+ menu->flags &= ~MENU_CHANGED;
+ return true;
+ }
+ return false;
+}
+
void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align)
@@ -239,9 +254,10 @@ void ConfigItem::init(void)
ConfigList* list = listView();
-#if QT_VERSION < 300
- visible = TRUE;
-#endif
- //menu->data = this;
+ nextItem = (ConfigItem*)menu->data;
+ menu->data = this;
+
if (list->mode != fullMode)
setOpen(TRUE);
- doInit= true;
+ if (menu->sym)
+ sym_calc_value(menu->sym);
+ updateMenu();
}
@@ -253,3 +269,9 @@ ConfigItem::~ConfigItem(void)
{
- //menu->data = 0;
+ ConfigItem** ip = &(ConfigItem*)menu->data;
+ for (; *ip; ip = &(*ip)->nextItem) {
+ if (*ip == this) {
+ *ip = nextItem;
+ break;
+ }
+ }
}
@@ -275,3 +297,3 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
sym_set_string_value(item->menu->sym, text().latin1());
- emit lineChanged(item);
+ parent()->updateList(item);
break;
@@ -282,2 +304,3 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
e->accept();
+ parent()->list->setFocus();
hide();
@@ -285,3 +308,3 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
-ConfigList::ConfigList(QWidget* p, ConfigView* cv)
+ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv)
: Parent(p), cview(cv),
@@ -354,2 +377,3 @@ void ConfigList::updateList(ConfigItem* item)
updateMenuList(this, rootEntry);
+ triggerUpdate();
}
@@ -384,3 +408,3 @@ void ConfigList::setValue(ConfigItem* item, tristate val)
item->setOpen(TRUE);
- emit symbolChanged(item);
+ parent()->updateList(item);
break;
@@ -416,3 +440,3 @@ void ConfigList::changeValue(ConfigItem* item)
if (oldexpr != newexpr)
- emit symbolChanged(item);
+ parent()->updateList(item);
break;
@@ -426,3 +450,3 @@ void ConfigList::changeValue(ConfigItem* item)
#endif
- lineEdit->show(item);
+ parent()->lineEdit->show(item);
break;
@@ -518,3 +542,3 @@ void ConfigList::contentsMousePressEvent(QMouseEvent* e)
//printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y());
- QListView::contentsMousePressEvent(e);
+ Parent::contentsMousePressEvent(e);
}
@@ -565,3 +589,3 @@ skip:
//printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y());
- QListView::contentsMouseReleaseEvent(e);
+ Parent::contentsMouseReleaseEvent(e);
}
@@ -572,3 +596,3 @@ void ConfigList::contentsMouseMoveEvent(QMouseEvent* e)
//printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y());
- QListView::contentsMouseMoveEvent(e);
+ Parent::contentsMouseMoveEvent(e);
}
@@ -589,2 +613,4 @@ void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e)
emit menuSelected(menu);
+ else if (menu->sym)
+ changeValue(item);
@@ -592,3 +618,3 @@ skip:
//printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y());
- QListView::contentsMouseDoubleClickEvent(e);
+ Parent::contentsMouseDoubleClickEvent(e);
}
@@ -607,2 +633,43 @@ void ConfigList::focusInEvent(QFocusEvent *e)
+ConfigView* ConfigView::viewList;
+
+ConfigView::ConfigView(QWidget* parent, ConfigMainWindow* cview)
+ : Parent(parent)
+{
+ list = new ConfigList(this, cview);
+ lineEdit = new ConfigLineEdit(this);
+ lineEdit->hide();
+
+ this->nextView = viewList;
+ viewList = this;
+}
+
+ConfigView::~ConfigView(void)
+{
+ ConfigView** vp;
+
+ for (vp = &viewList; *vp; vp = &(*vp)->nextView) {
+ if (*vp == this) {
+ *vp = nextView;
+ break;
+ }
+ }
+}
+
+void ConfigView::updateList(ConfigItem* item)
+{
+ ConfigView* v;
+
+ for (v = viewList; v; v = v->nextView)
+ v->list->updateList(item);
+}
+
+void ConfigView::updateListAll(void)
+{
+ ConfigView* v;
+
+ for (v = viewList; v; v = v->nextView)
+ v->list->updateListAll();
+}
+
/*
@@ -610,4 +677,5 @@ void ConfigList::focusInEvent(QFocusEvent *e)
*/
-ConfigView::ConfigView(void)
+ConfigMainWindow::ConfigMainWindow(void)
{
+ ConfigView* view;
QMenuBar* menu;
@@ -615,2 +683,21 @@ ConfigView::ConfigView(void)
QSplitter* split2;
+ bool ok;
+ int x, y, width, height;
+
+ QWidget *d = configApp->desktop();
+
+#if QT_VERSION >= 300
+ width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64);
+ height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64);
+ resize(width, height);
+ x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok);
+ if (ok)
+ y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok);
+ if (ok)
+ move(x, y);
+#else
+ width = d->width() - 64;
+ height = d->height() - 64;
+ resize(width, height);
+#endif
@@ -622,3 +709,4 @@ ConfigView::ConfigView(void)
- menuList = new ConfigList(split1, this);
+ view = new ConfigView(split1, this);
+ menuList = view->list;
@@ -628,12 +716,4 @@ ConfigView::ConfigView(void)
// create config tree
- QVBox* box = new QVBox(split2);
- configList = new ConfigList(box, this);
- configList->lineEdit = new ConfigLineEdit(box);
- configList->lineEdit->hide();
- configList->connect(configList, SIGNAL(symbolChanged(ConfigItem*)),
- configList, SLOT(updateList(ConfigItem*)));
- configList->connect(configList, SIGNAL(symbolChanged(ConfigItem*)),
- menuList, SLOT(updateList(ConfigItem*)));
- configList->connect(configList->lineEdit, SIGNAL(lineChanged(ConfigItem*)),
- SLOT(updateList(ConfigItem*)));
+ view = new ConfigView(split2, this);
+ configList = view->list;
@@ -687,2 +767,7 @@ ConfigView::ConfigView(void)
+ QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this);
+ connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
+ QAction *showAboutAction = new QAction(NULL, "About", 0, this);
+ connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
+
// init tool bar
@@ -716,2 +801,9 @@ ConfigView::ConfigView(void)
+ // create help menu
+ QPopupMenu* helpMenu = new QPopupMenu(this);
+ menu->insertSeparator();
+ menu->insertItem("&Help", helpMenu);
+ showIntroAction->addTo(helpMenu);
+ showAboutAction->addTo(helpMenu);
+
connect(configList, SIGNAL(menuSelected(struct menu *)),
@@ -771,3 +863,3 @@ static void expr_print_help(void *data, const char *str)
*/
-void ConfigView::setHelp(QListViewItem* item)
+void ConfigMainWindow::setHelp(QListViewItem* item)
{
@@ -776,3 +868,3 @@ void ConfigView::setHelp(QListViewItem* item)
- configList->lineEdit->hide();
+ configList->parent()->lineEdit->hide();
if (item) {
@@ -859,3 +951,3 @@ void ConfigView::setHelp(QListViewItem* item)
-void ConfigView::loadConfig(void)
+void ConfigMainWindow::loadConfig(void)
{
@@ -866,5 +958,6 @@ void ConfigView::loadConfig(void)
QMessageBox::information(this, "qconf", "Unable to load configuration!");
+ ConfigView::updateListAll();
}
-void ConfigView::saveConfig(void)
+void ConfigMainWindow::saveConfig(void)
{
@@ -874,3 +967,3 @@ void ConfigView::saveConfig(void)
-void ConfigView::saveConfigAs(void)
+void ConfigMainWindow::saveConfigAs(void)
{
@@ -883,3 +976,3 @@ void ConfigView::saveConfigAs(void)
-void ConfigView::changeMenu(struct menu *menu)
+void ConfigMainWindow::changeMenu(struct menu *menu)
{
@@ -889,3 +982,3 @@ void ConfigView::changeMenu(struct menu *menu)
-void ConfigView::listFocusChanged(void)
+void ConfigMainWindow::listFocusChanged(void)
{
@@ -900,3 +993,3 @@ void ConfigView::listFocusChanged(void)
-void ConfigView::goBack(void)
+void ConfigMainWindow::goBack(void)
{
@@ -917,3 +1010,3 @@ void ConfigView::goBack(void)
-void ConfigView::showSingleView(void)
+void ConfigMainWindow::showSingleView(void)
{
@@ -930,3 +1023,3 @@ void ConfigView::showSingleView(void)
-void ConfigView::showSplitView(void)
+void ConfigMainWindow::showSplitView(void)
{
@@ -946,3 +1039,3 @@ void ConfigView::showSplitView(void)
-void ConfigView::showFullView(void)
+void ConfigMainWindow::showFullView(void)
{
@@ -959,3 +1052,3 @@ void ConfigView::showFullView(void)
-void ConfigView::setShowAll(bool b)
+void ConfigMainWindow::setShowAll(bool b)
{
@@ -969,3 +1062,3 @@ void ConfigView::setShowAll(bool b)
-void ConfigView::setShowDebug(bool b)
+void ConfigMainWindow::setShowDebug(bool b)
{
@@ -976,3 +1069,3 @@ void ConfigView::setShowDebug(bool b)
-void ConfigView::setShowName(bool b)
+void ConfigMainWindow::setShowName(bool b)
{
@@ -984,3 +1077,3 @@ void ConfigView::setShowName(bool b)
-void ConfigView::setShowRange(bool b)
+void ConfigMainWindow::setShowRange(bool b)
{
@@ -992,3 +1085,3 @@ void ConfigView::setShowRange(bool b)
-void ConfigView::setShowData(bool b)
+void ConfigMainWindow::setShowData(bool b)
{
@@ -1004,3 +1097,3 @@ void ConfigView::setShowData(bool b)
*/
-void ConfigView::closeEvent(QCloseEvent* e)
+void ConfigMainWindow::closeEvent(QCloseEvent* e)
{
@@ -1027,2 +1120,27 @@ void ConfigView::closeEvent(QCloseEvent* e)
+void ConfigMainWindow::showIntro(void)
+{
+ static char str[] = "Welcome to the qconf graphical kernel configuration tool for Linux.\n\n"
+ "For each option, a blank box indicates the feature is disabled, a check\n"
+ "indicates it is enabled, and a dot indicates that it is to be compiled\n"
+ "as a module. Clicking on the box will cycle through the three states.\n\n"
+ "If you do not see an option (e.g., a device driver) that you believe\n"
+ "should be present, try turning on Show All Options under the Options menu.\n"
+ "Although there is no cross reference yet to help you figure out what other\n"
+ "options must be enabled to support the option you are interested in, you can\n"
+ "still view the help of a grayed-out option.\n\n"
+ "Toggling Show Debug Info under the Options menu will show the dependencies,\n"
+ "which you can then match by examining other options.\n\n";
+
+ QMessageBox::information(this, "qconf", str);
+}
+
+void ConfigMainWindow::showAbout(void)
+{
+ static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n"
+ "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n";
+
+ QMessageBox::information(this, "qconf", str);
+}
+
void fixup_rootmenu(struct menu *menu)
@@ -1040,3 +1158,3 @@ int main(int ac, char** av)
{
- ConfigView* v;
+ ConfigMainWindow* v;
const char *name;
@@ -1048,2 +1166,5 @@ int main(int ac, char** av)
configApp = new QApplication(ac, av);
+#if QT_VERSION >= 300
+ configSettings = new QSettings;
+#endif
if (ac > 1 && av[1][0] == '-') {
@@ -1065,3 +1186,4 @@ int main(int ac, char** av)
//zconfdump(stdout);
- v = new ConfigView();
+
+ v = new ConfigMainWindow();
@@ -1071,2 +1193,10 @@ int main(int ac, char** av)
configApp->exec();
+
+#if QT_VERSION >= 300
+ configSettings->writeEntry("/kconfig/qconf/window x", v->pos().x());
+ configSettings->writeEntry("/kconfig/qconf/window y", v->pos().y());
+ configSettings->writeEntry("/kconfig/qconf/window width", v->size().width());
+ configSettings->writeEntry("/kconfig/qconf/window height", v->size().height());
+ delete configSettings;
+#endif
return 0;