All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kconfig qconf: port to QT4
@ 2010-06-06 17:51 Alexander Stein
  2010-06-07 12:45 ` Michal Marek
  0 siblings, 1 reply; 20+ messages in thread
From: Alexander Stein @ 2010-06-06 17:51 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linux-kbuild, Alexander Stein

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

* rewritten makefile rules to use qmake based qt setup which is hopefully
  portable enough
* ConfigInfoView::menu has to be renamed as QT4 moc strips struct from
  struct menu and creates a name conflict

Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
---
 scripts/kconfig/Makefile |   44 ++++---------
 scripts/kconfig/qconf.cc |  163 +++++++++++++++++++++++----------------------
 scripts/kconfig/qconf.h  |   61 ++++++-----------
 3 files changed, 116 insertions(+), 152 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 7ea649d..01f5a1f 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -232,42 +232,22 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
 
 # QT needs some extra effort...
 $(obj)/.tmp_qtcheck:
-	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
-	pkg-config --exists qt 2> /dev/null && pkg=qt; \
-	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
-	if [ -n "$$pkg" ]; then \
-	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
-	  libs="\$$(shell pkg-config $$pkg --libs)"; \
-	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
-	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
-	else \
-	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
-	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
-	  done; \
-	  if [ -z "$$dir" ]; then \
+	@set -e; echo "  CHECK   qt"; \
+	qmake=$(shell which qmake); \
+	echo $$qmake; \
+	if [ -z $$qmake ]; then \
 	    echo "*"; \
-	    echo "* Unable to find the QT3 installation. Please make sure that"; \
-	    echo "* the QT3 development package is correctly installed and"; \
-	    echo "* either install pkg-config or set the QTDIR environment"; \
-	    echo "* variable to the correct location."; \
+	    echo "* Unable to find the QT4 tool qmake. Please make sure that"; \
+	    echo "* the QT4 development package is correctly installed."; \
 	    echo "*"; \
 	    false; \
-	  fi; \
-	  libpath=$$dir/lib; lib=qt; osdir=""; \
-	  $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
-	    osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
-	  test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
-	  test -f $$libpath/libqt-mt.so && lib=qt-mt; \
-	  cflags="-I$$dir/include"; \
-	  libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
-	  moc="$$dir/bin/moc"; \
-	fi; \
-	if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
-	  echo "*"; \
-	  echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
-	  echo "*"; \
-	  moc="/usr/bin/moc"; \
 	fi; \
+	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"; \
 	echo "KC_QT_CFLAGS=$$cflags" > $@; \
 	echo "KC_QT_LIBS=$$libs" >> $@; \
 	echo "KC_QT_MOC=$$moc" >> $@
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 00c5150..184e080 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -3,32 +3,33 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
-#include <qapplication.h>
-#include <qmainwindow.h>
-#include <qdesktopwidget.h>
-#include <qtoolbar.h>
-#include <qlayout.h>
-#include <qvbox.h>
-#include <qsplitter.h>
-#include <qlistview.h>
-#include <qtextbrowser.h>
-#include <qlineedit.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qmenubar.h>
-#include <qmessagebox.h>
-#include <qaction.h>
-#include <qheader.h>
-#include <qfiledialog.h>
-#include <qdragobject.h>
-#include <qregexp.h>
+#include <QApplication>
+#include <Q3MainWindow>
+#include <QDesktopWidget>
+#include <Q3ToolBar>
+#include <QLayout>
+#include <Q3VBox>
+#include <QSplitter>
+#include <Q3ListView>
+#include <Q3TextBrowser>
+#include <QLineEdit>
+#include <QLabel>
+#include <QPushButton>
+#include <QMenuBar>
+#include <QMessageBox>
+#include <Q3Action>
+#include <Q3Header>
+#include <Q3FileDialog>
+#include <Q3DragObject>
+#include <QRegExp>
+#include <QKeyEvent>
+#include <Q3PopupMenu>
 
 #include <stdlib.h>
 
 #include "lkc.h"
 #include "qconf.h"
 
-#include "qconf.moc"
 #include "images.c"
 
 #ifdef _
@@ -39,7 +40,7 @@
 static QApplication *configApp;
 static ConfigSettings *configSettings;
 
-QAction *ConfigMainWindow::saveAction;
+Q3Action *ConfigMainWindow::saveAction;
 
 static inline QString qgettext(const char* str)
 {
@@ -54,9 +55,9 @@ static inline QString qgettext(const QString& str)
 /**
  * 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);
 	if (ok) {
 		QStringList::Iterator it;
@@ -70,10 +71,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
 /**
  * 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;
-	QValueList<int>::ConstIterator it;
+	Q3ValueList<int>::ConstIterator it;
 
 	for (it = value.begin(); it != value.end(); ++it)
 		stringList.push_back(QString::number(*it));
@@ -422,7 +423,7 @@ void ConfigList::updateList(ConfigItem* item)
 	if (!rootEntry) {
 		if (mode != listMode)
 			goto update;
-		QListViewItemIterator it(this);
+		Q3ListViewItemIterator it(this);
 		ConfigItem* item;
 
 		for (; it.current(); ++it) {
@@ -553,7 +554,7 @@ void ConfigList::setParentMenu(void)
 		return;
 	setRootMenu(menu_get_parent_menu(rootEntry->parent));
 
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 	for (; (item = (ConfigItem*)it.current()); it++) {
 		if (item->menu == oldroot) {
 			setCurrentItem(item);
@@ -635,7 +636,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
 
 void ConfigList::keyPressEvent(QKeyEvent* ev)
 {
-	QListViewItem* i = currentItem();
+	Q3ListViewItem* i = currentItem();
 	ConfigItem* item;
 	struct menu *menu;
 	enum prop_type type;
@@ -801,10 +802,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 {
 	if (e->y() <= header()->geometry().bottom()) {
 		if (!headerPopup) {
-			QAction *action;
+			Q3Action *action;
 
-			headerPopup = new QPopupMenu(this);
-			action = new QAction(NULL, _("Show Name"), 0, this);
+			headerPopup = new Q3PopupMenu(this);
+			action = new Q3Action(NULL, _("Show Name"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowName(bool)));
@@ -812,7 +813,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showName);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Range"), 0, this);
+			action = new Q3Action(NULL, _("Show Range"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowRange(bool)));
@@ -820,7 +821,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showRange);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Data"), 0, this);
+			action = new Q3Action(NULL, _("Show Data"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowData(bool)));
@@ -898,7 +899,7 @@ void ConfigView::setShowData(bool b)
 
 void ConfigList::setAllOpen(bool open)
 {
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 
 	for (; it.current(); it++)
 		it.current()->setOpen(open);
@@ -921,7 +922,7 @@ void ConfigView::updateListAll(void)
 }
 
 ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
-	: Parent(parent, name), sym(0), menu(0)
+	: Parent(parent, name), sym(0), _menu(0)
 {
 	if (name) {
 		configSettings->beginGroup(name);
@@ -944,7 +945,7 @@ void ConfigInfoView::setShowDebug(bool b)
 {
 	if (_showDebug != b) {
 		_showDebug = b;
-		if (menu)
+		if (_menu)
 			menuInfo();
 		else if (sym)
 			symbolInfo();
@@ -954,11 +955,11 @@ void ConfigInfoView::setShowDebug(bool b)
 
 void ConfigInfoView::setInfo(struct menu *m)
 {
-	if (menu == m)
+	if (_menu == m)
 		return;
-	menu = m;
+	_menu = m;
 	sym = NULL;
-	if (!menu)
+	if (!_menu)
 		clear();
 	else
 		menuInfo();
@@ -968,17 +969,17 @@ void ConfigInfoView::setSource(const QString& name)
 {
 	const char *p = name.latin1();
 
-	menu = NULL;
+	_menu = NULL;
 	sym = NULL;
 
 	switch (p[0]) {
 	case 'm':
 		struct menu *m;
 
-		if (sscanf(p, "m%p", &m) == 1 && menu != m) {
-			menu = m;
+		if (sscanf(p, "m%p", &m) == 1 && _menu != m) {
+			_menu = m;
 			menuInfo();
-			emit menuSelected(menu);
+			emit menuSelected(_menu);
 		}
 		break;
 	case 's':
@@ -1013,11 +1014,11 @@ void ConfigInfoView::menuInfo(void)
 	struct symbol* sym;
 	QString head, debug, help;
 
-	sym = menu->sym;
+	sym = _menu->sym;
 	if (sym) {
-		if (menu->prompt) {
+		if (_menu->prompt) {
 			head += "<big><b>";
-			head += print_filter(_(menu->prompt->text));
+			head += print_filter(_(_menu->prompt->text));
 			head += "</b></big>";
 			if (sym->name) {
 				head += " (";
@@ -1043,23 +1044,23 @@ void ConfigInfoView::menuInfo(void)
 			debug = debug_info(sym);
 
 		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));
 		str_free(&help_gstr);
-	} else if (menu->prompt) {
+	} else if (_menu->prompt) {
 		head += "<big><b>";
-		head += print_filter(_(menu->prompt->text));
+		head += print_filter(_(_menu->prompt->text));
 		head += "</b></big><br><br>";
 		if (showDebug()) {
-			if (menu->prompt->visible.expr) {
+			if (_menu->prompt->visible.expr) {
 				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>";
 			}
 		}
 	}
 	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);
 }
@@ -1162,10 +1163,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 		*text += str2;
 }
 
-QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
+Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
 {
-	QPopupMenu* popup = Parent::createPopupMenu(pos);
-	QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
+	Q3PopupMenu* popup = Parent::createPopupMenu(pos);
+	Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
 	  action->setToggleAction(TRUE);
 	  connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
 	  connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1222,7 +1223,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
 			y = configSettings->readNumEntry("/window y", 0, &ok);
 		if (ok)
 			move(x, y);
-		QValueList<int> sizes = configSettings->readSizes("/split", &ok);
+		Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
 		if (ok)
 			split->setSizes(sizes);
 		configSettings->endGroup();
@@ -1309,60 +1310,60 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configList->setFocus();
 
 	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()));
 	  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()));
-	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()));
-	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()));
 	conf_set_changed_callback(conf_changed);
 	// Set saveAction's initial state
 	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()));
-	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()));
-	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()));
-	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()));
-	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()));
 
-	QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
+	Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
 	  showNameAction->setToggleAction(TRUE);
 	  connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
 	  connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
 	  connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
 	  connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
 	  showDataAction->setOn(configList->showData);
-	QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this);
+	Q3Action *showAllAction = new Q3Action(NULL, _("Show All Options"), 0, this);
 	  showAllAction->setToggleAction(TRUE);
 	  connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool)));
 	  connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool)));
 	  showAllAction->setOn(configList->showAll);
-	QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
+	Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this);
 	  showDebugAction->setToggleAction(TRUE);
 	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
 	  connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
 	  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()));
-	QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
+	Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
 	  connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
 
 	// init tool bar
@@ -1376,7 +1377,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 	fullViewAction->addTo(toolBar);
 
 	// create config menu
-	QPopupMenu* config = new QPopupMenu(this);
+	Q3PopupMenu* config = new Q3PopupMenu(this);
 	menu->insertItem(_("&File"), config);
 	loadAction->addTo(config);
 	saveAction->addTo(config);
@@ -1385,12 +1386,12 @@ ConfigMainWindow::ConfigMainWindow(void)
 	quitAction->addTo(config);
 
 	// create edit menu
-	QPopupMenu* editMenu = new QPopupMenu(this);
+	Q3PopupMenu* editMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Edit"), editMenu);
 	searchAction->addTo(editMenu);
 
 	// create options menu
-	QPopupMenu* optionMenu = new QPopupMenu(this);
+	Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Option"), optionMenu);
 	showNameAction->addTo(optionMenu);
 	showRangeAction->addTo(optionMenu);
@@ -1400,7 +1401,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 	showDebugAction->addTo(optionMenu);
 
 	// create help menu
-	QPopupMenu* helpMenu = new QPopupMenu(this);
+	Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
 	menu->insertSeparator();
 	menu->insertItem(_("&Help"), helpMenu);
 	showIntroAction->addTo(helpMenu);
@@ -1435,7 +1436,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 		showSplitView();
 
 	// UI setup done, restore splitter positions
-	QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
+	Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
 	if (ok)
 		split1->setSizes(sizes);
 
@@ -1446,7 +1447,7 @@ ConfigMainWindow::ConfigMainWindow(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())
 		return;
 	if (conf_read(QFile::encodeName(s)))
@@ -1462,7 +1463,7 @@ void ConfigMainWindow::saveConfig(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())
 		return;
 	if (conf_write(QFile::encodeName(s)))
@@ -1761,3 +1762,5 @@ int main(int ac, char** av)
 
 	return 0;
 }
+
+#include "qconf.moc"
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index b3b5657..8c8abdc 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,27 +3,8 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
-#include <qlistview.h>
-#if QT_VERSION >= 300
-#include <qsettings.h>
-#else
-class QSettings {
-public:
-	void beginGroup(const QString& group) { }
-	void endGroup(void) { }
-	bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QStringList readListEntry(const QString& key, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return QStringList(); }
-	template <class t>
-	bool writeEntry(const QString& key, t value)
-	{ return TRUE; }
-};
-#endif
+#include <Q3ListView>
+#include <QSettings>
 
 class ConfigView;
 class ConfigList;
@@ -34,8 +15,8 @@ class ConfigMainWindow;
 
 class ConfigSettings : public QSettings {
 public:
-	QValueList<int> readSizes(const QString& key, bool *ok);
-	bool writeSizes(const QString& key, const QValueList<int>& value);
+	Q3ValueList<int> readSizes(const QString& key, bool *ok);
+	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
 };
 
 enum colIdx {
@@ -45,9 +26,9 @@ enum listMode {
 	singleMode, menuMode, symbolMode, fullMode, listMode
 };
 
-class ConfigList : public QListView {
+class ConfigList : public Q3ListView {
 	Q_OBJECT
-	typedef class QListView Parent;
+	typedef class Q3ListView Parent;
 public:
 	ConfigList(ConfigView* p, const char *name = 0);
 	void reinit(void);
@@ -129,17 +110,17 @@ public:
 	struct menu *rootEntry;
 	QColorGroup disabledColorGroup;
 	QColorGroup inactivedColorGroup;
-	QPopupMenu* headerPopup;
+	Q3PopupMenu* headerPopup;
 
 private:
 	int colMap[colNr];
 	int colRevMap[colNr];
 };
 
-class ConfigItem : public QListViewItem {
-	typedef class QListViewItem Parent;
+class ConfigItem : public Q3ListViewItem {
+	typedef class Q3ListViewItem Parent;
 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)
 	{
 		init();
@@ -149,7 +130,7 @@ public:
 	{
 		init();
 	}
-	ConfigItem(QListView *parent, ConfigItem *after, bool v)
+	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
 	: Parent(parent, after), menu(0), visible(v), goParent(true)
 	{
 		init();
@@ -213,9 +194,9 @@ public:
 	ConfigItem *item;
 };
 
-class ConfigView : public QVBox {
+class ConfigView : public Q3VBox {
 	Q_OBJECT
-	typedef class QVBox Parent;
+	typedef class Q3VBox Parent;
 public:
 	ConfigView(QWidget* parent, const char *name = 0);
 	~ConfigView(void);
@@ -244,9 +225,9 @@ public:
 	ConfigView* nextView;
 };
 
-class ConfigInfoView : public QTextBrowser {
+class ConfigInfoView : public Q3TextBrowser {
 	Q_OBJECT
-	typedef class QTextBrowser Parent;
+	typedef class Q3TextBrowser Parent;
 public:
 	ConfigInfoView(QWidget* parent, const char *name = 0);
 	bool showDebug(void) const { return _showDebug; }
@@ -267,11 +248,11 @@ protected:
 	QString debug_info(struct symbol *sym);
 	static QString print_filter(const QString &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);
 
 	struct symbol *sym;
-	struct menu *menu;
+	struct menu *_menu;
 	bool _showDebug;
 };
 
@@ -295,10 +276,10 @@ protected:
 	struct symbol **result;
 };
 
-class ConfigMainWindow : public QMainWindow {
+class ConfigMainWindow : public Q3MainWindow {
 	Q_OBJECT
 
-	static QAction *saveAction;
+	static Q3Action *saveAction;
 	static void conf_changed(void);
 public:
 	ConfigMainWindow(void);
@@ -327,8 +308,8 @@ protected:
 	ConfigView *configView;
 	ConfigList *configList;
 	ConfigInfoView *helpText;
-	QToolBar *toolBar;
-	QAction *backAction;
+	Q3ToolBar *toolBar;
+	Q3Action *backAction;
 	QSplitter* split1;
 	QSplitter* split2;
 };
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH] kconfig qconf: port to QT4
  2010-06-06 17:51 [PATCH] kconfig qconf: port to QT4 Alexander Stein
@ 2010-06-07 12:45 ` Michal Marek
  2010-06-07 17:12   ` Alexander Stein
  0 siblings, 1 reply; 20+ messages in thread
From: Michal Marek @ 2010-06-07 12:45 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Roman Zippel, linux-kbuild, lkml

On 6.6.2010 19:51, Alexander Stein wrote:
> A straight forward port to QT4 using qt3to4 and compiling against
>   qt3support
> 
> * rewritten makefile rules to use qmake based qt setup which is hopefully
>   portable enough
> * ConfigInfoView::menu has to be renamed as QT4 moc strips struct from
>   struct menu and creates a name conflict

I've only very little experience with Qt 3 or 4. The patch basically
changes most QSomeClass to Q3SomeClass, which is the Qt3-compatible
wrapper around QSomeClass. Now is it possible to still support Qt3? E.g.
have a header file that #defines Q3SomeClass back to QSomeClass and does
similar with the Qt headers, would that be possible? I know that Qt4 has
be there for five years already, but if the cost of keeping support for
old userspace is not too hight, I would try it.

BTW, after applying your patch, make xconfig starts ok, but clicking in
the main menu does nothing, and if I close the close button, it does not
exit, but stops reacting to any input (but it still handles window
resize). The qt3 version would display the "Save changes?" dialog here.

Michal

> 
> Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
> ---
>  scripts/kconfig/Makefile |   44 ++++---------
>  scripts/kconfig/qconf.cc |  163 +++++++++++++++++++++++----------------------
>  scripts/kconfig/qconf.h  |   61 ++++++-----------
>  3 files changed, 116 insertions(+), 152 deletions(-)
> 
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index 7ea649d..01f5a1f 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -232,42 +232,22 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
>  
>  # QT needs some extra effort...
>  $(obj)/.tmp_qtcheck:
> -	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
> -	pkg-config --exists qt 2> /dev/null && pkg=qt; \
> -	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
> -	if [ -n "$$pkg" ]; then \
> -	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
> -	  libs="\$$(shell pkg-config $$pkg --libs)"; \
> -	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
> -	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
> -	else \
> -	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
> -	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
> -	  done; \
> -	  if [ -z "$$dir" ]; then \
> +	@set -e; echo "  CHECK   qt"; \
> +	qmake=$(shell which qmake); \
> +	echo $$qmake; \
> +	if [ -z $$qmake ]; then \
>  	    echo "*"; \
> -	    echo "* Unable to find the QT3 installation. Please make sure that"; \
> -	    echo "* the QT3 development package is correctly installed and"; \
> -	    echo "* either install pkg-config or set the QTDIR environment"; \
> -	    echo "* variable to the correct location."; \
> +	    echo "* Unable to find the QT4 tool qmake. Please make sure that"; \
> +	    echo "* the QT4 development package is correctly installed."; \
>  	    echo "*"; \
>  	    false; \
> -	  fi; \
> -	  libpath=$$dir/lib; lib=qt; osdir=""; \
> -	  $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
> -	    osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
> -	  test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
> -	  test -f $$libpath/libqt-mt.so && lib=qt-mt; \
> -	  cflags="-I$$dir/include"; \
> -	  libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
> -	  moc="$$dir/bin/moc"; \
> -	fi; \
> -	if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
> -	  echo "*"; \
> -	  echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
> -	  echo "*"; \
> -	  moc="/usr/bin/moc"; \
>  	fi; \
> +	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"; \
>  	echo "KC_QT_CFLAGS=$$cflags" > $@; \
>  	echo "KC_QT_LIBS=$$libs" >> $@; \
>  	echo "KC_QT_MOC=$$moc" >> $@
> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> index 00c5150..184e080 100644
> --- a/scripts/kconfig/qconf.cc
> +++ b/scripts/kconfig/qconf.cc
> @@ -3,32 +3,33 @@
>   * Released under the terms of the GNU GPL v2.0.
>   */
>  
> -#include <qapplication.h>
> -#include <qmainwindow.h>
> -#include <qdesktopwidget.h>
> -#include <qtoolbar.h>
> -#include <qlayout.h>
> -#include <qvbox.h>
> -#include <qsplitter.h>
> -#include <qlistview.h>
> -#include <qtextbrowser.h>
> -#include <qlineedit.h>
> -#include <qlabel.h>
> -#include <qpushbutton.h>
> -#include <qmenubar.h>
> -#include <qmessagebox.h>
> -#include <qaction.h>
> -#include <qheader.h>
> -#include <qfiledialog.h>
> -#include <qdragobject.h>
> -#include <qregexp.h>
> +#include <QApplication>
> +#include <Q3MainWindow>
> +#include <QDesktopWidget>
> +#include <Q3ToolBar>
> +#include <QLayout>
> +#include <Q3VBox>
> +#include <QSplitter>
> +#include <Q3ListView>
> +#include <Q3TextBrowser>
> +#include <QLineEdit>
> +#include <QLabel>
> +#include <QPushButton>
> +#include <QMenuBar>
> +#include <QMessageBox>
> +#include <Q3Action>
> +#include <Q3Header>
> +#include <Q3FileDialog>
> +#include <Q3DragObject>
> +#include <QRegExp>
> +#include <QKeyEvent>
> +#include <Q3PopupMenu>
>  
>  #include <stdlib.h>
>  
>  #include "lkc.h"
>  #include "qconf.h"
>  
> -#include "qconf.moc"
>  #include "images.c"
>  
>  #ifdef _
> @@ -39,7 +40,7 @@
>  static QApplication *configApp;
>  static ConfigSettings *configSettings;
>  
> -QAction *ConfigMainWindow::saveAction;
> +Q3Action *ConfigMainWindow::saveAction;
>  
>  static inline QString qgettext(const char* str)
>  {
> @@ -54,9 +55,9 @@ static inline QString qgettext(const QString& str)
>  /**
>   * 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);
>  	if (ok) {
>  		QStringList::Iterator it;
> @@ -70,10 +71,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
>  /**
>   * 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;
> -	QValueList<int>::ConstIterator it;
> +	Q3ValueList<int>::ConstIterator it;
>  
>  	for (it = value.begin(); it != value.end(); ++it)
>  		stringList.push_back(QString::number(*it));
> @@ -422,7 +423,7 @@ void ConfigList::updateList(ConfigItem* item)
>  	if (!rootEntry) {
>  		if (mode != listMode)
>  			goto update;
> -		QListViewItemIterator it(this);
> +		Q3ListViewItemIterator it(this);
>  		ConfigItem* item;
>  
>  		for (; it.current(); ++it) {
> @@ -553,7 +554,7 @@ void ConfigList::setParentMenu(void)
>  		return;
>  	setRootMenu(menu_get_parent_menu(rootEntry->parent));
>  
> -	QListViewItemIterator it(this);
> +	Q3ListViewItemIterator it(this);
>  	for (; (item = (ConfigItem*)it.current()); it++) {
>  		if (item->menu == oldroot) {
>  			setCurrentItem(item);
> @@ -635,7 +636,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
>  
>  void ConfigList::keyPressEvent(QKeyEvent* ev)
>  {
> -	QListViewItem* i = currentItem();
> +	Q3ListViewItem* i = currentItem();
>  	ConfigItem* item;
>  	struct menu *menu;
>  	enum prop_type type;
> @@ -801,10 +802,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
>  {
>  	if (e->y() <= header()->geometry().bottom()) {
>  		if (!headerPopup) {
> -			QAction *action;
> +			Q3Action *action;
>  
> -			headerPopup = new QPopupMenu(this);
> -			action = new QAction(NULL, _("Show Name"), 0, this);
> +			headerPopup = new Q3PopupMenu(this);
> +			action = new Q3Action(NULL, _("Show Name"), 0, this);
>  			  action->setToggleAction(TRUE);
>  			  connect(action, SIGNAL(toggled(bool)),
>  				  parent(), SLOT(setShowName(bool)));
> @@ -812,7 +813,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
>  				  action, SLOT(setOn(bool)));
>  			  action->setOn(showName);
>  			  action->addTo(headerPopup);
> -			action = new QAction(NULL, _("Show Range"), 0, this);
> +			action = new Q3Action(NULL, _("Show Range"), 0, this);
>  			  action->setToggleAction(TRUE);
>  			  connect(action, SIGNAL(toggled(bool)),
>  				  parent(), SLOT(setShowRange(bool)));
> @@ -820,7 +821,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
>  				  action, SLOT(setOn(bool)));
>  			  action->setOn(showRange);
>  			  action->addTo(headerPopup);
> -			action = new QAction(NULL, _("Show Data"), 0, this);
> +			action = new Q3Action(NULL, _("Show Data"), 0, this);
>  			  action->setToggleAction(TRUE);
>  			  connect(action, SIGNAL(toggled(bool)),
>  				  parent(), SLOT(setShowData(bool)));
> @@ -898,7 +899,7 @@ void ConfigView::setShowData(bool b)
>  
>  void ConfigList::setAllOpen(bool open)
>  {
> -	QListViewItemIterator it(this);
> +	Q3ListViewItemIterator it(this);
>  
>  	for (; it.current(); it++)
>  		it.current()->setOpen(open);
> @@ -921,7 +922,7 @@ void ConfigView::updateListAll(void)
>  }
>  
>  ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
> -	: Parent(parent, name), sym(0), menu(0)
> +	: Parent(parent, name), sym(0), _menu(0)
>  {
>  	if (name) {
>  		configSettings->beginGroup(name);
> @@ -944,7 +945,7 @@ void ConfigInfoView::setShowDebug(bool b)
>  {
>  	if (_showDebug != b) {
>  		_showDebug = b;
> -		if (menu)
> +		if (_menu)
>  			menuInfo();
>  		else if (sym)
>  			symbolInfo();
> @@ -954,11 +955,11 @@ void ConfigInfoView::setShowDebug(bool b)
>  
>  void ConfigInfoView::setInfo(struct menu *m)
>  {
> -	if (menu == m)
> +	if (_menu == m)
>  		return;
> -	menu = m;
> +	_menu = m;
>  	sym = NULL;
> -	if (!menu)
> +	if (!_menu)
>  		clear();
>  	else
>  		menuInfo();
> @@ -968,17 +969,17 @@ void ConfigInfoView::setSource(const QString& name)
>  {
>  	const char *p = name.latin1();
>  
> -	menu = NULL;
> +	_menu = NULL;
>  	sym = NULL;
>  
>  	switch (p[0]) {
>  	case 'm':
>  		struct menu *m;
>  
> -		if (sscanf(p, "m%p", &m) == 1 && menu != m) {
> -			menu = m;
> +		if (sscanf(p, "m%p", &m) == 1 && _menu != m) {
> +			_menu = m;
>  			menuInfo();
> -			emit menuSelected(menu);
> +			emit menuSelected(_menu);
>  		}
>  		break;
>  	case 's':
> @@ -1013,11 +1014,11 @@ void ConfigInfoView::menuInfo(void)
>  	struct symbol* sym;
>  	QString head, debug, help;
>  
> -	sym = menu->sym;
> +	sym = _menu->sym;
>  	if (sym) {
> -		if (menu->prompt) {
> +		if (_menu->prompt) {
>  			head += "<big><b>";
> -			head += print_filter(_(menu->prompt->text));
> +			head += print_filter(_(_menu->prompt->text));
>  			head += "</b></big>";
>  			if (sym->name) {
>  				head += " (";
> @@ -1043,23 +1044,23 @@ void ConfigInfoView::menuInfo(void)
>  			debug = debug_info(sym);
>  
>  		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));
>  		str_free(&help_gstr);
> -	} else if (menu->prompt) {
> +	} else if (_menu->prompt) {
>  		head += "<big><b>";
> -		head += print_filter(_(menu->prompt->text));
> +		head += print_filter(_(_menu->prompt->text));
>  		head += "</b></big><br><br>";
>  		if (showDebug()) {
> -			if (menu->prompt->visible.expr) {
> +			if (_menu->prompt->visible.expr) {
>  				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>";
>  			}
>  		}
>  	}
>  	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);
>  }
> @@ -1162,10 +1163,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
>  		*text += str2;
>  }
>  
> -QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
> +Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
>  {
> -	QPopupMenu* popup = Parent::createPopupMenu(pos);
> -	QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
> +	Q3PopupMenu* popup = Parent::createPopupMenu(pos);
> +	Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
>  	  action->setToggleAction(TRUE);
>  	  connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
>  	  connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
> @@ -1222,7 +1223,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
>  			y = configSettings->readNumEntry("/window y", 0, &ok);
>  		if (ok)
>  			move(x, y);
> -		QValueList<int> sizes = configSettings->readSizes("/split", &ok);
> +		Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
>  		if (ok)
>  			split->setSizes(sizes);
>  		configSettings->endGroup();
> @@ -1309,60 +1310,60 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	configList->setFocus();
>  
>  	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()));
>  	  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()));
> -	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()));
> -	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()));
>  	conf_set_changed_callback(conf_changed);
>  	// Set saveAction's initial state
>  	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()));
> -	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()));
> -	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()));
> -	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()));
> -	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()));
>  
> -	QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
> +	Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
>  	  showNameAction->setToggleAction(TRUE);
>  	  connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
>  	  connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
>  	  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);
>  	  connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
>  	  connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
>  	  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);
>  	  connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
>  	  connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
>  	  showDataAction->setOn(configList->showData);
> -	QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this);
> +	Q3Action *showAllAction = new Q3Action(NULL, _("Show All Options"), 0, this);
>  	  showAllAction->setToggleAction(TRUE);
>  	  connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool)));
>  	  connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool)));
>  	  showAllAction->setOn(configList->showAll);
> -	QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
> +	Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this);
>  	  showDebugAction->setToggleAction(TRUE);
>  	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
>  	  connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
>  	  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()));
> -	QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
> +	Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
>  	  connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
>  
>  	// init tool bar
> @@ -1376,7 +1377,7 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	fullViewAction->addTo(toolBar);
>  
>  	// create config menu
> -	QPopupMenu* config = new QPopupMenu(this);
> +	Q3PopupMenu* config = new Q3PopupMenu(this);
>  	menu->insertItem(_("&File"), config);
>  	loadAction->addTo(config);
>  	saveAction->addTo(config);
> @@ -1385,12 +1386,12 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	quitAction->addTo(config);
>  
>  	// create edit menu
> -	QPopupMenu* editMenu = new QPopupMenu(this);
> +	Q3PopupMenu* editMenu = new Q3PopupMenu(this);
>  	menu->insertItem(_("&Edit"), editMenu);
>  	searchAction->addTo(editMenu);
>  
>  	// create options menu
> -	QPopupMenu* optionMenu = new QPopupMenu(this);
> +	Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
>  	menu->insertItem(_("&Option"), optionMenu);
>  	showNameAction->addTo(optionMenu);
>  	showRangeAction->addTo(optionMenu);
> @@ -1400,7 +1401,7 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	showDebugAction->addTo(optionMenu);
>  
>  	// create help menu
> -	QPopupMenu* helpMenu = new QPopupMenu(this);
> +	Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
>  	menu->insertSeparator();
>  	menu->insertItem(_("&Help"), helpMenu);
>  	showIntroAction->addTo(helpMenu);
> @@ -1435,7 +1436,7 @@ ConfigMainWindow::ConfigMainWindow(void)
>  		showSplitView();
>  
>  	// UI setup done, restore splitter positions
> -	QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
> +	Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
>  	if (ok)
>  		split1->setSizes(sizes);
>  
> @@ -1446,7 +1447,7 @@ ConfigMainWindow::ConfigMainWindow(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())
>  		return;
>  	if (conf_read(QFile::encodeName(s)))
> @@ -1462,7 +1463,7 @@ void ConfigMainWindow::saveConfig(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())
>  		return;
>  	if (conf_write(QFile::encodeName(s)))
> @@ -1761,3 +1762,5 @@ int main(int ac, char** av)
>  
>  	return 0;
>  }
> +
> +#include "qconf.moc"
> diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
> index b3b5657..8c8abdc 100644
> --- a/scripts/kconfig/qconf.h
> +++ b/scripts/kconfig/qconf.h
> @@ -3,27 +3,8 @@
>   * Released under the terms of the GNU GPL v2.0.
>   */
>  
> -#include <qlistview.h>
> -#if QT_VERSION >= 300
> -#include <qsettings.h>
> -#else
> -class QSettings {
> -public:
> -	void beginGroup(const QString& group) { }
> -	void endGroup(void) { }
> -	bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return def; }
> -	int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return def; }
> -	QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return def; }
> -	QStringList readListEntry(const QString& key, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return QStringList(); }
> -	template <class t>
> -	bool writeEntry(const QString& key, t value)
> -	{ return TRUE; }
> -};
> -#endif
> +#include <Q3ListView>
> +#include <QSettings>
>  
>  class ConfigView;
>  class ConfigList;
> @@ -34,8 +15,8 @@ class ConfigMainWindow;
>  
>  class ConfigSettings : public QSettings {
>  public:
> -	QValueList<int> readSizes(const QString& key, bool *ok);
> -	bool writeSizes(const QString& key, const QValueList<int>& value);
> +	Q3ValueList<int> readSizes(const QString& key, bool *ok);
> +	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
>  };
>  
>  enum colIdx {
> @@ -45,9 +26,9 @@ enum listMode {
>  	singleMode, menuMode, symbolMode, fullMode, listMode
>  };
>  
> -class ConfigList : public QListView {
> +class ConfigList : public Q3ListView {
>  	Q_OBJECT
> -	typedef class QListView Parent;
> +	typedef class Q3ListView Parent;
>  public:
>  	ConfigList(ConfigView* p, const char *name = 0);
>  	void reinit(void);
> @@ -129,17 +110,17 @@ public:
>  	struct menu *rootEntry;
>  	QColorGroup disabledColorGroup;
>  	QColorGroup inactivedColorGroup;
> -	QPopupMenu* headerPopup;
> +	Q3PopupMenu* headerPopup;
>  
>  private:
>  	int colMap[colNr];
>  	int colRevMap[colNr];
>  };
>  
> -class ConfigItem : public QListViewItem {
> -	typedef class QListViewItem Parent;
> +class ConfigItem : public Q3ListViewItem {
> +	typedef class Q3ListViewItem Parent;
>  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)
>  	{
>  		init();
> @@ -149,7 +130,7 @@ public:
>  	{
>  		init();
>  	}
> -	ConfigItem(QListView *parent, ConfigItem *after, bool v)
> +	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
>  	: Parent(parent, after), menu(0), visible(v), goParent(true)
>  	{
>  		init();
> @@ -213,9 +194,9 @@ public:
>  	ConfigItem *item;
>  };
>  
> -class ConfigView : public QVBox {
> +class ConfigView : public Q3VBox {
>  	Q_OBJECT
> -	typedef class QVBox Parent;
> +	typedef class Q3VBox Parent;
>  public:
>  	ConfigView(QWidget* parent, const char *name = 0);
>  	~ConfigView(void);
> @@ -244,9 +225,9 @@ public:
>  	ConfigView* nextView;
>  };
>  
> -class ConfigInfoView : public QTextBrowser {
> +class ConfigInfoView : public Q3TextBrowser {
>  	Q_OBJECT
> -	typedef class QTextBrowser Parent;
> +	typedef class Q3TextBrowser Parent;
>  public:
>  	ConfigInfoView(QWidget* parent, const char *name = 0);
>  	bool showDebug(void) const { return _showDebug; }
> @@ -267,11 +248,11 @@ protected:
>  	QString debug_info(struct symbol *sym);
>  	static QString print_filter(const QString &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);
>  
>  	struct symbol *sym;
> -	struct menu *menu;
> +	struct menu *_menu;
>  	bool _showDebug;
>  };
>  
> @@ -295,10 +276,10 @@ protected:
>  	struct symbol **result;
>  };
>  
> -class ConfigMainWindow : public QMainWindow {
> +class ConfigMainWindow : public Q3MainWindow {
>  	Q_OBJECT
>  
> -	static QAction *saveAction;
> +	static Q3Action *saveAction;
>  	static void conf_changed(void);
>  public:
>  	ConfigMainWindow(void);
> @@ -327,8 +308,8 @@ protected:
>  	ConfigView *configView;
>  	ConfigList *configList;
>  	ConfigInfoView *helpText;
> -	QToolBar *toolBar;
> -	QAction *backAction;
> +	Q3ToolBar *toolBar;
> +	Q3Action *backAction;
>  	QSplitter* split1;
>  	QSplitter* split2;
>  };


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] kconfig qconf: port to QT4
  2010-06-07 12:45 ` Michal Marek
@ 2010-06-07 17:12   ` Alexander Stein
  2010-06-07 18:01     ` Gene Heskett
  2010-06-07 21:29     ` Michal Marek
  0 siblings, 2 replies; 20+ messages in thread
From: Alexander Stein @ 2010-06-07 17:12 UTC (permalink / raw)
  To: Michal Marek; +Cc: Roman Zippel, linux-kbuild, lkml

Hello Michal,

Am Montag 07 Juni 2010, 14:45:48 schrieb Michal Marek:
> I've only very little experience with Qt 3 or 4. The patch basically
> changes most QSomeClass to Q3SomeClass, which is the Qt3-compatible
> wrapper around QSomeClass. Now is it possible to still support Qt3? E.g.
> have a header file that #defines Q3SomeClass back to QSomeClass and does
> similar with the Qt headers, would that be possible? I know that Qt4 has
> be there for five years already, but if the cost of keeping support for
> old userspace is not too hight, I would try it.

I never thought about qt3 compatibility but It seems to me that renaming the 
qt3 compat classes and revert the header file name changes should suffice to 
compile against qt3 again. But then somebody else has to do the makefile magic 
to support both versions. Also which version should be prefered if both are 
available?

> BTW, after applying your patch, make xconfig starts ok, but clicking in
> the main menu does nothing, and if I close the close button, it does not
> exit, but stops reacting to any input (but it still handles window
> resize). The qt3 version would display the "Save changes?" dialog here.

I can click in the window around and closing the window using the X button 
asks me about saving the changes. Which QT version do you use actually?

Best regards
Alexander

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] kconfig qconf: port to QT4
  2010-06-07 17:12   ` Alexander Stein
@ 2010-06-07 18:01     ` Gene Heskett
  2010-06-07 21:29     ` Michal Marek
  1 sibling, 0 replies; 20+ messages in thread
From: Gene Heskett @ 2010-06-07 18:01 UTC (permalink / raw)
  To: linux-kernel, Alexander Stein

On Monday 07 June 2010, Alexander Stein wrote:
>Hello Michal,
>
>Am Montag 07 Juni 2010, 14:45:48 schrieb Michal Marek:
>> I've only very little experience with Qt 3 or 4. The patch basically
>> changes most QSomeClass to Q3SomeClass, which is the Qt3-compatible
>> wrapper around QSomeClass. Now is it possible to still support Qt3? E.g.
>> have a header file that #defines Q3SomeClass back to QSomeClass and does
>> similar with the Qt headers, would that be possible? I know that Qt4 has
>> be there for five years already, but if the cost of keeping support for
>> old userspace is not too hight, I would try it.
>
>I never thought about qt3 compatibility but It seems to me that renaming
> the qt3 compat classes and revert the header file name changes should
> suffice to compile against qt3 again. But then somebody else has to do
> the makefile magic to support both versions. Also which version should be
> prefered if both are available?
>
>> BTW, after applying your patch, make xconfig starts ok, but clicking in
>> the main menu does nothing, and if I close the close button, it does not
>> exit, but stops reacting to any input (but it still handles window
>> resize). The qt3 version would display the "Save changes?" dialog here.
>
>I can click in the window around and closing the window using the X button
>asks me about saving the changes. Which QT version do you use actually?
>
>Best regards
>Alexander

Re-enabling kconfig for gt4 only distros like mdv, would be hugely 
appreciated Alexander.  I have never been comfy with menuconfig, which is 
forced now.

So thanks for anything you can do about making both gconfig and kconfig 
work, as neither does on mdv-2010-x86-64.

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Whoever tells a lie cannot be pure in heart -- and only the pure in heart
can make a good soup.
		-- Ludwig Van Beethoven

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] kconfig qconf: port to QT4
  2010-06-07 17:12   ` Alexander Stein
  2010-06-07 18:01     ` Gene Heskett
@ 2010-06-07 21:29     ` Michal Marek
  2010-07-13 19:26       ` [PATCH v2] " Alexander Stein
  1 sibling, 1 reply; 20+ messages in thread
From: Michal Marek @ 2010-06-07 21:29 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Roman Zippel, linux-kbuild, lkml

On 7.6.2010 19:12, Alexander Stein wrote:
> Hello Michal,
> 
> Am Montag 07 Juni 2010, 14:45:48 schrieb Michal Marek:
>> I've only very little experience with Qt 3 or 4. The patch basically
>> changes most QSomeClass to Q3SomeClass, which is the Qt3-compatible
>> wrapper around QSomeClass. Now is it possible to still support Qt3? E.g.
>> have a header file that #defines Q3SomeClass back to QSomeClass and does
>> similar with the Qt headers, would that be possible? I know that Qt4 has
>> be there for five years already, but if the cost of keeping support for
>> old userspace is not too hight, I would try it.
> 
> I never thought about qt3 compatibility but It seems to me that renaming the 
> qt3 compat classes and revert the header file name changes should suffice to 
> compile against qt3 again. But then somebody else has to do the makefile magic 
> to support both versions. Also which version should be prefered if both are 
> available?

I'd say the Qt4 version, leaving the qt3 for those who have no other
option (and then letting it bitrot once the last user installs Qt4 :-)).


>> BTW, after applying your patch, make xconfig starts ok, but clicking in
>> the main menu does nothing, and if I close the close button, it does not
>> exit, but stops reacting to any input (but it still handles window
>> resize). The qt3 version would display the "Save changes?" dialog here.
> 
> I can click in the window around and closing the window using the X button 
> asks me about saving the changes. Which QT version do you use actually?


Strange, now it works fine. I'll play with it a bit more and then I'll
tell you for sure.

Michal

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v2] kconfig qconf: port to QT4
  2010-06-07 21:29     ` Michal Marek
@ 2010-07-13 19:26       ` Alexander Stein
  2010-07-26 12:44         ` Michal Marek
  0 siblings, 1 reply; 20+ messages in thread
From: Alexander Stein @ 2010-07-13 19:26 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Michal Marek, Roman Zippel, lkml, Alexander Stein

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

* rewritten makefile rules to detect QT4 by using qmake 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

Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
---
Changes in v2:
* Use QT3 as fallback if no QT4 is available
* Rename class names using defines for QT3

 scripts/kconfig/Makefile |   78 ++++++++++++++----------
 scripts/kconfig/qconf.cc |  151 +++++++++++++++++++++++++---------------------
 scripts/kconfig/qconf.h  |   74 +++++++++++------------
 3 files changed, 164 insertions(+), 139 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 7ea649d..eb3c2f6 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -233,40 +233,52 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
 # QT needs some extra effort...
 $(obj)/.tmp_qtcheck:
 	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
-	pkg-config --exists qt 2> /dev/null && pkg=qt; \
-	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
-	if [ -n "$$pkg" ]; then \
-	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
-	  libs="\$$(shell pkg-config $$pkg --libs)"; \
-	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
-	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	qmake=$(shell which qmake); \
+	if [ -z $$qmake ]; 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-mt 2> /dev/null && pkg=qt-mt; \
+	    if [ -n "$$pkg" ]; then \
+	      cflags="\$$(shell pkg-config $$pkg --cflags)"; \
+	      libs="\$$(shell pkg-config $$pkg --libs)"; \
+	      moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
+	      dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	    else \
+	      for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
+	        if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
+	      done; \
+	      if [ -z "$$dir" ]; then \
+	        echo "*"; \
+	        echo "* Unable to find any QT installation. Please make sure that"; \
+	        echo "* the QT4 or QT3 development package is correctly installed and"; \
+	        echo "* either qmake can be found or install pkg-config or set"; \
+	        echo "* the QTDIR environment variable to the correct location."; \
+	        echo "*"; \
+	        false; \
+	      fi; \
+	      libpath=$$dir/lib; lib=qt; osdir=""; \
+	      $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
+	        osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
+	      test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
+	      test -f $$libpath/libqt-mt.so && lib=qt-mt; \
+	      cflags="-I$$dir/include"; \
+	      libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
+	      moc="$$dir/bin/moc"; \
+	    fi; \
+	    if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
+	      echo "*"; \
+	      echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
+	      echo "*"; \
+	      moc="/usr/bin/moc"; \
+	    fi; \
+	    cflags="$$cflags -DUSE_QT3"; \
 	else \
-	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
-	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
-	  done; \
-	  if [ -z "$$dir" ]; then \
-	    echo "*"; \
-	    echo "* Unable to find the QT3 installation. Please make sure that"; \
-	    echo "* the QT3 development package is correctly installed and"; \
-	    echo "* either install pkg-config or set the QTDIR environment"; \
-	    echo "* variable to the correct location."; \
-	    echo "*"; \
-	    false; \
-	  fi; \
-	  libpath=$$dir/lib; lib=qt; osdir=""; \
-	  $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
-	    osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
-	  test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
-	  test -f $$libpath/libqt-mt.so && lib=qt-mt; \
-	  cflags="-I$$dir/include"; \
-	  libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
-	  moc="$$dir/bin/moc"; \
-	fi; \
-	if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
-	  echo "*"; \
-	  echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
-	  echo "*"; \
-	  moc="/usr/bin/moc"; \
+	  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_LIBS=$$libs" >> $@; \
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 00c5150..d287689 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -3,25 +3,40 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
-#include <qapplication.h>
+#ifdef USE_QT3
 #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 <qtoolbar.h>
 #include <qlayout.h>
-#include <qvbox.h>
 #include <qsplitter.h>
-#include <qlistview.h>
-#include <qtextbrowser.h>
 #include <qlineedit.h>
 #include <qlabel.h>
 #include <qpushbutton.h>
 #include <qmenubar.h>
 #include <qmessagebox.h>
-#include <qaction.h>
-#include <qheader.h>
-#include <qfiledialog.h>
-#include <qdragobject.h>
 #include <qregexp.h>
+#include <qevent.h>
 
 #include <stdlib.h>
 
@@ -39,7 +54,7 @@
 static QApplication *configApp;
 static ConfigSettings *configSettings;
 
-QAction *ConfigMainWindow::saveAction;
+Q3Action *ConfigMainWindow::saveAction;
 
 static inline QString qgettext(const char* str)
 {
@@ -54,9 +69,9 @@ static inline QString qgettext(const QString& str)
 /**
  * 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);
 	if (ok) {
 		QStringList::Iterator it;
@@ -70,10 +85,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
 /**
  * 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;
-	QValueList<int>::ConstIterator it;
+	Q3ValueList<int>::ConstIterator it;
 
 	for (it = value.begin(); it != value.end(); ++it)
 		stringList.push_back(QString::number(*it));
@@ -422,7 +437,7 @@ void ConfigList::updateList(ConfigItem* item)
 	if (!rootEntry) {
 		if (mode != listMode)
 			goto update;
-		QListViewItemIterator it(this);
+		Q3ListViewItemIterator it(this);
 		ConfigItem* item;
 
 		for (; it.current(); ++it) {
@@ -553,7 +568,7 @@ void ConfigList::setParentMenu(void)
 		return;
 	setRootMenu(menu_get_parent_menu(rootEntry->parent));
 
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 	for (; (item = (ConfigItem*)it.current()); it++) {
 		if (item->menu == oldroot) {
 			setCurrentItem(item);
@@ -635,7 +650,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
 
 void ConfigList::keyPressEvent(QKeyEvent* ev)
 {
-	QListViewItem* i = currentItem();
+	Q3ListViewItem* i = currentItem();
 	ConfigItem* item;
 	struct menu *menu;
 	enum prop_type type;
@@ -801,10 +816,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 {
 	if (e->y() <= header()->geometry().bottom()) {
 		if (!headerPopup) {
-			QAction *action;
+			Q3Action *action;
 
-			headerPopup = new QPopupMenu(this);
-			action = new QAction(NULL, _("Show Name"), 0, this);
+			headerPopup = new Q3PopupMenu(this);
+			action = new Q3Action(NULL, _("Show Name"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowName(bool)));
@@ -812,7 +827,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showName);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Range"), 0, this);
+			action = new Q3Action(NULL, _("Show Range"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowRange(bool)));
@@ -820,7 +835,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showRange);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Data"), 0, this);
+			action = new Q3Action(NULL, _("Show Data"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowData(bool)));
@@ -898,7 +913,7 @@ void ConfigView::setShowData(bool b)
 
 void ConfigList::setAllOpen(bool open)
 {
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 
 	for (; it.current(); it++)
 		it.current()->setOpen(open);
@@ -921,7 +936,7 @@ void ConfigView::updateListAll(void)
 }
 
 ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
-	: Parent(parent, name), sym(0), menu(0)
+	: Parent(parent, name), sym(0), _menu(0)
 {
 	if (name) {
 		configSettings->beginGroup(name);
@@ -944,7 +959,7 @@ void ConfigInfoView::setShowDebug(bool b)
 {
 	if (_showDebug != b) {
 		_showDebug = b;
-		if (menu)
+		if (_menu)
 			menuInfo();
 		else if (sym)
 			symbolInfo();
@@ -954,11 +969,11 @@ void ConfigInfoView::setShowDebug(bool b)
 
 void ConfigInfoView::setInfo(struct menu *m)
 {
-	if (menu == m)
+	if (_menu == m)
 		return;
-	menu = m;
+	_menu = m;
 	sym = NULL;
-	if (!menu)
+	if (!_menu)
 		clear();
 	else
 		menuInfo();
@@ -968,17 +983,17 @@ void ConfigInfoView::setSource(const QString& name)
 {
 	const char *p = name.latin1();
 
-	menu = NULL;
+	_menu = NULL;
 	sym = NULL;
 
 	switch (p[0]) {
 	case 'm':
 		struct menu *m;
 
-		if (sscanf(p, "m%p", &m) == 1 && menu != m) {
-			menu = m;
+		if (sscanf(p, "m%p", &m) == 1 && _menu != m) {
+			_menu = m;
 			menuInfo();
-			emit menuSelected(menu);
+			emit menuSelected(_menu);
 		}
 		break;
 	case 's':
@@ -1013,11 +1028,11 @@ void ConfigInfoView::menuInfo(void)
 	struct symbol* sym;
 	QString head, debug, help;
 
-	sym = menu->sym;
+	sym = _menu->sym;
 	if (sym) {
-		if (menu->prompt) {
+		if (_menu->prompt) {
 			head += "<big><b>";
-			head += print_filter(_(menu->prompt->text));
+			head += print_filter(_(_menu->prompt->text));
 			head += "</b></big>";
 			if (sym->name) {
 				head += " (";
@@ -1043,23 +1058,23 @@ void ConfigInfoView::menuInfo(void)
 			debug = debug_info(sym);
 
 		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));
 		str_free(&help_gstr);
-	} else if (menu->prompt) {
+	} else if (_menu->prompt) {
 		head += "<big><b>";
-		head += print_filter(_(menu->prompt->text));
+		head += print_filter(_(_menu->prompt->text));
 		head += "</b></big><br><br>";
 		if (showDebug()) {
-			if (menu->prompt->visible.expr) {
+			if (_menu->prompt->visible.expr) {
 				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>";
 			}
 		}
 	}
 	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);
 }
@@ -1162,10 +1177,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 		*text += str2;
 }
 
-QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
+Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
 {
-	QPopupMenu* popup = Parent::createPopupMenu(pos);
-	QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
+	Q3PopupMenu* popup = Parent::createPopupMenu(pos);
+	Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
 	  action->setToggleAction(TRUE);
 	  connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
 	  connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1222,7 +1237,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
 			y = configSettings->readNumEntry("/window y", 0, &ok);
 		if (ok)
 			move(x, y);
-		QValueList<int> sizes = configSettings->readSizes("/split", &ok);
+		Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
 		if (ok)
 			split->setSizes(sizes);
 		configSettings->endGroup();
@@ -1309,60 +1324,60 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configList->setFocus();
 
 	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()));
 	  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()));
-	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()));
-	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()));
 	conf_set_changed_callback(conf_changed);
 	// Set saveAction's initial state
 	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()));
-	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()));
-	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()));
-	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()));
-	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()));
 
-	QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
+	Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
 	  showNameAction->setToggleAction(TRUE);
 	  connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
 	  connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
 	  connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
 	  connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
 	  showDataAction->setOn(configList->showData);
-	QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this);
+	Q3Action *showAllAction = new Q3Action(NULL, _("Show All Options"), 0, this);
 	  showAllAction->setToggleAction(TRUE);
 	  connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool)));
 	  connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool)));
 	  showAllAction->setOn(configList->showAll);
-	QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
+	Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this);
 	  showDebugAction->setToggleAction(TRUE);
 	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
 	  connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
 	  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()));
-	QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
+	Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
 	  connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
 
 	// init tool bar
@@ -1376,7 +1391,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 	fullViewAction->addTo(toolBar);
 
 	// create config menu
-	QPopupMenu* config = new QPopupMenu(this);
+	Q3PopupMenu* config = new Q3PopupMenu(this);
 	menu->insertItem(_("&File"), config);
 	loadAction->addTo(config);
 	saveAction->addTo(config);
@@ -1385,12 +1400,12 @@ ConfigMainWindow::ConfigMainWindow(void)
 	quitAction->addTo(config);
 
 	// create edit menu
-	QPopupMenu* editMenu = new QPopupMenu(this);
+	Q3PopupMenu* editMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Edit"), editMenu);
 	searchAction->addTo(editMenu);
 
 	// create options menu
-	QPopupMenu* optionMenu = new QPopupMenu(this);
+	Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Option"), optionMenu);
 	showNameAction->addTo(optionMenu);
 	showRangeAction->addTo(optionMenu);
@@ -1400,7 +1415,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 	showDebugAction->addTo(optionMenu);
 
 	// create help menu
-	QPopupMenu* helpMenu = new QPopupMenu(this);
+	Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
 	menu->insertSeparator();
 	menu->insertItem(_("&Help"), helpMenu);
 	showIntroAction->addTo(helpMenu);
@@ -1435,7 +1450,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 		showSplitView();
 
 	// UI setup done, restore splitter positions
-	QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
+	Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
 	if (ok)
 		split1->setSizes(sizes);
 
@@ -1446,7 +1461,7 @@ ConfigMainWindow::ConfigMainWindow(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())
 		return;
 	if (conf_read(QFile::encodeName(s)))
@@ -1462,7 +1477,7 @@ void ConfigMainWindow::saveConfig(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())
 		return;
 	if (conf_write(QFile::encodeName(s)))
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index b3b5657..3853ae8 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,26 +3,25 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
+#ifdef USE_QT3
 #include <qlistview.h>
-#if QT_VERSION >= 300
-#include <qsettings.h>
 #else
-class QSettings {
-public:
-	void beginGroup(const QString& group) { }
-	void endGroup(void) { }
-	bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QStringList readListEntry(const QString& key, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return QStringList(); }
-	template <class t>
-	bool writeEntry(const QString& key, t value)
-	{ return TRUE; }
-};
+#include <q3listview.h>
+#endif
+#include <qsettings.h>
+
+#ifdef USE_QT3
+#define Q3ValueList             QValueList
+#define Q3PopupMenu             QPopupMenu
+#define Q3ListView              QListView
+#define Q3ListViewItem          QListViewItem
+#define Q3VBox                  QVBox
+#define Q3TextBrowser           QTextBrowser
+#define Q3MainWindow            QMainWindow
+#define Q3Action                QAction
+#define Q3ToolBar               QToolBar
+#define Q3ListViewItemIterator  QListViewItemIterator
+#define Q3FileDialog            QFileDialog
 #endif
 
 class ConfigView;
@@ -31,11 +30,10 @@ class ConfigItem;
 class ConfigLineEdit;
 class ConfigMainWindow;
 
-
 class ConfigSettings : public QSettings {
 public:
-	QValueList<int> readSizes(const QString& key, bool *ok);
-	bool writeSizes(const QString& key, const QValueList<int>& value);
+	Q3ValueList<int> readSizes(const QString& key, bool *ok);
+	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
 };
 
 enum colIdx {
@@ -45,9 +43,9 @@ enum listMode {
 	singleMode, menuMode, symbolMode, fullMode, listMode
 };
 
-class ConfigList : public QListView {
+class ConfigList : public Q3ListView {
 	Q_OBJECT
-	typedef class QListView Parent;
+	typedef class Q3ListView Parent;
 public:
 	ConfigList(ConfigView* p, const char *name = 0);
 	void reinit(void);
@@ -129,17 +127,17 @@ public:
 	struct menu *rootEntry;
 	QColorGroup disabledColorGroup;
 	QColorGroup inactivedColorGroup;
-	QPopupMenu* headerPopup;
+	Q3PopupMenu* headerPopup;
 
 private:
 	int colMap[colNr];
 	int colRevMap[colNr];
 };
 
-class ConfigItem : public QListViewItem {
-	typedef class QListViewItem Parent;
+class ConfigItem : public Q3ListViewItem {
+	typedef class Q3ListViewItem Parent;
 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)
 	{
 		init();
@@ -149,7 +147,7 @@ public:
 	{
 		init();
 	}
-	ConfigItem(QListView *parent, ConfigItem *after, bool v)
+	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
 	: Parent(parent, after), menu(0), visible(v), goParent(true)
 	{
 		init();
@@ -213,9 +211,9 @@ public:
 	ConfigItem *item;
 };
 
-class ConfigView : public QVBox {
+class ConfigView : public Q3VBox {
 	Q_OBJECT
-	typedef class QVBox Parent;
+	typedef class Q3VBox Parent;
 public:
 	ConfigView(QWidget* parent, const char *name = 0);
 	~ConfigView(void);
@@ -244,9 +242,9 @@ public:
 	ConfigView* nextView;
 };
 
-class ConfigInfoView : public QTextBrowser {
+class ConfigInfoView : public Q3TextBrowser {
 	Q_OBJECT
-	typedef class QTextBrowser Parent;
+	typedef class Q3TextBrowser Parent;
 public:
 	ConfigInfoView(QWidget* parent, const char *name = 0);
 	bool showDebug(void) const { return _showDebug; }
@@ -267,11 +265,11 @@ protected:
 	QString debug_info(struct symbol *sym);
 	static QString print_filter(const QString &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);
 
 	struct symbol *sym;
-	struct menu *menu;
+	struct menu *_menu;
 	bool _showDebug;
 };
 
@@ -295,10 +293,10 @@ protected:
 	struct symbol **result;
 };
 
-class ConfigMainWindow : public QMainWindow {
+class ConfigMainWindow : public Q3MainWindow {
 	Q_OBJECT
 
-	static QAction *saveAction;
+	static Q3Action *saveAction;
 	static void conf_changed(void);
 public:
 	ConfigMainWindow(void);
@@ -327,8 +325,8 @@ protected:
 	ConfigView *configView;
 	ConfigList *configList;
 	ConfigInfoView *helpText;
-	QToolBar *toolBar;
-	QAction *backAction;
+	Q3ToolBar *toolBar;
+	Q3Action *backAction;
 	QSplitter* split1;
 	QSplitter* split2;
 };
-- 
1.7.1.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v2] kconfig qconf: port to QT4
  2010-07-13 19:26       ` [PATCH v2] " Alexander Stein
@ 2010-07-26 12:44         ` Michal Marek
  2010-07-26 12:47             ` Michal Marek
  2010-07-30 11:15           ` [PATCHi v3] " Alexander Stein
  0 siblings, 2 replies; 20+ messages in thread
From: Michal Marek @ 2010-07-26 12:44 UTC (permalink / raw)
  To: Alexander Stein; +Cc: linux-kbuild, Roman Zippel, lkml

On 13.7.2010 21:26, Alexander Stein wrote:
> A straight forward port to QT4 using qt3to4 and compiling against
>   qt3support
> 
> * rewritten makefile rules to detect QT4 by using qmake 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

Hi Alexander,

first, one thing I forgot to mention: There are some changes by Li Zefan
in my kconfig branch, which conflict with your patch. I resolved the
conflicts myself (but see below), but could you please use the kconfig
or for-next branch of
git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git next
time? If you already have a clone of Linus's tree, then just do

$ git remote add kbuild \
  git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git
$ git remote update kbuild
$ git checkout -b kconfig kbuild/kconfig

This will only download a few hundred kilobytes.

> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index 7ea649d..eb3c2f6 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -233,40 +233,52 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
>  # QT needs some extra effort...
>  $(obj)/.tmp_qtcheck:
>  	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
> -	pkg-config --exists qt 2> /dev/null && pkg=qt; \
> -	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
> -	if [ -n "$$pkg" ]; then \
> -	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
> -	  libs="\$$(shell pkg-config $$pkg --libs)"; \
> -	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
> -	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
> +	qmake=$(shell which qmake); \
> +	if [ -z $$qmake ]; then \

Unfortunatelly, this doesn't work for me if I uninstall libqt4-devel and
use qt3-devel, because then I have:
$ qmake --version
Qmake version: 1.07a (Qt 3.3.8b)
Qmake is free software from Trolltech ASA.
$ which qmake
/usr/lib/qt3/bin/qmake

I'm using openSUSE 11.3, but I think this is a generic problem, qmake
existed before QT4.


> diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
> index b3b5657..3853ae8 100644
> --- a/scripts/kconfig/qconf.h
> +++ b/scripts/kconfig/qconf.h
> @@ -3,26 +3,25 @@
>   * Released under the terms of the GNU GPL v2.0.
>   */
>  
> +#ifdef USE_QT3
>  #include <qlistview.h>
> -#if QT_VERSION >= 300
> -#include <qsettings.h>
>  #else
> -class QSettings {
> -public:
> -	void beginGroup(const QString& group) { }
> -	void endGroup(void) { }
> -	bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return def; }
> -	int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return def; }
> -	QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return def; }
> -	QStringList readListEntry(const QString& key, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return QStringList(); }
> -	template <class t>
> -	bool writeEntry(const QString& key, t value)
> -	{ return TRUE; }
> -};
> +#include <q3listview.h>
> +#endif
> +#include <qsettings.h>

Here, you are removing compatibility code for pre-3.0.0 QT versions.
That's perfectly fine in 2010 :-), but could you also please mention it
in the changelog and remove the other occurences of this ifdef in qconf.cc?

Other than that, I haven't found other issues with *your* patch, but
when I merge it with 39a4897 (xconfig: add support to show hidden
options which have prompts) and work around the above Makefile issue, I get

QObject::connect: No such signal QActionGroup::selected(Q3Action*)
QObject::connect:  (sender name:   'unnamed')
QObject::connect:  (receiver name: 'config')
QObject::connect: No such signal QActionGroup::selected(Q3Action*)
QObject::connect:  (sender name:   'unnamed')
QObject::connect:  (receiver name: 'menu')

and the Option -> Show Normal/All/Promp options menu added by 39a4897
does not work. The problem is that the QT4 moc does not run the
preprocessor, so the Q3Action token is not replaced by QAction. The QT4
does not have this limitation anymore, so I was wondering: Instead of
renaming every single class name in the source and then defining the
names back for QT3, could we just define the classes to the Q3Foo
versions for the QT4 case? This would solve the issue with the QT3 moc
and also make the patch smaller.

Michal

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v2] kconfig qconf: port to QT4
  2010-07-26 12:44         ` Michal Marek
@ 2010-07-26 12:47             ` Michal Marek
  2010-07-30 11:15           ` [PATCHi v3] " Alexander Stein
  1 sibling, 0 replies; 20+ messages in thread
From: Michal Marek @ 2010-07-26 12:47 UTC (permalink / raw)
  To: Alexander Stein; +Cc: linux-kbuild, Roman Zippel, lkml

On Mon, Jul 26, 2010 at 02:44:56PM +0200, Michal Marek wrote:
> Other than that, I haven't found other issues with *your* patch, but
> when I merge it with 39a4897 (xconfig: add support to show hidden
> options which have prompts) and work around the above Makefile issue, I get
> [...]

For reference, here is the resulting patch I used:

>From 99913f21e95a4da1b58a50321564c10ca567d498 Mon Sep 17 00:00:00 2001
From: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
Date: Tue, 13 Jul 2010 21:26:56 +0200
Subject: [PATCH] kconfig qconf: port to QT4

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

* rewritten makefile rules to detect QT4 by using qmake 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

Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
[mmarek: merged with 39a4897]
Signed-off-by: Michal Marek <mmarek@suse.cz>
---
 scripts/kconfig/Makefile |   78 ++++++++++++---------
 scripts/kconfig/qconf.cc |  167 +++++++++++++++++++++++++---------------------
 scripts/kconfig/qconf.h  |   83 +++++++++++------------
 3 files changed, 177 insertions(+), 151 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index f8d1ee3..755e7b3 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -233,40 +233,52 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
 # QT needs some extra effort...
 $(obj)/.tmp_qtcheck:
 	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
-	pkg-config --exists qt 2> /dev/null && pkg=qt; \
-	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
-	if [ -n "$$pkg" ]; then \
-	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
-	  libs="\$$(shell pkg-config $$pkg --libs)"; \
-	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
-	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	qmake=$(shell which qmake); \
+	if [ -z $$qmake ]; 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-mt 2> /dev/null && pkg=qt-mt; \
+	    if [ -n "$$pkg" ]; then \
+	      cflags="\$$(shell pkg-config $$pkg --cflags)"; \
+	      libs="\$$(shell pkg-config $$pkg --libs)"; \
+	      moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
+	      dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	    else \
+	      for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
+	        if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
+	      done; \
+	      if [ -z "$$dir" ]; then \
+	        echo "*"; \
+	        echo "* Unable to find any QT installation. Please make sure that"; \
+	        echo "* the QT4 or QT3 development package is correctly installed and"; \
+	        echo "* either qmake can be found or install pkg-config or set"; \
+	        echo "* the QTDIR environment variable to the correct location."; \
+	        echo "*"; \
+	        false; \
+	      fi; \
+	      libpath=$$dir/lib; lib=qt; osdir=""; \
+	      $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
+	        osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
+	      test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
+	      test -f $$libpath/libqt-mt.so && lib=qt-mt; \
+	      cflags="-I$$dir/include"; \
+	      libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
+	      moc="$$dir/bin/moc"; \
+	    fi; \
+	    if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
+	      echo "*"; \
+	      echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
+	      echo "*"; \
+	      moc="/usr/bin/moc"; \
+	    fi; \
+	    cflags="$$cflags -DUSE_QT3"; \
 	else \
-	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
-	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
-	  done; \
-	  if [ -z "$$dir" ]; then \
-	    echo "*"; \
-	    echo "* Unable to find the QT3 installation. Please make sure that"; \
-	    echo "* the QT3 development package is correctly installed and"; \
-	    echo "* either install pkg-config or set the QTDIR environment"; \
-	    echo "* variable to the correct location."; \
-	    echo "*"; \
-	    false; \
-	  fi; \
-	  libpath=$$dir/lib; lib=qt; osdir=""; \
-	  $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
-	    osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
-	  test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
-	  test -f $$libpath/libqt-mt.so && lib=qt-mt; \
-	  cflags="-I$$dir/include"; \
-	  libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
-	  moc="$$dir/bin/moc"; \
-	fi; \
-	if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
-	  echo "*"; \
-	  echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
-	  echo "*"; \
-	  moc="/usr/bin/moc"; \
+	  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_LIBS=$$libs" >> $@; \
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 820df2d..781da27 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -3,25 +3,40 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
-#include <qapplication.h>
+#ifdef USE_QT3
 #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 <qtoolbar.h>
 #include <qlayout.h>
-#include <qvbox.h>
 #include <qsplitter.h>
-#include <qlistview.h>
-#include <qtextbrowser.h>
 #include <qlineedit.h>
 #include <qlabel.h>
 #include <qpushbutton.h>
 #include <qmenubar.h>
 #include <qmessagebox.h>
-#include <qaction.h>
-#include <qheader.h>
-#include <qfiledialog.h>
-#include <qdragobject.h>
 #include <qregexp.h>
+#include <qevent.h>
 
 #include <stdlib.h>
 
@@ -39,7 +54,7 @@
 static QApplication *configApp;
 static ConfigSettings *configSettings;
 
-QAction *ConfigMainWindow::saveAction;
+Q3Action *ConfigMainWindow::saveAction;
 
 static inline QString qgettext(const char* str)
 {
@@ -54,9 +69,9 @@ static inline QString qgettext(const QString& str)
 /**
  * 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::Iterator it;
 
@@ -69,10 +84,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
 /**
  * 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;
-	QValueList<int>::ConstIterator it;
+	Q3ValueList<int>::ConstIterator it;
 
 	for (it = value.begin(); it != value.end(); ++it)
 		stringList.push_back(QString::number(*it));
@@ -432,7 +447,7 @@ void ConfigList::updateList(ConfigItem* item)
 	if (!rootEntry) {
 		if (mode != listMode)
 			goto update;
-		QListViewItemIterator it(this);
+		Q3ListViewItemIterator it(this);
 		ConfigItem* item;
 
 		for (; it.current(); ++it) {
@@ -563,7 +578,7 @@ void ConfigList::setParentMenu(void)
 		return;
 	setRootMenu(menu_get_parent_menu(rootEntry->parent));
 
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 	for (; (item = (ConfigItem*)it.current()); it++) {
 		if (item->menu == oldroot) {
 			setCurrentItem(item);
@@ -645,7 +660,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
 
 void ConfigList::keyPressEvent(QKeyEvent* ev)
 {
-	QListViewItem* i = currentItem();
+	Q3ListViewItem* i = currentItem();
 	ConfigItem* item;
 	struct menu *menu;
 	enum prop_type type;
@@ -811,10 +826,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 {
 	if (e->y() <= header()->geometry().bottom()) {
 		if (!headerPopup) {
-			QAction *action;
+			Q3Action *action;
 
-			headerPopup = new QPopupMenu(this);
-			action = new QAction(NULL, _("Show Name"), 0, this);
+			headerPopup = new Q3PopupMenu(this);
+			action = new Q3Action(NULL, _("Show Name"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowName(bool)));
@@ -822,7 +837,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showName);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Range"), 0, this);
+			action = new Q3Action(NULL, _("Show Range"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowRange(bool)));
@@ -830,7 +845,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showRange);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Data"), 0, this);
+			action = new Q3Action(NULL, _("Show Data"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowData(bool)));
@@ -846,9 +861,9 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 }
 
 ConfigView*ConfigView::viewList;
-QAction *ConfigView::showNormalAction;
-QAction *ConfigView::showAllAction;
-QAction *ConfigView::showPromptAction;
+Q3Action *ConfigView::showNormalAction;
+Q3Action *ConfigView::showAllAction;
+Q3Action *ConfigView::showPromptAction;
 
 ConfigView::ConfigView(QWidget* parent, const char *name)
 	: Parent(parent, name)
@@ -873,7 +888,7 @@ ConfigView::~ConfigView(void)
 	}
 }
 
-void ConfigView::setOptionMode(QAction *act)
+void ConfigView::setOptionMode(Q3Action *act)
 {
 	if (act == showNormalAction)
 		list->optMode = normalOpt;
@@ -914,7 +929,7 @@ void ConfigView::setShowData(bool b)
 
 void ConfigList::setAllOpen(bool open)
 {
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 
 	for (; it.current(); it++)
 		it.current()->setOpen(open);
@@ -937,7 +952,7 @@ void ConfigView::updateListAll(void)
 }
 
 ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
-	: Parent(parent, name), sym(0), menu(0)
+	: Parent(parent, name), sym(0), _menu(0)
 {
 	if (name) {
 		configSettings->beginGroup(name);
@@ -960,7 +975,7 @@ void ConfigInfoView::setShowDebug(bool b)
 {
 	if (_showDebug != b) {
 		_showDebug = b;
-		if (menu)
+		if (_menu)
 			menuInfo();
 		else if (sym)
 			symbolInfo();
@@ -970,11 +985,11 @@ void ConfigInfoView::setShowDebug(bool b)
 
 void ConfigInfoView::setInfo(struct menu *m)
 {
-	if (menu == m)
+	if (_menu == m)
 		return;
-	menu = m;
+	_menu = m;
 	sym = NULL;
-	if (!menu)
+	if (!_menu)
 		clear();
 	else
 		menuInfo();
@@ -1001,11 +1016,11 @@ void ConfigInfoView::menuInfo(void)
 	struct symbol* sym;
 	QString head, debug, help;
 
-	sym = menu->sym;
+	sym = _menu->sym;
 	if (sym) {
-		if (menu->prompt) {
+		if (_menu->prompt) {
 			head += "<big><b>";
-			head += print_filter(_(menu->prompt->text));
+			head += print_filter(_(_menu->prompt->text));
 			head += "</b></big>";
 			if (sym->name) {
 				head += " (";
@@ -1031,23 +1046,23 @@ void ConfigInfoView::menuInfo(void)
 			debug = debug_info(sym);
 
 		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));
 		str_free(&help_gstr);
-	} else if (menu->prompt) {
+	} else if (_menu->prompt) {
 		head += "<big><b>";
-		head += print_filter(_(menu->prompt->text));
+		head += print_filter(_(_menu->prompt->text));
 		head += "</b></big><br><br>";
 		if (showDebug()) {
-			if (menu->prompt->visible.expr) {
+			if (_menu->prompt->visible.expr) {
 				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>";
 			}
 		}
 	}
 	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);
 }
@@ -1150,10 +1165,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 		*text += str2;
 }
 
-QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
+Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
 {
-	QPopupMenu* popup = Parent::createPopupMenu(pos);
-	QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
+	Q3PopupMenu* popup = Parent::createPopupMenu(pos);
+	Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
 	  action->setToggleAction(TRUE);
 	  connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
 	  connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1210,7 +1225,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
 			y = configSettings->readNumEntry("/window y", 0, &ok);
 		if (ok)
 			move(x, y);
-		QValueList<int> sizes = configSettings->readSizes("/split", &ok);
+		Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
 		if (ok)
 			split->setSizes(sizes);
 		configSettings->endGroup();
@@ -1297,57 +1312,57 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configList->setFocus();
 
 	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()));
 	  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()));
-	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()));
-	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()));
 	conf_set_changed_callback(conf_changed);
 	// Set saveAction's initial state
 	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()));
-	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()));
-	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()));
-	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()));
-	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()));
 
-	QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
+	Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
 	  showNameAction->setToggleAction(TRUE);
 	  connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
 	  connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
 	  connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
 	  connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
 	  showDataAction->setOn(configList->showData);
 
-	QActionGroup *optGroup = new QActionGroup(this);
+	Q3ActionGroup *optGroup = new Q3ActionGroup(this);
 	optGroup->setExclusive(TRUE);
-	connect(optGroup, SIGNAL(selected(QAction *)), configView,
-		SLOT(setOptionMode(QAction *)));
-	connect(optGroup, SIGNAL(selected(QAction *)), menuView,
-		SLOT(setOptionMode(QAction *)));
-
-	configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup);
-	configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup);
-	configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup);
+	connect(optGroup, SIGNAL(selected(Q3Action *)), configView,
+		SLOT(setOptionMode(Q3Action *)));
+	connect(optGroup, SIGNAL(selected(Q3Action *)), menuView,
+		SLOT(setOptionMode(Q3Action *)));
+
+	configView->showNormalAction = new Q3Action(NULL, _("Show Normal Options"), 0, optGroup);
+	configView->showAllAction = new Q3Action(NULL, _("Show All Options"), 0, optGroup);
+	configView->showPromptAction = new Q3Action(NULL, _("Show Prompt Options"), 0, optGroup);
 	configView->showNormalAction->setToggleAction(TRUE);
 	configView->showNormalAction->setOn(configList->optMode == normalOpt);
 	configView->showAllAction->setToggleAction(TRUE);
@@ -1355,15 +1370,15 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configView->showPromptAction->setToggleAction(TRUE);
 	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);
 	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
 	  connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
 	  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()));
-	QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
+	Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
 	  connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
 
 	// init tool bar
@@ -1377,7 +1392,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 	fullViewAction->addTo(toolBar);
 
 	// create config menu
-	QPopupMenu* config = new QPopupMenu(this);
+	Q3PopupMenu* config = new Q3PopupMenu(this);
 	menu->insertItem(_("&File"), config);
 	loadAction->addTo(config);
 	saveAction->addTo(config);
@@ -1386,12 +1401,12 @@ ConfigMainWindow::ConfigMainWindow(void)
 	quitAction->addTo(config);
 
 	// create edit menu
-	QPopupMenu* editMenu = new QPopupMenu(this);
+	Q3PopupMenu* editMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Edit"), editMenu);
 	searchAction->addTo(editMenu);
 
 	// create options menu
-	QPopupMenu* optionMenu = new QPopupMenu(this);
+	Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Option"), optionMenu);
 	showNameAction->addTo(optionMenu);
 	showRangeAction->addTo(optionMenu);
@@ -1402,7 +1417,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 	showDebugAction->addTo(optionMenu);
 
 	// create help menu
-	QPopupMenu* helpMenu = new QPopupMenu(this);
+	Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
 	menu->insertSeparator();
 	menu->insertItem(_("&Help"), helpMenu);
 	showIntroAction->addTo(helpMenu);
@@ -1437,7 +1452,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 		showSplitView();
 
 	// UI setup done, restore splitter positions
-	QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
+	Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
 	if (ok)
 		split1->setSizes(sizes);
 
@@ -1448,7 +1463,7 @@ ConfigMainWindow::ConfigMainWindow(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())
 		return;
 	if (conf_read(QFile::encodeName(s)))
@@ -1464,7 +1479,7 @@ void ConfigMainWindow::saveConfig(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())
 		return;
 	if (conf_write(QFile::encodeName(s)))
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 636a74b..3a441e7 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,26 +3,26 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
+#ifdef USE_QT3
 #include <qlistview.h>
-#if QT_VERSION >= 300
-#include <qsettings.h>
 #else
-class QSettings {
-public:
-	void beginGroup(const QString& group) { }
-	void endGroup(void) { }
-	bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QStringList readListEntry(const QString& key, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return QStringList(); }
-	template <class t>
-	bool writeEntry(const QString& key, t value)
-	{ return TRUE; }
-};
+#include <q3listview.h>
+#endif
+#include <qsettings.h>
+
+#ifdef USE_QT3
+#define Q3ValueList             QValueList
+#define Q3PopupMenu             QPopupMenu
+#define Q3ListView              QListView
+#define Q3ListViewItem          QListViewItem
+#define Q3VBox                  QVBox
+#define Q3TextBrowser           QTextBrowser
+#define Q3MainWindow            QMainWindow
+#define Q3Action                QAction
+#define Q3ActionGroup           QActionGroup
+#define Q3ToolBar               QToolBar
+#define Q3ListViewItemIterator  QListViewItemIterator
+#define Q3FileDialog            QFileDialog
 #endif
 
 class ConfigView;
@@ -31,11 +31,10 @@ class ConfigItem;
 class ConfigLineEdit;
 class ConfigMainWindow;
 
-
 class ConfigSettings : public QSettings {
 public:
-	QValueList<int> readSizes(const QString& key, bool *ok);
-	bool writeSizes(const QString& key, const QValueList<int>& value);
+	Q3ValueList<int> readSizes(const QString& key, bool *ok);
+	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
 };
 
 enum colIdx {
@@ -48,9 +47,9 @@ enum optionMode {
 	normalOpt = 0, allOpt, promptOpt
 };
 
-class ConfigList : public QListView {
+class ConfigList : public Q3ListView {
 	Q_OBJECT
-	typedef class QListView Parent;
+	typedef class Q3ListView Parent;
 public:
 	ConfigList(ConfigView* p, const char *name = 0);
 	void reinit(void);
@@ -135,17 +134,17 @@ public:
 	struct menu *rootEntry;
 	QColorGroup disabledColorGroup;
 	QColorGroup inactivedColorGroup;
-	QPopupMenu* headerPopup;
+	Q3PopupMenu* headerPopup;
 
 private:
 	int colMap[colNr];
 	int colRevMap[colNr];
 };
 
-class ConfigItem : public QListViewItem {
-	typedef class QListViewItem Parent;
+class ConfigItem : public Q3ListViewItem {
+	typedef class Q3ListViewItem Parent;
 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)
 	{
 		init();
@@ -155,7 +154,7 @@ public:
 	{
 		init();
 	}
-	ConfigItem(QListView *parent, ConfigItem *after, bool v)
+	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
 	: Parent(parent, after), menu(0), visible(v), goParent(true)
 	{
 		init();
@@ -219,9 +218,9 @@ public:
 	ConfigItem *item;
 };
 
-class ConfigView : public QVBox {
+class ConfigView : public Q3VBox {
 	Q_OBJECT
-	typedef class QVBox Parent;
+	typedef class Q3VBox Parent;
 public:
 	ConfigView(QWidget* parent, const char *name = 0);
 	~ConfigView(void);
@@ -235,7 +234,7 @@ public slots:
 	void setShowName(bool);
 	void setShowRange(bool);
 	void setShowData(bool);
-	void setOptionMode(QAction *);
+	void setOptionMode(Q3Action *);
 signals:
 	void showNameChanged(bool);
 	void showRangeChanged(bool);
@@ -247,14 +246,14 @@ public:
 	static ConfigView* viewList;
 	ConfigView* nextView;
 
-	static QAction *showNormalAction;
-	static QAction *showAllAction;
-	static QAction *showPromptAction;
+	static Q3Action *showNormalAction;
+	static Q3Action *showAllAction;
+	static Q3Action *showPromptAction;
 };
 
-class ConfigInfoView : public QTextBrowser {
+class ConfigInfoView : public Q3TextBrowser {
 	Q_OBJECT
-	typedef class QTextBrowser Parent;
+	typedef class Q3TextBrowser Parent;
 public:
 	ConfigInfoView(QWidget* parent, const char *name = 0);
 	bool showDebug(void) const { return _showDebug; }
@@ -274,11 +273,11 @@ protected:
 	QString debug_info(struct symbol *sym);
 	static QString print_filter(const QString &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);
 
 	struct symbol *sym;
-	struct menu *menu;
+	struct menu *_menu;
 	bool _showDebug;
 };
 
@@ -302,10 +301,10 @@ protected:
 	struct symbol **result;
 };
 
-class ConfigMainWindow : public QMainWindow {
+class ConfigMainWindow : public Q3MainWindow {
 	Q_OBJECT
 
-	static QAction *saveAction;
+	static Q3Action *saveAction;
 	static void conf_changed(void);
 public:
 	ConfigMainWindow(void);
@@ -334,8 +333,8 @@ protected:
 	ConfigView *configView;
 	ConfigList *configList;
 	ConfigInfoView *helpText;
-	QToolBar *toolBar;
-	QAction *backAction;
+	Q3ToolBar *toolBar;
+	Q3Action *backAction;
 	QSplitter* split1;
 	QSplitter* split2;
 };
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v2] kconfig qconf: port to QT4
@ 2010-07-26 12:47             ` Michal Marek
  0 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2010-07-26 12:47 UTC (permalink / raw)
  To: Alexander Stein; +Cc: linux-kbuild, Roman Zippel, lkml

On Mon, Jul 26, 2010 at 02:44:56PM +0200, Michal Marek wrote:
> Other than that, I haven't found other issues with *your* patch, but
> when I merge it with 39a4897 (xconfig: add support to show hidden
> options which have prompts) and work around the above Makefile issue, I get
> [...]

For reference, here is the resulting patch I used:

From 99913f21e95a4da1b58a50321564c10ca567d498 Mon Sep 17 00:00:00 2001
From: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
Date: Tue, 13 Jul 2010 21:26:56 +0200
Subject: [PATCH] kconfig qconf: port to QT4

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

* rewritten makefile rules to detect QT4 by using qmake 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

Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
[mmarek: merged with 39a4897]
Signed-off-by: Michal Marek <mmarek@suse.cz>
---
 scripts/kconfig/Makefile |   78 ++++++++++++---------
 scripts/kconfig/qconf.cc |  167 +++++++++++++++++++++++++---------------------
 scripts/kconfig/qconf.h  |   83 +++++++++++------------
 3 files changed, 177 insertions(+), 151 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index f8d1ee3..755e7b3 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -233,40 +233,52 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
 # QT needs some extra effort...
 $(obj)/.tmp_qtcheck:
 	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
-	pkg-config --exists qt 2> /dev/null && pkg=qt; \
-	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
-	if [ -n "$$pkg" ]; then \
-	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
-	  libs="\$$(shell pkg-config $$pkg --libs)"; \
-	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
-	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	qmake=$(shell which qmake); \
+	if [ -z $$qmake ]; 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-mt 2> /dev/null && pkg=qt-mt; \
+	    if [ -n "$$pkg" ]; then \
+	      cflags="\$$(shell pkg-config $$pkg --cflags)"; \
+	      libs="\$$(shell pkg-config $$pkg --libs)"; \
+	      moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
+	      dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	    else \
+	      for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
+	        if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
+	      done; \
+	      if [ -z "$$dir" ]; then \
+	        echo "*"; \
+	        echo "* Unable to find any QT installation. Please make sure that"; \
+	        echo "* the QT4 or QT3 development package is correctly installed and"; \
+	        echo "* either qmake can be found or install pkg-config or set"; \
+	        echo "* the QTDIR environment variable to the correct location."; \
+	        echo "*"; \
+	        false; \
+	      fi; \
+	      libpath=$$dir/lib; lib=qt; osdir=""; \
+	      $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
+	        osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
+	      test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
+	      test -f $$libpath/libqt-mt.so && lib=qt-mt; \
+	      cflags="-I$$dir/include"; \
+	      libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
+	      moc="$$dir/bin/moc"; \
+	    fi; \
+	    if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
+	      echo "*"; \
+	      echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
+	      echo "*"; \
+	      moc="/usr/bin/moc"; \
+	    fi; \
+	    cflags="$$cflags -DUSE_QT3"; \
 	else \
-	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
-	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
-	  done; \
-	  if [ -z "$$dir" ]; then \
-	    echo "*"; \
-	    echo "* Unable to find the QT3 installation. Please make sure that"; \
-	    echo "* the QT3 development package is correctly installed and"; \
-	    echo "* either install pkg-config or set the QTDIR environment"; \
-	    echo "* variable to the correct location."; \
-	    echo "*"; \
-	    false; \
-	  fi; \
-	  libpath=$$dir/lib; lib=qt; osdir=""; \
-	  $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
-	    osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
-	  test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
-	  test -f $$libpath/libqt-mt.so && lib=qt-mt; \
-	  cflags="-I$$dir/include"; \
-	  libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
-	  moc="$$dir/bin/moc"; \
-	fi; \
-	if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
-	  echo "*"; \
-	  echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
-	  echo "*"; \
-	  moc="/usr/bin/moc"; \
+	  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_LIBS=$$libs" >> $@; \
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 820df2d..781da27 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -3,25 +3,40 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
-#include <qapplication.h>
+#ifdef USE_QT3
 #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 <qtoolbar.h>
 #include <qlayout.h>
-#include <qvbox.h>
 #include <qsplitter.h>
-#include <qlistview.h>
-#include <qtextbrowser.h>
 #include <qlineedit.h>
 #include <qlabel.h>
 #include <qpushbutton.h>
 #include <qmenubar.h>
 #include <qmessagebox.h>
-#include <qaction.h>
-#include <qheader.h>
-#include <qfiledialog.h>
-#include <qdragobject.h>
 #include <qregexp.h>
+#include <qevent.h>
 
 #include <stdlib.h>
 
@@ -39,7 +54,7 @@
 static QApplication *configApp;
 static ConfigSettings *configSettings;
 
-QAction *ConfigMainWindow::saveAction;
+Q3Action *ConfigMainWindow::saveAction;
 
 static inline QString qgettext(const char* str)
 {
@@ -54,9 +69,9 @@ static inline QString qgettext(const QString& str)
 /**
  * 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::Iterator it;
 
@@ -69,10 +84,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
 /**
  * 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;
-	QValueList<int>::ConstIterator it;
+	Q3ValueList<int>::ConstIterator it;
 
 	for (it = value.begin(); it != value.end(); ++it)
 		stringList.push_back(QString::number(*it));
@@ -432,7 +447,7 @@ void ConfigList::updateList(ConfigItem* item)
 	if (!rootEntry) {
 		if (mode != listMode)
 			goto update;
-		QListViewItemIterator it(this);
+		Q3ListViewItemIterator it(this);
 		ConfigItem* item;
 
 		for (; it.current(); ++it) {
@@ -563,7 +578,7 @@ void ConfigList::setParentMenu(void)
 		return;
 	setRootMenu(menu_get_parent_menu(rootEntry->parent));
 
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 	for (; (item = (ConfigItem*)it.current()); it++) {
 		if (item->menu == oldroot) {
 			setCurrentItem(item);
@@ -645,7 +660,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
 
 void ConfigList::keyPressEvent(QKeyEvent* ev)
 {
-	QListViewItem* i = currentItem();
+	Q3ListViewItem* i = currentItem();
 	ConfigItem* item;
 	struct menu *menu;
 	enum prop_type type;
@@ -811,10 +826,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 {
 	if (e->y() <= header()->geometry().bottom()) {
 		if (!headerPopup) {
-			QAction *action;
+			Q3Action *action;
 
-			headerPopup = new QPopupMenu(this);
-			action = new QAction(NULL, _("Show Name"), 0, this);
+			headerPopup = new Q3PopupMenu(this);
+			action = new Q3Action(NULL, _("Show Name"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowName(bool)));
@@ -822,7 +837,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showName);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Range"), 0, this);
+			action = new Q3Action(NULL, _("Show Range"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowRange(bool)));
@@ -830,7 +845,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showRange);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Data"), 0, this);
+			action = new Q3Action(NULL, _("Show Data"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowData(bool)));
@@ -846,9 +861,9 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 }
 
 ConfigView*ConfigView::viewList;
-QAction *ConfigView::showNormalAction;
-QAction *ConfigView::showAllAction;
-QAction *ConfigView::showPromptAction;
+Q3Action *ConfigView::showNormalAction;
+Q3Action *ConfigView::showAllAction;
+Q3Action *ConfigView::showPromptAction;
 
 ConfigView::ConfigView(QWidget* parent, const char *name)
 	: Parent(parent, name)
@@ -873,7 +888,7 @@ ConfigView::~ConfigView(void)
 	}
 }
 
-void ConfigView::setOptionMode(QAction *act)
+void ConfigView::setOptionMode(Q3Action *act)
 {
 	if (act == showNormalAction)
 		list->optMode = normalOpt;
@@ -914,7 +929,7 @@ void ConfigView::setShowData(bool b)
 
 void ConfigList::setAllOpen(bool open)
 {
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 
 	for (; it.current(); it++)
 		it.current()->setOpen(open);
@@ -937,7 +952,7 @@ void ConfigView::updateListAll(void)
 }
 
 ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
-	: Parent(parent, name), sym(0), menu(0)
+	: Parent(parent, name), sym(0), _menu(0)
 {
 	if (name) {
 		configSettings->beginGroup(name);
@@ -960,7 +975,7 @@ void ConfigInfoView::setShowDebug(bool b)
 {
 	if (_showDebug != b) {
 		_showDebug = b;
-		if (menu)
+		if (_menu)
 			menuInfo();
 		else if (sym)
 			symbolInfo();
@@ -970,11 +985,11 @@ void ConfigInfoView::setShowDebug(bool b)
 
 void ConfigInfoView::setInfo(struct menu *m)
 {
-	if (menu == m)
+	if (_menu == m)
 		return;
-	menu = m;
+	_menu = m;
 	sym = NULL;
-	if (!menu)
+	if (!_menu)
 		clear();
 	else
 		menuInfo();
@@ -1001,11 +1016,11 @@ void ConfigInfoView::menuInfo(void)
 	struct symbol* sym;
 	QString head, debug, help;
 
-	sym = menu->sym;
+	sym = _menu->sym;
 	if (sym) {
-		if (menu->prompt) {
+		if (_menu->prompt) {
 			head += "<big><b>";
-			head += print_filter(_(menu->prompt->text));
+			head += print_filter(_(_menu->prompt->text));
 			head += "</b></big>";
 			if (sym->name) {
 				head += " (";
@@ -1031,23 +1046,23 @@ void ConfigInfoView::menuInfo(void)
 			debug = debug_info(sym);
 
 		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));
 		str_free(&help_gstr);
-	} else if (menu->prompt) {
+	} else if (_menu->prompt) {
 		head += "<big><b>";
-		head += print_filter(_(menu->prompt->text));
+		head += print_filter(_(_menu->prompt->text));
 		head += "</b></big><br><br>";
 		if (showDebug()) {
-			if (menu->prompt->visible.expr) {
+			if (_menu->prompt->visible.expr) {
 				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>";
 			}
 		}
 	}
 	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);
 }
@@ -1150,10 +1165,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 		*text += str2;
 }
 
-QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
+Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
 {
-	QPopupMenu* popup = Parent::createPopupMenu(pos);
-	QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
+	Q3PopupMenu* popup = Parent::createPopupMenu(pos);
+	Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
 	  action->setToggleAction(TRUE);
 	  connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
 	  connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1210,7 +1225,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
 			y = configSettings->readNumEntry("/window y", 0, &ok);
 		if (ok)
 			move(x, y);
-		QValueList<int> sizes = configSettings->readSizes("/split", &ok);
+		Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
 		if (ok)
 			split->setSizes(sizes);
 		configSettings->endGroup();
@@ -1297,57 +1312,57 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configList->setFocus();
 
 	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()));
 	  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()));
-	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()));
-	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()));
 	conf_set_changed_callback(conf_changed);
 	// Set saveAction's initial state
 	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()));
-	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()));
-	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()));
-	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()));
-	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()));
 
-	QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
+	Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
 	  showNameAction->setToggleAction(TRUE);
 	  connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
 	  connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
 	  connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
 	  connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
 	  showDataAction->setOn(configList->showData);
 
-	QActionGroup *optGroup = new QActionGroup(this);
+	Q3ActionGroup *optGroup = new Q3ActionGroup(this);
 	optGroup->setExclusive(TRUE);
-	connect(optGroup, SIGNAL(selected(QAction *)), configView,
-		SLOT(setOptionMode(QAction *)));
-	connect(optGroup, SIGNAL(selected(QAction *)), menuView,
-		SLOT(setOptionMode(QAction *)));
-
-	configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup);
-	configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup);
-	configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup);
+	connect(optGroup, SIGNAL(selected(Q3Action *)), configView,
+		SLOT(setOptionMode(Q3Action *)));
+	connect(optGroup, SIGNAL(selected(Q3Action *)), menuView,
+		SLOT(setOptionMode(Q3Action *)));
+
+	configView->showNormalAction = new Q3Action(NULL, _("Show Normal Options"), 0, optGroup);
+	configView->showAllAction = new Q3Action(NULL, _("Show All Options"), 0, optGroup);
+	configView->showPromptAction = new Q3Action(NULL, _("Show Prompt Options"), 0, optGroup);
 	configView->showNormalAction->setToggleAction(TRUE);
 	configView->showNormalAction->setOn(configList->optMode == normalOpt);
 	configView->showAllAction->setToggleAction(TRUE);
@@ -1355,15 +1370,15 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configView->showPromptAction->setToggleAction(TRUE);
 	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);
 	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
 	  connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
 	  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()));
-	QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
+	Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
 	  connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
 
 	// init tool bar
@@ -1377,7 +1392,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 	fullViewAction->addTo(toolBar);
 
 	// create config menu
-	QPopupMenu* config = new QPopupMenu(this);
+	Q3PopupMenu* config = new Q3PopupMenu(this);
 	menu->insertItem(_("&File"), config);
 	loadAction->addTo(config);
 	saveAction->addTo(config);
@@ -1386,12 +1401,12 @@ ConfigMainWindow::ConfigMainWindow(void)
 	quitAction->addTo(config);
 
 	// create edit menu
-	QPopupMenu* editMenu = new QPopupMenu(this);
+	Q3PopupMenu* editMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Edit"), editMenu);
 	searchAction->addTo(editMenu);
 
 	// create options menu
-	QPopupMenu* optionMenu = new QPopupMenu(this);
+	Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Option"), optionMenu);
 	showNameAction->addTo(optionMenu);
 	showRangeAction->addTo(optionMenu);
@@ -1402,7 +1417,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 	showDebugAction->addTo(optionMenu);
 
 	// create help menu
-	QPopupMenu* helpMenu = new QPopupMenu(this);
+	Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
 	menu->insertSeparator();
 	menu->insertItem(_("&Help"), helpMenu);
 	showIntroAction->addTo(helpMenu);
@@ -1437,7 +1452,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 		showSplitView();
 
 	// UI setup done, restore splitter positions
-	QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
+	Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
 	if (ok)
 		split1->setSizes(sizes);
 
@@ -1448,7 +1463,7 @@ ConfigMainWindow::ConfigMainWindow(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())
 		return;
 	if (conf_read(QFile::encodeName(s)))
@@ -1464,7 +1479,7 @@ void ConfigMainWindow::saveConfig(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())
 		return;
 	if (conf_write(QFile::encodeName(s)))
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 636a74b..3a441e7 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,26 +3,26 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
+#ifdef USE_QT3
 #include <qlistview.h>
-#if QT_VERSION >= 300
-#include <qsettings.h>
 #else
-class QSettings {
-public:
-	void beginGroup(const QString& group) { }
-	void endGroup(void) { }
-	bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QStringList readListEntry(const QString& key, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return QStringList(); }
-	template <class t>
-	bool writeEntry(const QString& key, t value)
-	{ return TRUE; }
-};
+#include <q3listview.h>
+#endif
+#include <qsettings.h>
+
+#ifdef USE_QT3
+#define Q3ValueList             QValueList
+#define Q3PopupMenu             QPopupMenu
+#define Q3ListView              QListView
+#define Q3ListViewItem          QListViewItem
+#define Q3VBox                  QVBox
+#define Q3TextBrowser           QTextBrowser
+#define Q3MainWindow            QMainWindow
+#define Q3Action                QAction
+#define Q3ActionGroup           QActionGroup
+#define Q3ToolBar               QToolBar
+#define Q3ListViewItemIterator  QListViewItemIterator
+#define Q3FileDialog            QFileDialog
 #endif
 
 class ConfigView;
@@ -31,11 +31,10 @@ class ConfigItem;
 class ConfigLineEdit;
 class ConfigMainWindow;
 
-
 class ConfigSettings : public QSettings {
 public:
-	QValueList<int> readSizes(const QString& key, bool *ok);
-	bool writeSizes(const QString& key, const QValueList<int>& value);
+	Q3ValueList<int> readSizes(const QString& key, bool *ok);
+	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
 };
 
 enum colIdx {
@@ -48,9 +47,9 @@ enum optionMode {
 	normalOpt = 0, allOpt, promptOpt
 };
 
-class ConfigList : public QListView {
+class ConfigList : public Q3ListView {
 	Q_OBJECT
-	typedef class QListView Parent;
+	typedef class Q3ListView Parent;
 public:
 	ConfigList(ConfigView* p, const char *name = 0);
 	void reinit(void);
@@ -135,17 +134,17 @@ public:
 	struct menu *rootEntry;
 	QColorGroup disabledColorGroup;
 	QColorGroup inactivedColorGroup;
-	QPopupMenu* headerPopup;
+	Q3PopupMenu* headerPopup;
 
 private:
 	int colMap[colNr];
 	int colRevMap[colNr];
 };
 
-class ConfigItem : public QListViewItem {
-	typedef class QListViewItem Parent;
+class ConfigItem : public Q3ListViewItem {
+	typedef class Q3ListViewItem Parent;
 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)
 	{
 		init();
@@ -155,7 +154,7 @@ public:
 	{
 		init();
 	}
-	ConfigItem(QListView *parent, ConfigItem *after, bool v)
+	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
 	: Parent(parent, after), menu(0), visible(v), goParent(true)
 	{
 		init();
@@ -219,9 +218,9 @@ public:
 	ConfigItem *item;
 };
 
-class ConfigView : public QVBox {
+class ConfigView : public Q3VBox {
 	Q_OBJECT
-	typedef class QVBox Parent;
+	typedef class Q3VBox Parent;
 public:
 	ConfigView(QWidget* parent, const char *name = 0);
 	~ConfigView(void);
@@ -235,7 +234,7 @@ public slots:
 	void setShowName(bool);
 	void setShowRange(bool);
 	void setShowData(bool);
-	void setOptionMode(QAction *);
+	void setOptionMode(Q3Action *);
 signals:
 	void showNameChanged(bool);
 	void showRangeChanged(bool);
@@ -247,14 +246,14 @@ public:
 	static ConfigView* viewList;
 	ConfigView* nextView;
 
-	static QAction *showNormalAction;
-	static QAction *showAllAction;
-	static QAction *showPromptAction;
+	static Q3Action *showNormalAction;
+	static Q3Action *showAllAction;
+	static Q3Action *showPromptAction;
 };
 
-class ConfigInfoView : public QTextBrowser {
+class ConfigInfoView : public Q3TextBrowser {
 	Q_OBJECT
-	typedef class QTextBrowser Parent;
+	typedef class Q3TextBrowser Parent;
 public:
 	ConfigInfoView(QWidget* parent, const char *name = 0);
 	bool showDebug(void) const { return _showDebug; }
@@ -274,11 +273,11 @@ protected:
 	QString debug_info(struct symbol *sym);
 	static QString print_filter(const QString &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);
 
 	struct symbol *sym;
-	struct menu *menu;
+	struct menu *_menu;
 	bool _showDebug;
 };
 
@@ -302,10 +301,10 @@ protected:
 	struct symbol **result;
 };
 
-class ConfigMainWindow : public QMainWindow {
+class ConfigMainWindow : public Q3MainWindow {
 	Q_OBJECT
 
-	static QAction *saveAction;
+	static Q3Action *saveAction;
 	static void conf_changed(void);
 public:
 	ConfigMainWindow(void);
@@ -334,8 +333,8 @@ protected:
 	ConfigView *configView;
 	ConfigList *configList;
 	ConfigInfoView *helpText;
-	QToolBar *toolBar;
-	QAction *backAction;
+	Q3ToolBar *toolBar;
+	Q3Action *backAction;
 	QSplitter* split1;
 	QSplitter* split2;
 };
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCHi v3] kconfig qconf: port to QT4
  2010-07-26 12:44         ` Michal Marek
  2010-07-26 12:47             ` Michal Marek
@ 2010-07-30 11:15           ` Alexander Stein
  2010-08-01 14:32             ` Ed Tomlinson
  2010-08-02 21:29             ` [PATCHi v3] kconfig qconf: port to QT4 Michal Marek
  1 sibling, 2 replies; 20+ messages in thread
From: Alexander Stein @ 2010-07-30 11:15 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kbuild, Roman Zippel, lkml, Alexander Stein

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

* rewritten makefile rules to detect QT4 by using qmake 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 39a4897c1bb66e8a36043c105d7fd73d8b32b480
  are use in native API

Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
---
Changes in v2:
* Use QT3 as fallback if no QT4 is available
* Rename class names using defines for QT3

Changes in v3:
* based on git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git
  kconfig branch
* Proper support for hidden options from 39a4897c1bb
* slightly rework Makefile detection to use pkg-config for QT4 detection
* Removed USE_QT3 usage, use QT_VERSION instead
* Drop QT2 support

Michael,

i kept using Q3Foo classes and redefine them to QFoo instead of the other way
around, as defining QFoo to Q3Foo doesn't work here.

 scripts/kconfig/Makefile |   77 +++++++++++++---------
 scripts/kconfig/qconf.cc |  162 +++++++++++++++++++++++++---------------------
 scripts/kconfig/qconf.h  |   76 ++++++++++-----------
 3 files changed, 169 insertions(+), 146 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index f8d1ee3..a203a90 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -233,40 +233,51 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
 # QT needs some extra effort...
 $(obj)/.tmp_qtcheck:
 	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
-	pkg-config --exists qt 2> /dev/null && pkg=qt; \
-	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
-	if [ -n "$$pkg" ]; then \
-	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
-	  libs="\$$(shell pkg-config $$pkg --libs)"; \
-	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
-	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	pkg-config --exists QtCore 2> /dev/null; \
+	if [ ! $? ]; 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-mt 2> /dev/null && pkg=qt-mt; \
+	    if [ -n "$$pkg" ]; then \
+	      cflags="\$$(shell pkg-config $$pkg --cflags)"; \
+	      libs="\$$(shell pkg-config $$pkg --libs)"; \
+	      moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
+	      dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	    else \
+	      for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
+	        if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
+	      done; \
+	      if [ -z "$$dir" ]; then \
+	        echo "*"; \
+	        echo "* Unable to find any QT installation. Please make sure that"; \
+	        echo "* the QT4 or QT3 development package is correctly installed and"; \
+	        echo "* either qmake can be found or install pkg-config or set"; \
+	        echo "* the QTDIR environment variable to the correct location."; \
+	        echo "*"; \
+	        false; \
+	      fi; \
+	      libpath=$$dir/lib; lib=qt; osdir=""; \
+	      $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
+	        osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
+	      test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
+	      test -f $$libpath/libqt-mt.so && lib=qt-mt; \
+	      cflags="-I$$dir/include"; \
+	      libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
+	      moc="$$dir/bin/moc"; \
+	    fi; \
+	    if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
+	      echo "*"; \
+	      echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
+	      echo "*"; \
+	      moc="/usr/bin/moc"; \
+	    fi; \
 	else \
-	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
-	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
-	  done; \
-	  if [ -z "$$dir" ]; then \
-	    echo "*"; \
-	    echo "* Unable to find the QT3 installation. Please make sure that"; \
-	    echo "* the QT3 development package is correctly installed and"; \
-	    echo "* either install pkg-config or set the QTDIR environment"; \
-	    echo "* variable to the correct location."; \
-	    echo "*"; \
-	    false; \
-	  fi; \
-	  libpath=$$dir/lib; lib=qt; osdir=""; \
-	  $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
-	    osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
-	  test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
-	  test -f $$libpath/libqt-mt.so && lib=qt-mt; \
-	  cflags="-I$$dir/include"; \
-	  libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
-	  moc="$$dir/bin/moc"; \
-	fi; \
-	if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
-	  echo "*"; \
-	  echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
-	  echo "*"; \
-	  moc="/usr/bin/moc"; \
+	  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_LIBS=$$libs" >> $@; \
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 820df2d..88d3874 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -3,25 +3,42 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
-#include <qapplication.h>
+#include <qglobal.h>
+
+#if QT_VERSION < 0x040000
 #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 <qtoolbar.h>
 #include <qlayout.h>
-#include <qvbox.h>
 #include <qsplitter.h>
-#include <qlistview.h>
-#include <qtextbrowser.h>
 #include <qlineedit.h>
 #include <qlabel.h>
 #include <qpushbutton.h>
 #include <qmenubar.h>
 #include <qmessagebox.h>
-#include <qaction.h>
-#include <qheader.h>
-#include <qfiledialog.h>
-#include <qdragobject.h>
 #include <qregexp.h>
+#include <qevent.h>
 
 #include <stdlib.h>
 
@@ -39,7 +56,7 @@
 static QApplication *configApp;
 static ConfigSettings *configSettings;
 
-QAction *ConfigMainWindow::saveAction;
+Q3Action *ConfigMainWindow::saveAction;
 
 static inline QString qgettext(const char* str)
 {
@@ -54,9 +71,9 @@ static inline QString qgettext(const QString& str)
 /**
  * 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::Iterator it;
 
@@ -69,10 +86,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
 /**
  * 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;
-	QValueList<int>::ConstIterator it;
+	Q3ValueList<int>::ConstIterator it;
 
 	for (it = value.begin(); it != value.end(); ++it)
 		stringList.push_back(QString::number(*it));
@@ -80,7 +97,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value
 }
 
 
-#if QT_VERSION >= 300
 /*
  * set the new data
  * TODO check the value
@@ -91,7 +107,6 @@ void ConfigItem::okRename(int col)
 	sym_set_string_value(menu->sym, text(dataColIdx).latin1());
 	listView()->updateList(this);
 }
-#endif
 
 /*
  * update the displayed of a menu entry
@@ -195,11 +210,9 @@ void ConfigItem::updateMenu(void)
 
 		data = sym_get_string_value(sym);
 
-#if QT_VERSION >= 300
 		int i = list->mapIdx(dataColIdx);
 		if (i >= 0)
 			setRenameEnabled(i, TRUE);
-#endif
 		setText(dataColIdx, data);
 		if (type == S_STRING)
 			prompt = QString("%1: %2").arg(prompt).arg(data);
@@ -432,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item)
 	if (!rootEntry) {
 		if (mode != listMode)
 			goto update;
-		QListViewItemIterator it(this);
+		Q3ListViewItemIterator it(this);
 		ConfigItem* item;
 
 		for (; it.current(); ++it) {
@@ -527,11 +540,9 @@ void ConfigList::changeValue(ConfigItem* item)
 	case S_INT:
 	case S_HEX:
 	case S_STRING:
-#if QT_VERSION >= 300
 		if (colMap[dataColIdx] >= 0)
 			item->startRename(colMap[dataColIdx]);
 		else
-#endif
 			parent()->lineEdit->show(item);
 		break;
 	}
@@ -563,7 +574,7 @@ void ConfigList::setParentMenu(void)
 		return;
 	setRootMenu(menu_get_parent_menu(rootEntry->parent));
 
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 	for (; (item = (ConfigItem*)it.current()); it++) {
 		if (item->menu == oldroot) {
 			setCurrentItem(item);
@@ -645,7 +656,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
 
 void ConfigList::keyPressEvent(QKeyEvent* ev)
 {
-	QListViewItem* i = currentItem();
+	Q3ListViewItem* i = currentItem();
 	ConfigItem* item;
 	struct menu *menu;
 	enum prop_type type;
@@ -811,10 +822,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 {
 	if (e->y() <= header()->geometry().bottom()) {
 		if (!headerPopup) {
-			QAction *action;
+			Q3Action *action;
 
-			headerPopup = new QPopupMenu(this);
-			action = new QAction(NULL, _("Show Name"), 0, this);
+			headerPopup = new Q3PopupMenu(this);
+			action = new Q3Action(NULL, _("Show Name"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowName(bool)));
@@ -822,7 +833,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showName);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Range"), 0, this);
+			action = new Q3Action(NULL, _("Show Range"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowRange(bool)));
@@ -830,7 +841,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showRange);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Data"), 0, this);
+			action = new Q3Action(NULL, _("Show Data"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowData(bool)));
@@ -914,7 +925,7 @@ void ConfigView::setShowData(bool b)
 
 void ConfigList::setAllOpen(bool open)
 {
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 
 	for (; it.current(); it++)
 		it.current()->setOpen(open);
@@ -937,7 +948,7 @@ void ConfigView::updateListAll(void)
 }
 
 ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
-	: Parent(parent, name), sym(0), menu(0)
+	: Parent(parent, name), sym(0), _menu(0)
 {
 	if (name) {
 		configSettings->beginGroup(name);
@@ -960,7 +971,7 @@ void ConfigInfoView::setShowDebug(bool b)
 {
 	if (_showDebug != b) {
 		_showDebug = b;
-		if (menu)
+		if (_menu)
 			menuInfo();
 		else if (sym)
 			symbolInfo();
@@ -970,11 +981,11 @@ void ConfigInfoView::setShowDebug(bool b)
 
 void ConfigInfoView::setInfo(struct menu *m)
 {
-	if (menu == m)
+	if (_menu == m)
 		return;
-	menu = m;
+	_menu = m;
 	sym = NULL;
-	if (!menu)
+	if (!_menu)
 		clear();
 	else
 		menuInfo();
@@ -1001,11 +1012,11 @@ void ConfigInfoView::menuInfo(void)
 	struct symbol* sym;
 	QString head, debug, help;
 
-	sym = menu->sym;
+	sym = _menu->sym;
 	if (sym) {
-		if (menu->prompt) {
+		if (_menu->prompt) {
 			head += "<big><b>";
-			head += print_filter(_(menu->prompt->text));
+			head += print_filter(_(_menu->prompt->text));
 			head += "</b></big>";
 			if (sym->name) {
 				head += " (";
@@ -1031,23 +1042,23 @@ void ConfigInfoView::menuInfo(void)
 			debug = debug_info(sym);
 
 		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));
 		str_free(&help_gstr);
-	} else if (menu->prompt) {
+	} else if (_menu->prompt) {
 		head += "<big><b>";
-		head += print_filter(_(menu->prompt->text));
+		head += print_filter(_(_menu->prompt->text));
 		head += "</b></big><br><br>";
 		if (showDebug()) {
-			if (menu->prompt->visible.expr) {
+			if (_menu->prompt->visible.expr) {
 				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>";
 			}
 		}
 	}
 	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);
 }
@@ -1150,10 +1161,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 		*text += str2;
 }
 
-QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
+Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
 {
-	QPopupMenu* popup = Parent::createPopupMenu(pos);
-	QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
+	Q3PopupMenu* popup = Parent::createPopupMenu(pos);
+	Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
 	  action->setToggleAction(TRUE);
 	  connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
 	  connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1210,7 +1221,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
 			y = configSettings->readNumEntry("/window y", 0, &ok);
 		if (ok)
 			move(x, y);
-		QValueList<int> sizes = configSettings->readSizes("/split", &ok);
+		Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
 		if (ok)
 			split->setSizes(sizes);
 		configSettings->endGroup();
@@ -1297,42 +1308,42 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configList->setFocus();
 
 	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()));
 	  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()));
-	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()));
-	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()));
 	conf_set_changed_callback(conf_changed);
 	// Set saveAction's initial state
 	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()));
-	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()));
-	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()));
-	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()));
-	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()));
 
-	QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
+	Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
 	  showNameAction->setToggleAction(TRUE);
 	  connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
 	  connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
 	  connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
 	  connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
@@ -1345,9 +1356,15 @@ ConfigMainWindow::ConfigMainWindow(void)
 	connect(optGroup, SIGNAL(selected(QAction *)), menuView,
 		SLOT(setOptionMode(QAction *)));
 
-	configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup);
-	configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup);
-	configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup);
+#if QT_VERSION >= 0x040000
+	configView->showNormalAction = new QAction(_("Show Normal Options"), 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->setOn(configList->optMode == normalOpt);
 	configView->showAllAction->setToggleAction(TRUE);
@@ -1355,15 +1372,15 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configView->showPromptAction->setToggleAction(TRUE);
 	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);
 	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
 	  connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
 	  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()));
-	QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
+	Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
 	  connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
 
 	// init tool bar
@@ -1377,7 +1394,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 	fullViewAction->addTo(toolBar);
 
 	// create config menu
-	QPopupMenu* config = new QPopupMenu(this);
+	Q3PopupMenu* config = new Q3PopupMenu(this);
 	menu->insertItem(_("&File"), config);
 	loadAction->addTo(config);
 	saveAction->addTo(config);
@@ -1386,12 +1403,12 @@ ConfigMainWindow::ConfigMainWindow(void)
 	quitAction->addTo(config);
 
 	// create edit menu
-	QPopupMenu* editMenu = new QPopupMenu(this);
+	Q3PopupMenu* editMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Edit"), editMenu);
 	searchAction->addTo(editMenu);
 
 	// create options menu
-	QPopupMenu* optionMenu = new QPopupMenu(this);
+	Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Option"), optionMenu);
 	showNameAction->addTo(optionMenu);
 	showRangeAction->addTo(optionMenu);
@@ -1399,10 +1416,9 @@ ConfigMainWindow::ConfigMainWindow(void)
 	optionMenu->insertSeparator();
 	optGroup->addTo(optionMenu);
 	optionMenu->insertSeparator();
-	showDebugAction->addTo(optionMenu);
 
 	// create help menu
-	QPopupMenu* helpMenu = new QPopupMenu(this);
+	Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
 	menu->insertSeparator();
 	menu->insertItem(_("&Help"), helpMenu);
 	showIntroAction->addTo(helpMenu);
@@ -1437,7 +1453,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 		showSplitView();
 
 	// UI setup done, restore splitter positions
-	QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
+	Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
 	if (ok)
 		split1->setSizes(sizes);
 
@@ -1448,7 +1464,7 @@ ConfigMainWindow::ConfigMainWindow(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())
 		return;
 	if (conf_read(QFile::encodeName(s)))
@@ -1464,7 +1480,7 @@ void ConfigMainWindow::saveConfig(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())
 		return;
 	if (conf_write(QFile::encodeName(s)))
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 636a74b..91677d9 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,26 +3,25 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
+#if QT_VERSION < 0x040000
 #include <qlistview.h>
-#if QT_VERSION >= 300
-#include <qsettings.h>
 #else
-class QSettings {
-public:
-	void beginGroup(const QString& group) { }
-	void endGroup(void) { }
-	bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QStringList readListEntry(const QString& key, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return QStringList(); }
-	template <class t>
-	bool writeEntry(const QString& key, t value)
-	{ return TRUE; }
-};
+#include <q3listview.h>
+#endif
+#include <qsettings.h>
+
+#if QT_VERSION < 0x040000
+#define Q3ValueList             QValueList
+#define Q3PopupMenu             QPopupMenu
+#define Q3ListView              QListView
+#define Q3ListViewItem          QListViewItem
+#define Q3VBox                  QVBox
+#define Q3TextBrowser           QTextBrowser
+#define Q3MainWindow            QMainWindow
+#define Q3Action                QAction
+#define Q3ToolBar               QToolBar
+#define Q3ListViewItemIterator  QListViewItemIterator
+#define Q3FileDialog            QFileDialog
 #endif
 
 class ConfigView;
@@ -31,11 +30,10 @@ class ConfigItem;
 class ConfigLineEdit;
 class ConfigMainWindow;
 
-
 class ConfigSettings : public QSettings {
 public:
-	QValueList<int> readSizes(const QString& key, bool *ok);
-	bool writeSizes(const QString& key, const QValueList<int>& value);
+	Q3ValueList<int> readSizes(const QString& key, bool *ok);
+	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
 };
 
 enum colIdx {
@@ -48,9 +46,9 @@ enum optionMode {
 	normalOpt = 0, allOpt, promptOpt
 };
 
-class ConfigList : public QListView {
+class ConfigList : public Q3ListView {
 	Q_OBJECT
-	typedef class QListView Parent;
+	typedef class Q3ListView Parent;
 public:
 	ConfigList(ConfigView* p, const char *name = 0);
 	void reinit(void);
@@ -135,17 +133,17 @@ public:
 	struct menu *rootEntry;
 	QColorGroup disabledColorGroup;
 	QColorGroup inactivedColorGroup;
-	QPopupMenu* headerPopup;
+	Q3PopupMenu* headerPopup;
 
 private:
 	int colMap[colNr];
 	int colRevMap[colNr];
 };
 
-class ConfigItem : public QListViewItem {
-	typedef class QListViewItem Parent;
+class ConfigItem : public Q3ListViewItem {
+	typedef class Q3ListViewItem Parent;
 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)
 	{
 		init();
@@ -155,16 +153,14 @@ public:
 	{
 		init();
 	}
-	ConfigItem(QListView *parent, ConfigItem *after, bool v)
+	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
 	: Parent(parent, after), menu(0), visible(v), goParent(true)
 	{
 		init();
 	}
 	~ConfigItem(void);
 	void init(void);
-#if QT_VERSION >= 300
 	void okRename(int col);
-#endif
 	void updateMenu(void);
 	void testUpdateMenu(bool v);
 	ConfigList* listView() const
@@ -219,9 +215,9 @@ public:
 	ConfigItem *item;
 };
 
-class ConfigView : public QVBox {
+class ConfigView : public Q3VBox {
 	Q_OBJECT
-	typedef class QVBox Parent;
+	typedef class Q3VBox Parent;
 public:
 	ConfigView(QWidget* parent, const char *name = 0);
 	~ConfigView(void);
@@ -252,9 +248,9 @@ public:
 	static QAction *showPromptAction;
 };
 
-class ConfigInfoView : public QTextBrowser {
+class ConfigInfoView : public Q3TextBrowser {
 	Q_OBJECT
-	typedef class QTextBrowser Parent;
+	typedef class Q3TextBrowser Parent;
 public:
 	ConfigInfoView(QWidget* parent, const char *name = 0);
 	bool showDebug(void) const { return _showDebug; }
@@ -274,11 +270,11 @@ protected:
 	QString debug_info(struct symbol *sym);
 	static QString print_filter(const QString &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);
 
 	struct symbol *sym;
-	struct menu *menu;
+	struct menu *_menu;
 	bool _showDebug;
 };
 
@@ -302,10 +298,10 @@ protected:
 	struct symbol **result;
 };
 
-class ConfigMainWindow : public QMainWindow {
+class ConfigMainWindow : public Q3MainWindow {
 	Q_OBJECT
 
-	static QAction *saveAction;
+	static Q3Action *saveAction;
 	static void conf_changed(void);
 public:
 	ConfigMainWindow(void);
@@ -334,8 +330,8 @@ protected:
 	ConfigView *configView;
 	ConfigList *configList;
 	ConfigInfoView *helpText;
-	QToolBar *toolBar;
-	QAction *backAction;
+	Q3ToolBar *toolBar;
+	Q3Action *backAction;
 	QSplitter* split1;
 	QSplitter* split2;
 };
-- 
1.7.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCHi v3] kconfig qconf: port to QT4
  2010-07-30 11:15           ` [PATCHi v3] " Alexander Stein
@ 2010-08-01 14:32             ` Ed Tomlinson
  2010-08-01 19:28               ` [PATCH] " Alexander Stein
  2010-08-02 21:29             ` [PATCHi v3] kconfig qconf: port to QT4 Michal Marek
  1 sibling, 1 reply; 20+ messages in thread
From: Ed Tomlinson @ 2010-08-01 14:32 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Michal Marek, linux-kbuild, Roman Zippel, lkml

Hi,

Would you have a version of this that applies to 35-rc6 ?

I dearly miss kconfig and now even xconfig is trying to use qt3 which
does not exist here.

TIA
Ed Tomlinson

On Friday 30 July 2010 07:15:17 Alexander Stein wrote:
> A straight forward port to QT4 using qt3to4 and compiling against
>   qt3support
> 
> * rewritten makefile rules to detect QT4 by using qmake 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 39a4897c1bb66e8a36043c105d7fd73d8b32b480
>   are use in native API
> 
> Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
> ---
> Changes in v2:
> * Use QT3 as fallback if no QT4 is available
> * Rename class names using defines for QT3
> 
> Changes in v3:
> * based on git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git
>   kconfig branch
> * Proper support for hidden options from 39a4897c1bb
> * slightly rework Makefile detection to use pkg-config for QT4 detection
> * Removed USE_QT3 usage, use QT_VERSION instead
> * Drop QT2 support
> 
> Michael,
> 
> i kept using Q3Foo classes and redefine them to QFoo instead of the other way
> around, as defining QFoo to Q3Foo doesn't work here.
> 
>  scripts/kconfig/Makefile |   77 +++++++++++++---------
>  scripts/kconfig/qconf.cc |  162 +++++++++++++++++++++++++---------------------
>  scripts/kconfig/qconf.h  |   76 ++++++++++-----------
>  3 files changed, 169 insertions(+), 146 deletions(-)
> 
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index f8d1ee3..a203a90 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -233,40 +233,51 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
>  # QT needs some extra effort...
>  $(obj)/.tmp_qtcheck:
>  	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
> -	pkg-config --exists qt 2> /dev/null && pkg=qt; \
> -	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
> -	if [ -n "$$pkg" ]; then \
> -	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
> -	  libs="\$$(shell pkg-config $$pkg --libs)"; \
> -	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
> -	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
> +	pkg-config --exists QtCore 2> /dev/null; \
> +	if [ ! $? ]; 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-mt 2> /dev/null && pkg=qt-mt; \
> +	    if [ -n "$$pkg" ]; then \
> +	      cflags="\$$(shell pkg-config $$pkg --cflags)"; \
> +	      libs="\$$(shell pkg-config $$pkg --libs)"; \
> +	      moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
> +	      dir="$$(pkg-config $$pkg --variable=prefix)"; \
> +	    else \
> +	      for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
> +	        if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
> +	      done; \
> +	      if [ -z "$$dir" ]; then \
> +	        echo "*"; \
> +	        echo "* Unable to find any QT installation. Please make sure that"; \
> +	        echo "* the QT4 or QT3 development package is correctly installed and"; \
> +	        echo "* either qmake can be found or install pkg-config or set"; \
> +	        echo "* the QTDIR environment variable to the correct location."; \
> +	        echo "*"; \
> +	        false; \
> +	      fi; \
> +	      libpath=$$dir/lib; lib=qt; osdir=""; \
> +	      $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
> +	        osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
> +	      test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
> +	      test -f $$libpath/libqt-mt.so && lib=qt-mt; \
> +	      cflags="-I$$dir/include"; \
> +	      libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
> +	      moc="$$dir/bin/moc"; \
> +	    fi; \
> +	    if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
> +	      echo "*"; \
> +	      echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
> +	      echo "*"; \
> +	      moc="/usr/bin/moc"; \
> +	    fi; \
>  	else \
> -	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
> -	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
> -	  done; \
> -	  if [ -z "$$dir" ]; then \
> -	    echo "*"; \
> -	    echo "* Unable to find the QT3 installation. Please make sure that"; \
> -	    echo "* the QT3 development package is correctly installed and"; \
> -	    echo "* either install pkg-config or set the QTDIR environment"; \
> -	    echo "* variable to the correct location."; \
> -	    echo "*"; \
> -	    false; \
> -	  fi; \
> -	  libpath=$$dir/lib; lib=qt; osdir=""; \
> -	  $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
> -	    osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
> -	  test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
> -	  test -f $$libpath/libqt-mt.so && lib=qt-mt; \
> -	  cflags="-I$$dir/include"; \
> -	  libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
> -	  moc="$$dir/bin/moc"; \
> -	fi; \
> -	if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
> -	  echo "*"; \
> -	  echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
> -	  echo "*"; \
> -	  moc="/usr/bin/moc"; \
> +	  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_LIBS=$$libs" >> $@; \
> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> index 820df2d..88d3874 100644
> --- a/scripts/kconfig/qconf.cc
> +++ b/scripts/kconfig/qconf.cc
> @@ -3,25 +3,42 @@
>   * Released under the terms of the GNU GPL v2.0.
>   */
>  
> -#include <qapplication.h>
> +#include <qglobal.h>
> +
> +#if QT_VERSION < 0x040000
>  #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 <qtoolbar.h>
>  #include <qlayout.h>
> -#include <qvbox.h>
>  #include <qsplitter.h>
> -#include <qlistview.h>
> -#include <qtextbrowser.h>
>  #include <qlineedit.h>
>  #include <qlabel.h>
>  #include <qpushbutton.h>
>  #include <qmenubar.h>
>  #include <qmessagebox.h>
> -#include <qaction.h>
> -#include <qheader.h>
> -#include <qfiledialog.h>
> -#include <qdragobject.h>
>  #include <qregexp.h>
> +#include <qevent.h>
>  
>  #include <stdlib.h>
>  
> @@ -39,7 +56,7 @@
>  static QApplication *configApp;
>  static ConfigSettings *configSettings;
>  
> -QAction *ConfigMainWindow::saveAction;
> +Q3Action *ConfigMainWindow::saveAction;
>  
>  static inline QString qgettext(const char* str)
>  {
> @@ -54,9 +71,9 @@ static inline QString qgettext(const QString& str)
>  /**
>   * 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::Iterator it;
>  
> @@ -69,10 +86,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
>  /**
>   * 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;
> -	QValueList<int>::ConstIterator it;
> +	Q3ValueList<int>::ConstIterator it;
>  
>  	for (it = value.begin(); it != value.end(); ++it)
>  		stringList.push_back(QString::number(*it));
> @@ -80,7 +97,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value
>  }
>  
>  
> -#if QT_VERSION >= 300
>  /*
>   * set the new data
>   * TODO check the value
> @@ -91,7 +107,6 @@ void ConfigItem::okRename(int col)
>  	sym_set_string_value(menu->sym, text(dataColIdx).latin1());
>  	listView()->updateList(this);
>  }
> -#endif
>  
>  /*
>   * update the displayed of a menu entry
> @@ -195,11 +210,9 @@ void ConfigItem::updateMenu(void)
>  
>  		data = sym_get_string_value(sym);
>  
> -#if QT_VERSION >= 300
>  		int i = list->mapIdx(dataColIdx);
>  		if (i >= 0)
>  			setRenameEnabled(i, TRUE);
> -#endif
>  		setText(dataColIdx, data);
>  		if (type == S_STRING)
>  			prompt = QString("%1: %2").arg(prompt).arg(data);
> @@ -432,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item)
>  	if (!rootEntry) {
>  		if (mode != listMode)
>  			goto update;
> -		QListViewItemIterator it(this);
> +		Q3ListViewItemIterator it(this);
>  		ConfigItem* item;
>  
>  		for (; it.current(); ++it) {
> @@ -527,11 +540,9 @@ void ConfigList::changeValue(ConfigItem* item)
>  	case S_INT:
>  	case S_HEX:
>  	case S_STRING:
> -#if QT_VERSION >= 300
>  		if (colMap[dataColIdx] >= 0)
>  			item->startRename(colMap[dataColIdx]);
>  		else
> -#endif
>  			parent()->lineEdit->show(item);
>  		break;
>  	}
> @@ -563,7 +574,7 @@ void ConfigList::setParentMenu(void)
>  		return;
>  	setRootMenu(menu_get_parent_menu(rootEntry->parent));
>  
> -	QListViewItemIterator it(this);
> +	Q3ListViewItemIterator it(this);
>  	for (; (item = (ConfigItem*)it.current()); it++) {
>  		if (item->menu == oldroot) {
>  			setCurrentItem(item);
> @@ -645,7 +656,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
>  
>  void ConfigList::keyPressEvent(QKeyEvent* ev)
>  {
> -	QListViewItem* i = currentItem();
> +	Q3ListViewItem* i = currentItem();
>  	ConfigItem* item;
>  	struct menu *menu;
>  	enum prop_type type;
> @@ -811,10 +822,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
>  {
>  	if (e->y() <= header()->geometry().bottom()) {
>  		if (!headerPopup) {
> -			QAction *action;
> +			Q3Action *action;
>  
> -			headerPopup = new QPopupMenu(this);
> -			action = new QAction(NULL, _("Show Name"), 0, this);
> +			headerPopup = new Q3PopupMenu(this);
> +			action = new Q3Action(NULL, _("Show Name"), 0, this);
>  			  action->setToggleAction(TRUE);
>  			  connect(action, SIGNAL(toggled(bool)),
>  				  parent(), SLOT(setShowName(bool)));
> @@ -822,7 +833,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
>  				  action, SLOT(setOn(bool)));
>  			  action->setOn(showName);
>  			  action->addTo(headerPopup);
> -			action = new QAction(NULL, _("Show Range"), 0, this);
> +			action = new Q3Action(NULL, _("Show Range"), 0, this);
>  			  action->setToggleAction(TRUE);
>  			  connect(action, SIGNAL(toggled(bool)),
>  				  parent(), SLOT(setShowRange(bool)));
> @@ -830,7 +841,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
>  				  action, SLOT(setOn(bool)));
>  			  action->setOn(showRange);
>  			  action->addTo(headerPopup);
> -			action = new QAction(NULL, _("Show Data"), 0, this);
> +			action = new Q3Action(NULL, _("Show Data"), 0, this);
>  			  action->setToggleAction(TRUE);
>  			  connect(action, SIGNAL(toggled(bool)),
>  				  parent(), SLOT(setShowData(bool)));
> @@ -914,7 +925,7 @@ void ConfigView::setShowData(bool b)
>  
>  void ConfigList::setAllOpen(bool open)
>  {
> -	QListViewItemIterator it(this);
> +	Q3ListViewItemIterator it(this);
>  
>  	for (; it.current(); it++)
>  		it.current()->setOpen(open);
> @@ -937,7 +948,7 @@ void ConfigView::updateListAll(void)
>  }
>  
>  ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
> -	: Parent(parent, name), sym(0), menu(0)
> +	: Parent(parent, name), sym(0), _menu(0)
>  {
>  	if (name) {
>  		configSettings->beginGroup(name);
> @@ -960,7 +971,7 @@ void ConfigInfoView::setShowDebug(bool b)
>  {
>  	if (_showDebug != b) {
>  		_showDebug = b;
> -		if (menu)
> +		if (_menu)
>  			menuInfo();
>  		else if (sym)
>  			symbolInfo();
> @@ -970,11 +981,11 @@ void ConfigInfoView::setShowDebug(bool b)
>  
>  void ConfigInfoView::setInfo(struct menu *m)
>  {
> -	if (menu == m)
> +	if (_menu == m)
>  		return;
> -	menu = m;
> +	_menu = m;
>  	sym = NULL;
> -	if (!menu)
> +	if (!_menu)
>  		clear();
>  	else
>  		menuInfo();
> @@ -1001,11 +1012,11 @@ void ConfigInfoView::menuInfo(void)
>  	struct symbol* sym;
>  	QString head, debug, help;
>  
> -	sym = menu->sym;
> +	sym = _menu->sym;
>  	if (sym) {
> -		if (menu->prompt) {
> +		if (_menu->prompt) {
>  			head += "<big><b>";
> -			head += print_filter(_(menu->prompt->text));
> +			head += print_filter(_(_menu->prompt->text));
>  			head += "</b></big>";
>  			if (sym->name) {
>  				head += " (";
> @@ -1031,23 +1042,23 @@ void ConfigInfoView::menuInfo(void)
>  			debug = debug_info(sym);
>  
>  		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));
>  		str_free(&help_gstr);
> -	} else if (menu->prompt) {
> +	} else if (_menu->prompt) {
>  		head += "<big><b>";
> -		head += print_filter(_(menu->prompt->text));
> +		head += print_filter(_(_menu->prompt->text));
>  		head += "</b></big><br><br>";
>  		if (showDebug()) {
> -			if (menu->prompt->visible.expr) {
> +			if (_menu->prompt->visible.expr) {
>  				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>";
>  			}
>  		}
>  	}
>  	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);
>  }
> @@ -1150,10 +1161,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
>  		*text += str2;
>  }
>  
> -QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
> +Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
>  {
> -	QPopupMenu* popup = Parent::createPopupMenu(pos);
> -	QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
> +	Q3PopupMenu* popup = Parent::createPopupMenu(pos);
> +	Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
>  	  action->setToggleAction(TRUE);
>  	  connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
>  	  connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
> @@ -1210,7 +1221,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
>  			y = configSettings->readNumEntry("/window y", 0, &ok);
>  		if (ok)
>  			move(x, y);
> -		QValueList<int> sizes = configSettings->readSizes("/split", &ok);
> +		Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
>  		if (ok)
>  			split->setSizes(sizes);
>  		configSettings->endGroup();
> @@ -1297,42 +1308,42 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	configList->setFocus();
>  
>  	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()));
>  	  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()));
> -	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()));
> -	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()));
>  	conf_set_changed_callback(conf_changed);
>  	// Set saveAction's initial state
>  	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()));
> -	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()));
> -	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()));
> -	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()));
> -	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()));
>  
> -	QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
> +	Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
>  	  showNameAction->setToggleAction(TRUE);
>  	  connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
>  	  connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
>  	  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);
>  	  connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
>  	  connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
>  	  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);
>  	  connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
>  	  connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
> @@ -1345,9 +1356,15 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	connect(optGroup, SIGNAL(selected(QAction *)), menuView,
>  		SLOT(setOptionMode(QAction *)));
>  
> -	configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup);
> -	configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup);
> -	configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup);
> +#if QT_VERSION >= 0x040000
> +	configView->showNormalAction = new QAction(_("Show Normal Options"), 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->setOn(configList->optMode == normalOpt);
>  	configView->showAllAction->setToggleAction(TRUE);
> @@ -1355,15 +1372,15 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	configView->showPromptAction->setToggleAction(TRUE);
>  	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);
>  	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
>  	  connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
>  	  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()));
> -	QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
> +	Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
>  	  connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
>  
>  	// init tool bar
> @@ -1377,7 +1394,7 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	fullViewAction->addTo(toolBar);
>  
>  	// create config menu
> -	QPopupMenu* config = new QPopupMenu(this);
> +	Q3PopupMenu* config = new Q3PopupMenu(this);
>  	menu->insertItem(_("&File"), config);
>  	loadAction->addTo(config);
>  	saveAction->addTo(config);
> @@ -1386,12 +1403,12 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	quitAction->addTo(config);
>  
>  	// create edit menu
> -	QPopupMenu* editMenu = new QPopupMenu(this);
> +	Q3PopupMenu* editMenu = new Q3PopupMenu(this);
>  	menu->insertItem(_("&Edit"), editMenu);
>  	searchAction->addTo(editMenu);
>  
>  	// create options menu
> -	QPopupMenu* optionMenu = new QPopupMenu(this);
> +	Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
>  	menu->insertItem(_("&Option"), optionMenu);
>  	showNameAction->addTo(optionMenu);
>  	showRangeAction->addTo(optionMenu);
> @@ -1399,10 +1416,9 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	optionMenu->insertSeparator();
>  	optGroup->addTo(optionMenu);
>  	optionMenu->insertSeparator();
> -	showDebugAction->addTo(optionMenu);
>  
>  	// create help menu
> -	QPopupMenu* helpMenu = new QPopupMenu(this);
> +	Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
>  	menu->insertSeparator();
>  	menu->insertItem(_("&Help"), helpMenu);
>  	showIntroAction->addTo(helpMenu);
> @@ -1437,7 +1453,7 @@ ConfigMainWindow::ConfigMainWindow(void)
>  		showSplitView();
>  
>  	// UI setup done, restore splitter positions
> -	QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
> +	Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
>  	if (ok)
>  		split1->setSizes(sizes);
>  
> @@ -1448,7 +1464,7 @@ ConfigMainWindow::ConfigMainWindow(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())
>  		return;
>  	if (conf_read(QFile::encodeName(s)))
> @@ -1464,7 +1480,7 @@ void ConfigMainWindow::saveConfig(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())
>  		return;
>  	if (conf_write(QFile::encodeName(s)))
> diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
> index 636a74b..91677d9 100644
> --- a/scripts/kconfig/qconf.h
> +++ b/scripts/kconfig/qconf.h
> @@ -3,26 +3,25 @@
>   * Released under the terms of the GNU GPL v2.0.
>   */
>  
> +#if QT_VERSION < 0x040000
>  #include <qlistview.h>
> -#if QT_VERSION >= 300
> -#include <qsettings.h>
>  #else
> -class QSettings {
> -public:
> -	void beginGroup(const QString& group) { }
> -	void endGroup(void) { }
> -	bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return def; }
> -	int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return def; }
> -	QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return def; }
> -	QStringList readListEntry(const QString& key, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return QStringList(); }
> -	template <class t>
> -	bool writeEntry(const QString& key, t value)
> -	{ return TRUE; }
> -};
> +#include <q3listview.h>
> +#endif
> +#include <qsettings.h>
> +
> +#if QT_VERSION < 0x040000
> +#define Q3ValueList             QValueList
> +#define Q3PopupMenu             QPopupMenu
> +#define Q3ListView              QListView
> +#define Q3ListViewItem          QListViewItem
> +#define Q3VBox                  QVBox
> +#define Q3TextBrowser           QTextBrowser
> +#define Q3MainWindow            QMainWindow
> +#define Q3Action                QAction
> +#define Q3ToolBar               QToolBar
> +#define Q3ListViewItemIterator  QListViewItemIterator
> +#define Q3FileDialog            QFileDialog
>  #endif
>  
>  class ConfigView;
> @@ -31,11 +30,10 @@ class ConfigItem;
>  class ConfigLineEdit;
>  class ConfigMainWindow;
>  
> -
>  class ConfigSettings : public QSettings {
>  public:
> -	QValueList<int> readSizes(const QString& key, bool *ok);
> -	bool writeSizes(const QString& key, const QValueList<int>& value);
> +	Q3ValueList<int> readSizes(const QString& key, bool *ok);
> +	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
>  };
>  
>  enum colIdx {
> @@ -48,9 +46,9 @@ enum optionMode {
>  	normalOpt = 0, allOpt, promptOpt
>  };
>  
> -class ConfigList : public QListView {
> +class ConfigList : public Q3ListView {
>  	Q_OBJECT
> -	typedef class QListView Parent;
> +	typedef class Q3ListView Parent;
>  public:
>  	ConfigList(ConfigView* p, const char *name = 0);
>  	void reinit(void);
> @@ -135,17 +133,17 @@ public:
>  	struct menu *rootEntry;
>  	QColorGroup disabledColorGroup;
>  	QColorGroup inactivedColorGroup;
> -	QPopupMenu* headerPopup;
> +	Q3PopupMenu* headerPopup;
>  
>  private:
>  	int colMap[colNr];
>  	int colRevMap[colNr];
>  };
>  
> -class ConfigItem : public QListViewItem {
> -	typedef class QListViewItem Parent;
> +class ConfigItem : public Q3ListViewItem {
> +	typedef class Q3ListViewItem Parent;
>  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)
>  	{
>  		init();
> @@ -155,16 +153,14 @@ public:
>  	{
>  		init();
>  	}
> -	ConfigItem(QListView *parent, ConfigItem *after, bool v)
> +	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
>  	: Parent(parent, after), menu(0), visible(v), goParent(true)
>  	{
>  		init();
>  	}
>  	~ConfigItem(void);
>  	void init(void);
> -#if QT_VERSION >= 300
>  	void okRename(int col);
> -#endif
>  	void updateMenu(void);
>  	void testUpdateMenu(bool v);
>  	ConfigList* listView() const
> @@ -219,9 +215,9 @@ public:
>  	ConfigItem *item;
>  };
>  
> -class ConfigView : public QVBox {
> +class ConfigView : public Q3VBox {
>  	Q_OBJECT
> -	typedef class QVBox Parent;
> +	typedef class Q3VBox Parent;
>  public:
>  	ConfigView(QWidget* parent, const char *name = 0);
>  	~ConfigView(void);
> @@ -252,9 +248,9 @@ public:
>  	static QAction *showPromptAction;
>  };
>  
> -class ConfigInfoView : public QTextBrowser {
> +class ConfigInfoView : public Q3TextBrowser {
>  	Q_OBJECT
> -	typedef class QTextBrowser Parent;
> +	typedef class Q3TextBrowser Parent;
>  public:
>  	ConfigInfoView(QWidget* parent, const char *name = 0);
>  	bool showDebug(void) const { return _showDebug; }
> @@ -274,11 +270,11 @@ protected:
>  	QString debug_info(struct symbol *sym);
>  	static QString print_filter(const QString &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);
>  
>  	struct symbol *sym;
> -	struct menu *menu;
> +	struct menu *_menu;
>  	bool _showDebug;
>  };
>  
> @@ -302,10 +298,10 @@ protected:
>  	struct symbol **result;
>  };
>  
> -class ConfigMainWindow : public QMainWindow {
> +class ConfigMainWindow : public Q3MainWindow {
>  	Q_OBJECT
>  
> -	static QAction *saveAction;
> +	static Q3Action *saveAction;
>  	static void conf_changed(void);
>  public:
>  	ConfigMainWindow(void);
> @@ -334,8 +330,8 @@ protected:
>  	ConfigView *configView;
>  	ConfigList *configList;
>  	ConfigInfoView *helpText;
> -	QToolBar *toolBar;
> -	QAction *backAction;
> +	Q3ToolBar *toolBar;
> +	Q3Action *backAction;
>  	QSplitter* split1;
>  	QSplitter* split2;
>  };
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] kconfig qconf: port to QT4
  2010-08-01 14:32             ` Ed Tomlinson
@ 2010-08-01 19:28               ` Alexander Stein
  2010-08-02 12:01                 ` Ed Tomlinson
  0 siblings, 1 reply; 20+ messages in thread
From: Alexander Stein @ 2010-08-01 19:28 UTC (permalink / raw)
  To: Ed Tomlinson
  Cc: Michal Marek, linux-kbuild, Roman Zippel, lkml, Alexander Stein

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

* rewritten makefile rules to detect QT4 by using qmake 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

Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
---
This patch is pretty the same as in 1280488517-30116-1-git-send-email-alexander.stein@informatik.tu-chemnitz.de.
But this is based on v2.6.35-rc6, hence hidden option feature is missin.

 scripts/kconfig/Makefile |   77 +++++++++++++----------
 scripts/kconfig/qconf.cc |  160 ++++++++++++++++++++++++---------------------
 scripts/kconfig/qconf.h  |   76 ++++++++++------------
 3 files changed, 165 insertions(+), 148 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 7ea649d..78829ac 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -233,40 +233,51 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
 # QT needs some extra effort...
 $(obj)/.tmp_qtcheck:
 	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
-	pkg-config --exists qt 2> /dev/null && pkg=qt; \
-	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
-	if [ -n "$$pkg" ]; then \
-	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
-	  libs="\$$(shell pkg-config $$pkg --libs)"; \
-	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
-	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	pkg-config --exists QtCore 2> /dev/null; \
+	if [ ! $? ]; 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-mt 2> /dev/null && pkg=qt-mt; \
+	    if [ -n "$$pkg" ]; then \
+	      cflags="\$$(shell pkg-config $$pkg --cflags)"; \
+	      libs="\$$(shell pkg-config $$pkg --libs)"; \
+	      moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
+	      dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	    else \
+	      for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
+	        if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
+	      done; \
+	      if [ -z "$$dir" ]; then \
+	        echo "*"; \
+	        echo "* Unable to find any QT installation. Please make sure that"; \
+	        echo "* the QT4 or QT3 development package is correctly installed and"; \
+	        echo "* either qmake can be found or install pkg-config or set"; \
+	        echo "* the QTDIR environment variable to the correct location."; \
+	        echo "*"; \
+	        false; \
+	      fi; \
+	      libpath=$$dir/lib; lib=qt; osdir=""; \
+	      $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
+	        osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
+	      test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
+	      test -f $$libpath/libqt-mt.so && lib=qt-mt; \
+	      cflags="-I$$dir/include"; \
+	      libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
+	      moc="$$dir/bin/moc"; \
+	    fi; \
+	    if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
+	      echo "*"; \
+	      echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
+	      echo "*"; \
+	      moc="/usr/bin/moc"; \
+	    fi; \
 	else \
-	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
-	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
-	  done; \
-	  if [ -z "$$dir" ]; then \
-	    echo "*"; \
-	    echo "* Unable to find the QT3 installation. Please make sure that"; \
-	    echo "* the QT3 development package is correctly installed and"; \
-	    echo "* either install pkg-config or set the QTDIR environment"; \
-	    echo "* variable to the correct location."; \
-	    echo "*"; \
-	    false; \
-	  fi; \
-	  libpath=$$dir/lib; lib=qt; osdir=""; \
-	  $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
-	    osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
-	  test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
-	  test -f $$libpath/libqt-mt.so && lib=qt-mt; \
-	  cflags="-I$$dir/include"; \
-	  libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
-	  moc="$$dir/bin/moc"; \
-	fi; \
-	if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
-	  echo "*"; \
-	  echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
-	  echo "*"; \
-	  moc="/usr/bin/moc"; \
+	  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_LIBS=$$libs" >> $@; \
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 00c5150..da38ff2 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -3,25 +3,42 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
-#include <qapplication.h>
+#include <qglobal.h>
+
+#if QT_VERSION < 0x040000
 #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 <qtoolbar.h>
 #include <qlayout.h>
-#include <qvbox.h>
 #include <qsplitter.h>
-#include <qlistview.h>
-#include <qtextbrowser.h>
 #include <qlineedit.h>
 #include <qlabel.h>
 #include <qpushbutton.h>
 #include <qmenubar.h>
 #include <qmessagebox.h>
-#include <qaction.h>
-#include <qheader.h>
-#include <qfiledialog.h>
-#include <qdragobject.h>
 #include <qregexp.h>
+#include <qevent.h>
 
 #include <stdlib.h>
 
@@ -39,7 +56,7 @@
 static QApplication *configApp;
 static ConfigSettings *configSettings;
 
-QAction *ConfigMainWindow::saveAction;
+Q3Action *ConfigMainWindow::saveAction;
 
 static inline QString qgettext(const char* str)
 {
@@ -54,9 +71,9 @@ static inline QString qgettext(const QString& str)
 /**
  * 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);
 	if (ok) {
 		QStringList::Iterator it;
@@ -70,10 +87,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
 /**
  * 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;
-	QValueList<int>::ConstIterator it;
+	Q3ValueList<int>::ConstIterator it;
 
 	for (it = value.begin(); it != value.end(); ++it)
 		stringList.push_back(QString::number(*it));
@@ -81,7 +98,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value
 }
 
 
-#if QT_VERSION >= 300
 /*
  * set the new data
  * TODO check the value
@@ -92,7 +108,6 @@ void ConfigItem::okRename(int col)
 	sym_set_string_value(menu->sym, text(dataColIdx).latin1());
 	listView()->updateList(this);
 }
-#endif
 
 /*
  * update the displayed of a menu entry
@@ -196,11 +211,9 @@ void ConfigItem::updateMenu(void)
 
 		data = sym_get_string_value(sym);
 
-#if QT_VERSION >= 300
 		int i = list->mapIdx(dataColIdx);
 		if (i >= 0)
 			setRenameEnabled(i, TRUE);
-#endif
 		setText(dataColIdx, data);
 		if (type == S_STRING)
 			prompt = QString("%1: %2").arg(prompt).arg(data);
@@ -422,7 +435,7 @@ void ConfigList::updateList(ConfigItem* item)
 	if (!rootEntry) {
 		if (mode != listMode)
 			goto update;
-		QListViewItemIterator it(this);
+		Q3ListViewItemIterator it(this);
 		ConfigItem* item;
 
 		for (; it.current(); ++it) {
@@ -517,11 +530,9 @@ void ConfigList::changeValue(ConfigItem* item)
 	case S_INT:
 	case S_HEX:
 	case S_STRING:
-#if QT_VERSION >= 300
 		if (colMap[dataColIdx] >= 0)
 			item->startRename(colMap[dataColIdx]);
 		else
-#endif
 			parent()->lineEdit->show(item);
 		break;
 	}
@@ -553,7 +564,7 @@ void ConfigList::setParentMenu(void)
 		return;
 	setRootMenu(menu_get_parent_menu(rootEntry->parent));
 
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 	for (; (item = (ConfigItem*)it.current()); it++) {
 		if (item->menu == oldroot) {
 			setCurrentItem(item);
@@ -635,7 +646,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
 
 void ConfigList::keyPressEvent(QKeyEvent* ev)
 {
-	QListViewItem* i = currentItem();
+	Q3ListViewItem* i = currentItem();
 	ConfigItem* item;
 	struct menu *menu;
 	enum prop_type type;
@@ -801,10 +812,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 {
 	if (e->y() <= header()->geometry().bottom()) {
 		if (!headerPopup) {
-			QAction *action;
+			Q3Action *action;
 
-			headerPopup = new QPopupMenu(this);
-			action = new QAction(NULL, _("Show Name"), 0, this);
+			headerPopup = new Q3PopupMenu(this);
+			action = new Q3Action(NULL, _("Show Name"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowName(bool)));
@@ -812,7 +823,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showName);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Range"), 0, this);
+			action = new Q3Action(NULL, _("Show Range"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowRange(bool)));
@@ -820,7 +831,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showRange);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Data"), 0, this);
+			action = new Q3Action(NULL, _("Show Data"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowData(bool)));
@@ -898,7 +909,7 @@ void ConfigView::setShowData(bool b)
 
 void ConfigList::setAllOpen(bool open)
 {
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 
 	for (; it.current(); it++)
 		it.current()->setOpen(open);
@@ -921,7 +932,7 @@ void ConfigView::updateListAll(void)
 }
 
 ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
-	: Parent(parent, name), sym(0), menu(0)
+	: Parent(parent, name), sym(0), _menu(0)
 {
 	if (name) {
 		configSettings->beginGroup(name);
@@ -944,7 +955,7 @@ void ConfigInfoView::setShowDebug(bool b)
 {
 	if (_showDebug != b) {
 		_showDebug = b;
-		if (menu)
+		if (_menu)
 			menuInfo();
 		else if (sym)
 			symbolInfo();
@@ -954,11 +965,11 @@ void ConfigInfoView::setShowDebug(bool b)
 
 void ConfigInfoView::setInfo(struct menu *m)
 {
-	if (menu == m)
+	if (_menu == m)
 		return;
-	menu = m;
+	_menu = m;
 	sym = NULL;
-	if (!menu)
+	if (!_menu)
 		clear();
 	else
 		menuInfo();
@@ -968,17 +979,17 @@ void ConfigInfoView::setSource(const QString& name)
 {
 	const char *p = name.latin1();
 
-	menu = NULL;
+	_menu = NULL;
 	sym = NULL;
 
 	switch (p[0]) {
 	case 'm':
 		struct menu *m;
 
-		if (sscanf(p, "m%p", &m) == 1 && menu != m) {
-			menu = m;
+		if (sscanf(p, "m%p", &m) == 1 && _menu != m) {
+			_menu = m;
 			menuInfo();
-			emit menuSelected(menu);
+			emit menuSelected(_menu);
 		}
 		break;
 	case 's':
@@ -1013,11 +1024,11 @@ void ConfigInfoView::menuInfo(void)
 	struct symbol* sym;
 	QString head, debug, help;
 
-	sym = menu->sym;
+	sym = _menu->sym;
 	if (sym) {
-		if (menu->prompt) {
+		if (_menu->prompt) {
 			head += "<big><b>";
-			head += print_filter(_(menu->prompt->text));
+			head += print_filter(_(_menu->prompt->text));
 			head += "</b></big>";
 			if (sym->name) {
 				head += " (";
@@ -1043,23 +1054,23 @@ void ConfigInfoView::menuInfo(void)
 			debug = debug_info(sym);
 
 		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));
 		str_free(&help_gstr);
-	} else if (menu->prompt) {
+	} else if (_menu->prompt) {
 		head += "<big><b>";
-		head += print_filter(_(menu->prompt->text));
+		head += print_filter(_(_menu->prompt->text));
 		head += "</b></big><br><br>";
 		if (showDebug()) {
-			if (menu->prompt->visible.expr) {
+			if (_menu->prompt->visible.expr) {
 				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>";
 			}
 		}
 	}
 	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);
 }
@@ -1162,10 +1173,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 		*text += str2;
 }
 
-QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
+Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
 {
-	QPopupMenu* popup = Parent::createPopupMenu(pos);
-	QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
+	Q3PopupMenu* popup = Parent::createPopupMenu(pos);
+	Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
 	  action->setToggleAction(TRUE);
 	  connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
 	  connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1222,7 +1233,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
 			y = configSettings->readNumEntry("/window y", 0, &ok);
 		if (ok)
 			move(x, y);
-		QValueList<int> sizes = configSettings->readSizes("/split", &ok);
+		Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
 		if (ok)
 			split->setSizes(sizes);
 		configSettings->endGroup();
@@ -1309,60 +1320,60 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configList->setFocus();
 
 	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()));
 	  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()));
-	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()));
-	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()));
 	conf_set_changed_callback(conf_changed);
 	// Set saveAction's initial state
 	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()));
-	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()));
-	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()));
-	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()));
-	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()));
 
-	QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
+	Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
 	  showNameAction->setToggleAction(TRUE);
 	  connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
 	  connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
 	  connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
 	  connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
 	  showDataAction->setOn(configList->showData);
-	QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this);
+	Q3Action *showAllAction = new Q3Action(NULL, _("Show All Options"), 0, this);
 	  showAllAction->setToggleAction(TRUE);
 	  connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool)));
 	  connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool)));
 	  showAllAction->setOn(configList->showAll);
-	QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
+	Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this);
 	  showDebugAction->setToggleAction(TRUE);
 	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
 	  connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
 	  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()));
-	QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
+	Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
 	  connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
 
 	// init tool bar
@@ -1376,7 +1387,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 	fullViewAction->addTo(toolBar);
 
 	// create config menu
-	QPopupMenu* config = new QPopupMenu(this);
+	Q3PopupMenu* config = new Q3PopupMenu(this);
 	menu->insertItem(_("&File"), config);
 	loadAction->addTo(config);
 	saveAction->addTo(config);
@@ -1385,22 +1396,21 @@ ConfigMainWindow::ConfigMainWindow(void)
 	quitAction->addTo(config);
 
 	// create edit menu
-	QPopupMenu* editMenu = new QPopupMenu(this);
+	Q3PopupMenu* editMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Edit"), editMenu);
 	searchAction->addTo(editMenu);
 
 	// create options menu
-	QPopupMenu* optionMenu = new QPopupMenu(this);
+	Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Option"), optionMenu);
 	showNameAction->addTo(optionMenu);
 	showRangeAction->addTo(optionMenu);
 	showDataAction->addTo(optionMenu);
 	optionMenu->insertSeparator();
 	showAllAction->addTo(optionMenu);
-	showDebugAction->addTo(optionMenu);
 
 	// create help menu
-	QPopupMenu* helpMenu = new QPopupMenu(this);
+	Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
 	menu->insertSeparator();
 	menu->insertItem(_("&Help"), helpMenu);
 	showIntroAction->addTo(helpMenu);
@@ -1435,7 +1445,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 		showSplitView();
 
 	// UI setup done, restore splitter positions
-	QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
+	Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
 	if (ok)
 		split1->setSizes(sizes);
 
@@ -1446,7 +1456,7 @@ ConfigMainWindow::ConfigMainWindow(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())
 		return;
 	if (conf_read(QFile::encodeName(s)))
@@ -1462,7 +1472,7 @@ void ConfigMainWindow::saveConfig(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())
 		return;
 	if (conf_write(QFile::encodeName(s)))
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index b3b5657..8e5848a 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,26 +3,25 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
+#if QT_VERSION < 0x040000
 #include <qlistview.h>
-#if QT_VERSION >= 300
-#include <qsettings.h>
 #else
-class QSettings {
-public:
-	void beginGroup(const QString& group) { }
-	void endGroup(void) { }
-	bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QStringList readListEntry(const QString& key, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return QStringList(); }
-	template <class t>
-	bool writeEntry(const QString& key, t value)
-	{ return TRUE; }
-};
+#include <q3listview.h>
+#endif
+#include <qsettings.h>
+
+#if QT_VERSION < 0x040000
+#define Q3ValueList             QValueList
+#define Q3PopupMenu             QPopupMenu
+#define Q3ListView              QListView
+#define Q3ListViewItem          QListViewItem
+#define Q3VBox                  QVBox
+#define Q3TextBrowser           QTextBrowser
+#define Q3MainWindow            QMainWindow
+#define Q3Action                QAction
+#define Q3ToolBar               QToolBar
+#define Q3ListViewItemIterator  QListViewItemIterator
+#define Q3FileDialog            QFileDialog
 #endif
 
 class ConfigView;
@@ -31,11 +30,10 @@ class ConfigItem;
 class ConfigLineEdit;
 class ConfigMainWindow;
 
-
 class ConfigSettings : public QSettings {
 public:
-	QValueList<int> readSizes(const QString& key, bool *ok);
-	bool writeSizes(const QString& key, const QValueList<int>& value);
+	Q3ValueList<int> readSizes(const QString& key, bool *ok);
+	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
 };
 
 enum colIdx {
@@ -45,9 +43,9 @@ enum listMode {
 	singleMode, menuMode, symbolMode, fullMode, listMode
 };
 
-class ConfigList : public QListView {
+class ConfigList : public Q3ListView {
 	Q_OBJECT
-	typedef class QListView Parent;
+	typedef class Q3ListView Parent;
 public:
 	ConfigList(ConfigView* p, const char *name = 0);
 	void reinit(void);
@@ -129,17 +127,17 @@ public:
 	struct menu *rootEntry;
 	QColorGroup disabledColorGroup;
 	QColorGroup inactivedColorGroup;
-	QPopupMenu* headerPopup;
+	Q3PopupMenu* headerPopup;
 
 private:
 	int colMap[colNr];
 	int colRevMap[colNr];
 };
 
-class ConfigItem : public QListViewItem {
-	typedef class QListViewItem Parent;
+class ConfigItem : public Q3ListViewItem {
+	typedef class Q3ListViewItem Parent;
 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)
 	{
 		init();
@@ -149,16 +147,14 @@ public:
 	{
 		init();
 	}
-	ConfigItem(QListView *parent, ConfigItem *after, bool v)
+	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
 	: Parent(parent, after), menu(0), visible(v), goParent(true)
 	{
 		init();
 	}
 	~ConfigItem(void);
 	void init(void);
-#if QT_VERSION >= 300
 	void okRename(int col);
-#endif
 	void updateMenu(void);
 	void testUpdateMenu(bool v);
 	ConfigList* listView() const
@@ -213,9 +209,9 @@ public:
 	ConfigItem *item;
 };
 
-class ConfigView : public QVBox {
+class ConfigView : public Q3VBox {
 	Q_OBJECT
-	typedef class QVBox Parent;
+	typedef class Q3VBox Parent;
 public:
 	ConfigView(QWidget* parent, const char *name = 0);
 	~ConfigView(void);
@@ -244,9 +240,9 @@ public:
 	ConfigView* nextView;
 };
 
-class ConfigInfoView : public QTextBrowser {
+class ConfigInfoView : public Q3TextBrowser {
 	Q_OBJECT
-	typedef class QTextBrowser Parent;
+	typedef class Q3TextBrowser Parent;
 public:
 	ConfigInfoView(QWidget* parent, const char *name = 0);
 	bool showDebug(void) const { return _showDebug; }
@@ -267,11 +263,11 @@ protected:
 	QString debug_info(struct symbol *sym);
 	static QString print_filter(const QString &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);
 
 	struct symbol *sym;
-	struct menu *menu;
+	struct menu *_menu;
 	bool _showDebug;
 };
 
@@ -295,10 +291,10 @@ protected:
 	struct symbol **result;
 };
 
-class ConfigMainWindow : public QMainWindow {
+class ConfigMainWindow : public Q3MainWindow {
 	Q_OBJECT
 
-	static QAction *saveAction;
+	static Q3Action *saveAction;
 	static void conf_changed(void);
 public:
 	ConfigMainWindow(void);
@@ -327,8 +323,8 @@ protected:
 	ConfigView *configView;
 	ConfigList *configList;
 	ConfigInfoView *helpText;
-	QToolBar *toolBar;
-	QAction *backAction;
+	Q3ToolBar *toolBar;
+	Q3Action *backAction;
 	QSplitter* split1;
 	QSplitter* split2;
 };
-- 
1.7.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH] kconfig qconf: port to QT4
  2010-08-01 19:28               ` [PATCH] " Alexander Stein
@ 2010-08-02 12:01                 ` Ed Tomlinson
  2010-09-18 14:22                   ` Ed Tomlinson
  0 siblings, 1 reply; 20+ messages in thread
From: Ed Tomlinson @ 2010-08-02 12:01 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Michal Marek, linux-kbuild, Roman Zippel, lkml

Hi,

Works as advertised here.  The merge window for .36 is open.  Would it be possible for this to be included?

Thanks,
Ed Tomlinson

On Sunday 01 August 2010 15:28:35 Alexander Stein wrote:
> A straight forward port to QT4 using qt3to4 and compiling against
>   qt3support
> 
> * rewritten makefile rules to detect QT4 by using qmake 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
> 
> Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
> ---
> This patch is pretty the same as in 1280488517-30116-1-git-send-email-alexander.stein@informatik.tu-chemnitz.de.
> But this is based on v2.6.35-rc6, hence hidden option feature is missin.
> 
>  scripts/kconfig/Makefile |   77 +++++++++++++----------
>  scripts/kconfig/qconf.cc |  160 ++++++++++++++++++++++++---------------------
>  scripts/kconfig/qconf.h  |   76 ++++++++++------------
>  3 files changed, 165 insertions(+), 148 deletions(-)
> 
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index 7ea649d..78829ac 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -233,40 +233,51 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
>  # QT needs some extra effort...
>  $(obj)/.tmp_qtcheck:
>  	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
> -	pkg-config --exists qt 2> /dev/null && pkg=qt; \
> -	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
> -	if [ -n "$$pkg" ]; then \
> -	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
> -	  libs="\$$(shell pkg-config $$pkg --libs)"; \
> -	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
> -	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
> +	pkg-config --exists QtCore 2> /dev/null; \
> +	if [ ! $? ]; 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-mt 2> /dev/null && pkg=qt-mt; \
> +	    if [ -n "$$pkg" ]; then \
> +	      cflags="\$$(shell pkg-config $$pkg --cflags)"; \
> +	      libs="\$$(shell pkg-config $$pkg --libs)"; \
> +	      moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
> +	      dir="$$(pkg-config $$pkg --variable=prefix)"; \
> +	    else \
> +	      for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
> +	        if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
> +	      done; \
> +	      if [ -z "$$dir" ]; then \
> +	        echo "*"; \
> +	        echo "* Unable to find any QT installation. Please make sure that"; \
> +	        echo "* the QT4 or QT3 development package is correctly installed and"; \
> +	        echo "* either qmake can be found or install pkg-config or set"; \
> +	        echo "* the QTDIR environment variable to the correct location."; \
> +	        echo "*"; \
> +	        false; \
> +	      fi; \
> +	      libpath=$$dir/lib; lib=qt; osdir=""; \
> +	      $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
> +	        osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
> +	      test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
> +	      test -f $$libpath/libqt-mt.so && lib=qt-mt; \
> +	      cflags="-I$$dir/include"; \
> +	      libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
> +	      moc="$$dir/bin/moc"; \
> +	    fi; \
> +	    if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
> +	      echo "*"; \
> +	      echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
> +	      echo "*"; \
> +	      moc="/usr/bin/moc"; \
> +	    fi; \
>  	else \
> -	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
> -	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
> -	  done; \
> -	  if [ -z "$$dir" ]; then \
> -	    echo "*"; \
> -	    echo "* Unable to find the QT3 installation. Please make sure that"; \
> -	    echo "* the QT3 development package is correctly installed and"; \
> -	    echo "* either install pkg-config or set the QTDIR environment"; \
> -	    echo "* variable to the correct location."; \
> -	    echo "*"; \
> -	    false; \
> -	  fi; \
> -	  libpath=$$dir/lib; lib=qt; osdir=""; \
> -	  $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
> -	    osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
> -	  test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
> -	  test -f $$libpath/libqt-mt.so && lib=qt-mt; \
> -	  cflags="-I$$dir/include"; \
> -	  libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
> -	  moc="$$dir/bin/moc"; \
> -	fi; \
> -	if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
> -	  echo "*"; \
> -	  echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
> -	  echo "*"; \
> -	  moc="/usr/bin/moc"; \
> +	  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_LIBS=$$libs" >> $@; \
> diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
> index 00c5150..da38ff2 100644
> --- a/scripts/kconfig/qconf.cc
> +++ b/scripts/kconfig/qconf.cc
> @@ -3,25 +3,42 @@
>   * Released under the terms of the GNU GPL v2.0.
>   */
>  
> -#include <qapplication.h>
> +#include <qglobal.h>
> +
> +#if QT_VERSION < 0x040000
>  #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 <qtoolbar.h>
>  #include <qlayout.h>
> -#include <qvbox.h>
>  #include <qsplitter.h>
> -#include <qlistview.h>
> -#include <qtextbrowser.h>
>  #include <qlineedit.h>
>  #include <qlabel.h>
>  #include <qpushbutton.h>
>  #include <qmenubar.h>
>  #include <qmessagebox.h>
> -#include <qaction.h>
> -#include <qheader.h>
> -#include <qfiledialog.h>
> -#include <qdragobject.h>
>  #include <qregexp.h>
> +#include <qevent.h>
>  
>  #include <stdlib.h>
>  
> @@ -39,7 +56,7 @@
>  static QApplication *configApp;
>  static ConfigSettings *configSettings;
>  
> -QAction *ConfigMainWindow::saveAction;
> +Q3Action *ConfigMainWindow::saveAction;
>  
>  static inline QString qgettext(const char* str)
>  {
> @@ -54,9 +71,9 @@ static inline QString qgettext(const QString& str)
>  /**
>   * 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);
>  	if (ok) {
>  		QStringList::Iterator it;
> @@ -70,10 +87,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
>  /**
>   * 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;
> -	QValueList<int>::ConstIterator it;
> +	Q3ValueList<int>::ConstIterator it;
>  
>  	for (it = value.begin(); it != value.end(); ++it)
>  		stringList.push_back(QString::number(*it));
> @@ -81,7 +98,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value
>  }
>  
>  
> -#if QT_VERSION >= 300
>  /*
>   * set the new data
>   * TODO check the value
> @@ -92,7 +108,6 @@ void ConfigItem::okRename(int col)
>  	sym_set_string_value(menu->sym, text(dataColIdx).latin1());
>  	listView()->updateList(this);
>  }
> -#endif
>  
>  /*
>   * update the displayed of a menu entry
> @@ -196,11 +211,9 @@ void ConfigItem::updateMenu(void)
>  
>  		data = sym_get_string_value(sym);
>  
> -#if QT_VERSION >= 300
>  		int i = list->mapIdx(dataColIdx);
>  		if (i >= 0)
>  			setRenameEnabled(i, TRUE);
> -#endif
>  		setText(dataColIdx, data);
>  		if (type == S_STRING)
>  			prompt = QString("%1: %2").arg(prompt).arg(data);
> @@ -422,7 +435,7 @@ void ConfigList::updateList(ConfigItem* item)
>  	if (!rootEntry) {
>  		if (mode != listMode)
>  			goto update;
> -		QListViewItemIterator it(this);
> +		Q3ListViewItemIterator it(this);
>  		ConfigItem* item;
>  
>  		for (; it.current(); ++it) {
> @@ -517,11 +530,9 @@ void ConfigList::changeValue(ConfigItem* item)
>  	case S_INT:
>  	case S_HEX:
>  	case S_STRING:
> -#if QT_VERSION >= 300
>  		if (colMap[dataColIdx] >= 0)
>  			item->startRename(colMap[dataColIdx]);
>  		else
> -#endif
>  			parent()->lineEdit->show(item);
>  		break;
>  	}
> @@ -553,7 +564,7 @@ void ConfigList::setParentMenu(void)
>  		return;
>  	setRootMenu(menu_get_parent_menu(rootEntry->parent));
>  
> -	QListViewItemIterator it(this);
> +	Q3ListViewItemIterator it(this);
>  	for (; (item = (ConfigItem*)it.current()); it++) {
>  		if (item->menu == oldroot) {
>  			setCurrentItem(item);
> @@ -635,7 +646,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
>  
>  void ConfigList::keyPressEvent(QKeyEvent* ev)
>  {
> -	QListViewItem* i = currentItem();
> +	Q3ListViewItem* i = currentItem();
>  	ConfigItem* item;
>  	struct menu *menu;
>  	enum prop_type type;
> @@ -801,10 +812,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
>  {
>  	if (e->y() <= header()->geometry().bottom()) {
>  		if (!headerPopup) {
> -			QAction *action;
> +			Q3Action *action;
>  
> -			headerPopup = new QPopupMenu(this);
> -			action = new QAction(NULL, _("Show Name"), 0, this);
> +			headerPopup = new Q3PopupMenu(this);
> +			action = new Q3Action(NULL, _("Show Name"), 0, this);
>  			  action->setToggleAction(TRUE);
>  			  connect(action, SIGNAL(toggled(bool)),
>  				  parent(), SLOT(setShowName(bool)));
> @@ -812,7 +823,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
>  				  action, SLOT(setOn(bool)));
>  			  action->setOn(showName);
>  			  action->addTo(headerPopup);
> -			action = new QAction(NULL, _("Show Range"), 0, this);
> +			action = new Q3Action(NULL, _("Show Range"), 0, this);
>  			  action->setToggleAction(TRUE);
>  			  connect(action, SIGNAL(toggled(bool)),
>  				  parent(), SLOT(setShowRange(bool)));
> @@ -820,7 +831,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
>  				  action, SLOT(setOn(bool)));
>  			  action->setOn(showRange);
>  			  action->addTo(headerPopup);
> -			action = new QAction(NULL, _("Show Data"), 0, this);
> +			action = new Q3Action(NULL, _("Show Data"), 0, this);
>  			  action->setToggleAction(TRUE);
>  			  connect(action, SIGNAL(toggled(bool)),
>  				  parent(), SLOT(setShowData(bool)));
> @@ -898,7 +909,7 @@ void ConfigView::setShowData(bool b)
>  
>  void ConfigList::setAllOpen(bool open)
>  {
> -	QListViewItemIterator it(this);
> +	Q3ListViewItemIterator it(this);
>  
>  	for (; it.current(); it++)
>  		it.current()->setOpen(open);
> @@ -921,7 +932,7 @@ void ConfigView::updateListAll(void)
>  }
>  
>  ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
> -	: Parent(parent, name), sym(0), menu(0)
> +	: Parent(parent, name), sym(0), _menu(0)
>  {
>  	if (name) {
>  		configSettings->beginGroup(name);
> @@ -944,7 +955,7 @@ void ConfigInfoView::setShowDebug(bool b)
>  {
>  	if (_showDebug != b) {
>  		_showDebug = b;
> -		if (menu)
> +		if (_menu)
>  			menuInfo();
>  		else if (sym)
>  			symbolInfo();
> @@ -954,11 +965,11 @@ void ConfigInfoView::setShowDebug(bool b)
>  
>  void ConfigInfoView::setInfo(struct menu *m)
>  {
> -	if (menu == m)
> +	if (_menu == m)
>  		return;
> -	menu = m;
> +	_menu = m;
>  	sym = NULL;
> -	if (!menu)
> +	if (!_menu)
>  		clear();
>  	else
>  		menuInfo();
> @@ -968,17 +979,17 @@ void ConfigInfoView::setSource(const QString& name)
>  {
>  	const char *p = name.latin1();
>  
> -	menu = NULL;
> +	_menu = NULL;
>  	sym = NULL;
>  
>  	switch (p[0]) {
>  	case 'm':
>  		struct menu *m;
>  
> -		if (sscanf(p, "m%p", &m) == 1 && menu != m) {
> -			menu = m;
> +		if (sscanf(p, "m%p", &m) == 1 && _menu != m) {
> +			_menu = m;
>  			menuInfo();
> -			emit menuSelected(menu);
> +			emit menuSelected(_menu);
>  		}
>  		break;
>  	case 's':
> @@ -1013,11 +1024,11 @@ void ConfigInfoView::menuInfo(void)
>  	struct symbol* sym;
>  	QString head, debug, help;
>  
> -	sym = menu->sym;
> +	sym = _menu->sym;
>  	if (sym) {
> -		if (menu->prompt) {
> +		if (_menu->prompt) {
>  			head += "<big><b>";
> -			head += print_filter(_(menu->prompt->text));
> +			head += print_filter(_(_menu->prompt->text));
>  			head += "</b></big>";
>  			if (sym->name) {
>  				head += " (";
> @@ -1043,23 +1054,23 @@ void ConfigInfoView::menuInfo(void)
>  			debug = debug_info(sym);
>  
>  		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));
>  		str_free(&help_gstr);
> -	} else if (menu->prompt) {
> +	} else if (_menu->prompt) {
>  		head += "<big><b>";
> -		head += print_filter(_(menu->prompt->text));
> +		head += print_filter(_(_menu->prompt->text));
>  		head += "</b></big><br><br>";
>  		if (showDebug()) {
> -			if (menu->prompt->visible.expr) {
> +			if (_menu->prompt->visible.expr) {
>  				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>";
>  			}
>  		}
>  	}
>  	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);
>  }
> @@ -1162,10 +1173,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
>  		*text += str2;
>  }
>  
> -QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
> +Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
>  {
> -	QPopupMenu* popup = Parent::createPopupMenu(pos);
> -	QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
> +	Q3PopupMenu* popup = Parent::createPopupMenu(pos);
> +	Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
>  	  action->setToggleAction(TRUE);
>  	  connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
>  	  connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
> @@ -1222,7 +1233,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
>  			y = configSettings->readNumEntry("/window y", 0, &ok);
>  		if (ok)
>  			move(x, y);
> -		QValueList<int> sizes = configSettings->readSizes("/split", &ok);
> +		Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
>  		if (ok)
>  			split->setSizes(sizes);
>  		configSettings->endGroup();
> @@ -1309,60 +1320,60 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	configList->setFocus();
>  
>  	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()));
>  	  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()));
> -	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()));
> -	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()));
>  	conf_set_changed_callback(conf_changed);
>  	// Set saveAction's initial state
>  	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()));
> -	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()));
> -	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()));
> -	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()));
> -	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()));
>  
> -	QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
> +	Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
>  	  showNameAction->setToggleAction(TRUE);
>  	  connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
>  	  connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
>  	  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);
>  	  connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
>  	  connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
>  	  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);
>  	  connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
>  	  connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
>  	  showDataAction->setOn(configList->showData);
> -	QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this);
> +	Q3Action *showAllAction = new Q3Action(NULL, _("Show All Options"), 0, this);
>  	  showAllAction->setToggleAction(TRUE);
>  	  connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool)));
>  	  connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool)));
>  	  showAllAction->setOn(configList->showAll);
> -	QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this);
> +	Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this);
>  	  showDebugAction->setToggleAction(TRUE);
>  	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
>  	  connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
>  	  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()));
> -	QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
> +	Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
>  	  connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
>  
>  	// init tool bar
> @@ -1376,7 +1387,7 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	fullViewAction->addTo(toolBar);
>  
>  	// create config menu
> -	QPopupMenu* config = new QPopupMenu(this);
> +	Q3PopupMenu* config = new Q3PopupMenu(this);
>  	menu->insertItem(_("&File"), config);
>  	loadAction->addTo(config);
>  	saveAction->addTo(config);
> @@ -1385,22 +1396,21 @@ ConfigMainWindow::ConfigMainWindow(void)
>  	quitAction->addTo(config);
>  
>  	// create edit menu
> -	QPopupMenu* editMenu = new QPopupMenu(this);
> +	Q3PopupMenu* editMenu = new Q3PopupMenu(this);
>  	menu->insertItem(_("&Edit"), editMenu);
>  	searchAction->addTo(editMenu);
>  
>  	// create options menu
> -	QPopupMenu* optionMenu = new QPopupMenu(this);
> +	Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
>  	menu->insertItem(_("&Option"), optionMenu);
>  	showNameAction->addTo(optionMenu);
>  	showRangeAction->addTo(optionMenu);
>  	showDataAction->addTo(optionMenu);
>  	optionMenu->insertSeparator();
>  	showAllAction->addTo(optionMenu);
> -	showDebugAction->addTo(optionMenu);
>  
>  	// create help menu
> -	QPopupMenu* helpMenu = new QPopupMenu(this);
> +	Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
>  	menu->insertSeparator();
>  	menu->insertItem(_("&Help"), helpMenu);
>  	showIntroAction->addTo(helpMenu);
> @@ -1435,7 +1445,7 @@ ConfigMainWindow::ConfigMainWindow(void)
>  		showSplitView();
>  
>  	// UI setup done, restore splitter positions
> -	QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
> +	Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
>  	if (ok)
>  		split1->setSizes(sizes);
>  
> @@ -1446,7 +1456,7 @@ ConfigMainWindow::ConfigMainWindow(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())
>  		return;
>  	if (conf_read(QFile::encodeName(s)))
> @@ -1462,7 +1472,7 @@ void ConfigMainWindow::saveConfig(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())
>  		return;
>  	if (conf_write(QFile::encodeName(s)))
> diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
> index b3b5657..8e5848a 100644
> --- a/scripts/kconfig/qconf.h
> +++ b/scripts/kconfig/qconf.h
> @@ -3,26 +3,25 @@
>   * Released under the terms of the GNU GPL v2.0.
>   */
>  
> +#if QT_VERSION < 0x040000
>  #include <qlistview.h>
> -#if QT_VERSION >= 300
> -#include <qsettings.h>
>  #else
> -class QSettings {
> -public:
> -	void beginGroup(const QString& group) { }
> -	void endGroup(void) { }
> -	bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return def; }
> -	int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return def; }
> -	QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return def; }
> -	QStringList readListEntry(const QString& key, bool* ok = 0) const
> -	{ if (ok) *ok = FALSE; return QStringList(); }
> -	template <class t>
> -	bool writeEntry(const QString& key, t value)
> -	{ return TRUE; }
> -};
> +#include <q3listview.h>
> +#endif
> +#include <qsettings.h>
> +
> +#if QT_VERSION < 0x040000
> +#define Q3ValueList             QValueList
> +#define Q3PopupMenu             QPopupMenu
> +#define Q3ListView              QListView
> +#define Q3ListViewItem          QListViewItem
> +#define Q3VBox                  QVBox
> +#define Q3TextBrowser           QTextBrowser
> +#define Q3MainWindow            QMainWindow
> +#define Q3Action                QAction
> +#define Q3ToolBar               QToolBar
> +#define Q3ListViewItemIterator  QListViewItemIterator
> +#define Q3FileDialog            QFileDialog
>  #endif
>  
>  class ConfigView;
> @@ -31,11 +30,10 @@ class ConfigItem;
>  class ConfigLineEdit;
>  class ConfigMainWindow;
>  
> -
>  class ConfigSettings : public QSettings {
>  public:
> -	QValueList<int> readSizes(const QString& key, bool *ok);
> -	bool writeSizes(const QString& key, const QValueList<int>& value);
> +	Q3ValueList<int> readSizes(const QString& key, bool *ok);
> +	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
>  };
>  
>  enum colIdx {
> @@ -45,9 +43,9 @@ enum listMode {
>  	singleMode, menuMode, symbolMode, fullMode, listMode
>  };
>  
> -class ConfigList : public QListView {
> +class ConfigList : public Q3ListView {
>  	Q_OBJECT
> -	typedef class QListView Parent;
> +	typedef class Q3ListView Parent;
>  public:
>  	ConfigList(ConfigView* p, const char *name = 0);
>  	void reinit(void);
> @@ -129,17 +127,17 @@ public:
>  	struct menu *rootEntry;
>  	QColorGroup disabledColorGroup;
>  	QColorGroup inactivedColorGroup;
> -	QPopupMenu* headerPopup;
> +	Q3PopupMenu* headerPopup;
>  
>  private:
>  	int colMap[colNr];
>  	int colRevMap[colNr];
>  };
>  
> -class ConfigItem : public QListViewItem {
> -	typedef class QListViewItem Parent;
> +class ConfigItem : public Q3ListViewItem {
> +	typedef class Q3ListViewItem Parent;
>  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)
>  	{
>  		init();
> @@ -149,16 +147,14 @@ public:
>  	{
>  		init();
>  	}
> -	ConfigItem(QListView *parent, ConfigItem *after, bool v)
> +	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
>  	: Parent(parent, after), menu(0), visible(v), goParent(true)
>  	{
>  		init();
>  	}
>  	~ConfigItem(void);
>  	void init(void);
> -#if QT_VERSION >= 300
>  	void okRename(int col);
> -#endif
>  	void updateMenu(void);
>  	void testUpdateMenu(bool v);
>  	ConfigList* listView() const
> @@ -213,9 +209,9 @@ public:
>  	ConfigItem *item;
>  };
>  
> -class ConfigView : public QVBox {
> +class ConfigView : public Q3VBox {
>  	Q_OBJECT
> -	typedef class QVBox Parent;
> +	typedef class Q3VBox Parent;
>  public:
>  	ConfigView(QWidget* parent, const char *name = 0);
>  	~ConfigView(void);
> @@ -244,9 +240,9 @@ public:
>  	ConfigView* nextView;
>  };
>  
> -class ConfigInfoView : public QTextBrowser {
> +class ConfigInfoView : public Q3TextBrowser {
>  	Q_OBJECT
> -	typedef class QTextBrowser Parent;
> +	typedef class Q3TextBrowser Parent;
>  public:
>  	ConfigInfoView(QWidget* parent, const char *name = 0);
>  	bool showDebug(void) const { return _showDebug; }
> @@ -267,11 +263,11 @@ protected:
>  	QString debug_info(struct symbol *sym);
>  	static QString print_filter(const QString &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);
>  
>  	struct symbol *sym;
> -	struct menu *menu;
> +	struct menu *_menu;
>  	bool _showDebug;
>  };
>  
> @@ -295,10 +291,10 @@ protected:
>  	struct symbol **result;
>  };
>  
> -class ConfigMainWindow : public QMainWindow {
> +class ConfigMainWindow : public Q3MainWindow {
>  	Q_OBJECT
>  
> -	static QAction *saveAction;
> +	static Q3Action *saveAction;
>  	static void conf_changed(void);
>  public:
>  	ConfigMainWindow(void);
> @@ -327,8 +323,8 @@ protected:
>  	ConfigView *configView;
>  	ConfigList *configList;
>  	ConfigInfoView *helpText;
> -	QToolBar *toolBar;
> -	QAction *backAction;
> +	Q3ToolBar *toolBar;
> +	Q3Action *backAction;
>  	QSplitter* split1;
>  	QSplitter* split2;
>  };
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCHi v3] kconfig qconf: port to QT4
  2010-07-30 11:15           ` [PATCHi v3] " Alexander Stein
  2010-08-01 14:32             ` Ed Tomlinson
@ 2010-08-02 21:29             ` Michal Marek
  2010-08-31 15:34               ` [PATCH v4] " Alexander Stein
  1 sibling, 1 reply; 20+ messages in thread
From: Michal Marek @ 2010-08-02 21:29 UTC (permalink / raw)
  To: Alexander Stein; +Cc: linux-kbuild, Roman Zippel, lkml

On 30.7.2010 13:15, Alexander Stein wrote:
> A straight forward port to QT4 using qt3to4 and compiling against
>   qt3support
> 
> * rewritten makefile rules to detect QT4 by using qmake which is hopefully
>   portable enough

You are using pkg-config now.


> * 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 39a4897c1bb66e8a36043c105d7fd73d8b32b480
>   are use in native API
> 
> Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
> ---
> Changes in v2:
> * Use QT3 as fallback if no QT4 is available
> * Rename class names using defines for QT3
> 
> Changes in v3:
> * based on git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git
>   kconfig branch

Thanks, that makes my life easier.


> * Proper support for hidden options from 39a4897c1bb
> * slightly rework Makefile detection to use pkg-config for QT4 detection
> * Removed USE_QT3 usage, use QT_VERSION instead
> * Drop QT2 support
> 
> Michael,
> 
> i kept using Q3Foo classes and redefine them to QFoo instead of the other way
> around, as defining QFoo to Q3Foo doesn't work here.

OK.


>  scripts/kconfig/Makefile |   77 +++++++++++++---------
>  scripts/kconfig/qconf.cc |  162 +++++++++++++++++++++++++---------------------
>  scripts/kconfig/qconf.h  |   76 ++++++++++-----------
>  3 files changed, 169 insertions(+), 146 deletions(-)
> 
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index f8d1ee3..a203a90 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -233,40 +233,51 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
>  # QT needs some extra effort...
>  $(obj)/.tmp_qtcheck:
>  	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
> -	pkg-config --exists qt 2> /dev/null && pkg=qt; \
> -	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
> -	if [ -n "$$pkg" ]; then \
> -	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
> -	  libs="\$$(shell pkg-config $$pkg --libs)"; \
> -	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
> -	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
> +	pkg-config --exists QtCore 2> /dev/null; \
> +	if [ ! $? ]; then \

A couple of issues here: 1) The script is running under set -e, so if
there is no Qt4, it will exit right away. 2) The '$?' is interpreted by
make, you need to say '$$?' if you want the shell see '$?'. Last but not
least, there is no C-style arithmetics in the [ builtin, [ ! 0 ] and [ !
1 ] will both evaluate to failure. You probably meant [ $$? -ne 0 ], but
it still wouldn't work because of 1). Just use

  if ! pkg-config --exists QtCore 2> /dev/null; then
    ... qt 3 ...
  else
    ... qt 4 ...
  fi

When I fix it manually, it works OK both under Qt4 and Qt3, which is
great, but please submit a patch that you tested yourself. If you're
quick (but not too quick to omit testing), I'll push it in this merge
window.

thanks,
Michal

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH v4] kconfig qconf: port to QT4
  2010-08-02 21:29             ` [PATCHi v3] kconfig qconf: port to QT4 Michal Marek
@ 2010-08-31 15:34               ` Alexander Stein
  2010-09-01 14:57                 ` Michal Marek
  0 siblings, 1 reply; 20+ messages in thread
From: Alexander Stein @ 2010-08-31 15:34 UTC (permalink / raw)
  To: Michal Marek; +Cc: Roman Zippel, lkml, linux-kbuild, Alexander Stein

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 39a4897c1bb66e8a36043c105d7fd73d8b32b480
  are use in native API

Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
---
Changes in v2:
* Use QT3 as fallback if no QT4 is available
* Rename class names using defines for QT3

Changes in v3:
* based on git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git
  kconfig branch
  * Proper support for hidden options from 39a4897c1bb
  * slightly rework Makefile detection to use pkg-config for QT4 detection
  * Removed USE_QT3 usage, use QT_VERSION instead
  * Drop QT2 support

Changes in v4:
* fixed commit message wrt qmake <-> pkg-config
* fix if branching after pkg-config check

 scripts/kconfig/Makefile |   76 ++++++++++++---------
 scripts/kconfig/qconf.cc |  162 +++++++++++++++++++++++++---------------------
 scripts/kconfig/qconf.h  |   76 ++++++++++-----------
 3 files changed, 168 insertions(+), 146 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 7522a8b..d337229 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -237,40 +237,50 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
 # QT needs some extra effort...
 $(obj)/.tmp_qtcheck:
 	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
-	pkg-config --exists qt 2> /dev/null && pkg=qt; \
-	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
-	if [ -n "$$pkg" ]; then \
-	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
-	  libs="\$$(shell pkg-config $$pkg --libs)"; \
-	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
-	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	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-mt 2> /dev/null && pkg=qt-mt; \
+	    if [ -n "$$pkg" ]; then \
+	      cflags="\$$(shell pkg-config $$pkg --cflags)"; \
+	      libs="\$$(shell pkg-config $$pkg --libs)"; \
+	      moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
+	      dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	    else \
+	      for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
+	        if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
+	      done; \
+	      if [ -z "$$dir" ]; then \
+	        echo "*"; \
+	        echo "* Unable to find any QT installation. Please make sure that"; \
+	        echo "* the QT4 or QT3 development package is correctly installed and"; \
+	        echo "* either qmake can be found or install pkg-config or set"; \
+	        echo "* the QTDIR environment variable to the correct location."; \
+	        echo "*"; \
+	        false; \
+	      fi; \
+	      libpath=$$dir/lib; lib=qt; osdir=""; \
+	      $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
+	        osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
+	      test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
+	      test -f $$libpath/libqt-mt.so && lib=qt-mt; \
+	      cflags="-I$$dir/include"; \
+	      libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
+	      moc="$$dir/bin/moc"; \
+	    fi; \
+	    if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
+	      echo "*"; \
+	      echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
+	      echo "*"; \
+	      moc="/usr/bin/moc"; \
+	    fi; \
 	else \
-	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
-	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
-	  done; \
-	  if [ -z "$$dir" ]; then \
-	    echo "*"; \
-	    echo "* Unable to find the QT3 installation. Please make sure that"; \
-	    echo "* the QT3 development package is correctly installed and"; \
-	    echo "* either install pkg-config or set the QTDIR environment"; \
-	    echo "* variable to the correct location."; \
-	    echo "*"; \
-	    false; \
-	  fi; \
-	  libpath=$$dir/lib; lib=qt; osdir=""; \
-	  $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
-	    osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
-	  test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
-	  test -f $$libpath/libqt-mt.so && lib=qt-mt; \
-	  cflags="-I$$dir/include"; \
-	  libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
-	  moc="$$dir/bin/moc"; \
-	fi; \
-	if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
-	  echo "*"; \
-	  echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
-	  echo "*"; \
-	  moc="/usr/bin/moc"; \
+	  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_LIBS=$$libs" >> $@; \
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 820df2d..88d3874 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -3,25 +3,42 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
-#include <qapplication.h>
+#include <qglobal.h>
+
+#if QT_VERSION < 0x040000
 #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 <qtoolbar.h>
 #include <qlayout.h>
-#include <qvbox.h>
 #include <qsplitter.h>
-#include <qlistview.h>
-#include <qtextbrowser.h>
 #include <qlineedit.h>
 #include <qlabel.h>
 #include <qpushbutton.h>
 #include <qmenubar.h>
 #include <qmessagebox.h>
-#include <qaction.h>
-#include <qheader.h>
-#include <qfiledialog.h>
-#include <qdragobject.h>
 #include <qregexp.h>
+#include <qevent.h>
 
 #include <stdlib.h>
 
@@ -39,7 +56,7 @@
 static QApplication *configApp;
 static ConfigSettings *configSettings;
 
-QAction *ConfigMainWindow::saveAction;
+Q3Action *ConfigMainWindow::saveAction;
 
 static inline QString qgettext(const char* str)
 {
@@ -54,9 +71,9 @@ static inline QString qgettext(const QString& str)
 /**
  * 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::Iterator it;
 
@@ -69,10 +86,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
 /**
  * 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;
-	QValueList<int>::ConstIterator it;
+	Q3ValueList<int>::ConstIterator it;
 
 	for (it = value.begin(); it != value.end(); ++it)
 		stringList.push_back(QString::number(*it));
@@ -80,7 +97,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value
 }
 
 
-#if QT_VERSION >= 300
 /*
  * set the new data
  * TODO check the value
@@ -91,7 +107,6 @@ void ConfigItem::okRename(int col)
 	sym_set_string_value(menu->sym, text(dataColIdx).latin1());
 	listView()->updateList(this);
 }
-#endif
 
 /*
  * update the displayed of a menu entry
@@ -195,11 +210,9 @@ void ConfigItem::updateMenu(void)
 
 		data = sym_get_string_value(sym);
 
-#if QT_VERSION >= 300
 		int i = list->mapIdx(dataColIdx);
 		if (i >= 0)
 			setRenameEnabled(i, TRUE);
-#endif
 		setText(dataColIdx, data);
 		if (type == S_STRING)
 			prompt = QString("%1: %2").arg(prompt).arg(data);
@@ -432,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item)
 	if (!rootEntry) {
 		if (mode != listMode)
 			goto update;
-		QListViewItemIterator it(this);
+		Q3ListViewItemIterator it(this);
 		ConfigItem* item;
 
 		for (; it.current(); ++it) {
@@ -527,11 +540,9 @@ void ConfigList::changeValue(ConfigItem* item)
 	case S_INT:
 	case S_HEX:
 	case S_STRING:
-#if QT_VERSION >= 300
 		if (colMap[dataColIdx] >= 0)
 			item->startRename(colMap[dataColIdx]);
 		else
-#endif
 			parent()->lineEdit->show(item);
 		break;
 	}
@@ -563,7 +574,7 @@ void ConfigList::setParentMenu(void)
 		return;
 	setRootMenu(menu_get_parent_menu(rootEntry->parent));
 
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 	for (; (item = (ConfigItem*)it.current()); it++) {
 		if (item->menu == oldroot) {
 			setCurrentItem(item);
@@ -645,7 +656,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
 
 void ConfigList::keyPressEvent(QKeyEvent* ev)
 {
-	QListViewItem* i = currentItem();
+	Q3ListViewItem* i = currentItem();
 	ConfigItem* item;
 	struct menu *menu;
 	enum prop_type type;
@@ -811,10 +822,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 {
 	if (e->y() <= header()->geometry().bottom()) {
 		if (!headerPopup) {
-			QAction *action;
+			Q3Action *action;
 
-			headerPopup = new QPopupMenu(this);
-			action = new QAction(NULL, _("Show Name"), 0, this);
+			headerPopup = new Q3PopupMenu(this);
+			action = new Q3Action(NULL, _("Show Name"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowName(bool)));
@@ -822,7 +833,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showName);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Range"), 0, this);
+			action = new Q3Action(NULL, _("Show Range"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowRange(bool)));
@@ -830,7 +841,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showRange);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Data"), 0, this);
+			action = new Q3Action(NULL, _("Show Data"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowData(bool)));
@@ -914,7 +925,7 @@ void ConfigView::setShowData(bool b)
 
 void ConfigList::setAllOpen(bool open)
 {
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 
 	for (; it.current(); it++)
 		it.current()->setOpen(open);
@@ -937,7 +948,7 @@ void ConfigView::updateListAll(void)
 }
 
 ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
-	: Parent(parent, name), sym(0), menu(0)
+	: Parent(parent, name), sym(0), _menu(0)
 {
 	if (name) {
 		configSettings->beginGroup(name);
@@ -960,7 +971,7 @@ void ConfigInfoView::setShowDebug(bool b)
 {
 	if (_showDebug != b) {
 		_showDebug = b;
-		if (menu)
+		if (_menu)
 			menuInfo();
 		else if (sym)
 			symbolInfo();
@@ -970,11 +981,11 @@ void ConfigInfoView::setShowDebug(bool b)
 
 void ConfigInfoView::setInfo(struct menu *m)
 {
-	if (menu == m)
+	if (_menu == m)
 		return;
-	menu = m;
+	_menu = m;
 	sym = NULL;
-	if (!menu)
+	if (!_menu)
 		clear();
 	else
 		menuInfo();
@@ -1001,11 +1012,11 @@ void ConfigInfoView::menuInfo(void)
 	struct symbol* sym;
 	QString head, debug, help;
 
-	sym = menu->sym;
+	sym = _menu->sym;
 	if (sym) {
-		if (menu->prompt) {
+		if (_menu->prompt) {
 			head += "<big><b>";
-			head += print_filter(_(menu->prompt->text));
+			head += print_filter(_(_menu->prompt->text));
 			head += "</b></big>";
 			if (sym->name) {
 				head += " (";
@@ -1031,23 +1042,23 @@ void ConfigInfoView::menuInfo(void)
 			debug = debug_info(sym);
 
 		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));
 		str_free(&help_gstr);
-	} else if (menu->prompt) {
+	} else if (_menu->prompt) {
 		head += "<big><b>";
-		head += print_filter(_(menu->prompt->text));
+		head += print_filter(_(_menu->prompt->text));
 		head += "</b></big><br><br>";
 		if (showDebug()) {
-			if (menu->prompt->visible.expr) {
+			if (_menu->prompt->visible.expr) {
 				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>";
 			}
 		}
 	}
 	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);
 }
@@ -1150,10 +1161,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 		*text += str2;
 }
 
-QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
+Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
 {
-	QPopupMenu* popup = Parent::createPopupMenu(pos);
-	QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
+	Q3PopupMenu* popup = Parent::createPopupMenu(pos);
+	Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
 	  action->setToggleAction(TRUE);
 	  connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
 	  connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1210,7 +1221,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
 			y = configSettings->readNumEntry("/window y", 0, &ok);
 		if (ok)
 			move(x, y);
-		QValueList<int> sizes = configSettings->readSizes("/split", &ok);
+		Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
 		if (ok)
 			split->setSizes(sizes);
 		configSettings->endGroup();
@@ -1297,42 +1308,42 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configList->setFocus();
 
 	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()));
 	  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()));
-	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()));
-	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()));
 	conf_set_changed_callback(conf_changed);
 	// Set saveAction's initial state
 	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()));
-	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()));
-	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()));
-	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()));
-	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()));
 
-	QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
+	Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
 	  showNameAction->setToggleAction(TRUE);
 	  connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
 	  connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
 	  connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
 	  connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
@@ -1345,9 +1356,15 @@ ConfigMainWindow::ConfigMainWindow(void)
 	connect(optGroup, SIGNAL(selected(QAction *)), menuView,
 		SLOT(setOptionMode(QAction *)));
 
-	configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup);
-	configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup);
-	configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup);
+#if QT_VERSION >= 0x040000
+	configView->showNormalAction = new QAction(_("Show Normal Options"), 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->setOn(configList->optMode == normalOpt);
 	configView->showAllAction->setToggleAction(TRUE);
@@ -1355,15 +1372,15 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configView->showPromptAction->setToggleAction(TRUE);
 	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);
 	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
 	  connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
 	  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()));
-	QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
+	Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
 	  connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
 
 	// init tool bar
@@ -1377,7 +1394,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 	fullViewAction->addTo(toolBar);
 
 	// create config menu
-	QPopupMenu* config = new QPopupMenu(this);
+	Q3PopupMenu* config = new Q3PopupMenu(this);
 	menu->insertItem(_("&File"), config);
 	loadAction->addTo(config);
 	saveAction->addTo(config);
@@ -1386,12 +1403,12 @@ ConfigMainWindow::ConfigMainWindow(void)
 	quitAction->addTo(config);
 
 	// create edit menu
-	QPopupMenu* editMenu = new QPopupMenu(this);
+	Q3PopupMenu* editMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Edit"), editMenu);
 	searchAction->addTo(editMenu);
 
 	// create options menu
-	QPopupMenu* optionMenu = new QPopupMenu(this);
+	Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Option"), optionMenu);
 	showNameAction->addTo(optionMenu);
 	showRangeAction->addTo(optionMenu);
@@ -1399,10 +1416,9 @@ ConfigMainWindow::ConfigMainWindow(void)
 	optionMenu->insertSeparator();
 	optGroup->addTo(optionMenu);
 	optionMenu->insertSeparator();
-	showDebugAction->addTo(optionMenu);
 
 	// create help menu
-	QPopupMenu* helpMenu = new QPopupMenu(this);
+	Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
 	menu->insertSeparator();
 	menu->insertItem(_("&Help"), helpMenu);
 	showIntroAction->addTo(helpMenu);
@@ -1437,7 +1453,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 		showSplitView();
 
 	// UI setup done, restore splitter positions
-	QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
+	Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
 	if (ok)
 		split1->setSizes(sizes);
 
@@ -1448,7 +1464,7 @@ ConfigMainWindow::ConfigMainWindow(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())
 		return;
 	if (conf_read(QFile::encodeName(s)))
@@ -1464,7 +1480,7 @@ void ConfigMainWindow::saveConfig(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())
 		return;
 	if (conf_write(QFile::encodeName(s)))
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 636a74b..91677d9 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,26 +3,25 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
+#if QT_VERSION < 0x040000
 #include <qlistview.h>
-#if QT_VERSION >= 300
-#include <qsettings.h>
 #else
-class QSettings {
-public:
-	void beginGroup(const QString& group) { }
-	void endGroup(void) { }
-	bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QStringList readListEntry(const QString& key, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return QStringList(); }
-	template <class t>
-	bool writeEntry(const QString& key, t value)
-	{ return TRUE; }
-};
+#include <q3listview.h>
+#endif
+#include <qsettings.h>
+
+#if QT_VERSION < 0x040000
+#define Q3ValueList             QValueList
+#define Q3PopupMenu             QPopupMenu
+#define Q3ListView              QListView
+#define Q3ListViewItem          QListViewItem
+#define Q3VBox                  QVBox
+#define Q3TextBrowser           QTextBrowser
+#define Q3MainWindow            QMainWindow
+#define Q3Action                QAction
+#define Q3ToolBar               QToolBar
+#define Q3ListViewItemIterator  QListViewItemIterator
+#define Q3FileDialog            QFileDialog
 #endif
 
 class ConfigView;
@@ -31,11 +30,10 @@ class ConfigItem;
 class ConfigLineEdit;
 class ConfigMainWindow;
 
-
 class ConfigSettings : public QSettings {
 public:
-	QValueList<int> readSizes(const QString& key, bool *ok);
-	bool writeSizes(const QString& key, const QValueList<int>& value);
+	Q3ValueList<int> readSizes(const QString& key, bool *ok);
+	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
 };
 
 enum colIdx {
@@ -48,9 +46,9 @@ enum optionMode {
 	normalOpt = 0, allOpt, promptOpt
 };
 
-class ConfigList : public QListView {
+class ConfigList : public Q3ListView {
 	Q_OBJECT
-	typedef class QListView Parent;
+	typedef class Q3ListView Parent;
 public:
 	ConfigList(ConfigView* p, const char *name = 0);
 	void reinit(void);
@@ -135,17 +133,17 @@ public:
 	struct menu *rootEntry;
 	QColorGroup disabledColorGroup;
 	QColorGroup inactivedColorGroup;
-	QPopupMenu* headerPopup;
+	Q3PopupMenu* headerPopup;
 
 private:
 	int colMap[colNr];
 	int colRevMap[colNr];
 };
 
-class ConfigItem : public QListViewItem {
-	typedef class QListViewItem Parent;
+class ConfigItem : public Q3ListViewItem {
+	typedef class Q3ListViewItem Parent;
 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)
 	{
 		init();
@@ -155,16 +153,14 @@ public:
 	{
 		init();
 	}
-	ConfigItem(QListView *parent, ConfigItem *after, bool v)
+	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
 	: Parent(parent, after), menu(0), visible(v), goParent(true)
 	{
 		init();
 	}
 	~ConfigItem(void);
 	void init(void);
-#if QT_VERSION >= 300
 	void okRename(int col);
-#endif
 	void updateMenu(void);
 	void testUpdateMenu(bool v);
 	ConfigList* listView() const
@@ -219,9 +215,9 @@ public:
 	ConfigItem *item;
 };
 
-class ConfigView : public QVBox {
+class ConfigView : public Q3VBox {
 	Q_OBJECT
-	typedef class QVBox Parent;
+	typedef class Q3VBox Parent;
 public:
 	ConfigView(QWidget* parent, const char *name = 0);
 	~ConfigView(void);
@@ -252,9 +248,9 @@ public:
 	static QAction *showPromptAction;
 };
 
-class ConfigInfoView : public QTextBrowser {
+class ConfigInfoView : public Q3TextBrowser {
 	Q_OBJECT
-	typedef class QTextBrowser Parent;
+	typedef class Q3TextBrowser Parent;
 public:
 	ConfigInfoView(QWidget* parent, const char *name = 0);
 	bool showDebug(void) const { return _showDebug; }
@@ -274,11 +270,11 @@ protected:
 	QString debug_info(struct symbol *sym);
 	static QString print_filter(const QString &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);
 
 	struct symbol *sym;
-	struct menu *menu;
+	struct menu *_menu;
 	bool _showDebug;
 };
 
@@ -302,10 +298,10 @@ protected:
 	struct symbol **result;
 };
 
-class ConfigMainWindow : public QMainWindow {
+class ConfigMainWindow : public Q3MainWindow {
 	Q_OBJECT
 
-	static QAction *saveAction;
+	static Q3Action *saveAction;
 	static void conf_changed(void);
 public:
 	ConfigMainWindow(void);
@@ -334,8 +330,8 @@ protected:
 	ConfigView *configView;
 	ConfigList *configList;
 	ConfigInfoView *helpText;
-	QToolBar *toolBar;
-	QAction *backAction;
+	Q3ToolBar *toolBar;
+	Q3Action *backAction;
 	QSplitter* split1;
 	QSplitter* split2;
 };
-- 
1.7.2.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v4] kconfig qconf: port to QT4
  2010-08-31 15:34               ` [PATCH v4] " Alexander Stein
@ 2010-09-01 14:57                 ` Michal Marek
  0 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2010-09-01 14:57 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Roman Zippel, lkml, linux-kbuild

On 31.8.2010 17:34, Alexander Stein wrote:
> 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 39a4897c1bb66e8a36043c105d7fd73d8b32b480
>   are use in native API
> 
> Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
> ---
> Changes in v2:
> * Use QT3 as fallback if no QT4 is available
> * Rename class names using defines for QT3
> 
> Changes in v3:
> * based on git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git
>   kconfig branch
>   * Proper support for hidden options from 39a4897c1bb
>   * slightly rework Makefile detection to use pkg-config for QT4 detection
>   * Removed USE_QT3 usage, use QT_VERSION instead
>   * Drop QT2 support
> 
> Changes in v4:
> * fixed commit message wrt qmake <-> pkg-config
> * fix if branching after pkg-config check

Thanks a lot, applied now.

Michal

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] kconfig qconf: port to QT4
  2010-08-02 12:01                 ` Ed Tomlinson
@ 2010-09-18 14:22                   ` Ed Tomlinson
  2010-09-20 12:03                     ` Michal Marek
                                       ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Ed Tomlinson @ 2010-09-18 14:22 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Michal Marek, linux-kbuild, Roman Zippel, lkml

On Monday 02 August 2010 08:01:23 Ed Tomlinson wrote:
> Hi,
> 
> Works as advertised here.  The merge window for .36 is open.  Would it be possible for this to be included?

Looks like this did not make it into .36...  would you have a version that works with .36-rc

TIA
Ed Tomlinson

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] kconfig qconf: port to QT4
  2010-09-18 14:22                   ` Ed Tomlinson
@ 2010-09-20 12:03                     ` Michal Marek
  2010-09-21 17:31                     ` [PATCH 1/2] " Alexander Stein
  2010-09-21 17:31                     ` [PATCH 2/2] Fix QT4 moc, cflags libs detection on dual QT3/Qt4 systems Alexander Stein
  2 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2010-09-20 12:03 UTC (permalink / raw)
  To: Ed Tomlinson; +Cc: Alexander Stein, linux-kbuild, Roman Zippel, lkml

On 18.9.2010 16:22, Ed Tomlinson wrote:
> On Monday 02 August 2010 08:01:23 Ed Tomlinson wrote:
>> Hi,
>>
>> Works as advertised here.  The merge window for .36 is open.  Would it be possible for this to be included?
> 
> Looks like this did not make it into .36...  would you have a version that works with .36-rc

It is in the kconfig branch of
git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git and
will end up in 2.6.37-rc1.

Michal

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/2] kconfig qconf: port to QT4
  2010-09-18 14:22                   ` Ed Tomlinson
  2010-09-20 12:03                     ` Michal Marek
@ 2010-09-21 17:31                     ` Alexander Stein
  2010-09-21 17:31                     ` [PATCH 2/2] Fix QT4 moc, cflags libs detection on dual QT3/Qt4 systems Alexander Stein
  2 siblings, 0 replies; 20+ messages in thread
From: Alexander Stein @ 2010-09-21 17:31 UTC (permalink / raw)
  To: Ed Tomlinson
  Cc: Michal Marek, linux-kbuild, Roman Zippel, lkml, Alexander Stein

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 39a4897c1bb66e8a36043c105d7fd73d8b32b480
  are use in native API

Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
Signed-off-by: Michal Marek <mmarek@suse.cz>
---
these two patches should apply on v2.6.36-rc5

 scripts/kconfig/Makefile |   76 ++++++++++++---------
 scripts/kconfig/qconf.cc |  162 +++++++++++++++++++++++++---------------------
 scripts/kconfig/qconf.h  |   76 ++++++++++-----------
 3 files changed, 168 insertions(+), 146 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index de934de..cb02b1e 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -236,40 +236,50 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
 # QT needs some extra effort...
 $(obj)/.tmp_qtcheck:
 	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
-	pkg-config --exists qt 2> /dev/null && pkg=qt; \
-	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
-	if [ -n "$$pkg" ]; then \
-	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
-	  libs="\$$(shell pkg-config $$pkg --libs)"; \
-	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
-	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	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-mt 2> /dev/null && pkg=qt-mt; \
+	    if [ -n "$$pkg" ]; then \
+	      cflags="\$$(shell pkg-config $$pkg --cflags)"; \
+	      libs="\$$(shell pkg-config $$pkg --libs)"; \
+	      moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
+	      dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	    else \
+	      for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
+	        if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
+	      done; \
+	      if [ -z "$$dir" ]; then \
+	        echo "*"; \
+	        echo "* Unable to find any QT installation. Please make sure that"; \
+	        echo "* the QT4 or QT3 development package is correctly installed and"; \
+	        echo "* either qmake can be found or install pkg-config or set"; \
+	        echo "* the QTDIR environment variable to the correct location."; \
+	        echo "*"; \
+	        false; \
+	      fi; \
+	      libpath=$$dir/lib; lib=qt; osdir=""; \
+	      $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
+	        osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
+	      test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
+	      test -f $$libpath/libqt-mt.so && lib=qt-mt; \
+	      cflags="-I$$dir/include"; \
+	      libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
+	      moc="$$dir/bin/moc"; \
+	    fi; \
+	    if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
+	      echo "*"; \
+	      echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
+	      echo "*"; \
+	      moc="/usr/bin/moc"; \
+	    fi; \
 	else \
-	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
-	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
-	  done; \
-	  if [ -z "$$dir" ]; then \
-	    echo "*"; \
-	    echo "* Unable to find the QT3 installation. Please make sure that"; \
-	    echo "* the QT3 development package is correctly installed and"; \
-	    echo "* either install pkg-config or set the QTDIR environment"; \
-	    echo "* variable to the correct location."; \
-	    echo "*"; \
-	    false; \
-	  fi; \
-	  libpath=$$dir/lib; lib=qt; osdir=""; \
-	  $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
-	    osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
-	  test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
-	  test -f $$libpath/libqt-mt.so && lib=qt-mt; \
-	  cflags="-I$$dir/include"; \
-	  libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
-	  moc="$$dir/bin/moc"; \
-	fi; \
-	if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
-	  echo "*"; \
-	  echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
-	  echo "*"; \
-	  moc="/usr/bin/moc"; \
+	  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_LIBS=$$libs" >> $@; \
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 820df2d..88d3874 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -3,25 +3,42 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
-#include <qapplication.h>
+#include <qglobal.h>
+
+#if QT_VERSION < 0x040000
 #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 <qtoolbar.h>
 #include <qlayout.h>
-#include <qvbox.h>
 #include <qsplitter.h>
-#include <qlistview.h>
-#include <qtextbrowser.h>
 #include <qlineedit.h>
 #include <qlabel.h>
 #include <qpushbutton.h>
 #include <qmenubar.h>
 #include <qmessagebox.h>
-#include <qaction.h>
-#include <qheader.h>
-#include <qfiledialog.h>
-#include <qdragobject.h>
 #include <qregexp.h>
+#include <qevent.h>
 
 #include <stdlib.h>
 
@@ -39,7 +56,7 @@
 static QApplication *configApp;
 static ConfigSettings *configSettings;
 
-QAction *ConfigMainWindow::saveAction;
+Q3Action *ConfigMainWindow::saveAction;
 
 static inline QString qgettext(const char* str)
 {
@@ -54,9 +71,9 @@ static inline QString qgettext(const QString& str)
 /**
  * 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::Iterator it;
 
@@ -69,10 +86,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
 /**
  * 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;
-	QValueList<int>::ConstIterator it;
+	Q3ValueList<int>::ConstIterator it;
 
 	for (it = value.begin(); it != value.end(); ++it)
 		stringList.push_back(QString::number(*it));
@@ -80,7 +97,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value
 }
 
 
-#if QT_VERSION >= 300
 /*
  * set the new data
  * TODO check the value
@@ -91,7 +107,6 @@ void ConfigItem::okRename(int col)
 	sym_set_string_value(menu->sym, text(dataColIdx).latin1());
 	listView()->updateList(this);
 }
-#endif
 
 /*
  * update the displayed of a menu entry
@@ -195,11 +210,9 @@ void ConfigItem::updateMenu(void)
 
 		data = sym_get_string_value(sym);
 
-#if QT_VERSION >= 300
 		int i = list->mapIdx(dataColIdx);
 		if (i >= 0)
 			setRenameEnabled(i, TRUE);
-#endif
 		setText(dataColIdx, data);
 		if (type == S_STRING)
 			prompt = QString("%1: %2").arg(prompt).arg(data);
@@ -432,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item)
 	if (!rootEntry) {
 		if (mode != listMode)
 			goto update;
-		QListViewItemIterator it(this);
+		Q3ListViewItemIterator it(this);
 		ConfigItem* item;
 
 		for (; it.current(); ++it) {
@@ -527,11 +540,9 @@ void ConfigList::changeValue(ConfigItem* item)
 	case S_INT:
 	case S_HEX:
 	case S_STRING:
-#if QT_VERSION >= 300
 		if (colMap[dataColIdx] >= 0)
 			item->startRename(colMap[dataColIdx]);
 		else
-#endif
 			parent()->lineEdit->show(item);
 		break;
 	}
@@ -563,7 +574,7 @@ void ConfigList::setParentMenu(void)
 		return;
 	setRootMenu(menu_get_parent_menu(rootEntry->parent));
 
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 	for (; (item = (ConfigItem*)it.current()); it++) {
 		if (item->menu == oldroot) {
 			setCurrentItem(item);
@@ -645,7 +656,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
 
 void ConfigList::keyPressEvent(QKeyEvent* ev)
 {
-	QListViewItem* i = currentItem();
+	Q3ListViewItem* i = currentItem();
 	ConfigItem* item;
 	struct menu *menu;
 	enum prop_type type;
@@ -811,10 +822,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 {
 	if (e->y() <= header()->geometry().bottom()) {
 		if (!headerPopup) {
-			QAction *action;
+			Q3Action *action;
 
-			headerPopup = new QPopupMenu(this);
-			action = new QAction(NULL, _("Show Name"), 0, this);
+			headerPopup = new Q3PopupMenu(this);
+			action = new Q3Action(NULL, _("Show Name"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowName(bool)));
@@ -822,7 +833,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showName);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Range"), 0, this);
+			action = new Q3Action(NULL, _("Show Range"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowRange(bool)));
@@ -830,7 +841,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
 				  action, SLOT(setOn(bool)));
 			  action->setOn(showRange);
 			  action->addTo(headerPopup);
-			action = new QAction(NULL, _("Show Data"), 0, this);
+			action = new Q3Action(NULL, _("Show Data"), 0, this);
 			  action->setToggleAction(TRUE);
 			  connect(action, SIGNAL(toggled(bool)),
 				  parent(), SLOT(setShowData(bool)));
@@ -914,7 +925,7 @@ void ConfigView::setShowData(bool b)
 
 void ConfigList::setAllOpen(bool open)
 {
-	QListViewItemIterator it(this);
+	Q3ListViewItemIterator it(this);
 
 	for (; it.current(); it++)
 		it.current()->setOpen(open);
@@ -937,7 +948,7 @@ void ConfigView::updateListAll(void)
 }
 
 ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
-	: Parent(parent, name), sym(0), menu(0)
+	: Parent(parent, name), sym(0), _menu(0)
 {
 	if (name) {
 		configSettings->beginGroup(name);
@@ -960,7 +971,7 @@ void ConfigInfoView::setShowDebug(bool b)
 {
 	if (_showDebug != b) {
 		_showDebug = b;
-		if (menu)
+		if (_menu)
 			menuInfo();
 		else if (sym)
 			symbolInfo();
@@ -970,11 +981,11 @@ void ConfigInfoView::setShowDebug(bool b)
 
 void ConfigInfoView::setInfo(struct menu *m)
 {
-	if (menu == m)
+	if (_menu == m)
 		return;
-	menu = m;
+	_menu = m;
 	sym = NULL;
-	if (!menu)
+	if (!_menu)
 		clear();
 	else
 		menuInfo();
@@ -1001,11 +1012,11 @@ void ConfigInfoView::menuInfo(void)
 	struct symbol* sym;
 	QString head, debug, help;
 
-	sym = menu->sym;
+	sym = _menu->sym;
 	if (sym) {
-		if (menu->prompt) {
+		if (_menu->prompt) {
 			head += "<big><b>";
-			head += print_filter(_(menu->prompt->text));
+			head += print_filter(_(_menu->prompt->text));
 			head += "</b></big>";
 			if (sym->name) {
 				head += " (";
@@ -1031,23 +1042,23 @@ void ConfigInfoView::menuInfo(void)
 			debug = debug_info(sym);
 
 		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));
 		str_free(&help_gstr);
-	} else if (menu->prompt) {
+	} else if (_menu->prompt) {
 		head += "<big><b>";
-		head += print_filter(_(menu->prompt->text));
+		head += print_filter(_(_menu->prompt->text));
 		head += "</b></big><br><br>";
 		if (showDebug()) {
-			if (menu->prompt->visible.expr) {
+			if (_menu->prompt->visible.expr) {
 				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>";
 			}
 		}
 	}
 	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);
 }
@@ -1150,10 +1161,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 		*text += str2;
 }
 
-QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
+Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
 {
-	QPopupMenu* popup = Parent::createPopupMenu(pos);
-	QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup);
+	Q3PopupMenu* popup = Parent::createPopupMenu(pos);
+	Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
 	  action->setToggleAction(TRUE);
 	  connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
 	  connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1210,7 +1221,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
 			y = configSettings->readNumEntry("/window y", 0, &ok);
 		if (ok)
 			move(x, y);
-		QValueList<int> sizes = configSettings->readSizes("/split", &ok);
+		Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
 		if (ok)
 			split->setSizes(sizes);
 		configSettings->endGroup();
@@ -1297,42 +1308,42 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configList->setFocus();
 
 	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()));
 	  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()));
-	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()));
-	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()));
 	conf_set_changed_callback(conf_changed);
 	// Set saveAction's initial state
 	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()));
-	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()));
-	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()));
-	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()));
-	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()));
 
-	QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this);
+	Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
 	  showNameAction->setToggleAction(TRUE);
 	  connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
 	  connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
 	  connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
 	  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);
 	  connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
 	  connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
@@ -1345,9 +1356,15 @@ ConfigMainWindow::ConfigMainWindow(void)
 	connect(optGroup, SIGNAL(selected(QAction *)), menuView,
 		SLOT(setOptionMode(QAction *)));
 
-	configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup);
-	configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup);
-	configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup);
+#if QT_VERSION >= 0x040000
+	configView->showNormalAction = new QAction(_("Show Normal Options"), 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->setOn(configList->optMode == normalOpt);
 	configView->showAllAction->setToggleAction(TRUE);
@@ -1355,15 +1372,15 @@ ConfigMainWindow::ConfigMainWindow(void)
 	configView->showPromptAction->setToggleAction(TRUE);
 	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);
 	  connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
 	  connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
 	  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()));
-	QAction *showAboutAction = new QAction(NULL, _("About"), 0, this);
+	Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
 	  connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
 
 	// init tool bar
@@ -1377,7 +1394,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 	fullViewAction->addTo(toolBar);
 
 	// create config menu
-	QPopupMenu* config = new QPopupMenu(this);
+	Q3PopupMenu* config = new Q3PopupMenu(this);
 	menu->insertItem(_("&File"), config);
 	loadAction->addTo(config);
 	saveAction->addTo(config);
@@ -1386,12 +1403,12 @@ ConfigMainWindow::ConfigMainWindow(void)
 	quitAction->addTo(config);
 
 	// create edit menu
-	QPopupMenu* editMenu = new QPopupMenu(this);
+	Q3PopupMenu* editMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Edit"), editMenu);
 	searchAction->addTo(editMenu);
 
 	// create options menu
-	QPopupMenu* optionMenu = new QPopupMenu(this);
+	Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
 	menu->insertItem(_("&Option"), optionMenu);
 	showNameAction->addTo(optionMenu);
 	showRangeAction->addTo(optionMenu);
@@ -1399,10 +1416,9 @@ ConfigMainWindow::ConfigMainWindow(void)
 	optionMenu->insertSeparator();
 	optGroup->addTo(optionMenu);
 	optionMenu->insertSeparator();
-	showDebugAction->addTo(optionMenu);
 
 	// create help menu
-	QPopupMenu* helpMenu = new QPopupMenu(this);
+	Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
 	menu->insertSeparator();
 	menu->insertItem(_("&Help"), helpMenu);
 	showIntroAction->addTo(helpMenu);
@@ -1437,7 +1453,7 @@ ConfigMainWindow::ConfigMainWindow(void)
 		showSplitView();
 
 	// UI setup done, restore splitter positions
-	QValueList<int> sizes = configSettings->readSizes("/split1", &ok);
+	Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
 	if (ok)
 		split1->setSizes(sizes);
 
@@ -1448,7 +1464,7 @@ ConfigMainWindow::ConfigMainWindow(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())
 		return;
 	if (conf_read(QFile::encodeName(s)))
@@ -1464,7 +1480,7 @@ void ConfigMainWindow::saveConfig(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())
 		return;
 	if (conf_write(QFile::encodeName(s)))
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 636a74b..91677d9 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,26 +3,25 @@
  * Released under the terms of the GNU GPL v2.0.
  */
 
+#if QT_VERSION < 0x040000
 #include <qlistview.h>
-#if QT_VERSION >= 300
-#include <qsettings.h>
 #else
-class QSettings {
-public:
-	void beginGroup(const QString& group) { }
-	void endGroup(void) { }
-	bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return def; }
-	QStringList readListEntry(const QString& key, bool* ok = 0) const
-	{ if (ok) *ok = FALSE; return QStringList(); }
-	template <class t>
-	bool writeEntry(const QString& key, t value)
-	{ return TRUE; }
-};
+#include <q3listview.h>
+#endif
+#include <qsettings.h>
+
+#if QT_VERSION < 0x040000
+#define Q3ValueList             QValueList
+#define Q3PopupMenu             QPopupMenu
+#define Q3ListView              QListView
+#define Q3ListViewItem          QListViewItem
+#define Q3VBox                  QVBox
+#define Q3TextBrowser           QTextBrowser
+#define Q3MainWindow            QMainWindow
+#define Q3Action                QAction
+#define Q3ToolBar               QToolBar
+#define Q3ListViewItemIterator  QListViewItemIterator
+#define Q3FileDialog            QFileDialog
 #endif
 
 class ConfigView;
@@ -31,11 +30,10 @@ class ConfigItem;
 class ConfigLineEdit;
 class ConfigMainWindow;
 
-
 class ConfigSettings : public QSettings {
 public:
-	QValueList<int> readSizes(const QString& key, bool *ok);
-	bool writeSizes(const QString& key, const QValueList<int>& value);
+	Q3ValueList<int> readSizes(const QString& key, bool *ok);
+	bool writeSizes(const QString& key, const Q3ValueList<int>& value);
 };
 
 enum colIdx {
@@ -48,9 +46,9 @@ enum optionMode {
 	normalOpt = 0, allOpt, promptOpt
 };
 
-class ConfigList : public QListView {
+class ConfigList : public Q3ListView {
 	Q_OBJECT
-	typedef class QListView Parent;
+	typedef class Q3ListView Parent;
 public:
 	ConfigList(ConfigView* p, const char *name = 0);
 	void reinit(void);
@@ -135,17 +133,17 @@ public:
 	struct menu *rootEntry;
 	QColorGroup disabledColorGroup;
 	QColorGroup inactivedColorGroup;
-	QPopupMenu* headerPopup;
+	Q3PopupMenu* headerPopup;
 
 private:
 	int colMap[colNr];
 	int colRevMap[colNr];
 };
 
-class ConfigItem : public QListViewItem {
-	typedef class QListViewItem Parent;
+class ConfigItem : public Q3ListViewItem {
+	typedef class Q3ListViewItem Parent;
 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)
 	{
 		init();
@@ -155,16 +153,14 @@ public:
 	{
 		init();
 	}
-	ConfigItem(QListView *parent, ConfigItem *after, bool v)
+	ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
 	: Parent(parent, after), menu(0), visible(v), goParent(true)
 	{
 		init();
 	}
 	~ConfigItem(void);
 	void init(void);
-#if QT_VERSION >= 300
 	void okRename(int col);
-#endif
 	void updateMenu(void);
 	void testUpdateMenu(bool v);
 	ConfigList* listView() const
@@ -219,9 +215,9 @@ public:
 	ConfigItem *item;
 };
 
-class ConfigView : public QVBox {
+class ConfigView : public Q3VBox {
 	Q_OBJECT
-	typedef class QVBox Parent;
+	typedef class Q3VBox Parent;
 public:
 	ConfigView(QWidget* parent, const char *name = 0);
 	~ConfigView(void);
@@ -252,9 +248,9 @@ public:
 	static QAction *showPromptAction;
 };
 
-class ConfigInfoView : public QTextBrowser {
+class ConfigInfoView : public Q3TextBrowser {
 	Q_OBJECT
-	typedef class QTextBrowser Parent;
+	typedef class Q3TextBrowser Parent;
 public:
 	ConfigInfoView(QWidget* parent, const char *name = 0);
 	bool showDebug(void) const { return _showDebug; }
@@ -274,11 +270,11 @@ protected:
 	QString debug_info(struct symbol *sym);
 	static QString print_filter(const QString &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);
 
 	struct symbol *sym;
-	struct menu *menu;
+	struct menu *_menu;
 	bool _showDebug;
 };
 
@@ -302,10 +298,10 @@ protected:
 	struct symbol **result;
 };
 
-class ConfigMainWindow : public QMainWindow {
+class ConfigMainWindow : public Q3MainWindow {
 	Q_OBJECT
 
-	static QAction *saveAction;
+	static Q3Action *saveAction;
 	static void conf_changed(void);
 public:
 	ConfigMainWindow(void);
@@ -334,8 +330,8 @@ protected:
 	ConfigView *configView;
 	ConfigList *configList;
 	ConfigInfoView *helpText;
-	QToolBar *toolBar;
-	QAction *backAction;
+	Q3ToolBar *toolBar;
+	Q3Action *backAction;
 	QSplitter* split1;
 	QSplitter* split2;
 };
-- 
1.7.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/2] Fix QT4 moc, cflags libs detection on dual QT3/Qt4 systems
  2010-09-18 14:22                   ` Ed Tomlinson
  2010-09-20 12:03                     ` Michal Marek
  2010-09-21 17:31                     ` [PATCH 1/2] " Alexander Stein
@ 2010-09-21 17:31                     ` Alexander Stein
  2 siblings, 0 replies; 20+ messages in thread
From: Alexander Stein @ 2010-09-21 17:31 UTC (permalink / raw)
  To: Ed Tomlinson
  Cc: Michal Marek, linux-kbuild, Roman Zippel, lkml, Alexander Stein

On system with QT3 and QT4 qmake in PATH may be from QT3. So we use
pkg-config for proper QT4 detection.
By reqesting cflags and libs for either QtCore, QtGui and QtSupport include
dirs and libs get listed several times, but so we won't mis anything

CC: Michal Marek <mmarek@suse.cz>
Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
---
 scripts/kconfig/Makefile |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index cb02b1e..321aa67 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -274,12 +274,10 @@ $(obj)/.tmp_qtcheck:
 	      moc="/usr/bin/moc"; \
 	    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"; \
+	  cflags="\$$(shell pkg-config QtCore --cflags) \$$(shell pkg-config QtGui --cflags) \$$(shell pkg-config Qt3Support --cflags)"; \
+	  libs="\$$(shell pkg-config QtCore --libs) \$$(shell pkg-config QtGui --libs) \$$(shell pkg-config Qt3Support --libs)"; \
+	  binpath="\$$(shell pkg-config QtCore --variable=prefix)"; \
+	  moc="$$binpath/bin/moc"; \
 	fi; \
 	echo "KC_QT_CFLAGS=$$cflags" > $@; \
 	echo "KC_QT_LIBS=$$libs" >> $@; \
-- 
1.7.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2010-09-21 17:32 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-06 17:51 [PATCH] kconfig qconf: port to QT4 Alexander Stein
2010-06-07 12:45 ` Michal Marek
2010-06-07 17:12   ` Alexander Stein
2010-06-07 18:01     ` Gene Heskett
2010-06-07 21:29     ` Michal Marek
2010-07-13 19:26       ` [PATCH v2] " Alexander Stein
2010-07-26 12:44         ` Michal Marek
2010-07-26 12:47           ` Michal Marek
2010-07-26 12:47             ` Michal Marek
2010-07-30 11:15           ` [PATCHi v3] " Alexander Stein
2010-08-01 14:32             ` Ed Tomlinson
2010-08-01 19:28               ` [PATCH] " Alexander Stein
2010-08-02 12:01                 ` Ed Tomlinson
2010-09-18 14:22                   ` Ed Tomlinson
2010-09-20 12:03                     ` Michal Marek
2010-09-21 17:31                     ` [PATCH 1/2] " Alexander Stein
2010-09-21 17:31                     ` [PATCH 2/2] Fix QT4 moc, cflags libs detection on dual QT3/Qt4 systems Alexander Stein
2010-08-02 21:29             ` [PATCHi v3] kconfig qconf: port to QT4 Michal Marek
2010-08-31 15:34               ` [PATCH v4] " Alexander Stein
2010-09-01 14:57                 ` Michal Marek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.