aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-11 00:06:50 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-11 00:06:50 -0500
commit152813e6e4bbb5f017e33eba7eb01bbda4b389b8 (patch)
treef0d0345a1ff7d6362881997cb67ee3c01a50614f /scripts
parentc34e6e0bd5d729948119d4b3e15b075ec0b80d6f (diff)
parentbe596aaa74090f553c61505ad03bb7a7460e5d23 (diff)
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kconfig updates from Michal Marek: - 'make xconfig' ported to Qt5, dropping support for Qt3 - merge_config.sh supports a single-input-file mode and also respects $KCONFIG_CONFIG - Fix for incorrect display of >= and > in dependency expressions * 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: (44 commits) Add current selection check. Use pkg-config to find Qt 4 and 5 instead of direct qmake kconfig: Fix copy&paste error kconfig/merge_config.sh: Accept a single file kconfig/merge_config.sh: Support KCONFIG_CONFIG Update the buildsystem for KConfig finding Qt Port xconfig to Qt5 - Update copyright. Port xconfig to Qt5 - Fix goParent issue. Port xconfig to Qt5 - on Back clicked, deselect old item. Port xconfig to Qt5 - Add(back) one click checkbox toggle. Port xconfig to Qt5 - Add(back) lineedit editing. Port xconfig to Qt5 - Remove some commented code. Port xconfig to Qt5 - Source format. Port xconfig to Qt5 - Add horizontal scrollbar, and scroll per pixel. Port xconfig to Qt5 - Change ConfigItem constructor parent type. Port xconfig to Qt5 - Disable ConfigList soring Port xconfig to Qt5 - Remove ConfigList::updateMenuList template. Port xconfig to Qt5 - Add ConfigList::mode to initializer list. Port xconfig to Qt5 - Add ConfigItem::nextItem to initializer list. Port xconfig to Qt5 - Tree widget set column titles. ...
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/Makefile56
-rw-r--r--scripts/kconfig/expr.c2
-rwxr-xr-xscripts/kconfig/merge_config.sh18
-rw-r--r--scripts/kconfig/qconf.cc688
-rw-r--r--scripts/kconfig/qconf.h150
-rw-r--r--scripts/kconfig/symbol.c2
6 files changed, 480 insertions, 436 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 3043d6b0b51d..d79cba4ce3eb 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -229,49 +229,21 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
229 229
230# Qt needs some extra effort... 230# Qt needs some extra effort...
231$(obj)/.tmp_qtcheck: 231$(obj)/.tmp_qtcheck:
232 @set -e; $(kecho) " CHECK qt"; dir=""; pkg=""; \ 232 @set -e; $(kecho) " CHECK qt"; \
233 if ! pkg-config --exists QtCore 2> /dev/null; then \ 233 if pkg-config --exists Qt5Core; then \
234 echo "* Unable to find the Qt4 tool qmake. Trying to use Qt3"; \ 234 cflags="-std=c++11 -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets`"; \
235 pkg-config --exists qt 2> /dev/null && pkg=qt; \ 235 libs=`pkg-config --libs Qt5Core Qt5Gui Qt5Widgets`; \
236 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ 236 moc=`pkg-config --variable=host_bins Qt5Core`/moc; \
237 if [ -n "$$pkg" ]; then \ 237 elif pkg-config --exists QtCore; then \
238 cflags="\$$(shell pkg-config $$pkg --cflags)"; \ 238 cflags=`pkg-config --cflags QtCore QtGui`; \
239 libs="\$$(shell pkg-config $$pkg --libs)"; \ 239 libs=`pkg-config --libs QtCore QtGui`; \
240 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ 240 moc=`pkg-config --variable=moc_location QtCore`; \
241 dir="$$(pkg-config $$pkg --variable=prefix)"; \
242 else \
243 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
244 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
245 done; \
246 if [ -z "$$dir" ]; then \
247 echo >&2 "*"; \
248 echo >&2 "* Unable to find any Qt installation. Please make sure that"; \
249 echo >&2 "* the Qt4 or Qt3 development package is correctly installed and"; \
250 echo >&2 "* either qmake can be found or install pkg-config or set"; \
251 echo >&2 "* the QTDIR environment variable to the correct location."; \
252 echo >&2 "*"; \
253 false; \
254 fi; \
255 libpath=$$dir/lib; lib=qt; osdir=""; \
256 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
257 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
258 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
259 test -f $$libpath/libqt-mt.so && lib=qt-mt; \
260 cflags="-I$$dir/include"; \
261 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
262 moc="$$dir/bin/moc"; \
263 fi; \
264 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
265 echo "*"; \
266 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
267 echo "*"; \
268 moc="/usr/bin/moc"; \
269 fi; \
270 else \ 241 else \
271 cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \ 242 echo >&2 "*"; \
272 libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \ 243 echo >&2 "* Could not find Qt via pkg-config."; \
273 moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \ 244 echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \
274 [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \ 245 echo >&2 "*"; \
246 exit 1; \
275 fi; \ 247 fi; \
276 echo "KC_QT_CFLAGS=$$cflags" > $@; \ 248 echo "KC_QT_CFLAGS=$$cflags" > $@; \
277 echo "KC_QT_LIBS=$$libs" >> $@; \ 249 echo "KC_QT_LIBS=$$libs" >> $@; \
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 667d1aa23711..cbf4996dd9c1 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -1113,7 +1113,7 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *
1113 fn(data, e->left.sym, e->left.sym->name); 1113 fn(data, e->left.sym, e->left.sym->name);
1114 else 1114 else
1115 fn(data, NULL, "<choice>"); 1115 fn(data, NULL, "<choice>");
1116 fn(data, NULL, e->type == E_LEQ ? ">=" : ">"); 1116 fn(data, NULL, e->type == E_GEQ ? ">=" : ">");
1117 fn(data, e->right.sym, e->right.sym->name); 1117 fn(data, e->right.sym, e->right.sym->name);
1118 break; 1118 break;
1119 case E_UNEQUAL: 1119 case E_UNEQUAL:
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 0d883b37882a..67d131447631 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -32,7 +32,7 @@ usage() {
32 echo " -m only merge the fragments, do not execute the make command" 32 echo " -m only merge the fragments, do not execute the make command"
33 echo " -n use allnoconfig instead of alldefconfig" 33 echo " -n use allnoconfig instead of alldefconfig"
34 echo " -r list redundant entries when merging fragments" 34 echo " -r list redundant entries when merging fragments"
35 echo " -O dir to put generated output files" 35 echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead."
36} 36}
37 37
38RUNMAKE=true 38RUNMAKE=true
@@ -77,11 +77,19 @@ while true; do
77 esac 77 esac
78done 78done
79 79
80if [ "$#" -lt 2 ] ; then 80if [ "$#" -lt 1 ] ; then
81 usage 81 usage
82 exit 82 exit
83fi 83fi
84 84
85if [ -z "$KCONFIG_CONFIG" ]; then
86 if [ "$OUTPUT" != . ]; then
87 KCONFIG_CONFIG=$(readlink -m -- "$OUTPUT/.config")
88 else
89 KCONFIG_CONFIG=.config
90 fi
91fi
92
85INITFILE=$1 93INITFILE=$1
86shift; 94shift;
87 95
@@ -124,9 +132,9 @@ for MERGE_FILE in $MERGE_LIST ; do
124done 132done
125 133
126if [ "$RUNMAKE" = "false" ]; then 134if [ "$RUNMAKE" = "false" ]; then
127 cp $TMP_FILE $OUTPUT/.config 135 cp -T -- "$TMP_FILE" "$KCONFIG_CONFIG"
128 echo "#" 136 echo "#"
129 echo "# merged configuration written to $OUTPUT/.config (needs make)" 137 echo "# merged configuration written to $KCONFIG_CONFIG (needs make)"
130 echo "#" 138 echo "#"
131 clean_up 139 clean_up
132 exit 140 exit
@@ -150,7 +158,7 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET
150for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do 158for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
151 159
152 REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) 160 REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)
153 ACTUAL_VAL=$(grep -w -e "$CFG" $OUTPUT/.config) 161 ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG")
154 if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then 162 if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
155 echo "Value requested for $CFG not in final .config" 163 echo "Value requested for $CFG not in final .config"
156 echo "Requested value: $REQUESTED_VAL" 164 echo "Requested value: $REQUESTED_VAL"
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index c3bb7fe8dfa6..91b7e6fbc364 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1,32 +1,17 @@
1/* 1/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com>
3 * Released under the terms of the GNU GPL v2.0. 4 * Released under the terms of the GNU GPL v2.0.
4 */ 5 */
5 6
6#include <qglobal.h> 7#include <qglobal.h>
7 8
8#if QT_VERSION < 0x040000 9#include <QMainWindow>
9#include <stddef.h> 10#include <QList>
10#include <qmainwindow.h>
11#include <qvbox.h>
12#include <qvaluelist.h>
13#include <qtextbrowser.h> 11#include <qtextbrowser.h>
14#include <qaction.h> 12#include <QAction>
15#include <qheader.h> 13#include <QFileDialog>
16#include <qfiledialog.h> 14#include <QMenu>
17#include <qdragobject.h>
18#include <qpopupmenu.h>
19#else
20#include <q3mainwindow.h>
21#include <q3vbox.h>
22#include <q3valuelist.h>
23#include <q3textbrowser.h>
24#include <q3action.h>
25#include <q3header.h>
26#include <q3filedialog.h>
27#include <q3dragobject.h>
28#include <q3popupmenu.h>
29#endif
30 15
31#include <qapplication.h> 16#include <qapplication.h>
32#include <qdesktopwidget.h> 17#include <qdesktopwidget.h>
@@ -57,7 +42,7 @@
57static QApplication *configApp; 42static QApplication *configApp;
58static ConfigSettings *configSettings; 43static ConfigSettings *configSettings;
59 44
60Q3Action *ConfigMainWindow::saveAction; 45QAction *ConfigMainWindow::saveAction;
61 46
62static inline QString qgettext(const char* str) 47static inline QString qgettext(const char* str)
63{ 48{
@@ -66,7 +51,7 @@ static inline QString qgettext(const char* str)
66 51
67static inline QString qgettext(const QString& str) 52static inline QString qgettext(const QString& str)
68{ 53{
69 return QString::fromLocal8Bit(gettext(str.latin1())); 54 return QString::fromLocal8Bit(gettext(str.toLatin1()));
70} 55}
71 56
72ConfigSettings::ConfigSettings() 57ConfigSettings::ConfigSettings()
@@ -77,10 +62,10 @@ ConfigSettings::ConfigSettings()
77/** 62/**
78 * Reads a list of integer values from the application settings. 63 * Reads a list of integer values from the application settings.
79 */ 64 */
80Q3ValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) 65QList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
81{ 66{
82 Q3ValueList<int> result; 67 QList<int> result;
83 QStringList entryList = readListEntry(key, ok); 68 QStringList entryList = value(key).toStringList();
84 QStringList::Iterator it; 69 QStringList::Iterator it;
85 70
86 for (it = entryList.begin(); it != entryList.end(); ++it) 71 for (it = entryList.begin(); it != entryList.end(); ++it)
@@ -92,14 +77,16 @@ Q3ValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
92/** 77/**
93 * Writes a list of integer values to the application settings. 78 * Writes a list of integer values to the application settings.
94 */ 79 */
95bool ConfigSettings::writeSizes(const QString& key, const Q3ValueList<int>& value) 80bool ConfigSettings::writeSizes(const QString& key, const QList<int>& value)
96{ 81{
97 QStringList stringList; 82 QStringList stringList;
98 Q3ValueList<int>::ConstIterator it; 83 QList<int>::ConstIterator it;
99 84
100 for (it = value.begin(); it != value.end(); ++it) 85 for (it = value.begin(); it != value.end(); ++it)
101 stringList.push_back(QString::number(*it)); 86 stringList.push_back(QString::number(*it));
102 return writeEntry(key, stringList); 87 setValue(key, stringList);
88
89 return true;
103} 90}
104 91
105 92
@@ -109,9 +96,6 @@ bool ConfigSettings::writeSizes(const QString& key, const Q3ValueList<int>& valu
109 */ 96 */
110void ConfigItem::okRename(int col) 97void ConfigItem::okRename(int col)
111{ 98{
112 Parent::okRename(col);
113 sym_set_string_value(menu->sym, text(dataColIdx).latin1());
114 listView()->updateList(this);
115} 99}
116 100
117/* 101/*
@@ -149,11 +133,11 @@ void ConfigItem::updateMenu(void)
149 } else { 133 } else {
150 if (sym) 134 if (sym)
151 break; 135 break;
152 setPixmap(promptColIdx, 0); 136 setPixmap(promptColIdx, QIcon());
153 } 137 }
154 goto set_prompt; 138 goto set_prompt;
155 case P_COMMENT: 139 case P_COMMENT:
156 setPixmap(promptColIdx, 0); 140 setPixmap(promptColIdx, QIcon());
157 goto set_prompt; 141 goto set_prompt;
158 default: 142 default:
159 ; 143 ;
@@ -170,7 +154,7 @@ void ConfigItem::updateMenu(void)
170 char ch; 154 char ch;
171 155
172 if (!sym_is_changable(sym) && list->optMode == normalOpt) { 156 if (!sym_is_changable(sym) && list->optMode == normalOpt) {
173 setPixmap(promptColIdx, 0); 157 setPixmap(promptColIdx, QIcon());
174 setText(noColIdx, QString::null); 158 setText(noColIdx, QString::null);
175 setText(modColIdx, QString::null); 159 setText(modColIdx, QString::null);
176 setText(yesColIdx, QString::null); 160 setText(yesColIdx, QString::null);
@@ -216,9 +200,6 @@ void ConfigItem::updateMenu(void)
216 200
217 data = sym_get_string_value(sym); 201 data = sym_get_string_value(sym);
218 202
219 int i = list->mapIdx(dataColIdx);
220 if (i >= 0)
221 setRenameEnabled(i, TRUE);
222 setText(dataColIdx, data); 203 setText(dataColIdx, data);
223 if (type == S_STRING) 204 if (type == S_STRING)
224 prompt = QString("%1: %2").arg(prompt).arg(data); 205 prompt = QString("%1: %2").arg(prompt).arg(data);
@@ -250,18 +231,6 @@ void ConfigItem::testUpdateMenu(bool v)
250 updateMenu(); 231 updateMenu();
251} 232}
252 233
253void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align)
254{
255 ConfigList* list = listView();
256
257 if (visible) {
258 if (isSelected() && !list->hasFocus() && list->mode == menuMode)
259 Parent::paintCell(p, list->inactivedColorGroup, column, width, align);
260 else
261 Parent::paintCell(p, cg, column, width, align);
262 } else
263 Parent::paintCell(p, list->disabledColorGroup, column, width, align);
264}
265 234
266/* 235/*
267 * construct a menu entry 236 * construct a menu entry
@@ -274,7 +243,7 @@ void ConfigItem::init(void)
274 menu->data = this; 243 menu->data = this;
275 244
276 if (list->mode != fullMode) 245 if (list->mode != fullMode)
277 setOpen(TRUE); 246 setExpanded(true);
278 sym_calc_value(menu->sym); 247 sym_calc_value(menu->sym);
279 } 248 }
280 updateMenu(); 249 updateMenu();
@@ -299,7 +268,7 @@ ConfigItem::~ConfigItem(void)
299ConfigLineEdit::ConfigLineEdit(ConfigView* parent) 268ConfigLineEdit::ConfigLineEdit(ConfigView* parent)
300 : Parent(parent) 269 : Parent(parent)
301{ 270{
302 connect(this, SIGNAL(lostFocus()), SLOT(hide())); 271 connect(this, SIGNAL(editingFinished()), SLOT(hide()));
303} 272}
304 273
305void ConfigLineEdit::show(ConfigItem* i) 274void ConfigLineEdit::show(ConfigItem* i)
@@ -320,7 +289,7 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
320 break; 289 break;
321 case Qt::Key_Return: 290 case Qt::Key_Return:
322 case Qt::Key_Enter: 291 case Qt::Key_Enter:
323 sym_set_string_value(item->menu->sym, text().latin1()); 292 sym_set_string_value(item->menu->sym, text().toLatin1());
324 parent()->updateList(item); 293 parent()->updateList(item);
325 break; 294 break;
326 default: 295 default:
@@ -333,39 +302,39 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
333} 302}
334 303
335ConfigList::ConfigList(ConfigView* p, const char *name) 304ConfigList::ConfigList(ConfigView* p, const char *name)
336 : Parent(p, name), 305 : Parent(p),
337 updateAll(false), 306 updateAll(false),
338 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), 307 symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no),
339 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), 308 choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no),
340 menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), 309 menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void),
341 showName(false), showRange(false), showData(false), optMode(normalOpt), 310 showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt),
342 rootEntry(0), headerPopup(0) 311 rootEntry(0), headerPopup(0)
343{ 312{
344 int i; 313 int i;
345 314
346 setSorting(-1); 315 setObjectName(name);
347 setRootIsDecorated(TRUE); 316 setSortingEnabled(false);
348 disabledColorGroup = palette().active(); 317 setRootIsDecorated(true);
349 disabledColorGroup.setColor(QColorGroup::Text, palette().disabled().text()); 318
350 inactivedColorGroup = palette().active(); 319 setVerticalScrollMode(ScrollPerPixel);
351 inactivedColorGroup.setColor(QColorGroup::Highlight, palette().disabled().highlight()); 320 setHorizontalScrollMode(ScrollPerPixel);
321
322 setHeaderLabels(QStringList() << _("Option") << _("Name") << "N" << "M" << "Y" << _("Value"));
352 323
353 connect(this, SIGNAL(selectionChanged(void)), 324 connect(this, SIGNAL(itemSelectionChanged(void)),
354 SLOT(updateSelection(void))); 325 SLOT(updateSelection(void)));
355 326
356 if (name) { 327 if (name) {
357 configSettings->beginGroup(name); 328 configSettings->beginGroup(name);
358 showName = configSettings->readBoolEntry("/showName", false); 329 showName = configSettings->value("/showName", false).toBool();
359 showRange = configSettings->readBoolEntry("/showRange", false); 330 showRange = configSettings->value("/showRange", false).toBool();
360 showData = configSettings->readBoolEntry("/showData", false); 331 showData = configSettings->value("/showData", false).toBool();
361 optMode = (enum optionMode)configSettings->readNumEntry("/optionMode", false); 332 optMode = (enum optionMode)configSettings->value("/optionMode", 0).toInt();
362 configSettings->endGroup(); 333 configSettings->endGroup();
363 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); 334 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
364 } 335 }
365 336
366 for (i = 0; i < colNr; i++) 337 addColumn(promptColIdx);
367 colMap[i] = colRevMap[i] = -1;
368 addColumn(promptColIdx, _("Option"));
369 338
370 reinit(); 339 reinit();
371} 340}
@@ -390,26 +359,26 @@ void ConfigList::reinit(void)
390 removeColumn(nameColIdx); 359 removeColumn(nameColIdx);
391 360
392 if (showName) 361 if (showName)
393 addColumn(nameColIdx, _("Name")); 362 addColumn(nameColIdx);
394 if (showRange) { 363 if (showRange) {
395 addColumn(noColIdx, "N"); 364 addColumn(noColIdx);
396 addColumn(modColIdx, "M"); 365 addColumn(modColIdx);
397 addColumn(yesColIdx, "Y"); 366 addColumn(yesColIdx);
398 } 367 }
399 if (showData) 368 if (showData)
400 addColumn(dataColIdx, _("Value")); 369 addColumn(dataColIdx);
401 370
402 updateListAll(); 371 updateListAll();
403} 372}
404 373
405void ConfigList::saveSettings(void) 374void ConfigList::saveSettings(void)
406{ 375{
407 if (name()) { 376 if (!objectName().isEmpty()) {
408 configSettings->beginGroup(name()); 377 configSettings->beginGroup(objectName());
409 configSettings->writeEntry("/showName", showName); 378 configSettings->setValue("/showName", showName);
410 configSettings->writeEntry("/showRange", showRange); 379 configSettings->setValue("/showRange", showRange);
411 configSettings->writeEntry("/showData", showData); 380 configSettings->setValue("/showData", showData);
412 configSettings->writeEntry("/optionMode", (int)optMode); 381 configSettings->setValue("/optionMode", (int)optMode);
413 configSettings->endGroup(); 382 configSettings->endGroup();
414 } 383 }
415} 384}
@@ -431,7 +400,10 @@ void ConfigList::updateSelection(void)
431 struct menu *menu; 400 struct menu *menu;
432 enum prop_type type; 401 enum prop_type type;
433 402
434 ConfigItem* item = (ConfigItem*)selectedItem(); 403 if (selectedItems().count() == 0)
404 return;
405
406 ConfigItem* item = (ConfigItem*)selectedItems().first();
435 if (!item) 407 if (!item)
436 return; 408 return;
437 409
@@ -451,21 +423,23 @@ void ConfigList::updateList(ConfigItem* item)
451 if (!rootEntry) { 423 if (!rootEntry) {
452 if (mode != listMode) 424 if (mode != listMode)
453 goto update; 425 goto update;
454 Q3ListViewItemIterator it(this); 426 QTreeWidgetItemIterator it(this);
455 ConfigItem* item; 427 ConfigItem* item;
456 428
457 for (; it.current(); ++it) { 429 while (*it) {
458 item = (ConfigItem*)it.current(); 430 item = (ConfigItem*)(*it);
459 if (!item->menu) 431 if (!item->menu)
460 continue; 432 continue;
461 item->testUpdateMenu(menu_is_visible(item->menu)); 433 item->testUpdateMenu(menu_is_visible(item->menu));
434
435 ++it;
462 } 436 }
463 return; 437 return;
464 } 438 }
465 439
466 if (rootEntry != &rootmenu && (mode == singleMode || 440 if (rootEntry != &rootmenu && (mode == singleMode ||
467 (mode == symbolMode && rootEntry->parent != &rootmenu))) { 441 (mode == symbolMode && rootEntry->parent != &rootmenu))) {
468 item = firstChild(); 442 item = (ConfigItem *)topLevelItem(0);
469 if (!item) 443 if (!item)
470 item = new ConfigItem(this, 0, true); 444 item = new ConfigItem(this, 0, true);
471 last = item; 445 last = item;
@@ -479,12 +453,14 @@ void ConfigList::updateList(ConfigItem* item)
479 item->testUpdateMenu(true); 453 item->testUpdateMenu(true);
480 454
481 updateMenuList(item, rootEntry); 455 updateMenuList(item, rootEntry);
482 triggerUpdate(); 456 update();
457 resizeColumnToContents(0);
483 return; 458 return;
484 } 459 }
485update: 460update:
486 updateMenuList(this, rootEntry); 461 updateMenuList(this, rootEntry);
487 triggerUpdate(); 462 update();
463 resizeColumnToContents(0);
488} 464}
489 465
490void ConfigList::setValue(ConfigItem* item, tristate val) 466void ConfigList::setValue(ConfigItem* item, tristate val)
@@ -506,7 +482,7 @@ void ConfigList::setValue(ConfigItem* item, tristate val)
506 if (!sym_set_tristate_value(sym, val)) 482 if (!sym_set_tristate_value(sym, val))
507 return; 483 return;
508 if (oldval == no && item->menu->list) 484 if (oldval == no && item->menu->list)
509 item->setOpen(TRUE); 485 item->setExpanded(true);
510 parent()->updateList(item); 486 parent()->updateList(item);
511 break; 487 break;
512 } 488 }
@@ -524,7 +500,7 @@ void ConfigList::changeValue(ConfigItem* item)
524 sym = menu->sym; 500 sym = menu->sym;
525 if (!sym) { 501 if (!sym) {
526 if (item->menu->list) 502 if (item->menu->list)
527 item->setOpen(!item->isOpen()); 503 item->setExpanded(!item->isExpanded());
528 return; 504 return;
529 } 505 }
530 506
@@ -536,9 +512,9 @@ void ConfigList::changeValue(ConfigItem* item)
536 newexpr = sym_toggle_tristate_value(sym); 512 newexpr = sym_toggle_tristate_value(sym);
537 if (item->menu->list) { 513 if (item->menu->list) {
538 if (oldexpr == newexpr) 514 if (oldexpr == newexpr)
539 item->setOpen(!item->isOpen()); 515 item->setExpanded(!item->isExpanded());
540 else if (oldexpr == no) 516 else if (oldexpr == no)
541 item->setOpen(TRUE); 517 item->setExpanded(true);
542 } 518 }
543 if (oldexpr != newexpr) 519 if (oldexpr != newexpr)
544 parent()->updateList(item); 520 parent()->updateList(item);
@@ -546,10 +522,7 @@ void ConfigList::changeValue(ConfigItem* item)
546 case S_INT: 522 case S_INT:
547 case S_HEX: 523 case S_HEX:
548 case S_STRING: 524 case S_STRING:
549 if (colMap[dataColIdx] >= 0) 525 parent()->lineEdit->show(item);
550 item->startRename(colMap[dataColIdx]);
551 else
552 parent()->lineEdit->show(item);
553 break; 526 break;
554 } 527 }
555} 528}
@@ -566,8 +539,10 @@ void ConfigList::setRootMenu(struct menu *menu)
566 updateMenuList(this, 0); 539 updateMenuList(this, 0);
567 rootEntry = menu; 540 rootEntry = menu;
568 updateListAll(); 541 updateListAll();
569 setSelected(currentItem(), hasFocus()); 542 if (currentItem()) {
570 ensureItemVisible(currentItem()); 543 currentItem()->setSelected(hasFocus());
544 scrollToItem(currentItem());
545 }
571} 546}
572 547
573void ConfigList::setParentMenu(void) 548void ConfigList::setParentMenu(void)
@@ -580,13 +555,16 @@ void ConfigList::setParentMenu(void)
580 return; 555 return;
581 setRootMenu(menu_get_parent_menu(rootEntry->parent)); 556 setRootMenu(menu_get_parent_menu(rootEntry->parent));
582 557
583 Q3ListViewItemIterator it(this); 558 QTreeWidgetItemIterator it(this);
584 for (; (item = (ConfigItem*)it.current()); it++) { 559 while (*it) {
560 item = (ConfigItem *)(*it);
585 if (item->menu == oldroot) { 561 if (item->menu == oldroot) {
586 setCurrentItem(item); 562 setCurrentItem(item);
587 ensureItemVisible(item); 563 scrollToItem(item);
588 break; 564 break;
589 } 565 }
566
567 ++it;
590 } 568 }
591} 569}
592 570
@@ -597,8 +575,7 @@ void ConfigList::setParentMenu(void)
597 * parent: either the menu list widget or a menu entry widget 575 * parent: either the menu list widget or a menu entry widget
598 * menu: entry to be updated 576 * menu: entry to be updated
599 */ 577 */
600template <class P> 578void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu)
601void ConfigList::updateMenuList(P* parent, struct menu* menu)
602{ 579{
603 struct menu* child; 580 struct menu* child;
604 ConfigItem* item; 581 ConfigItem* item;
@@ -607,8 +584,11 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
607 enum prop_type type; 584 enum prop_type type;
608 585
609 if (!menu) { 586 if (!menu) {
610 while ((item = parent->firstChild())) 587 while (parent->childCount() > 0)
611 delete item; 588 {
589 delete parent->takeChild(0);
590 }
591
612 return; 592 return;
613 } 593 }
614 594
@@ -660,9 +640,74 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
660 } 640 }
661} 641}
662 642
643void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu)
644{
645 struct menu* child;
646 ConfigItem* item;
647 ConfigItem* last;
648 bool visible;
649 enum prop_type type;
650
651 if (!menu) {
652 while (parent->topLevelItemCount() > 0)
653 {
654 delete parent->takeTopLevelItem(0);
655 }
656
657 return;
658 }
659
660 last = (ConfigItem*)parent->topLevelItem(0);
661 if (last && !last->goParent)
662 last = 0;
663 for (child = menu->list; child; child = child->next) {
664 item = last ? last->nextSibling() : (ConfigItem*)parent->topLevelItem(0);
665 type = child->prompt ? child->prompt->type : P_UNKNOWN;
666
667 switch (mode) {
668 case menuMode:
669 if (!(child->flags & MENU_ROOT))
670 goto hide;
671 break;
672 case symbolMode:
673 if (child->flags & MENU_ROOT)
674 goto hide;
675 break;
676 default:
677 break;
678 }
679
680 visible = menu_is_visible(child);
681 if (!menuSkip(child)) {
682 if (!child->sym && !child->list && !child->prompt)
683 continue;
684 if (!item || item->menu != child)
685 item = new ConfigItem(parent, last, child, visible);
686 else
687 item->testUpdateMenu(visible);
688
689 if (mode == fullMode || mode == menuMode || type != P_MENU)
690 updateMenuList(item, child);
691 else
692 updateMenuList(item, 0);
693 last = item;
694 continue;
695 }
696 hide:
697 if (item && item->menu == child) {
698 last = (ConfigItem*)parent->topLevelItem(0);
699 if (last == item)
700 last = 0;
701 else while (last->nextSibling() != item)
702 last = last->nextSibling();
703 delete item;
704 }
705 }
706}
707
663void ConfigList::keyPressEvent(QKeyEvent* ev) 708void ConfigList::keyPressEvent(QKeyEvent* ev)
664{ 709{
665 Q3ListViewItem* i = currentItem(); 710 QTreeWidgetItem* i = currentItem();
666 ConfigItem* item; 711 ConfigItem* item;
667 struct menu *menu; 712 struct menu *menu;
668 enum prop_type type; 713 enum prop_type type;
@@ -714,20 +759,20 @@ void ConfigList::keyPressEvent(QKeyEvent* ev)
714 ev->accept(); 759 ev->accept();
715} 760}
716 761
717void ConfigList::contentsMousePressEvent(QMouseEvent* e) 762void ConfigList::mousePressEvent(QMouseEvent* e)
718{ 763{
719 //QPoint p(contentsToViewport(e->pos())); 764 //QPoint p(contentsToViewport(e->pos()));
720 //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y()); 765 //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y());
721 Parent::contentsMousePressEvent(e); 766 Parent::mousePressEvent(e);
722} 767}
723 768
724void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e) 769void ConfigList::mouseReleaseEvent(QMouseEvent* e)
725{ 770{
726 QPoint p(contentsToViewport(e->pos())); 771 QPoint p = e->pos();
727 ConfigItem* item = (ConfigItem*)itemAt(p); 772 ConfigItem* item = (ConfigItem*)itemAt(p);
728 struct menu *menu; 773 struct menu *menu;
729 enum prop_type ptype; 774 enum prop_type ptype;
730 const QPixmap* pm; 775 QIcon icon;
731 int idx, x; 776 int idx, x;
732 777
733 if (!item) 778 if (!item)
@@ -735,14 +780,13 @@ void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e)
735 780
736 menu = item->menu; 781 menu = item->menu;
737 x = header()->offset() + p.x(); 782 x = header()->offset() + p.x();
738 idx = colRevMap[header()->sectionAt(x)]; 783 idx = header()->logicalIndexAt(x);
739 switch (idx) { 784 switch (idx) {
740 case promptColIdx: 785 case promptColIdx:
741 pm = item->pixmap(promptColIdx); 786 icon = item->pixmap(promptColIdx);
742 if (pm) { 787 if (!icon.isNull()) {
743 int off = header()->sectionPos(0) + itemMargin() + 788 int off = header()->sectionPosition(0) + visualRect(indexAt(p)).x() + 4; // 4 is Hardcoded image offset. There might be a way to do it properly.
744 treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0)); 789 if (x >= off && x < off + icon.availableSizes().first().width()) {
745 if (x >= off && x < off + pm->width()) {
746 if (item->goParent) { 790 if (item->goParent) {
747 emit parentSelected(); 791 emit parentSelected();
748 break; 792 break;
@@ -773,19 +817,19 @@ void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e)
773 817
774skip: 818skip:
775 //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y()); 819 //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y());
776 Parent::contentsMouseReleaseEvent(e); 820 Parent::mouseReleaseEvent(e);
777} 821}
778 822
779void ConfigList::contentsMouseMoveEvent(QMouseEvent* e) 823void ConfigList::mouseMoveEvent(QMouseEvent* e)
780{ 824{
781 //QPoint p(contentsToViewport(e->pos())); 825 //QPoint p(contentsToViewport(e->pos()));
782 //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y()); 826 //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y());
783 Parent::contentsMouseMoveEvent(e); 827 Parent::mouseMoveEvent(e);
784} 828}
785 829
786void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e) 830void ConfigList::mouseDoubleClickEvent(QMouseEvent* e)
787{ 831{
788 QPoint p(contentsToViewport(e->pos())); 832 QPoint p = e->pos(); // TODO: Check if this works(was contentsToViewport).
789 ConfigItem* item = (ConfigItem*)itemAt(p); 833 ConfigItem* item = (ConfigItem*)itemAt(p);
790 struct menu *menu; 834 struct menu *menu;
791 enum prop_type ptype; 835 enum prop_type ptype;
@@ -807,7 +851,7 @@ void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e)
807 851
808skip: 852skip:
809 //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y()); 853 //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y());
810 Parent::contentsMouseDoubleClickEvent(e); 854 Parent::mouseDoubleClickEvent(e);
811} 855}
812 856
813void ConfigList::focusInEvent(QFocusEvent *e) 857void ConfigList::focusInEvent(QFocusEvent *e)
@@ -818,7 +862,7 @@ void ConfigList::focusInEvent(QFocusEvent *e)
818 862
819 ConfigItem* item = (ConfigItem *)currentItem(); 863 ConfigItem* item = (ConfigItem *)currentItem();
820 if (item) { 864 if (item) {
821 setSelected(item, TRUE); 865 item->setSelected(true);
822 menu = item->menu; 866 menu = item->menu;
823 } 867 }
824 emit gotFocus(menu); 868 emit gotFocus(menu);
@@ -828,33 +872,33 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
828{ 872{
829 if (e->y() <= header()->geometry().bottom()) { 873 if (e->y() <= header()->geometry().bottom()) {
830 if (!headerPopup) { 874 if (!headerPopup) {
831 Q3Action *action; 875 QAction *action;
832 876
833 headerPopup = new Q3PopupMenu(this); 877 headerPopup = new QMenu(this);
834 action = new Q3Action(NULL, _("Show Name"), 0, this); 878 action = new QAction(_("Show Name"), this);
835 action->setToggleAction(TRUE); 879 action->setCheckable(true);
836 connect(action, SIGNAL(toggled(bool)), 880 connect(action, SIGNAL(toggled(bool)),
837 parent(), SLOT(setShowName(bool))); 881 parent(), SLOT(setShowName(bool)));
838 connect(parent(), SIGNAL(showNameChanged(bool)), 882 connect(parent(), SIGNAL(showNameChanged(bool)),
839 action, SLOT(setOn(bool))); 883 action, SLOT(setOn(bool)));
840 action->setOn(showName); 884 action->setChecked(showName);
841 action->addTo(headerPopup); 885 headerPopup->addAction(action);
842 action = new Q3Action(NULL, _("Show Range"), 0, this); 886 action = new QAction(_("Show Range"), this);
843 action->setToggleAction(TRUE); 887 action->setCheckable(true);
844 connect(action, SIGNAL(toggled(bool)), 888 connect(action, SIGNAL(toggled(bool)),
845 parent(), SLOT(setShowRange(bool))); 889 parent(), SLOT(setShowRange(bool)));
846 connect(parent(), SIGNAL(showRangeChanged(bool)), 890 connect(parent(), SIGNAL(showRangeChanged(bool)),
847 action, SLOT(setOn(bool))); 891 action, SLOT(setOn(bool)));
848 action->setOn(showRange); 892 action->setChecked(showRange);
849 action->addTo(headerPopup); 893 headerPopup->addAction(action);
850 action = new Q3Action(NULL, _("Show Data"), 0, this); 894 action = new QAction(_("Show Data"), this);
851 action->setToggleAction(TRUE); 895 action->setCheckable(true);
852 connect(action, SIGNAL(toggled(bool)), 896 connect(action, SIGNAL(toggled(bool)),
853 parent(), SLOT(setShowData(bool))); 897 parent(), SLOT(setShowData(bool)));
854 connect(parent(), SIGNAL(showDataChanged(bool)), 898 connect(parent(), SIGNAL(showDataChanged(bool)),
855 action, SLOT(setOn(bool))); 899 action, SLOT(setOn(bool)));
856 action->setOn(showData); 900 action->setChecked(showData);
857 action->addTo(headerPopup); 901 headerPopup->addAction(action);
858 } 902 }
859 headerPopup->exec(e->globalPos()); 903 headerPopup->exec(e->globalPos());
860 e->accept(); 904 e->accept();
@@ -868,11 +912,17 @@ QAction *ConfigView::showAllAction;
868QAction *ConfigView::showPromptAction; 912QAction *ConfigView::showPromptAction;
869 913
870ConfigView::ConfigView(QWidget* parent, const char *name) 914ConfigView::ConfigView(QWidget* parent, const char *name)
871 : Parent(parent, name) 915 : Parent(parent)
872{ 916{
873 list = new ConfigList(this, name); 917 setObjectName(name);
918 QVBoxLayout *verticalLayout = new QVBoxLayout(this);
919 verticalLayout->setContentsMargins(0, 0, 0, 0);
920
921 list = new ConfigList(this);
922 verticalLayout->addWidget(list);
874 lineEdit = new ConfigLineEdit(this); 923 lineEdit = new ConfigLineEdit(this);
875 lineEdit->hide(); 924 lineEdit->hide();
925 verticalLayout->addWidget(lineEdit);
876 926
877 this->nextView = viewList; 927 this->nextView = viewList;
878 viewList = this; 928 viewList = this;
@@ -931,10 +981,13 @@ void ConfigView::setShowData(bool b)
931 981
932void ConfigList::setAllOpen(bool open) 982void ConfigList::setAllOpen(bool open)
933{ 983{
934 Q3ListViewItemIterator it(this); 984 QTreeWidgetItemIterator it(this);
985
986 while (*it) {
987 (*it)->setExpanded(open);
935 988
936 for (; it.current(); it++) 989 ++it;
937 it.current()->setOpen(open); 990 }
938} 991}
939 992
940void ConfigView::updateList(ConfigItem* item) 993void ConfigView::updateList(ConfigItem* item)
@@ -954,11 +1007,14 @@ void ConfigView::updateListAll(void)
954} 1007}
955 1008
956ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) 1009ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
957 : Parent(parent, name), sym(0), _menu(0) 1010 : Parent(parent), sym(0), _menu(0)
958{ 1011{
959 if (name) { 1012 setObjectName(name);
960 configSettings->beginGroup(name); 1013
961 _showDebug = configSettings->readBoolEntry("/showDebug", false); 1014
1015 if (!objectName().isEmpty()) {
1016 configSettings->beginGroup(objectName());
1017 _showDebug = configSettings->value("/showDebug", false).toBool();
962 configSettings->endGroup(); 1018 configSettings->endGroup();
963 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); 1019 connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
964 } 1020 }
@@ -966,9 +1022,9 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
966 1022
967void ConfigInfoView::saveSettings(void) 1023void ConfigInfoView::saveSettings(void)
968{ 1024{
969 if (name()) { 1025 if (!objectName().isEmpty()) {
970 configSettings->beginGroup(name()); 1026 configSettings->beginGroup(objectName());
971 configSettings->writeEntry("/showDebug", showDebug()); 1027 configSettings->setValue("/showDebug", showDebug());
972 configSettings->endGroup(); 1028 configSettings->endGroup();
973 } 1029 }
974} 1030}
@@ -1127,8 +1183,8 @@ QString ConfigInfoView::print_filter(const QString &str)
1127{ 1183{
1128 QRegExp re("[<>&\"\\n]"); 1184 QRegExp re("[<>&\"\\n]");
1129 QString res = str; 1185 QString res = str;
1130 for (int i = 0; (i = res.find(re, i)) >= 0;) { 1186 for (int i = 0; (i = res.indexOf(re, i)) >= 0;) {
1131 switch (res[i].latin1()) { 1187 switch (res[i].toLatin1()) {
1132 case '<': 1188 case '<':
1133 res.replace(i, 1, "&lt;"); 1189 res.replace(i, 1, "&lt;");
1134 i += 4; 1190 i += 4;
@@ -1167,37 +1223,42 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
1167 *text += str2; 1223 *text += str2;
1168} 1224}
1169 1225
1170Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) 1226QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos)
1171{ 1227{
1172 Q3PopupMenu* popup = Parent::createPopupMenu(pos); 1228 QMenu* popup = Parent::createStandardContextMenu(pos);
1173 Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup); 1229 QAction* action = new QAction(_("Show Debug Info"), popup);
1174 action->setToggleAction(TRUE); 1230 action->setCheckable(true);
1175 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); 1231 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
1176 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); 1232 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
1177 action->setOn(showDebug()); 1233 action->setChecked(showDebug());
1178 popup->insertSeparator(); 1234 popup->addSeparator();
1179 action->addTo(popup); 1235 popup->addAction(action);
1180 return popup; 1236 return popup;
1181} 1237}
1182 1238
1183void ConfigInfoView::contentsContextMenuEvent(QContextMenuEvent *e) 1239void ConfigInfoView::contextMenuEvent(QContextMenuEvent *e)
1184{ 1240{
1185 Parent::contentsContextMenuEvent(e); 1241 Parent::contextMenuEvent(e);
1186} 1242}
1187 1243
1188ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name) 1244ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name)
1189 : Parent(parent, name), result(NULL) 1245 : Parent(parent), result(NULL)
1190{ 1246{
1191 setCaption("Search Config"); 1247 setObjectName(name);
1248 setWindowTitle("Search Config");
1192 1249
1193 QVBoxLayout* layout1 = new QVBoxLayout(this, 11, 6); 1250 QVBoxLayout* layout1 = new QVBoxLayout(this);
1194 QHBoxLayout* layout2 = new QHBoxLayout(0, 0, 6); 1251 layout1->setContentsMargins(11, 11, 11, 11);
1252 layout1->setSpacing(6);
1253 QHBoxLayout* layout2 = new QHBoxLayout(0);
1254 layout2->setContentsMargins(0, 0, 0, 0);
1255 layout2->setSpacing(6);
1195 layout2->addWidget(new QLabel(_("Find:"), this)); 1256 layout2->addWidget(new QLabel(_("Find:"), this));
1196 editField = new QLineEdit(this); 1257 editField = new QLineEdit(this);
1197 connect(editField, SIGNAL(returnPressed()), SLOT(search())); 1258 connect(editField, SIGNAL(returnPressed()), SLOT(search()));
1198 layout2->addWidget(editField); 1259 layout2->addWidget(editField);
1199 searchButton = new QPushButton(_("Search"), this); 1260 searchButton = new QPushButton(_("Search"), this);
1200 searchButton->setAutoDefault(FALSE); 1261 searchButton->setAutoDefault(false);
1201 connect(searchButton, SIGNAL(clicked()), SLOT(search())); 1262 connect(searchButton, SIGNAL(clicked()), SLOT(search()));
1202 layout2->addWidget(searchButton); 1263 layout2->addWidget(searchButton);
1203 layout1->addLayout(layout2); 1264 layout1->addLayout(layout2);
@@ -1215,19 +1276,19 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
1215 layout1->addWidget(split); 1276 layout1->addWidget(split);
1216 1277
1217 if (name) { 1278 if (name) {
1218 int x, y, width, height; 1279 QVariant x, y;
1280 int width, height;
1219 bool ok; 1281 bool ok;
1220 1282
1221 configSettings->beginGroup(name); 1283 configSettings->beginGroup(name);
1222 width = configSettings->readNumEntry("/window width", parent->width() / 2); 1284 width = configSettings->value("/window width", parent->width() / 2).toInt();
1223 height = configSettings->readNumEntry("/window height", parent->height() / 2); 1285 height = configSettings->value("/window height", parent->height() / 2).toInt();
1224 resize(width, height); 1286 resize(width, height);
1225 x = configSettings->readNumEntry("/window x", 0, &ok); 1287 x = configSettings->value("/window x");
1226 if (ok) 1288 y = configSettings->value("/window y");
1227 y = configSettings->readNumEntry("/window y", 0, &ok); 1289 if ((x.isValid())&&(y.isValid()))
1228 if (ok) 1290 move(x.toInt(), y.toInt());
1229 move(x, y); 1291 QList<int> sizes = configSettings->readSizes("/split", &ok);
1230 Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
1231 if (ok) 1292 if (ok)
1232 split->setSizes(sizes); 1293 split->setSizes(sizes);
1233 configSettings->endGroup(); 1294 configSettings->endGroup();
@@ -1237,12 +1298,12 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
1237 1298
1238void ConfigSearchWindow::saveSettings(void) 1299void ConfigSearchWindow::saveSettings(void)
1239{ 1300{
1240 if (name()) { 1301 if (!objectName().isEmpty()) {
1241 configSettings->beginGroup(name()); 1302 configSettings->beginGroup(objectName());
1242 configSettings->writeEntry("/window x", pos().x()); 1303 configSettings->setValue("/window x", pos().x());
1243 configSettings->writeEntry("/window y", pos().y()); 1304 configSettings->setValue("/window y", pos().y());
1244 configSettings->writeEntry("/window width", size().width()); 1305 configSettings->setValue("/window width", size().width());
1245 configSettings->writeEntry("/window height", size().height()); 1306 configSettings->setValue("/window height", size().height());
1246 configSettings->writeSizes("/split", split->sizes()); 1307 configSettings->writeSizes("/split", split->sizes());
1247 configSettings->endGroup(); 1308 configSettings->endGroup();
1248 } 1309 }
@@ -1258,7 +1319,7 @@ void ConfigSearchWindow::search(void)
1258 list->list->clear(); 1319 list->list->clear();
1259 info->clear(); 1320 info->clear();
1260 1321
1261 result = sym_re_search(editField->text().latin1()); 1322 result = sym_re_search(editField->text().toLatin1());
1262 if (!result) 1323 if (!result)
1263 return; 1324 return;
1264 for (p = result; *p; p++) { 1325 for (p = result; *p; p++) {
@@ -1275,29 +1336,25 @@ ConfigMainWindow::ConfigMainWindow(void)
1275 : searchWindow(0) 1336 : searchWindow(0)
1276{ 1337{
1277 QMenuBar* menu; 1338 QMenuBar* menu;
1278 bool ok; 1339 bool ok = true;
1279 int x, y, width, height; 1340 QVariant x, y;
1341 int width, height;
1280 char title[256]; 1342 char title[256];
1281 1343
1282 QDesktopWidget *d = configApp->desktop(); 1344 QDesktopWidget *d = configApp->desktop();
1283 snprintf(title, sizeof(title), "%s%s", 1345 snprintf(title, sizeof(title), "%s%s",
1284 rootmenu.prompt->text, 1346 rootmenu.prompt->text,
1285#if QT_VERSION < 0x040000
1286 " (Qt3)"
1287#else
1288 "" 1347 ""
1289#endif
1290 ); 1348 );
1291 setCaption(title); 1349 setWindowTitle(title);
1292 1350
1293 width = configSettings->readNumEntry("/window width", d->width() - 64); 1351 width = configSettings->value("/window width", d->width() - 64).toInt();
1294 height = configSettings->readNumEntry("/window height", d->height() - 64); 1352 height = configSettings->value("/window height", d->height() - 64).toInt();
1295 resize(width, height); 1353 resize(width, height);
1296 x = configSettings->readNumEntry("/window x", 0, &ok); 1354 x = configSettings->value("/window x");
1297 if (ok) 1355 y = configSettings->value("/window y");
1298 y = configSettings->readNumEntry("/window y", 0, &ok); 1356 if ((x.isValid())&&(y.isValid()))
1299 if (ok) 1357 move(x.toInt(), y.toInt());
1300 move(x, y);
1301 1358
1302 split1 = new QSplitter(this); 1359 split1 = new QSplitter(this);
1303 split1->setOrientation(Qt::Horizontal); 1360 split1->setOrientation(Qt::Horizontal);
@@ -1314,127 +1371,115 @@ ConfigMainWindow::ConfigMainWindow(void)
1314 configList = configView->list; 1371 configList = configView->list;
1315 1372
1316 helpText = new ConfigInfoView(split2, "help"); 1373 helpText = new ConfigInfoView(split2, "help");
1317 helpText->setTextFormat(Qt::RichText);
1318 1374
1319 setTabOrder(configList, helpText); 1375 setTabOrder(configList, helpText);
1320 configList->setFocus(); 1376 configList->setFocus();
1321 1377
1322 menu = menuBar(); 1378 menu = menuBar();
1323 toolBar = new Q3ToolBar("Tools", this); 1379 toolBar = new QToolBar("Tools", this);
1324 1380 addToolBar(toolBar);
1325 backAction = new Q3Action("Back", QPixmap(xpm_back), _("Back"), 0, this); 1381
1326 connect(backAction, SIGNAL(activated()), SLOT(goBack())); 1382 backAction = new QAction(QPixmap(xpm_back), _("Back"), this);
1327 backAction->setEnabled(FALSE); 1383 connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack()));
1328 Q3Action *quitAction = new Q3Action("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this); 1384 backAction->setEnabled(false);
1329 connect(quitAction, SIGNAL(activated()), SLOT(close())); 1385 QAction *quitAction = new QAction(_("&Quit"), this);
1330 Q3Action *loadAction = new Q3Action("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this); 1386 quitAction->setShortcut(Qt::CTRL + Qt::Key_Q);
1331 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); 1387 connect(quitAction, SIGNAL(triggered(bool)), SLOT(close()));
1332 saveAction = new Q3Action("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this); 1388 QAction *loadAction = new QAction(QPixmap(xpm_load), _("&Load"), this);
1333 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); 1389 loadAction->setShortcut(Qt::CTRL + Qt::Key_L);
1390 connect(loadAction, SIGNAL(triggered(bool)), SLOT(loadConfig()));
1391 saveAction = new QAction(QPixmap(xpm_save), _("&Save"), this);
1392 saveAction->setShortcut(Qt::CTRL + Qt::Key_S);
1393 connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig()));
1334 conf_set_changed_callback(conf_changed); 1394 conf_set_changed_callback(conf_changed);
1335 // Set saveAction's initial state 1395 // Set saveAction's initial state
1336 conf_changed(); 1396 conf_changed();
1337 Q3Action *saveAsAction = new Q3Action("Save As...", _("Save &As..."), 0, this); 1397 QAction *saveAsAction = new QAction(_("Save &As..."), this);
1338 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); 1398 connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs()));
1339 Q3Action *searchAction = new Q3Action("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this); 1399 QAction *searchAction = new QAction(_("&Find"), this);
1340 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); 1400 searchAction->setShortcut(Qt::CTRL + Qt::Key_F);
1341 Q3Action *singleViewAction = new Q3Action("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); 1401 connect(searchAction, SIGNAL(triggered(bool)), SLOT(searchConfig()));
1342 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); 1402 singleViewAction = new QAction(QPixmap(xpm_single_view), _("Single View"), this);
1343 Q3Action *splitViewAction = new Q3Action("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this); 1403 singleViewAction->setCheckable(true);
1344 connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); 1404 connect(singleViewAction, SIGNAL(triggered(bool)), SLOT(showSingleView()));
1345 Q3Action *fullViewAction = new Q3Action("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this); 1405 splitViewAction = new QAction(QPixmap(xpm_split_view), _("Split View"), this);
1346 connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); 1406 splitViewAction->setCheckable(true);
1347 1407 connect(splitViewAction, SIGNAL(triggered(bool)), SLOT(showSplitView()));
1348 Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this); 1408 fullViewAction = new QAction(QPixmap(xpm_tree_view), _("Full View"), this);
1349 showNameAction->setToggleAction(TRUE); 1409 fullViewAction->setCheckable(true);
1410 connect(fullViewAction, SIGNAL(triggered(bool)), SLOT(showFullView()));
1411
1412 QAction *showNameAction = new QAction(_("Show Name"), this);
1413 showNameAction->setCheckable(true);
1350 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); 1414 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
1351 connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); 1415 showNameAction->setChecked(configView->showName());
1352 showNameAction->setOn(configView->showName()); 1416 QAction *showRangeAction = new QAction(_("Show Range"), this);
1353 Q3Action *showRangeAction = new Q3Action(NULL, _("Show Range"), 0, this); 1417 showRangeAction->setCheckable(true);
1354 showRangeAction->setToggleAction(TRUE);
1355 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); 1418 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
1356 connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); 1419 QAction *showDataAction = new QAction(_("Show Data"), this);
1357 showRangeAction->setOn(configList->showRange); 1420 showDataAction->setCheckable(true);
1358 Q3Action *showDataAction = new Q3Action(NULL, _("Show Data"), 0, this);
1359 showDataAction->setToggleAction(TRUE);
1360 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); 1421 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
1361 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
1362 showDataAction->setOn(configList->showData);
1363 1422
1364 QActionGroup *optGroup = new QActionGroup(this); 1423 QActionGroup *optGroup = new QActionGroup(this);
1365 optGroup->setExclusive(TRUE); 1424 optGroup->setExclusive(true);
1366 connect(optGroup, SIGNAL(selected(QAction *)), configView, 1425 connect(optGroup, SIGNAL(triggered(QAction*)), configView,
1367 SLOT(setOptionMode(QAction *))); 1426 SLOT(setOptionMode(QAction *)));
1368 connect(optGroup, SIGNAL(selected(QAction *)), menuView, 1427 connect(optGroup, SIGNAL(triggered(QAction *)), menuView,
1369 SLOT(setOptionMode(QAction *))); 1428 SLOT(setOptionMode(QAction *)));
1370 1429
1371#if QT_VERSION >= 0x040000
1372 configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup); 1430 configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup);
1373 configView->showAllAction = new QAction(_("Show All Options"), optGroup); 1431 configView->showAllAction = new QAction(_("Show All Options"), optGroup);
1374 configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup); 1432 configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup);
1375#else 1433 configView->showNormalAction->setCheckable(true);
1376 configView->showNormalAction = new QAction(_("Show Normal Options"), 0, optGroup); 1434 configView->showAllAction->setCheckable(true);
1377 configView->showAllAction = new QAction(_("Show All Options"), 0, optGroup); 1435 configView->showPromptAction->setCheckable(true);
1378 configView->showPromptAction = new QAction(_("Show Prompt Options"), 0, optGroup); 1436
1379#endif 1437 QAction *showDebugAction = new QAction( _("Show Debug Info"), this);
1380 configView->showNormalAction->setToggleAction(TRUE); 1438 showDebugAction->setCheckable(true);
1381 configView->showNormalAction->setOn(configList->optMode == normalOpt);
1382 configView->showAllAction->setToggleAction(TRUE);
1383 configView->showAllAction->setOn(configList->optMode == allOpt);
1384 configView->showPromptAction->setToggleAction(TRUE);
1385 configView->showPromptAction->setOn(configList->optMode == promptOpt);
1386
1387 Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this);
1388 showDebugAction->setToggleAction(TRUE);
1389 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); 1439 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
1390 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); 1440 showDebugAction->setChecked(helpText->showDebug());
1391 showDebugAction->setOn(helpText->showDebug());
1392 1441
1393 Q3Action *showIntroAction = new Q3Action(NULL, _("Introduction"), 0, this); 1442 QAction *showIntroAction = new QAction( _("Introduction"), this);
1394 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); 1443 connect(showIntroAction, SIGNAL(triggered(bool)), SLOT(showIntro()));
1395 Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this); 1444 QAction *showAboutAction = new QAction( _("About"), this);
1396 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); 1445 connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout()));
1397 1446
1398 // init tool bar 1447 // init tool bar
1399 backAction->addTo(toolBar); 1448 toolBar->addAction(backAction);
1400 toolBar->addSeparator(); 1449 toolBar->addSeparator();
1401 loadAction->addTo(toolBar); 1450 toolBar->addAction(loadAction);
1402 saveAction->addTo(toolBar); 1451 toolBar->addAction(saveAction);
1403 toolBar->addSeparator(); 1452 toolBar->addSeparator();
1404 singleViewAction->addTo(toolBar); 1453 toolBar->addAction(singleViewAction);
1405 splitViewAction->addTo(toolBar); 1454 toolBar->addAction(splitViewAction);
1406 fullViewAction->addTo(toolBar); 1455 toolBar->addAction(fullViewAction);
1407 1456
1408 // create config menu 1457 // create config menu
1409 Q3PopupMenu* config = new Q3PopupMenu(this); 1458 QMenu* config = menu->addMenu(_("&File"));
1410 menu->insertItem(_("&File"), config); 1459 config->addAction(loadAction);
1411 loadAction->addTo(config); 1460 config->addAction(saveAction);
1412 saveAction->addTo(config); 1461 config->addAction(saveAsAction);
1413 saveAsAction->addTo(config); 1462 config->addSeparator();
1414 config->insertSeparator(); 1463 config->addAction(quitAction);
1415 quitAction->addTo(config);
1416 1464
1417 // create edit menu 1465 // create edit menu
1418 Q3PopupMenu* editMenu = new Q3PopupMenu(this); 1466 QMenu* editMenu = menu->addMenu(_("&Edit"));
1419 menu->insertItem(_("&Edit"), editMenu); 1467 editMenu->addAction(searchAction);
1420 searchAction->addTo(editMenu);
1421 1468
1422 // create options menu 1469 // create options menu
1423 Q3PopupMenu* optionMenu = new Q3PopupMenu(this); 1470 QMenu* optionMenu = menu->addMenu(_("&Option"));
1424 menu->insertItem(_("&Option"), optionMenu); 1471 optionMenu->addAction(showNameAction);
1425 showNameAction->addTo(optionMenu); 1472 optionMenu->addAction(showRangeAction);
1426 showRangeAction->addTo(optionMenu); 1473 optionMenu->addAction(showDataAction);
1427 showDataAction->addTo(optionMenu); 1474 optionMenu->addSeparator();
1428 optionMenu->insertSeparator(); 1475 optionMenu->addActions(optGroup->actions());
1429 optGroup->addTo(optionMenu); 1476 optionMenu->addSeparator();
1430 optionMenu->insertSeparator();
1431 1477
1432 // create help menu 1478 // create help menu
1433 Q3PopupMenu* helpMenu = new Q3PopupMenu(this); 1479 menu->addSeparator();
1434 menu->insertSeparator(); 1480 QMenu* helpMenu = menu->addMenu(_("&Help"));
1435 menu->insertItem(_("&Help"), helpMenu); 1481 helpMenu->addAction(showIntroAction);
1436 showIntroAction->addTo(helpMenu); 1482 helpMenu->addAction(showAboutAction);
1437 showAboutAction->addTo(helpMenu);
1438 1483
1439 connect(configList, SIGNAL(menuChanged(struct menu *)), 1484 connect(configList, SIGNAL(menuChanged(struct menu *)),
1440 helpText, SLOT(setInfo(struct menu *))); 1485 helpText, SLOT(setInfo(struct menu *)));
@@ -1456,7 +1501,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1456 connect(helpText, SIGNAL(menuSelected(struct menu *)), 1501 connect(helpText, SIGNAL(menuSelected(struct menu *)),
1457 SLOT(setMenuLink(struct menu *))); 1502 SLOT(setMenuLink(struct menu *)));
1458 1503
1459 QString listMode = configSettings->readEntry("/listMode", "symbol"); 1504 QString listMode = configSettings->value("/listMode", "symbol").toString();
1460 if (listMode == "single") 1505 if (listMode == "single")
1461 showSingleView(); 1506 showSingleView();
1462 else if (listMode == "full") 1507 else if (listMode == "full")
@@ -1465,7 +1510,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1465 showSplitView(); 1510 showSplitView();
1466 1511
1467 // UI setup done, restore splitter positions 1512 // UI setup done, restore splitter positions
1468 Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok); 1513 QList<int> sizes = configSettings->readSizes("/split1", &ok);
1469 if (ok) 1514 if (ok)
1470 split1->setSizes(sizes); 1515 split1->setSizes(sizes);
1471 1516
@@ -1476,7 +1521,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1476 1521
1477void ConfigMainWindow::loadConfig(void) 1522void ConfigMainWindow::loadConfig(void)
1478{ 1523{
1479 QString s = Q3FileDialog::getOpenFileName(conf_get_configname(), NULL, this); 1524 QString s = QFileDialog::getOpenFileName(this, "", conf_get_configname());
1480 if (s.isNull()) 1525 if (s.isNull())
1481 return; 1526 return;
1482 if (conf_read(QFile::encodeName(s))) 1527 if (conf_read(QFile::encodeName(s)))
@@ -1495,7 +1540,7 @@ bool ConfigMainWindow::saveConfig(void)
1495 1540
1496void ConfigMainWindow::saveConfigAs(void) 1541void ConfigMainWindow::saveConfigAs(void)
1497{ 1542{
1498 QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this); 1543 QString s = QFileDialog::getSaveFileName(this, "", conf_get_configname());
1499 if (s.isNull()) 1544 if (s.isNull())
1500 return; 1545 return;
1501 saveConfig(); 1546 saveConfig();
@@ -1512,9 +1557,9 @@ void ConfigMainWindow::changeMenu(struct menu *menu)
1512{ 1557{
1513 configList->setRootMenu(menu); 1558 configList->setRootMenu(menu);
1514 if (configList->rootEntry->parent == &rootmenu) 1559 if (configList->rootEntry->parent == &rootmenu)
1515 backAction->setEnabled(FALSE); 1560 backAction->setEnabled(false);
1516 else 1561 else
1517 backAction->setEnabled(TRUE); 1562 backAction->setEnabled(true);
1518} 1563}
1519 1564
1520void ConfigMainWindow::setMenuLink(struct menu *menu) 1565void ConfigMainWindow::setMenuLink(struct menu *menu)
@@ -1546,8 +1591,8 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
1546 return; 1591 return;
1547 item = menuList->findConfigItem(parent); 1592 item = menuList->findConfigItem(parent);
1548 if (item) { 1593 if (item) {
1549 menuList->setSelected(item, TRUE); 1594 item->setSelected(true);
1550 menuList->ensureItemVisible(item); 1595 menuList->scrollToItem(item);
1551 } 1596 }
1552 list->setRootMenu(parent); 1597 list->setRootMenu(parent);
1553 } 1598 }
@@ -1562,8 +1607,8 @@ void ConfigMainWindow::setMenuLink(struct menu *menu)
1562 if (list) { 1607 if (list) {
1563 item = list->findConfigItem(menu); 1608 item = list->findConfigItem(menu);
1564 if (item) { 1609 if (item) {
1565 list->setSelected(item, TRUE); 1610 item->setSelected(true);
1566 list->ensureItemVisible(item); 1611 list->scrollToItem(item);
1567 list->setFocus(); 1612 list->setFocus();
1568 } 1613 }
1569 } 1614 }
@@ -1577,15 +1622,21 @@ void ConfigMainWindow::listFocusChanged(void)
1577 1622
1578void ConfigMainWindow::goBack(void) 1623void ConfigMainWindow::goBack(void)
1579{ 1624{
1580 ConfigItem* item; 1625 ConfigItem* item, *oldSelection;
1581 1626
1582 configList->setParentMenu(); 1627 configList->setParentMenu();
1583 if (configList->rootEntry == &rootmenu) 1628 if (configList->rootEntry == &rootmenu)
1584 backAction->setEnabled(FALSE); 1629 backAction->setEnabled(false);
1585 item = (ConfigItem*)menuList->selectedItem(); 1630
1631 if (menuList->selectedItems().count() == 0)
1632 return;
1633
1634 item = (ConfigItem*)menuList->selectedItems().first();
1635 oldSelection = item;
1586 while (item) { 1636 while (item) {
1587 if (item->menu == configList->rootEntry) { 1637 if (item->menu == configList->rootEntry) {
1588 menuList->setSelected(item, TRUE); 1638 oldSelection->setSelected(false);
1639 item->setSelected(true);
1589 break; 1640 break;
1590 } 1641 }
1591 item = (ConfigItem*)item->parent(); 1642 item = (ConfigItem*)item->parent();
@@ -1594,6 +1645,13 @@ void ConfigMainWindow::goBack(void)
1594 1645
1595void ConfigMainWindow::showSingleView(void) 1646void ConfigMainWindow::showSingleView(void)
1596{ 1647{
1648 singleViewAction->setEnabled(false);
1649 singleViewAction->setChecked(true);
1650 splitViewAction->setEnabled(true);
1651 splitViewAction->setChecked(false);
1652 fullViewAction->setEnabled(true);
1653 fullViewAction->setChecked(false);
1654
1597 menuView->hide(); 1655 menuView->hide();
1598 menuList->setRootMenu(0); 1656 menuList->setRootMenu(0);
1599 configList->mode = singleMode; 1657 configList->mode = singleMode;
@@ -1601,28 +1659,41 @@ void ConfigMainWindow::showSingleView(void)
1601 configList->updateListAll(); 1659 configList->updateListAll();
1602 else 1660 else
1603 configList->setRootMenu(&rootmenu); 1661 configList->setRootMenu(&rootmenu);
1604 configList->setAllOpen(TRUE);
1605 configList->setFocus(); 1662 configList->setFocus();
1606} 1663}
1607 1664
1608void ConfigMainWindow::showSplitView(void) 1665void ConfigMainWindow::showSplitView(void)
1609{ 1666{
1667 singleViewAction->setEnabled(true);
1668 singleViewAction->setChecked(false);
1669 splitViewAction->setEnabled(false);
1670 splitViewAction->setChecked(true);
1671 fullViewAction->setEnabled(true);
1672 fullViewAction->setChecked(false);
1673
1610 configList->mode = symbolMode; 1674 configList->mode = symbolMode;
1611 if (configList->rootEntry == &rootmenu) 1675 if (configList->rootEntry == &rootmenu)
1612 configList->updateListAll(); 1676 configList->updateListAll();
1613 else 1677 else
1614 configList->setRootMenu(&rootmenu); 1678 configList->setRootMenu(&rootmenu);
1615 configList->setAllOpen(TRUE); 1679 configList->setAllOpen(true);
1616 configApp->processEvents(); 1680 configApp->processEvents();
1617 menuList->mode = menuMode; 1681 menuList->mode = menuMode;
1618 menuList->setRootMenu(&rootmenu); 1682 menuList->setRootMenu(&rootmenu);
1619 menuList->setAllOpen(TRUE); 1683 menuList->setAllOpen(true);
1620 menuView->show(); 1684 menuView->show();
1621 menuList->setFocus(); 1685 menuList->setFocus();
1622} 1686}
1623 1687
1624void ConfigMainWindow::showFullView(void) 1688void ConfigMainWindow::showFullView(void)
1625{ 1689{
1690 singleViewAction->setEnabled(true);
1691 singleViewAction->setChecked(false);
1692 splitViewAction->setEnabled(true);
1693 splitViewAction->setChecked(false);
1694 fullViewAction->setEnabled(false);
1695 fullViewAction->setChecked(true);
1696
1626 menuView->hide(); 1697 menuView->hide();
1627 menuList->setRootMenu(0); 1698 menuList->setRootMenu(0);
1628 configList->mode = fullMode; 1699 configList->mode = fullMode;
@@ -1630,7 +1701,6 @@ void ConfigMainWindow::showFullView(void)
1630 configList->updateListAll(); 1701 configList->updateListAll();
1631 else 1702 else
1632 configList->setRootMenu(&rootmenu); 1703 configList->setRootMenu(&rootmenu);
1633 configList->setAllOpen(FALSE);
1634 configList->setFocus(); 1704 configList->setFocus();
1635} 1705}
1636 1706
@@ -1684,7 +1754,8 @@ void ConfigMainWindow::showIntro(void)
1684 1754
1685void ConfigMainWindow::showAbout(void) 1755void ConfigMainWindow::showAbout(void)
1686{ 1756{
1687 static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n" 1757 static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n"
1758 "Copyright (C) 2015 Boris Barbulovski <bbarbulovski@gmail.com>.\n\n"
1688 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"); 1759 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n");
1689 1760
1690 QMessageBox::information(this, "qconf", str); 1761 QMessageBox::information(this, "qconf", str);
@@ -1692,10 +1763,10 @@ void ConfigMainWindow::showAbout(void)
1692 1763
1693void ConfigMainWindow::saveSettings(void) 1764void ConfigMainWindow::saveSettings(void)
1694{ 1765{
1695 configSettings->writeEntry("/window x", pos().x()); 1766 configSettings->setValue("/window x", pos().x());
1696 configSettings->writeEntry("/window y", pos().y()); 1767 configSettings->setValue("/window y", pos().y());
1697 configSettings->writeEntry("/window width", size().width()); 1768 configSettings->setValue("/window width", size().width());
1698 configSettings->writeEntry("/window height", size().height()); 1769 configSettings->setValue("/window height", size().height());
1699 1770
1700 QString entry; 1771 QString entry;
1701 switch(configList->mode) { 1772 switch(configList->mode) {
@@ -1714,7 +1785,7 @@ void ConfigMainWindow::saveSettings(void)
1714 default: 1785 default:
1715 break; 1786 break;
1716 } 1787 }
1717 configSettings->writeEntry("/listMode", entry); 1788 configSettings->setValue("/listMode", entry);
1718 1789
1719 configSettings->writeSizes("/split1", split1->sizes()); 1790 configSettings->writeSizes("/split1", split1->sizes());
1720 configSettings->writeSizes("/split2", split2->sizes()); 1791 configSettings->writeSizes("/split2", split2->sizes());
@@ -1746,7 +1817,7 @@ static const char *progname;
1746 1817
1747static void usage(void) 1818static void usage(void)
1748{ 1819{
1749 printf(_("%s [-s] <config>\n"), progname); 1820 printf(_("%s [-s] <config>\n").toLatin1().constData(), progname);
1750 exit(0); 1821 exit(0);
1751} 1822}
1752 1823
@@ -1785,7 +1856,6 @@ int main(int ac, char** av)
1785 v = new ConfigMainWindow(); 1856 v = new ConfigMainWindow();
1786 1857
1787 //zconfdump(stdout); 1858 //zconfdump(stdout);
1788 configApp->setMainWidget(v);
1789 configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); 1859 configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit()));
1790 configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings())); 1860 configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings()));
1791 v->show(); 1861 v->show();
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index bde0c6b6f9e8..a40036d1b059 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,26 +3,18 @@
3 * Released under the terms of the GNU GPL v2.0. 3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#if QT_VERSION < 0x040000 6#include <QTextBrowser>
7#include <qlistview.h> 7#include <QTreeWidget>
8#else 8#include <QMainWindow>
9#include <q3listview.h> 9#include <QHeaderView>
10#endif
11#include <qsettings.h> 10#include <qsettings.h>
12 11#include <QPushButton>
13#if QT_VERSION < 0x040000 12#include <QSettings>
14#define Q3ValueList QValueList 13#include <QLineEdit>
15#define Q3PopupMenu QPopupMenu 14#include <QSplitter>
16#define Q3ListView QListView 15#include <QCheckBox>
17#define Q3ListViewItem QListViewItem 16#include <QDialog>
18#define Q3VBox QVBox 17#include "expr.h"
19#define Q3TextBrowser QTextBrowser
20#define Q3MainWindow QMainWindow
21#define Q3Action QAction
22#define Q3ToolBar QToolBar
23#define Q3ListViewItemIterator QListViewItemIterator
24#define Q3FileDialog QFileDialog
25#endif
26 18
27class ConfigView; 19class ConfigView;
28class ConfigList; 20class ConfigList;
@@ -33,8 +25,8 @@ class ConfigMainWindow;
33class ConfigSettings : public QSettings { 25class ConfigSettings : public QSettings {
34public: 26public:
35 ConfigSettings(); 27 ConfigSettings();
36 Q3ValueList<int> readSizes(const QString& key, bool *ok); 28 QList<int> readSizes(const QString& key, bool *ok);
37 bool writeSizes(const QString& key, const Q3ValueList<int>& value); 29 bool writeSizes(const QString& key, const QList<int>& value);
38}; 30};
39 31
40enum colIdx { 32enum colIdx {
@@ -47,9 +39,9 @@ enum optionMode {
47 normalOpt = 0, allOpt, promptOpt 39 normalOpt = 0, allOpt, promptOpt
48}; 40};
49 41
50class ConfigList : public Q3ListView { 42class ConfigList : public QTreeWidget {
51 Q_OBJECT 43 Q_OBJECT
52 typedef class Q3ListView Parent; 44 typedef class QTreeWidget Parent;
53public: 45public:
54 ConfigList(ConfigView* p, const char *name = 0); 46 ConfigList(ConfigView* p, const char *name = 0);
55 void reinit(void); 47 void reinit(void);
@@ -61,10 +53,10 @@ public:
61 53
62protected: 54protected:
63 void keyPressEvent(QKeyEvent *e); 55 void keyPressEvent(QKeyEvent *e);
64 void contentsMousePressEvent(QMouseEvent *e); 56 void mousePressEvent(QMouseEvent *e);
65 void contentsMouseReleaseEvent(QMouseEvent *e); 57 void mouseReleaseEvent(QMouseEvent *e);
66 void contentsMouseMoveEvent(QMouseEvent *e); 58 void mouseMoveEvent(QMouseEvent *e);
67 void contentsMouseDoubleClickEvent(QMouseEvent *e); 59 void mouseDoubleClickEvent(QMouseEvent *e);
68 void focusInEvent(QFocusEvent *e); 60 void focusInEvent(QFocusEvent *e);
69 void contextMenuEvent(QContextMenuEvent *e); 61 void contextMenuEvent(QContextMenuEvent *e);
70 62
@@ -95,32 +87,23 @@ public:
95 } 87 }
96 ConfigItem* firstChild() const 88 ConfigItem* firstChild() const
97 { 89 {
98 return (ConfigItem *)Parent::firstChild(); 90 return (ConfigItem *)children().first();
99 }
100 int mapIdx(colIdx idx)
101 {
102 return colMap[idx];
103 } 91 }
104 void addColumn(colIdx idx, const QString& label) 92 void addColumn(colIdx idx)
105 { 93 {
106 colMap[idx] = Parent::addColumn(label); 94 showColumn(idx);
107 colRevMap[colMap[idx]] = idx;
108 } 95 }
109 void removeColumn(colIdx idx) 96 void removeColumn(colIdx idx)
110 { 97 {
111 int col = colMap[idx]; 98 hideColumn(idx);
112 if (col >= 0) {
113 Parent::removeColumn(col);
114 colRevMap[col] = colMap[idx] = -1;
115 }
116 } 99 }
117 void setAllOpen(bool open); 100 void setAllOpen(bool open);
118 void setParentMenu(void); 101 void setParentMenu(void);
119 102
120 bool menuSkip(struct menu *); 103 bool menuSkip(struct menu *);
121 104
122 template <class P> 105 void updateMenuList(ConfigItem *parent, struct menu*);
123 void updateMenuList(P*, struct menu*); 106 void updateMenuList(ConfigList *parent, struct menu*);
124 107
125 bool updateAll; 108 bool updateAll;
126 109
@@ -132,30 +115,26 @@ public:
132 enum listMode mode; 115 enum listMode mode;
133 enum optionMode optMode; 116 enum optionMode optMode;
134 struct menu *rootEntry; 117 struct menu *rootEntry;
135 QColorGroup disabledColorGroup; 118 QPalette disabledColorGroup;
136 QColorGroup inactivedColorGroup; 119 QPalette inactivedColorGroup;
137 Q3PopupMenu* headerPopup; 120 QMenu* headerPopup;
138
139private:
140 int colMap[colNr];
141 int colRevMap[colNr];
142}; 121};
143 122
144class ConfigItem : public Q3ListViewItem { 123class ConfigItem : public QTreeWidgetItem {
145 typedef class Q3ListViewItem Parent; 124 typedef class QTreeWidgetItem Parent;
146public: 125public:
147 ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v) 126 ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m, bool v)
148 : Parent(parent, after), menu(m), visible(v), goParent(false) 127 : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
149 { 128 {
150 init(); 129 init();
151 } 130 }
152 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) 131 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
153 : Parent(parent, after), menu(m), visible(v), goParent(false) 132 : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false)
154 { 133 {
155 init(); 134 init();
156 } 135 }
157 ConfigItem(Q3ListView *parent, ConfigItem *after, bool v) 136 ConfigItem(ConfigList *parent, ConfigItem *after, bool v)
158 : Parent(parent, after), menu(0), visible(v), goParent(true) 137 : Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true)
159 { 138 {
160 init(); 139 init();
161 } 140 }
@@ -166,33 +145,43 @@ public:
166 void testUpdateMenu(bool v); 145 void testUpdateMenu(bool v);
167 ConfigList* listView() const 146 ConfigList* listView() const
168 { 147 {
169 return (ConfigList*)Parent::listView(); 148 return (ConfigList*)Parent::treeWidget();
170 } 149 }
171 ConfigItem* firstChild() const 150 ConfigItem* firstChild() const
172 { 151 {
173 return (ConfigItem *)Parent::firstChild(); 152 return (ConfigItem *)Parent::child(0);
174 } 153 }
175 ConfigItem* nextSibling() const 154 ConfigItem* nextSibling()
176 { 155 {
177 return (ConfigItem *)Parent::nextSibling(); 156 ConfigItem *ret = NULL;
157 ConfigItem *_parent = (ConfigItem *)parent();
158
159 if(_parent) {
160 ret = (ConfigItem *)_parent->child(_parent->indexOfChild(this)+1);
161 } else {
162 QTreeWidget *_treeWidget = treeWidget();
163 ret = (ConfigItem *)_treeWidget->topLevelItem(_treeWidget->indexOfTopLevelItem(this)+1);
164 }
165
166 return ret;
178 } 167 }
179 void setText(colIdx idx, const QString& text) 168 void setText(colIdx idx, const QString& text)
180 { 169 {
181 Parent::setText(listView()->mapIdx(idx), text); 170 Parent::setText(idx, text);
182 } 171 }
183 QString text(colIdx idx) const 172 QString text(colIdx idx) const
184 { 173 {
185 return Parent::text(listView()->mapIdx(idx)); 174 return Parent::text(idx);
186 } 175 }
187 void setPixmap(colIdx idx, const QPixmap& pm) 176 void setPixmap(colIdx idx, const QIcon &icon)
188 { 177 {
189 Parent::setPixmap(listView()->mapIdx(idx), pm); 178 Parent::setIcon(idx, icon);
190 } 179 }
191 const QPixmap* pixmap(colIdx idx) const 180 const QIcon pixmap(colIdx idx) const
192 { 181 {
193 return Parent::pixmap(listView()->mapIdx(idx)); 182 return icon(idx);
194 } 183 }
195 void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align); 184 // TODO: Implement paintCell
196 185
197 ConfigItem* nextItem; 186 ConfigItem* nextItem;
198 struct menu *menu; 187 struct menu *menu;
@@ -216,9 +205,9 @@ public:
216 ConfigItem *item; 205 ConfigItem *item;
217}; 206};
218 207
219class ConfigView : public Q3VBox { 208class ConfigView : public QWidget {
220 Q_OBJECT 209 Q_OBJECT
221 typedef class Q3VBox Parent; 210 typedef class QWidget Parent;
222public: 211public:
223 ConfigView(QWidget* parent, const char *name = 0); 212 ConfigView(QWidget* parent, const char *name = 0);
224 ~ConfigView(void); 213 ~ConfigView(void);
@@ -249,9 +238,9 @@ public:
249 static QAction *showPromptAction; 238 static QAction *showPromptAction;
250}; 239};
251 240
252class ConfigInfoView : public Q3TextBrowser { 241class ConfigInfoView : public QTextBrowser {
253 Q_OBJECT 242 Q_OBJECT
254 typedef class Q3TextBrowser Parent; 243 typedef class QTextBrowser Parent;
255public: 244public:
256 ConfigInfoView(QWidget* parent, const char *name = 0); 245 ConfigInfoView(QWidget* parent, const char *name = 0);
257 bool showDebug(void) const { return _showDebug; } 246 bool showDebug(void) const { return _showDebug; }
@@ -271,8 +260,8 @@ protected:
271 QString debug_info(struct symbol *sym); 260 QString debug_info(struct symbol *sym);
272 static QString print_filter(const QString &str); 261 static QString print_filter(const QString &str);
273 static void expr_print_help(void *data, struct symbol *sym, const char *str); 262 static void expr_print_help(void *data, struct symbol *sym, const char *str);
274 Q3PopupMenu* createPopupMenu(const QPoint& pos); 263 QMenu *createStandardContextMenu(const QPoint & pos);
275 void contentsContextMenuEvent(QContextMenuEvent *e); 264 void contextMenuEvent(QContextMenuEvent *e);
276 265
277 struct symbol *sym; 266 struct symbol *sym;
278 struct menu *_menu; 267 struct menu *_menu;
@@ -299,10 +288,10 @@ protected:
299 struct symbol **result; 288 struct symbol **result;
300}; 289};
301 290
302class ConfigMainWindow : public Q3MainWindow { 291class ConfigMainWindow : public QMainWindow {
303 Q_OBJECT 292 Q_OBJECT
304 293
305 static Q3Action *saveAction; 294 static QAction *saveAction;
306 static void conf_changed(void); 295 static void conf_changed(void);
307public: 296public:
308 ConfigMainWindow(void); 297 ConfigMainWindow(void);
@@ -331,8 +320,11 @@ protected:
331 ConfigView *configView; 320 ConfigView *configView;
332 ConfigList *configList; 321 ConfigList *configList;
333 ConfigInfoView *helpText; 322 ConfigInfoView *helpText;
334 Q3ToolBar *toolBar; 323 QToolBar *toolBar;
335 Q3Action *backAction; 324 QAction *backAction;
336 QSplitter* split1; 325 QAction *singleViewAction;
337 QSplitter* split2; 326 QAction *splitViewAction;
327 QAction *fullViewAction;
328 QSplitter *split1;
329 QSplitter *split2;
338}; 330};
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 50878dc025a5..25cf0c2c0c79 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -1116,6 +1116,8 @@ static void sym_check_print_recursive(struct symbol *last_sym)
1116 if (stack->sym == last_sym) 1116 if (stack->sym == last_sym)
1117 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n", 1117 fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
1118 prop->file->name, prop->lineno); 1118 prop->file->name, prop->lineno);
1119 fprintf(stderr, "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n");
1120 fprintf(stderr, "subsection \"Kconfig recursive dependency limitations\"\n");
1119 if (stack->expr) { 1121 if (stack->expr) {
1120 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n", 1122 fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
1121 prop->file->name, prop->lineno, 1123 prop->file->name, prop->lineno,