summaryrefslogtreecommitdiff
path: root/scripts/kconfig/qconf.cc
Side-by-side diff
Diffstat (limited to 'scripts/kconfig/qconf.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--scripts/kconfig/qconf.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 52419ad..0459caf 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1,57 +1,57 @@
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#include <qapplication.h>
#include <qmainwindow.h>
#include <qtoolbar.h>
#include <qvbox.h>
#include <qsplitter.h>
#include <qlistview.h>
#include <qtextview.h>
#include <qlineedit.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qaction.h>
#include <qheader.h>
#include <qfiledialog.h>
#include <qregexp.h>
-#if QT_VERSION >= 300
+#if QT_VERSION >= 0x030000
#include <qsettings.h>
#endif
#include <stdlib.h>
#include "lkc.h"
#include "qconf.h"
#include "qconf.moc"
#include "images.c"
static QApplication *configApp;
-#if QT_VERSION >= 300
+#if QT_VERSION >= 0x030000
static QSettings *configSettings;
#endif
/*
* update all the children of a menu entry
* removes/adds the entries from the parent widget as necessary
*
* parent: either the menu list widget or a menu entry widget
* menu: entry to be updated
*/
template <class P>
void ConfigList::updateMenuList(P* parent, struct menu* menu)
{
struct menu* child;
ConfigItem* item;
ConfigItem* last;
bool visible;
enum prop_type type;
if (!menu) {
while ((item = parent->firstChild()))
delete item;
return;
}
@@ -81,49 +81,49 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
if (!item || item->menu != child)
item = new ConfigItem(parent, last, child, visible);
else
item->testUpdateMenu(visible);
if (mode == fullMode || mode == menuMode || type != P_MENU)
updateMenuList(item, child);
else
updateMenuList(item, 0);
last = item;
continue;
}
hide:
if (item && item->menu == child) {
last = parent->firstChild();
if (last == item)
last = 0;
else while (last->nextSibling() != item)
last = last->nextSibling();
delete item;
}
}
}
-#if QT_VERSION >= 300
+#if QT_VERSION >= 0x030000
/*
* set the new data
* TODO check the value
*/
void ConfigItem::okRename(int col)
{
Parent::okRename(col);
sym_set_string_value(menu->sym, text(dataColIdx).latin1());
}
#endif
/*
* update the displayed of a menu entry
*/
void ConfigItem::updateMenu(void)
{
ConfigList* list;
struct symbol* sym;
struct property *prop;
QString prompt;
int type;
tristate expr;
list = listView();
@@ -194,49 +194,49 @@ void ConfigItem::updateMenu(void)
default:
if (sym_is_choice_value(sym) && type == S_BOOLEAN)
setPixmap(promptColIdx, list->choiceNoPix);
else
setPixmap(promptColIdx, list->symbolNoPix);
setText(noColIdx, "N");
ch = 'N';
break;
}
if (expr != no)
setText(noColIdx, sym_tristate_within_range(sym, no) ? "_" : 0);
if (expr != mod)
setText(modColIdx, sym_tristate_within_range(sym, mod) ? "_" : 0);
if (expr != yes)
setText(yesColIdx, sym_tristate_within_range(sym, yes) ? "_" : 0);
setText(dataColIdx, QChar(ch));
break;
case S_INT:
case S_HEX:
case S_STRING:
const char* data;
data = sym_get_string_value(sym);
-#if QT_VERSION >= 300
+#if QT_VERSION >= 0x030000
int i = list->mapIdx(dataColIdx);
if (i >= 0)
setRenameEnabled(i, TRUE);
#endif
setText(dataColIdx, data);
if (type == S_STRING)
prompt.sprintf("%s: %s", prompt.latin1(), data);
else
prompt.sprintf("(%s) %s", data, prompt.latin1());
break;
}
if (!sym_has_value(sym) && visible)
prompt += " (NEW)";
set_prompt:
setText(promptColIdx, prompt);
}
void ConfigItem::testUpdateMenu(bool v)
{
ConfigItem* i;
visible = v;
if (!menu)
return;
@@ -469,49 +469,49 @@ void ConfigList::changeValue(ConfigItem* item)
if (!sym) {
if (item->menu->list)
item->setOpen(!item->isOpen());
return;
}
type = sym_get_type(sym);
switch (type) {
case S_BOOLEAN:
case S_TRISTATE:
oldexpr = sym_get_tristate_value(sym);
newexpr = sym_toggle_tristate_value(sym);
if (item->menu->list) {
if (oldexpr == newexpr)
item->setOpen(!item->isOpen());
else if (oldexpr == no)
item->setOpen(TRUE);
}
if (oldexpr != newexpr)
parent()->updateList(item);
break;
case S_INT:
case S_HEX:
case S_STRING:
-#if QT_VERSION >= 300
+#if QT_VERSION >= 0x030000
if (colMap[dataColIdx] >= 0)
item->startRename(colMap[dataColIdx]);
else
#endif
parent()->lineEdit->show(item);
break;
}
}
void ConfigList::setRootMenu(struct menu *menu)
{
enum prop_type type;
if (rootEntry == menu)
return;
type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN;
if (type != P_MENU)
return;
updateMenuList(this, 0);
rootEntry = menu;
updateListAll();
setSelected(currentItem(), hasFocus());
}
@@ -730,49 +730,49 @@ void ConfigView::updateList(ConfigItem* item)
v->list->updateList(item);
}
void ConfigView::updateListAll(void)
{
ConfigView* v;
for (v = viewList; v; v = v->nextView)
v->list->updateListAll();
}
/*
* Construct the complete config widget
*/
ConfigMainWindow::ConfigMainWindow(void)
{
QMenuBar* menu;
QSplitter* split1;
QSplitter* split2;
bool ok;
int x, y, width, height;
QWidget *d = configApp->desktop();
-#if QT_VERSION >= 300
+#if QT_VERSION >= 0x030000
width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64);
height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64);
resize(width, height);
x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok);
if (ok)
y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok);
if (ok)
move(x, y);
#else
width = d->width() - 64;
height = d->height() - 64;
resize(width, height);
#endif
showDebug = false;
split1 = new QSplitter(this);
split1->setOrientation(QSplitter::Horizontal);
setCentralWidget(split1);
menuView = new ConfigView(split1, this);
menuList = menuView->list;
split2 = new QSplitter(split1);
@@ -1245,60 +1245,60 @@ void fixup_rootmenu(struct menu *menu)
} else if (!menu_cnt)
fixup_rootmenu(child);
}
}
static const char *progname;
static void usage(void)
{
printf("%s <config>\n", progname);
exit(0);
}
int main(int ac, char** av)
{
ConfigMainWindow* v;
const char *name;
#ifndef LKC_DIRECT_LINK
kconfig_load();
#endif
progname = av[0];
configApp = new QApplication(ac, av);
-#if QT_VERSION >= 300
+#if QT_VERSION >= 0x030000
configSettings = new QSettings;
#endif
if (ac > 1 && av[1][0] == '-') {
switch (av[1][1]) {
case 'h':
case '?':
usage();
}
name = av[2];
} else
name = av[1];
if (!name)
usage();
conf_parse(name);
fixup_rootmenu(&rootmenu);
conf_read(NULL);
//zconfdump(stdout);
v = new ConfigMainWindow();
//zconfdump(stdout);
v->show();
configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit()));
configApp->exec();
-#if QT_VERSION >= 300
+#if QT_VERSION >= 0x030000
configSettings->writeEntry("/kconfig/qconf/window x", v->pos().x());
configSettings->writeEntry("/kconfig/qconf/window y", v->pos().y());
configSettings->writeEntry("/kconfig/qconf/window width", v->size().width());
configSettings->writeEntry("/kconfig/qconf/window height", v->size().height());
delete configSettings;
#endif
return 0;
}