-rw-r--r-- | scripts/kconfig/qconf.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 52419ad..0459caf 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -1,153 +1,153 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> |
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 <qapplication.h> |
7 | #include <qmainwindow.h> | 7 | #include <qmainwindow.h> |
8 | #include <qtoolbar.h> | 8 | #include <qtoolbar.h> |
9 | #include <qvbox.h> | 9 | #include <qvbox.h> |
10 | #include <qsplitter.h> | 10 | #include <qsplitter.h> |
11 | #include <qlistview.h> | 11 | #include <qlistview.h> |
12 | #include <qtextview.h> | 12 | #include <qtextview.h> |
13 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |
14 | #include <qmenubar.h> | 14 | #include <qmenubar.h> |
15 | #include <qmessagebox.h> | 15 | #include <qmessagebox.h> |
16 | #include <qaction.h> | 16 | #include <qaction.h> |
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 | 20 | #if QT_VERSION >= 0x030000 |
21 | #include <qsettings.h> | 21 | #include <qsettings.h> |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
25 | 25 | ||
26 | #include "lkc.h" | 26 | #include "lkc.h" |
27 | #include "qconf.h" | 27 | #include "qconf.h" |
28 | 28 | ||
29 | #include "qconf.moc" | 29 | #include "qconf.moc" |
30 | #include "images.c" | 30 | #include "images.c" |
31 | 31 | ||
32 | static QApplication *configApp; | 32 | static QApplication *configApp; |
33 | #if QT_VERSION >= 300 | 33 | #if QT_VERSION >= 0x030000 |
34 | static QSettings *configSettings; | 34 | static QSettings *configSettings; |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | /* | 37 | /* |
38 | * update all the children of a menu entry | 38 | * update all the children of a menu entry |
39 | * removes/adds the entries from the parent widget as necessary | 39 | * removes/adds the entries from the parent widget as necessary |
40 | * | 40 | * |
41 | * parent: either the menu list widget or a menu entry widget | 41 | * parent: either the menu list widget or a menu entry widget |
42 | * menu: entry to be updated | 42 | * menu: entry to be updated |
43 | */ | 43 | */ |
44 | template <class P> | 44 | template <class P> |
45 | void ConfigList::updateMenuList(P* parent, struct menu* menu) | 45 | void ConfigList::updateMenuList(P* parent, struct menu* menu) |
46 | { | 46 | { |
47 | struct menu* child; | 47 | struct menu* child; |
48 | ConfigItem* item; | 48 | ConfigItem* item; |
49 | ConfigItem* last; | 49 | ConfigItem* last; |
50 | bool visible; | 50 | bool visible; |
51 | enum prop_type type; | 51 | enum prop_type type; |
52 | 52 | ||
53 | if (!menu) { | 53 | if (!menu) { |
54 | while ((item = parent->firstChild())) | 54 | while ((item = parent->firstChild())) |
55 | delete item; | 55 | delete item; |
56 | return; | 56 | return; |
57 | } | 57 | } |
58 | 58 | ||
59 | last = parent->firstChild(); | 59 | last = parent->firstChild(); |
60 | if (last && !last->goParent) | 60 | if (last && !last->goParent) |
61 | last = 0; | 61 | last = 0; |
62 | for (child = menu->list; child; child = child->next) { | 62 | for (child = menu->list; child; child = child->next) { |
63 | item = last ? last->nextSibling() : parent->firstChild(); | 63 | item = last ? last->nextSibling() : parent->firstChild(); |
64 | type = child->prompt ? child->prompt->type : P_UNKNOWN; | 64 | type = child->prompt ? child->prompt->type : P_UNKNOWN; |
65 | 65 | ||
66 | switch (mode) { | 66 | switch (mode) { |
67 | case menuMode: | 67 | case menuMode: |
68 | if (!(child->flags & MENU_ROOT)) | 68 | if (!(child->flags & MENU_ROOT)) |
69 | goto hide; | 69 | goto hide; |
70 | break; | 70 | break; |
71 | case symbolMode: | 71 | case symbolMode: |
72 | if (child->flags & MENU_ROOT) | 72 | if (child->flags & MENU_ROOT) |
73 | goto hide; | 73 | goto hide; |
74 | break; | 74 | break; |
75 | default: | 75 | default: |
76 | break; | 76 | break; |
77 | } | 77 | } |
78 | 78 | ||
79 | visible = menu_is_visible(child); | 79 | visible = menu_is_visible(child); |
80 | if (showAll || visible) { | 80 | if (showAll || visible) { |
81 | if (!item || item->menu != child) | 81 | if (!item || item->menu != child) |
82 | item = new ConfigItem(parent, last, child, visible); | 82 | item = new ConfigItem(parent, last, child, visible); |
83 | else | 83 | else |
84 | item->testUpdateMenu(visible); | 84 | item->testUpdateMenu(visible); |
85 | 85 | ||
86 | if (mode == fullMode || mode == menuMode || type != P_MENU) | 86 | if (mode == fullMode || mode == menuMode || type != P_MENU) |
87 | updateMenuList(item, child); | 87 | updateMenuList(item, child); |
88 | else | 88 | else |
89 | updateMenuList(item, 0); | 89 | updateMenuList(item, 0); |
90 | last = item; | 90 | last = item; |
91 | continue; | 91 | continue; |
92 | } | 92 | } |
93 | hide: | 93 | hide: |
94 | if (item && item->menu == child) { | 94 | if (item && item->menu == child) { |
95 | last = parent->firstChild(); | 95 | last = parent->firstChild(); |
96 | if (last == item) | 96 | if (last == item) |
97 | last = 0; | 97 | last = 0; |
98 | else while (last->nextSibling() != item) | 98 | else while (last->nextSibling() != item) |
99 | last = last->nextSibling(); | 99 | last = last->nextSibling(); |
100 | delete item; | 100 | delete item; |
101 | } | 101 | } |
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | #if QT_VERSION >= 300 | 105 | #if QT_VERSION >= 0x030000 |
106 | /* | 106 | /* |
107 | * set the new data | 107 | * set the new data |
108 | * TODO check the value | 108 | * TODO check the value |
109 | */ | 109 | */ |
110 | void ConfigItem::okRename(int col) | 110 | void ConfigItem::okRename(int col) |
111 | { | 111 | { |
112 | Parent::okRename(col); | 112 | Parent::okRename(col); |
113 | sym_set_string_value(menu->sym, text(dataColIdx).latin1()); | 113 | sym_set_string_value(menu->sym, text(dataColIdx).latin1()); |
114 | } | 114 | } |
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | /* | 117 | /* |
118 | * update the displayed of a menu entry | 118 | * update the displayed of a menu entry |
119 | */ | 119 | */ |
120 | void ConfigItem::updateMenu(void) | 120 | void ConfigItem::updateMenu(void) |
121 | { | 121 | { |
122 | ConfigList* list; | 122 | ConfigList* list; |
123 | struct symbol* sym; | 123 | struct symbol* sym; |
124 | struct property *prop; | 124 | struct property *prop; |
125 | QString prompt; | 125 | QString prompt; |
126 | int type; | 126 | int type; |
127 | tristate expr; | 127 | tristate expr; |
128 | 128 | ||
129 | list = listView(); | 129 | list = listView(); |
130 | if (goParent) { | 130 | if (goParent) { |
131 | setPixmap(promptColIdx, list->menuBackPix); | 131 | setPixmap(promptColIdx, list->menuBackPix); |
132 | prompt = ".."; | 132 | prompt = ".."; |
133 | goto set_prompt; | 133 | goto set_prompt; |
134 | } | 134 | } |
135 | 135 | ||
136 | sym = menu->sym; | 136 | sym = menu->sym; |
137 | prop = menu->prompt; | 137 | prop = menu->prompt; |
138 | prompt = menu_get_prompt(menu); | 138 | prompt = menu_get_prompt(menu); |
139 | 139 | ||
140 | if (prop) switch (prop->type) { | 140 | if (prop) switch (prop->type) { |
141 | case P_MENU: | 141 | case P_MENU: |
142 | if (list->mode == singleMode || list->mode == symbolMode) { | 142 | if (list->mode == singleMode || list->mode == symbolMode) { |
143 | /* a menuconfig entry is displayed differently | 143 | /* a menuconfig entry is displayed differently |
144 | * depending whether it's at the view root or a child. | 144 | * depending whether it's at the view root or a child. |
145 | */ | 145 | */ |
146 | if (sym && list->rootEntry == menu) | 146 | if (sym && list->rootEntry == menu) |
147 | break; | 147 | break; |
148 | setPixmap(promptColIdx, list->menuPix); | 148 | setPixmap(promptColIdx, list->menuPix); |
149 | } else { | 149 | } else { |
150 | if (sym) | 150 | if (sym) |
151 | break; | 151 | break; |
152 | setPixmap(promptColIdx, 0); | 152 | setPixmap(promptColIdx, 0); |
153 | } | 153 | } |
@@ -170,97 +170,97 @@ void ConfigItem::updateMenu(void) | |||
170 | char ch; | 170 | char ch; |
171 | 171 | ||
172 | if (!sym_is_changable(sym) && !list->showAll) { | 172 | if (!sym_is_changable(sym) && !list->showAll) { |
173 | setPixmap(promptColIdx, 0); | 173 | setPixmap(promptColIdx, 0); |
174 | setText(noColIdx, 0); | 174 | setText(noColIdx, 0); |
175 | setText(modColIdx, 0); | 175 | setText(modColIdx, 0); |
176 | setText(yesColIdx, 0); | 176 | setText(yesColIdx, 0); |
177 | break; | 177 | break; |
178 | } | 178 | } |
179 | expr = sym_get_tristate_value(sym); | 179 | expr = sym_get_tristate_value(sym); |
180 | switch (expr) { | 180 | switch (expr) { |
181 | case yes: | 181 | case yes: |
182 | if (sym_is_choice_value(sym) && type == S_BOOLEAN) | 182 | if (sym_is_choice_value(sym) && type == S_BOOLEAN) |
183 | setPixmap(promptColIdx, list->choiceYesPix); | 183 | setPixmap(promptColIdx, list->choiceYesPix); |
184 | else | 184 | else |
185 | setPixmap(promptColIdx, list->symbolYesPix); | 185 | setPixmap(promptColIdx, list->symbolYesPix); |
186 | setText(yesColIdx, "Y"); | 186 | setText(yesColIdx, "Y"); |
187 | ch = 'Y'; | 187 | ch = 'Y'; |
188 | break; | 188 | break; |
189 | case mod: | 189 | case mod: |
190 | setPixmap(promptColIdx, list->symbolModPix); | 190 | setPixmap(promptColIdx, list->symbolModPix); |
191 | setText(modColIdx, "M"); | 191 | setText(modColIdx, "M"); |
192 | ch = 'M'; | 192 | ch = 'M'; |
193 | break; | 193 | break; |
194 | default: | 194 | default: |
195 | if (sym_is_choice_value(sym) && type == S_BOOLEAN) | 195 | if (sym_is_choice_value(sym) && type == S_BOOLEAN) |
196 | setPixmap(promptColIdx, list->choiceNoPix); | 196 | setPixmap(promptColIdx, list->choiceNoPix); |
197 | else | 197 | else |
198 | setPixmap(promptColIdx, list->symbolNoPix); | 198 | setPixmap(promptColIdx, list->symbolNoPix); |
199 | setText(noColIdx, "N"); | 199 | setText(noColIdx, "N"); |
200 | ch = 'N'; | 200 | ch = 'N'; |
201 | break; | 201 | break; |
202 | } | 202 | } |
203 | if (expr != no) | 203 | if (expr != no) |
204 | setText(noColIdx, sym_tristate_within_range(sym, no) ? "_" : 0); | 204 | setText(noColIdx, sym_tristate_within_range(sym, no) ? "_" : 0); |
205 | if (expr != mod) | 205 | if (expr != mod) |
206 | setText(modColIdx, sym_tristate_within_range(sym, mod) ? "_" : 0); | 206 | setText(modColIdx, sym_tristate_within_range(sym, mod) ? "_" : 0); |
207 | if (expr != yes) | 207 | if (expr != yes) |
208 | setText(yesColIdx, sym_tristate_within_range(sym, yes) ? "_" : 0); | 208 | setText(yesColIdx, sym_tristate_within_range(sym, yes) ? "_" : 0); |
209 | 209 | ||
210 | setText(dataColIdx, QChar(ch)); | 210 | setText(dataColIdx, QChar(ch)); |
211 | break; | 211 | break; |
212 | case S_INT: | 212 | case S_INT: |
213 | case S_HEX: | 213 | case S_HEX: |
214 | case S_STRING: | 214 | case S_STRING: |
215 | const char* data; | 215 | const char* data; |
216 | 216 | ||
217 | data = sym_get_string_value(sym); | 217 | data = sym_get_string_value(sym); |
218 | #if QT_VERSION >= 300 | 218 | #if QT_VERSION >= 0x030000 |
219 | int i = list->mapIdx(dataColIdx); | 219 | int i = list->mapIdx(dataColIdx); |
220 | if (i >= 0) | 220 | if (i >= 0) |
221 | setRenameEnabled(i, TRUE); | 221 | setRenameEnabled(i, TRUE); |
222 | #endif | 222 | #endif |
223 | setText(dataColIdx, data); | 223 | setText(dataColIdx, data); |
224 | if (type == S_STRING) | 224 | if (type == S_STRING) |
225 | prompt.sprintf("%s: %s", prompt.latin1(), data); | 225 | prompt.sprintf("%s: %s", prompt.latin1(), data); |
226 | else | 226 | else |
227 | prompt.sprintf("(%s) %s", data, prompt.latin1()); | 227 | prompt.sprintf("(%s) %s", data, prompt.latin1()); |
228 | break; | 228 | break; |
229 | } | 229 | } |
230 | if (!sym_has_value(sym) && visible) | 230 | if (!sym_has_value(sym) && visible) |
231 | prompt += " (NEW)"; | 231 | prompt += " (NEW)"; |
232 | set_prompt: | 232 | set_prompt: |
233 | setText(promptColIdx, prompt); | 233 | setText(promptColIdx, prompt); |
234 | } | 234 | } |
235 | 235 | ||
236 | void ConfigItem::testUpdateMenu(bool v) | 236 | void ConfigItem::testUpdateMenu(bool v) |
237 | { | 237 | { |
238 | ConfigItem* i; | 238 | ConfigItem* i; |
239 | 239 | ||
240 | visible = v; | 240 | visible = v; |
241 | if (!menu) | 241 | if (!menu) |
242 | return; | 242 | return; |
243 | 243 | ||
244 | sym_calc_value(menu->sym); | 244 | sym_calc_value(menu->sym); |
245 | if (menu->flags & MENU_CHANGED) { | 245 | if (menu->flags & MENU_CHANGED) { |
246 | /* the menu entry changed, so update all list items */ | 246 | /* the menu entry changed, so update all list items */ |
247 | menu->flags &= ~MENU_CHANGED; | 247 | menu->flags &= ~MENU_CHANGED; |
248 | for (i = (ConfigItem*)menu->data; i; i = i->nextItem) | 248 | for (i = (ConfigItem*)menu->data; i; i = i->nextItem) |
249 | i->updateMenu(); | 249 | i->updateMenu(); |
250 | } else if (listView()->updateAll) | 250 | } else if (listView()->updateAll) |
251 | updateMenu(); | 251 | updateMenu(); |
252 | } | 252 | } |
253 | 253 | ||
254 | void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align) | 254 | void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align) |
255 | { | 255 | { |
256 | ConfigList* list = listView(); | 256 | ConfigList* list = listView(); |
257 | 257 | ||
258 | if (visible) { | 258 | if (visible) { |
259 | if (isSelected() && !list->hasFocus() && list->mode == menuMode) | 259 | if (isSelected() && !list->hasFocus() && list->mode == menuMode) |
260 | Parent::paintCell(p, list->inactivedColorGroup, column, width, align); | 260 | Parent::paintCell(p, list->inactivedColorGroup, column, width, align); |
261 | else | 261 | else |
262 | Parent::paintCell(p, cg, column, width, align); | 262 | Parent::paintCell(p, cg, column, width, align); |
263 | } else | 263 | } else |
264 | Parent::paintCell(p, list->disabledColorGroup, column, width, align); | 264 | Parent::paintCell(p, list->disabledColorGroup, column, width, align); |
265 | } | 265 | } |
266 | 266 | ||
@@ -445,97 +445,97 @@ void ConfigList::setValue(ConfigItem* item, tristate val) | |||
445 | switch (type) { | 445 | switch (type) { |
446 | case S_BOOLEAN: | 446 | case S_BOOLEAN: |
447 | case S_TRISTATE: | 447 | case S_TRISTATE: |
448 | oldval = sym_get_tristate_value(sym); | 448 | oldval = sym_get_tristate_value(sym); |
449 | 449 | ||
450 | if (!sym_set_tristate_value(sym, val)) | 450 | if (!sym_set_tristate_value(sym, val)) |
451 | return; | 451 | return; |
452 | if (oldval == no && item->menu->list) | 452 | if (oldval == no && item->menu->list) |
453 | item->setOpen(TRUE); | 453 | item->setOpen(TRUE); |
454 | parent()->updateList(item); | 454 | parent()->updateList(item); |
455 | break; | 455 | break; |
456 | } | 456 | } |
457 | } | 457 | } |
458 | 458 | ||
459 | void ConfigList::changeValue(ConfigItem* item) | 459 | void ConfigList::changeValue(ConfigItem* item) |
460 | { | 460 | { |
461 | struct symbol* sym; | 461 | struct symbol* sym; |
462 | struct menu* menu; | 462 | struct menu* menu; |
463 | int type, oldexpr, newexpr; | 463 | int type, oldexpr, newexpr; |
464 | 464 | ||
465 | menu = item->menu; | 465 | menu = item->menu; |
466 | if (!menu) | 466 | if (!menu) |
467 | return; | 467 | return; |
468 | sym = menu->sym; | 468 | sym = menu->sym; |
469 | if (!sym) { | 469 | if (!sym) { |
470 | if (item->menu->list) | 470 | if (item->menu->list) |
471 | item->setOpen(!item->isOpen()); | 471 | item->setOpen(!item->isOpen()); |
472 | return; | 472 | return; |
473 | } | 473 | } |
474 | 474 | ||
475 | type = sym_get_type(sym); | 475 | type = sym_get_type(sym); |
476 | switch (type) { | 476 | switch (type) { |
477 | case S_BOOLEAN: | 477 | case S_BOOLEAN: |
478 | case S_TRISTATE: | 478 | case S_TRISTATE: |
479 | oldexpr = sym_get_tristate_value(sym); | 479 | oldexpr = sym_get_tristate_value(sym); |
480 | newexpr = sym_toggle_tristate_value(sym); | 480 | newexpr = sym_toggle_tristate_value(sym); |
481 | if (item->menu->list) { | 481 | if (item->menu->list) { |
482 | if (oldexpr == newexpr) | 482 | if (oldexpr == newexpr) |
483 | item->setOpen(!item->isOpen()); | 483 | item->setOpen(!item->isOpen()); |
484 | else if (oldexpr == no) | 484 | else if (oldexpr == no) |
485 | item->setOpen(TRUE); | 485 | item->setOpen(TRUE); |
486 | } | 486 | } |
487 | if (oldexpr != newexpr) | 487 | if (oldexpr != newexpr) |
488 | parent()->updateList(item); | 488 | parent()->updateList(item); |
489 | break; | 489 | break; |
490 | case S_INT: | 490 | case S_INT: |
491 | case S_HEX: | 491 | case S_HEX: |
492 | case S_STRING: | 492 | case S_STRING: |
493 | #if QT_VERSION >= 300 | 493 | #if QT_VERSION >= 0x030000 |
494 | if (colMap[dataColIdx] >= 0) | 494 | if (colMap[dataColIdx] >= 0) |
495 | item->startRename(colMap[dataColIdx]); | 495 | item->startRename(colMap[dataColIdx]); |
496 | else | 496 | else |
497 | #endif | 497 | #endif |
498 | parent()->lineEdit->show(item); | 498 | parent()->lineEdit->show(item); |
499 | break; | 499 | break; |
500 | } | 500 | } |
501 | } | 501 | } |
502 | 502 | ||
503 | void ConfigList::setRootMenu(struct menu *menu) | 503 | void ConfigList::setRootMenu(struct menu *menu) |
504 | { | 504 | { |
505 | enum prop_type type; | 505 | enum prop_type type; |
506 | 506 | ||
507 | if (rootEntry == menu) | 507 | if (rootEntry == menu) |
508 | return; | 508 | return; |
509 | type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN; | 509 | type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN; |
510 | if (type != P_MENU) | 510 | if (type != P_MENU) |
511 | return; | 511 | return; |
512 | updateMenuList(this, 0); | 512 | updateMenuList(this, 0); |
513 | rootEntry = menu; | 513 | rootEntry = menu; |
514 | updateListAll(); | 514 | updateListAll(); |
515 | setSelected(currentItem(), hasFocus()); | 515 | setSelected(currentItem(), hasFocus()); |
516 | } | 516 | } |
517 | 517 | ||
518 | void ConfigList::setParentMenu(void) | 518 | void ConfigList::setParentMenu(void) |
519 | { | 519 | { |
520 | ConfigItem* item; | 520 | ConfigItem* item; |
521 | struct menu *oldroot; | 521 | struct menu *oldroot; |
522 | 522 | ||
523 | oldroot = rootEntry; | 523 | oldroot = rootEntry; |
524 | if (rootEntry == &rootmenu) | 524 | if (rootEntry == &rootmenu) |
525 | return; | 525 | return; |
526 | setRootMenu(menu_get_parent_menu(rootEntry->parent)); | 526 | setRootMenu(menu_get_parent_menu(rootEntry->parent)); |
527 | 527 | ||
528 | QListViewItemIterator it(this); | 528 | QListViewItemIterator it(this); |
529 | for (; (item = (ConfigItem*)it.current()); it++) { | 529 | for (; (item = (ConfigItem*)it.current()); it++) { |
530 | if (item->menu == oldroot) { | 530 | if (item->menu == oldroot) { |
531 | setCurrentItem(item); | 531 | setCurrentItem(item); |
532 | ensureItemVisible(item); | 532 | ensureItemVisible(item); |
533 | break; | 533 | break; |
534 | } | 534 | } |
535 | } | 535 | } |
536 | } | 536 | } |
537 | 537 | ||
538 | void ConfigList::keyPressEvent(QKeyEvent* ev) | 538 | void ConfigList::keyPressEvent(QKeyEvent* ev) |
539 | { | 539 | { |
540 | QListViewItem* i = currentItem(); | 540 | QListViewItem* i = currentItem(); |
541 | ConfigItem* item; | 541 | ConfigItem* item; |
@@ -706,97 +706,97 @@ ConfigView::ConfigView(QWidget* parent, ConfigMainWindow* cview) | |||
706 | lineEdit = new ConfigLineEdit(this); | 706 | lineEdit = new ConfigLineEdit(this); |
707 | lineEdit->hide(); | 707 | lineEdit->hide(); |
708 | 708 | ||
709 | this->nextView = viewList; | 709 | this->nextView = viewList; |
710 | viewList = this; | 710 | viewList = this; |
711 | } | 711 | } |
712 | 712 | ||
713 | ConfigView::~ConfigView(void) | 713 | ConfigView::~ConfigView(void) |
714 | { | 714 | { |
715 | ConfigView** vp; | 715 | ConfigView** vp; |
716 | 716 | ||
717 | for (vp = &viewList; *vp; vp = &(*vp)->nextView) { | 717 | for (vp = &viewList; *vp; vp = &(*vp)->nextView) { |
718 | if (*vp == this) { | 718 | if (*vp == this) { |
719 | *vp = nextView; | 719 | *vp = nextView; |
720 | break; | 720 | break; |
721 | } | 721 | } |
722 | } | 722 | } |
723 | } | 723 | } |
724 | 724 | ||
725 | void ConfigView::updateList(ConfigItem* item) | 725 | void ConfigView::updateList(ConfigItem* item) |
726 | { | 726 | { |
727 | ConfigView* v; | 727 | ConfigView* v; |
728 | 728 | ||
729 | for (v = viewList; v; v = v->nextView) | 729 | for (v = viewList; v; v = v->nextView) |
730 | v->list->updateList(item); | 730 | v->list->updateList(item); |
731 | } | 731 | } |
732 | 732 | ||
733 | void ConfigView::updateListAll(void) | 733 | void ConfigView::updateListAll(void) |
734 | { | 734 | { |
735 | ConfigView* v; | 735 | ConfigView* v; |
736 | 736 | ||
737 | for (v = viewList; v; v = v->nextView) | 737 | for (v = viewList; v; v = v->nextView) |
738 | v->list->updateListAll(); | 738 | v->list->updateListAll(); |
739 | } | 739 | } |
740 | 740 | ||
741 | /* | 741 | /* |
742 | * Construct the complete config widget | 742 | * Construct the complete config widget |
743 | */ | 743 | */ |
744 | ConfigMainWindow::ConfigMainWindow(void) | 744 | ConfigMainWindow::ConfigMainWindow(void) |
745 | { | 745 | { |
746 | QMenuBar* menu; | 746 | QMenuBar* menu; |
747 | QSplitter* split1; | 747 | QSplitter* split1; |
748 | QSplitter* split2; | 748 | QSplitter* split2; |
749 | bool ok; | 749 | bool ok; |
750 | int x, y, width, height; | 750 | int x, y, width, height; |
751 | 751 | ||
752 | QWidget *d = configApp->desktop(); | 752 | QWidget *d = configApp->desktop(); |
753 | 753 | ||
754 | #if QT_VERSION >= 300 | 754 | #if QT_VERSION >= 0x030000 |
755 | width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64); | 755 | width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64); |
756 | height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64); | 756 | height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64); |
757 | resize(width, height); | 757 | resize(width, height); |
758 | x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok); | 758 | x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok); |
759 | if (ok) | 759 | if (ok) |
760 | y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok); | 760 | y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok); |
761 | if (ok) | 761 | if (ok) |
762 | move(x, y); | 762 | move(x, y); |
763 | #else | 763 | #else |
764 | width = d->width() - 64; | 764 | width = d->width() - 64; |
765 | height = d->height() - 64; | 765 | height = d->height() - 64; |
766 | resize(width, height); | 766 | resize(width, height); |
767 | #endif | 767 | #endif |
768 | 768 | ||
769 | showDebug = false; | 769 | showDebug = false; |
770 | 770 | ||
771 | split1 = new QSplitter(this); | 771 | split1 = new QSplitter(this); |
772 | split1->setOrientation(QSplitter::Horizontal); | 772 | split1->setOrientation(QSplitter::Horizontal); |
773 | setCentralWidget(split1); | 773 | setCentralWidget(split1); |
774 | 774 | ||
775 | menuView = new ConfigView(split1, this); | 775 | menuView = new ConfigView(split1, this); |
776 | menuList = menuView->list; | 776 | menuList = menuView->list; |
777 | 777 | ||
778 | split2 = new QSplitter(split1); | 778 | split2 = new QSplitter(split1); |
779 | split2->setOrientation(QSplitter::Vertical); | 779 | split2->setOrientation(QSplitter::Vertical); |
780 | 780 | ||
781 | // create config tree | 781 | // create config tree |
782 | configView = new ConfigView(split2, this); | 782 | configView = new ConfigView(split2, this); |
783 | configList = configView->list; | 783 | configList = configView->list; |
784 | 784 | ||
785 | helpText = new QTextView(split2); | 785 | helpText = new QTextView(split2); |
786 | helpText->setTextFormat(Qt::RichText); | 786 | helpText->setTextFormat(Qt::RichText); |
787 | 787 | ||
788 | setTabOrder(configList, helpText); | 788 | setTabOrder(configList, helpText); |
789 | configList->setFocus(); | 789 | configList->setFocus(); |
790 | 790 | ||
791 | menu = menuBar(); | 791 | menu = menuBar(); |
792 | toolBar = new QToolBar("Tools", this); | 792 | toolBar = new QToolBar("Tools", this); |
793 | 793 | ||
794 | backAction = new QAction("Back", QPixmap(xpm_back), "Back", 0, this); | 794 | backAction = new QAction("Back", QPixmap(xpm_back), "Back", 0, this); |
795 | connect(backAction, SIGNAL(activated()), SLOT(goBack())); | 795 | connect(backAction, SIGNAL(activated()), SLOT(goBack())); |
796 | backAction->setEnabled(FALSE); | 796 | backAction->setEnabled(FALSE); |
797 | QAction *quitAction = new QAction("Quit", "&Quit", CTRL+Key_Q, this); | 797 | QAction *quitAction = new QAction("Quit", "&Quit", CTRL+Key_Q, this); |
798 | connect(quitAction, SIGNAL(activated()), SLOT(close())); | 798 | connect(quitAction, SIGNAL(activated()), SLOT(close())); |
799 | QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this); | 799 | QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this); |
800 | connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); | 800 | connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); |
801 | QAction *saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this); | 801 | QAction *saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this); |
802 | connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); | 802 | connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); |
@@ -1221,84 +1221,84 @@ void ConfigMainWindow::showIntro(void) | |||
1221 | "which you can then match by examining other options.\n\n"; | 1221 | "which you can then match by examining other options.\n\n"; |
1222 | 1222 | ||
1223 | QMessageBox::information(this, "qconf", str); | 1223 | QMessageBox::information(this, "qconf", str); |
1224 | } | 1224 | } |
1225 | 1225 | ||
1226 | void ConfigMainWindow::showAbout(void) | 1226 | void ConfigMainWindow::showAbout(void) |
1227 | { | 1227 | { |
1228 | static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n" | 1228 | static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n" |
1229 | "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"; | 1229 | "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"; |
1230 | 1230 | ||
1231 | QMessageBox::information(this, "qconf", str); | 1231 | QMessageBox::information(this, "qconf", str); |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | void fixup_rootmenu(struct menu *menu) | 1234 | void fixup_rootmenu(struct menu *menu) |
1235 | { | 1235 | { |
1236 | struct menu *child; | 1236 | struct menu *child; |
1237 | static int menu_cnt = 0; | 1237 | static int menu_cnt = 0; |
1238 | 1238 | ||
1239 | menu->flags |= MENU_ROOT; | 1239 | menu->flags |= MENU_ROOT; |
1240 | for (child = menu->list; child; child = child->next) { | 1240 | for (child = menu->list; child; child = child->next) { |
1241 | if (child->prompt && child->prompt->type == P_MENU) { | 1241 | if (child->prompt && child->prompt->type == P_MENU) { |
1242 | menu_cnt++; | 1242 | menu_cnt++; |
1243 | fixup_rootmenu(child); | 1243 | fixup_rootmenu(child); |
1244 | menu_cnt--; | 1244 | menu_cnt--; |
1245 | } else if (!menu_cnt) | 1245 | } else if (!menu_cnt) |
1246 | fixup_rootmenu(child); | 1246 | fixup_rootmenu(child); |
1247 | } | 1247 | } |
1248 | } | 1248 | } |
1249 | 1249 | ||
1250 | static const char *progname; | 1250 | static const char *progname; |
1251 | 1251 | ||
1252 | static void usage(void) | 1252 | static void usage(void) |
1253 | { | 1253 | { |
1254 | printf("%s <config>\n", progname); | 1254 | printf("%s <config>\n", progname); |
1255 | exit(0); | 1255 | exit(0); |
1256 | } | 1256 | } |
1257 | 1257 | ||
1258 | int main(int ac, char** av) | 1258 | int main(int ac, char** av) |
1259 | { | 1259 | { |
1260 | ConfigMainWindow* v; | 1260 | ConfigMainWindow* v; |
1261 | const char *name; | 1261 | const char *name; |
1262 | 1262 | ||
1263 | #ifndef LKC_DIRECT_LINK | 1263 | #ifndef LKC_DIRECT_LINK |
1264 | kconfig_load(); | 1264 | kconfig_load(); |
1265 | #endif | 1265 | #endif |
1266 | 1266 | ||
1267 | progname = av[0]; | 1267 | progname = av[0]; |
1268 | configApp = new QApplication(ac, av); | 1268 | configApp = new QApplication(ac, av); |
1269 | #if QT_VERSION >= 300 | 1269 | #if QT_VERSION >= 0x030000 |
1270 | configSettings = new QSettings; | 1270 | configSettings = new QSettings; |
1271 | #endif | 1271 | #endif |
1272 | if (ac > 1 && av[1][0] == '-') { | 1272 | if (ac > 1 && av[1][0] == '-') { |
1273 | switch (av[1][1]) { | 1273 | switch (av[1][1]) { |
1274 | case 'h': | 1274 | case 'h': |
1275 | case '?': | 1275 | case '?': |
1276 | usage(); | 1276 | usage(); |
1277 | } | 1277 | } |
1278 | name = av[2]; | 1278 | name = av[2]; |
1279 | } else | 1279 | } else |
1280 | name = av[1]; | 1280 | name = av[1]; |
1281 | if (!name) | 1281 | if (!name) |
1282 | usage(); | 1282 | usage(); |
1283 | 1283 | ||
1284 | conf_parse(name); | 1284 | conf_parse(name); |
1285 | fixup_rootmenu(&rootmenu); | 1285 | fixup_rootmenu(&rootmenu); |
1286 | conf_read(NULL); | 1286 | conf_read(NULL); |
1287 | //zconfdump(stdout); | 1287 | //zconfdump(stdout); |
1288 | 1288 | ||
1289 | v = new ConfigMainWindow(); | 1289 | v = new ConfigMainWindow(); |
1290 | 1290 | ||
1291 | //zconfdump(stdout); | 1291 | //zconfdump(stdout); |
1292 | v->show(); | 1292 | v->show(); |
1293 | configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); | 1293 | configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); |
1294 | configApp->exec(); | 1294 | configApp->exec(); |
1295 | 1295 | ||
1296 | #if QT_VERSION >= 300 | 1296 | #if QT_VERSION >= 0x030000 |
1297 | configSettings->writeEntry("/kconfig/qconf/window x", v->pos().x()); | 1297 | configSettings->writeEntry("/kconfig/qconf/window x", v->pos().x()); |
1298 | configSettings->writeEntry("/kconfig/qconf/window y", v->pos().y()); | 1298 | configSettings->writeEntry("/kconfig/qconf/window y", v->pos().y()); |
1299 | configSettings->writeEntry("/kconfig/qconf/window width", v->size().width()); | 1299 | configSettings->writeEntry("/kconfig/qconf/window width", v->size().width()); |
1300 | configSettings->writeEntry("/kconfig/qconf/window height", v->size().height()); | 1300 | configSettings->writeEntry("/kconfig/qconf/window height", v->size().height()); |
1301 | delete configSettings; | 1301 | delete configSettings; |
1302 | #endif | 1302 | #endif |
1303 | return 0; | 1303 | return 0; |
1304 | } | 1304 | } |