~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/kconfig/qconf.cc

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/kconfig/qconf.cc (Version linux-6.12-rc7) and /scripts/kconfig/qconf.cc (Version linux-6.6.60)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2 /*                                                  2 /*
  3  * Copyright (C) 2002 Roman Zippel <zippel@lin      3  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  4  * Copyright (C) 2015 Boris Barbulovski <bbarb      4  * Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com>
  5  */                                                 5  */
  6                                                     6 
  7 #include <QAction>                                  7 #include <QAction>
  8 #include <QActionGroup>                             8 #include <QActionGroup>
  9 #include <QApplication>                             9 #include <QApplication>
 10 #include <QCloseEvent>                             10 #include <QCloseEvent>
 11 #include <QDebug>                                  11 #include <QDebug>
 12 #include <QFileDialog>                             12 #include <QFileDialog>
 13 #include <QLabel>                                  13 #include <QLabel>
 14 #include <QLayout>                                 14 #include <QLayout>
 15 #include <QList>                                   15 #include <QList>
 16 #include <QMenu>                                   16 #include <QMenu>
 17 #include <QMenuBar>                                17 #include <QMenuBar>
 18 #include <QMessageBox>                             18 #include <QMessageBox>
 19 #include <QRegularExpression>                      19 #include <QRegularExpression>
 20 #include <QScreen>                                 20 #include <QScreen>
 21 #include <QToolBar>                                21 #include <QToolBar>
 22                                                    22 
 23 #include <stdlib.h>                                23 #include <stdlib.h>
 24                                                    24 
 25 #include <xalloc.h>                            << 
 26 #include "lkc.h"                                   25 #include "lkc.h"
 27 #include "qconf.h"                                 26 #include "qconf.h"
 28                                                    27 
 29 #include "images.h"                                28 #include "images.h"
 30                                                    29 
 31                                                    30 
 32 static QApplication *configApp;                    31 static QApplication *configApp;
 33 static ConfigSettings *configSettings;             32 static ConfigSettings *configSettings;
 34                                                    33 
 35 QAction *ConfigMainWindow::saveAction;             34 QAction *ConfigMainWindow::saveAction;
 36                                                    35 
 37 ConfigSettings::ConfigSettings()                   36 ConfigSettings::ConfigSettings()
 38         : QSettings("kernel.org", "qconf")         37         : QSettings("kernel.org", "qconf")
 39 {                                                  38 {
 40 }                                                  39 }
 41                                                    40 
 42 /**                                                41 /**
 43  * Reads a list of integer values from the app     42  * Reads a list of integer values from the application settings.
 44  */                                                43  */
 45 QList<int> ConfigSettings::readSizes(const QSt     44 QList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
 46 {                                                  45 {
 47         QList<int> result;                         46         QList<int> result;
 48                                                    47 
 49         if (contains(key))                         48         if (contains(key))
 50         {                                          49         {
 51                 QStringList entryList = value(     50                 QStringList entryList = value(key).toStringList();
 52                 QStringList::Iterator it;          51                 QStringList::Iterator it;
 53                                                    52 
 54                 for (it = entryList.begin(); i     53                 for (it = entryList.begin(); it != entryList.end(); ++it)
 55                         result.push_back((*it)     54                         result.push_back((*it).toInt());
 56                                                    55 
 57                 *ok = true;                        56                 *ok = true;
 58         }                                          57         }
 59         else                                       58         else
 60                 *ok = false;                       59                 *ok = false;
 61                                                    60 
 62         return result;                             61         return result;
 63 }                                                  62 }
 64                                                    63 
 65 /**                                                64 /**
 66  * Writes a list of integer values to the appl     65  * Writes a list of integer values to the application settings.
 67  */                                                66  */
 68 bool ConfigSettings::writeSizes(const QString&     67 bool ConfigSettings::writeSizes(const QString& key, const QList<int>& value)
 69 {                                                  68 {
 70         QStringList stringList;                    69         QStringList stringList;
 71         QList<int>::ConstIterator it;              70         QList<int>::ConstIterator it;
 72                                                    71 
 73         for (it = value.begin(); it != value.e     72         for (it = value.begin(); it != value.end(); ++it)
 74                 stringList.push_back(QString::     73                 stringList.push_back(QString::number(*it));
 75         setValue(key, stringList);                 74         setValue(key, stringList);
 76                                                    75 
 77         return true;                               76         return true;
 78 }                                                  77 }
 79                                                    78 
 80 QIcon ConfigItem::symbolYesIcon;                   79 QIcon ConfigItem::symbolYesIcon;
 81 QIcon ConfigItem::symbolModIcon;                   80 QIcon ConfigItem::symbolModIcon;
 82 QIcon ConfigItem::symbolNoIcon;                    81 QIcon ConfigItem::symbolNoIcon;
 83 QIcon ConfigItem::choiceYesIcon;                   82 QIcon ConfigItem::choiceYesIcon;
 84 QIcon ConfigItem::choiceNoIcon;                    83 QIcon ConfigItem::choiceNoIcon;
 85 QIcon ConfigItem::menuIcon;                        84 QIcon ConfigItem::menuIcon;
 86 QIcon ConfigItem::menubackIcon;                    85 QIcon ConfigItem::menubackIcon;
 87                                                    86 
 88 /*                                                 87 /*
 89  * update the displayed of a menu entry            88  * update the displayed of a menu entry
 90  */                                                89  */
 91 void ConfigItem::updateMenu(void)                  90 void ConfigItem::updateMenu(void)
 92 {                                                  91 {
 93         ConfigList* list;                          92         ConfigList* list;
 94         struct symbol* sym;                        93         struct symbol* sym;
 95         struct property *prop;                     94         struct property *prop;
 96         QString prompt;                            95         QString prompt;
 97         int type;                                  96         int type;
 98         tristate expr;                             97         tristate expr;
 99                                                    98 
100         list = listView();                         99         list = listView();
101         if (goParent) {                           100         if (goParent) {
102                 setIcon(promptColIdx, menuback    101                 setIcon(promptColIdx, menubackIcon);
103                 prompt = "..";                    102                 prompt = "..";
104                 goto set_prompt;                  103                 goto set_prompt;
105         }                                         104         }
106                                                   105 
107         sym = menu->sym;                          106         sym = menu->sym;
108         prop = menu->prompt;                      107         prop = menu->prompt;
109         prompt = menu_get_prompt(menu);           108         prompt = menu_get_prompt(menu);
110                                                   109 
111         if (prop) switch (prop->type) {           110         if (prop) switch (prop->type) {
112         case P_MENU:                              111         case P_MENU:
113                 if (list->mode == singleMode |    112                 if (list->mode == singleMode || list->mode == symbolMode) {
114                         /* a menuconfig entry     113                         /* a menuconfig entry is displayed differently
115                          * depending whether i    114                          * depending whether it's at the view root or a child.
116                          */                       115                          */
117                         if (sym && list->rootE    116                         if (sym && list->rootEntry == menu)
118                                 break;            117                                 break;
119                         setIcon(promptColIdx,     118                         setIcon(promptColIdx, menuIcon);
120                 } else {                          119                 } else {
121                         if (sym)                  120                         if (sym)
122                                 break;            121                                 break;
123                         setIcon(promptColIdx,     122                         setIcon(promptColIdx, QIcon());
124                 }                                 123                 }
125                 goto set_prompt;                  124                 goto set_prompt;
126         case P_COMMENT:                           125         case P_COMMENT:
127                 setIcon(promptColIdx, QIcon())    126                 setIcon(promptColIdx, QIcon());
128                 prompt = "*** " + prompt + " *    127                 prompt = "*** " + prompt + " ***";
129                 goto set_prompt;                  128                 goto set_prompt;
130         default:                                  129         default:
131                 ;                                 130                 ;
132         }                                         131         }
133         if (!sym)                                 132         if (!sym)
134                 goto set_prompt;                  133                 goto set_prompt;
135                                                   134 
136         setText(nameColIdx, sym->name);           135         setText(nameColIdx, sym->name);
137                                                   136 
138         type = sym_get_type(sym);                 137         type = sym_get_type(sym);
139         switch (type) {                           138         switch (type) {
140         case S_BOOLEAN:                           139         case S_BOOLEAN:
141         case S_TRISTATE:                          140         case S_TRISTATE:
142                 char ch;                          141                 char ch;
143                                                   142 
144                 if (!sym_is_changeable(sym) &&    143                 if (!sym_is_changeable(sym) && list->optMode == normalOpt) {
145                         setIcon(promptColIdx,     144                         setIcon(promptColIdx, QIcon());
146                         break;                    145                         break;
147                 }                                 146                 }
148                 expr = sym_get_tristate_value(    147                 expr = sym_get_tristate_value(sym);
149                 switch (expr) {                   148                 switch (expr) {
150                 case yes:                         149                 case yes:
151                         if (sym_is_choice_valu !! 150                         if (sym_is_choice_value(sym) && type == S_BOOLEAN)
152                                 setIcon(prompt    151                                 setIcon(promptColIdx, choiceYesIcon);
153                         else                      152                         else
154                                 setIcon(prompt    153                                 setIcon(promptColIdx, symbolYesIcon);
155                         ch = 'Y';                 154                         ch = 'Y';
156                         break;                    155                         break;
157                 case mod:                         156                 case mod:
158                         setIcon(promptColIdx,     157                         setIcon(promptColIdx, symbolModIcon);
159                         ch = 'M';                 158                         ch = 'M';
160                         break;                    159                         break;
161                 default:                          160                 default:
162                         if (sym_is_choice_valu    161                         if (sym_is_choice_value(sym) && type == S_BOOLEAN)
163                                 setIcon(prompt    162                                 setIcon(promptColIdx, choiceNoIcon);
164                         else                      163                         else
165                                 setIcon(prompt    164                                 setIcon(promptColIdx, symbolNoIcon);
166                         ch = 'N';                 165                         ch = 'N';
167                         break;                    166                         break;
168                 }                                 167                 }
169                                                   168 
170                 setText(dataColIdx, QChar(ch))    169                 setText(dataColIdx, QChar(ch));
171                 break;                            170                 break;
172         case S_INT:                               171         case S_INT:
173         case S_HEX:                               172         case S_HEX:
174         case S_STRING:                            173         case S_STRING:
175                 setText(dataColIdx, sym_get_st    174                 setText(dataColIdx, sym_get_string_value(sym));
176                 break;                            175                 break;
177         }                                         176         }
178         if (!sym_has_value(sym) && visible)       177         if (!sym_has_value(sym) && visible)
179                 prompt += " (NEW)";               178                 prompt += " (NEW)";
180 set_prompt:                                       179 set_prompt:
181         setText(promptColIdx, prompt);            180         setText(promptColIdx, prompt);
182 }                                                 181 }
183                                                   182 
184 void ConfigItem::testUpdateMenu(bool v)           183 void ConfigItem::testUpdateMenu(bool v)
185 {                                                 184 {
186         ConfigItem* i;                            185         ConfigItem* i;
187                                                   186 
188         visible = v;                              187         visible = v;
189         if (!menu)                                188         if (!menu)
190                 return;                           189                 return;
191                                                   190 
192         sym_calc_value(menu->sym);                191         sym_calc_value(menu->sym);
193         if (menu->flags & MENU_CHANGED) {         192         if (menu->flags & MENU_CHANGED) {
194                 /* the menu entry changed, so     193                 /* the menu entry changed, so update all list items */
195                 menu->flags &= ~MENU_CHANGED;     194                 menu->flags &= ~MENU_CHANGED;
196                 for (i = (ConfigItem*)menu->da    195                 for (i = (ConfigItem*)menu->data; i; i = i->nextItem)
197                         i->updateMenu();          196                         i->updateMenu();
198         } else if (listView()->updateAll)         197         } else if (listView()->updateAll)
199                 updateMenu();                     198                 updateMenu();
200 }                                                 199 }
201                                                   200 
202                                                   201 
203 /*                                                202 /*
204  * construct a menu entry                         203  * construct a menu entry
205  */                                               204  */
206 void ConfigItem::init(void)                       205 void ConfigItem::init(void)
207 {                                                 206 {
208         if (menu) {                               207         if (menu) {
209                 ConfigList* list = listView();    208                 ConfigList* list = listView();
210                 nextItem = (ConfigItem*)menu->    209                 nextItem = (ConfigItem*)menu->data;
211                 menu->data = this;                210                 menu->data = this;
212                                                   211 
213                 if (list->mode != fullMode)       212                 if (list->mode != fullMode)
214                         setExpanded(true);        213                         setExpanded(true);
215                 sym_calc_value(menu->sym);        214                 sym_calc_value(menu->sym);
216                                                   215 
217                 if (menu->sym) {                  216                 if (menu->sym) {
218                         enum symbol_type type     217                         enum symbol_type type = menu->sym->type;
219                                                   218 
220                         // Allow to edit "int"    219                         // Allow to edit "int", "hex", and "string" in-place in
221                         // the data column. Un    220                         // the data column. Unfortunately, you cannot specify
222                         // the flags per colum    221                         // the flags per column. Set ItemIsEditable for all
223                         // columns here, and c    222                         // columns here, and check the column in createEditor().
224                         if (type == S_INT || t    223                         if (type == S_INT || type == S_HEX || type == S_STRING)
225                                 setFlags(flags    224                                 setFlags(flags() | Qt::ItemIsEditable);
226                 }                                 225                 }
227         }                                         226         }
228         updateMenu();                             227         updateMenu();
229 }                                                 228 }
230                                                   229 
231 /*                                                230 /*
232  * destruct a menu entry                          231  * destruct a menu entry
233  */                                               232  */
234 ConfigItem::~ConfigItem(void)                     233 ConfigItem::~ConfigItem(void)
235 {                                                 234 {
236         if (menu) {                               235         if (menu) {
237                 ConfigItem** ip = (ConfigItem*    236                 ConfigItem** ip = (ConfigItem**)&menu->data;
238                 for (; *ip; ip = &(*ip)->nextI    237                 for (; *ip; ip = &(*ip)->nextItem) {
239                         if (*ip == this) {        238                         if (*ip == this) {
240                                 *ip = nextItem    239                                 *ip = nextItem;
241                                 break;            240                                 break;
242                         }                         241                         }
243                 }                                 242                 }
244         }                                         243         }
245 }                                                 244 }
246                                                   245 
247 QWidget *ConfigItemDelegate::createEditor(QWid    246 QWidget *ConfigItemDelegate::createEditor(QWidget *parent,
248                                           cons    247                                           const QStyleOptionViewItem &option,
249                                           cons    248                                           const QModelIndex &index) const
250 {                                                 249 {
251         ConfigItem *item;                         250         ConfigItem *item;
252                                                   251 
253         // Only the data column is editable       252         // Only the data column is editable
254         if (index.column() != dataColIdx)         253         if (index.column() != dataColIdx)
255                 return nullptr;                   254                 return nullptr;
256                                                   255 
257         // You cannot edit invisible menus        256         // You cannot edit invisible menus
258         item = static_cast<ConfigItem *>(index    257         item = static_cast<ConfigItem *>(index.internalPointer());
259         if (!item || !item->menu || !menu_is_v    258         if (!item || !item->menu || !menu_is_visible(item->menu))
260                 return nullptr;                   259                 return nullptr;
261                                                   260 
262         return QStyledItemDelegate::createEdit    261         return QStyledItemDelegate::createEditor(parent, option, index);
263 }                                                 262 }
264                                                   263 
265 void ConfigItemDelegate::setModelData(QWidget     264 void ConfigItemDelegate::setModelData(QWidget *editor,
266                                       QAbstrac    265                                       QAbstractItemModel *model,
267                                       const QM    266                                       const QModelIndex &index) const
268 {                                                 267 {
269         QLineEdit *lineEdit;                      268         QLineEdit *lineEdit;
270         ConfigItem *item;                         269         ConfigItem *item;
271         struct symbol *sym;                       270         struct symbol *sym;
272         bool success;                             271         bool success;
273                                                   272 
274         lineEdit = qobject_cast<QLineEdit *>(e    273         lineEdit = qobject_cast<QLineEdit *>(editor);
275         // If this is not a QLineEdit, use the    274         // If this is not a QLineEdit, use the parent's default.
276         // (does this happen?)                    275         // (does this happen?)
277         if (!lineEdit)                            276         if (!lineEdit)
278                 goto parent;                      277                 goto parent;
279                                                   278 
280         item = static_cast<ConfigItem *>(index    279         item = static_cast<ConfigItem *>(index.internalPointer());
281         if (!item || !item->menu)                 280         if (!item || !item->menu)
282                 goto parent;                      281                 goto parent;
283                                                   282 
284         sym = item->menu->sym;                    283         sym = item->menu->sym;
285         if (!sym)                                 284         if (!sym)
286                 goto parent;                      285                 goto parent;
287                                                   286 
288         success = sym_set_string_value(sym, li    287         success = sym_set_string_value(sym, lineEdit->text().toUtf8().data());
289         if (success) {                            288         if (success) {
290                 ConfigList::updateListForAll()    289                 ConfigList::updateListForAll();
291         } else {                                  290         } else {
292                 QMessageBox::information(edito    291                 QMessageBox::information(editor, "qconf",
293                         "Cannot set the data (    292                         "Cannot set the data (maybe due to out of range).\n"
294                         "Setting the old value    293                         "Setting the old value.");
295                 lineEdit->setText(sym_get_stri    294                 lineEdit->setText(sym_get_string_value(sym));
296         }                                         295         }
297                                                   296 
298 parent:                                           297 parent:
299         QStyledItemDelegate::setModelData(edit    298         QStyledItemDelegate::setModelData(editor, model, index);
300 }                                                 299 }
301                                                   300 
302 ConfigList::ConfigList(QWidget *parent, const     301 ConfigList::ConfigList(QWidget *parent, const char *name)
303         : QTreeWidget(parent),                    302         : QTreeWidget(parent),
304           updateAll(false),                       303           updateAll(false),
305           showName(false), mode(singleMode), o    304           showName(false), mode(singleMode), optMode(normalOpt),
306           rootEntry(0), headerPopup(0)            305           rootEntry(0), headerPopup(0)
307 {                                                 306 {
308         setObjectName(name);                      307         setObjectName(name);
309         setSortingEnabled(false);                 308         setSortingEnabled(false);
310         setRootIsDecorated(true);                 309         setRootIsDecorated(true);
311                                                   310 
312         setVerticalScrollMode(ScrollPerPixel);    311         setVerticalScrollMode(ScrollPerPixel);
313         setHorizontalScrollMode(ScrollPerPixel    312         setHorizontalScrollMode(ScrollPerPixel);
314                                                   313 
315         setHeaderLabels(QStringList() << "Opti    314         setHeaderLabels(QStringList() << "Option" << "Name" << "Value");
316                                                   315 
317         connect(this, &ConfigList::itemSelecti    316         connect(this, &ConfigList::itemSelectionChanged,
318                 this, &ConfigList::updateSelec    317                 this, &ConfigList::updateSelection);
319                                                   318 
320         if (name) {                               319         if (name) {
321                 configSettings->beginGroup(nam    320                 configSettings->beginGroup(name);
322                 showName = configSettings->val    321                 showName = configSettings->value("/showName", false).toBool();
323                 optMode = (enum optionMode)con    322                 optMode = (enum optionMode)configSettings->value("/optionMode", 0).toInt();
324                 configSettings->endGroup();       323                 configSettings->endGroup();
325                 connect(configApp, &QApplicati    324                 connect(configApp, &QApplication::aboutToQuit,
326                         this, &ConfigList::sav    325                         this, &ConfigList::saveSettings);
327         }                                         326         }
328                                                   327 
329         showColumn(promptColIdx);                 328         showColumn(promptColIdx);
330                                                   329 
331         setItemDelegate(new ConfigItemDelegate    330         setItemDelegate(new ConfigItemDelegate(this));
332                                                   331 
333         allLists.append(this);                    332         allLists.append(this);
334                                                   333 
335         reinit();                                 334         reinit();
336 }                                                 335 }
337                                                   336 
338 ConfigList::~ConfigList()                         337 ConfigList::~ConfigList()
339 {                                                 338 {
340         allLists.removeOne(this);                 339         allLists.removeOne(this);
341 }                                                 340 }
342                                                   341 
343 bool ConfigList::menuSkip(struct menu *menu)      342 bool ConfigList::menuSkip(struct menu *menu)
344 {                                                 343 {
345         if (optMode == normalOpt && menu_is_vi    344         if (optMode == normalOpt && menu_is_visible(menu))
346                 return false;                     345                 return false;
347         if (optMode == promptOpt && menu_has_p    346         if (optMode == promptOpt && menu_has_prompt(menu))
348                 return false;                     347                 return false;
349         if (optMode == allOpt)                    348         if (optMode == allOpt)
350                 return false;                     349                 return false;
351         return true;                              350         return true;
352 }                                                 351 }
353                                                   352 
354 void ConfigList::reinit(void)                     353 void ConfigList::reinit(void)
355 {                                                 354 {
356         hideColumn(nameColIdx);                   355         hideColumn(nameColIdx);
357                                                   356 
358         if (showName)                             357         if (showName)
359                 showColumn(nameColIdx);           358                 showColumn(nameColIdx);
360                                                   359 
361         updateListAll();                          360         updateListAll();
362 }                                                 361 }
363                                                   362 
364 void ConfigList::setOptionMode(QAction *action    363 void ConfigList::setOptionMode(QAction *action)
365 {                                                 364 {
366         if (action == showNormalAction)           365         if (action == showNormalAction)
367                 optMode = normalOpt;              366                 optMode = normalOpt;
368         else if (action == showAllAction)         367         else if (action == showAllAction)
369                 optMode = allOpt;                 368                 optMode = allOpt;
370         else                                      369         else
371                 optMode = promptOpt;              370                 optMode = promptOpt;
372                                                   371 
373         updateListAll();                          372         updateListAll();
374 }                                                 373 }
375                                                   374 
376 void ConfigList::saveSettings(void)               375 void ConfigList::saveSettings(void)
377 {                                                 376 {
378         if (!objectName().isEmpty()) {            377         if (!objectName().isEmpty()) {
379                 configSettings->beginGroup(obj    378                 configSettings->beginGroup(objectName());
380                 configSettings->setValue("/sho    379                 configSettings->setValue("/showName", showName);
381                 configSettings->setValue("/opt    380                 configSettings->setValue("/optionMode", (int)optMode);
382                 configSettings->endGroup();       381                 configSettings->endGroup();
383         }                                         382         }
384 }                                                 383 }
385                                                   384 
386 ConfigItem* ConfigList::findConfigItem(struct     385 ConfigItem* ConfigList::findConfigItem(struct menu *menu)
387 {                                                 386 {
388         ConfigItem* item = (ConfigItem*)menu->    387         ConfigItem* item = (ConfigItem*)menu->data;
389                                                   388 
390         for (; item; item = item->nextItem) {     389         for (; item; item = item->nextItem) {
391                 if (this == item->listView())     390                 if (this == item->listView())
392                         break;                    391                         break;
393         }                                         392         }
394                                                   393 
395         return item;                              394         return item;
396 }                                                 395 }
397                                                   396 
398 void ConfigList::updateSelection(void)            397 void ConfigList::updateSelection(void)
399 {                                                 398 {
400         struct menu *menu;                        399         struct menu *menu;
401         enum prop_type type;                      400         enum prop_type type;
402                                                   401 
403         if (selectedItems().count() == 0)         402         if (selectedItems().count() == 0)
404                 return;                           403                 return;
405                                                   404 
406         ConfigItem* item = (ConfigItem*)select    405         ConfigItem* item = (ConfigItem*)selectedItems().first();
407         if (!item)                                406         if (!item)
408                 return;                           407                 return;
409                                                   408 
410         menu = item->menu;                        409         menu = item->menu;
411         emit menuChanged(menu);                   410         emit menuChanged(menu);
412         if (!menu)                                411         if (!menu)
413                 return;                           412                 return;
414         type = menu->prompt ? menu->prompt->ty    413         type = menu->prompt ? menu->prompt->type : P_UNKNOWN;
415         if (mode == menuMode && type == P_MENU    414         if (mode == menuMode && type == P_MENU)
416                 emit menuSelected(menu);          415                 emit menuSelected(menu);
417 }                                                 416 }
418                                                   417 
419 void ConfigList::updateList()                     418 void ConfigList::updateList()
420 {                                                 419 {
421         ConfigItem* last = 0;                     420         ConfigItem* last = 0;
422         ConfigItem *item;                         421         ConfigItem *item;
423                                                   422 
424         if (!rootEntry) {                         423         if (!rootEntry) {
425                 if (mode != listMode)             424                 if (mode != listMode)
426                         goto update;              425                         goto update;
427                 QTreeWidgetItemIterator it(thi    426                 QTreeWidgetItemIterator it(this);
428                                                   427 
429                 while (*it) {                     428                 while (*it) {
430                         item = (ConfigItem*)(*    429                         item = (ConfigItem*)(*it);
431                         if (!item->menu)          430                         if (!item->menu)
432                                 continue;         431                                 continue;
433                         item->testUpdateMenu(m    432                         item->testUpdateMenu(menu_is_visible(item->menu));
434                                                   433 
435                         ++it;                     434                         ++it;
436                 }                                 435                 }
437                 return;                           436                 return;
438         }                                         437         }
439                                                   438 
440         if (rootEntry != &rootmenu && (mode ==    439         if (rootEntry != &rootmenu && (mode == singleMode ||
441             (mode == symbolMode && rootEntry->    440             (mode == symbolMode && rootEntry->parent != &rootmenu))) {
442                 item = (ConfigItem *)topLevelI    441                 item = (ConfigItem *)topLevelItem(0);
443                 if (!item)                        442                 if (!item)
444                         item = new ConfigItem(    443                         item = new ConfigItem(this, 0, true);
445                 last = item;                      444                 last = item;
446         }                                         445         }
447         if ((mode == singleMode || (mode == sy    446         if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) &&
448             rootEntry->sym && rootEntry->promp    447             rootEntry->sym && rootEntry->prompt) {
449                 item = last ? last->nextSiblin    448                 item = last ? last->nextSibling() : nullptr;
450                 if (!item)                        449                 if (!item)
451                         item = new ConfigItem(    450                         item = new ConfigItem(this, last, rootEntry, true);
452                 else                              451                 else
453                         item->testUpdateMenu(t    452                         item->testUpdateMenu(true);
454                                                   453 
455                 updateMenuList(item, rootEntry    454                 updateMenuList(item, rootEntry);
456                 update();                         455                 update();
457                 resizeColumnToContents(0);        456                 resizeColumnToContents(0);
458                 return;                           457                 return;
459         }                                         458         }
460 update:                                           459 update:
461         updateMenuList(rootEntry);                460         updateMenuList(rootEntry);
462         update();                                 461         update();
463         resizeColumnToContents(0);                462         resizeColumnToContents(0);
464 }                                                 463 }
465                                                   464 
466 void ConfigList::updateListForAll()               465 void ConfigList::updateListForAll()
467 {                                                 466 {
468         QListIterator<ConfigList *> it(allList    467         QListIterator<ConfigList *> it(allLists);
469                                                   468 
470         while (it.hasNext()) {                    469         while (it.hasNext()) {
471                 ConfigList *list = it.next();     470                 ConfigList *list = it.next();
472                                                   471 
473                 list->updateList();               472                 list->updateList();
474         }                                         473         }
475 }                                                 474 }
476                                                   475 
477 void ConfigList::updateListAllForAll()            476 void ConfigList::updateListAllForAll()
478 {                                                 477 {
479         QListIterator<ConfigList *> it(allList    478         QListIterator<ConfigList *> it(allLists);
480                                                   479 
481         while (it.hasNext()) {                    480         while (it.hasNext()) {
482                 ConfigList *list = it.next();     481                 ConfigList *list = it.next();
483                                                   482 
484                 list->updateList();               483                 list->updateList();
485         }                                         484         }
486 }                                                 485 }
487                                                   486 
488 void ConfigList::setValue(ConfigItem* item, tr    487 void ConfigList::setValue(ConfigItem* item, tristate val)
489 {                                                 488 {
490         struct symbol* sym;                       489         struct symbol* sym;
491         int type;                                 490         int type;
492         tristate oldval;                          491         tristate oldval;
493                                                   492 
494         sym = item->menu ? item->menu->sym : 0    493         sym = item->menu ? item->menu->sym : 0;
495         if (!sym)                                 494         if (!sym)
496                 return;                           495                 return;
497                                                   496 
498         type = sym_get_type(sym);                 497         type = sym_get_type(sym);
499         switch (type) {                           498         switch (type) {
500         case S_BOOLEAN:                           499         case S_BOOLEAN:
501         case S_TRISTATE:                          500         case S_TRISTATE:
502                 oldval = sym_get_tristate_valu    501                 oldval = sym_get_tristate_value(sym);
503                                                   502 
504                 if (!sym_set_tristate_value(sy    503                 if (!sym_set_tristate_value(sym, val))
505                         return;                   504                         return;
506                 if (oldval == no && item->menu    505                 if (oldval == no && item->menu->list)
507                         item->setExpanded(true    506                         item->setExpanded(true);
508                 ConfigList::updateListForAll()    507                 ConfigList::updateListForAll();
509                 break;                            508                 break;
510         }                                         509         }
511 }                                                 510 }
512                                                   511 
513 void ConfigList::changeValue(ConfigItem* item)    512 void ConfigList::changeValue(ConfigItem* item)
514 {                                                 513 {
515         struct symbol* sym;                       514         struct symbol* sym;
516         struct menu* menu;                        515         struct menu* menu;
517         int type, oldexpr, newexpr;               516         int type, oldexpr, newexpr;
518                                                   517 
519         menu = item->menu;                        518         menu = item->menu;
520         if (!menu)                                519         if (!menu)
521                 return;                           520                 return;
522         sym = menu->sym;                          521         sym = menu->sym;
523         if (!sym) {                               522         if (!sym) {
524                 if (item->menu->list)             523                 if (item->menu->list)
525                         item->setExpanded(!ite    524                         item->setExpanded(!item->isExpanded());
526                 return;                           525                 return;
527         }                                         526         }
528                                                   527 
529         type = sym_get_type(sym);                 528         type = sym_get_type(sym);
530         switch (type) {                           529         switch (type) {
531         case S_BOOLEAN:                           530         case S_BOOLEAN:
532         case S_TRISTATE:                          531         case S_TRISTATE:
533                 oldexpr = sym_get_tristate_val    532                 oldexpr = sym_get_tristate_value(sym);
534                 newexpr = sym_toggle_tristate_    533                 newexpr = sym_toggle_tristate_value(sym);
535                 if (item->menu->list) {           534                 if (item->menu->list) {
536                         if (oldexpr == newexpr    535                         if (oldexpr == newexpr)
537                                 item->setExpan    536                                 item->setExpanded(!item->isExpanded());
538                         else if (oldexpr == no    537                         else if (oldexpr == no)
539                                 item->setExpan    538                                 item->setExpanded(true);
540                 }                                 539                 }
541                 if (oldexpr != newexpr)           540                 if (oldexpr != newexpr)
542                         ConfigList::updateList    541                         ConfigList::updateListForAll();
543                 break;                            542                 break;
544         default:                                  543         default:
545                 break;                            544                 break;
546         }                                         545         }
547 }                                                 546 }
548                                                   547 
549 void ConfigList::setRootMenu(struct menu *menu    548 void ConfigList::setRootMenu(struct menu *menu)
550 {                                                 549 {
551         enum prop_type type;                      550         enum prop_type type;
552                                                   551 
553         if (rootEntry == menu)                    552         if (rootEntry == menu)
554                 return;                           553                 return;
555         type = menu && menu->prompt ? menu->pr    554         type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN;
556         if (type != P_MENU)                       555         if (type != P_MENU)
557                 return;                           556                 return;
558         updateMenuList(0);                        557         updateMenuList(0);
559         rootEntry = menu;                         558         rootEntry = menu;
560         updateListAll();                          559         updateListAll();
561         if (currentItem()) {                      560         if (currentItem()) {
562                 setSelected(currentItem(), has    561                 setSelected(currentItem(), hasFocus());
563                 scrollToItem(currentItem());      562                 scrollToItem(currentItem());
564         }                                         563         }
565 }                                                 564 }
566                                                   565 
567 void ConfigList::setParentMenu(void)              566 void ConfigList::setParentMenu(void)
568 {                                                 567 {
569         ConfigItem* item;                         568         ConfigItem* item;
570         struct menu *oldroot;                     569         struct menu *oldroot;
571                                                   570 
572         oldroot = rootEntry;                      571         oldroot = rootEntry;
573         if (rootEntry == &rootmenu)               572         if (rootEntry == &rootmenu)
574                 return;                           573                 return;
575         setRootMenu(menu_get_parent_menu(rootE    574         setRootMenu(menu_get_parent_menu(rootEntry->parent));
576                                                   575 
577         QTreeWidgetItemIterator it(this);         576         QTreeWidgetItemIterator it(this);
578         while (*it) {                             577         while (*it) {
579                 item = (ConfigItem *)(*it);       578                 item = (ConfigItem *)(*it);
580                 if (item->menu == oldroot) {      579                 if (item->menu == oldroot) {
581                         setCurrentItem(item);     580                         setCurrentItem(item);
582                         scrollToItem(item);       581                         scrollToItem(item);
583                         break;                    582                         break;
584                 }                                 583                 }
585                                                   584 
586                 ++it;                             585                 ++it;
587         }                                         586         }
588 }                                                 587 }
589                                                   588 
590 /*                                                589 /*
591  * update all the children of a menu entry        590  * update all the children of a menu entry
592  *   removes/adds the entries from the parent     591  *   removes/adds the entries from the parent widget as necessary
593  *                                                592  *
594  * parent: either the menu list widget or a me    593  * parent: either the menu list widget or a menu entry widget
595  * menu: entry to be updated                      594  * menu: entry to be updated
596  */                                               595  */
597 void ConfigList::updateMenuList(ConfigItem *pa    596 void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu)
598 {                                                 597 {
599         struct menu* child;                       598         struct menu* child;
600         ConfigItem* item;                         599         ConfigItem* item;
601         ConfigItem* last;                         600         ConfigItem* last;
602         bool visible;                             601         bool visible;
603         enum prop_type type;                      602         enum prop_type type;
604                                                   603 
605         if (!menu) {                              604         if (!menu) {
606                 while (parent->childCount() >     605                 while (parent->childCount() > 0)
607                 {                                 606                 {
608                         delete parent->takeChi    607                         delete parent->takeChild(0);
609                 }                                 608                 }
610                                                   609 
611                 return;                           610                 return;
612         }                                         611         }
613                                                   612 
614         last = parent->firstChild();              613         last = parent->firstChild();
615         if (last && !last->goParent)              614         if (last && !last->goParent)
616                 last = 0;                         615                 last = 0;
617         for (child = menu->list; child; child     616         for (child = menu->list; child; child = child->next) {
618                 item = last ? last->nextSiblin    617                 item = last ? last->nextSibling() : parent->firstChild();
619                 type = child->prompt ? child->    618                 type = child->prompt ? child->prompt->type : P_UNKNOWN;
620                                                   619 
621                 switch (mode) {                   620                 switch (mode) {
622                 case menuMode:                    621                 case menuMode:
623                         if (!(child->flags & M    622                         if (!(child->flags & MENU_ROOT))
624                                 goto hide;        623                                 goto hide;
625                         break;                    624                         break;
626                 case symbolMode:                  625                 case symbolMode:
627                         if (child->flags & MEN    626                         if (child->flags & MENU_ROOT)
628                                 goto hide;        627                                 goto hide;
629                         break;                    628                         break;
630                 default:                          629                 default:
631                         break;                    630                         break;
632                 }                                 631                 }
633                                                   632 
634                 visible = menu_is_visible(chil    633                 visible = menu_is_visible(child);
635                 if (!menuSkip(child)) {           634                 if (!menuSkip(child)) {
636                         if (!child->sym && !ch    635                         if (!child->sym && !child->list && !child->prompt)
637                                 continue;         636                                 continue;
638                         if (!item || item->men    637                         if (!item || item->menu != child)
639                                 item = new Con    638                                 item = new ConfigItem(parent, last, child, visible);
640                         else                      639                         else
641                                 item->testUpda    640                                 item->testUpdateMenu(visible);
642                                                   641 
643                         if (mode == fullMode |    642                         if (mode == fullMode || mode == menuMode || type != P_MENU)
644                                 updateMenuList    643                                 updateMenuList(item, child);
645                         else                      644                         else
646                                 updateMenuList    645                                 updateMenuList(item, 0);
647                         last = item;              646                         last = item;
648                         continue;                 647                         continue;
649                 }                                 648                 }
650 hide:                                             649 hide:
651                 if (item && item->menu == chil    650                 if (item && item->menu == child) {
652                         last = parent->firstCh    651                         last = parent->firstChild();
653                         if (last == item)         652                         if (last == item)
654                                 last = 0;         653                                 last = 0;
655                         else while (last->next    654                         else while (last->nextSibling() != item)
656                                 last = last->n    655                                 last = last->nextSibling();
657                         delete item;              656                         delete item;
658                 }                                 657                 }
659         }                                         658         }
660 }                                                 659 }
661                                                   660 
662 void ConfigList::updateMenuList(struct menu *m    661 void ConfigList::updateMenuList(struct menu *menu)
663 {                                                 662 {
664         struct menu* child;                       663         struct menu* child;
665         ConfigItem* item;                         664         ConfigItem* item;
666         ConfigItem* last;                         665         ConfigItem* last;
667         bool visible;                             666         bool visible;
668         enum prop_type type;                      667         enum prop_type type;
669                                                   668 
670         if (!menu) {                              669         if (!menu) {
671                 while (topLevelItemCount() > 0    670                 while (topLevelItemCount() > 0)
672                 {                                 671                 {
673                         delete takeTopLevelIte    672                         delete takeTopLevelItem(0);
674                 }                                 673                 }
675                                                   674 
676                 return;                           675                 return;
677         }                                         676         }
678                                                   677 
679         last = (ConfigItem *)topLevelItem(0);     678         last = (ConfigItem *)topLevelItem(0);
680         if (last && !last->goParent)              679         if (last && !last->goParent)
681                 last = 0;                         680                 last = 0;
682         for (child = menu->list; child; child     681         for (child = menu->list; child; child = child->next) {
683                 item = last ? last->nextSiblin    682                 item = last ? last->nextSibling() : (ConfigItem *)topLevelItem(0);
684                 type = child->prompt ? child->    683                 type = child->prompt ? child->prompt->type : P_UNKNOWN;
685                                                   684 
686                 switch (mode) {                   685                 switch (mode) {
687                 case menuMode:                    686                 case menuMode:
688                         if (!(child->flags & M    687                         if (!(child->flags & MENU_ROOT))
689                                 goto hide;        688                                 goto hide;
690                         break;                    689                         break;
691                 case symbolMode:                  690                 case symbolMode:
692                         if (child->flags & MEN    691                         if (child->flags & MENU_ROOT)
693                                 goto hide;        692                                 goto hide;
694                         break;                    693                         break;
695                 default:                          694                 default:
696                         break;                    695                         break;
697                 }                                 696                 }
698                                                   697 
699                 visible = menu_is_visible(chil    698                 visible = menu_is_visible(child);
700                 if (!menuSkip(child)) {           699                 if (!menuSkip(child)) {
701                         if (!child->sym && !ch    700                         if (!child->sym && !child->list && !child->prompt)
702                                 continue;         701                                 continue;
703                         if (!item || item->men    702                         if (!item || item->menu != child)
704                                 item = new Con    703                                 item = new ConfigItem(this, last, child, visible);
705                         else                      704                         else
706                                 item->testUpda    705                                 item->testUpdateMenu(visible);
707                                                   706 
708                         if (mode == fullMode |    707                         if (mode == fullMode || mode == menuMode || type != P_MENU)
709                                 updateMenuList    708                                 updateMenuList(item, child);
710                         else                      709                         else
711                                 updateMenuList    710                                 updateMenuList(item, 0);
712                         last = item;              711                         last = item;
713                         continue;                 712                         continue;
714                 }                                 713                 }
715 hide:                                             714 hide:
716                 if (item && item->menu == chil    715                 if (item && item->menu == child) {
717                         last = (ConfigItem *)t    716                         last = (ConfigItem *)topLevelItem(0);
718                         if (last == item)         717                         if (last == item)
719                                 last = 0;         718                                 last = 0;
720                         else while (last->next    719                         else while (last->nextSibling() != item)
721                                 last = last->n    720                                 last = last->nextSibling();
722                         delete item;              721                         delete item;
723                 }                                 722                 }
724         }                                         723         }
725 }                                                 724 }
726                                                   725 
727 void ConfigList::keyPressEvent(QKeyEvent* ev)     726 void ConfigList::keyPressEvent(QKeyEvent* ev)
728 {                                                 727 {
729         QTreeWidgetItem* i = currentItem();       728         QTreeWidgetItem* i = currentItem();
730         ConfigItem* item;                         729         ConfigItem* item;
731         struct menu *menu;                        730         struct menu *menu;
732         enum prop_type type;                      731         enum prop_type type;
733                                                   732 
734         if (ev->key() == Qt::Key_Escape && mod    733         if (ev->key() == Qt::Key_Escape && mode != fullMode && mode != listMode) {
735                 emit parentSelected();            734                 emit parentSelected();
736                 ev->accept();                     735                 ev->accept();
737                 return;                           736                 return;
738         }                                         737         }
739                                                   738 
740         if (!i) {                                 739         if (!i) {
741                 Parent::keyPressEvent(ev);        740                 Parent::keyPressEvent(ev);
742                 return;                           741                 return;
743         }                                         742         }
744         item = (ConfigItem*)i;                    743         item = (ConfigItem*)i;
745                                                   744 
746         switch (ev->key()) {                      745         switch (ev->key()) {
747         case Qt::Key_Return:                      746         case Qt::Key_Return:
748         case Qt::Key_Enter:                       747         case Qt::Key_Enter:
749                 if (item->goParent) {             748                 if (item->goParent) {
750                         emit parentSelected();    749                         emit parentSelected();
751                         break;                    750                         break;
752                 }                                 751                 }
753                 menu = item->menu;                752                 menu = item->menu;
754                 if (!menu)                        753                 if (!menu)
755                         break;                    754                         break;
756                 type = menu->prompt ? menu->pr    755                 type = menu->prompt ? menu->prompt->type : P_UNKNOWN;
757                 if (type == P_MENU && rootEntr    756                 if (type == P_MENU && rootEntry != menu &&
758                     mode != fullMode && mode !    757                     mode != fullMode && mode != menuMode) {
759                         if (mode == menuMode)     758                         if (mode == menuMode)
760                                 emit menuSelec    759                                 emit menuSelected(menu);
761                         else                      760                         else
762                                 emit itemSelec    761                                 emit itemSelected(menu);
763                         break;                    762                         break;
764                 }                                 763                 }
765         case Qt::Key_Space:                       764         case Qt::Key_Space:
766                 changeValue(item);                765                 changeValue(item);
767                 break;                            766                 break;
768         case Qt::Key_N:                           767         case Qt::Key_N:
769                 setValue(item, no);               768                 setValue(item, no);
770                 break;                            769                 break;
771         case Qt::Key_M:                           770         case Qt::Key_M:
772                 setValue(item, mod);              771                 setValue(item, mod);
773                 break;                            772                 break;
774         case Qt::Key_Y:                           773         case Qt::Key_Y:
775                 setValue(item, yes);              774                 setValue(item, yes);
776                 break;                            775                 break;
777         default:                                  776         default:
778                 Parent::keyPressEvent(ev);        777                 Parent::keyPressEvent(ev);
779                 return;                           778                 return;
780         }                                         779         }
781         ev->accept();                             780         ev->accept();
782 }                                                 781 }
783                                                   782 
784 void ConfigList::mousePressEvent(QMouseEvent*     783 void ConfigList::mousePressEvent(QMouseEvent* e)
785 {                                                 784 {
786         //QPoint p(contentsToViewport(e->pos()    785         //QPoint p(contentsToViewport(e->pos()));
787         //printf("contentsMousePressEvent: %d,    786         //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y());
788         Parent::mousePressEvent(e);               787         Parent::mousePressEvent(e);
789 }                                                 788 }
790                                                   789 
791 void ConfigList::mouseReleaseEvent(QMouseEvent    790 void ConfigList::mouseReleaseEvent(QMouseEvent* e)
792 {                                                 791 {
793         QPoint p = e->pos();                      792         QPoint p = e->pos();
794         ConfigItem* item = (ConfigItem*)itemAt    793         ConfigItem* item = (ConfigItem*)itemAt(p);
795         struct menu *menu;                        794         struct menu *menu;
796         enum prop_type ptype;                     795         enum prop_type ptype;
797         QIcon icon;                               796         QIcon icon;
798         int idx, x;                               797         int idx, x;
799                                                   798 
800         if (!item)                                799         if (!item)
801                 goto skip;                        800                 goto skip;
802                                                   801 
803         menu = item->menu;                        802         menu = item->menu;
804         x = header()->offset() + p.x();           803         x = header()->offset() + p.x();
805         idx = header()->logicalIndexAt(x);        804         idx = header()->logicalIndexAt(x);
806         switch (idx) {                            805         switch (idx) {
807         case promptColIdx:                        806         case promptColIdx:
808                 icon = item->icon(promptColIdx    807                 icon = item->icon(promptColIdx);
809                 if (!icon.isNull()) {             808                 if (!icon.isNull()) {
810                         int off = header()->se    809                         int off = header()->sectionPosition(0) + visualRect(indexAt(p)).x() + 4; // 4 is Hardcoded image offset. There might be a way to do it properly.
811                         if (x >= off && x < of    810                         if (x >= off && x < off + icon.availableSizes().first().width()) {
812                                 if (item->goPa    811                                 if (item->goParent) {
813                                         emit p    812                                         emit parentSelected();
814                                         break;    813                                         break;
815                                 } else if (!me    814                                 } else if (!menu)
816                                         break;    815                                         break;
817                                 ptype = menu->    816                                 ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
818                                 if (ptype == P    817                                 if (ptype == P_MENU && rootEntry != menu &&
819                                     mode != fu    818                                     mode != fullMode && mode != menuMode &&
820                                     mode != li    819                                     mode != listMode)
821                                         emit m    820                                         emit menuSelected(menu);
822                                 else              821                                 else
823                                         change    822                                         changeValue(item);
824                         }                         823                         }
825                 }                                 824                 }
826                 break;                            825                 break;
827         case dataColIdx:                          826         case dataColIdx:
828                 changeValue(item);                827                 changeValue(item);
829                 break;                            828                 break;
830         }                                         829         }
831                                                   830 
832 skip:                                             831 skip:
833         //printf("contentsMouseReleaseEvent: %    832         //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y());
834         Parent::mouseReleaseEvent(e);             833         Parent::mouseReleaseEvent(e);
835 }                                                 834 }
836                                                   835 
837 void ConfigList::mouseMoveEvent(QMouseEvent* e    836 void ConfigList::mouseMoveEvent(QMouseEvent* e)
838 {                                                 837 {
839         //QPoint p(contentsToViewport(e->pos()    838         //QPoint p(contentsToViewport(e->pos()));
840         //printf("contentsMouseMoveEvent: %d,%    839         //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y());
841         Parent::mouseMoveEvent(e);                840         Parent::mouseMoveEvent(e);
842 }                                                 841 }
843                                                   842 
844 void ConfigList::mouseDoubleClickEvent(QMouseE    843 void ConfigList::mouseDoubleClickEvent(QMouseEvent* e)
845 {                                                 844 {
846         QPoint p = e->pos();                      845         QPoint p = e->pos();
847         ConfigItem* item = (ConfigItem*)itemAt    846         ConfigItem* item = (ConfigItem*)itemAt(p);
848         struct menu *menu;                        847         struct menu *menu;
849         enum prop_type ptype;                     848         enum prop_type ptype;
850                                                   849 
851         if (!item)                                850         if (!item)
852                 goto skip;                        851                 goto skip;
853         if (item->goParent) {                     852         if (item->goParent) {
854                 emit parentSelected();            853                 emit parentSelected();
855                 goto skip;                        854                 goto skip;
856         }                                         855         }
857         menu = item->menu;                        856         menu = item->menu;
858         if (!menu)                                857         if (!menu)
859                 goto skip;                        858                 goto skip;
860         ptype = menu->prompt ? menu->prompt->t    859         ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
861         if (ptype == P_MENU && mode != listMod    860         if (ptype == P_MENU && mode != listMode) {
862                 if (mode == singleMode)           861                 if (mode == singleMode)
863                         emit itemSelected(menu    862                         emit itemSelected(menu);
864                 else if (mode == symbolMode)      863                 else if (mode == symbolMode)
865                         emit menuSelected(menu    864                         emit menuSelected(menu);
866         } else if (menu->sym)                     865         } else if (menu->sym)
867                 changeValue(item);                866                 changeValue(item);
868                                                   867 
869 skip:                                             868 skip:
870         //printf("contentsMouseDoubleClickEven    869         //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y());
871         Parent::mouseDoubleClickEvent(e);         870         Parent::mouseDoubleClickEvent(e);
872 }                                                 871 }
873                                                   872 
874 void ConfigList::focusInEvent(QFocusEvent *e)     873 void ConfigList::focusInEvent(QFocusEvent *e)
875 {                                                 874 {
876         struct menu *menu = NULL;                 875         struct menu *menu = NULL;
877                                                   876 
878         Parent::focusInEvent(e);                  877         Parent::focusInEvent(e);
879                                                   878 
880         ConfigItem* item = (ConfigItem *)curre    879         ConfigItem* item = (ConfigItem *)currentItem();
881         if (item) {                               880         if (item) {
882                 setSelected(item, true);          881                 setSelected(item, true);
883                 menu = item->menu;                882                 menu = item->menu;
884         }                                         883         }
885         emit gotFocus(menu);                      884         emit gotFocus(menu);
886 }                                                 885 }
887                                                   886 
888 void ConfigList::contextMenuEvent(QContextMenu    887 void ConfigList::contextMenuEvent(QContextMenuEvent *e)
889 {                                                 888 {
890         if (!headerPopup) {                       889         if (!headerPopup) {
891                 QAction *action;                  890                 QAction *action;
892                                                   891 
893                 headerPopup = new QMenu(this);    892                 headerPopup = new QMenu(this);
894                 action = new QAction("Show Nam    893                 action = new QAction("Show Name", this);
895                 action->setCheckable(true);       894                 action->setCheckable(true);
896                 connect(action, &QAction::togg    895                 connect(action, &QAction::toggled,
897                         this, &ConfigList::set    896                         this, &ConfigList::setShowName);
898                 connect(this, &ConfigList::sho    897                 connect(this, &ConfigList::showNameChanged,
899                         action, &QAction::setC    898                         action, &QAction::setChecked);
900                 action->setChecked(showName);     899                 action->setChecked(showName);
901                 headerPopup->addAction(action)    900                 headerPopup->addAction(action);
902         }                                         901         }
903                                                   902 
904         headerPopup->exec(e->globalPos());        903         headerPopup->exec(e->globalPos());
905         e->accept();                              904         e->accept();
906 }                                                 905 }
907                                                   906 
908 void ConfigList::setShowName(bool on)             907 void ConfigList::setShowName(bool on)
909 {                                                 908 {
910         if (showName == on)                       909         if (showName == on)
911                 return;                           910                 return;
912                                                   911 
913         showName = on;                            912         showName = on;
914         reinit();                                 913         reinit();
915         emit showNameChanged(on);                 914         emit showNameChanged(on);
916 }                                                 915 }
917                                                   916 
918 QList<ConfigList *> ConfigList::allLists;         917 QList<ConfigList *> ConfigList::allLists;
919 QAction *ConfigList::showNormalAction;            918 QAction *ConfigList::showNormalAction;
920 QAction *ConfigList::showAllAction;               919 QAction *ConfigList::showAllAction;
921 QAction *ConfigList::showPromptAction;            920 QAction *ConfigList::showPromptAction;
922                                                   921 
923 void ConfigList::setAllOpen(bool open)            922 void ConfigList::setAllOpen(bool open)
924 {                                                 923 {
925         QTreeWidgetItemIterator it(this);         924         QTreeWidgetItemIterator it(this);
926                                                   925 
927         while (*it) {                             926         while (*it) {
928                 (*it)->setExpanded(open);         927                 (*it)->setExpanded(open);
929                                                   928 
930                 ++it;                             929                 ++it;
931         }                                         930         }
932 }                                                 931 }
933                                                   932 
934 ConfigInfoView::ConfigInfoView(QWidget* parent    933 ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
935         : Parent(parent), sym(0), _menu(0)        934         : Parent(parent), sym(0), _menu(0)
936 {                                                 935 {
937         setObjectName(name);                      936         setObjectName(name);
938         setOpenLinks(false);                      937         setOpenLinks(false);
939                                                   938 
940         if (!objectName().isEmpty()) {            939         if (!objectName().isEmpty()) {
941                 configSettings->beginGroup(obj    940                 configSettings->beginGroup(objectName());
942                 setShowDebug(configSettings->v    941                 setShowDebug(configSettings->value("/showDebug", false).toBool());
943                 configSettings->endGroup();       942                 configSettings->endGroup();
944                 connect(configApp, &QApplicati    943                 connect(configApp, &QApplication::aboutToQuit,
945                         this, &ConfigInfoView:    944                         this, &ConfigInfoView::saveSettings);
946         }                                         945         }
947                                                   946 
948         contextMenu = createStandardContextMen    947         contextMenu = createStandardContextMenu();
949         QAction *action = new QAction("Show De    948         QAction *action = new QAction("Show Debug Info", contextMenu);
950                                                   949 
951         action->setCheckable(true);               950         action->setCheckable(true);
952         connect(action, &QAction::toggled,        951         connect(action, &QAction::toggled,
953                 this, &ConfigInfoView::setShow    952                 this, &ConfigInfoView::setShowDebug);
954         connect(this, &ConfigInfoView::showDeb    953         connect(this, &ConfigInfoView::showDebugChanged,
955                 action, &QAction::setChecked);    954                 action, &QAction::setChecked);
956         action->setChecked(showDebug());          955         action->setChecked(showDebug());
957         contextMenu->addSeparator();              956         contextMenu->addSeparator();
958         contextMenu->addAction(action);           957         contextMenu->addAction(action);
959 }                                                 958 }
960                                                   959 
961 void ConfigInfoView::saveSettings(void)           960 void ConfigInfoView::saveSettings(void)
962 {                                                 961 {
963         if (!objectName().isEmpty()) {            962         if (!objectName().isEmpty()) {
964                 configSettings->beginGroup(obj    963                 configSettings->beginGroup(objectName());
965                 configSettings->setValue("/sho    964                 configSettings->setValue("/showDebug", showDebug());
966                 configSettings->endGroup();       965                 configSettings->endGroup();
967         }                                         966         }
968 }                                                 967 }
969                                                   968 
970 void ConfigInfoView::setShowDebug(bool b)         969 void ConfigInfoView::setShowDebug(bool b)
971 {                                                 970 {
972         if (_showDebug != b) {                    971         if (_showDebug != b) {
973                 _showDebug = b;                   972                 _showDebug = b;
974                 if (_menu)                        973                 if (_menu)
975                         menuInfo();               974                         menuInfo();
976                 else if (sym)                     975                 else if (sym)
977                         symbolInfo();             976                         symbolInfo();
978                 emit showDebugChanged(b);         977                 emit showDebugChanged(b);
979         }                                         978         }
980 }                                                 979 }
981                                                   980 
982 void ConfigInfoView::setInfo(struct menu *m)      981 void ConfigInfoView::setInfo(struct menu *m)
983 {                                                 982 {
984         if (_menu == m)                           983         if (_menu == m)
985                 return;                           984                 return;
986         _menu = m;                                985         _menu = m;
987         sym = NULL;                               986         sym = NULL;
988         if (!_menu)                               987         if (!_menu)
989                 clear();                          988                 clear();
990         else                                      989         else
991                 menuInfo();                       990                 menuInfo();
992 }                                                 991 }
993                                                   992 
994 void ConfigInfoView::symbolInfo(void)             993 void ConfigInfoView::symbolInfo(void)
995 {                                                 994 {
996         QString str;                              995         QString str;
997                                                   996 
998         str += "<big>Symbol: <b>";                997         str += "<big>Symbol: <b>";
999         str += print_filter(sym->name);           998         str += print_filter(sym->name);
1000         str += "</b></big><br><br>value: ";      999         str += "</b></big><br><br>value: ";
1001         str += print_filter(sym_get_string_va    1000         str += print_filter(sym_get_string_value(sym));
1002         str += "<br>visibility: ";               1001         str += "<br>visibility: ";
1003         str += sym->visible == yes ? "y" : sy    1002         str += sym->visible == yes ? "y" : sym->visible == mod ? "m" : "n";
1004         str += "<br>";                           1003         str += "<br>";
1005         str += debug_info(sym);                  1004         str += debug_info(sym);
1006                                                  1005 
1007         setText(str);                            1006         setText(str);
1008 }                                                1007 }
1009                                                  1008 
1010 void ConfigInfoView::menuInfo(void)              1009 void ConfigInfoView::menuInfo(void)
1011 {                                                1010 {
1012         struct symbol* sym;                      1011         struct symbol* sym;
1013         QString info;                            1012         QString info;
1014         QTextStream stream(&info);               1013         QTextStream stream(&info);
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                         stream << "<big><b>";    1018                         stream << "<big><b>";
1020                         stream << print_filte    1019                         stream << print_filter(_menu->prompt->text);
1021                         stream << "</b></big>    1020                         stream << "</b></big>";
1022                         if (sym->name) {         1021                         if (sym->name) {
1023                                 stream << " (    1022                                 stream << " (";
1024                                 if (showDebug    1023                                 if (showDebug())
1025                                         strea    1024                                         stream << "<a href=\"s" << sym->name << "\">";
1026                                 stream << pri    1025                                 stream << print_filter(sym->name);
1027                                 if (showDebug    1026                                 if (showDebug())
1028                                         strea    1027                                         stream << "</a>";
1029                                 stream << ")"    1028                                 stream << ")";
1030                         }                        1029                         }
1031                 } else if (sym->name) {          1030                 } else if (sym->name) {
1032                         stream << "<big><b>";    1031                         stream << "<big><b>";
1033                         if (showDebug())         1032                         if (showDebug())
1034                                 stream << "<a    1033                                 stream << "<a href=\"s" << sym->name << "\">";
1035                         stream << print_filte    1034                         stream << print_filter(sym->name);
1036                         if (showDebug())         1035                         if (showDebug())
1037                                 stream << "</    1036                                 stream << "</a>";
1038                         stream << "</b></big>    1037                         stream << "</b></big>";
1039                 }                                1038                 }
1040                 stream << "<br><br>";            1039                 stream << "<br><br>";
1041                                                  1040 
1042                 if (showDebug())                 1041                 if (showDebug())
1043                         stream << debug_info(    1042                         stream << debug_info(sym);
1044                                                  1043 
1045                 struct gstr help_gstr = str_n    1044                 struct gstr help_gstr = str_new();
1046                                                  1045 
1047                 menu_get_ext_help(_menu, &hel    1046                 menu_get_ext_help(_menu, &help_gstr);
1048                 stream << print_filter(str_ge    1047                 stream << print_filter(str_get(&help_gstr));
1049                 str_free(&help_gstr);            1048                 str_free(&help_gstr);
1050         } else if (_menu->prompt) {              1049         } else if (_menu->prompt) {
1051                 stream << "<big><b>";            1050                 stream << "<big><b>";
1052                 stream << print_filter(_menu-    1051                 stream << print_filter(_menu->prompt->text);
1053                 stream << "</b></big><br><br>    1052                 stream << "</b></big><br><br>";
1054                 if (showDebug()) {               1053                 if (showDebug()) {
1055                         if (_menu->prompt->vi    1054                         if (_menu->prompt->visible.expr) {
1056                                 stream << "&n    1055                                 stream << "&nbsp;&nbsp;dep: ";
1057                                 expr_print(_m    1056                                 expr_print(_menu->prompt->visible.expr,
1058                                            ex    1057                                            expr_print_help, &stream, E_NONE);
1059                                 stream << "<b    1058                                 stream << "<br><br>";
1060                         }                        1059                         }
1061                                                  1060 
1062                         stream << "defined at !! 1061                         stream << "defined at " << _menu->file->name << ":"
1063                                << _menu->line    1062                                << _menu->lineno << "<br><br>";
1064                 }                                1063                 }
1065         }                                        1064         }
1066                                                  1065 
1067         setText(info);                           1066         setText(info);
1068 }                                                1067 }
1069                                                  1068 
1070 QString ConfigInfoView::debug_info(struct sym    1069 QString ConfigInfoView::debug_info(struct symbol *sym)
1071 {                                                1070 {
1072         QString debug;                           1071         QString debug;
1073         QTextStream stream(&debug);              1072         QTextStream stream(&debug);
1074                                                  1073 
1075         stream << "type: ";                      1074         stream << "type: ";
1076         stream << print_filter(sym_type_name(    1075         stream << print_filter(sym_type_name(sym->type));
1077         if (sym_is_choice(sym))                  1076         if (sym_is_choice(sym))
1078                 stream << " (choice)";           1077                 stream << " (choice)";
1079         debug += "<br>";                         1078         debug += "<br>";
1080         if (sym->rev_dep.expr) {                 1079         if (sym->rev_dep.expr) {
1081                 stream << "reverse dep: ";       1080                 stream << "reverse dep: ";
1082                 expr_print(sym->rev_dep.expr,    1081                 expr_print(sym->rev_dep.expr, expr_print_help, &stream, E_NONE);
1083                 stream << "<br>";                1082                 stream << "<br>";
1084         }                                        1083         }
1085         for (struct property *prop = sym->pro    1084         for (struct property *prop = sym->prop; prop; prop = prop->next) {
1086                 switch (prop->type) {            1085                 switch (prop->type) {
1087                 case P_PROMPT:                   1086                 case P_PROMPT:
1088                 case P_MENU:                     1087                 case P_MENU:
1089                         stream << "prompt: <a    1088                         stream << "prompt: <a href=\"m" << sym->name << "\">";
1090                         stream << print_filte    1089                         stream << print_filter(prop->text);
1091                         stream << "</a><br>";    1090                         stream << "</a><br>";
1092                         break;                   1091                         break;
1093                 case P_DEFAULT:                  1092                 case P_DEFAULT:
1094                 case P_SELECT:                   1093                 case P_SELECT:
1095                 case P_RANGE:                    1094                 case P_RANGE:
1096                 case P_COMMENT:                  1095                 case P_COMMENT:
1097                 case P_IMPLY:                    1096                 case P_IMPLY:
                                                   >> 1097                 case P_SYMBOL:
1098                         stream << prop_get_ty    1098                         stream << prop_get_type_name(prop->type);
1099                         stream << ": ";          1099                         stream << ": ";
1100                         expr_print(prop->expr    1100                         expr_print(prop->expr, expr_print_help,
1101                                    &stream, E    1101                                    &stream, E_NONE);
1102                         stream << "<br>";        1102                         stream << "<br>";
1103                         break;                   1103                         break;
                                                   >> 1104                 case P_CHOICE:
                                                   >> 1105                         if (sym_is_choice(sym)) {
                                                   >> 1106                                 stream << "choice: ";
                                                   >> 1107                                 expr_print(prop->expr, expr_print_help,
                                                   >> 1108                                            &stream, E_NONE);
                                                   >> 1109                                 stream << "<br>";
                                                   >> 1110                         }
                                                   >> 1111                         break;
1104                 default:                         1112                 default:
1105                         stream << "unknown pr    1113                         stream << "unknown property: ";
1106                         stream << prop_get_ty    1114                         stream << prop_get_type_name(prop->type);
1107                         stream << "<br>";        1115                         stream << "<br>";
1108                 }                                1116                 }
1109                 if (prop->visible.expr) {        1117                 if (prop->visible.expr) {
1110                         stream << "&nbsp;&nbs    1118                         stream << "&nbsp;&nbsp;&nbsp;&nbsp;dep: ";
1111                         expr_print(prop->visi    1119                         expr_print(prop->visible.expr, expr_print_help,
1112                                    &stream, E    1120                                    &stream, E_NONE);
1113                         stream << "<br>";        1121                         stream << "<br>";
1114                 }                                1122                 }
1115         }                                        1123         }
1116         stream << "<br>";                        1124         stream << "<br>";
1117                                                  1125 
1118         return debug;                            1126         return debug;
1119 }                                                1127 }
1120                                                  1128 
1121 QString ConfigInfoView::print_filter(const QS    1129 QString ConfigInfoView::print_filter(const QString &str)
1122 {                                                1130 {
1123         QRegularExpression re("[<>&\"\\n]");     1131         QRegularExpression re("[<>&\"\\n]");
1124         QString res = str;                       1132         QString res = str;
1125         for (int i = 0; (i = res.indexOf(re,     1133         for (int i = 0; (i = res.indexOf(re, i)) >= 0;) {
1126                 switch (res[i].toLatin1()) {     1134                 switch (res[i].toLatin1()) {
1127                 case '<':                        1135                 case '<':
1128                         res.replace(i, 1, "&l    1136                         res.replace(i, 1, "&lt;");
1129                         i += 4;                  1137                         i += 4;
1130                         break;                   1138                         break;
1131                 case '>':                        1139                 case '>':
1132                         res.replace(i, 1, "&g    1140                         res.replace(i, 1, "&gt;");
1133                         i += 4;                  1141                         i += 4;
1134                         break;                   1142                         break;
1135                 case '&':                        1143                 case '&':
1136                         res.replace(i, 1, "&a    1144                         res.replace(i, 1, "&amp;");
1137                         i += 5;                  1145                         i += 5;
1138                         break;                   1146                         break;
1139                 case '"':                        1147                 case '"':
1140                         res.replace(i, 1, "&q    1148                         res.replace(i, 1, "&quot;");
1141                         i += 6;                  1149                         i += 6;
1142                         break;                   1150                         break;
1143                 case '\n':                       1151                 case '\n':
1144                         res.replace(i, 1, "<b    1152                         res.replace(i, 1, "<br>");
1145                         i += 4;                  1153                         i += 4;
1146                         break;                   1154                         break;
1147                 }                                1155                 }
1148         }                                        1156         }
1149         return res;                              1157         return res;
1150 }                                                1158 }
1151                                                  1159 
1152 void ConfigInfoView::expr_print_help(void *da    1160 void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char *str)
1153 {                                                1161 {
1154         QTextStream *stream = reinterpret_cas    1162         QTextStream *stream = reinterpret_cast<QTextStream *>(data);
1155                                                  1163 
1156         if (sym && sym->name && !(sym->flags     1164         if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) {
1157                 *stream << "<a href=\"s" << s    1165                 *stream << "<a href=\"s" << sym->name << "\">";
1158                 *stream << print_filter(str);    1166                 *stream << print_filter(str);
1159                 *stream << "</a>";               1167                 *stream << "</a>";
1160         } else {                                 1168         } else {
1161                 *stream << print_filter(str);    1169                 *stream << print_filter(str);
1162         }                                        1170         }
1163 }                                                1171 }
1164                                                  1172 
1165 void ConfigInfoView::clicked(const QUrl &url)    1173 void ConfigInfoView::clicked(const QUrl &url)
1166 {                                                1174 {
1167         QByteArray str = url.toEncoded();        1175         QByteArray str = url.toEncoded();
1168         const std::size_t count = str.size();    1176         const std::size_t count = str.size();
1169         char *data = new char[count + 2];  //    1177         char *data = new char[count + 2];  // '$' + '\0'
1170         struct symbol **result;                  1178         struct symbol **result;
1171         struct menu *m = NULL;                   1179         struct menu *m = NULL;
1172                                                  1180 
1173         if (count < 1) {                         1181         if (count < 1) {
1174                 delete[] data;                   1182                 delete[] data;
1175                 return;                          1183                 return;
1176         }                                        1184         }
1177                                                  1185 
1178         memcpy(data, str.constData(), count);    1186         memcpy(data, str.constData(), count);
1179         data[count] = '\0';                      1187         data[count] = '\0';
1180                                                  1188 
1181         /* Seek for exact match */               1189         /* Seek for exact match */
1182         data[0] = '^';                           1190         data[0] = '^';
1183         strcat(data, "$");                       1191         strcat(data, "$");
1184         result = sym_re_search(data);            1192         result = sym_re_search(data);
1185         if (!result) {                           1193         if (!result) {
1186                 delete[] data;                   1194                 delete[] data;
1187                 return;                          1195                 return;
1188         }                                        1196         }
1189                                                  1197 
1190         sym = *result;                           1198         sym = *result;
1191                                                  1199 
1192         /* Seek for the menu which holds the     1200         /* Seek for the menu which holds the symbol */
1193         for (struct property *prop = sym->pro    1201         for (struct property *prop = sym->prop; prop; prop = prop->next) {
1194                     if (prop->type != P_PROMP    1202                     if (prop->type != P_PROMPT && prop->type != P_MENU)
1195                             continue;            1203                             continue;
1196                     m = prop->menu;              1204                     m = prop->menu;
1197                     break;                       1205                     break;
1198         }                                        1206         }
1199                                                  1207 
1200         if (!m) {                                1208         if (!m) {
1201                 /* Symbol is not visible as a    1209                 /* Symbol is not visible as a menu */
1202                 symbolInfo();                    1210                 symbolInfo();
1203                 emit showDebugChanged(true);     1211                 emit showDebugChanged(true);
1204         } else {                                 1212         } else {
1205                 emit menuSelected(m);            1213                 emit menuSelected(m);
1206         }                                        1214         }
1207                                                  1215 
1208         free(result);                            1216         free(result);
1209         delete[] data;                           1217         delete[] data;
1210 }                                                1218 }
1211                                                  1219 
1212 void ConfigInfoView::contextMenuEvent(QContex    1220 void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event)
1213 {                                                1221 {
1214         contextMenu->popup(event->globalPos()    1222         contextMenu->popup(event->globalPos());
1215         event->accept();                         1223         event->accept();
1216 }                                                1224 }
1217                                                  1225 
1218 ConfigSearchWindow::ConfigSearchWindow(Config    1226 ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent)
1219         : Parent(parent), result(NULL)           1227         : Parent(parent), result(NULL)
1220 {                                                1228 {
1221         setObjectName("search");                 1229         setObjectName("search");
1222         setWindowTitle("Search Config");         1230         setWindowTitle("Search Config");
1223                                                  1231 
1224         QVBoxLayout* layout1 = new QVBoxLayou    1232         QVBoxLayout* layout1 = new QVBoxLayout(this);
1225         layout1->setContentsMargins(11, 11, 1    1233         layout1->setContentsMargins(11, 11, 11, 11);
1226         layout1->setSpacing(6);                  1234         layout1->setSpacing(6);
1227                                                  1235 
1228         QHBoxLayout* layout2 = new QHBoxLayou    1236         QHBoxLayout* layout2 = new QHBoxLayout();
1229         layout2->setContentsMargins(0, 0, 0,     1237         layout2->setContentsMargins(0, 0, 0, 0);
1230         layout2->setSpacing(6);                  1238         layout2->setSpacing(6);
1231         layout2->addWidget(new QLabel("Find:"    1239         layout2->addWidget(new QLabel("Find:", this));
1232         editField = new QLineEdit(this);         1240         editField = new QLineEdit(this);
1233         connect(editField, &QLineEdit::return    1241         connect(editField, &QLineEdit::returnPressed,
1234                 this, &ConfigSearchWindow::se    1242                 this, &ConfigSearchWindow::search);
1235         layout2->addWidget(editField);           1243         layout2->addWidget(editField);
1236         searchButton = new QPushButton("Searc    1244         searchButton = new QPushButton("Search", this);
1237         searchButton->setAutoDefault(false);     1245         searchButton->setAutoDefault(false);
1238         connect(searchButton, &QPushButton::c    1246         connect(searchButton, &QPushButton::clicked,
1239                 this, &ConfigSearchWindow::se    1247                 this, &ConfigSearchWindow::search);
1240         layout2->addWidget(searchButton);        1248         layout2->addWidget(searchButton);
1241         layout1->addLayout(layout2);             1249         layout1->addLayout(layout2);
1242                                                  1250 
1243         split = new QSplitter(this);             1251         split = new QSplitter(this);
1244         split->setOrientation(Qt::Vertical);     1252         split->setOrientation(Qt::Vertical);
1245         list = new ConfigList(split, "search"    1253         list = new ConfigList(split, "search");
1246         list->mode = listMode;                   1254         list->mode = listMode;
1247         info = new ConfigInfoView(split, "sea    1255         info = new ConfigInfoView(split, "search");
1248         connect(list, &ConfigList::menuChange    1256         connect(list, &ConfigList::menuChanged,
1249                 info, &ConfigInfoView::setInf    1257                 info, &ConfigInfoView::setInfo);
1250         connect(list, &ConfigList::menuChange    1258         connect(list, &ConfigList::menuChanged,
1251                 parent, &ConfigMainWindow::se    1259                 parent, &ConfigMainWindow::setMenuLink);
1252                                                  1260 
1253         layout1->addWidget(split);               1261         layout1->addWidget(split);
1254                                                  1262 
1255         QVariant x, y;                           1263         QVariant x, y;
1256         int width, height;                       1264         int width, height;
1257         bool ok;                                 1265         bool ok;
1258                                                  1266 
1259         configSettings->beginGroup("search");    1267         configSettings->beginGroup("search");
1260         width = configSettings->value("/windo    1268         width = configSettings->value("/window width", parent->width() / 2).toInt();
1261         height = configSettings->value("/wind    1269         height = configSettings->value("/window height", parent->height() / 2).toInt();
1262         resize(width, height);                   1270         resize(width, height);
1263         x = configSettings->value("/window x"    1271         x = configSettings->value("/window x");
1264         y = configSettings->value("/window y"    1272         y = configSettings->value("/window y");
1265         if (x.isValid() && y.isValid())          1273         if (x.isValid() && y.isValid())
1266                 move(x.toInt(), y.toInt());      1274                 move(x.toInt(), y.toInt());
1267         QList<int> sizes = configSettings->re    1275         QList<int> sizes = configSettings->readSizes("/split", &ok);
1268         if (ok)                                  1276         if (ok)
1269                 split->setSizes(sizes);          1277                 split->setSizes(sizes);
1270         configSettings->endGroup();              1278         configSettings->endGroup();
1271         connect(configApp, &QApplication::abo    1279         connect(configApp, &QApplication::aboutToQuit,
1272                 this, &ConfigSearchWindow::sa    1280                 this, &ConfigSearchWindow::saveSettings);
1273 }                                                1281 }
1274                                                  1282 
1275 void ConfigSearchWindow::saveSettings(void)      1283 void ConfigSearchWindow::saveSettings(void)
1276 {                                                1284 {
1277         if (!objectName().isEmpty()) {           1285         if (!objectName().isEmpty()) {
1278                 configSettings->beginGroup(ob    1286                 configSettings->beginGroup(objectName());
1279                 configSettings->setValue("/wi    1287                 configSettings->setValue("/window x", pos().x());
1280                 configSettings->setValue("/wi    1288                 configSettings->setValue("/window y", pos().y());
1281                 configSettings->setValue("/wi    1289                 configSettings->setValue("/window width", size().width());
1282                 configSettings->setValue("/wi    1290                 configSettings->setValue("/window height", size().height());
1283                 configSettings->writeSizes("/    1291                 configSettings->writeSizes("/split", split->sizes());
1284                 configSettings->endGroup();      1292                 configSettings->endGroup();
1285         }                                        1293         }
1286 }                                                1294 }
1287                                                  1295 
1288 void ConfigSearchWindow::search(void)            1296 void ConfigSearchWindow::search(void)
1289 {                                                1297 {
1290         struct symbol **p;                       1298         struct symbol **p;
1291         struct property *prop;                   1299         struct property *prop;
1292         ConfigItem *lastItem = NULL;             1300         ConfigItem *lastItem = NULL;
1293                                                  1301 
1294         free(result);                            1302         free(result);
1295         list->clear();                           1303         list->clear();
1296         info->clear();                           1304         info->clear();
1297                                                  1305 
1298         result = sym_re_search(editField->tex    1306         result = sym_re_search(editField->text().toLatin1());
1299         if (!result)                             1307         if (!result)
1300                 return;                          1308                 return;
1301         for (p = result; *p; p++) {              1309         for (p = result; *p; p++) {
1302                 for_all_prompts((*p), prop)      1310                 for_all_prompts((*p), prop)
1303                         lastItem = new Config    1311                         lastItem = new ConfigItem(list, lastItem, prop->menu,
1304                                                  1312                                                   menu_is_visible(prop->menu));
1305         }                                        1313         }
1306 }                                                1314 }
1307                                                  1315 
1308 /*                                               1316 /*
1309  * Construct the complete config widget          1317  * Construct the complete config widget
1310  */                                              1318  */
1311 ConfigMainWindow::ConfigMainWindow(void)         1319 ConfigMainWindow::ConfigMainWindow(void)
1312         : searchWindow(0)                        1320         : searchWindow(0)
1313 {                                                1321 {
1314         bool ok = true;                          1322         bool ok = true;
1315         QVariant x, y;                           1323         QVariant x, y;
1316         int width, height;                       1324         int width, height;
1317         char title[256];                         1325         char title[256];
1318                                                  1326 
1319         snprintf(title, sizeof(title), "%s%s"    1327         snprintf(title, sizeof(title), "%s%s",
1320                 rootmenu.prompt->text,           1328                 rootmenu.prompt->text,
1321                 ""                               1329                 ""
1322                 );                               1330                 );
1323         setWindowTitle(title);                   1331         setWindowTitle(title);
1324                                                  1332 
1325         QRect g = configApp->primaryScreen()-    1333         QRect g = configApp->primaryScreen()->geometry();
1326         width = configSettings->value("/windo    1334         width = configSettings->value("/window width", g.width() - 64).toInt();
1327         height = configSettings->value("/wind    1335         height = configSettings->value("/window height", g.height() - 64).toInt();
1328         resize(width, height);                   1336         resize(width, height);
1329         x = configSettings->value("/window x"    1337         x = configSettings->value("/window x");
1330         y = configSettings->value("/window y"    1338         y = configSettings->value("/window y");
1331         if ((x.isValid())&&(y.isValid()))        1339         if ((x.isValid())&&(y.isValid()))
1332                 move(x.toInt(), y.toInt());      1340                 move(x.toInt(), y.toInt());
1333                                                  1341 
1334         // set up icons                          1342         // set up icons
1335         ConfigItem::symbolYesIcon = QIcon(QPi    1343         ConfigItem::symbolYesIcon = QIcon(QPixmap(xpm_symbol_yes));
1336         ConfigItem::symbolModIcon = QIcon(QPi    1344         ConfigItem::symbolModIcon = QIcon(QPixmap(xpm_symbol_mod));
1337         ConfigItem::symbolNoIcon = QIcon(QPix    1345         ConfigItem::symbolNoIcon = QIcon(QPixmap(xpm_symbol_no));
1338         ConfigItem::choiceYesIcon = QIcon(QPi    1346         ConfigItem::choiceYesIcon = QIcon(QPixmap(xpm_choice_yes));
1339         ConfigItem::choiceNoIcon = QIcon(QPix    1347         ConfigItem::choiceNoIcon = QIcon(QPixmap(xpm_choice_no));
1340         ConfigItem::menuIcon = QIcon(QPixmap(    1348         ConfigItem::menuIcon = QIcon(QPixmap(xpm_menu));
1341         ConfigItem::menubackIcon = QIcon(QPix    1349         ConfigItem::menubackIcon = QIcon(QPixmap(xpm_menuback));
1342                                                  1350 
1343         QWidget *widget = new QWidget(this);     1351         QWidget *widget = new QWidget(this);
1344         QVBoxLayout *layout = new QVBoxLayout    1352         QVBoxLayout *layout = new QVBoxLayout(widget);
1345         setCentralWidget(widget);                1353         setCentralWidget(widget);
1346                                                  1354 
1347         split1 = new QSplitter(widget);          1355         split1 = new QSplitter(widget);
1348         split1->setOrientation(Qt::Horizontal    1356         split1->setOrientation(Qt::Horizontal);
1349         split1->setChildrenCollapsible(false)    1357         split1->setChildrenCollapsible(false);
1350                                                  1358 
1351         menuList = new ConfigList(widget, "me    1359         menuList = new ConfigList(widget, "menu");
1352                                                  1360 
1353         split2 = new QSplitter(widget);          1361         split2 = new QSplitter(widget);
1354         split2->setChildrenCollapsible(false)    1362         split2->setChildrenCollapsible(false);
1355         split2->setOrientation(Qt::Vertical);    1363         split2->setOrientation(Qt::Vertical);
1356                                                  1364 
1357         // create config tree                    1365         // create config tree
1358         configList = new ConfigList(widget, "    1366         configList = new ConfigList(widget, "config");
1359                                                  1367 
1360         helpText = new ConfigInfoView(widget,    1368         helpText = new ConfigInfoView(widget, "help");
1361                                                  1369 
1362         layout->addWidget(split2);               1370         layout->addWidget(split2);
1363         split2->addWidget(split1);               1371         split2->addWidget(split1);
1364         split1->addWidget(configList);           1372         split1->addWidget(configList);
1365         split1->addWidget(menuList);             1373         split1->addWidget(menuList);
1366         split2->addWidget(helpText);             1374         split2->addWidget(helpText);
1367                                                  1375 
1368         setTabOrder(configList, helpText);       1376         setTabOrder(configList, helpText);
1369         configList->setFocus();                  1377         configList->setFocus();
1370                                                  1378 
1371         backAction = new QAction(QPixmap(xpm_    1379         backAction = new QAction(QPixmap(xpm_back), "Back", this);
1372         connect(backAction, &QAction::trigger    1380         connect(backAction, &QAction::triggered,
1373                 this, &ConfigMainWindow::goBa    1381                 this, &ConfigMainWindow::goBack);
1374                                                  1382 
1375         QAction *quitAction = new QAction("&Q    1383         QAction *quitAction = new QAction("&Quit", this);
1376         quitAction->setShortcut(Qt::CTRL | Qt    1384         quitAction->setShortcut(Qt::CTRL | Qt::Key_Q);
1377         connect(quitAction, &QAction::trigger    1385         connect(quitAction, &QAction::triggered,
1378                 this, &ConfigMainWindow::clos    1386                 this, &ConfigMainWindow::close);
1379                                                  1387 
1380         QAction *loadAction = new QAction(QPi    1388         QAction *loadAction = new QAction(QPixmap(xpm_load), "&Load", this);
1381         loadAction->setShortcut(Qt::CTRL | Qt    1389         loadAction->setShortcut(Qt::CTRL | Qt::Key_L);
1382         connect(loadAction, &QAction::trigger    1390         connect(loadAction, &QAction::triggered,
1383                 this, &ConfigMainWindow::load    1391                 this, &ConfigMainWindow::loadConfig);
1384                                                  1392 
1385         saveAction = new QAction(QPixmap(xpm_    1393         saveAction = new QAction(QPixmap(xpm_save), "&Save", this);
1386         saveAction->setShortcut(Qt::CTRL | Qt    1394         saveAction->setShortcut(Qt::CTRL | Qt::Key_S);
1387         connect(saveAction, &QAction::trigger    1395         connect(saveAction, &QAction::triggered,
1388                 this, &ConfigMainWindow::save    1396                 this, &ConfigMainWindow::saveConfig);
1389                                                  1397 
1390         conf_set_changed_callback(conf_change    1398         conf_set_changed_callback(conf_changed);
1391                                                  1399 
                                                   >> 1400         // Set saveAction's initial state
                                                   >> 1401         conf_changed();
1392         configname = xstrdup(conf_get_confign    1402         configname = xstrdup(conf_get_configname());
1393                                                  1403 
1394         QAction *saveAsAction = new QAction("    1404         QAction *saveAsAction = new QAction("Save &As...", this);
1395         connect(saveAsAction, &QAction::trigg    1405         connect(saveAsAction, &QAction::triggered,
1396                 this, &ConfigMainWindow::save    1406                 this, &ConfigMainWindow::saveConfigAs);
1397         QAction *searchAction = new QAction("    1407         QAction *searchAction = new QAction("&Find", this);
1398         searchAction->setShortcut(Qt::CTRL |     1408         searchAction->setShortcut(Qt::CTRL | Qt::Key_F);
1399         connect(searchAction, &QAction::trigg    1409         connect(searchAction, &QAction::triggered,
1400                 this, &ConfigMainWindow::sear    1410                 this, &ConfigMainWindow::searchConfig);
1401         singleViewAction = new QAction(QPixma    1411         singleViewAction = new QAction(QPixmap(xpm_single_view), "Single View", this);
1402         singleViewAction->setCheckable(true);    1412         singleViewAction->setCheckable(true);
1403         connect(singleViewAction, &QAction::t    1413         connect(singleViewAction, &QAction::triggered,
1404                 this, &ConfigMainWindow::show    1414                 this, &ConfigMainWindow::showSingleView);
1405         splitViewAction = new QAction(QPixmap    1415         splitViewAction = new QAction(QPixmap(xpm_split_view), "Split View", this);
1406         splitViewAction->setCheckable(true);     1416         splitViewAction->setCheckable(true);
1407         connect(splitViewAction, &QAction::tr    1417         connect(splitViewAction, &QAction::triggered,
1408                 this, &ConfigMainWindow::show    1418                 this, &ConfigMainWindow::showSplitView);
1409         fullViewAction = new QAction(QPixmap(    1419         fullViewAction = new QAction(QPixmap(xpm_tree_view), "Full View", this);
1410         fullViewAction->setCheckable(true);      1420         fullViewAction->setCheckable(true);
1411         connect(fullViewAction, &QAction::tri    1421         connect(fullViewAction, &QAction::triggered,
1412                 this, &ConfigMainWindow::show    1422                 this, &ConfigMainWindow::showFullView);
1413                                                  1423 
1414         QAction *showNameAction = new QAction    1424         QAction *showNameAction = new QAction("Show Name", this);
1415           showNameAction->setCheckable(true);    1425           showNameAction->setCheckable(true);
1416         connect(showNameAction, &QAction::tog    1426         connect(showNameAction, &QAction::toggled,
1417                 configList, &ConfigList::setS    1427                 configList, &ConfigList::setShowName);
1418         showNameAction->setChecked(configList    1428         showNameAction->setChecked(configList->showName);
1419                                                  1429 
1420         QActionGroup *optGroup = new QActionG    1430         QActionGroup *optGroup = new QActionGroup(this);
1421         optGroup->setExclusive(true);            1431         optGroup->setExclusive(true);
1422         connect(optGroup, &QActionGroup::trig    1432         connect(optGroup, &QActionGroup::triggered,
1423                 configList, &ConfigList::setO    1433                 configList, &ConfigList::setOptionMode);
1424         connect(optGroup, &QActionGroup::trig    1434         connect(optGroup, &QActionGroup::triggered,
1425                 menuList, &ConfigList::setOpt    1435                 menuList, &ConfigList::setOptionMode);
1426                                                  1436 
1427         ConfigList::showNormalAction = new QA    1437         ConfigList::showNormalAction = new QAction("Show Normal Options", optGroup);
1428         ConfigList::showNormalAction->setChec    1438         ConfigList::showNormalAction->setCheckable(true);
1429         ConfigList::showAllAction = new QActi    1439         ConfigList::showAllAction = new QAction("Show All Options", optGroup);
1430         ConfigList::showAllAction->setCheckab    1440         ConfigList::showAllAction->setCheckable(true);
1431         ConfigList::showPromptAction = new QA    1441         ConfigList::showPromptAction = new QAction("Show Prompt Options", optGroup);
1432         ConfigList::showPromptAction->setChec    1442         ConfigList::showPromptAction->setCheckable(true);
1433                                                  1443 
1434         QAction *showDebugAction = new QActio    1444         QAction *showDebugAction = new QAction("Show Debug Info", this);
1435           showDebugAction->setCheckable(true)    1445           showDebugAction->setCheckable(true);
1436         connect(showDebugAction, &QAction::to    1446         connect(showDebugAction, &QAction::toggled,
1437                 helpText, &ConfigInfoView::se    1447                 helpText, &ConfigInfoView::setShowDebug);
1438           showDebugAction->setChecked(helpTex    1448           showDebugAction->setChecked(helpText->showDebug());
1439                                                  1449 
1440         QAction *showIntroAction = new QActio    1450         QAction *showIntroAction = new QAction("Introduction", this);
1441         connect(showIntroAction, &QAction::tr    1451         connect(showIntroAction, &QAction::triggered,
1442                 this, &ConfigMainWindow::show    1452                 this, &ConfigMainWindow::showIntro);
1443         QAction *showAboutAction = new QActio    1453         QAction *showAboutAction = new QAction("About", this);
1444         connect(showAboutAction, &QAction::tr    1454         connect(showAboutAction, &QAction::triggered,
1445                 this, &ConfigMainWindow::show    1455                 this, &ConfigMainWindow::showAbout);
1446                                                  1456 
1447         // init tool bar                         1457         // init tool bar
1448         QToolBar *toolBar = addToolBar("Tools    1458         QToolBar *toolBar = addToolBar("Tools");
1449         toolBar->addAction(backAction);          1459         toolBar->addAction(backAction);
1450         toolBar->addSeparator();                 1460         toolBar->addSeparator();
1451         toolBar->addAction(loadAction);          1461         toolBar->addAction(loadAction);
1452         toolBar->addAction(saveAction);          1462         toolBar->addAction(saveAction);
1453         toolBar->addSeparator();                 1463         toolBar->addSeparator();
1454         toolBar->addAction(singleViewAction);    1464         toolBar->addAction(singleViewAction);
1455         toolBar->addAction(splitViewAction);     1465         toolBar->addAction(splitViewAction);
1456         toolBar->addAction(fullViewAction);      1466         toolBar->addAction(fullViewAction);
1457                                                  1467 
1458         // create file menu                      1468         // create file menu
1459         QMenu *menu = menuBar()->addMenu("&Fi    1469         QMenu *menu = menuBar()->addMenu("&File");
1460         menu->addAction(loadAction);             1470         menu->addAction(loadAction);
1461         menu->addAction(saveAction);             1471         menu->addAction(saveAction);
1462         menu->addAction(saveAsAction);           1472         menu->addAction(saveAsAction);
1463         menu->addSeparator();                    1473         menu->addSeparator();
1464         menu->addAction(quitAction);             1474         menu->addAction(quitAction);
1465                                                  1475 
1466         // create edit menu                      1476         // create edit menu
1467         menu = menuBar()->addMenu("&Edit");      1477         menu = menuBar()->addMenu("&Edit");
1468         menu->addAction(searchAction);           1478         menu->addAction(searchAction);
1469                                                  1479 
1470         // create options menu                   1480         // create options menu
1471         menu = menuBar()->addMenu("&Option");    1481         menu = menuBar()->addMenu("&Option");
1472         menu->addAction(showNameAction);         1482         menu->addAction(showNameAction);
1473         menu->addSeparator();                    1483         menu->addSeparator();
1474         menu->addActions(optGroup->actions())    1484         menu->addActions(optGroup->actions());
1475         menu->addSeparator();                    1485         menu->addSeparator();
1476         menu->addAction(showDebugAction);        1486         menu->addAction(showDebugAction);
1477                                                  1487 
1478         // create help menu                      1488         // create help menu
1479         menu = menuBar()->addMenu("&Help");      1489         menu = menuBar()->addMenu("&Help");
1480         menu->addAction(showIntroAction);        1490         menu->addAction(showIntroAction);
1481         menu->addAction(showAboutAction);        1491         menu->addAction(showAboutAction);
1482                                                  1492 
1483         connect(helpText, &ConfigInfoView::an    1493         connect(helpText, &ConfigInfoView::anchorClicked,
1484                 helpText, &ConfigInfoView::cl    1494                 helpText, &ConfigInfoView::clicked);
1485                                                  1495 
1486         connect(configList, &ConfigList::menu    1496         connect(configList, &ConfigList::menuChanged,
1487                 helpText, &ConfigInfoView::se    1497                 helpText, &ConfigInfoView::setInfo);
1488         connect(configList, &ConfigList::menu    1498         connect(configList, &ConfigList::menuSelected,
1489                 this, &ConfigMainWindow::chan    1499                 this, &ConfigMainWindow::changeMenu);
1490         connect(configList, &ConfigList::item    1500         connect(configList, &ConfigList::itemSelected,
1491                 this, &ConfigMainWindow::chan    1501                 this, &ConfigMainWindow::changeItens);
1492         connect(configList, &ConfigList::pare    1502         connect(configList, &ConfigList::parentSelected,
1493                 this, &ConfigMainWindow::goBa    1503                 this, &ConfigMainWindow::goBack);
1494         connect(menuList, &ConfigList::menuCh    1504         connect(menuList, &ConfigList::menuChanged,
1495                 helpText, &ConfigInfoView::se    1505                 helpText, &ConfigInfoView::setInfo);
1496         connect(menuList, &ConfigList::menuSe    1506         connect(menuList, &ConfigList::menuSelected,
1497                 this, &ConfigMainWindow::chan    1507                 this, &ConfigMainWindow::changeMenu);
1498                                                  1508 
1499         connect(configList, &ConfigList::gotF    1509         connect(configList, &ConfigList::gotFocus,
1500                 helpText, &ConfigInfoView::se    1510                 helpText, &ConfigInfoView::setInfo);
1501         connect(menuList, &ConfigList::gotFoc    1511         connect(menuList, &ConfigList::gotFocus,
1502                 helpText, &ConfigInfoView::se    1512                 helpText, &ConfigInfoView::setInfo);
1503         connect(menuList, &ConfigList::gotFoc    1513         connect(menuList, &ConfigList::gotFocus,
1504                 this, &ConfigMainWindow::list    1514                 this, &ConfigMainWindow::listFocusChanged);
1505         connect(helpText, &ConfigInfoView::me    1515         connect(helpText, &ConfigInfoView::menuSelected,
1506                 this, &ConfigMainWindow::setM    1516                 this, &ConfigMainWindow::setMenuLink);
1507                                                  1517 
1508         conf_read(NULL);                      << 
1509                                               << 
1510         QString listMode = configSettings->va    1518         QString listMode = configSettings->value("/listMode", "symbol").toString();
1511         if (listMode == "single")                1519         if (listMode == "single")
1512                 showSingleView();                1520                 showSingleView();
1513         else if (listMode == "full")             1521         else if (listMode == "full")
1514                 showFullView();                  1522                 showFullView();
1515         else /*if (listMode == "split")*/        1523         else /*if (listMode == "split")*/
1516                 showSplitView();                 1524                 showSplitView();
1517                                                  1525 
1518         // UI setup done, restore splitter po    1526         // UI setup done, restore splitter positions
1519         QList<int> sizes = configSettings->re    1527         QList<int> sizes = configSettings->readSizes("/split1", &ok);
1520         if (ok)                                  1528         if (ok)
1521                 split1->setSizes(sizes);         1529                 split1->setSizes(sizes);
1522                                                  1530 
1523         sizes = configSettings->readSizes("/s    1531         sizes = configSettings->readSizes("/split2", &ok);
1524         if (ok)                                  1532         if (ok)
1525                 split2->setSizes(sizes);         1533                 split2->setSizes(sizes);
1526 }                                                1534 }
1527                                                  1535 
1528 void ConfigMainWindow::loadConfig(void)          1536 void ConfigMainWindow::loadConfig(void)
1529 {                                                1537 {
1530         QString str;                             1538         QString str;
1531         QByteArray ba;                           1539         QByteArray ba;
1532         const char *name;                        1540         const char *name;
1533                                                  1541 
1534         str = QFileDialog::getOpenFileName(th    1542         str = QFileDialog::getOpenFileName(this, "", configname);
1535         if (str.isNull())                        1543         if (str.isNull())
1536                 return;                          1544                 return;
1537                                                  1545 
1538         ba = str.toLocal8Bit();                  1546         ba = str.toLocal8Bit();
1539         name = ba.data();                        1547         name = ba.data();
1540                                                  1548 
1541         if (conf_read(name))                     1549         if (conf_read(name))
1542                 QMessageBox::information(this    1550                 QMessageBox::information(this, "qconf", "Unable to load configuration!");
1543                                                  1551 
1544         free(configname);                        1552         free(configname);
1545         configname = xstrdup(name);              1553         configname = xstrdup(name);
1546                                                  1554 
1547         ConfigList::updateListAllForAll();       1555         ConfigList::updateListAllForAll();
1548 }                                                1556 }
1549                                                  1557 
1550 bool ConfigMainWindow::saveConfig(void)          1558 bool ConfigMainWindow::saveConfig(void)
1551 {                                                1559 {
1552         if (conf_write(configname)) {            1560         if (conf_write(configname)) {
1553                 QMessageBox::information(this    1561                 QMessageBox::information(this, "qconf", "Unable to save configuration!");
1554                 return false;                    1562                 return false;
1555         }                                        1563         }
1556         conf_write_autoconf(0);                  1564         conf_write_autoconf(0);
1557                                                  1565 
1558         return true;                             1566         return true;
1559 }                                                1567 }
1560                                                  1568 
1561 void ConfigMainWindow::saveConfigAs(void)        1569 void ConfigMainWindow::saveConfigAs(void)
1562 {                                                1570 {
1563         QString str;                             1571         QString str;
1564         QByteArray ba;                           1572         QByteArray ba;
1565         const char *name;                        1573         const char *name;
1566                                                  1574 
1567         str = QFileDialog::getSaveFileName(th    1575         str = QFileDialog::getSaveFileName(this, "", configname);
1568         if (str.isNull())                        1576         if (str.isNull())
1569                 return;                          1577                 return;
1570                                                  1578 
1571         ba = str.toLocal8Bit();                  1579         ba = str.toLocal8Bit();
1572         name = ba.data();                        1580         name = ba.data();
1573                                                  1581 
1574         if (conf_write(name)) {                  1582         if (conf_write(name)) {
1575                 QMessageBox::information(this    1583                 QMessageBox::information(this, "qconf", "Unable to save configuration!");
1576         }                                        1584         }
1577         conf_write_autoconf(0);                  1585         conf_write_autoconf(0);
1578                                                  1586 
1579         free(configname);                        1587         free(configname);
1580         configname = xstrdup(name);              1588         configname = xstrdup(name);
1581 }                                                1589 }
1582                                                  1590 
1583 void ConfigMainWindow::searchConfig(void)        1591 void ConfigMainWindow::searchConfig(void)
1584 {                                                1592 {
1585         if (!searchWindow)                       1593         if (!searchWindow)
1586                 searchWindow = new ConfigSear    1594                 searchWindow = new ConfigSearchWindow(this);
1587         searchWindow->show();                    1595         searchWindow->show();
1588 }                                                1596 }
1589                                                  1597 
1590 void ConfigMainWindow::changeItens(struct men    1598 void ConfigMainWindow::changeItens(struct menu *menu)
1591 {                                                1599 {
1592         configList->setRootMenu(menu);           1600         configList->setRootMenu(menu);
1593 }                                                1601 }
1594                                                  1602 
1595 void ConfigMainWindow::changeMenu(struct menu    1603 void ConfigMainWindow::changeMenu(struct menu *menu)
1596 {                                                1604 {
1597         menuList->setRootMenu(menu);             1605         menuList->setRootMenu(menu);
1598 }                                                1606 }
1599                                                  1607 
1600 void ConfigMainWindow::setMenuLink(struct men    1608 void ConfigMainWindow::setMenuLink(struct menu *menu)
1601 {                                                1609 {
1602         struct menu *parent;                     1610         struct menu *parent;
1603         ConfigList* list = NULL;                 1611         ConfigList* list = NULL;
1604         ConfigItem* item;                        1612         ConfigItem* item;
1605                                                  1613 
1606         if (configList->menuSkip(menu))          1614         if (configList->menuSkip(menu))
1607                 return;                          1615                 return;
1608                                                  1616 
1609         switch (configList->mode) {              1617         switch (configList->mode) {
1610         case singleMode:                         1618         case singleMode:
1611                 list = configList;               1619                 list = configList;
1612                 parent = menu_get_parent_menu    1620                 parent = menu_get_parent_menu(menu);
1613                 if (!parent)                     1621                 if (!parent)
1614                         return;                  1622                         return;
1615                 list->setRootMenu(parent);       1623                 list->setRootMenu(parent);
1616                 break;                           1624                 break;
1617         case menuMode:                           1625         case menuMode:
1618                 if (menu->flags & MENU_ROOT)     1626                 if (menu->flags & MENU_ROOT) {
1619                         menuList->setRootMenu    1627                         menuList->setRootMenu(menu);
1620                         configList->clearSele    1628                         configList->clearSelection();
1621                         list = configList;       1629                         list = configList;
1622                 } else {                         1630                 } else {
1623                         parent = menu_get_par    1631                         parent = menu_get_parent_menu(menu->parent);
1624                         if (!parent)             1632                         if (!parent)
1625                                 return;          1633                                 return;
1626                                                  1634 
1627                         /* Select the config     1635                         /* Select the config view */
1628                         item = configList->fi    1636                         item = configList->findConfigItem(parent);
1629                         if (item) {              1637                         if (item) {
1630                                 configList->s    1638                                 configList->setSelected(item, true);
1631                                 configList->s    1639                                 configList->scrollToItem(item);
1632                         }                        1640                         }
1633                                                  1641 
1634                         menuList->setRootMenu    1642                         menuList->setRootMenu(parent);
1635                         menuList->clearSelect    1643                         menuList->clearSelection();
1636                         list = menuList;         1644                         list = menuList;
1637                 }                                1645                 }
1638                 break;                           1646                 break;
1639         case fullMode:                           1647         case fullMode:
1640                 list = configList;               1648                 list = configList;
1641                 break;                           1649                 break;
1642         default:                                 1650         default:
1643                 break;                           1651                 break;
1644         }                                        1652         }
1645                                                  1653 
1646         if (list) {                              1654         if (list) {
1647                 item = list->findConfigItem(m    1655                 item = list->findConfigItem(menu);
1648                 if (item) {                      1656                 if (item) {
1649                         list->setSelected(ite    1657                         list->setSelected(item, true);
1650                         list->scrollToItem(it    1658                         list->scrollToItem(item);
1651                         list->setFocus();        1659                         list->setFocus();
1652                         helpText->setInfo(men    1660                         helpText->setInfo(menu);
1653                 }                                1661                 }
1654         }                                        1662         }
1655 }                                                1663 }
1656                                                  1664 
1657 void ConfigMainWindow::listFocusChanged(void)    1665 void ConfigMainWindow::listFocusChanged(void)
1658 {                                                1666 {
1659         if (menuList->mode == menuMode)          1667         if (menuList->mode == menuMode)
1660                 configList->clearSelection();    1668                 configList->clearSelection();
1661 }                                                1669 }
1662                                                  1670 
1663 void ConfigMainWindow::goBack(void)              1671 void ConfigMainWindow::goBack(void)
1664 {                                                1672 {
1665         if (configList->rootEntry == &rootmen    1673         if (configList->rootEntry == &rootmenu)
1666                 return;                          1674                 return;
1667                                                  1675 
1668         configList->setParentMenu();             1676         configList->setParentMenu();
1669 }                                                1677 }
1670                                                  1678 
1671 void ConfigMainWindow::showSingleView(void)      1679 void ConfigMainWindow::showSingleView(void)
1672 {                                                1680 {
1673         singleViewAction->setEnabled(false);     1681         singleViewAction->setEnabled(false);
1674         singleViewAction->setChecked(true);      1682         singleViewAction->setChecked(true);
1675         splitViewAction->setEnabled(true);       1683         splitViewAction->setEnabled(true);
1676         splitViewAction->setChecked(false);      1684         splitViewAction->setChecked(false);
1677         fullViewAction->setEnabled(true);        1685         fullViewAction->setEnabled(true);
1678         fullViewAction->setChecked(false);       1686         fullViewAction->setChecked(false);
1679                                                  1687 
1680         backAction->setEnabled(true);            1688         backAction->setEnabled(true);
1681                                                  1689 
1682         menuList->hide();                        1690         menuList->hide();
1683         menuList->setRootMenu(0);                1691         menuList->setRootMenu(0);
1684         configList->mode = singleMode;           1692         configList->mode = singleMode;
1685         if (configList->rootEntry == &rootmen    1693         if (configList->rootEntry == &rootmenu)
1686                 configList->updateListAll();     1694                 configList->updateListAll();
1687         else                                     1695         else
1688                 configList->setRootMenu(&root    1696                 configList->setRootMenu(&rootmenu);
1689         configList->setFocus();                  1697         configList->setFocus();
1690 }                                                1698 }
1691                                                  1699 
1692 void ConfigMainWindow::showSplitView(void)       1700 void ConfigMainWindow::showSplitView(void)
1693 {                                                1701 {
1694         singleViewAction->setEnabled(true);      1702         singleViewAction->setEnabled(true);
1695         singleViewAction->setChecked(false);     1703         singleViewAction->setChecked(false);
1696         splitViewAction->setEnabled(false);      1704         splitViewAction->setEnabled(false);
1697         splitViewAction->setChecked(true);       1705         splitViewAction->setChecked(true);
1698         fullViewAction->setEnabled(true);        1706         fullViewAction->setEnabled(true);
1699         fullViewAction->setChecked(false);       1707         fullViewAction->setChecked(false);
1700                                                  1708 
1701         backAction->setEnabled(false);           1709         backAction->setEnabled(false);
1702                                                  1710 
1703         configList->mode = menuMode;             1711         configList->mode = menuMode;
1704         if (configList->rootEntry == &rootmen    1712         if (configList->rootEntry == &rootmenu)
1705                 configList->updateListAll();     1713                 configList->updateListAll();
1706         else                                     1714         else
1707                 configList->setRootMenu(&root    1715                 configList->setRootMenu(&rootmenu);
1708         configList->setAllOpen(true);            1716         configList->setAllOpen(true);
1709         configApp->processEvents();              1717         configApp->processEvents();
1710         menuList->mode = symbolMode;             1718         menuList->mode = symbolMode;
1711         menuList->setRootMenu(&rootmenu);        1719         menuList->setRootMenu(&rootmenu);
1712         menuList->setAllOpen(true);              1720         menuList->setAllOpen(true);
1713         menuList->show();                        1721         menuList->show();
1714         menuList->setFocus();                    1722         menuList->setFocus();
1715 }                                                1723 }
1716                                                  1724 
1717 void ConfigMainWindow::showFullView(void)        1725 void ConfigMainWindow::showFullView(void)
1718 {                                                1726 {
1719         singleViewAction->setEnabled(true);      1727         singleViewAction->setEnabled(true);
1720         singleViewAction->setChecked(false);     1728         singleViewAction->setChecked(false);
1721         splitViewAction->setEnabled(true);       1729         splitViewAction->setEnabled(true);
1722         splitViewAction->setChecked(false);      1730         splitViewAction->setChecked(false);
1723         fullViewAction->setEnabled(false);       1731         fullViewAction->setEnabled(false);
1724         fullViewAction->setChecked(true);        1732         fullViewAction->setChecked(true);
1725                                                  1733 
1726         backAction->setEnabled(false);           1734         backAction->setEnabled(false);
1727                                                  1735 
1728         menuList->hide();                        1736         menuList->hide();
1729         menuList->setRootMenu(0);                1737         menuList->setRootMenu(0);
1730         configList->mode = fullMode;             1738         configList->mode = fullMode;
1731         if (configList->rootEntry == &rootmen    1739         if (configList->rootEntry == &rootmenu)
1732                 configList->updateListAll();     1740                 configList->updateListAll();
1733         else                                     1741         else
1734                 configList->setRootMenu(&root    1742                 configList->setRootMenu(&rootmenu);
1735         configList->setFocus();                  1743         configList->setFocus();
1736 }                                                1744 }
1737                                                  1745 
1738 /*                                               1746 /*
1739  * ask for saving configuration before quitti    1747  * ask for saving configuration before quitting
1740  */                                              1748  */
1741 void ConfigMainWindow::closeEvent(QCloseEvent    1749 void ConfigMainWindow::closeEvent(QCloseEvent* e)
1742 {                                                1750 {
1743         if (!conf_get_changed()) {               1751         if (!conf_get_changed()) {
1744                 e->accept();                     1752                 e->accept();
1745                 return;                          1753                 return;
1746         }                                        1754         }
1747                                                  1755 
1748         QMessageBox mb(QMessageBox::Icon::War    1756         QMessageBox mb(QMessageBox::Icon::Warning, "qconf",
1749                        "Save configuration?")    1757                        "Save configuration?");
1750                                                  1758 
1751         QPushButton *yb = mb.addButton(QMessa    1759         QPushButton *yb = mb.addButton(QMessageBox::Yes);
1752         QPushButton *db = mb.addButton(QMessa    1760         QPushButton *db = mb.addButton(QMessageBox::No);
1753         QPushButton *cb = mb.addButton(QMessa    1761         QPushButton *cb = mb.addButton(QMessageBox::Cancel);
1754                                                  1762 
1755         yb->setText("&Save Changes");            1763         yb->setText("&Save Changes");
1756         db->setText("&Discard Changes");         1764         db->setText("&Discard Changes");
1757         cb->setText("Cancel Exit");              1765         cb->setText("Cancel Exit");
1758                                                  1766 
1759         mb.setDefaultButton(yb);                 1767         mb.setDefaultButton(yb);
1760         mb.setEscapeButton(cb);                  1768         mb.setEscapeButton(cb);
1761                                                  1769 
1762         switch (mb.exec()) {                     1770         switch (mb.exec()) {
1763         case QMessageBox::Yes:                   1771         case QMessageBox::Yes:
1764                 if (saveConfig())                1772                 if (saveConfig())
1765                         e->accept();             1773                         e->accept();
1766                 else                             1774                 else
1767                         e->ignore();             1775                         e->ignore();
1768                 break;                           1776                 break;
1769         case QMessageBox::No:                    1777         case QMessageBox::No:
1770                 e->accept();                     1778                 e->accept();
1771                 break;                           1779                 break;
1772         case QMessageBox::Cancel:                1780         case QMessageBox::Cancel:
1773                 e->ignore();                     1781                 e->ignore();
1774                 break;                           1782                 break;
1775         }                                        1783         }
1776 }                                                1784 }
1777                                                  1785 
1778 void ConfigMainWindow::showIntro(void)           1786 void ConfigMainWindow::showIntro(void)
1779 {                                                1787 {
1780         static const QString str =               1788         static const QString str =
1781                 "Welcome to the qconf graphic    1789                 "Welcome to the qconf graphical configuration tool.\n"
1782                 "\n"                             1790                 "\n"
1783                 "For bool and tristate option    1791                 "For bool and tristate options, a blank box indicates the "
1784                 "feature is disabled, a check    1792                 "feature is disabled, a check indicates it is enabled, and a "
1785                 "dot indicates that it is to     1793                 "dot indicates that it is to be compiled as a module. Clicking "
1786                 "on the box will cycle throug    1794                 "on the box will cycle through the three states. For int, hex, "
1787                 "and string options, double-c    1795                 "and string options, double-clicking or pressing F2 on the "
1788                 "Value cell will allow you to    1796                 "Value cell will allow you to edit the value.\n"
1789                 "\n"                             1797                 "\n"
1790                 "If you do not see an option     1798                 "If you do not see an option (e.g., a device driver) that you "
1791                 "believe should be present, t    1799                 "believe should be present, try turning on Show All Options "
1792                 "under the Options menu. Enab    1800                 "under the Options menu. Enabling Show Debug Info will help you"
1793                 "figure out what other option    1801                 "figure out what other options must be enabled to support the "
1794                 "option you are interested in    1802                 "option you are interested in, and hyperlinks will navigate to "
1795                 "them.\n"                        1803                 "them.\n"
1796                 "\n"                             1804                 "\n"
1797                 "Toggling Show Debug Info und    1805                 "Toggling Show Debug Info under the Options menu will show the "
1798                 "dependencies, which you can     1806                 "dependencies, which you can then match by examining other "
1799                 "options.\n";                    1807                 "options.\n";
1800                                                  1808 
1801         QMessageBox::information(this, "qconf    1809         QMessageBox::information(this, "qconf", str);
1802 }                                                1810 }
1803                                                  1811 
1804 void ConfigMainWindow::showAbout(void)           1812 void ConfigMainWindow::showAbout(void)
1805 {                                                1813 {
1806         static const QString str = "qconf is     1814         static const QString str = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n"
1807                 "Copyright (C) 2015 Boris Bar    1815                 "Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com>.\n"
1808                 "\n"                             1816                 "\n"
1809                 "Bug reports and feature requ    1817                 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"
1810                 "\n"                             1818                 "\n"
1811                 "Qt Version: ";                  1819                 "Qt Version: ";
1812                                                  1820 
1813         QMessageBox::information(this, "qconf    1821         QMessageBox::information(this, "qconf", str + qVersion());
1814 }                                                1822 }
1815                                                  1823 
1816 void ConfigMainWindow::saveSettings(void)        1824 void ConfigMainWindow::saveSettings(void)
1817 {                                                1825 {
1818         configSettings->setValue("/window x",    1826         configSettings->setValue("/window x", pos().x());
1819         configSettings->setValue("/window y",    1827         configSettings->setValue("/window y", pos().y());
1820         configSettings->setValue("/window wid    1828         configSettings->setValue("/window width", size().width());
1821         configSettings->setValue("/window hei    1829         configSettings->setValue("/window height", size().height());
1822                                                  1830 
1823         QString entry;                           1831         QString entry;
1824         switch(configList->mode) {               1832         switch(configList->mode) {
1825         case singleMode :                        1833         case singleMode :
1826                 entry = "single";                1834                 entry = "single";
1827                 break;                           1835                 break;
1828                                                  1836 
1829         case symbolMode :                        1837         case symbolMode :
1830                 entry = "split";                 1838                 entry = "split";
1831                 break;                           1839                 break;
1832                                                  1840 
1833         case fullMode :                          1841         case fullMode :
1834                 entry = "full";                  1842                 entry = "full";
1835                 break;                           1843                 break;
1836                                                  1844 
1837         default:                                 1845         default:
1838                 break;                           1846                 break;
1839         }                                        1847         }
1840         configSettings->setValue("/listMode",    1848         configSettings->setValue("/listMode", entry);
1841                                                  1849 
1842         configSettings->writeSizes("/split1",    1850         configSettings->writeSizes("/split1", split1->sizes());
1843         configSettings->writeSizes("/split2",    1851         configSettings->writeSizes("/split2", split2->sizes());
1844 }                                                1852 }
1845                                                  1853 
1846 void ConfigMainWindow::conf_changed(bool dirt !! 1854 void ConfigMainWindow::conf_changed(void)
1847 {                                                1855 {
1848         if (saveAction)                          1856         if (saveAction)
1849                 saveAction->setEnabled(dirty) !! 1857                 saveAction->setEnabled(conf_get_changed());
1850 }                                                1858 }
1851                                                  1859 
1852 void fixup_rootmenu(struct menu *menu)           1860 void fixup_rootmenu(struct menu *menu)
1853 {                                                1861 {
1854         struct menu *child;                      1862         struct menu *child;
1855         static int menu_cnt = 0;                 1863         static int menu_cnt = 0;
1856                                                  1864 
1857         menu->flags |= MENU_ROOT;                1865         menu->flags |= MENU_ROOT;
1858         for (child = menu->list; child; child    1866         for (child = menu->list; child; child = child->next) {
1859                 if (child->prompt && child->p    1867                 if (child->prompt && child->prompt->type == P_MENU) {
1860                         menu_cnt++;              1868                         menu_cnt++;
1861                         fixup_rootmenu(child)    1869                         fixup_rootmenu(child);
1862                         menu_cnt--;              1870                         menu_cnt--;
1863                 } else if (!menu_cnt)            1871                 } else if (!menu_cnt)
1864                         fixup_rootmenu(child)    1872                         fixup_rootmenu(child);
1865         }                                        1873         }
1866 }                                                1874 }
1867                                                  1875 
1868 static const char *progname;                     1876 static const char *progname;
1869                                                  1877 
1870 static void usage(void)                          1878 static void usage(void)
1871 {                                                1879 {
1872         printf("%s [-s] <config>\n", progname    1880         printf("%s [-s] <config>\n", progname);
1873         exit(0);                                 1881         exit(0);
1874 }                                                1882 }
1875                                                  1883 
1876 int main(int ac, char** av)                      1884 int main(int ac, char** av)
1877 {                                                1885 {
1878         ConfigMainWindow* v;                     1886         ConfigMainWindow* v;
1879         const char *name;                        1887         const char *name;
1880                                                  1888 
1881         progname = av[0];                        1889         progname = av[0];
1882         if (ac > 1 && av[1][0] == '-') {         1890         if (ac > 1 && av[1][0] == '-') {
1883                 switch (av[1][1]) {              1891                 switch (av[1][1]) {
1884                 case 's':                        1892                 case 's':
1885                         conf_set_message_call    1893                         conf_set_message_callback(NULL);
1886                         break;                   1894                         break;
1887                 case 'h':                        1895                 case 'h':
1888                 case '?':                        1896                 case '?':
1889                         usage();                 1897                         usage();
1890                 }                                1898                 }
1891                 name = av[2];                    1899                 name = av[2];
1892         } else                                   1900         } else
1893                 name = av[1];                    1901                 name = av[1];
1894         if (!name)                               1902         if (!name)
1895                 usage();                         1903                 usage();
1896                                                  1904 
1897         conf_parse(name);                        1905         conf_parse(name);
1898         fixup_rootmenu(&rootmenu);               1906         fixup_rootmenu(&rootmenu);
                                                   >> 1907         conf_read(NULL);
1899         //zconfdump(stdout);                     1908         //zconfdump(stdout);
1900                                                  1909 
1901         configApp = new QApplication(ac, av);    1910         configApp = new QApplication(ac, av);
1902                                                  1911 
1903         configSettings = new ConfigSettings()    1912         configSettings = new ConfigSettings();
1904         configSettings->beginGroup("/kconfig/    1913         configSettings->beginGroup("/kconfig/qconf");
1905         v = new ConfigMainWindow();              1914         v = new ConfigMainWindow();
1906                                                  1915 
1907         //zconfdump(stdout);                     1916         //zconfdump(stdout);
1908         configApp->connect(configApp, SIGNAL(    1917         configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit()));
1909         configApp->connect(configApp, SIGNAL(    1918         configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings()));
1910                                               << 
1911         v->show();                               1919         v->show();
1912         configApp->exec();                       1920         configApp->exec();
1913                                                  1921 
1914         configSettings->endGroup();              1922         configSettings->endGroup();
1915         delete configSettings;                   1923         delete configSettings;
1916         delete v;                                1924         delete v;
1917         delete configApp;                        1925         delete configApp;
1918                                                  1926 
1919         return 0;                                1927         return 0;
1920 }                                                1928 }
1921                                                  1929 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php