aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/qconf.cc
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/qconf.cc')
-rw-r--r--scripts/kconfig/qconf.cc486
1 files changed, 282 insertions, 204 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}