aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/qconf.cc444
-rw-r--r--scripts/kconfig/qconf.h61
2 files changed, 333 insertions, 172 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 4590cd31623f..2befaeac6e64 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -6,16 +6,20 @@
6#include <qapplication.h> 6#include <qapplication.h>
7#include <qmainwindow.h> 7#include <qmainwindow.h>
8#include <qtoolbar.h> 8#include <qtoolbar.h>
9#include <qlayout.h>
9#include <qvbox.h> 10#include <qvbox.h>
10#include <qsplitter.h> 11#include <qsplitter.h>
11#include <qlistview.h> 12#include <qlistview.h>
12#include <qtextview.h> 13#include <qtextbrowser.h>
13#include <qlineedit.h> 14#include <qlineedit.h>
15#include <qlabel.h>
16#include <qpushbutton.h>
14#include <qmenubar.h> 17#include <qmenubar.h>
15#include <qmessagebox.h> 18#include <qmessagebox.h>
16#include <qaction.h> 19#include <qaction.h>
17#include <qheader.h> 20#include <qheader.h>
18#include <qfiledialog.h> 21#include <qfiledialog.h>
22#include <qdragobject.h>
19#include <qregexp.h> 23#include <qregexp.h>
20 24
21#include <stdlib.h> 25#include <stdlib.h>
@@ -35,12 +39,12 @@ static QApplication *configApp;
35 39
36static inline QString qgettext(const char* str) 40static inline QString qgettext(const char* str)
37{ 41{
38 return QString::fromLocal8Bit(gettext(str)); 42 return QString::fromLocal8Bit(gettext(str));
39} 43}
40 44
41static inline QString qgettext(const QString& str) 45static inline QString qgettext(const QString& str)
42{ 46{
43 return QString::fromLocal8Bit(gettext(str.latin1())); 47 return QString::fromLocal8Bit(gettext(str.latin1()));
44} 48}
45 49
46ConfigSettings::ConfigSettings() 50ConfigSettings::ConfigSettings()
@@ -355,6 +359,12 @@ ConfigItem::~ConfigItem(void)
355 } 359 }
356} 360}
357 361
362ConfigLineEdit::ConfigLineEdit(ConfigView* parent)
363 : Parent(parent)
364{
365 connect(this, SIGNAL(lostFocus()), SLOT(hide()));
366}
367
358void ConfigLineEdit::show(ConfigItem* i) 368void ConfigLineEdit::show(ConfigItem* i)
359{ 369{
360 item = i; 370 item = i;
@@ -385,8 +395,8 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
385 hide(); 395 hide();
386} 396}
387 397
388ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv, ConfigSettings* configSettings) 398ConfigList::ConfigList(ConfigView* p, ConfigSettings* configSettings)
389 : Parent(p), cview(cv), 399 : Parent(p),
390 updateAll(false), 400 updateAll(false),
391 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), 401 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
392 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), 402 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
@@ -450,9 +460,8 @@ void ConfigList::updateSelection(void)
450 if (!item) 460 if (!item)
451 return; 461 return;
452 462
453 cview->setHelp(item);
454
455 menu = item->menu; 463 menu = item->menu;
464 emit menuChanged(menu);
456 if (!menu) 465 if (!menu)
457 return; 466 return;
458 type = menu->prompt ? menu->prompt->type : P_UNKNOWN; 467 type = menu->prompt ? menu->prompt->type : P_UNKNOWN;
@@ -464,8 +473,20 @@ void ConfigList::updateList(ConfigItem* item)
464{ 473{
465 ConfigItem* last = 0; 474 ConfigItem* last = 0;
466 475
467 if (!rootEntry) 476 if (!rootEntry) {
468 goto update; 477 if (mode != listMode)
478 goto update;
479 QListViewItemIterator it(this);
480 ConfigItem* item;
481
482 for (; it.current(); ++it) {
483 item = (ConfigItem*)it.current();
484 if (!item->menu)
485 continue;
486 item->testUpdateMenu(menu_is_visible(item->menu));
487 }
488 return;
489 }
469 490
470 if (rootEntry != &rootmenu && (mode == singleMode || 491 if (rootEntry != &rootmenu && (mode == singleMode ||
471 (mode == symbolMode && rootEntry->parent != &rootmenu))) { 492 (mode == symbolMode && rootEntry->parent != &rootmenu))) {
@@ -610,7 +631,7 @@ void ConfigList::keyPressEvent(QKeyEvent* ev)
610 struct menu *menu; 631 struct menu *menu;
611 enum prop_type type; 632 enum prop_type type;
612 633
613 if (ev->key() == Key_Escape && mode != fullMode) { 634 if (ev->key() == Key_Escape && mode != fullMode && mode != listMode) {
614 emit parentSelected(); 635 emit parentSelected();
615 ev->accept(); 636 ev->accept();
616 return; 637 return;
@@ -767,11 +788,10 @@ void ConfigList::focusInEvent(QFocusEvent *e)
767 788
768ConfigView* ConfigView::viewList; 789ConfigView* ConfigView::viewList;
769 790
770ConfigView::ConfigView(QWidget* parent, ConfigMainWindow* cview, 791ConfigView::ConfigView(QWidget* parent, ConfigSettings *configSettings)
771 ConfigSettings *configSettings)
772 : Parent(parent) 792 : Parent(parent)
773{ 793{
774 list = new ConfigList(this, cview, configSettings); 794 list = new ConfigList(this, configSettings);
775 lineEdit = new ConfigLineEdit(this); 795 lineEdit = new ConfigLineEdit(this);
776 lineEdit->hide(); 796 lineEdit->hide();
777 797
@@ -807,13 +827,238 @@ void ConfigView::updateListAll(void)
807 v->list->updateListAll(); 827 v->list->updateListAll();
808} 828}
809 829
830ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
831 : Parent(parent, name), menu(0)
832{
833}
834
835void ConfigInfoView::setShowDebug(bool b)
836{
837 if (_showDebug != b) {
838 _showDebug = b;
839 if (menu)
840 menuInfo();
841 emit showDebugChanged(b);
842 }
843}
844
845void ConfigInfoView::setInfo(struct menu *m)
846{
847 menu = m;
848 if (!menu)
849 clear();
850 else
851 menuInfo();
852}
853
854void ConfigInfoView::setSource(const QString& name)
855{
856 const char *p = name.latin1();
857
858 menu = NULL;
859
860 switch (p[0]) {
861 case 'm':
862 if (sscanf(p, "m%p", &menu) == 1)
863 menuInfo();
864 break;
865 }
866}
867
868void ConfigInfoView::menuInfo(void)
869{
870 struct symbol* sym;
871 QString head, debug, help;
872
873 sym = menu->sym;
874 if (sym) {
875 if (menu->prompt) {
876 head += "<big><b>";
877 head += print_filter(_(menu->prompt->text));
878 head += "</b></big>";
879 if (sym->name) {
880 head += " (";
881 head += print_filter(sym->name);
882 head += ")";
883 }
884 } else if (sym->name) {
885 head += "<big><b>";
886 head += print_filter(sym->name);
887 head += "</b></big>";
888 }
889 head += "<br><br>";
890
891 if (showDebug())
892 debug = debug_info(sym);
893
894 help = print_filter(_(sym->help));
895 } else if (menu->prompt) {
896 head += "<big><b>";
897 head += print_filter(_(menu->prompt->text));
898 head += "</b></big><br><br>";
899 if (showDebug()) {
900 if (menu->prompt->visible.expr) {
901 debug += "&nbsp;&nbsp;dep: ";
902 expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE);
903 debug += "<br><br>";
904 }
905 }
906 }
907 if (showDebug())
908 debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno);
909
910 setText(head + debug + help);
911}
912
913QString ConfigInfoView::debug_info(struct symbol *sym)
914{
915 QString debug;
916
917 debug += "type: ";
918 debug += print_filter(sym_type_name(sym->type));
919 if (sym_is_choice(sym))
920 debug += " (choice)";
921 debug += "<br>";
922 if (sym->rev_dep.expr) {
923 debug += "reverse dep: ";
924 expr_print(sym->rev_dep.expr, expr_print_help, &debug, E_NONE);
925 debug += "<br>";
926 }
927 for (struct property *prop = sym->prop; prop; prop = prop->next) {
928 switch (prop->type) {
929 case P_PROMPT:
930 case P_MENU:
931 debug += "prompt: ";
932 debug += print_filter(_(prop->text));
933 debug += "<br>";
934 break;
935 case P_DEFAULT:
936 debug += "default: ";
937 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
938 debug += "<br>";
939 break;
940 case P_CHOICE:
941 if (sym_is_choice(sym)) {
942 debug += "choice: ";
943 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
944 debug += "<br>";
945 }
946 break;
947 case P_SELECT:
948 debug += "select: ";
949 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
950 debug += "<br>";
951 break;
952 case P_RANGE:
953 debug += "range: ";
954 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
955 debug += "<br>";
956 break;
957 default:
958 debug += "unknown property: ";
959 debug += prop_get_type_name(prop->type);
960 debug += "<br>";
961 }
962 if (prop->visible.expr) {
963 debug += "&nbsp;&nbsp;&nbsp;&nbsp;dep: ";
964 expr_print(prop->visible.expr, expr_print_help, &debug, E_NONE);
965 debug += "<br>";
966 }
967 }
968 debug += "<br>";
969
970 return debug;
971}
972
973QString ConfigInfoView::print_filter(const QString &str)
974{
975 QRegExp re("[<>&\"\\n]");
976 QString res = str;
977 for (int i = 0; (i = res.find(re, i)) >= 0;) {
978 switch (res[i].latin1()) {
979 case '<':
980 res.replace(i, 1, "&lt;");
981 i += 4;
982 break;
983 case '>':
984 res.replace(i, 1, "&gt;");
985 i += 4;
986 break;
987 case '&':
988 res.replace(i, 1, "&amp;");
989 i += 5;
990 break;
991 case '"':
992 res.replace(i, 1, "&quot;");
993 i += 6;
994 break;
995 case '\n':
996 res.replace(i, 1, "<br>");
997 i += 4;
998 break;
999 }
1000 }
1001 return res;
1002}
1003
1004void ConfigInfoView::expr_print_help(void *data, const char *str)
1005{
1006 reinterpret_cast<QString*>(data)->append(print_filter(str));
1007}
1008
1009ConfigSearchWindow::ConfigSearchWindow(QWidget* parent)
1010 : Parent(parent), result(NULL)
1011{
1012 setCaption("Search Config");
1013
1014 QVBoxLayout* layout1 = new QVBoxLayout(this, 11, 6);
1015 QHBoxLayout* layout2 = new QHBoxLayout(0, 0, 6);
1016 layout2->addWidget(new QLabel("Find:", this));
1017 editField = new QLineEdit(this);
1018 connect(editField, SIGNAL(returnPressed()), SLOT(search()));
1019 layout2->addWidget(editField);
1020 searchButton = new QPushButton("Search", this);
1021 searchButton->setAutoDefault(FALSE);
1022 connect(searchButton, SIGNAL(clicked()), SLOT(search()));
1023 layout2->addWidget(searchButton);
1024 layout1->addLayout(layout2);
1025
1026 QSplitter* split = new QSplitter(this);
1027 split->setOrientation(QSplitter::Vertical);
1028 list = new ConfigView(split, NULL);
1029 list->list->mode = listMode;
1030 info = new ConfigInfoView(split);
1031 connect(list->list, SIGNAL(menuChanged(struct menu *)),
1032 info, SLOT(setInfo(struct menu *)));
1033 layout1->addWidget(split);
1034}
1035
1036void ConfigSearchWindow::search(void)
1037{
1038 struct symbol **p;
1039 struct property *prop;
1040 ConfigItem *lastItem = NULL;
1041
1042 free(result);
1043 list->list->clear();
1044
1045 result = sym_re_search(editField->text().latin1());
1046 if (!result)
1047 return;
1048 for (p = result; *p; p++) {
1049 for_all_prompts((*p), prop)
1050 lastItem = new ConfigItem(list->list, lastItem, prop->menu,
1051 menu_is_visible(prop->menu));
1052 }
1053}
1054
810/* 1055/*
811 * Construct the complete config widget 1056 * Construct the complete config widget
812 */ 1057 */
813ConfigMainWindow::ConfigMainWindow(void) 1058ConfigMainWindow::ConfigMainWindow(void)
814{ 1059{
815 QMenuBar* menu; 1060 QMenuBar* menu;
816 bool ok; 1061 bool ok, showDebug;
817 int x, y, width, height; 1062 int x, y, width, height;
818 1063
819 QWidget *d = configApp->desktop(); 1064 QWidget *d = configApp->desktop();
@@ -843,18 +1088,19 @@ ConfigMainWindow::ConfigMainWindow(void)
843 split1->setOrientation(QSplitter::Horizontal); 1088 split1->setOrientation(QSplitter::Horizontal);
844 setCentralWidget(split1); 1089 setCentralWidget(split1);
845 1090
846 menuView = new ConfigView(split1, this, configSettings); 1091 menuView = new ConfigView(split1, configSettings);
847 menuList = menuView->list; 1092 menuList = menuView->list;
848 1093
849 split2 = new QSplitter(split1); 1094 split2 = new QSplitter(split1);
850 split2->setOrientation(QSplitter::Vertical); 1095 split2->setOrientation(QSplitter::Vertical);
851 1096
852 // create config tree 1097 // create config tree
853 configView = new ConfigView(split2, this, configSettings); 1098 configView = new ConfigView(split2, configSettings);
854 configList = configView->list; 1099 configList = configView->list;
855 1100
856 helpText = new QTextView(split2); 1101 helpText = new ConfigInfoView(split2);
857 helpText->setTextFormat(Qt::RichText); 1102 helpText->setTextFormat(Qt::RichText);
1103 helpText->setShowDebug(showDebug);
858 1104
859 setTabOrder(configList, helpText); 1105 setTabOrder(configList, helpText);
860 configList->setFocus(); 1106 configList->setFocus();
@@ -873,6 +1119,8 @@ ConfigMainWindow::ConfigMainWindow(void)
873 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); 1119 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
874 QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); 1120 QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this);
875 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); 1121 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
1122 QAction *searchAction = new QAction("Search", "&Search", CTRL+Key_F, this);
1123 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
876 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this); 1124 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this);
877 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); 1125 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
878 QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this); 1126 QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this);
@@ -899,7 +1147,8 @@ ConfigMainWindow::ConfigMainWindow(void)
899 QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this); 1147 QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this);
900 showDebugAction->setToggleAction(TRUE); 1148 showDebugAction->setToggleAction(TRUE);
901 showDebugAction->setOn(showDebug); 1149 showDebugAction->setOn(showDebug);
902 connect(showDebugAction, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); 1150 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
1151 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
903 1152
904 QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this); 1153 QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this);
905 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); 1154 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
@@ -923,6 +1172,8 @@ ConfigMainWindow::ConfigMainWindow(void)
923 saveAction->addTo(config); 1172 saveAction->addTo(config);
924 saveAsAction->addTo(config); 1173 saveAsAction->addTo(config);
925 config->insertSeparator(); 1174 config->insertSeparator();
1175 searchAction->addTo(config);
1176 config->insertSeparator();
926 quitAction->addTo(config); 1177 quitAction->addTo(config);
927 1178
928 // create options menu 1179 // create options menu
@@ -942,10 +1193,14 @@ ConfigMainWindow::ConfigMainWindow(void)
942 showIntroAction->addTo(helpMenu); 1193 showIntroAction->addTo(helpMenu);
943 showAboutAction->addTo(helpMenu); 1194 showAboutAction->addTo(helpMenu);
944 1195
1196 connect(configList, SIGNAL(menuChanged(struct menu *)),
1197 helpText, SLOT(setInfo(struct menu *)));
945 connect(configList, SIGNAL(menuSelected(struct menu *)), 1198 connect(configList, SIGNAL(menuSelected(struct menu *)),
946 SLOT(changeMenu(struct menu *))); 1199 SLOT(changeMenu(struct menu *)));
947 connect(configList, SIGNAL(parentSelected()), 1200 connect(configList, SIGNAL(parentSelected()),
948 SLOT(goBack())); 1201 SLOT(goBack()));
1202 connect(menuList, SIGNAL(menuChanged(struct menu *)),
1203 helpText, SLOT(setInfo(struct menu *)));
949 connect(menuList, SIGNAL(menuSelected(struct menu *)), 1204 connect(menuList, SIGNAL(menuSelected(struct menu *)),
950 SLOT(changeMenu(struct menu *))); 1205 SLOT(changeMenu(struct menu *)));
951 1206
@@ -977,42 +1232,6 @@ ConfigMainWindow::ConfigMainWindow(void)
977 delete configSettings; 1232 delete configSettings;
978} 1233}
979 1234
980static QString print_filter(const QString &str)
981{
982 QRegExp re("[<>&\"\\n]");
983 QString res = str;
984 for (int i = 0; (i = res.find(re, i)) >= 0;) {
985 switch (res[i].latin1()) {
986 case '<':
987 res.replace(i, 1, "&lt;");
988 i += 4;
989 break;
990 case '>':
991 res.replace(i, 1, "&gt;");
992 i += 4;
993 break;
994 case '&':
995 res.replace(i, 1, "&amp;");
996 i += 5;
997 break;
998 case '"':
999 res.replace(i, 1, "&quot;");
1000 i += 6;
1001 break;
1002 case '\n':
1003 res.replace(i, 1, "<br>");
1004 i += 4;
1005 break;
1006 }
1007 }
1008 return res;
1009}
1010
1011static void expr_print_help(void *data, const char *str)
1012{
1013 reinterpret_cast<QString*>(data)->append(print_filter(str));
1014}
1015
1016/* 1235/*
1017 * display a new help entry as soon as a new menu entry is selected 1236 * display a new help entry as soon as a new menu entry is selected
1018 */ 1237 */
@@ -1021,105 +1240,9 @@ void ConfigMainWindow::setHelp(QListViewItem* item)
1021 struct symbol* sym; 1240 struct symbol* sym;
1022 struct menu* menu = 0; 1241 struct menu* menu = 0;
1023 1242
1024 configList->parent()->lineEdit->hide();
1025 if (item) 1243 if (item)
1026 menu = ((ConfigItem*)item)->menu; 1244 menu = ((ConfigItem*)item)->menu;
1027 if (!menu) { 1245 helpText->setInfo(menu);
1028 helpText->setText(QString::null);
1029 return;
1030 }
1031
1032 QString head, debug, help;
1033 menu = ((ConfigItem*)item)->menu;
1034 sym = menu->sym;
1035 if (sym) {
1036 if (menu->prompt) {
1037 head += "<big><b>";
1038 head += print_filter(_(menu->prompt->text));
1039 head += "</b></big>";
1040 if (sym->name) {
1041 head += " (";
1042 head += print_filter(_(sym->name));
1043 head += ")";
1044 }
1045 } else if (sym->name) {
1046 head += "<big><b>";
1047 head += print_filter(_(sym->name));
1048 head += "</b></big>";
1049 }
1050 head += "<br><br>";
1051
1052 if (showDebug) {
1053 debug += "type: ";
1054 debug += print_filter(sym_type_name(sym->type));
1055 if (sym_is_choice(sym))
1056 debug += " (choice)";
1057 debug += "<br>";
1058 if (sym->rev_dep.expr) {
1059 debug += "reverse dep: ";
1060 expr_print(sym->rev_dep.expr, expr_print_help, &debug, E_NONE);
1061 debug += "<br>";
1062 }
1063 for (struct property *prop = sym->prop; prop; prop = prop->next) {
1064 switch (prop->type) {
1065 case P_PROMPT:
1066 case P_MENU:
1067 debug += "prompt: ";
1068 debug += print_filter(_(prop->text));
1069 debug += "<br>";
1070 break;
1071 case P_DEFAULT:
1072 debug += "default: ";
1073 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
1074 debug += "<br>";
1075 break;
1076 case P_CHOICE:
1077 if (sym_is_choice(sym)) {
1078 debug += "choice: ";
1079 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
1080 debug += "<br>";
1081 }
1082 break;
1083 case P_SELECT:
1084 debug += "select: ";
1085 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
1086 debug += "<br>";
1087 break;
1088 case P_RANGE:
1089 debug += "range: ";
1090 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
1091 debug += "<br>";
1092 break;
1093 default:
1094 debug += "unknown property: ";
1095 debug += prop_get_type_name(prop->type);
1096 debug += "<br>";
1097 }
1098 if (prop->visible.expr) {
1099 debug += "&nbsp;&nbsp;&nbsp;&nbsp;dep: ";
1100 expr_print(prop->visible.expr, expr_print_help, &debug, E_NONE);
1101 debug += "<br>";
1102 }
1103 }
1104 debug += "<br>";
1105 }
1106
1107 help = print_filter(_(sym->help));
1108 } else if (menu->prompt) {
1109 head += "<big><b>";
1110 head += print_filter(_(menu->prompt->text));
1111 head += "</b></big><br><br>";
1112 if (showDebug) {
1113 if (menu->prompt->visible.expr) {
1114 debug += "&nbsp;&nbsp;dep: ";
1115 expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE);
1116 debug += "<br><br>";
1117 }
1118 }
1119 }
1120 if (showDebug)
1121 debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno);
1122 helpText->setText(head + debug + help);
1123} 1246}
1124 1247
1125void ConfigMainWindow::loadConfig(void) 1248void ConfigMainWindow::loadConfig(void)
@@ -1147,6 +1270,13 @@ void ConfigMainWindow::saveConfigAs(void)
1147 QMessageBox::information(this, "qconf", "Unable to save configuration!"); 1270 QMessageBox::information(this, "qconf", "Unable to save configuration!");
1148} 1271}
1149 1272
1273void ConfigMainWindow::searchConfig(void)
1274{
1275 if (!searchWindow)
1276 searchWindow = new ConfigSearchWindow(this);
1277 searchWindow->show();
1278}
1279
1150void ConfigMainWindow::changeMenu(struct menu *menu) 1280void ConfigMainWindow::changeMenu(struct menu *menu)
1151{ 1281{
1152 configList->setRootMenu(menu); 1282 configList->setRootMenu(menu);
@@ -1233,13 +1363,6 @@ void ConfigMainWindow::setShowAll(bool b)
1233 menuList->updateListAll(); 1363 menuList->updateListAll();
1234} 1364}
1235 1365
1236void ConfigMainWindow::setShowDebug(bool b)
1237{
1238 if (showDebug == b)
1239 return;
1240 showDebug = b;
1241}
1242
1243void ConfigMainWindow::setShowName(bool b) 1366void ConfigMainWindow::setShowName(bool b)
1244{ 1367{
1245 if (configList->showName == b) 1368 if (configList->showName == b)
@@ -1334,7 +1457,7 @@ void ConfigMainWindow::saveSettings(void)
1334 configSettings->writeEntry("/kconfig/qconf/showRange", configList->showRange); 1457 configSettings->writeEntry("/kconfig/qconf/showRange", configList->showRange);
1335 configSettings->writeEntry("/kconfig/qconf/showData", configList->showData); 1458 configSettings->writeEntry("/kconfig/qconf/showData", configList->showData);
1336 configSettings->writeEntry("/kconfig/qconf/showAll", configList->showAll); 1459 configSettings->writeEntry("/kconfig/qconf/showAll", configList->showAll);
1337 configSettings->writeEntry("/kconfig/qconf/showDebug", showDebug); 1460 configSettings->writeEntry("/kconfig/qconf/showDebug", helpText->showDebug());
1338 1461
1339 QString entry; 1462 QString entry;
1340 switch(configList->mode) { 1463 switch(configList->mode) {
@@ -1417,9 +1540,10 @@ int main(int ac, char** av)
1417 v = new ConfigMainWindow(); 1540 v = new ConfigMainWindow();
1418 1541
1419 //zconfdump(stdout); 1542 //zconfdump(stdout);
1420 v->show(); 1543 configApp->setMainWidget(v);
1421 configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); 1544 configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit()));
1422 configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings())); 1545 configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings()));
1546 v->show();
1423 configApp->exec(); 1547 configApp->exec();
1424 1548
1425 return 0; 1549 return 0;
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index e52f3e90bf0c..a548d13149b3 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -36,7 +36,7 @@ class ConfigView : public QVBox {
36 Q_OBJECT 36 Q_OBJECT
37 typedef class QVBox Parent; 37 typedef class QVBox Parent;
38public: 38public:
39 ConfigView(QWidget* parent, ConfigMainWindow* cview, ConfigSettings* configSettings); 39 ConfigView(QWidget* parent, ConfigSettings* configSettings);
40 ~ConfigView(void); 40 ~ConfigView(void);
41 static void updateList(ConfigItem* item); 41 static void updateList(ConfigItem* item);
42 static void updateListAll(void); 42 static void updateListAll(void);
@@ -53,14 +53,14 @@ enum colIdx {
53 promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr 53 promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr
54}; 54};
55enum listMode { 55enum listMode {
56 singleMode, menuMode, symbolMode, fullMode 56 singleMode, menuMode, symbolMode, fullMode, listMode
57}; 57};
58 58
59class ConfigList : public QListView { 59class ConfigList : public QListView {
60 Q_OBJECT 60 Q_OBJECT
61 typedef class QListView Parent; 61 typedef class QListView Parent;
62public: 62public:
63 ConfigList(ConfigView* p, ConfigMainWindow* cview, ConfigSettings *configSettings); 63 ConfigList(ConfigView* p, ConfigSettings *configSettings);
64 void reinit(void); 64 void reinit(void);
65 ConfigView* parent(void) const 65 ConfigView* parent(void) const
66 { 66 {
@@ -68,8 +68,6 @@ public:
68 } 68 }
69 69
70protected: 70protected:
71 ConfigMainWindow* cview;
72
73 void keyPressEvent(QKeyEvent *e); 71 void keyPressEvent(QKeyEvent *e);
74 void contentsMousePressEvent(QMouseEvent *e); 72 void contentsMousePressEvent(QMouseEvent *e);
75 void contentsMouseReleaseEvent(QMouseEvent *e); 73 void contentsMouseReleaseEvent(QMouseEvent *e);
@@ -84,6 +82,7 @@ public slots:
84 void changeValue(ConfigItem* item); 82 void changeValue(ConfigItem* item);
85 void updateSelection(void); 83 void updateSelection(void);
86signals: 84signals:
85 void menuChanged(struct menu *menu);
87 void menuSelected(struct menu *menu); 86 void menuSelected(struct menu *menu);
88 void parentSelected(void); 87 void parentSelected(void);
89 void gotFocus(void); 88 void gotFocus(void);
@@ -208,9 +207,7 @@ class ConfigLineEdit : public QLineEdit {
208 Q_OBJECT 207 Q_OBJECT
209 typedef class QLineEdit Parent; 208 typedef class QLineEdit Parent;
210public: 209public:
211 ConfigLineEdit(ConfigView* parent) 210 ConfigLineEdit(ConfigView* parent);
212 : Parent(parent)
213 { }
214 ConfigView* parent(void) const 211 ConfigView* parent(void) const
215 { 212 {
216 return (ConfigView*)Parent::parent(); 213 return (ConfigView*)Parent::parent();
@@ -222,6 +219,47 @@ public:
222 ConfigItem *item; 219 ConfigItem *item;
223}; 220};
224 221
222class ConfigInfoView : public QTextBrowser {
223 Q_OBJECT
224 typedef class QTextBrowser Parent;
225public:
226 ConfigInfoView(QWidget* parent, const char *name = 0);
227 bool showDebug(void) const { return _showDebug; }
228
229public slots:
230 void setInfo(struct menu *menu);
231 void setSource(const QString& name);
232 void setShowDebug(bool);
233
234signals:
235 void showDebugChanged(bool);
236
237protected:
238 void menuInfo(void);
239 QString debug_info(struct symbol *sym);
240 static QString print_filter(const QString &str);
241 static void expr_print_help(void *data, const char *str);
242
243 struct menu *menu;
244 bool _showDebug;
245};
246
247class ConfigSearchWindow : public QDialog {
248 Q_OBJECT
249 typedef class QDialog Parent;
250public:
251 ConfigSearchWindow(QWidget* parent);
252public slots:
253 void search(void);
254protected:
255 QLineEdit* editField;
256 QPushButton* searchButton;
257 ConfigView* list;
258 ConfigInfoView* info;
259
260 struct symbol **result;
261};
262
225class ConfigMainWindow : public QMainWindow { 263class ConfigMainWindow : public QMainWindow {
226 Q_OBJECT 264 Q_OBJECT
227public: 265public:
@@ -234,11 +272,11 @@ public slots:
234 void loadConfig(void); 272 void loadConfig(void);
235 void saveConfig(void); 273 void saveConfig(void);
236 void saveConfigAs(void); 274 void saveConfigAs(void);
275 void searchConfig(void);
237 void showSingleView(void); 276 void showSingleView(void);
238 void showSplitView(void); 277 void showSplitView(void);
239 void showFullView(void); 278 void showFullView(void);
240 void setShowAll(bool); 279 void setShowAll(bool);
241 void setShowDebug(bool);
242 void setShowRange(bool); 280 void setShowRange(bool);
243 void setShowName(bool); 281 void setShowName(bool);
244 void setShowData(bool); 282 void setShowData(bool);
@@ -249,15 +287,14 @@ public slots:
249protected: 287protected:
250 void closeEvent(QCloseEvent *e); 288 void closeEvent(QCloseEvent *e);
251 289
290 ConfigSearchWindow *searchWindow;
252 ConfigView *menuView; 291 ConfigView *menuView;
253 ConfigList *menuList; 292 ConfigList *menuList;
254 ConfigView *configView; 293 ConfigView *configView;
255 ConfigList *configList; 294 ConfigList *configList;
256 QTextView *helpText; 295 ConfigInfoView *helpText;
257 QToolBar *toolBar; 296 QToolBar *toolBar;
258 QAction *backAction; 297 QAction *backAction;
259 QSplitter* split1; 298 QSplitter* split1;
260 QSplitter* split2; 299 QSplitter* split2;
261
262 bool showDebug;
263}; 300};