Commit 133c5f7c authored by Alexander Stein's avatar Alexander Stein Committed by Michal Marek

kconfig qconf: port to QT4

A straight forward port to QT4 using qt3to4 and compiling against
  qt3support

* Use pkg-config to detect QT4 which is hopefully portable enough
* If no QT4, QT3 will by tried instead
* Classes renamed using qt3to4
  * If build using QT3 renamed to QT3 class names using defines
* ConfigInfoView::menu has to be renamed as QT4 moc strips struct from
  struct menu and creates a name conflict
* QT2 support has been dropped
* The hidden options inserted in 39a4897c
  are use in native API
Signed-off-by: default avatarAlexander Stein <alexander.stein@informatik.tu-chemnitz.de>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent c94d3fb0
...@@ -235,6 +235,8 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile ...@@ -235,6 +235,8 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
# QT needs some extra effort... # QT needs some extra effort...
$(obj)/.tmp_qtcheck: $(obj)/.tmp_qtcheck:
@set -e; echo " CHECK qt"; dir=""; pkg=""; \ @set -e; echo " CHECK qt"; dir=""; pkg=""; \
if ! pkg-config --exists QtCore 2> /dev/null; then \
echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
pkg-config --exists qt 2> /dev/null && pkg=qt; \ pkg-config --exists qt 2> /dev/null && pkg=qt; \
pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
if [ -n "$$pkg" ]; then \ if [ -n "$$pkg" ]; then \
...@@ -248,10 +250,10 @@ $(obj)/.tmp_qtcheck: ...@@ -248,10 +250,10 @@ $(obj)/.tmp_qtcheck:
done; \ done; \
if [ -z "$$dir" ]; then \ if [ -z "$$dir" ]; then \
echo "*"; \ echo "*"; \
echo "* Unable to find the QT3 installation. Please make sure that"; \ echo "* Unable to find any QT installation. Please make sure that"; \
echo "* the QT3 development package is correctly installed and"; \ echo "* the QT4 or QT3 development package is correctly installed and"; \
echo "* either install pkg-config or set the QTDIR environment"; \ echo "* either qmake can be found or install pkg-config or set"; \
echo "* variable to the correct location."; \ echo "* the QTDIR environment variable to the correct location."; \
echo "*"; \ echo "*"; \
false; \ false; \
fi; \ fi; \
...@@ -270,6 +272,14 @@ $(obj)/.tmp_qtcheck: ...@@ -270,6 +272,14 @@ $(obj)/.tmp_qtcheck:
echo "*"; \ echo "*"; \
moc="/usr/bin/moc"; \ moc="/usr/bin/moc"; \
fi; \ fi; \
else \
headerpath="\$$(shell qmake -query QT_INSTALL_HEADERS)"; \
libpath="\$$(shell qmake -query QT_INSTALL_LIBS)"; \
binpath="\$$(shell qmake -query QT_INSTALL_BINS)"; \
cflags="-I$$headerpath -I$$headerpath/QtCore -I$$headerpath/QtGui -I$$headerpath/Qt3Support -DQT3_SUPPORT"; \
libs="-L$$libpath -Wl,-rpath,$$libpath -lQtCore -lQtGui -lQt3Support"; \
moc="$$binpath/moc"; \
fi; \
echo "KC_QT_CFLAGS=$$cflags" > $@; \ echo "KC_QT_CFLAGS=$$cflags" > $@; \
echo "KC_QT_LIBS=$$libs" >> $@; \ echo "KC_QT_LIBS=$$libs" >> $@; \
echo "KC_QT_MOC=$$moc" >> $@ echo "KC_QT_MOC=$$moc" >> $@
......
...@@ -3,25 +3,42 @@ ...@@ -3,25 +3,42 @@
* Released under the terms of the GNU GPL v2.0. * Released under the terms of the GNU GPL v2.0.
*/ */
#include <qapplication.h> #include <qglobal.h>
#if QT_VERSION < 0x040000
#include <qmainwindow.h> #include <qmainwindow.h>
#include <qvbox.h>
#include <qvaluelist.h>
#include <qtextbrowser.h>
#include <qaction.h>
#include <qheader.h>
#include <qfiledialog.h>
#include <qdragobject.h>
#include <qpopupmenu.h>
#else
#include <q3mainwindow.h>
#include <q3vbox.h>
#include <q3valuelist.h>
#include <q3textbrowser.h>
#include <q3action.h>
#include <q3header.h>
#include <q3filedialog.h>
#include <q3dragobject.h>
#include <q3popupmenu.h>
#endif
#include <qapplication.h>
#include <qdesktopwidget.h> #include <qdesktopwidget.h>
#include <qtoolbar.h> #include <qtoolbar.h>
#include <qlayout.h> #include <qlayout.h>
#include <qvbox.h>
#include <qsplitter.h> #include <qsplitter.h>
#include <qlistview.h>
#include <qtextbrowser.h>
#include <qlineedit.h> #include <qlineedit.h>
#include <qlabel.h> #include <qlabel.h>
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qmenubar.h> #include <qmenubar.h>
#include <qmessagebox.h> #include <qmessagebox.h>
#include <qaction.h>
#include <qheader.h>
#include <qfiledialog.h>
#include <qdragobject.h>
#include <qregexp.h> #include <qregexp.h>
#include <qevent.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -39,7 +56,7 @@ ...@@ -39,7 +56,7 @@
static QApplication *configApp; static QApplication *configApp;
static ConfigSettings *configSettings; static ConfigSettings *configSettings;
QAction *ConfigMainWindow::saveAction; Q3Action *ConfigMainWindow::saveAction;
static inline QString qgettext(const char* str) static inline QString qgettext(const char* str)
{ {
...@@ -54,9 +71,9 @@ static inline QString qgettext(const QString& str) ...@@ -54,9 +71,9 @@ static inline QString qgettext(const QString& str)
/** /**
* Reads a list of integer values from the application settings. * Reads a list of integer values from the application settings.
*/ */
QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) Q3ValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
{ {
QValueList<int> result; Q3ValueList<int> result;
QStringList entryList = readListEntry(key, ok); QStringList entryList = readListEntry(key, ok);
QStringList::Iterator it; QStringList::Iterator it;
...@@ -69,10 +86,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) ...@@ -69,10 +86,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
/** /**
* Writes a list of integer values to the application settings. * Writes a list of integer values to the application settings.
*/ */
bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value) bool ConfigSettings::writeSizes(const QString& key, const Q3ValueList<int>& value)
{ {
QStringList stringList; QStringList stringList;
QValueList<int>::ConstIterator it; Q3ValueList<int>::ConstIterator it;
for (it = value.begin(); it != value.end(); ++it) for (it = value.begin(); it != value.end(); ++it)
stringList.push_back(QString::number(*it)); stringList.push_back(QString::number(*it));
...@@ -80,7 +97,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value ...@@ -80,7 +97,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value
} }
#if QT_VERSION >= 300
/* /*
* set the new data * set the new data
* TODO check the value * TODO check the value
...@@ -91,7 +107,6 @@ void ConfigItem::okRename(int col) ...@@ -91,7 +107,6 @@ void ConfigItem::okRename(int col)
sym_set_string_value(menu->sym, text(dataColIdx).latin1()); sym_set_string_value(menu->sym, text(dataColIdx).latin1());
listView()->updateList(this); listView()->updateList(this);
} }
#endif
/* /*
* update the displayed of a menu entry * update the displayed of a menu entry
...@@ -195,11 +210,9 @@ void ConfigItem::updateMenu(void) ...@@ -195,11 +210,9 @@ void ConfigItem::updateMenu(void)
data = sym_get_string_value(sym); data = sym_get_string_value(sym);
#if QT_VERSION >= 300
int i = list->mapIdx(dataColIdx); int i = list->mapIdx(dataColIdx);
if (i >= 0) if (i >= 0)
setRenameEnabled(i, TRUE); setRenameEnabled(i, TRUE);
#endif
setText(dataColIdx, data); setText(dataColIdx, data);
if (type == S_STRING) if (type == S_STRING)
prompt = QString("%1: %2").arg(prompt).arg(data); prompt = QString("%1: %2").arg(prompt).arg(data);
...@@ -432,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item) ...@@ -432,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item)
if (!rootEntry) { if (!rootEntry) {
if (mode != listMode) if (mode != listMode)
goto update; goto update;
QListViewItemIterator it(this); Q3ListViewItemIterator it(this);
ConfigItem* item; ConfigItem* item;
for (; it.current(); ++it) { for (; it.current(); ++it) {
...@@ -527,11 +540,9 @@ void ConfigList::changeValue(ConfigItem* item) ...@@ -527,11 +540,9 @@ void ConfigList::changeValue(ConfigItem* item)
case S_INT: case S_INT:
case S_HEX: case S_HEX:
case S_STRING: case S_STRING:
#if QT_VERSION >= 300
if (colMap[dataColIdx] >= 0) if (colMap[dataColIdx] >= 0)
item->startRename(colMap[dataColIdx]); item->startRename(colMap[dataColIdx]);
else else
#endif
parent()->lineEdit->show(item); parent()->lineEdit->show(item);
break; break;
} }
...@@ -563,7 +574,7 @@ void ConfigList::setParentMenu(void) ...@@ -563,7 +574,7 @@ void ConfigList::setParentMenu(void)
return; return;
setRootMenu(menu_get_parent_menu(rootEntry->parent)); setRootMenu(menu_get_parent_menu(rootEntry->parent));
QListViewItemIterator it(this); Q3ListViewItemIterator it(this);
for (; (item = (ConfigItem*)it.current()); it++) { for (; (item = (ConfigItem*)it.current()); it++) {
if (item->menu == oldroot) { if (item->menu == oldroot) {
setCurrentItem(item); setCurrentItem(item);
...@@ -645,7 +656,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) ...@@ -645,7 +656,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
void ConfigList::keyPressEvent(QKeyEvent* ev) void ConfigList::keyPressEvent(QKeyEvent* ev)
{ {
QListViewItem* i = currentItem(); Q3ListViewItem* i = currentItem();
ConfigItem* item; ConfigItem* item;
struct menu *menu; struct menu *menu;
enum prop_type type; enum prop_type type;
...@@ -811,10 +822,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) ...@@ -811,10 +822,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
{ {
if (e->y() <= header()->geometry().bottom()) { if (e->y() <= header()->geometry().bottom()) {
if (!headerPopup) { if (!headerPopup) {
QAction *action; Q3Action *action;
headerPopup = new QPopupMenu(this); headerPopup = new Q3PopupMenu(this);
action = new QAction(NULL, _("Show Name"), 0, this); action = new Q3Action(NULL, _("Show Name"), 0, this);
action->setToggleAction(TRUE); action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)), connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowName(bool))); parent(), SLOT(setShowName(bool)));
...@@ -822,7 +833,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) ...@@ -822,7 +833,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
action, SLOT(setOn(bool))); action, SLOT(setOn(bool)));
action->setOn(showName); action->setOn(showName);
action->addTo(headerPopup); action->addTo(headerPopup);
action = new QAction(NULL, _("Show Range"), 0, this); action = new Q3Action(NULL, _("Show Range"), 0, this);
action->setToggleAction(TRUE); action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)), connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowRange(bool))); parent(), SLOT(setShowRange(bool)));
...@@ -830,7 +841,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) ...@@ -830,7 +841,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
action, SLOT(setOn(bool))); action, SLOT(setOn(bool)));
action->setOn(showRange); action->setOn(showRange);
action->addTo(headerPopup); action->addTo(headerPopup);
action = new QAction(NULL, _("Show Data"), 0, this); action = new Q3Action(NULL, _("Show Data"), 0, this);
action->setToggleAction(TRUE); action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)), connect(action, SIGNAL(toggled(bool)),
parent(), SLOT(setShowData(bool))); parent(), SLOT(setShowData(bool)));
...@@ -914,7 +925,7 @@ void ConfigView::setShowData(bool b) ...@@ -914,7 +925,7 @@ void ConfigView::setShowData(bool b)
void ConfigList::setAllOpen(bool open) void ConfigList::setAllOpen(bool open)
{ {
QListViewItemIterator it(this); Q3ListViewItemIterator it(this);
for (; it.current(); it++) for (; it.current(); it++)
it.current()->setOpen(open); it.current()->setOpen(open);
...@@ -937,7 +948,7 @@ void ConfigView::updateListAll(void) ...@@ -937,7 +948,7 @@ void ConfigView::updateListAll(void)
} }
ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
: Parent(parent, name), sym(0), menu(0) : Parent(parent, name), sym(0), _menu(0)
{ {
if (name) { if (name) {
configSettings->beginGroup(name); configSettings->beginGroup(name);
...@@ -960,7 +971,7 @@ void ConfigInfoView::setShowDebug(bool b) ...@@ -960,7 +971,7 @@ void ConfigInfoView::setShowDebug(bool b)
{ {
if (_showDebug != b) { if (_showDebug != b) {
_showDebug = b; _showDebug = b;
if (menu) if (_menu)
menuInfo(); menuInfo();
else if (sym) else if (sym)
symbolInfo(); symbolInfo();
...@@ -970,11 +981,11 @@ void ConfigInfoView::setShowDebug(bool b) ...@@ -970,11 +981,11 @@ void ConfigInfoView::setShowDebug(bool b)
void ConfigInfoView::setInfo(struct menu *m) void ConfigInfoView::setInfo(struct menu *m)
{ {
if (menu == m) if (_menu == m)
return; return;
menu = m; _menu = m;
sym = NULL; sym = NULL;
if (!menu) if (!_menu)
clear(); clear();
else else
menuInfo(); menuInfo();
...@@ -1001,11 +1012,11 @@ void ConfigInfoView::menuInfo(void) ...@@ -1001,11 +1012,11 @@ void ConfigInfoView::menuInfo(void)
struct symbol* sym; struct symbol* sym;
QString head, debug, help; QString head, debug, help;
sym = menu->sym; sym = _menu->sym;
if (sym) { if (sym) {
if (menu->prompt) { if (_menu->prompt) {
head += "<big><b>"; head += "<big><b>";
head += print_filter(_(menu->prompt->text)); head += print_filter(_(_menu->prompt->text));
head += "</b></big>"; head += "</b></big>";
if (sym->name) { if (sym->name) {
head += " ("; head += " (";
...@@ -1031,23 +1042,23 @@ void ConfigInfoView::menuInfo(void) ...@@ -1031,23 +1042,23 @@ void ConfigInfoView::menuInfo(void)
debug = debug_info(sym); debug = debug_info(sym);
struct gstr help_gstr = str_new(); struct gstr help_gstr = str_new();
menu_get_ext_help(menu, &help_gstr); menu_get_ext_help(_menu, &help_gstr);
help = print_filter(str_get(&help_gstr)); help = print_filter(str_get(&help_gstr));
str_free(&help_gstr); str_free(&help_gstr);
} else if (menu->prompt) { } else if (_menu->prompt) {
head += "<big><b>"; head += "<big><b>";
head += print_filter(_(menu->prompt->text)); head += print_filter(_(_menu->prompt->text));
head += "</b></big><br><br>"; head += "</b></big><br><br>";
if (showDebug()) { if (showDebug()) {
if (menu->prompt->visible.expr) { if (_menu->prompt->visible.expr) {
debug += "&nbsp;&nbsp;dep: "; debug += "&nbsp;&nbsp;dep: ";
expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); expr_print(_menu->prompt->visible.expr, expr_print_help, &debug, E_NONE);
debug += "<br><br>"; debug += "<br><br>";
} }
} }
} }
if (showDebug()) if (showDebug())
debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno); debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
setText(head + debug + help); setText(head + debug + help);
} }
...@@ -1150,10 +1161,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char ...@@ -1150,10 +1161,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
*text += str2; *text += str2;
} }
QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
{ {
QPopupMenu* popup = Parent::createPopupMenu(pos); Q3PopupMenu* popup = Parent::createPopupMenu(pos);
QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup); Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
action->setToggleAction(TRUE); action->setToggleAction(TRUE);
connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
...@@ -1210,7 +1221,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam ...@@ -1210,7 +1221,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
y = configSettings->readNumEntry("/window y", 0, &ok); y = configSettings->readNumEntry("/window y", 0, &ok);
if (ok) if (ok)
move(x, y); move(x, y);
QValueList<int> sizes = configSettings->readSizes("/split", &ok); Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
if (ok) if (ok)
split->setSizes(sizes); split->setSizes(sizes);
configSettings->endGroup(); configSettings->endGroup();
...@@ -1297,42 +1308,42 @@ ConfigMainWindow::ConfigMainWindow(void) ...@@ -1297,42 +1308,42 @@ ConfigMainWindow::ConfigMainWindow(void)
configList->setFocus(); configList->setFocus();
menu = menuBar(); menu = menuBar();
toolBar = new QToolBar("Tools", this); toolBar = new Q3ToolBar("Tools", this);
backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this); backAction = new Q3Action("Back", QPixmap(xpm_back), _("Back"), 0, this);
connect(backAction, SIGNAL(activated()), SLOT(goBack())); connect(backAction, SIGNAL(activated()), SLOT(goBack()));
backAction->setEnabled(FALSE); backAction->setEnabled(FALSE);
QAction *quitAction = new QAction("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this); Q3Action *quitAction = new Q3Action("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this);
connect(quitAction, SIGNAL(activated()), SLOT(close())); connect(quitAction, SIGNAL(activated()), SLOT(close()));
QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this); Q3Action *loadAction = new Q3Action("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this);
connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); connect(loadAction, SIGNAL(activated()), SLOT(loadConfig()));
saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this); saveAction = new Q3Action("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this);
connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
conf_set_changed_callback(conf_changed); conf_set_changed_callback(conf_changed);
// Set saveAction's initial state // Set saveAction's initial state
conf_changed(); conf_changed();
QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this); Q3Action *saveAsAction = new Q3Action("Save As...", _("Save &As..."), 0, this);
connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
QAction *searchAction = new QAction("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this); Q3Action *searchAction = new Q3Action("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this);
connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); Q3Action *singleViewAction = new Q3Action("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this);
connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this); Q3Action *splitViewAction = new Q3Action("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this);
connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this); Q3Action *fullViewAction = new Q3Action("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this);
connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this); Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
showNameAction->setToggleAction(TRUE); showNameAction->setToggleAction(TRUE);
connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
showNameAction->setOn(configView->showName()); showNameAction->setOn(configView->showName());
QAction *showRangeAction = new QAction(NULL, _("Show Range"), 0, this); Q3Action *showRangeAction = new Q3Action(NULL, _("Show Range"), 0, this);
showRangeAction->setToggleAction(TRUE); showRangeAction->setToggleAction(TRUE);
connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
showRangeAction->setOn(configList->showRange); showRangeAction->setOn(configList->showRange);
QAction *showDataAction = new QAction(NULL, _("Show Data"), 0, this); Q3Action *showDataAction = new Q3Action(NULL, _("Show Data"), 0, this);
showDataAction->setToggleAction(TRUE); showDataAction->setToggleAction(TRUE);
connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
...@@ -1345,9 +1356,15 @@ ConfigMainWindow::ConfigMainWindow(void) ...@@ -1345,9 +1356,15 @@ ConfigMainWindow::ConfigMainWindow(void)
connect(optGroup, SIGNAL(selected(QAction *)), menuView, connect(optGroup, SIGNAL(selected(QAction *)), menuView,
SLOT(setOptionMode(QAction *))); SLOT(setOptionMode(QAction *)));
configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup); #if QT_VERSION >= 0x040000
configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup); configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup);
configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup); configView->showAllAction = new QAction(_("Show All Options"), optGroup);
configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup);
#else
configView->showNormalAction = new QAction(_("Show Normal Options"), 0, optGroup);
configView->showAllAction = new QAction(_("Show All Options"), 0, optGroup);
configView->showPromptAction = new QAction(_("Show Prompt Options"), 0, optGroup);
#endif
configView->showNormalAction->setToggleAction(TRUE); configView->showNormalAction->setToggleAction(TRUE);
configView->showNormalAction->setOn(configList->optMode == normalOpt); configView->showNormalAction->setOn(configList->optMode == normalOpt);
configView->showAllAction->setToggleAction(TRUE); configView->showAllAction->setToggleAction(TRUE);
...@@ -1355,15 +1372,15 @@ ConfigMainWindow::ConfigMainWindow(void) ...@@ -1355,15 +1372,15 @@ ConfigMainWindow::ConfigMainWindow(void)
configView->showPromptAction->setToggleAction(TRUE); configView->showPromptAction->setToggleAction(TRUE);
configView->showPromptAction->setOn(configList->optMode == promptOpt); configView->showPromptAction->setOn(configList->optMode == promptOpt);
QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this); Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this);
showDebugAction->setToggleAction(TRUE); showDebugAction->setToggleAction(TRUE);
connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
showDebugAction->setOn(helpText->showDebug()); showDebugAction->setOn(helpText->showDebug());
QAction *showIntroAction = new QAction(NULL, _("Introduction"), 0, this); Q3Action *showIntroAction = new Q3Action(NULL, _("Introduction"), 0, this);
connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
QAction *showAboutAction = new QAction(NULL, _("About"), 0, this); Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
// init tool bar // init tool bar
...@@ -1377,7 +1394,7 @@ ConfigMainWindow::ConfigMainWindow(void) ...@@ -1377,7 +1394,7 @@ ConfigMainWindow::ConfigMainWindow(void)
fullViewAction->addTo(toolBar); fullViewAction->addTo(toolBar);
// create config menu // create config menu
QPopupMenu* config = new QPopupMenu(this); Q3PopupMenu* config = new Q3PopupMenu(this);
menu->insertItem(_("&File"), config); menu->insertItem(_("&File"), config);
loadAction->addTo(config); loadAction->addTo(config);
saveAction->addTo(config); saveAction->addTo(config);
...@@ -1386,12 +1403,12 @@ ConfigMainWindow::ConfigMainWindow(void) ...@@ -1386,12 +1403,12 @@ ConfigMainWindow::ConfigMainWindow(void)
quitAction->addTo(config); quitAction->addTo(config);
// create edit menu // create edit menu
QPopupMenu* editMenu = new QPopupMenu(this); Q3PopupMenu* editMenu = new Q3PopupMenu(this);
menu->insertItem(_("&Edit"), editMenu); menu->insertItem(_("&Edit"), editMenu);
searchAction->addTo(editMenu); searchAction->addTo(editMenu);
// create options menu // create options menu
QPopupMenu* optionMenu = new QPopupMenu(this); Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
menu->insertItem(_("&Option"), optionMenu); menu->insertItem(_("&Option"), optionMenu);
showNameAction->addTo(optionMenu); showNameAction->addTo(optionMenu);
showRangeAction->addTo(optionMenu); showRangeAction->addTo(optionMenu);
...@@ -1399,10 +1416,9 @@ ConfigMainWindow::ConfigMainWindow(void) ...@@ -1399,10 +1416,9 @@ ConfigMainWindow::ConfigMainWindow(void)
optionMenu->insertSeparator(); optionMenu->insertSeparator();
optGroup->addTo(optionMenu); optGroup->addTo(optionMenu);
optionMenu->insertSeparator(); optionMenu->insertSeparator();
showDebugAction->addTo(optionMenu);
// create help menu // create help menu
QPopupMenu* helpMenu = new QPopupMenu(this); Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
menu->insertSeparator(); menu->insertSeparator();
menu->insertItem(_("&Help"), helpMenu); menu->insertItem(_("&Help"), helpMenu);
showIntroAction->addTo(helpMenu); showIntroAction->addTo(helpMenu);
...@@ -1437,7 +1453,7 @@ ConfigMainWindow::ConfigMainWindow(void) ...@@ -1437,7 +1453,7 @@ ConfigMainWindow::ConfigMainWindow(void)
showSplitView(); showSplitView();
// UI setup done, restore splitter positions // UI setup done, restore splitter positions
QValueList<int> sizes = configSettings->readSizes("/split1", &ok); Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
if (ok) if (ok)
split1->setSizes(sizes); split1->setSizes(sizes);
...@@ -1448,7 +1464,7 @@ ConfigMainWindow::ConfigMainWindow(void) ...@@ -1448,7 +1464,7 @@ ConfigMainWindow::ConfigMainWindow(void)
void ConfigMainWindow::loadConfig(void) void ConfigMainWindow::loadConfig(void)
{ {
QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this); QString s = Q3FileDialog::getOpenFileName(conf_get_configname(), NULL, this);
if (s.isNull()) if (s.isNull())
return; return;
if (conf_read(QFile::encodeName(s))) if (conf_read(QFile::encodeName(s)))
...@@ -1464,7 +1480,7 @@ void ConfigMainWindow::saveConfig(void) ...@@ -1464,7 +1480,7 @@ void ConfigMainWindow::saveConfig(void)
void ConfigMainWindow::saveConfigAs(void) void ConfigMainWindow::saveConfigAs(void)
{ {
QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this); QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this);
if (s.isNull()) if (s.isNull())
return; return;
if (conf_write(QFile::encodeName(s))) if (conf_write(QFile::encodeName(s)))
......
...@@ -3,26 +3,25 @@ ...@@ -3,26 +3,25 @@
* Released under the terms of the GNU GPL v2.0. * Released under the terms of the GNU GPL v2.0.
*/ */
#if QT_VERSION < 0x040000
#include <qlistview.h> #include <qlistview.h>
#if QT_VERSION >= 300
#include <qsettings.h>
#else #else
class QSettings { #include <q3listview.h>
public: #endif
void beginGroup(const QString& group) { } #include <qsettings.h>
void endGroup(void) { }
bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const #if QT_VERSION < 0x040000
{ if (ok) *ok = FALSE; return def; } #define Q3ValueList QValueList
int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const #define Q3PopupMenu QPopupMenu
{ if (ok) *ok = FALSE; return def; } #define Q3ListView QListView
QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const #define Q3ListViewItem QListViewItem
{ if (ok) *ok = FALSE; return def; } #define Q3VBox QVBox
QStringList readListEntry(const QString& key, bool* ok = 0) const #define Q3TextBrowser QTextBrowser
{ if (ok) *ok = FALSE; return QStringList(); } #define Q3MainWindow QMainWindow
template <class t> #define Q3Action QAction
bool writeEntry(const QString& key, t value) #define Q3ToolBar QToolBar
{ return TRUE; } #define Q3ListViewItemIterator QListViewItemIterator
}; #define Q3FileDialog QFileDialog
#endif #endif
class ConfigView; class ConfigView;
...@@ -31,11 +30,10 @@ class ConfigItem; ...@@ -31,11 +30,10 @@ class ConfigItem;
class ConfigLineEdit; class ConfigLineEdit;
class ConfigMainWindow; class ConfigMainWindow;
class ConfigSettings : public QSettings { class ConfigSettings : public QSettings {
public: public:
QValueList<int> readSizes(const QString& key, bool *ok); Q3ValueList<int> readSizes(const QString& key, bool *ok);
bool writeSizes(const QString& key, const QValueList<int>& value); bool writeSizes(const QString& key, const Q3ValueList<int>& value);
}; };
enum colIdx { enum colIdx {
...@@ -48,9 +46,9 @@ enum optionMode { ...@@ -48,9 +46,9 @@ enum optionMode {
normalOpt = 0, allOpt, promptOpt normalOpt = 0, allOpt, promptOpt
}; };
class ConfigList : public QListView { class ConfigList : public Q3ListView {
Q_OBJECT Q_OBJECT
typedef class QListView Parent; typedef class Q3ListView Parent;
public: public:
ConfigList(ConfigView* p, const char *name = 0); ConfigList(ConfigView* p, const char *name = 0);
void reinit(void); void reinit(void);
...@@ -135,17 +133,17 @@ public slots: ...@@ -135,17 +133,17 @@ public slots:
struct menu *rootEntry; struct menu *rootEntry;
QColorGroup disabledColorGroup; QColorGroup disabledColorGroup;
QColorGroup inactivedColorGroup; QColorGroup inactivedColorGroup;
QPopupMenu* headerPopup; Q3PopupMenu* headerPopup;
private: private:
int colMap[colNr]; int colMap[colNr];
int colRevMap[colNr]; int colRevMap[colNr];
}; };
class ConfigItem : public QListViewItem { class ConfigItem : public Q3ListViewItem {
typedef class QListViewItem Parent; typedef class Q3ListViewItem Parent;
public: public:
ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v) ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v)
: Parent(parent, after), menu(m), visible(v), goParent(false) : Parent(parent, after), menu(m), visible(v), goParent(false)
{ {
init(); init();
...@@ -155,16 +153,14 @@ class ConfigItem : public QListViewItem { ...@@ -155,16 +153,14 @@ class ConfigItem : public QListViewItem {
{ {
init(); init();
} }
ConfigItem(QListView *parent, ConfigItem *after, bool v) ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
: Parent(parent, after), menu(0), visible(v), goParent(true) : Parent(parent, after), menu(0), visible(v), goParent(true)
{ {
init(); init();
} }
~ConfigItem(void); ~ConfigItem(void);
void init(void); void init(void);
#if QT_VERSION >= 300
void okRename(int col); void okRename(int col);
#endif
void updateMenu(void); void updateMenu(void);
void testUpdateMenu(bool v); void testUpdateMenu(bool v);
ConfigList* listView() const ConfigList* listView() const
...@@ -219,9 +215,9 @@ class ConfigLineEdit : public QLineEdit { ...@@ -219,9 +215,9 @@ class ConfigLineEdit : public QLineEdit {
ConfigItem *item; ConfigItem *item;
}; };
class ConfigView : public QVBox { class ConfigView : public Q3VBox {
Q_OBJECT Q_OBJECT
typedef class QVBox Parent; typedef class Q3VBox Parent;
public: public:
ConfigView(QWidget* parent, const char *name = 0); ConfigView(QWidget* parent, const char *name = 0);
~ConfigView(void); ~ConfigView(void);
...@@ -252,9 +248,9 @@ public slots: ...@@ -252,9 +248,9 @@ public slots:
static QAction *showPromptAction; static QAction *showPromptAction;
}; };
class ConfigInfoView : public QTextBrowser { class ConfigInfoView : public Q3TextBrowser {
Q_OBJECT Q_OBJECT
typedef class QTextBrowser Parent; typedef class Q3TextBrowser Parent;
public: public:
ConfigInfoView(QWidget* parent, const char *name = 0); ConfigInfoView(QWidget* parent, const char *name = 0);
bool showDebug(void) const { return _showDebug; } bool showDebug(void) const { return _showDebug; }
...@@ -274,11 +270,11 @@ public slots: ...@@ -274,11 +270,11 @@ public slots:
QString debug_info(struct symbol *sym); QString debug_info(struct symbol *sym);
static QString print_filter(const QString &str); static QString print_filter(const QString &str);
static void expr_print_help(void *data, struct symbol *sym, const char *str); static void expr_print_help(void *data, struct symbol *sym, const char *str);
QPopupMenu* createPopupMenu(const QPoint& pos); Q3PopupMenu* createPopupMenu(const QPoint& pos);
void contentsContextMenuEvent(QContextMenuEvent *e); void contentsContextMenuEvent(QContextMenuEvent *e);
struct symbol *sym; struct symbol *sym;
struct menu *menu; struct menu *_menu;
bool _showDebug; bool _showDebug;
}; };
...@@ -302,10 +298,10 @@ public slots: ...@@ -302,10 +298,10 @@ public slots:
struct symbol **result; struct symbol **result;
}; };
class ConfigMainWindow : public QMainWindow { class ConfigMainWindow : public Q3MainWindow {
Q_OBJECT Q_OBJECT
static QAction *saveAction; static Q3Action *saveAction;
static void conf_changed(void); static void conf_changed(void);
public: public:
ConfigMainWindow(void); ConfigMainWindow(void);
...@@ -334,8 +330,8 @@ public slots: ...@@ -334,8 +330,8 @@ public slots:
ConfigView *configView; ConfigView *configView;
ConfigList *configList; ConfigList *configList;
ConfigInfoView *helpText; ConfigInfoView *helpText;
QToolBar *toolBar; Q3ToolBar *toolBar;
QAction *backAction; Q3Action *backAction;
QSplitter* split1; QSplitter* split1;
QSplitter* split2; QSplitter* split2;
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment