diff options
Diffstat (limited to 'scripts/kconfig/qconf.cc')
-rw-r--r-- | scripts/kconfig/qconf.cc | 274 |
1 files changed, 149 insertions, 125 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 00c51507cfcc..06dd2e33581d 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -3,25 +3,42 @@ | |||
3 | * Released under the terms of the GNU GPL v2.0. | 3 | * Released under the terms of the GNU GPL v2.0. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <qapplication.h> | 6 | #include <qglobal.h> |
7 | |||
8 | #if QT_VERSION < 0x040000 | ||
7 | #include <qmainwindow.h> | 9 | #include <qmainwindow.h> |
10 | #include <qvbox.h> | ||
11 | #include <qvaluelist.h> | ||
12 | #include <qtextbrowser.h> | ||
13 | #include <qaction.h> | ||
14 | #include <qheader.h> | ||
15 | #include <qfiledialog.h> | ||
16 | #include <qdragobject.h> | ||
17 | #include <qpopupmenu.h> | ||
18 | #else | ||
19 | #include <q3mainwindow.h> | ||
20 | #include <q3vbox.h> | ||
21 | #include <q3valuelist.h> | ||
22 | #include <q3textbrowser.h> | ||
23 | #include <q3action.h> | ||
24 | #include <q3header.h> | ||
25 | #include <q3filedialog.h> | ||
26 | #include <q3dragobject.h> | ||
27 | #include <q3popupmenu.h> | ||
28 | #endif | ||
29 | |||
30 | #include <qapplication.h> | ||
8 | #include <qdesktopwidget.h> | 31 | #include <qdesktopwidget.h> |
9 | #include <qtoolbar.h> | 32 | #include <qtoolbar.h> |
10 | #include <qlayout.h> | 33 | #include <qlayout.h> |
11 | #include <qvbox.h> | ||
12 | #include <qsplitter.h> | 34 | #include <qsplitter.h> |
13 | #include <qlistview.h> | ||
14 | #include <qtextbrowser.h> | ||
15 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
16 | #include <qlabel.h> | 36 | #include <qlabel.h> |
17 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
18 | #include <qmenubar.h> | 38 | #include <qmenubar.h> |
19 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
20 | #include <qaction.h> | ||
21 | #include <qheader.h> | ||
22 | #include <qfiledialog.h> | ||
23 | #include <qdragobject.h> | ||
24 | #include <qregexp.h> | 40 | #include <qregexp.h> |
41 | #include <qevent.h> | ||
25 | 42 | ||
26 | #include <stdlib.h> | 43 | #include <stdlib.h> |
27 | 44 | ||
@@ -39,7 +56,7 @@ | |||
39 | static QApplication *configApp; | 56 | static QApplication *configApp; |
40 | static ConfigSettings *configSettings; | 57 | static ConfigSettings *configSettings; |
41 | 58 | ||
42 | QAction *ConfigMainWindow::saveAction; | 59 | Q3Action *ConfigMainWindow::saveAction; |
43 | 60 | ||
44 | static inline QString qgettext(const char* str) | 61 | static inline QString qgettext(const char* str) |
45 | { | 62 | { |
@@ -54,15 +71,14 @@ static inline QString qgettext(const QString& str) | |||
54 | /** | 71 | /** |
55 | * Reads a list of integer values from the application settings. | 72 | * Reads a list of integer values from the application settings. |
56 | */ | 73 | */ |
57 | QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) | 74 | Q3ValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) |
58 | { | 75 | { |
59 | QValueList<int> result; | 76 | Q3ValueList<int> result; |
60 | QStringList entryList = readListEntry(key, ok); | 77 | QStringList entryList = readListEntry(key, ok); |
61 | if (ok) { | 78 | QStringList::Iterator it; |
62 | QStringList::Iterator it; | 79 | |
63 | for (it = entryList.begin(); it != entryList.end(); ++it) | 80 | for (it = entryList.begin(); it != entryList.end(); ++it) |
64 | result.push_back((*it).toInt()); | 81 | result.push_back((*it).toInt()); |
65 | } | ||
66 | 82 | ||
67 | return result; | 83 | return result; |
68 | } | 84 | } |
@@ -70,10 +86,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) | |||
70 | /** | 86 | /** |
71 | * Writes a list of integer values to the application settings. | 87 | * Writes a list of integer values to the application settings. |
72 | */ | 88 | */ |
73 | bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value) | 89 | bool ConfigSettings::writeSizes(const QString& key, const Q3ValueList<int>& value) |
74 | { | 90 | { |
75 | QStringList stringList; | 91 | QStringList stringList; |
76 | QValueList<int>::ConstIterator it; | 92 | Q3ValueList<int>::ConstIterator it; |
77 | 93 | ||
78 | for (it = value.begin(); it != value.end(); ++it) | 94 | for (it = value.begin(); it != value.end(); ++it) |
79 | stringList.push_back(QString::number(*it)); | 95 | stringList.push_back(QString::number(*it)); |
@@ -81,7 +97,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value | |||
81 | } | 97 | } |
82 | 98 | ||
83 | 99 | ||
84 | #if QT_VERSION >= 300 | ||
85 | /* | 100 | /* |
86 | * set the new data | 101 | * set the new data |
87 | * TODO check the value | 102 | * TODO check the value |
@@ -92,7 +107,6 @@ void ConfigItem::okRename(int col) | |||
92 | sym_set_string_value(menu->sym, text(dataColIdx).latin1()); | 107 | sym_set_string_value(menu->sym, text(dataColIdx).latin1()); |
93 | listView()->updateList(this); | 108 | listView()->updateList(this); |
94 | } | 109 | } |
95 | #endif | ||
96 | 110 | ||
97 | /* | 111 | /* |
98 | * update the displayed of a menu entry | 112 | * update the displayed of a menu entry |
@@ -149,7 +163,7 @@ void ConfigItem::updateMenu(void) | |||
149 | case S_TRISTATE: | 163 | case S_TRISTATE: |
150 | char ch; | 164 | char ch; |
151 | 165 | ||
152 | if (!sym_is_changable(sym) && !list->showAll) { | 166 | if (!sym_is_changable(sym) && list->optMode == normalOpt) { |
153 | setPixmap(promptColIdx, 0); | 167 | setPixmap(promptColIdx, 0); |
154 | setText(noColIdx, QString::null); | 168 | setText(noColIdx, QString::null); |
155 | setText(modColIdx, QString::null); | 169 | setText(modColIdx, QString::null); |
@@ -196,11 +210,9 @@ void ConfigItem::updateMenu(void) | |||
196 | 210 | ||
197 | data = sym_get_string_value(sym); | 211 | data = sym_get_string_value(sym); |
198 | 212 | ||
199 | #if QT_VERSION >= 300 | ||
200 | int i = list->mapIdx(dataColIdx); | 213 | int i = list->mapIdx(dataColIdx); |
201 | if (i >= 0) | 214 | if (i >= 0) |
202 | setRenameEnabled(i, TRUE); | 215 | setRenameEnabled(i, TRUE); |
203 | #endif | ||
204 | setText(dataColIdx, data); | 216 | setText(dataColIdx, data); |
205 | if (type == S_STRING) | 217 | if (type == S_STRING) |
206 | prompt = QString("%1: %2").arg(prompt).arg(data); | 218 | prompt = QString("%1: %2").arg(prompt).arg(data); |
@@ -320,7 +332,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) | |||
320 | symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), | 332 | symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), |
321 | choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), | 333 | choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), |
322 | menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), | 334 | menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), |
323 | showAll(false), showName(false), showRange(false), showData(false), | 335 | showName(false), showRange(false), showData(false), optMode(normalOpt), |
324 | rootEntry(0), headerPopup(0) | 336 | rootEntry(0), headerPopup(0) |
325 | { | 337 | { |
326 | int i; | 338 | int i; |
@@ -337,10 +349,10 @@ ConfigList::ConfigList(ConfigView* p, const char *name) | |||
337 | 349 | ||
338 | if (name) { | 350 | if (name) { |
339 | configSettings->beginGroup(name); | 351 | configSettings->beginGroup(name); |
340 | showAll = configSettings->readBoolEntry("/showAll", false); | ||
341 | showName = configSettings->readBoolEntry("/showName", false); | 352 | showName = configSettings->readBoolEntry("/showName", false); |
342 | showRange = configSettings->readBoolEntry("/showRange", false); | 353 | showRange = configSettings->readBoolEntry("/showRange", false); |
343 | showData = configSettings->readBoolEntry("/showData", false); | 354 | showData = configSettings->readBoolEntry("/showData", false); |
355 | optMode = (enum optionMode)configSettings->readNumEntry("/optionMode", false); | ||
344 | configSettings->endGroup(); | 356 | configSettings->endGroup(); |
345 | connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); | 357 | connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); |
346 | } | 358 | } |
@@ -352,6 +364,17 @@ ConfigList::ConfigList(ConfigView* p, const char *name) | |||
352 | reinit(); | 364 | reinit(); |
353 | } | 365 | } |
354 | 366 | ||
367 | bool ConfigList::menuSkip(struct menu *menu) | ||
368 | { | ||
369 | if (optMode == normalOpt && menu_is_visible(menu)) | ||
370 | return false; | ||
371 | if (optMode == promptOpt && menu_has_prompt(menu)) | ||
372 | return false; | ||
373 | if (optMode == allOpt) | ||
374 | return false; | ||
375 | return true; | ||
376 | } | ||
377 | |||
355 | void ConfigList::reinit(void) | 378 | void ConfigList::reinit(void) |
356 | { | 379 | { |
357 | removeColumn(dataColIdx); | 380 | removeColumn(dataColIdx); |
@@ -380,7 +403,7 @@ void ConfigList::saveSettings(void) | |||
380 | configSettings->writeEntry("/showName", showName); | 403 | configSettings->writeEntry("/showName", showName); |
381 | configSettings->writeEntry("/showRange", showRange); | 404 | configSettings->writeEntry("/showRange", showRange); |
382 | configSettings->writeEntry("/showData", showData); | 405 | configSettings->writeEntry("/showData", showData); |
383 | configSettings->writeEntry("/showAll", showAll); | 406 | configSettings->writeEntry("/optionMode", (int)optMode); |
384 | configSettings->endGroup(); | 407 | configSettings->endGroup(); |
385 | } | 408 | } |
386 | } | 409 | } |
@@ -422,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item) | |||
422 | if (!rootEntry) { | 445 | if (!rootEntry) { |
423 | if (mode != listMode) | 446 | if (mode != listMode) |
424 | goto update; | 447 | goto update; |
425 | QListViewItemIterator it(this); | 448 | Q3ListViewItemIterator it(this); |
426 | ConfigItem* item; | 449 | ConfigItem* item; |
427 | 450 | ||
428 | for (; it.current(); ++it) { | 451 | for (; it.current(); ++it) { |
@@ -517,11 +540,9 @@ void ConfigList::changeValue(ConfigItem* item) | |||
517 | case S_INT: | 540 | case S_INT: |
518 | case S_HEX: | 541 | case S_HEX: |
519 | case S_STRING: | 542 | case S_STRING: |
520 | #if QT_VERSION >= 300 | ||
521 | if (colMap[dataColIdx] >= 0) | 543 | if (colMap[dataColIdx] >= 0) |
522 | item->startRename(colMap[dataColIdx]); | 544 | item->startRename(colMap[dataColIdx]); |
523 | else | 545 | else |
524 | #endif | ||
525 | parent()->lineEdit->show(item); | 546 | parent()->lineEdit->show(item); |
526 | break; | 547 | break; |
527 | } | 548 | } |
@@ -553,7 +574,7 @@ void ConfigList::setParentMenu(void) | |||
553 | return; | 574 | return; |
554 | setRootMenu(menu_get_parent_menu(rootEntry->parent)); | 575 | setRootMenu(menu_get_parent_menu(rootEntry->parent)); |
555 | 576 | ||
556 | QListViewItemIterator it(this); | 577 | Q3ListViewItemIterator it(this); |
557 | for (; (item = (ConfigItem*)it.current()); it++) { | 578 | for (; (item = (ConfigItem*)it.current()); it++) { |
558 | if (item->menu == oldroot) { | 579 | if (item->menu == oldroot) { |
559 | setCurrentItem(item); | 580 | setCurrentItem(item); |
@@ -606,7 +627,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) | |||
606 | } | 627 | } |
607 | 628 | ||
608 | visible = menu_is_visible(child); | 629 | visible = menu_is_visible(child); |
609 | if (showAll || visible) { | 630 | if (!menuSkip(child)) { |
610 | if (!child->sym && !child->list && !child->prompt) | 631 | if (!child->sym && !child->list && !child->prompt) |
611 | continue; | 632 | continue; |
612 | if (!item || item->menu != child) | 633 | if (!item || item->menu != child) |
@@ -635,7 +656,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) | |||
635 | 656 | ||
636 | void ConfigList::keyPressEvent(QKeyEvent* ev) | 657 | void ConfigList::keyPressEvent(QKeyEvent* ev) |
637 | { | 658 | { |
638 | QListViewItem* i = currentItem(); | 659 | Q3ListViewItem* i = currentItem(); |
639 | ConfigItem* item; | 660 | ConfigItem* item; |
640 | struct menu *menu; | 661 | struct menu *menu; |
641 | enum prop_type type; | 662 | enum prop_type type; |
@@ -801,10 +822,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) | |||
801 | { | 822 | { |
802 | if (e->y() <= header()->geometry().bottom()) { | 823 | if (e->y() <= header()->geometry().bottom()) { |
803 | if (!headerPopup) { | 824 | if (!headerPopup) { |
804 | QAction *action; | 825 | Q3Action *action; |
805 | 826 | ||
806 | headerPopup = new QPopupMenu(this); | 827 | headerPopup = new Q3PopupMenu(this); |
807 | action = new QAction(NULL, _("Show Name"), 0, this); | 828 | action = new Q3Action(NULL, _("Show Name"), 0, this); |
808 | action->setToggleAction(TRUE); | 829 | action->setToggleAction(TRUE); |
809 | connect(action, SIGNAL(toggled(bool)), | 830 | connect(action, SIGNAL(toggled(bool)), |
810 | parent(), SLOT(setShowName(bool))); | 831 | parent(), SLOT(setShowName(bool))); |
@@ -812,7 +833,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) | |||
812 | action, SLOT(setOn(bool))); | 833 | action, SLOT(setOn(bool))); |
813 | action->setOn(showName); | 834 | action->setOn(showName); |
814 | action->addTo(headerPopup); | 835 | action->addTo(headerPopup); |
815 | action = new QAction(NULL, _("Show Range"), 0, this); | 836 | action = new Q3Action(NULL, _("Show Range"), 0, this); |
816 | action->setToggleAction(TRUE); | 837 | action->setToggleAction(TRUE); |
817 | connect(action, SIGNAL(toggled(bool)), | 838 | connect(action, SIGNAL(toggled(bool)), |
818 | parent(), SLOT(setShowRange(bool))); | 839 | parent(), SLOT(setShowRange(bool))); |
@@ -820,7 +841,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) | |||
820 | action, SLOT(setOn(bool))); | 841 | action, SLOT(setOn(bool))); |
821 | action->setOn(showRange); | 842 | action->setOn(showRange); |
822 | action->addTo(headerPopup); | 843 | action->addTo(headerPopup); |
823 | action = new QAction(NULL, _("Show Data"), 0, this); | 844 | action = new Q3Action(NULL, _("Show Data"), 0, this); |
824 | action->setToggleAction(TRUE); | 845 | action->setToggleAction(TRUE); |
825 | connect(action, SIGNAL(toggled(bool)), | 846 | connect(action, SIGNAL(toggled(bool)), |
826 | parent(), SLOT(setShowData(bool))); | 847 | parent(), SLOT(setShowData(bool))); |
@@ -835,7 +856,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) | |||
835 | e->ignore(); | 856 | e->ignore(); |
836 | } | 857 | } |
837 | 858 | ||
838 | ConfigView* ConfigView::viewList; | 859 | ConfigView*ConfigView::viewList; |
860 | QAction *ConfigView::showNormalAction; | ||
861 | QAction *ConfigView::showAllAction; | ||
862 | QAction *ConfigView::showPromptAction; | ||
839 | 863 | ||
840 | ConfigView::ConfigView(QWidget* parent, const char *name) | 864 | ConfigView::ConfigView(QWidget* parent, const char *name) |
841 | : Parent(parent, name) | 865 | : Parent(parent, name) |
@@ -860,13 +884,16 @@ ConfigView::~ConfigView(void) | |||
860 | } | 884 | } |
861 | } | 885 | } |
862 | 886 | ||
863 | void ConfigView::setShowAll(bool b) | 887 | void ConfigView::setOptionMode(QAction *act) |
864 | { | 888 | { |
865 | if (list->showAll != b) { | 889 | if (act == showNormalAction) |
866 | list->showAll = b; | 890 | list->optMode = normalOpt; |
867 | list->updateListAll(); | 891 | else if (act == showAllAction) |
868 | emit showAllChanged(b); | 892 | list->optMode = allOpt; |
869 | } | 893 | else |
894 | list->optMode = promptOpt; | ||
895 | |||
896 | list->updateListAll(); | ||
870 | } | 897 | } |
871 | 898 | ||
872 | void ConfigView::setShowName(bool b) | 899 | void ConfigView::setShowName(bool b) |
@@ -898,7 +925,7 @@ void ConfigView::setShowData(bool b) | |||
898 | 925 | ||
899 | void ConfigList::setAllOpen(bool open) | 926 | void ConfigList::setAllOpen(bool open) |
900 | { | 927 | { |
901 | QListViewItemIterator it(this); | 928 | Q3ListViewItemIterator it(this); |
902 | 929 | ||
903 | for (; it.current(); it++) | 930 | for (; it.current(); it++) |
904 | it.current()->setOpen(open); | 931 | it.current()->setOpen(open); |
@@ -921,7 +948,7 @@ void ConfigView::updateListAll(void) | |||
921 | } | 948 | } |
922 | 949 | ||
923 | ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) | 950 | ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) |
924 | : Parent(parent, name), sym(0), menu(0) | 951 | : Parent(parent, name), sym(0), _menu(0) |
925 | { | 952 | { |
926 | if (name) { | 953 | if (name) { |
927 | configSettings->beginGroup(name); | 954 | configSettings->beginGroup(name); |
@@ -944,7 +971,7 @@ void ConfigInfoView::setShowDebug(bool b) | |||
944 | { | 971 | { |
945 | if (_showDebug != b) { | 972 | if (_showDebug != b) { |
946 | _showDebug = b; | 973 | _showDebug = b; |
947 | if (menu) | 974 | if (_menu) |
948 | menuInfo(); | 975 | menuInfo(); |
949 | else if (sym) | 976 | else if (sym) |
950 | symbolInfo(); | 977 | symbolInfo(); |
@@ -954,44 +981,16 @@ void ConfigInfoView::setShowDebug(bool b) | |||
954 | 981 | ||
955 | void ConfigInfoView::setInfo(struct menu *m) | 982 | void ConfigInfoView::setInfo(struct menu *m) |
956 | { | 983 | { |
957 | if (menu == m) | 984 | if (_menu == m) |
958 | return; | 985 | return; |
959 | menu = m; | 986 | _menu = m; |
960 | sym = NULL; | 987 | sym = NULL; |
961 | if (!menu) | 988 | if (!_menu) |
962 | clear(); | 989 | clear(); |
963 | else | 990 | else |
964 | menuInfo(); | 991 | menuInfo(); |
965 | } | 992 | } |
966 | 993 | ||
967 | void ConfigInfoView::setSource(const QString& name) | ||
968 | { | ||
969 | const char *p = name.latin1(); | ||
970 | |||
971 | menu = NULL; | ||
972 | sym = NULL; | ||
973 | |||
974 | switch (p[0]) { | ||
975 | case 'm': | ||
976 | struct menu *m; | ||
977 | |||
978 | if (sscanf(p, "m%p", &m) == 1 && menu != m) { | ||
979 | menu = m; | ||
980 | menuInfo(); | ||
981 | emit menuSelected(menu); | ||
982 | } | ||
983 | break; | ||
984 | case 's': | ||
985 | struct symbol *s; | ||
986 | |||
987 | if (sscanf(p, "s%p", &s) == 1 && sym != s) { | ||
988 | sym = s; | ||
989 | symbolInfo(); | ||
990 | } | ||
991 | break; | ||
992 | } | ||
993 | } | ||
994 | |||
995 | void ConfigInfoView::symbolInfo(void) | 994 | void ConfigInfoView::symbolInfo(void) |
996 | { | 995 | { |
997 | QString str; | 996 | QString str; |
@@ -1013,11 +1012,11 @@ void ConfigInfoView::menuInfo(void) | |||
1013 | struct symbol* sym; | 1012 | struct symbol* sym; |
1014 | QString head, debug, help; | 1013 | QString head, debug, help; |
1015 | 1014 | ||
1016 | sym = menu->sym; | 1015 | sym = _menu->sym; |
1017 | if (sym) { | 1016 | if (sym) { |
1018 | if (menu->prompt) { | 1017 | if (_menu->prompt) { |
1019 | head += "<big><b>"; | 1018 | head += "<big><b>"; |
1020 | head += print_filter(_(menu->prompt->text)); | 1019 | head += print_filter(_(_menu->prompt->text)); |
1021 | head += "</b></big>"; | 1020 | head += "</b></big>"; |
1022 | if (sym->name) { | 1021 | if (sym->name) { |
1023 | head += " ("; | 1022 | head += " ("; |
@@ -1043,23 +1042,23 @@ void ConfigInfoView::menuInfo(void) | |||
1043 | debug = debug_info(sym); | 1042 | debug = debug_info(sym); |
1044 | 1043 | ||
1045 | struct gstr help_gstr = str_new(); | 1044 | struct gstr help_gstr = str_new(); |
1046 | menu_get_ext_help(menu, &help_gstr); | 1045 | menu_get_ext_help(_menu, &help_gstr); |
1047 | help = print_filter(str_get(&help_gstr)); | 1046 | help = print_filter(str_get(&help_gstr)); |
1048 | str_free(&help_gstr); | 1047 | str_free(&help_gstr); |
1049 | } else if (menu->prompt) { | 1048 | } else if (_menu->prompt) { |
1050 | head += "<big><b>"; | 1049 | head += "<big><b>"; |
1051 | head += print_filter(_(menu->prompt->text)); | 1050 | head += print_filter(_(_menu->prompt->text)); |
1052 | head += "</b></big><br><br>"; | 1051 | head += "</b></big><br><br>"; |
1053 | if (showDebug()) { | 1052 | if (showDebug()) { |
1054 | if (menu->prompt->visible.expr) { | 1053 | if (_menu->prompt->visible.expr) { |
1055 | debug += " dep: "; | 1054 | debug += " dep: "; |
1056 | expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); | 1055 | expr_print(_menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); |
1057 | debug += "<br><br>"; | 1056 | debug += "<br><br>"; |
1058 | } | 1057 | } |
1059 | } | 1058 | } |
1060 | } | 1059 | } |
1061 | if (showDebug()) | 1060 | if (showDebug()) |
1062 | debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno); | 1061 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno); |
1063 | 1062 | ||
1064 | setText(head + debug + help); | 1063 | setText(head + debug + help); |
1065 | } | 1064 | } |
@@ -1162,10 +1161,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char | |||
1162 | *text += str2; | 1161 | *text += str2; |
1163 | } | 1162 | } |
1164 | 1163 | ||
1165 | QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) | 1164 | Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) |
1166 | { | 1165 | { |
1167 | QPopupMenu* popup = Parent::createPopupMenu(pos); | 1166 | Q3PopupMenu* popup = Parent::createPopupMenu(pos); |
1168 | QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup); | 1167 | Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup); |
1169 | action->setToggleAction(TRUE); | 1168 | action->setToggleAction(TRUE); |
1170 | connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); | 1169 | connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); |
1171 | connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); | 1170 | connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); |
@@ -1222,7 +1221,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam | |||
1222 | y = configSettings->readNumEntry("/window y", 0, &ok); | 1221 | y = configSettings->readNumEntry("/window y", 0, &ok); |
1223 | if (ok) | 1222 | if (ok) |
1224 | move(x, y); | 1223 | move(x, y); |
1225 | QValueList<int> sizes = configSettings->readSizes("/split", &ok); | 1224 | Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok); |
1226 | if (ok) | 1225 | if (ok) |
1227 | split->setSizes(sizes); | 1226 | split->setSizes(sizes); |
1228 | configSettings->endGroup(); | 1227 | configSettings->endGroup(); |
@@ -1275,8 +1274,14 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1275 | char title[256]; | 1274 | char title[256]; |
1276 | 1275 | ||
1277 | QDesktopWidget *d = configApp->desktop(); | 1276 | QDesktopWidget *d = configApp->desktop(); |
1278 | snprintf(title, sizeof(title), _("Linux Kernel v%s Configuration"), | 1277 | snprintf(title, sizeof(title), "%s%s", |
1279 | getenv("KERNELVERSION")); | 1278 | rootmenu.prompt->text, |
1279 | #if QT_VERSION < 0x040000 | ||
1280 | " (Qt3)" | ||
1281 | #else | ||
1282 | "" | ||
1283 | #endif | ||
1284 | ); | ||
1280 | setCaption(title); | 1285 | setCaption(title); |
1281 | 1286 | ||
1282 | width = configSettings->readNumEntry("/window width", d->width() - 64); | 1287 | width = configSettings->readNumEntry("/window width", d->width() - 64); |
@@ -1309,60 +1314,79 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1309 | configList->setFocus(); | 1314 | configList->setFocus(); |
1310 | 1315 | ||
1311 | menu = menuBar(); | 1316 | menu = menuBar(); |
1312 | toolBar = new QToolBar("Tools", this); | 1317 | toolBar = new Q3ToolBar("Tools", this); |
1313 | 1318 | ||
1314 | backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this); | 1319 | backAction = new Q3Action("Back", QPixmap(xpm_back), _("Back"), 0, this); |
1315 | connect(backAction, SIGNAL(activated()), SLOT(goBack())); | 1320 | connect(backAction, SIGNAL(activated()), SLOT(goBack())); |
1316 | backAction->setEnabled(FALSE); | 1321 | backAction->setEnabled(FALSE); |
1317 | QAction *quitAction = new QAction("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this); | 1322 | Q3Action *quitAction = new Q3Action("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this); |
1318 | connect(quitAction, SIGNAL(activated()), SLOT(close())); | 1323 | connect(quitAction, SIGNAL(activated()), SLOT(close())); |
1319 | QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this); | 1324 | Q3Action *loadAction = new Q3Action("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this); |
1320 | connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); | 1325 | connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); |
1321 | saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this); | 1326 | saveAction = new Q3Action("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this); |
1322 | connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); | 1327 | connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); |
1323 | conf_set_changed_callback(conf_changed); | 1328 | conf_set_changed_callback(conf_changed); |
1324 | // Set saveAction's initial state | 1329 | // Set saveAction's initial state |
1325 | conf_changed(); | 1330 | conf_changed(); |
1326 | QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this); | 1331 | Q3Action *saveAsAction = new Q3Action("Save As...", _("Save &As..."), 0, this); |
1327 | connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); | 1332 | connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); |
1328 | QAction *searchAction = new QAction("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this); | 1333 | Q3Action *searchAction = new Q3Action("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this); |
1329 | connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); | 1334 | connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); |
1330 | QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); | 1335 | Q3Action *singleViewAction = new Q3Action("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); |
1331 | connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); | 1336 | connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); |
1332 | QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this); | 1337 | Q3Action *splitViewAction = new Q3Action("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this); |
1333 | connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); | 1338 | connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); |
1334 | QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this); | 1339 | Q3Action *fullViewAction = new Q3Action("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this); |
1335 | connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); | 1340 | connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); |
1336 | 1341 | ||
1337 | QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this); | 1342 | Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this); |
1338 | showNameAction->setToggleAction(TRUE); | 1343 | showNameAction->setToggleAction(TRUE); |
1339 | connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); | 1344 | connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); |
1340 | connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); | 1345 | connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); |
1341 | showNameAction->setOn(configView->showName()); | 1346 | showNameAction->setOn(configView->showName()); |
1342 | QAction *showRangeAction = new QAction(NULL, _("Show Range"), 0, this); | 1347 | Q3Action *showRangeAction = new Q3Action(NULL, _("Show Range"), 0, this); |
1343 | showRangeAction->setToggleAction(TRUE); | 1348 | showRangeAction->setToggleAction(TRUE); |
1344 | connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); | 1349 | connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); |
1345 | connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); | 1350 | connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); |
1346 | showRangeAction->setOn(configList->showRange); | 1351 | showRangeAction->setOn(configList->showRange); |
1347 | QAction *showDataAction = new QAction(NULL, _("Show Data"), 0, this); | 1352 | Q3Action *showDataAction = new Q3Action(NULL, _("Show Data"), 0, this); |
1348 | showDataAction->setToggleAction(TRUE); | 1353 | showDataAction->setToggleAction(TRUE); |
1349 | connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); | 1354 | connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); |
1350 | connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); | 1355 | connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); |
1351 | showDataAction->setOn(configList->showData); | 1356 | showDataAction->setOn(configList->showData); |
1352 | QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this); | 1357 | |
1353 | showAllAction->setToggleAction(TRUE); | 1358 | QActionGroup *optGroup = new QActionGroup(this); |
1354 | connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool))); | 1359 | optGroup->setExclusive(TRUE); |
1355 | connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool))); | 1360 | connect(optGroup, SIGNAL(selected(QAction *)), configView, |
1356 | showAllAction->setOn(configList->showAll); | 1361 | SLOT(setOptionMode(QAction *))); |
1357 | QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this); | 1362 | connect(optGroup, SIGNAL(selected(QAction *)), menuView, |
1363 | SLOT(setOptionMode(QAction *))); | ||
1364 | |||
1365 | #if QT_VERSION >= 0x040000 | ||
1366 | configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup); | ||
1367 | configView->showAllAction = new QAction(_("Show All Options"), optGroup); | ||
1368 | configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup); | ||
1369 | #else | ||
1370 | configView->showNormalAction = new QAction(_("Show Normal Options"), 0, optGroup); | ||
1371 | configView->showAllAction = new QAction(_("Show All Options"), 0, optGroup); | ||
1372 | configView->showPromptAction = new QAction(_("Show Prompt Options"), 0, optGroup); | ||
1373 | #endif | ||
1374 | configView->showNormalAction->setToggleAction(TRUE); | ||
1375 | configView->showNormalAction->setOn(configList->optMode == normalOpt); | ||
1376 | configView->showAllAction->setToggleAction(TRUE); | ||
1377 | configView->showAllAction->setOn(configList->optMode == allOpt); | ||
1378 | configView->showPromptAction->setToggleAction(TRUE); | ||
1379 | configView->showPromptAction->setOn(configList->optMode == promptOpt); | ||
1380 | |||
1381 | Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this); | ||
1358 | showDebugAction->setToggleAction(TRUE); | 1382 | showDebugAction->setToggleAction(TRUE); |
1359 | connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); | 1383 | connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); |
1360 | connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); | 1384 | connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); |
1361 | showDebugAction->setOn(helpText->showDebug()); | 1385 | showDebugAction->setOn(helpText->showDebug()); |
1362 | 1386 | ||
1363 | QAction *showIntroAction = new QAction(NULL, _("Introduction"), 0, this); | 1387 | Q3Action *showIntroAction = new Q3Action(NULL, _("Introduction"), 0, this); |
1364 | connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); | 1388 | connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); |
1365 | QAction *showAboutAction = new QAction(NULL, _("About"), 0, this); | 1389 | Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this); |
1366 | connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); | 1390 | connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); |
1367 | 1391 | ||
1368 | // init tool bar | 1392 | // init tool bar |
@@ -1376,7 +1400,7 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1376 | fullViewAction->addTo(toolBar); | 1400 | fullViewAction->addTo(toolBar); |
1377 | 1401 | ||
1378 | // create config menu | 1402 | // create config menu |
1379 | QPopupMenu* config = new QPopupMenu(this); | 1403 | Q3PopupMenu* config = new Q3PopupMenu(this); |
1380 | menu->insertItem(_("&File"), config); | 1404 | menu->insertItem(_("&File"), config); |
1381 | loadAction->addTo(config); | 1405 | loadAction->addTo(config); |
1382 | saveAction->addTo(config); | 1406 | saveAction->addTo(config); |
@@ -1385,22 +1409,22 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1385 | quitAction->addTo(config); | 1409 | quitAction->addTo(config); |
1386 | 1410 | ||
1387 | // create edit menu | 1411 | // create edit menu |
1388 | QPopupMenu* editMenu = new QPopupMenu(this); | 1412 | Q3PopupMenu* editMenu = new Q3PopupMenu(this); |
1389 | menu->insertItem(_("&Edit"), editMenu); | 1413 | menu->insertItem(_("&Edit"), editMenu); |
1390 | searchAction->addTo(editMenu); | 1414 | searchAction->addTo(editMenu); |
1391 | 1415 | ||
1392 | // create options menu | 1416 | // create options menu |
1393 | QPopupMenu* optionMenu = new QPopupMenu(this); | 1417 | Q3PopupMenu* optionMenu = new Q3PopupMenu(this); |
1394 | menu->insertItem(_("&Option"), optionMenu); | 1418 | menu->insertItem(_("&Option"), optionMenu); |
1395 | showNameAction->addTo(optionMenu); | 1419 | showNameAction->addTo(optionMenu); |
1396 | showRangeAction->addTo(optionMenu); | 1420 | showRangeAction->addTo(optionMenu); |
1397 | showDataAction->addTo(optionMenu); | 1421 | showDataAction->addTo(optionMenu); |
1398 | optionMenu->insertSeparator(); | 1422 | optionMenu->insertSeparator(); |
1399 | showAllAction->addTo(optionMenu); | 1423 | optGroup->addTo(optionMenu); |
1400 | showDebugAction->addTo(optionMenu); | 1424 | optionMenu->insertSeparator(); |
1401 | 1425 | ||
1402 | // create help menu | 1426 | // create help menu |
1403 | QPopupMenu* helpMenu = new QPopupMenu(this); | 1427 | Q3PopupMenu* helpMenu = new Q3PopupMenu(this); |
1404 | menu->insertSeparator(); | 1428 | menu->insertSeparator(); |
1405 | menu->insertItem(_("&Help"), helpMenu); | 1429 | menu->insertItem(_("&Help"), helpMenu); |
1406 | showIntroAction->addTo(helpMenu); | 1430 | showIntroAction->addTo(helpMenu); |
@@ -1435,7 +1459,7 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1435 | showSplitView(); | 1459 | showSplitView(); |
1436 | 1460 | ||
1437 | // UI setup done, restore splitter positions | 1461 | // UI setup done, restore splitter positions |
1438 | QValueList<int> sizes = configSettings->readSizes("/split1", &ok); | 1462 | Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok); |
1439 | if (ok) | 1463 | if (ok) |
1440 | split1->setSizes(sizes); | 1464 | split1->setSizes(sizes); |
1441 | 1465 | ||
@@ -1446,7 +1470,7 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1446 | 1470 | ||
1447 | void ConfigMainWindow::loadConfig(void) | 1471 | void ConfigMainWindow::loadConfig(void) |
1448 | { | 1472 | { |
1449 | QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this); | 1473 | QString s = Q3FileDialog::getOpenFileName(conf_get_configname(), NULL, this); |
1450 | if (s.isNull()) | 1474 | if (s.isNull()) |
1451 | return; | 1475 | return; |
1452 | if (conf_read(QFile::encodeName(s))) | 1476 | if (conf_read(QFile::encodeName(s))) |
@@ -1462,7 +1486,7 @@ void ConfigMainWindow::saveConfig(void) | |||
1462 | 1486 | ||
1463 | void ConfigMainWindow::saveConfigAs(void) | 1487 | void ConfigMainWindow::saveConfigAs(void) |
1464 | { | 1488 | { |
1465 | QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this); | 1489 | QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this); |
1466 | if (s.isNull()) | 1490 | if (s.isNull()) |
1467 | return; | 1491 | return; |
1468 | if (conf_write(QFile::encodeName(s))) | 1492 | if (conf_write(QFile::encodeName(s))) |
@@ -1491,7 +1515,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) | |||
1491 | ConfigList* list = NULL; | 1515 | ConfigList* list = NULL; |
1492 | ConfigItem* item; | 1516 | ConfigItem* item; |
1493 | 1517 | ||
1494 | if (!menu_is_visible(menu) && !configView->showAll()) | 1518 | if (configList->menuSkip(menu)) |
1495 | return; | 1519 | return; |
1496 | 1520 | ||
1497 | switch (configList->mode) { | 1521 | switch (configList->mode) { |
@@ -1631,7 +1655,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) | |||
1631 | 1655 | ||
1632 | void ConfigMainWindow::showIntro(void) | 1656 | void ConfigMainWindow::showIntro(void) |
1633 | { | 1657 | { |
1634 | static const QString str = _("Welcome to the qconf graphical kernel configuration tool for Linux.\n\n" | 1658 | static const QString str = _("Welcome to the qconf graphical configuration tool.\n\n" |
1635 | "For each option, a blank box indicates the feature is disabled, a check\n" | 1659 | "For each option, a blank box indicates the feature is disabled, a check\n" |
1636 | "indicates it is enabled, and a dot indicates that it is to be compiled\n" | 1660 | "indicates it is enabled, and a dot indicates that it is to be compiled\n" |
1637 | "as a module. Clicking on the box will cycle through the three states.\n\n" | 1661 | "as a module. Clicking on the box will cycle through the three states.\n\n" |