summaryrefslogtreecommitdiff
path: root/scripts/kconfig/qconf.cc
Unidiff
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
@@ -17,6 +17,10 @@
17#include <qheader.h> 17#include <qheader.h>
18#include <qfiledialog.h> 18#include <qfiledialog.h>
19#include <qregexp.h> 19#include <qregexp.h>
20#if QT_VERSION >= 300
21#include <qsettings.h>
22#endif
23
20#include <stdlib.h> 24#include <stdlib.h>
21 25
22#include "lkc.h" 26#include "lkc.h"
@@ -26,6 +30,9 @@
26#include "images.c" 30#include "images.c"
27 31
28static QApplication *configApp; 32static QApplication *configApp;
33#if QT_VERSION >= 300
34static QSettings *configSettings;
35#endif
29 36
30/* 37/*
31 * update all the children of a menu entry 38 * update all the children of a menu entry
@@ -73,9 +80,17 @@ static void updateMenuList(P* parent, struct menu* menu)
73 visible = menu_is_visible(child); 80 visible = menu_is_visible(child);
74 if (showAll || visible) { 81 if (showAll || visible) {
75 if (!item || item->menu != child) 82 if (!item || item->menu != child)
76 item = new ConfigItem(parent, last, child); 83 item = new ConfigItem(parent, last, child, visible);
77 item->visible = visible; 84 else {
78 item->updateMenu(); 85 item->visible = visible;
86 if (item->updateNeeded()) {
87 ConfigItem* i = (ConfigItem*)child->data;
88 for (; i; i = i->nextItem) {
89 i->updateMenu();
90 }
91 } else if (list->updateAll)
92 item->updateMenu();
93 }
79 94
80 if (mode == fullMode || mode == menuMode || 95 if (mode == fullMode || mode == menuMode ||
81 (type != P_MENU && type != P_ROOTMENU)) 96 (type != P_MENU && type != P_ROOTMENU))
@@ -120,36 +135,22 @@ void ConfigItem::updateMenu(void)
120 int type; 135 int type;
121 enum prop_type ptype; 136 enum prop_type ptype;
122 tristate expr; 137 tristate expr;
123 bool update;
124 138
125 list = listView(); 139 list = listView();
126 update = doInit;
127 if (update)
128 doInit = false;
129 else
130 update = list->updateAll;
131 140
132 sym = menu->sym; 141 sym = menu->sym;
133 if (!sym) { 142 if (!sym) {
134 if (update) { 143 setText(promptColIdx, menu_get_prompt(menu));
135 setText(promptColIdx, menu_get_prompt(menu)); 144 ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
136 ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; 145 if ((ptype == P_ROOTMENU || ptype == P_MENU) &&
137 if ((ptype == P_ROOTMENU || ptype == P_MENU) && 146 (list->mode == singleMode || list->mode == symbolMode))
138 (list->mode == singleMode || list->mode == symbolMode)) 147 setPixmap(promptColIdx, list->menuPix);
139 setPixmap(promptColIdx, list->menuPix); 148 else
140 else 149 setPixmap(promptColIdx, 0);
141 setPixmap(promptColIdx, 0);
142 }
143 return; 150 return;
144 } 151 }
145 152
146 sym_calc_value(sym); 153 setText(nameColIdx, sym->name);
147 if (!(sym->flags & SYMBOL_CHANGED) && !update)
148 return;
149
150 sym->flags &= ~SYMBOL_CHANGED;
151
152 setText(nameColIdx, menu->sym->name);
153 154
154 type = sym_get_type(sym); 155 type = sym_get_type(sym);
155 switch (type) { 156 switch (type) {
@@ -204,7 +205,9 @@ void ConfigItem::updateMenu(void)
204 205
205 data = sym_get_string_value(sym); 206 data = sym_get_string_value(sym);
206#if QT_VERSION >= 300 207#if QT_VERSION >= 300
207 setRenameEnabled(list->mapIdx(dataColIdx), TRUE); 208 int i = list->mapIdx(dataColIdx);
209 if (i >= 0)
210 setRenameEnabled(i, TRUE);
208#endif 211#endif
209 setText(dataColIdx, data); 212 setText(dataColIdx, data);
210 if (type == S_STRING) 213 if (type == S_STRING)
@@ -218,6 +221,18 @@ void ConfigItem::updateMenu(void)
218 setText(promptColIdx, prompt); 221 setText(promptColIdx, prompt);
219} 222}
220 223
224bool ConfigItem::updateNeeded(void)
225{
226 struct symbol* sym = menu->sym;
227 if (sym)
228 sym_calc_value(sym);
229 if (menu->flags & MENU_CHANGED) {
230 menu->flags &= ~MENU_CHANGED;
231 return true;
232 }
233 return false;
234}
235
221void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align) 236void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align)
222{ 237{
223 ConfigList* list = listView(); 238 ConfigList* list = listView();
@@ -237,13 +252,14 @@ void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int w
237void ConfigItem::init(void) 252void ConfigItem::init(void)
238{ 253{
239 ConfigList* list = listView(); 254 ConfigList* list = listView();
240#if QT_VERSION < 300 255 nextItem = (ConfigItem*)menu->data;
241 visible = TRUE; 256 menu->data = this;
242#endif 257
243 //menu->data = this;
244 if (list->mode != fullMode) 258 if (list->mode != fullMode)
245 setOpen(TRUE); 259 setOpen(TRUE);
246 doInit= true; 260 if (menu->sym)
261 sym_calc_value(menu->sym);
262 updateMenu();
247} 263}
248 264
249/* 265/*
@@ -251,7 +267,13 @@ void ConfigItem::init(void)
251 */ 267 */
252ConfigItem::~ConfigItem(void) 268ConfigItem::~ConfigItem(void)
253{ 269{
254 //menu->data = 0; 270 ConfigItem** ip = &(ConfigItem*)menu->data;
271 for (; *ip; ip = &(*ip)->nextItem) {
272 if (*ip == this) {
273 *ip = nextItem;
274 break;
275 }
276 }
255} 277}
256 278
257void ConfigLineEdit::show(ConfigItem* i) 279void ConfigLineEdit::show(ConfigItem* i)
@@ -273,17 +295,18 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
273 case Key_Return: 295 case Key_Return:
274 case Key_Enter: 296 case Key_Enter:
275 sym_set_string_value(item->menu->sym, text().latin1()); 297 sym_set_string_value(item->menu->sym, text().latin1());
276 emit lineChanged(item); 298 parent()->updateList(item);
277 break; 299 break;
278 default: 300 default:
279 Parent::keyPressEvent(e); 301 Parent::keyPressEvent(e);
280 return; 302 return;
281 } 303 }
282 e->accept(); 304 e->accept();
305 parent()->list->setFocus();
283 hide(); 306 hide();
284} 307}
285 308
286ConfigList::ConfigList(QWidget* p, ConfigView* cv) 309ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv)
287 : Parent(p), cview(cv), 310 : Parent(p), cview(cv),
288 updateAll(false), 311 updateAll(false),
289 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), 312 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
@@ -352,6 +375,7 @@ void ConfigList::updateList(ConfigItem* item)
352{ 375{
353 (void)item;// unused so far 376 (void)item;// unused so far
354 updateMenuList(this, rootEntry); 377 updateMenuList(this, rootEntry);
378 triggerUpdate();
355} 379}
356 380
357void ConfigList::setAllOpen(bool open) 381void ConfigList::setAllOpen(bool open)
@@ -382,7 +406,7 @@ void ConfigList::setValue(ConfigItem* item, tristate val)
382 return; 406 return;
383 if (oldval == no && item->menu->list) 407 if (oldval == no && item->menu->list)
384 item->setOpen(TRUE); 408 item->setOpen(TRUE);
385 emit symbolChanged(item); 409 parent()->updateList(item);
386 break; 410 break;
387 } 411 }
388} 412}
@@ -414,7 +438,7 @@ void ConfigList::changeValue(ConfigItem* item)
414 item->setOpen(TRUE); 438 item->setOpen(TRUE);
415 } 439 }
416 if (oldexpr != newexpr) 440 if (oldexpr != newexpr)
417 emit symbolChanged(item); 441 parent()->updateList(item);
418 break; 442 break;
419 case S_INT: 443 case S_INT:
420 case S_HEX: 444 case S_HEX:
@@ -424,7 +448,7 @@ void ConfigList::changeValue(ConfigItem* item)
424 item->startRename(colMap[dataColIdx]); 448 item->startRename(colMap[dataColIdx]);
425 else 449 else
426#endif 450#endif
427 lineEdit->show(item); 451 parent()->lineEdit->show(item);
428 break; 452 break;
429 } 453 }
430} 454}
@@ -516,7 +540,7 @@ void ConfigList::contentsMousePressEvent(QMouseEvent* e)
516{ 540{
517 //QPoint p(contentsToViewport(e->pos())); 541 //QPoint p(contentsToViewport(e->pos()));
518 //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y()); 542 //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y());
519 QListView::contentsMousePressEvent(e); 543 Parent::contentsMousePressEvent(e);
520} 544}
521 545
522void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e) 546void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e)
@@ -563,14 +587,14 @@ void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e)
563 587
564skip: 588skip:
565 //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y()); 589 //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y());
566 QListView::contentsMouseReleaseEvent(e); 590 Parent::contentsMouseReleaseEvent(e);
567} 591}
568 592
569void ConfigList::contentsMouseMoveEvent(QMouseEvent* e) 593void ConfigList::contentsMouseMoveEvent(QMouseEvent* e)
570{ 594{
571 //QPoint p(contentsToViewport(e->pos())); 595 //QPoint p(contentsToViewport(e->pos()));
572 //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y()); 596 //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y());
573 QListView::contentsMouseMoveEvent(e); 597 Parent::contentsMouseMoveEvent(e);
574} 598}
575 599
576void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e) 600void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e)
@@ -587,10 +611,12 @@ void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e)
587 if ((ptype == P_ROOTMENU || ptype == P_MENU) && 611 if ((ptype == P_ROOTMENU || ptype == P_MENU) &&
588 (mode == singleMode || mode == symbolMode)) 612 (mode == singleMode || mode == symbolMode))
589 emit menuSelected(menu); 613 emit menuSelected(menu);
614 else if (menu->sym)
615 changeValue(item);
590 616
591skip: 617skip:
592 //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y()); 618 //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y());
593 QListView::contentsMouseDoubleClickEvent(e); 619 Parent::contentsMouseDoubleClickEvent(e);
594} 620}
595 621
596void ConfigList::focusInEvent(QFocusEvent *e) 622void ConfigList::focusInEvent(QFocusEvent *e)
@@ -605,14 +631,75 @@ void ConfigList::focusInEvent(QFocusEvent *e)
605 emit gotFocus(); 631 emit gotFocus();
606} 632}
607 633
634ConfigView* ConfigView::viewList;
635
636ConfigView::ConfigView(QWidget* parent, ConfigMainWindow* cview)
637 : Parent(parent)
638{
639 list = new ConfigList(this, cview);
640 lineEdit = new ConfigLineEdit(this);
641 lineEdit->hide();
642
643 this->nextView = viewList;
644 viewList = this;
645}
646
647ConfigView::~ConfigView(void)
648{
649 ConfigView** vp;
650
651 for (vp = &viewList; *vp; vp = &(*vp)->nextView) {
652 if (*vp == this) {
653 *vp = nextView;
654 break;
655 }
656 }
657}
658
659void ConfigView::updateList(ConfigItem* item)
660{
661 ConfigView* v;
662
663 for (v = viewList; v; v = v->nextView)
664 v->list->updateList(item);
665}
666
667void ConfigView::updateListAll(void)
668{
669 ConfigView* v;
670
671 for (v = viewList; v; v = v->nextView)
672 v->list->updateListAll();
673}
674
608/* 675/*
609 * Construct the complete config widget 676 * Construct the complete config widget
610 */ 677 */
611ConfigView::ConfigView(void) 678ConfigMainWindow::ConfigMainWindow(void)
612{ 679{
680 ConfigView* view;
613 QMenuBar* menu; 681 QMenuBar* menu;
614 QSplitter* split1; 682 QSplitter* split1;
615 QSplitter* split2; 683 QSplitter* split2;
684 bool ok;
685 int x, y, width, height;
686
687 QWidget *d = configApp->desktop();
688
689#if QT_VERSION >= 300
690 width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64);
691 height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64);
692 resize(width, height);
693 x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok);
694 if (ok)
695 y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok);
696 if (ok)
697 move(x, y);
698#else
699 width = d->width() - 64;
700 height = d->height() - 64;
701 resize(width, height);
702#endif
616 703
617 showDebug = false; 704 showDebug = false;
618 705
@@ -620,22 +707,15 @@ ConfigView::ConfigView(void)
620 split1->setOrientation(QSplitter::Horizontal); 707 split1->setOrientation(QSplitter::Horizontal);
621 setCentralWidget(split1); 708 setCentralWidget(split1);
622 709
623 menuList = new ConfigList(split1, this); 710 view = new ConfigView(split1, this);
711 menuList = view->list;
624 712
625 split2 = new QSplitter(split1); 713 split2 = new QSplitter(split1);
626 split2->setOrientation(QSplitter::Vertical); 714 split2->setOrientation(QSplitter::Vertical);
627 715
628 // create config tree 716 // create config tree
629 QVBox* box = new QVBox(split2); 717 view = new ConfigView(split2, this);
630 configList = new ConfigList(box, this); 718 configList = view->list;
631 configList->lineEdit = new ConfigLineEdit(box);
632 configList->lineEdit->hide();
633 configList->connect(configList, SIGNAL(symbolChanged(ConfigItem*)),
634 configList, SLOT(updateList(ConfigItem*)));
635 configList->connect(configList, SIGNAL(symbolChanged(ConfigItem*)),
636 menuList, SLOT(updateList(ConfigItem*)));
637 configList->connect(configList->lineEdit, SIGNAL(lineChanged(ConfigItem*)),
638 SLOT(updateList(ConfigItem*)));
639 719
640 helpText = new QTextView(split2); 720 helpText = new QTextView(split2);
641 helpText->setTextFormat(Qt::RichText); 721 helpText->setTextFormat(Qt::RichText);
@@ -685,6 +765,11 @@ ConfigView::ConfigView(void)
685 showDebugAction->setOn(showDebug); 765 showDebugAction->setOn(showDebug);
686 connect(showDebugAction, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); 766 connect(showDebugAction, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
687 767
768 QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this);
769 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
770 QAction *showAboutAction = new QAction(NULL, "About", 0, this);
771 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
772
688 // init tool bar 773 // init tool bar
689 backAction->addTo(toolBar); 774 backAction->addTo(toolBar);
690 toolBar->addSeparator(); 775 toolBar->addSeparator();
@@ -714,6 +799,13 @@ ConfigView::ConfigView(void)
714 showAllAction->addTo(optionMenu); 799 showAllAction->addTo(optionMenu);
715 showDebugAction->addTo(optionMenu); 800 showDebugAction->addTo(optionMenu);
716 801
802 // create help menu
803 QPopupMenu* helpMenu = new QPopupMenu(this);
804 menu->insertSeparator();
805 menu->insertItem("&Help", helpMenu);
806 showIntroAction->addTo(helpMenu);
807 showAboutAction->addTo(helpMenu);
808
717 connect(configList, SIGNAL(menuSelected(struct menu *)), 809 connect(configList, SIGNAL(menuSelected(struct menu *)),
718 SLOT(changeMenu(struct menu *))); 810 SLOT(changeMenu(struct menu *)));
719 connect(configList, SIGNAL(parentSelected()), 811 connect(configList, SIGNAL(parentSelected()),
@@ -769,12 +861,12 @@ static void expr_print_help(void *data, const char *str)
769/* 861/*
770 * display a new help entry as soon as a new menu entry is selected 862 * display a new help entry as soon as a new menu entry is selected
771 */ 863 */
772void ConfigView::setHelp(QListViewItem* item) 864void ConfigMainWindow::setHelp(QListViewItem* item)
773{ 865{
774 struct symbol* sym; 866 struct symbol* sym;
775 struct menu* menu; 867 struct menu* menu;
776 868
777 configList->lineEdit->hide(); 869 configList->parent()->lineEdit->hide();
778 if (item) { 870 if (item) {
779 QString head, debug, help; 871 QString head, debug, help;
780 menu = ((ConfigItem*)item)->menu; 872 menu = ((ConfigItem*)item)->menu;
@@ -857,22 +949,23 @@ void ConfigView::setHelp(QListViewItem* item)
857 helpText->setText(NULL); 949 helpText->setText(NULL);
858} 950}
859 951
860void ConfigView::loadConfig(void) 952void ConfigMainWindow::loadConfig(void)
861{ 953{
862 QString s = QFileDialog::getOpenFileName(".config", NULL, this); 954 QString s = QFileDialog::getOpenFileName(".config", NULL, this);
863 if (s.isNull()) 955 if (s.isNull())
864 return; 956 return;
865 if (conf_read(s.latin1())) 957 if (conf_read(s.latin1()))
866 QMessageBox::information(this, "qconf", "Unable to load configuration!"); 958 QMessageBox::information(this, "qconf", "Unable to load configuration!");
959 ConfigView::updateListAll();
867} 960}
868 961
869void ConfigView::saveConfig(void) 962void ConfigMainWindow::saveConfig(void)
870{ 963{
871 if (conf_write(NULL)) 964 if (conf_write(NULL))
872 QMessageBox::information(this, "qconf", "Unable to save configuration!"); 965 QMessageBox::information(this, "qconf", "Unable to save configuration!");
873} 966}
874 967
875void ConfigView::saveConfigAs(void) 968void ConfigMainWindow::saveConfigAs(void)
876{ 969{
877 QString s = QFileDialog::getSaveFileName(".config", NULL, this); 970 QString s = QFileDialog::getSaveFileName(".config", NULL, this);
878 if (s.isNull()) 971 if (s.isNull())
@@ -881,13 +974,13 @@ void ConfigView::saveConfigAs(void)
881 QMessageBox::information(this, "qconf", "Unable to save configuration!"); 974 QMessageBox::information(this, "qconf", "Unable to save configuration!");
882} 975}
883 976
884void ConfigView::changeMenu(struct menu *menu) 977void ConfigMainWindow::changeMenu(struct menu *menu)
885{ 978{
886 configList->setRootMenu(menu); 979 configList->setRootMenu(menu);
887 backAction->setEnabled(TRUE); 980 backAction->setEnabled(TRUE);
888} 981}
889 982
890void ConfigView::listFocusChanged(void) 983void ConfigMainWindow::listFocusChanged(void)
891{ 984{
892 if (menuList->hasFocus()) { 985 if (menuList->hasFocus()) {
893 if (menuList->mode == menuMode) 986 if (menuList->mode == menuMode)
@@ -898,7 +991,7 @@ void ConfigView::listFocusChanged(void)
898 } 991 }
899} 992}
900 993
901void ConfigView::goBack(void) 994void ConfigMainWindow::goBack(void)
902{ 995{
903 ConfigItem* item; 996 ConfigItem* item;
904 997
@@ -915,7 +1008,7 @@ void ConfigView::goBack(void)
915 } 1008 }
916} 1009}
917 1010
918void ConfigView::showSingleView(void) 1011void ConfigMainWindow::showSingleView(void)
919{ 1012{
920 menuList->hide(); 1013 menuList->hide();
921 menuList->setRootMenu(0); 1014 menuList->setRootMenu(0);
@@ -928,7 +1021,7 @@ void ConfigView::showSingleView(void)
928 configList->setFocus(); 1021 configList->setFocus();
929} 1022}
930 1023
931void ConfigView::showSplitView(void) 1024void ConfigMainWindow::showSplitView(void)
932{ 1025{
933 configList->mode = symbolMode; 1026 configList->mode = symbolMode;
934 if (configList->rootEntry == &rootmenu) 1027 if (configList->rootEntry == &rootmenu)
@@ -944,7 +1037,7 @@ void ConfigView::showSplitView(void)
944 menuList->setFocus(); 1037 menuList->setFocus();
945} 1038}
946 1039
947void ConfigView::showFullView(void) 1040void ConfigMainWindow::showFullView(void)
948{ 1041{
949 menuList->hide(); 1042 menuList->hide();
950 menuList->setRootMenu(0); 1043 menuList->setRootMenu(0);
@@ -957,7 +1050,7 @@ void ConfigView::showFullView(void)
957 configList->setFocus(); 1050 configList->setFocus();
958} 1051}
959 1052
960void ConfigView::setShowAll(bool b) 1053void ConfigMainWindow::setShowAll(bool b)
961{ 1054{
962 if (configList->showAll == b) 1055 if (configList->showAll == b)
963 return; 1056 return;
@@ -967,14 +1060,14 @@ void ConfigView::setShowAll(bool b)
967 menuList->updateListAll(); 1060 menuList->updateListAll();
968} 1061}
969 1062
970void ConfigView::setShowDebug(bool b) 1063void ConfigMainWindow::setShowDebug(bool b)
971{ 1064{
972 if (showDebug == b) 1065 if (showDebug == b)
973 return; 1066 return;
974 showDebug = b; 1067 showDebug = b;
975} 1068}
976 1069
977void ConfigView::setShowName(bool b) 1070void ConfigMainWindow::setShowName(bool b)
978{ 1071{
979 if (configList->showName == b) 1072 if (configList->showName == b)
980 return; 1073 return;
@@ -982,7 +1075,7 @@ void ConfigView::setShowName(bool b)
982 configList->reinit(); 1075 configList->reinit();
983} 1076}
984 1077
985void ConfigView::setShowRange(bool b) 1078void ConfigMainWindow::setShowRange(bool b)
986{ 1079{
987 if (configList->showRange == b) 1080 if (configList->showRange == b)
988 return; 1081 return;
@@ -990,7 +1083,7 @@ void ConfigView::setShowRange(bool b)
990 configList->reinit(); 1083 configList->reinit();
991} 1084}
992 1085
993void ConfigView::setShowData(bool b) 1086void ConfigMainWindow::setShowData(bool b)
994{ 1087{
995 if (configList->showData == b) 1088 if (configList->showData == b)
996 return; 1089 return;
@@ -1002,7 +1095,7 @@ void ConfigView::setShowData(bool b)
1002 * ask for saving configuration before quitting 1095 * ask for saving configuration before quitting
1003 * TODO ask only when something changed 1096 * TODO ask only when something changed
1004 */ 1097 */
1005void ConfigView::closeEvent(QCloseEvent* e) 1098void ConfigMainWindow::closeEvent(QCloseEvent* e)
1006{ 1099{
1007 if (!sym_change_count) { 1100 if (!sym_change_count) {
1008 e->accept(); 1101 e->accept();
@@ -1025,6 +1118,31 @@ void ConfigView::closeEvent(QCloseEvent* e)
1025 } 1118 }
1026} 1119}
1027 1120
1121void ConfigMainWindow::showIntro(void)
1122{
1123 static char str[] = "Welcome to the qconf graphical kernel configuration tool for Linux.\n\n"
1124 "For each option, a blank box indicates the feature is disabled, a check\n"
1125 "indicates it is enabled, and a dot indicates that it is to be compiled\n"
1126 "as a module. Clicking on the box will cycle through the three states.\n\n"
1127 "If you do not see an option (e.g., a device driver) that you believe\n"
1128 "should be present, try turning on Show All Options under the Options menu.\n"
1129 "Although there is no cross reference yet to help you figure out what other\n"
1130 "options must be enabled to support the option you are interested in, you can\n"
1131 "still view the help of a grayed-out option.\n\n"
1132 "Toggling Show Debug Info under the Options menu will show the dependencies,\n"
1133 "which you can then match by examining other options.\n\n";
1134
1135 QMessageBox::information(this, "qconf", str);
1136}
1137
1138void ConfigMainWindow::showAbout(void)
1139{
1140 static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n"
1141 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n";
1142
1143 QMessageBox::information(this, "qconf", str);
1144}
1145
1028void fixup_rootmenu(struct menu *menu) 1146void fixup_rootmenu(struct menu *menu)
1029{ 1147{
1030 struct menu *child; 1148 struct menu *child;
@@ -1038,7 +1156,7 @@ void fixup_rootmenu(struct menu *menu)
1038 1156
1039int main(int ac, char** av) 1157int main(int ac, char** av)
1040{ 1158{
1041 ConfigView* v; 1159 ConfigMainWindow* v;
1042 const char *name; 1160 const char *name;
1043 1161
1044#ifndef LKC_DIRECT_LINK 1162#ifndef LKC_DIRECT_LINK
@@ -1046,6 +1164,9 @@ int main(int ac, char** av)
1046#endif 1164#endif
1047 1165
1048 configApp = new QApplication(ac, av); 1166 configApp = new QApplication(ac, av);
1167#if QT_VERSION >= 300
1168 configSettings = new QSettings;
1169#endif
1049 if (ac > 1 && av[1][0] == '-') { 1170 if (ac > 1 && av[1][0] == '-') {
1050 switch (av[1][1]) { 1171 switch (av[1][1]) {
1051 case 'a': 1172 case 'a':
@@ -1063,11 +1184,20 @@ int main(int ac, char** av)
1063 fixup_rootmenu(&rootmenu); 1184 fixup_rootmenu(&rootmenu);
1064 conf_read(NULL); 1185 conf_read(NULL);
1065 //zconfdump(stdout); 1186 //zconfdump(stdout);
1066 v = new ConfigView(); 1187
1188 v = new ConfigMainWindow();
1067 1189
1068 //zconfdump(stdout); 1190 //zconfdump(stdout);
1069 v->show(); 1191 v->show();
1070 configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); 1192 configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit()));
1071 configApp->exec(); 1193 configApp->exec();
1194
1195#if QT_VERSION >= 300
1196 configSettings->writeEntry("/kconfig/qconf/window x", v->pos().x());
1197 configSettings->writeEntry("/kconfig/qconf/window y", v->pos().y());
1198 configSettings->writeEntry("/kconfig/qconf/window width", v->size().width());
1199 configSettings->writeEntry("/kconfig/qconf/window height", v->size().height());
1200 delete configSettings;
1201#endif
1072 return 0; 1202 return 0;
1073} 1203}