aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/kconfig/qconf.cc486
-rw-r--r--scripts/kconfig/qconf.h95
2 files changed, 343 insertions, 238 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 2befaeac6e64..f3f86e735a87 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -36,6 +36,7 @@
36#endif 36#endif
37 37
38static QApplication *configApp; 38static QApplication *configApp;
39static ConfigSettings *configSettings;
39 40
40static inline QString qgettext(const char* str) 41static inline QString qgettext(const char* str)
41{ 42{
@@ -47,23 +48,6 @@ static inline QString qgettext(const QString& str)
47 return QString::fromLocal8Bit(gettext(str.latin1())); 48 return QString::fromLocal8Bit(gettext(str.latin1()));
48} 49}
49 50
50ConfigSettings::ConfigSettings()
51 : showAll(false), showName(false), showRange(false), showData(false)
52{
53}
54
55#if QT_VERSION >= 300
56/**
57 * Reads the list column settings from the application settings.
58 */
59void ConfigSettings::readListSettings()
60{
61 showAll = readBoolEntry("/kconfig/qconf/showAll", false);
62 showName = readBoolEntry("/kconfig/qconf/showName", false);
63 showRange = readBoolEntry("/kconfig/qconf/showRange", false);
64 showData = readBoolEntry("/kconfig/qconf/showData", false);
65}
66
67/** 51/**
68 * Reads a list of integer values from the application settings. 52 * Reads a list of integer values from the application settings.
69 */ 53 */
@@ -92,76 +76,7 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value
92 stringList.push_back(QString::number(*it)); 76 stringList.push_back(QString::number(*it));
93 return writeEntry(key, stringList); 77 return writeEntry(key, stringList);
94} 78}
95#endif
96
97
98/*
99 * update all the children of a menu entry
100 * removes/adds the entries from the parent widget as necessary
101 *
102 * parent: either the menu list widget or a menu entry widget
103 * menu: entry to be updated
104 */
105template <class P>
106void ConfigList::updateMenuList(P* parent, struct menu* menu)
107{
108 struct menu* child;
109 ConfigItem* item;
110 ConfigItem* last;
111 bool visible;
112 enum prop_type type;
113
114 if (!menu) {
115 while ((item = parent->firstChild()))
116 delete item;
117 return;
118 }
119
120 last = parent->firstChild();
121 if (last && !last->goParent)
122 last = 0;
123 for (child = menu->list; child; child = child->next) {
124 item = last ? last->nextSibling() : parent->firstChild();
125 type = child->prompt ? child->prompt->type : P_UNKNOWN;
126
127 switch (mode) {
128 case menuMode:
129 if (!(child->flags & MENU_ROOT))
130 goto hide;
131 break;
132 case symbolMode:
133 if (child->flags & MENU_ROOT)
134 goto hide;
135 break;
136 default:
137 break;
138 }
139
140 visible = menu_is_visible(child);
141 if (showAll || visible) {
142 if (!item || item->menu != child)
143 item = new ConfigItem(parent, last, child, visible);
144 else
145 item->testUpdateMenu(visible);
146 79
147 if (mode == fullMode || mode == menuMode || type != P_MENU)
148 updateMenuList(item, child);
149 else
150 updateMenuList(item, 0);
151 last = item;
152 continue;
153 }
154 hide:
155 if (item && item->menu == child) {
156 last = parent->firstChild();
157 if (last == item)
158 last = 0;
159 else while (last->nextSibling() != item)
160 last = last->nextSibling();
161 delete item;
162 }
163 }
164}
165 80
166#if QT_VERSION >= 300 81#if QT_VERSION >= 300
167/* 82/*
@@ -395,14 +310,14 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
395 hide(); 310 hide();
396} 311}
397 312
398ConfigList::ConfigList(ConfigView* p, ConfigSettings* configSettings) 313ConfigList::ConfigList(ConfigView* p, const char *name)
399 : Parent(p), 314 : Parent(p, name),
400 updateAll(false), 315 updateAll(false),
401 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), 316 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
402 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), 317 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
403 menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), 318 menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void),
404 showAll(false), showName(false), showRange(false), showData(false), 319 showAll(false), showName(false), showRange(false), showData(false),
405 rootEntry(0) 320 rootEntry(0), headerPopup(0)
406{ 321{
407 int i; 322 int i;
408 323
@@ -416,11 +331,14 @@ ConfigList::ConfigList(ConfigView* p, ConfigSettings* configSettings)
416 connect(this, SIGNAL(selectionChanged(void)), 331 connect(this, SIGNAL(selectionChanged(void)),
417 SLOT(updateSelection(void))); 332 SLOT(updateSelection(void)));
418 333
419 if (configSettings) { 334 if (name) {
420 showAll = configSettings->showAll; 335 configSettings->beginGroup(name);
421 showName = configSettings->showName; 336 showAll = configSettings->readBoolEntry("/showAll", false);
422 showRange = configSettings->showRange; 337 showName = configSettings->readBoolEntry("/showName", false);
423 showData = configSettings->showData; 338 showRange = configSettings->readBoolEntry("/showRange", false);
339 showData = configSettings->readBoolEntry("/showData", false);
340 configSettings->endGroup();
341 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
424 } 342 }
425 343
426 for (i = 0; i < colNr; i++) 344 for (i = 0; i < colNr; i++)
@@ -451,6 +369,18 @@ void ConfigList::reinit(void)
451 updateListAll(); 369 updateListAll();
452} 370}
453 371
372void ConfigList::saveSettings(void)
373{
374 if (name()) {
375 configSettings->beginGroup(name());
376 configSettings->writeEntry("/showName", showName);
377 configSettings->writeEntry("/showRange", showRange);
378 configSettings->writeEntry("/showData", showData);
379 configSettings->writeEntry("/showAll", showAll);
380 configSettings->endGroup();
381 }
382}
383
454void ConfigList::updateSelection(void) 384void ConfigList::updateSelection(void)
455{ 385{
456 struct menu *menu; 386 struct menu *menu;
@@ -512,14 +442,6 @@ update:
512 triggerUpdate(); 442 triggerUpdate();
513} 443}
514 444
515void ConfigList::setAllOpen(bool open)
516{
517 QListViewItemIterator it(this);
518
519 for (; it.current(); it++)
520 it.current()->setOpen(open);
521}
522
523void ConfigList::setValue(ConfigItem* item, tristate val) 445void ConfigList::setValue(ConfigItem* item, tristate val)
524{ 446{
525 struct symbol* sym; 447 struct symbol* sym;
@@ -624,6 +546,74 @@ void ConfigList::setParentMenu(void)
624 } 546 }
625} 547}
626 548
549/*
550 * update all the children of a menu entry
551 * removes/adds the entries from the parent widget as necessary
552 *
553 * parent: either the menu list widget or a menu entry widget
554 * menu: entry to be updated
555 */
556template <class P>
557void ConfigList::updateMenuList(P* parent, struct menu* menu)
558{
559 struct menu* child;
560 ConfigItem* item;
561 ConfigItem* last;
562 bool visible;
563 enum prop_type type;
564
565 if (!menu) {
566 while ((item = parent->firstChild()))
567 delete item;
568 return;
569 }
570
571 last = parent->firstChild();
572 if (last && !last->goParent)
573 last = 0;
574 for (child = menu->list; child; child = child->next) {
575 item = last ? last->nextSibling() : parent->firstChild();
576 type = child->prompt ? child->prompt->type : P_UNKNOWN;
577
578 switch (mode) {
579 case menuMode:
580 if (!(child->flags & MENU_ROOT))
581 goto hide;
582 break;
583 case symbolMode:
584 if (child->flags & MENU_ROOT)
585 goto hide;
586 break;
587 default:
588 break;
589 }
590
591 visible = menu_is_visible(child);
592 if (showAll || visible) {
593 if (!item || item->menu != child)
594 item = new ConfigItem(parent, last, child, visible);
595 else
596 item->testUpdateMenu(visible);
597
598 if (mode == fullMode || mode == menuMode || type != P_MENU)
599 updateMenuList(item, child);
600 else
601 updateMenuList(item, 0);
602 last = item;
603 continue;
604 }
605 hide:
606 if (item && item->menu == child) {
607 last = parent->firstChild();
608 if (last == item)
609 last = 0;
610 else while (last->nextSibling() != item)
611 last = last->nextSibling();
612 delete item;
613 }
614 }
615}
616
627void ConfigList::keyPressEvent(QKeyEvent* ev) 617void ConfigList::keyPressEvent(QKeyEvent* ev)
628{ 618{
629 QListViewItem* i = currentItem(); 619 QListViewItem* i = currentItem();
@@ -786,12 +776,50 @@ void ConfigList::focusInEvent(QFocusEvent *e)
786 emit gotFocus(); 776 emit gotFocus();
787} 777}
788 778
779void ConfigList::contextMenuEvent(QContextMenuEvent *e)
780{
781 if (e->y() <= header()->geometry().bottom()) {
782 if (!headerPopup) {
783 QAction *action;
784
785 headerPopup = new QPopupMenu(this);
786 action = new QAction("Show Name", 0, this);
787 action->setToggleAction(TRUE);
788 connect(action, SIGNAL(toggled(bool)),
789 parent(), SLOT(setShowName(bool)));
790 connect(parent(), SIGNAL(showNameChanged(bool)),
791 action, SLOT(setOn(bool)));
792 action->setOn(showName);
793 action->addTo(headerPopup);
794 action = new QAction("Show Range", 0, this);
795 action->setToggleAction(TRUE);
796 connect(action, SIGNAL(toggled(bool)),
797 parent(), SLOT(setShowRange(bool)));
798 connect(parent(), SIGNAL(showRangeChanged(bool)),
799 action, SLOT(setOn(bool)));
800 action->setOn(showRange);
801 action->addTo(headerPopup);
802 action = new QAction("Show Data", 0, this);
803 action->setToggleAction(TRUE);
804 connect(action, SIGNAL(toggled(bool)),
805 parent(), SLOT(setShowData(bool)));
806 connect(parent(), SIGNAL(showDataChanged(bool)),
807 action, SLOT(setOn(bool)));
808 action->setOn(showData);
809 action->addTo(headerPopup);
810 }
811 headerPopup->exec(e->globalPos());
812 e->accept();
813 } else
814 e->ignore();
815}
816
789ConfigView* ConfigView::viewList; 817ConfigView* ConfigView::viewList;
790 818
791ConfigView::ConfigView(QWidget* parent, ConfigSettings *configSettings) 819ConfigView::ConfigView(QWidget* parent, const char *name)
792 : Parent(parent) 820 : Parent(parent, name)
793{ 821{
794 list = new ConfigList(this, configSettings); 822 list = new ConfigList(this, name);
795 lineEdit = new ConfigLineEdit(this); 823 lineEdit = new ConfigLineEdit(this);
796 lineEdit->hide(); 824 lineEdit->hide();
797 825
@@ -811,6 +839,50 @@ ConfigView::~ConfigView(void)
811 } 839 }
812} 840}
813 841
842void ConfigView::setShowAll(bool b)
843{
844 if (list->showAll != b) {
845 list->showAll = b;
846 list->updateListAll();
847 emit showAllChanged(b);
848 }
849}
850
851void ConfigView::setShowName(bool b)
852{
853 if (list->showName != b) {
854 list->showName = b;
855 list->reinit();
856 emit showNameChanged(b);
857 }
858}
859
860void ConfigView::setShowRange(bool b)
861{
862 if (list->showRange != b) {
863 list->showRange = b;
864 list->reinit();
865 emit showRangeChanged(b);
866 }
867}
868
869void ConfigView::setShowData(bool b)
870{
871 if (list->showData != b) {
872 list->showData = b;
873 list->reinit();
874 emit showDataChanged(b);
875 }
876}
877
878void ConfigList::setAllOpen(bool open)
879{
880 QListViewItemIterator it(this);
881
882 for (; it.current(); it++)
883 it.current()->setOpen(open);
884}
885
814void ConfigView::updateList(ConfigItem* item) 886void ConfigView::updateList(ConfigItem* item)
815{ 887{
816 ConfigView* v; 888 ConfigView* v;
@@ -830,6 +902,21 @@ void ConfigView::updateListAll(void)
830ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) 902ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
831 : Parent(parent, name), menu(0) 903 : Parent(parent, name), menu(0)
832{ 904{
905 if (name) {
906 configSettings->beginGroup(name);
907 _showDebug = configSettings->readBoolEntry("/showDebug", false);
908 configSettings->endGroup();
909 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
910 }
911}
912
913void ConfigInfoView::saveSettings(void)
914{
915 if (name()) {
916 configSettings->beginGroup(name());
917 configSettings->writeEntry("/showDebug", showDebug());
918 configSettings->endGroup();
919 }
833} 920}
834 921
835void ConfigInfoView::setShowDebug(bool b) 922void ConfigInfoView::setShowDebug(bool b)
@@ -1006,8 +1093,26 @@ void ConfigInfoView::expr_print_help(void *data, const char *str)
1006 reinterpret_cast<QString*>(data)->append(print_filter(str)); 1093 reinterpret_cast<QString*>(data)->append(print_filter(str));
1007} 1094}
1008 1095
1009ConfigSearchWindow::ConfigSearchWindow(QWidget* parent) 1096QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
1010 : Parent(parent), result(NULL) 1097{
1098 QPopupMenu* popup = Parent::createPopupMenu(pos);
1099 QAction* action = new QAction("Show Debug Info", 0, popup);
1100 action->setToggleAction(TRUE);
1101 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
1102 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
1103 action->setOn(showDebug());
1104 popup->insertSeparator();
1105 action->addTo(popup);
1106 return popup;
1107}
1108
1109void ConfigInfoView::contentsContextMenuEvent(QContextMenuEvent *e)
1110{
1111 Parent::contentsContextMenuEvent(e);
1112}
1113
1114ConfigSearchWindow::ConfigSearchWindow(QWidget* parent, const char *name)
1115 : Parent(parent, name), result(NULL)
1011{ 1116{
1012 setCaption("Search Config"); 1117 setCaption("Search Config");
1013 1118
@@ -1023,14 +1128,47 @@ ConfigSearchWindow::ConfigSearchWindow(QWidget* parent)
1023 layout2->addWidget(searchButton); 1128 layout2->addWidget(searchButton);
1024 layout1->addLayout(layout2); 1129 layout1->addLayout(layout2);
1025 1130
1026 QSplitter* split = new QSplitter(this); 1131 split = new QSplitter(this);
1027 split->setOrientation(QSplitter::Vertical); 1132 split->setOrientation(QSplitter::Vertical);
1028 list = new ConfigView(split, NULL); 1133 list = new ConfigView(split, name);
1029 list->list->mode = listMode; 1134 list->list->mode = listMode;
1030 info = new ConfigInfoView(split); 1135 info = new ConfigInfoView(split, name);
1031 connect(list->list, SIGNAL(menuChanged(struct menu *)), 1136 connect(list->list, SIGNAL(menuChanged(struct menu *)),
1032 info, SLOT(setInfo(struct menu *))); 1137 info, SLOT(setInfo(struct menu *)));
1033 layout1->addWidget(split); 1138 layout1->addWidget(split);
1139
1140 if (name) {
1141 int x, y, width, height;
1142 bool ok;
1143
1144 configSettings->beginGroup(name);
1145 width = configSettings->readNumEntry("/window width", parent->width() / 2);
1146 height = configSettings->readNumEntry("/window height", parent->height() / 2);
1147 resize(width, height);
1148 x = configSettings->readNumEntry("/window x", 0, &ok);
1149 if (ok)
1150 y = configSettings->readNumEntry("/window y", 0, &ok);
1151 if (ok)
1152 move(x, y);
1153 QValueList<int> sizes = configSettings->readSizes("/split", &ok);
1154 if (ok)
1155 split->setSizes(sizes);
1156 configSettings->endGroup();
1157 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
1158 }
1159}
1160
1161void ConfigSearchWindow::saveSettings(void)
1162{
1163 if (name()) {
1164 configSettings->beginGroup(name());
1165 configSettings->writeEntry("/window x", pos().x());
1166 configSettings->writeEntry("/window y", pos().y());
1167 configSettings->writeEntry("/window width", size().width());
1168 configSettings->writeEntry("/window height", size().height());
1169 configSettings->writeSizes("/split", split->sizes());
1170 configSettings->endGroup();
1171 }
1034} 1172}
1035 1173
1036void ConfigSearchWindow::search(void) 1174void ConfigSearchWindow::search(void)
@@ -1058,49 +1196,36 @@ void ConfigSearchWindow::search(void)
1058ConfigMainWindow::ConfigMainWindow(void) 1196ConfigMainWindow::ConfigMainWindow(void)
1059{ 1197{
1060 QMenuBar* menu; 1198 QMenuBar* menu;
1061 bool ok, showDebug; 1199 bool ok;
1062 int x, y, width, height; 1200 int x, y, width, height;
1063 1201
1064 QWidget *d = configApp->desktop(); 1202 QWidget *d = configApp->desktop();
1065 1203
1066 ConfigSettings* configSettings = new ConfigSettings(); 1204 width = configSettings->readNumEntry("/window width", d->width() - 64);
1067#if QT_VERSION >= 300 1205 height = configSettings->readNumEntry("/window height", d->height() - 64);
1068 width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64);
1069 height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64);
1070 resize(width, height); 1206 resize(width, height);
1071 x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok); 1207 x = configSettings->readNumEntry("/window x", 0, &ok);
1072 if (ok) 1208 if (ok)
1073 y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok); 1209 y = configSettings->readNumEntry("/window y", 0, &ok);
1074 if (ok) 1210 if (ok)
1075 move(x, y); 1211 move(x, y);
1076 showDebug = configSettings->readBoolEntry("/kconfig/qconf/showDebug", false);
1077
1078 // read list settings into configSettings, will be used later for ConfigList setup
1079 configSettings->readListSettings();
1080#else
1081 width = d->width() - 64;
1082 height = d->height() - 64;
1083 resize(width, height);
1084 showDebug = false;
1085#endif
1086 1212
1087 split1 = new QSplitter(this); 1213 split1 = new QSplitter(this);
1088 split1->setOrientation(QSplitter::Horizontal); 1214 split1->setOrientation(QSplitter::Horizontal);
1089 setCentralWidget(split1); 1215 setCentralWidget(split1);
1090 1216
1091 menuView = new ConfigView(split1, configSettings); 1217 menuView = new ConfigView(split1, "menu");
1092 menuList = menuView->list; 1218 menuList = menuView->list;
1093 1219
1094 split2 = new QSplitter(split1); 1220 split2 = new QSplitter(split1);
1095 split2->setOrientation(QSplitter::Vertical); 1221 split2->setOrientation(QSplitter::Vertical);
1096 1222
1097 // create config tree 1223 // create config tree
1098 configView = new ConfigView(split2, configSettings); 1224 configView = new ConfigView(split2, "config");
1099 configList = configView->list; 1225 configList = configView->list;
1100 1226
1101 helpText = new ConfigInfoView(split2); 1227 helpText = new ConfigInfoView(split2, "help");
1102 helpText->setTextFormat(Qt::RichText); 1228 helpText->setTextFormat(Qt::RichText);
1103 helpText->setShowDebug(showDebug);
1104 1229
1105 setTabOrder(configList, helpText); 1230 setTabOrder(configList, helpText);
1106 configList->setFocus(); 1231 configList->setFocus();
@@ -1130,25 +1255,29 @@ ConfigMainWindow::ConfigMainWindow(void)
1130 1255
1131 QAction *showNameAction = new QAction(NULL, "Show Name", 0, this); 1256 QAction *showNameAction = new QAction(NULL, "Show Name", 0, this);
1132 showNameAction->setToggleAction(TRUE); 1257 showNameAction->setToggleAction(TRUE);
1133 showNameAction->setOn(configList->showName); 1258 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
1134 connect(showNameAction, SIGNAL(toggled(bool)), SLOT(setShowName(bool))); 1259 connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
1260 showNameAction->setOn(configView->showName());
1135 QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this); 1261 QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this);
1136 showRangeAction->setToggleAction(TRUE); 1262 showRangeAction->setToggleAction(TRUE);
1263 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
1264 connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
1137 showRangeAction->setOn(configList->showRange); 1265 showRangeAction->setOn(configList->showRange);
1138 connect(showRangeAction, SIGNAL(toggled(bool)), SLOT(setShowRange(bool)));
1139 QAction *showDataAction = new QAction(NULL, "Show Data", 0, this); 1266 QAction *showDataAction = new QAction(NULL, "Show Data", 0, this);
1140 showDataAction->setToggleAction(TRUE); 1267 showDataAction->setToggleAction(TRUE);
1268 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
1269 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
1141 showDataAction->setOn(configList->showData); 1270 showDataAction->setOn(configList->showData);
1142 connect(showDataAction, SIGNAL(toggled(bool)), SLOT(setShowData(bool)));
1143 QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this); 1271 QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this);
1144 showAllAction->setToggleAction(TRUE); 1272 showAllAction->setToggleAction(TRUE);
1273 connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool)));
1274 connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool)));
1145 showAllAction->setOn(configList->showAll); 1275 showAllAction->setOn(configList->showAll);
1146 connect(showAllAction, SIGNAL(toggled(bool)), SLOT(setShowAll(bool)));
1147 QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this); 1276 QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this);
1148 showDebugAction->setToggleAction(TRUE); 1277 showDebugAction->setToggleAction(TRUE);
1149 showDebugAction->setOn(showDebug);
1150 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); 1278 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
1151 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); 1279 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
1280 showDebugAction->setOn(helpText->showDebug());
1152 1281
1153 QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this); 1282 QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this);
1154 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); 1283 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
@@ -1209,8 +1338,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1209 connect(menuList, SIGNAL(gotFocus(void)), 1338 connect(menuList, SIGNAL(gotFocus(void)),
1210 SLOT(listFocusChanged(void))); 1339 SLOT(listFocusChanged(void)));
1211 1340
1212#if QT_VERSION >= 300 1341 QString listMode = configSettings->readEntry("/listMode", "symbol");
1213 QString listMode = configSettings->readEntry("/kconfig/qconf/listMode", "symbol");
1214 if (listMode == "single") 1342 if (listMode == "single")
1215 showSingleView(); 1343 showSingleView();
1216 else if (listMode == "full") 1344 else if (listMode == "full")
@@ -1219,17 +1347,13 @@ ConfigMainWindow::ConfigMainWindow(void)
1219 showSplitView(); 1347 showSplitView();
1220 1348
1221 // UI setup done, restore splitter positions 1349 // UI setup done, restore splitter positions
1222 QValueList<int> sizes = configSettings->readSizes("/kconfig/qconf/split1", &ok); 1350 QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
1223 if (ok) 1351 if (ok)
1224 split1->setSizes(sizes); 1352 split1->setSizes(sizes);
1225 1353
1226 sizes = configSettings->readSizes("/kconfig/qconf/split2", &ok); 1354 sizes = configSettings->readSizes("/split2", &ok);
1227 if (ok) 1355 if (ok)
1228 split2->setSizes(sizes); 1356 split2->setSizes(sizes);
1229#else
1230 showSplitView();
1231#endif
1232 delete configSettings;
1233} 1357}
1234 1358
1235/* 1359/*
@@ -1237,7 +1361,6 @@ ConfigMainWindow::ConfigMainWindow(void)
1237 */ 1361 */
1238void ConfigMainWindow::setHelp(QListViewItem* item) 1362void ConfigMainWindow::setHelp(QListViewItem* item)
1239{ 1363{
1240 struct symbol* sym;
1241 struct menu* menu = 0; 1364 struct menu* menu = 0;
1242 1365
1243 if (item) 1366 if (item)
@@ -1273,7 +1396,7 @@ void ConfigMainWindow::saveConfigAs(void)
1273void ConfigMainWindow::searchConfig(void) 1396void ConfigMainWindow::searchConfig(void)
1274{ 1397{
1275 if (!searchWindow) 1398 if (!searchWindow)
1276 searchWindow = new ConfigSearchWindow(this); 1399 searchWindow = new ConfigSearchWindow(this, "search");
1277 searchWindow->show(); 1400 searchWindow->show();
1278} 1401}
1279 1402
@@ -1353,46 +1476,6 @@ void ConfigMainWindow::showFullView(void)
1353 configList->setFocus(); 1476 configList->setFocus();
1354} 1477}
1355 1478
1356void ConfigMainWindow::setShowAll(bool b)
1357{
1358 if (configList->showAll == b)
1359 return;
1360 configList->showAll = b;
1361 configList->updateListAll();
1362 menuList->showAll = b;
1363 menuList->updateListAll();
1364}
1365
1366void ConfigMainWindow::setShowName(bool b)
1367{
1368 if (configList->showName == b)
1369 return;
1370 configList->showName = b;
1371 configList->reinit();
1372 menuList->showName = b;
1373 menuList->reinit();
1374}
1375
1376void ConfigMainWindow::setShowRange(bool b)
1377{
1378 if (configList->showRange == b)
1379 return;
1380 configList->showRange = b;
1381 configList->reinit();
1382 menuList->showRange = b;
1383 menuList->reinit();
1384}
1385
1386void ConfigMainWindow::setShowData(bool b)
1387{
1388 if (configList->showData == b)
1389 return;
1390 configList->showData = b;
1391 configList->reinit();
1392 menuList->showData = b;
1393 menuList->reinit();
1394}
1395
1396/* 1479/*
1397 * ask for saving configuration before quitting 1480 * ask for saving configuration before quitting
1398 * TODO ask only when something changed 1481 * TODO ask only when something changed
@@ -1447,17 +1530,10 @@ void ConfigMainWindow::showAbout(void)
1447 1530
1448void ConfigMainWindow::saveSettings(void) 1531void ConfigMainWindow::saveSettings(void)
1449{ 1532{
1450#if QT_VERSION >= 300 1533 configSettings->writeEntry("/window x", pos().x());
1451 ConfigSettings *configSettings = new ConfigSettings; 1534 configSettings->writeEntry("/window y", pos().y());
1452 configSettings->writeEntry("/kconfig/qconf/window x", pos().x()); 1535 configSettings->writeEntry("/window width", size().width());
1453 configSettings->writeEntry("/kconfig/qconf/window y", pos().y()); 1536 configSettings->writeEntry("/window height", size().height());
1454 configSettings->writeEntry("/kconfig/qconf/window width", size().width());
1455 configSettings->writeEntry("/kconfig/qconf/window height", size().height());
1456 configSettings->writeEntry("/kconfig/qconf/showName", configList->showName);
1457 configSettings->writeEntry("/kconfig/qconf/showRange", configList->showRange);
1458 configSettings->writeEntry("/kconfig/qconf/showData", configList->showData);
1459 configSettings->writeEntry("/kconfig/qconf/showAll", configList->showAll);
1460 configSettings->writeEntry("/kconfig/qconf/showDebug", helpText->showDebug());
1461 1537
1462 QString entry; 1538 QString entry;
1463 switch(configList->mode) { 1539 switch(configList->mode) {
@@ -1473,13 +1549,10 @@ void ConfigMainWindow::saveSettings(void)
1473 entry = "full"; 1549 entry = "full";
1474 break; 1550 break;
1475 } 1551 }
1476 configSettings->writeEntry("/kconfig/qconf/listMode", entry); 1552 configSettings->writeEntry("/listMode", entry);
1477 1553
1478 configSettings->writeSizes("/kconfig/qconf/split1", split1->sizes()); 1554 configSettings->writeSizes("/split1", split1->sizes());
1479 configSettings->writeSizes("/kconfig/qconf/split2", split2->sizes()); 1555 configSettings->writeSizes("/split2", split2->sizes());
1480
1481 delete configSettings;
1482#endif
1483} 1556}
1484 1557
1485void fixup_rootmenu(struct menu *menu) 1558void fixup_rootmenu(struct menu *menu)
@@ -1537,6 +1610,8 @@ int main(int ac, char** av)
1537 conf_read(NULL); 1610 conf_read(NULL);
1538 //zconfdump(stdout); 1611 //zconfdump(stdout);
1539 1612
1613 configSettings = new ConfigSettings();
1614 configSettings->beginGroup("/kconfig/qconf");
1540 v = new ConfigMainWindow(); 1615 v = new ConfigMainWindow();
1541 1616
1542 //zconfdump(stdout); 1617 //zconfdump(stdout);
@@ -1546,5 +1621,8 @@ int main(int ac, char** av)
1546 v->show(); 1621 v->show();
1547 configApp->exec(); 1622 configApp->exec();
1548 1623
1624 configSettings->endGroup();
1625 delete configSettings;
1626
1549 return 0; 1627 return 0;
1550} 1628}
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index a548d13149b3..fb50e1c6029f 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -7,9 +7,25 @@
7#if QT_VERSION >= 300 7#if QT_VERSION >= 300
8#include <qsettings.h> 8#include <qsettings.h>
9#else 9#else
10class QSettings { }; 10class QSettings {
11public:
12 void beginGroup(const QString& group) { }
13 void endGroup(void) { }
14 bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
15 { if (ok) *ok = FALSE; return def; }
16 int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
17 { if (ok) *ok = FALSE; return def; }
18 QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
19 { if (ok) *ok = FALSE; return def; }
20 QStringList readListEntry(const QString& key, bool* ok = 0) const
21 { if (ok) *ok = FALSE; return QStringList(); }
22 template <class t>
23 bool writeEntry(const QString& key, t value)
24 { return TRUE; }
25};
11#endif 26#endif
12 27
28class ConfigView;
13class ConfigList; 29class ConfigList;
14class ConfigItem; 30class ConfigItem;
15class ConfigLineEdit; 31class ConfigLineEdit;
@@ -18,35 +34,8 @@ class ConfigMainWindow;
18 34
19class ConfigSettings : public QSettings { 35class ConfigSettings : public QSettings {
20public: 36public:
21 ConfigSettings();
22
23#if QT_VERSION >= 300
24 void readListSettings();
25 QValueList<int> readSizes(const QString& key, bool *ok); 37 QValueList<int> readSizes(const QString& key, bool *ok);
26 bool writeSizes(const QString& key, const QValueList<int>& value); 38 bool writeSizes(const QString& key, const QValueList<int>& value);
27#endif
28
29 bool showAll;
30 bool showName;
31 bool showRange;
32 bool showData;
33};
34
35class ConfigView : public QVBox {
36 Q_OBJECT
37 typedef class QVBox Parent;
38public:
39 ConfigView(QWidget* parent, ConfigSettings* configSettings);
40 ~ConfigView(void);
41 static void updateList(ConfigItem* item);
42 static void updateListAll(void);
43
44public:
45 ConfigList* list;
46 ConfigLineEdit* lineEdit;
47
48 static ConfigView* viewList;
49 ConfigView* nextView;
50}; 39};
51 40
52enum colIdx { 41enum colIdx {
@@ -60,7 +49,7 @@ class ConfigList : public QListView {
60 Q_OBJECT 49 Q_OBJECT
61 typedef class QListView Parent; 50 typedef class QListView Parent;
62public: 51public:
63 ConfigList(ConfigView* p, ConfigSettings *configSettings); 52 ConfigList(ConfigView* p, const char *name = 0);
64 void reinit(void); 53 void reinit(void);
65 ConfigView* parent(void) const 54 ConfigView* parent(void) const
66 { 55 {
@@ -74,6 +63,8 @@ protected:
74 void contentsMouseMoveEvent(QMouseEvent *e); 63 void contentsMouseMoveEvent(QMouseEvent *e);
75 void contentsMouseDoubleClickEvent(QMouseEvent *e); 64 void contentsMouseDoubleClickEvent(QMouseEvent *e);
76 void focusInEvent(QFocusEvent *e); 65 void focusInEvent(QFocusEvent *e);
66 void contextMenuEvent(QContextMenuEvent *e);
67
77public slots: 68public slots:
78 void setRootMenu(struct menu *menu); 69 void setRootMenu(struct menu *menu);
79 70
@@ -81,6 +72,7 @@ public slots:
81 void setValue(ConfigItem* item, tristate val); 72 void setValue(ConfigItem* item, tristate val);
82 void changeValue(ConfigItem* item); 73 void changeValue(ConfigItem* item);
83 void updateSelection(void); 74 void updateSelection(void);
75 void saveSettings(void);
84signals: 76signals:
85 void menuChanged(struct menu *menu); 77 void menuChanged(struct menu *menu);
86 void menuSelected(struct menu *menu); 78 void menuSelected(struct menu *menu);
@@ -136,6 +128,7 @@ public:
136 struct menu *rootEntry; 128 struct menu *rootEntry;
137 QColorGroup disabledColorGroup; 129 QColorGroup disabledColorGroup;
138 QColorGroup inactivedColorGroup; 130 QColorGroup inactivedColorGroup;
131 QPopupMenu* headerPopup;
139 132
140private: 133private:
141 int colMap[colNr]; 134 int colMap[colNr];
@@ -219,6 +212,37 @@ public:
219 ConfigItem *item; 212 ConfigItem *item;
220}; 213};
221 214
215class ConfigView : public QVBox {
216 Q_OBJECT
217 typedef class QVBox Parent;
218public:
219 ConfigView(QWidget* parent, const char *name = 0);
220 ~ConfigView(void);
221 static void updateList(ConfigItem* item);
222 static void updateListAll(void);
223
224 bool showAll(void) const { return list->showAll; }
225 bool showName(void) const { return list->showName; }
226 bool showRange(void) const { return list->showRange; }
227 bool showData(void) const { return list->showData; }
228public slots:
229 void setShowAll(bool);
230 void setShowName(bool);
231 void setShowRange(bool);
232 void setShowData(bool);
233signals:
234 void showAllChanged(bool);
235 void showNameChanged(bool);
236 void showRangeChanged(bool);
237 void showDataChanged(bool);
238public:
239 ConfigList* list;
240 ConfigLineEdit* lineEdit;
241
242 static ConfigView* viewList;
243 ConfigView* nextView;
244};
245
222class ConfigInfoView : public QTextBrowser { 246class ConfigInfoView : public QTextBrowser {
223 Q_OBJECT 247 Q_OBJECT
224 typedef class QTextBrowser Parent; 248 typedef class QTextBrowser Parent;
@@ -228,6 +252,7 @@ public:
228 252
229public slots: 253public slots:
230 void setInfo(struct menu *menu); 254 void setInfo(struct menu *menu);
255 void saveSettings(void);
231 void setSource(const QString& name); 256 void setSource(const QString& name);
232 void setShowDebug(bool); 257 void setShowDebug(bool);
233 258
@@ -239,6 +264,8 @@ protected:
239 QString debug_info(struct symbol *sym); 264 QString debug_info(struct symbol *sym);
240 static QString print_filter(const QString &str); 265 static QString print_filter(const QString &str);
241 static void expr_print_help(void *data, const char *str); 266 static void expr_print_help(void *data, const char *str);
267 QPopupMenu* createPopupMenu(const QPoint& pos);
268 void contentsContextMenuEvent(QContextMenuEvent *e);
242 269
243 struct menu *menu; 270 struct menu *menu;
244 bool _showDebug; 271 bool _showDebug;
@@ -248,12 +275,16 @@ class ConfigSearchWindow : public QDialog {
248 Q_OBJECT 275 Q_OBJECT
249 typedef class QDialog Parent; 276 typedef class QDialog Parent;
250public: 277public:
251 ConfigSearchWindow(QWidget* parent); 278 ConfigSearchWindow(QWidget* parent, const char *name = 0);
279
252public slots: 280public slots:
281 void saveSettings(void);
253 void search(void); 282 void search(void);
283
254protected: 284protected:
255 QLineEdit* editField; 285 QLineEdit* editField;
256 QPushButton* searchButton; 286 QPushButton* searchButton;
287 QSplitter* split;
257 ConfigView* list; 288 ConfigView* list;
258 ConfigInfoView* info; 289 ConfigInfoView* info;
259 290
@@ -276,10 +307,6 @@ public slots:
276 void showSingleView(void); 307 void showSingleView(void);
277 void showSplitView(void); 308 void showSplitView(void);
278 void showFullView(void); 309 void showFullView(void);
279 void setShowAll(bool);
280 void setShowRange(bool);
281 void setShowName(bool);
282 void setShowData(bool);
283 void showIntro(void); 310 void showIntro(void);
284 void showAbout(void); 311 void showAbout(void);
285 void saveSettings(void); 312 void saveSettings(void);