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

kconfig qconf: port to QT4

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

* Use pkg-config to detect QT4 which is hopefully portable enough
* If no QT4, QT3 will by tried instead
* Classes renamed using qt3to4
  * If build using QT3 renamed to QT3 class names using defines
* ConfigInfoView::menu has to be renamed as QT4 moc strips struct from
  struct menu and creates a name conflict
* QT2 support has been dropped
* The hidden options inserted in 39a4897c
  are use in native API
Signed-off-by: default avatarAlexander Stein <alexander.stein@informatik.tu-chemnitz.de>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent c94d3fb0
...@@ -235,40 +235,50 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile ...@@ -235,40 +235,50 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
# QT needs some extra effort... # QT needs some extra effort...
$(obj)/.tmp_qtcheck: $(obj)/.tmp_qtcheck:
@set -e; echo " CHECK qt"; dir=""; pkg=""; \ @set -e; echo " CHECK qt"; dir=""; pkg=""; \
pkg-config --exists qt 2> /dev/null && pkg=qt; \ if ! pkg-config --exists QtCore 2> /dev/null; then \
pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
if [ -n "$$pkg" ]; then \ pkg-config --exists qt 2> /dev/null && pkg=qt; \
cflags="\$$(shell pkg-config $$pkg --cflags)"; \ pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
libs="\$$(shell pkg-config $$pkg --libs)"; \ if [ -n "$$pkg" ]; then \
moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ cflags="\$$(shell pkg-config $$pkg --cflags)"; \
dir="$$(pkg-config $$pkg --variable=prefix)"; \ 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 \ else \
for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ headerpath="\$$(shell qmake -query QT_INSTALL_HEADERS)"; \
if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ libpath="\$$(shell qmake -query QT_INSTALL_LIBS)"; \
done; \ binpath="\$$(shell qmake -query QT_INSTALL_BINS)"; \
if [ -z "$$dir" ]; then \ cflags="-I$$headerpath -I$$headerpath/QtCore -I$$headerpath/QtGui -I$$headerpath/Qt3Support -DQT3_SUPPORT"; \
echo "*"; \ libs="-L$$libpath -Wl,-rpath,$$libpath -lQtCore -lQtGui -lQt3Support"; \
echo "* Unable to find the QT3 installation. Please make sure that"; \ moc="$$binpath/moc"; \
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"; \
fi; \ fi; \
echo "KC_QT_CFLAGS=$$cflags" > $@; \ echo "KC_QT_CFLAGS=$$cflags" > $@; \
echo "KC_QT_LIBS=$$libs" >> $@; \ echo "KC_QT_LIBS=$$libs" >> $@; \
......
This diff is collapsed.
...@@ -3,26 +3,25 @@ ...@@ -3,26 +3,25 @@
* Released under the terms of the GNU GPL v2.0. * Released under the terms of the GNU GPL v2.0.
*/ */
#if QT_VERSION < 0x040000
#include <qlistview.h> #include <qlistview.h>
#if QT_VERSION >= 300
#include <qsettings.h>
#else #else
class QSettings { #include <q3listview.h>
public: #endif
void beginGroup(const QString& group) { } #include <qsettings.h>
void endGroup(void) { }
bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const #if QT_VERSION < 0x040000
{ if (ok) *ok = FALSE; return def; } #define Q3ValueList QValueList
int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const #define Q3PopupMenu QPopupMenu
{ if (ok) *ok = FALSE; return def; } #define Q3ListView QListView
QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const #define Q3ListViewItem QListViewItem
{ if (ok) *ok = FALSE; return def; } #define Q3VBox QVBox
QStringList readListEntry(const QString& key, bool* ok = 0) const #define Q3TextBrowser QTextBrowser
{ if (ok) *ok = FALSE; return QStringList(); } #define Q3MainWindow QMainWindow
template <class t> #define Q3Action QAction
bool writeEntry(const QString& key, t value) #define Q3ToolBar QToolBar
{ return TRUE; } #define Q3ListViewItemIterator QListViewItemIterator
}; #define Q3FileDialog QFileDialog
#endif #endif
class ConfigView; class ConfigView;
...@@ -31,11 +30,10 @@ class ConfigItem; ...@@ -31,11 +30,10 @@ class ConfigItem;
class ConfigLineEdit; class ConfigLineEdit;
class ConfigMainWindow; class ConfigMainWindow;
class ConfigSettings : public QSettings { class ConfigSettings : public QSettings {
public: public:
QValueList<int> readSizes(const QString& key, bool *ok); Q3ValueList<int> readSizes(const QString& key, bool *ok);
bool writeSizes(const QString& key, const QValueList<int>& value); bool writeSizes(const QString& key, const Q3ValueList<int>& value);
}; };
enum colIdx { enum colIdx {
...@@ -48,9 +46,9 @@ enum optionMode { ...@@ -48,9 +46,9 @@ enum optionMode {
normalOpt = 0, allOpt, promptOpt normalOpt = 0, allOpt, promptOpt
}; };
class ConfigList : public QListView { class ConfigList : public Q3ListView {
Q_OBJECT Q_OBJECT
typedef class QListView Parent; typedef class Q3ListView Parent;
public: public:
ConfigList(ConfigView* p, const char *name = 0); ConfigList(ConfigView* p, const char *name = 0);
void reinit(void); void reinit(void);
...@@ -135,17 +133,17 @@ public slots: ...@@ -135,17 +133,17 @@ public slots:
struct menu *rootEntry; struct menu *rootEntry;
QColorGroup disabledColorGroup; QColorGroup disabledColorGroup;
QColorGroup inactivedColorGroup; QColorGroup inactivedColorGroup;
QPopupMenu* headerPopup; Q3PopupMenu* headerPopup;
private: private:
int colMap[colNr]; int colMap[colNr];
int colRevMap[colNr]; int colRevMap[colNr];
}; };
class ConfigItem : public QListViewItem { class ConfigItem : public Q3ListViewItem {
typedef class QListViewItem Parent; typedef class Q3ListViewItem Parent;
public: public:
ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v) ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v)
: Parent(parent, after), menu(m), visible(v), goParent(false) : Parent(parent, after), menu(m), visible(v), goParent(false)
{ {
init(); init();
...@@ -155,16 +153,14 @@ class ConfigItem : public QListViewItem { ...@@ -155,16 +153,14 @@ class ConfigItem : public QListViewItem {
{ {
init(); init();
} }
ConfigItem(QListView *parent, ConfigItem *after, bool v) ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
: Parent(parent, after), menu(0), visible(v), goParent(true) : Parent(parent, after), menu(0), visible(v), goParent(true)
{ {
init(); init();
} }
~ConfigItem(void); ~ConfigItem(void);
void init(void); void init(void);
#if QT_VERSION >= 300
void okRename(int col); void okRename(int col);
#endif
void updateMenu(void); void updateMenu(void);
void testUpdateMenu(bool v); void testUpdateMenu(bool v);
ConfigList* listView() const ConfigList* listView() const
...@@ -219,9 +215,9 @@ class ConfigLineEdit : public QLineEdit { ...@@ -219,9 +215,9 @@ class ConfigLineEdit : public QLineEdit {
ConfigItem *item; ConfigItem *item;
}; };
class ConfigView : public QVBox { class ConfigView : public Q3VBox {
Q_OBJECT Q_OBJECT
typedef class QVBox Parent; typedef class Q3VBox Parent;
public: public:
ConfigView(QWidget* parent, const char *name = 0); ConfigView(QWidget* parent, const char *name = 0);
~ConfigView(void); ~ConfigView(void);
...@@ -252,9 +248,9 @@ public slots: ...@@ -252,9 +248,9 @@ public slots:
static QAction *showPromptAction; static QAction *showPromptAction;
}; };
class ConfigInfoView : public QTextBrowser { class ConfigInfoView : public Q3TextBrowser {
Q_OBJECT Q_OBJECT
typedef class QTextBrowser Parent; typedef class Q3TextBrowser Parent;
public: public:
ConfigInfoView(QWidget* parent, const char *name = 0); ConfigInfoView(QWidget* parent, const char *name = 0);
bool showDebug(void) const { return _showDebug; } bool showDebug(void) const { return _showDebug; }
...@@ -274,11 +270,11 @@ public slots: ...@@ -274,11 +270,11 @@ public slots:
QString debug_info(struct symbol *sym); QString debug_info(struct symbol *sym);
static QString print_filter(const QString &str); static QString print_filter(const QString &str);
static void expr_print_help(void *data, struct symbol *sym, const char *str); static void expr_print_help(void *data, struct symbol *sym, const char *str);
QPopupMenu* createPopupMenu(const QPoint& pos); Q3PopupMenu* createPopupMenu(const QPoint& pos);
void contentsContextMenuEvent(QContextMenuEvent *e); void contentsContextMenuEvent(QContextMenuEvent *e);
struct symbol *sym; struct symbol *sym;
struct menu *menu; struct menu *_menu;
bool _showDebug; bool _showDebug;
}; };
...@@ -302,10 +298,10 @@ public slots: ...@@ -302,10 +298,10 @@ public slots:
struct symbol **result; struct symbol **result;
}; };
class ConfigMainWindow : public QMainWindow { class ConfigMainWindow : public Q3MainWindow {
Q_OBJECT Q_OBJECT
static QAction *saveAction; static Q3Action *saveAction;
static void conf_changed(void); static void conf_changed(void);
public: public:
ConfigMainWindow(void); ConfigMainWindow(void);
...@@ -334,8 +330,8 @@ public slots: ...@@ -334,8 +330,8 @@ public slots:
ConfigView *configView; ConfigView *configView;
ConfigList *configList; ConfigList *configList;
ConfigInfoView *helpText; ConfigInfoView *helpText;
QToolBar *toolBar; Q3ToolBar *toolBar;
QAction *backAction; Q3Action *backAction;
QSplitter* split1; QSplitter* split1;
QSplitter* split2; QSplitter* split2;
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment