~ [ 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-4.12.14)


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

~ [ 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