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.cc405
1 files changed, 253 insertions, 152 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index bed541d..52419ad 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -42,15 +42,12 @@ static QSettings *configSettings;
42 * menu: entry to be updated 42 * menu: entry to be updated
43 */ 43 */
44template <class P> 44template <class P>
45static void updateMenuList(P* parent, struct menu* menu) 45void ConfigList::updateMenuList(P* parent, struct menu* menu)
46{ 46{
47 struct menu* child; 47 struct menu* child;
48 ConfigList* list = parent->listView();
49 ConfigItem* item; 48 ConfigItem* item;
50 ConfigItem* last; 49 ConfigItem* last;
51 bool visible; 50 bool visible;
52 bool showAll = list->showAll;
53 enum listMode mode = list->mode;
54 enum prop_type type; 51 enum prop_type type;
55 52
56 if (!menu) { 53 if (!menu) {
@@ -59,18 +56,20 @@ static void updateMenuList(P* parent, struct menu* menu)
59 return; 56 return;
60 } 57 }
61 58
62 last = 0; 59 last = parent->firstChild();
60 if (last && !last->goParent)
61 last = 0;
63 for (child = menu->list; child; child = child->next) { 62 for (child = menu->list; child; child = child->next) {
64 item = last ? last->nextSibling() : parent->firstChild(); 63 item = last ? last->nextSibling() : parent->firstChild();
65 type = child->prompt ? child->prompt->type : P_UNKNOWN; 64 type = child->prompt ? child->prompt->type : P_UNKNOWN;
66 65
67 switch (mode) { 66 switch (mode) {
68 case menuMode: 67 case menuMode:
69 if (type != P_ROOTMENU) 68 if (!(child->flags & MENU_ROOT))
70 goto hide; 69 goto hide;
71 break; 70 break;
72 case symbolMode: 71 case symbolMode:
73 if (type == P_ROOTMENU) 72 if (child->flags & MENU_ROOT)
74 goto hide; 73 goto hide;
75 break; 74 break;
76 default: 75 default:
@@ -81,26 +80,17 @@ static void updateMenuList(P* parent, struct menu* menu)
81 if (showAll || visible) { 80 if (showAll || visible) {
82 if (!item || item->menu != child) 81 if (!item || item->menu != child)
83 item = new ConfigItem(parent, last, child, visible); 82 item = new ConfigItem(parent, last, child, visible);
84 else { 83 else
85 item->visible = visible; 84 item->testUpdateMenu(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 }
94 85
95 if (mode == fullMode || mode == menuMode || 86 if (mode == fullMode || mode == menuMode || type != P_MENU)
96 (type != P_MENU && type != P_ROOTMENU))
97 updateMenuList(item, child); 87 updateMenuList(item, child);
98 else 88 else
99 updateMenuList(item, 0); 89 updateMenuList(item, 0);
100 last = item; 90 last = item;
101 continue; 91 continue;
102 } 92 }
103 hide: 93 hide:
104 if (item && item->menu == child) { 94 if (item && item->menu == child) {
105 last = parent->firstChild(); 95 last = parent->firstChild();
106 if (last == item) 96 if (last == item)
@@ -131,24 +121,45 @@ void ConfigItem::updateMenu(void)
131{ 121{
132 ConfigList* list; 122 ConfigList* list;
133 struct symbol* sym; 123 struct symbol* sym;
124 struct property *prop;
134 QString prompt; 125 QString prompt;
135 int type; 126 int type;
136 enum prop_type ptype;
137 tristate expr; 127 tristate expr;
138 128
139 list = listView(); 129 list = listView();
130 if (goParent) {
131 setPixmap(promptColIdx, list->menuBackPix);
132 prompt = "..";
133 goto set_prompt;
134 }
140 135
141 sym = menu->sym; 136 sym = menu->sym;
142 if (!sym) { 137 prop = menu->prompt;
143 setText(promptColIdx, menu_get_prompt(menu)); 138 prompt = menu_get_prompt(menu);
144 ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; 139
145 if ((ptype == P_ROOTMENU || ptype == P_MENU) && 140 if (prop) switch (prop->type) {
146 (list->mode == singleMode || list->mode == symbolMode)) 141 case P_MENU:
142 if (list->mode == singleMode || list->mode == symbolMode) {
143 /* a menuconfig entry is displayed differently
144 * depending whether it's at the view root or a child.
145 */
146 if (sym && list->rootEntry == menu)
147 break;
147 setPixmap(promptColIdx, list->menuPix); 148 setPixmap(promptColIdx, list->menuPix);
148 else 149 } else {
150 if (sym)
151 break;
149 setPixmap(promptColIdx, 0); 152 setPixmap(promptColIdx, 0);
150 return; 153 }
154 goto set_prompt;
155 case P_COMMENT:
156 setPixmap(promptColIdx, 0);
157 goto set_prompt;
158 default:
159 ;
151 } 160 }
161 if (!sym)
162 goto set_prompt;
152 163
153 setText(nameColIdx, sym->name); 164 setText(nameColIdx, sym->name);
154 165
@@ -158,8 +169,8 @@ void ConfigItem::updateMenu(void)
158 case S_TRISTATE: 169 case S_TRISTATE:
159 char ch; 170 char ch;
160 171
161 prompt = menu_get_prompt(menu);
162 if (!sym_is_changable(sym) && !list->showAll) { 172 if (!sym_is_changable(sym) && !list->showAll) {
173 setPixmap(promptColIdx, 0);
163 setText(noColIdx, 0); 174 setText(noColIdx, 0);
164 setText(modColIdx, 0); 175 setText(modColIdx, 0);
165 setText(yesColIdx, 0); 176 setText(yesColIdx, 0);
@@ -211,26 +222,33 @@ void ConfigItem::updateMenu(void)
211#endif 222#endif
212 setText(dataColIdx, data); 223 setText(dataColIdx, data);
213 if (type == S_STRING) 224 if (type == S_STRING)
214 prompt.sprintf("%s: %s", menu_get_prompt(menu), data); 225 prompt.sprintf("%s: %s", prompt.latin1(), data);
215 else 226 else
216 prompt.sprintf("(%s) %s", data, menu_get_prompt(menu)); 227 prompt.sprintf("(%s) %s", data, prompt.latin1());
217 break; 228 break;
218 } 229 }
219 if (!sym_has_value(sym) && visible) 230 if (!sym_has_value(sym) && visible)
220 prompt += " (NEW)"; 231 prompt += " (NEW)";
232set_prompt:
221 setText(promptColIdx, prompt); 233 setText(promptColIdx, prompt);
222} 234}
223 235
224bool ConfigItem::updateNeeded(void) 236void ConfigItem::testUpdateMenu(bool v)
225{ 237{
226 struct symbol* sym = menu->sym; 238 ConfigItem* i;
227 if (sym) 239
228 sym_calc_value(sym); 240 visible = v;
241 if (!menu)
242 return;
243
244 sym_calc_value(menu->sym);
229 if (menu->flags & MENU_CHANGED) { 245 if (menu->flags & MENU_CHANGED) {
246 /* the menu entry changed, so update all list items */
230 menu->flags &= ~MENU_CHANGED; 247 menu->flags &= ~MENU_CHANGED;
231 return true; 248 for (i = (ConfigItem*)menu->data; i; i = i->nextItem)
232 } 249 i->updateMenu();
233 return false; 250 } else if (listView()->updateAll)
251 updateMenu();
234} 252}
235 253
236void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align) 254void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align)
@@ -251,14 +269,15 @@ void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int w
251 */ 269 */
252void ConfigItem::init(void) 270void ConfigItem::init(void)
253{ 271{
254 ConfigList* list = listView(); 272 if (menu) {
255 nextItem = (ConfigItem*)menu->data; 273 ConfigList* list = listView();
256 menu->data = this; 274 nextItem = (ConfigItem*)menu->data;
275 menu->data = this;
257 276
258 if (list->mode != fullMode) 277 if (list->mode != fullMode)
259 setOpen(TRUE); 278 setOpen(TRUE);
260 if (menu->sym)
261 sym_calc_value(menu->sym); 279 sym_calc_value(menu->sym);
280 }
262 updateMenu(); 281 updateMenu();
263} 282}
264 283
@@ -267,11 +286,13 @@ void ConfigItem::init(void)
267 */ 286 */
268ConfigItem::~ConfigItem(void) 287ConfigItem::~ConfigItem(void)
269{ 288{
270 ConfigItem** ip = &(ConfigItem*)menu->data; 289 if (menu) {
271 for (; *ip; ip = &(*ip)->nextItem) { 290 ConfigItem** ip = (ConfigItem**)&menu->data;
272 if (*ip == this) { 291 for (; *ip; ip = &(*ip)->nextItem) {
273 *ip = nextItem; 292 if (*ip == this) {
274 break; 293 *ip = nextItem;
294 break;
295 }
275 } 296 }
276 } 297 }
277} 298}
@@ -310,7 +331,8 @@ ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv)
310 : Parent(p), cview(cv), 331 : Parent(p), cview(cv),
311 updateAll(false), 332 updateAll(false),
312 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), 333 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
313 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), menuPix(xpm_menu), menuInvPix(xpm_menu_inv), 334 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
335 menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void),
314 showAll(false), showName(false), showRange(false), showData(false), 336 showAll(false), showName(false), showRange(false), showData(false),
315 rootEntry(0) 337 rootEntry(0)
316{ 338{
@@ -366,14 +388,37 @@ void ConfigList::updateSelection(void)
366 cview->setHelp(item); 388 cview->setHelp(item);
367 389
368 menu = item->menu; 390 menu = item->menu;
391 if (!menu)
392 return;
369 type = menu->prompt ? menu->prompt->type : P_UNKNOWN; 393 type = menu->prompt ? menu->prompt->type : P_UNKNOWN;
370 if (mode == menuMode && (type == P_MENU || type == P_ROOTMENU)) 394 if (mode == menuMode && type == P_MENU)
371 emit menuSelected(menu); 395 emit menuSelected(menu);
372} 396}
373 397
374void ConfigList::updateList(ConfigItem* item) 398void ConfigList::updateList(ConfigItem* item)
375{ 399{
376 (void)item;// unused so far 400 ConfigItem* last = 0;
401
402 if (!rootEntry)
403 goto update;
404
405 if (rootEntry != &rootmenu && (mode == singleMode ||
406 (mode == symbolMode && rootEntry->parent != &rootmenu))) {
407 item = firstChild();
408 if (!item)
409 item = new ConfigItem(this, 0, true);
410 last = item;
411 }
412 if (mode == singleMode && rootEntry->sym && rootEntry->prompt) {
413 item = last ? last->nextSibling() : firstChild();
414 if (!item)
415 item = new ConfigItem(this, last, rootEntry, true);
416
417 updateMenuList(item, rootEntry);
418 triggerUpdate();
419 return;
420 }
421update:
377 updateMenuList(this, rootEntry); 422 updateMenuList(this, rootEntry);
378 triggerUpdate(); 423 triggerUpdate();
379} 424}
@@ -392,7 +437,7 @@ void ConfigList::setValue(ConfigItem* item, tristate val)
392 int type; 437 int type;
393 tristate oldval; 438 tristate oldval;
394 439
395 sym = item->menu->sym; 440 sym = item->menu ? item->menu->sym : 0;
396 if (!sym) 441 if (!sym)
397 return; 442 return;
398 443
@@ -418,6 +463,8 @@ void ConfigList::changeValue(ConfigItem* item)
418 int type, oldexpr, newexpr; 463 int type, oldexpr, newexpr;
419 464
420 menu = item->menu; 465 menu = item->menu;
466 if (!menu)
467 return;
421 sym = menu->sym; 468 sym = menu->sym;
422 if (!sym) { 469 if (!sym) {
423 if (item->menu->list) 470 if (item->menu->list)
@@ -460,7 +507,7 @@ void ConfigList::setRootMenu(struct menu *menu)
460 if (rootEntry == menu) 507 if (rootEntry == menu)
461 return; 508 return;
462 type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN; 509 type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN;
463 if (type != P_MENU && type != P_ROOTMENU) 510 if (type != P_MENU)
464 return; 511 return;
465 updateMenuList(this, 0); 512 updateMenuList(this, 0);
466 rootEntry = menu; 513 rootEntry = menu;
@@ -471,13 +518,12 @@ void ConfigList::setRootMenu(struct menu *menu)
471void ConfigList::setParentMenu(void) 518void ConfigList::setParentMenu(void)
472{ 519{
473 ConfigItem* item; 520 ConfigItem* item;
474 struct menu *oldroot, *newroot; 521 struct menu *oldroot;
475 522
476 oldroot = rootEntry; 523 oldroot = rootEntry;
477 newroot = menu_get_parent_menu(oldroot); 524 if (rootEntry == &rootmenu)
478 if (newroot == oldroot)
479 return; 525 return;
480 setRootMenu(newroot); 526 setRootMenu(menu_get_parent_menu(rootEntry->parent));
481 527
482 QListViewItemIterator it(this); 528 QListViewItemIterator it(this);
483 for (; (item = (ConfigItem*)it.current()); it++) { 529 for (; (item = (ConfigItem*)it.current()); it++) {
@@ -511,9 +557,16 @@ void ConfigList::keyPressEvent(QKeyEvent* ev)
511 switch (ev->key()) { 557 switch (ev->key()) {
512 case Key_Return: 558 case Key_Return:
513 case Key_Enter: 559 case Key_Enter:
560 if (item->goParent) {
561 emit parentSelected();
562 break;
563 }
514 menu = item->menu; 564 menu = item->menu;
565 if (!menu)
566 break;
515 type = menu->prompt ? menu->prompt->type : P_UNKNOWN; 567 type = menu->prompt ? menu->prompt->type : P_UNKNOWN;
516 if ((type == P_MENU || type == P_ROOTMENU) && mode != fullMode) { 568 if (type == P_MENU && rootEntry != menu &&
569 mode != fullMode && mode != menuMode) {
517 emit menuSelected(menu); 570 emit menuSelected(menu);
518 break; 571 break;
519 } 572 }
@@ -548,6 +601,7 @@ void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e)
548 QPoint p(contentsToViewport(e->pos())); 601 QPoint p(contentsToViewport(e->pos()));
549 ConfigItem* item = (ConfigItem*)itemAt(p); 602 ConfigItem* item = (ConfigItem*)itemAt(p);
550 struct menu *menu; 603 struct menu *menu;
604 enum prop_type ptype;
551 const QPixmap* pm; 605 const QPixmap* pm;
552 int idx, x; 606 int idx, x;
553 607
@@ -564,10 +618,17 @@ void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e)
564 int off = header()->sectionPos(0) + itemMargin() + 618 int off = header()->sectionPos(0) + itemMargin() +
565 treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0)); 619 treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0));
566 if (x >= off && x < off + pm->width()) { 620 if (x >= off && x < off + pm->width()) {
567 if (menu->sym) 621 if (item->goParent) {
568 changeValue(item); 622 emit parentSelected();
569 else 623 break;
624 } else if (!menu)
625 break;
626 ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
627 if (ptype == P_MENU && rootEntry != menu &&
628 mode != fullMode && mode != menuMode)
570 emit menuSelected(menu); 629 emit menuSelected(menu);
630 else
631 changeValue(item);
571 } 632 }
572 } 633 }
573 break; 634 break;
@@ -606,10 +667,15 @@ void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e)
606 667
607 if (!item) 668 if (!item)
608 goto skip; 669 goto skip;
670 if (item->goParent) {
671 emit parentSelected();
672 goto skip;
673 }
609 menu = item->menu; 674 menu = item->menu;
675 if (!menu)
676 goto skip;
610 ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; 677 ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
611 if ((ptype == P_ROOTMENU || ptype == P_MENU) && 678 if (ptype == P_MENU && (mode == singleMode || mode == symbolMode))
612 (mode == singleMode || mode == symbolMode))
613 emit menuSelected(menu); 679 emit menuSelected(menu);
614 else if (menu->sym) 680 else if (menu->sym)
615 changeValue(item); 681 changeValue(item);
@@ -677,7 +743,6 @@ void ConfigView::updateListAll(void)
677 */ 743 */
678ConfigMainWindow::ConfigMainWindow(void) 744ConfigMainWindow::ConfigMainWindow(void)
679{ 745{
680 ConfigView* view;
681 QMenuBar* menu; 746 QMenuBar* menu;
682 QSplitter* split1; 747 QSplitter* split1;
683 QSplitter* split2; 748 QSplitter* split2;
@@ -707,15 +772,15 @@ ConfigMainWindow::ConfigMainWindow(void)
707 split1->setOrientation(QSplitter::Horizontal); 772 split1->setOrientation(QSplitter::Horizontal);
708 setCentralWidget(split1); 773 setCentralWidget(split1);
709 774
710 view = new ConfigView(split1, this); 775 menuView = new ConfigView(split1, this);
711 menuList = view->list; 776 menuList = menuView->list;
712 777
713 split2 = new QSplitter(split1); 778 split2 = new QSplitter(split1);
714 split2->setOrientation(QSplitter::Vertical); 779 split2->setOrientation(QSplitter::Vertical);
715 780
716 // create config tree 781 // create config tree
717 view = new ConfigView(split2, this); 782 configView = new ConfigView(split2, this);
718 configList = view->list; 783 configList = configView->list;
719 784
720 helpText = new QTextView(split2); 785 helpText = new QTextView(split2);
721 helpText->setTextFormat(Qt::RichText); 786 helpText->setTextFormat(Qt::RichText);
@@ -818,7 +883,6 @@ ConfigMainWindow::ConfigMainWindow(void)
818 connect(menuList, SIGNAL(gotFocus(void)), 883 connect(menuList, SIGNAL(gotFocus(void)),
819 SLOT(listFocusChanged(void))); 884 SLOT(listFocusChanged(void)));
820 885
821 //showFullView();
822 showSplitView(); 886 showSplitView();
823} 887}
824 888
@@ -864,89 +928,107 @@ static void expr_print_help(void *data, const char *str)
864void ConfigMainWindow::setHelp(QListViewItem* item) 928void ConfigMainWindow::setHelp(QListViewItem* item)
865{ 929{
866 struct symbol* sym; 930 struct symbol* sym;
867 struct menu* menu; 931 struct menu* menu = 0;
868 932
869 configList->parent()->lineEdit->hide(); 933 configList->parent()->lineEdit->hide();
870 if (item) { 934 if (item)
871 QString head, debug, help;
872 menu = ((ConfigItem*)item)->menu; 935 menu = ((ConfigItem*)item)->menu;
873 sym = menu->sym; 936 if (!menu) {
874 if (sym) { 937 helpText->setText(NULL);
875 if (menu->prompt) { 938 return;
876 head += "<big><b>"; 939 }
877 head += print_filter(menu->prompt->text); 940
878 head += "</b></big>"; 941 QString head, debug, help;
879 if (sym->name) { 942 menu = ((ConfigItem*)item)->menu;
880 head += " ("; 943 sym = menu->sym;
881 head += print_filter(sym->name); 944 if (sym) {
882 head += ")"; 945 if (menu->prompt) {
883 } 946 head += "<big><b>";
884 } else if (sym->name) { 947 head += print_filter(menu->prompt->text);
885 head += "<big><b>"; 948 head += "</b></big>";
949 if (sym->name) {
950 head += " (";
886 head += print_filter(sym->name); 951 head += print_filter(sym->name);
887 head += "</b></big>"; 952 head += ")";
888 } 953 }
889 head += "<br><br>"; 954 } else if (sym->name) {
890 955 head += "<big><b>";
891 if (showDebug) { 956 head += print_filter(sym->name);
892 debug += "type: "; 957 head += "</b></big>";
893 debug += print_filter(sym_type_name(sym->type)); 958 }
959 head += "<br><br>";
960
961 if (showDebug) {
962 debug += "type: ";
963 debug += print_filter(sym_type_name(sym->type));
964 if (sym_is_choice(sym))
965 debug += " (choice)";
966 debug += "<br>";
967 if (sym->rev_dep.expr) {
968 debug += "reverse dep: ";
969 expr_print(sym->rev_dep.expr, expr_print_help, &debug, E_NONE);
894 debug += "<br>"; 970 debug += "<br>";
895 for (struct property *prop = sym->prop; prop; prop = prop->next) { 971 }
896 switch (prop->type) { 972 for (struct property *prop = sym->prop; prop; prop = prop->next) {
897 case P_PROMPT: 973 switch (prop->type) {
898 debug += "prompt: "; 974 case P_PROMPT:
899 debug += print_filter(prop->text); 975 case P_MENU:
900 debug += "<br>"; 976 debug += "prompt: ";
901 if (prop->visible.expr) { 977 debug += print_filter(prop->text);
902 debug += "&nbsp;&nbsp;dep: "; 978 debug += "<br>";
903 expr_print(prop->visible.expr, expr_print_help, &debug, E_NONE); 979 break;
904 debug += "<br>"; 980 case P_DEFAULT:
905 } 981 debug += "default: ";
906 break; 982 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
907 case P_DEFAULT: 983 debug += "<br>";
908 debug += "default: "; 984 break;
909 if (sym_is_choice(sym)) 985 case P_CHOICE:
910 debug += print_filter(prop->def->name); 986 if (sym_is_choice(sym)) {
911 else { 987 debug += "choice: ";
912 sym_calc_value(prop->def); 988 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
913 debug += print_filter(sym_get_string_value(prop->def));
914 }
915 debug += "<br>";
916 if (prop->visible.expr) {
917 debug += "&nbsp;&nbsp;dep: ";
918 expr_print(prop->visible.expr, expr_print_help, &debug, E_NONE);
919 debug += "<br>";
920 }
921 break;
922 case P_CHOICE:
923 break;
924 default:
925 debug += "unknown property: ";
926 debug += prop_get_type_name(prop->type);
927 debug += "<br>"; 989 debug += "<br>";
928 } 990 }
991 break;
992 case P_SELECT:
993 debug += "select: ";
994 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
995 debug += "<br>";
996 break;
997 case P_RANGE:
998 debug += "range: ";
999 expr_print(prop->expr, expr_print_help, &debug, E_NONE);
1000 debug += "<br>";
1001 break;
1002 default:
1003 debug += "unknown property: ";
1004 debug += prop_get_type_name(prop->type);
1005 debug += "<br>";
929 } 1006 }
930 debug += "<br>"; 1007 if (prop->visible.expr) {
931 } 1008 debug += "&nbsp;&nbsp;&nbsp;&nbsp;dep: ";
932 1009 expr_print(prop->visible.expr, expr_print_help, &debug, E_NONE);
933 help = print_filter(sym->help);
934 } else if (menu->prompt) {
935 head += "<big><b>";
936 head += print_filter(menu->prompt->text);
937 head += "</b></big><br><br>";
938 if (showDebug) {
939 if (menu->prompt->visible.expr) {
940 debug += "&nbsp;&nbsp;dep: ";
941 expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE);
942 debug += "<br>"; 1010 debug += "<br>";
943 } 1011 }
944 } 1012 }
1013 debug += "<br>";
1014 }
1015
1016 help = print_filter(sym->help);
1017 } else if (menu->prompt) {
1018 head += "<big><b>";
1019 head += print_filter(menu->prompt->text);
1020 head += "</b></big><br><br>";
1021 if (showDebug) {
1022 if (menu->prompt->visible.expr) {
1023 debug += "&nbsp;&nbsp;dep: ";
1024 expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE);
1025 debug += "<br><br>";
1026 }
945 } 1027 }
946 helpText->setText(head + debug + help);
947 return;
948 } 1028 }
949 helpText->setText(NULL); 1029 if (showDebug)
1030 debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno);
1031 helpText->setText(head + debug + help);
950} 1032}
951 1033
952void ConfigMainWindow::loadConfig(void) 1034void ConfigMainWindow::loadConfig(void)
@@ -1010,7 +1092,7 @@ void ConfigMainWindow::goBack(void)
1010 1092
1011void ConfigMainWindow::showSingleView(void) 1093void ConfigMainWindow::showSingleView(void)
1012{ 1094{
1013 menuList->hide(); 1095 menuView->hide();
1014 menuList->setRootMenu(0); 1096 menuList->setRootMenu(0);
1015 configList->mode = singleMode; 1097 configList->mode = singleMode;
1016 if (configList->rootEntry == &rootmenu) 1098 if (configList->rootEntry == &rootmenu)
@@ -1032,14 +1114,14 @@ void ConfigMainWindow::showSplitView(void)
1032 configApp->processEvents(); 1114 configApp->processEvents();
1033 menuList->mode = menuMode; 1115 menuList->mode = menuMode;
1034 menuList->setRootMenu(&rootmenu); 1116 menuList->setRootMenu(&rootmenu);
1035 menuList->show();
1036 menuList->setAllOpen(TRUE); 1117 menuList->setAllOpen(TRUE);
1118 menuView->show();
1037 menuList->setFocus(); 1119 menuList->setFocus();
1038} 1120}
1039 1121
1040void ConfigMainWindow::showFullView(void) 1122void ConfigMainWindow::showFullView(void)
1041{ 1123{
1042 menuList->hide(); 1124 menuView->hide();
1043 menuList->setRootMenu(0); 1125 menuList->setRootMenu(0);
1044 configList->mode = fullMode; 1126 configList->mode = fullMode;
1045 if (configList->rootEntry == &rootmenu) 1127 if (configList->rootEntry == &rootmenu)
@@ -1073,6 +1155,8 @@ void ConfigMainWindow::setShowName(bool b)
1073 return; 1155 return;
1074 configList->showName = b; 1156 configList->showName = b;
1075 configList->reinit(); 1157 configList->reinit();
1158 menuList->showName = b;
1159 menuList->reinit();
1076} 1160}
1077 1161
1078void ConfigMainWindow::setShowRange(bool b) 1162void ConfigMainWindow::setShowRange(bool b)
@@ -1081,6 +1165,8 @@ void ConfigMainWindow::setShowRange(bool b)
1081 return; 1165 return;
1082 configList->showRange = b; 1166 configList->showRange = b;
1083 configList->reinit(); 1167 configList->reinit();
1168 menuList->showRange = b;
1169 menuList->reinit();
1084} 1170}
1085 1171
1086void ConfigMainWindow::setShowData(bool b) 1172void ConfigMainWindow::setShowData(bool b)
@@ -1089,6 +1175,8 @@ void ConfigMainWindow::setShowData(bool b)
1089 return; 1175 return;
1090 configList->showData = b; 1176 configList->showData = b;
1091 configList->reinit(); 1177 configList->reinit();
1178 menuList->showData = b;
1179 menuList->reinit();
1092} 1180}
1093 1181
1094/* 1182/*
@@ -1146,12 +1234,25 @@ void ConfigMainWindow::showAbout(void)
1146void fixup_rootmenu(struct menu *menu) 1234void fixup_rootmenu(struct menu *menu)
1147{ 1235{
1148 struct menu *child; 1236 struct menu *child;
1237 static int menu_cnt = 0;
1149 1238
1150 if (!menu->prompt || menu->prompt->type != P_MENU) 1239 menu->flags |= MENU_ROOT;
1151 return; 1240 for (child = menu->list; child; child = child->next) {
1152 menu->prompt->type = P_ROOTMENU; 1241 if (child->prompt && child->prompt->type == P_MENU) {
1153 for (child = menu->list; child; child = child->next) 1242 menu_cnt++;
1154 fixup_rootmenu(child); 1243 fixup_rootmenu(child);
1244 menu_cnt--;
1245 } else if (!menu_cnt)
1246 fixup_rootmenu(child);
1247 }
1248}
1249
1250static const char *progname;
1251
1252static void usage(void)
1253{
1254 printf("%s <config>\n", progname);
1255 exit(0);
1155} 1256}
1156 1257
1157int main(int ac, char** av) 1258int main(int ac, char** av)
@@ -1163,23 +1264,23 @@ int main(int ac, char** av)
1163 kconfig_load(); 1264 kconfig_load();
1164#endif 1265#endif
1165 1266
1267 progname = av[0];
1166 configApp = new QApplication(ac, av); 1268 configApp = new QApplication(ac, av);
1167#if QT_VERSION >= 300 1269#if QT_VERSION >= 300
1168 configSettings = new QSettings; 1270 configSettings = new QSettings;
1169#endif 1271#endif
1170 if (ac > 1 && av[1][0] == '-') { 1272 if (ac > 1 && av[1][0] == '-') {
1171 switch (av[1][1]) { 1273 switch (av[1][1]) {
1172 case 'a':
1173 //showAll = 1;
1174 break;
1175 case 'h': 1274 case 'h':
1176 case '?': 1275 case '?':
1177 printf("%s <config>\n", av[0]); 1276 usage();
1178 exit(0);
1179 } 1277 }
1180 name = av[2]; 1278 name = av[2];
1181 } else 1279 } else
1182 name = av[1]; 1280 name = av[1];
1281 if (!name)
1282 usage();
1283
1183 conf_parse(name); 1284 conf_parse(name);
1184 fixup_rootmenu(&rootmenu); 1285 fixup_rootmenu(&rootmenu);
1185 conf_read(NULL); 1286 conf_read(NULL);