Port of [qx]config to Qt 5
This patch set contains the port of qconfig to Qt 5. At the same time, it removes Qt 2 and 3 support (the last Qt 3 release was in 2007).
Most of the work was done by Boris Barbulovski, so many thanks! I've reviewed and tested the changes.
The patch set contains one patch per functionality being ported, for ease of reviewing. The first patch contains the removal of the #ifdef'ed code for older versions and the last one contains an update to the buildsystem to find Qt 5.
Note that the Qt 5 build requires a host compiler that understands the -std=c++11 switch (for GCC, since 4.7).
scripts/kconfig/qconf.h | 150 +++++++++++------------- scripts/kconfig/Makefile | 73 +++++------- scripts/kconfig/qconf.cc | 688 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------ 3 files changed, 478 insertions(+), 433 deletions(-)
PATCH 1/39 Remove support for QT3 and older.
From: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 18 ------------------ scripts/kconfig/qconf.cc | 23 ----------------------- 2 files changed, 41 deletions(-)
scripts/kconfig/qconf.h +0 -18
@@ -3,27 +3,9 @@* Released under the terms of the GNU GPL v2.0. */ -#if QT_VERSION <0x040000 -#include <qlistview.h> -#else #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;class ConfigList;class ConfigItem;
scripts/kconfig/qconf.cc +0 -23
@@ -5,18 +5,6 @@ #include <qglobal.h> -#if QT_VERSION < 0x040000 -#include <stddef.h> -#include <qmainwindow.h> -#include <qvbox.h> -#include <qvaluelist.h> -#include <qtextbrowser.h> -#include <qaction.h> -#include <qheader.h> -#include <qfiledialog.h> -#include <qdragobject.h> -#include <qpopupmenu.h> -#else #include <q3mainwindow.h> #include <q3vbox.h> #include <q3valuelist.h>
@@ -26,7 +14,6 @@ #include <q3filedialog.h> #include <q3dragobject.h> #include <q3popupmenu.h> -#endif #include <qapplication.h> #include <qdesktopwidget.h>
@@ -1282,11 +1269,7 @@ ConfigMainWindow::ConfigMainWindow(void) QDesktopWidget *d = configApp->desktop(); snprintf(title, sizeof(title), "%s%s", rootmenu.prompt->text, -#if QT_VERSION < 0x040000 - " (Qt3)" -#else "" -#endif ); setCaption(title);
@@ -1368,15 +1351,9 @@ ConfigMainWindow::ConfigMainWindow(void) connect(optGroup, SIGNAL(selected(QAction *)), menuView, SLOT(setOptionMode(QAction *))); -#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);
Signature · 1 line
2.1.4
PATCH 2/39 Port xconfig to Qt5 - Use QMainWindow, QToolBar
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 5 +++-- scripts/kconfig/qconf.cc | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
scripts/kconfig/qconf.h +3 -2
@@ -4,6 +4,7 @@*/ #include <q3listview.h> +#include <QMainWindow> #include <qsettings.h> class ConfigView;
@@ -281,7 +282,7 @@ protected:struct symbol **result; }; -class ConfigMainWindow : public Q3MainWindow { +class ConfigMainWindow : public QMainWindow {Q_OBJECT static Q3Action *saveAction;
@@ -313,7 +314,7 @@ protected:ConfigView *configView;ConfigList *configList;ConfigInfoView *helpText; -Q3ToolBar *toolBar; +QToolBar *toolBar;Q3Action *backAction;QSplitter * split1;QSplitter * split2;
scripts/kconfig/qconf.cc +2 -2
@@ -5,7 +5,7 @@ #include <qglobal.h> -#include <q3mainwindow.h> +#include <QMainWindow> #include <q3vbox.h> #include <q3valuelist.h> #include <q3textbrowser.h>
@@ -1303,7 +1303,7 @@ ConfigMainWindow::ConfigMainWindow(void) configList->setFocus(); menu = menuBar(); - toolBar = new Q3ToolBar("Tools", this); + toolBar = new QToolBar("Tools", this); backAction = new Q3Action("Back", QPixmap(xpm_back), _("Back"), 0, this); connect(backAction, SIGNAL(activated()), SLOT(goBack()));
Signature · 1 line
2.1.4
PATCH 3/39 Port xconfig to Qt5 - Use QAction
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 4 ++-- scripts/kconfig/qconf.cc | 48 ++++++++++++++++++++++++++---------------------- 2 files changed, 28 insertions(+), 24 deletions(-)
scripts/kconfig/qconf.h +2 -2
@@ -285,7 +285,7 @@ protected: class ConfigMainWindow : public QMainWindow {Q_OBJECT - static Q3Action *saveAction; + static QAction *saveAction;static void conf_changed (void ); public:ConfigMainWindow (void);
@@ -315,7 +315,7 @@ protected:ConfigList *configList;ConfigInfoView *helpText;QToolBar *toolBar; -Q3Action *backAction; +QAction *backAction;QSplitter * split1;QSplitter * split2; };
scripts/kconfig/qconf.cc +26 -22
126 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 4/39 Port xconfig to Qt5 - Use QFileDialog
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/kconfig/qconf.cc +3 -3
@@ -11,7 +11,7 @@ #include <q3textbrowser.h> #include <QAction> #include <q3header.h> -#include <q3filedialog.h> +#include <QFileDialog> #include <q3dragobject.h> #include <q3popupmenu.h>
@@ -1457,7 +1457,7 @@ ConfigMainWindow::ConfigMainWindow(void) void ConfigMainWindow::loadConfig(void) { - QString s = Q3FileDialog::getOpenFileName(conf_get_configname(), NULL, this); + QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this); if (s.isNull()) return; if (conf_read(QFile::encodeName(s)))
@@ -1476,7 +1476,7 @@ bool ConfigMainWindow::saveConfig(void) void ConfigMainWindow::saveConfigAs(void) { - QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this); + QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this); if (s.isNull()) return; saveConfig();
Signature · 1 line
2.1.4
PATCH 5/39 Port xconfig to Qt5 - Use QList
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 4 ++-- scripts/kconfig/qconf.cc | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-)
scripts/kconfig/qconf.h +2 -2
@@ -16,8 +16,8 @@ class ConfigMainWindow; class ConfigSettings : public QSettings { public:ConfigSettings (); - Q3ValueList<int> readSizes(const QString& key, bool *ok); - bool writeSizes(const QString& key, const Q3ValueList<int>& value); + QList<int> readSizes(const QString& key, bool *ok); + bool writeSizes(const QString& key, const QList<int>& value); };enum colIdx {
scripts/kconfig/qconf.cc +7 -7
@@ -7,7 +7,7 @@ #include <QMainWindow> #include <q3vbox.h> -#include <q3valuelist.h> +#include <QList> #include <q3textbrowser.h> #include <QAction> #include <q3header.h>
@@ -64,9 +64,9 @@ ConfigSettings::ConfigSettings() /** * Reads a list of integer values from the application settings. */ -Q3ValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) +QList<int> ConfigSettings::readSizes(const QString& key, bool *ok) { - Q3ValueList<int> result; + QList<int> result; QStringList entryList = readListEntry(key, ok); QStringList::Iterator it;
@@ -79,10 +79,10 @@ Q3ValueList<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 Q3ValueList<int>& value) +bool ConfigSettings::writeSizes(const QString& key, const QList<int>& value) { QStringList stringList; - Q3ValueList<int>::ConstIterator it; + QList<int>::ConstIterator it; for (it = value.begin(); it != value.end(); ++it) stringList.push_back(QString::number(*it));
@@ -1214,7 +1214,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam y = configSettings->readNumEntry("/window y", 0, &ok); if (ok) move(x, y); - Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok); + QList<int> sizes = configSettings->readSizes("/split", &ok); if (ok) split->setSizes(sizes); configSettings->endGroup();
@@ -1446,7 +1446,7 @@ ConfigMainWindow::ConfigMainWindow(void) showSplitView(); // UI setup done, restore splitter positions - Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok); + QList<int> sizes = configSettings->readSizes("/split1", &ok); if (ok) split1->setSizes(sizes);
Signature · 1 line
2.1.4
PATCH 6/39 Port xconfig to Qt5 - Use QTextBrowser
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 8 ++++---- scripts/kconfig/qconf.cc | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-)
scripts/kconfig/qconf.h +4 -4
@@ -232,9 +232,9 @@ public:static QAction *showPromptAction; }; -class ConfigInfoView : public Q3TextBrowser { +class ConfigInfoView : public QTextBrowser {Q_OBJECT - typedef class Q3TextBrowser Parent; + typedef class QTextBrowser Parent; public: ConfigInfoView(QWidget* parent, const char *name = 0);bool showDebug (void ) const {return _showDebug; }
@@ -254,8 +254,8 @@ 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); - Q3PopupMenu* createPopupMenu(const QPoint& pos); -void contentsContextMenuEvent (QContextMenuEvent *e); + QMenu *createStandardContextMenu(const QPoint & pos); +void contextMenuEvent (QContextMenuEvent *e);struct symbol *sym;struct menu *_menu;
scripts/kconfig/qconf.cc +6 -6
@@ -8,7 +8,7 @@ #include <QMainWindow> #include <q3vbox.h> #include <QList> -#include <q3textbrowser.h> +#include <qtextbrowser.h> #include <QAction> #include <q3header.h> #include <QFileDialog>
@@ -1154,22 +1154,22 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char *text += str2; } -Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) +QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) { - Q3PopupMenu* popup = Parent::createPopupMenu(pos); + QMenu* popup = Parent::createStandardContextMenu(pos); QAction* action = new QAction(_("Show Debug Info"), popup); action->setToggleAction(TRUE); connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); action->setOn(showDebug()); - popup->insertSeparator(); + popup->addSeparator(); action->addTo(popup); return popup; } -void ConfigInfoView::contentsContextMenuEvent(QContextMenuEvent *e) +void ConfigInfoView::contextMenuEvent(QContextMenuEvent *e) { - Parent::contentsContextMenuEvent(e); + Parent::contextMenuEvent(e); } ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name)
Signature · 1 line
2.1.4
PATCH 7/39 Port xconfig to Qt5 - Use QMenu
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 2 +- scripts/kconfig/qconf.cc | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-)
scripts/kconfig/qconf.h +1 -1
@@ -117,7 +117,7 @@ public:struct menu *rootEntry;QColorGroup disabledColorGroup;QColorGroup inactivedColorGroup; -Q3PopupMenu * headerPopup; +QMenu * headerPopup; private:int colMap[colNr];
scripts/kconfig/qconf.cc +10 -10
@@ -13,7 +13,7 @@ #include <q3header.h> #include <QFileDialog> #include <q3dragobject.h> -#include <q3popupmenu.h> +#include <QMenu> #include <qapplication.h> #include <qdesktopwidget.h>
@@ -817,7 +817,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) if (!headerPopup) { QAction *action; - headerPopup = new Q3PopupMenu(this); + headerPopup = new QMenu(this); action = new QAction(_("Show Name"), this); action->setToggleAction(TRUE); connect(action, SIGNAL(toggled(bool)),
@@ -1387,32 +1387,32 @@ ConfigMainWindow::ConfigMainWindow(void) fullViewAction->addTo(toolBar); // create config menu - Q3PopupMenu* config = new Q3PopupMenu(this); + QMenu* config = new QMenu(this); menu->insertItem(_("&File"), config); loadAction->addTo(config); saveAction->addTo(config); saveAsAction->addTo(config); - config->insertSeparator(); + config->addSeparator(); quitAction->addTo(config); // create edit menu - Q3PopupMenu* editMenu = new Q3PopupMenu(this); + QMenu* editMenu = new QMenu(this); menu->insertItem(_("&Edit"), editMenu); searchAction->addTo(editMenu); // create options menu - Q3PopupMenu* optionMenu = new Q3PopupMenu(this); + QMenu* optionMenu = new QMenu(this); menu->insertItem(_("&Option"), optionMenu); showNameAction->addTo(optionMenu); showRangeAction->addTo(optionMenu); showDataAction->addTo(optionMenu); - optionMenu->insertSeparator(); + optionMenu->addSeparator(); optGroup->addTo(optionMenu); - optionMenu->insertSeparator(); + optionMenu->addSeparator(); // create help menu - Q3PopupMenu* helpMenu = new Q3PopupMenu(this); - menu->insertSeparator(); + QMenu* helpMenu = new QMenu(this); + menu->addSeparator(); menu->insertItem(_("&Help"), helpMenu); showIntroAction->addTo(helpMenu); showAboutAction->addTo(helpMenu);
Signature · 1 line
2.1.4
PATCH 8/39 Port xconfig to Qt5 - Remove unused #include <q3dragobject.h>
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 1 - 1 file changed, 1 deletion(-)
scripts/kconfig/qconf.cc +0 -1
@@ -12,7 +12,6 @@ #include <QAction> #include <q3header.h> #include <QFileDialog> -#include <q3dragobject.h> #include <QMenu> #include <qapplication.h>
Signature · 1 line
2.1.4
PATCH 9/39 Port xconfig to Qt5 - Replace Q3VBox with QWidget
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 4 ++-- scripts/kconfig/qconf.cc | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
scripts/kconfig/qconf.h +2 -2
@@ -199,9 +199,9 @@ public:ConfigItem *item; }; -class ConfigView : public Q3VBox { +class ConfigView : public QWidget {Q_OBJECT - typedef class Q3VBox Parent; + typedef class QWidget Parent; public: ConfigView(QWidget* parent, const char *name = 0); ~ConfigView (void);
scripts/kconfig/qconf.cc +0 -1
@@ -6,7 +6,6 @@ #include <qglobal.h> #include <QMainWindow> -#include <q3vbox.h> #include <QList> #include <qtextbrowser.h> #include <QAction>
Signature · 1 line
2.1.4
PATCH 10/39 Port xconfig to Qt5 - Fix layout
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 5 +++++ 1 file changed, 5 insertions(+)
scripts/kconfig/qconf.cc +5 -0
@@ -855,9 +855,13 @@ QAction *ConfigView::showPromptAction; ConfigView::ConfigView(QWidget* parent, const char *name) : Parent(parent, name) { + QVBoxLayout *verticalLayout = new QVBoxLayout(this); + list = new ConfigList(this, name); + verticalLayout->addWidget(list); lineEdit = new ConfigLineEdit(this); lineEdit->hide(); + verticalLayout->addWidget(lineEdit); this->nextView = viewList; viewList = this;
@@ -1302,6 +1306,7 @@ ConfigMainWindow::ConfigMainWindow(void) menu = menuBar(); toolBar = new QToolBar("Tools", this); + addToolBar(toolBar); backAction = new QAction(QPixmap(xpm_back), _("Back"), this); connect(backAction, SIGNAL(activated()), SLOT(goBack()));
Signature · 1 line
2.1.4
PATCH 11/39 Port xconfig to Qt5 - Fix layout margin.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 1 + 1 file changed, 1 insertion(+)
scripts/kconfig/qconf.cc +1 -0
@@ -856,6 +856,7 @@ ConfigView::ConfigView(QWidget* parent, const char *name) : Parent(parent, name) { QVBoxLayout *verticalLayout = new QVBoxLayout(this); + verticalLayout->setContentsMargins(0, 0, 0, 0); list = new ConfigList(this, name); verticalLayout->addWidget(list);
Signature · 1 line
2.1.4
PATCH 12/39 Port xconfig to Qt5 - Update QAction checkable
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-)
scripts/kconfig/qconf.cc +22 -22
@@ -817,28 +817,28 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) headerPopup = new QMenu(this); action = new QAction(_("Show Name"), this); - action->setToggleAction(TRUE); + action->setCheckable(TRUE); connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowName(bool))); connect(parent(), SIGNAL(showNameChanged(bool)), action, SLOT(setOn(bool))); - action->setOn(showName); + action->setChecked(showName); action->addTo(headerPopup); action = new QAction(_("Show Range"), this); - action->setToggleAction(TRUE); + action->setCheckable(TRUE); connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowRange(bool))); connect(parent(), SIGNAL(showRangeChanged(bool)), action, SLOT(setOn(bool))); - action->setOn(showRange); + action->setChecked(showRange); action->addTo(headerPopup); action = new QAction( _("Show Data"), this); - action->setToggleAction(TRUE); + action->setCheckable(TRUE); connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowData(bool))); connect(parent(), SIGNAL(showDataChanged(bool)), action, SLOT(setOn(bool))); - action->setOn(showData); + action->setChecked(showData); action->addTo(headerPopup); } headerPopup->exec(e->globalPos());
@@ -1161,10 +1161,10 @@ QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) { QMenu* popup = Parent::createStandardContextMenu(pos); QAction* action = new QAction(_("Show Debug Info"), popup); - action->setToggleAction(TRUE); + action->setCheckable(TRUE); connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); - action->setOn(showDebug()); + action->setChecked(showDebug()); popup->addSeparator(); action->addTo(popup); return popup;
@@ -1337,20 +1337,20 @@ ConfigMainWindow::ConfigMainWindow(void) connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); QAction *showNameAction = new QAction(_("Show Name"), this); - showNameAction->setToggleAction(TRUE); + showNameAction->setCheckable(TRUE); connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); - showNameAction->setOn(configView->showName()); + showNameAction->setChecked(configView->showName()); QAction *showRangeAction = new QAction(_("Show Range"), this); - showRangeAction->setToggleAction(TRUE); + showRangeAction->setCheckable(TRUE); connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); - showRangeAction->setOn(configList->showRange); + showRangeAction->setChecked(configList->showRange); QAction *showDataAction = new QAction(_("Show Data"), this); - showDataAction->setToggleAction(TRUE); + showDataAction->setCheckable(TRUE); connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); - showDataAction->setOn(configList->showData); + showDataAction->setChecked(configList->showData); QActionGroup *optGroup = new QActionGroup(this); optGroup->setExclusive(TRUE);
@@ -1362,18 +1362,18 @@ ConfigMainWindow::ConfigMainWindow(void) configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup); configView->showAllAction = new QAction(_("Show All Options"), optGroup); configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup); - configView->showNormalAction->setToggleAction(TRUE); - configView->showNormalAction->setOn(configList->optMode == normalOpt); - configView->showAllAction->setToggleAction(TRUE); - configView->showAllAction->setOn(configList->optMode == allOpt); - configView->showPromptAction->setToggleAction(TRUE); - configView->showPromptAction->setOn(configList->optMode == promptOpt); + configView->showNormalAction->setCheckable(TRUE); + configView->showNormalAction->setChecked(configList->optMode == normalOpt); + configView->showAllAction->setCheckable(TRUE); + configView->showAllAction->setChecked(configList->optMode == allOpt); + configView->showPromptAction->setCheckable(TRUE); + configView->showPromptAction->setChecked(configList->optMode == promptOpt); QAction *showDebugAction = new QAction( _("Show Debug Info"), this); - showDebugAction->setToggleAction(TRUE); + showDebugAction->setCheckable(TRUE); connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); - showDebugAction->setOn(helpText->showDebug()); + showDebugAction->setChecked(helpText->showDebug()); QAction *showIntroAction = new QAction( _("Introduction"), this); connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
Signature · 1 line
2.1.4
PATCH 13/39 Port xconfig to Qt5 - Make single/split/full actions checkable.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 3 +++ scripts/kconfig/qconf.cc | 30 +++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-)
scripts/kconfig/qconf.h +3 -0
@@ -316,6 +316,9 @@ protected:ConfigInfoView *helpText;QToolBar *toolBar;QAction *backAction; +QAction *singleViewAction; +QAction *splitViewAction; +QAction *fullViewAction;QSplitter * split1;QSplitter * split2; };
scripts/kconfig/qconf.cc +27 -3
@@ -1329,11 +1329,14 @@ ConfigMainWindow::ConfigMainWindow(void) QAction *searchAction = new QAction(_("&Find"), this); searchAction->setShortcut(Qt::CTRL + Qt::Key_F); connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); - QAction *singleViewAction = new QAction(QPixmap(xpm_single_view), _("Single View"), this); + singleViewAction = new QAction(QPixmap(xpm_single_view), _("Single View"), this); + singleViewAction->setCheckable(TRUE); connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); - QAction *splitViewAction = new QAction(QPixmap(xpm_split_view), _("Split View"), this); + splitViewAction = new QAction(QPixmap(xpm_split_view), _("Split View"), this); + splitViewAction->setCheckable(TRUE); connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); - QAction *fullViewAction = new QAction(QPixmap(xpm_tree_view), _("Full View"), this); + fullViewAction = new QAction(QPixmap(xpm_tree_view), _("Full View"), this); + fullViewAction->setCheckable(TRUE); connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); QAction *showNameAction = new QAction(_("Show Name"), this);
@@ -1579,6 +1582,13 @@ void ConfigMainWindow::goBack(void) void ConfigMainWindow::showSingleView(void) { + singleViewAction->setEnabled(false); + singleViewAction->setChecked(true); + splitViewAction->setEnabled(true); + splitViewAction->setChecked(false); + fullViewAction->setEnabled(true); + fullViewAction->setChecked(false); + menuView->hide(); menuList->setRootMenu(0); configList->mode = singleMode;
@@ -1592,6 +1602,13 @@ void ConfigMainWindow::showSingleView(void) void ConfigMainWindow::showSplitView(void) { + singleViewAction->setEnabled(true); + singleViewAction->setChecked(false); + splitViewAction->setEnabled(false); + splitViewAction->setChecked(true); + fullViewAction->setEnabled(true); + fullViewAction->setChecked(false); + configList->mode = symbolMode; if (configList->rootEntry == &rootmenu) configList->updateListAll();
@@ -1608,6 +1625,13 @@ void ConfigMainWindow::showSplitView(void) void ConfigMainWindow::showFullView(void) { + singleViewAction->setEnabled(true); + singleViewAction->setChecked(false); + splitViewAction->setEnabled(true); + splitViewAction->setChecked(false); + fullViewAction->setEnabled(false); + fullViewAction->setChecked(true); + menuView->hide(); menuList->setRootMenu(0); configList->mode = fullMode;
Signature · 1 line
2.1.4
PATCH 14/39 Port xconfig to Qt5 - Remove custom ListView classes.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 177 +--------- scripts/kconfig/qconf.cc | 904 +---------------------------------------------- 2 files changed, 15 insertions(+), 1066 deletions(-)
scripts/kconfig/qconf.h +11 -166
@@ -8,8 +8,6 @@#include <qsettings.h> class ConfigView; -class ConfigList; -class ConfigItem;class ConfigLineEdit;class ConfigMainWindow;
@@ -30,159 +28,6 @@ enum optionMode { normalOpt =0 , allOpt, promptOpt }; -class ConfigList : public Q3ListView { -Q_OBJECT - typedef class Q3ListView Parent; -public: - ConfigList(ConfigView* p, const char *name = 0); -void reinit (void ); -ConfigView *parent (void ) const - { - return (ConfigView*)Parent::parent(); - } -ConfigItem *findConfigItem (struct menu *); - -protected: -void keyPressEvent (QKeyEvent *e); -void contentsMousePressEvent (QMouseEvent *e); -void contentsMouseReleaseEvent (QMouseEvent *e); -void contentsMouseMoveEvent (QMouseEvent *e); -void contentsMouseDoubleClickEvent (QMouseEvent *e); -void focusInEvent (QFocusEvent *e); -void contextMenuEvent (QContextMenuEvent *e); - -public slots: -void setRootMenu (struct menu *menu); - -void updateList (ConfigItem *item); -void setValue (ConfigItem * item,tristate val); -void changeValue (ConfigItem * item); -void updateSelection (void ); -void saveSettings (void ); -signals: -void menuChanged (struct menu *menu); -void menuSelected (struct menu *menu); -void parentSelected (void ); -void gotFocus (struct menu *); - -public: - void updateListAll(void) - { - updateAll = true; -updateList (NULL ); - updateAll = false; - } -ConfigList *listView () - { -return this; - } -ConfigItem *firstChild () const - { - return (ConfigItem *)Parent::firstChild(); - } -int mapIdx (colIdx idx) - { -return colMap[idx]; - } - void addColumn(colIdx idx, const QString& label) - { - colMap[idx] = Parent::addColumn(label); - colRevMap[colMap[idx]] = idx; - } -void removeColumn (colIdx idx) - { -int col = colMap[idx]; -if (col >=0 ) { - Parent::removeColumn(col); - colRevMap[col] = colMap[idx] =-1 ; - } - } -void setAllOpen (bool open); -void setParentMenu (void ); - -bool menuSkip (struct menu *); - - template <class P> - void updateMenuList(P*, struct menu*); - -bool updateAll; - -QPixmap symbolYesPix, symbolModPix, symbolNoPix; -QPixmap choiceYesPix, choiceNoPix; -QPixmap menuPix, menuInvPix, menuBackPix, voidPix; - -bool showName, showRange, showData; -enum listMode mode; -enum optionMode optMode; -struct menu *rootEntry; -QColorGroup disabledColorGroup; -QColorGroup inactivedColorGroup; -QMenu * headerPopup; - -private: -int colMap[colNr]; -int colRevMap[colNr]; -}; - -class ConfigItem : public Q3ListViewItem { - typedef class Q3ListViewItem Parent; -public: - ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v) - : Parent(parent, after), menu(m), visible(v), goParent(false) - { -init (); - } - ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) - : Parent(parent, after), menu(m), visible(v), goParent(false) - { -init (); - } - ConfigItem(Q3ListView *parent, ConfigItem *after, bool v) - : Parent(parent, after), menu(0), visible(v), goParent(true) - { -init (); - } - ~ConfigItem (void); -void init (void ); -void okRename (int col); -void updateMenu (void ); -void testUpdateMenu (bool v); -ConfigList *listView () const - { - return (ConfigList*)Parent::listView(); - } -ConfigItem *firstChild () const - { - return (ConfigItem *)Parent::firstChild(); - } -ConfigItem *nextSibling () const - { - return (ConfigItem *)Parent::nextSibling(); - } - void setText(colIdx idx, const QString& text) - { - Parent::setText(listView()->mapIdx(idx), text); - } -QString text (colIdx idx) const - { - return Parent::text(listView()->mapIdx(idx)); - } - void setPixmap(colIdx idx, const QPixmap& pm) - { - Parent::setPixmap(listView()->mapIdx(idx), pm); - } -const QPixmap *pixmap (colIdx idx) const - { - return Parent::pixmap(listView()->mapIdx(idx)); - } - void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align); - -ConfigItem * nextItem; -struct menu *menu; -bool visible; -bool goParent; -}; - class ConfigLineEdit : public QLineEdit {Q_OBJECT typedef class QLineEdit Parent;
@@ -192,11 +37,11 @@ public: { return (ConfigView*)Parent::parent(); } -void show (ConfigItem *i); +void show (Q3ListViewItem *i);void keyPressEvent (QKeyEvent *e); public: -ConfigItem *item; +Q3ListViewItem *item; }; class ConfigView : public QWidget {
@@ -205,12 +50,12 @@ class ConfigView : public QWidget { public: ConfigView(QWidget* parent, const char *name = 0); ~ConfigView (void); -static void updateList (ConfigItem * item); +static void updateList (Q3ListViewItem * item);static void updateListAll (void ); -bool showName (void ) const {return list->showName; } -bool showRange (void ) const {return list->showRange; } -bool showData (void ) const {return list->showData; } +bool showName (void ) const {return false; }// TODO: Implement me. +bool showRange (void ) const {return false; }// TODO: Implement me. +bool showData (void ) const {return false; }// TODO: Implement me. public slots:void setShowName (bool );void setShowRange (bool );
@@ -221,7 +66,7 @@ signals:void showRangeChanged (bool );void showDataChanged (bool ); public: -ConfigList * list; +Q3ListView * list;ConfigLineEdit * lineEdit;static ConfigView * viewList;
@@ -310,15 +155,15 @@ protected:ConfigSearchWindow *searchWindow;ConfigView *menuView; -ConfigList *menuList; +Q3ListView *menuList;ConfigView *configView; -ConfigList *configList; +Q3ListView *configList;ConfigInfoView *helpText;QToolBar *toolBar;QAction *backAction;QAction *singleViewAction;QAction *splitViewAction;QAction *fullViewAction; -QSplitter * split1; -QSplitter * split2; +QSplitter *split1; +QSplitter *split2; };
scripts/kconfig/qconf.cc +4 -900
1,034 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 15/39 Port xconfig to Qt5 - Fix the code so it compiles with Qt5
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 23 ++++-- scripts/kconfig/qconf.cc | 185 +++++++++++++++++++++++------------------------ 2 files changed, 108 insertions(+), 100 deletions(-)
scripts/kconfig/qconf.h +16 -7
@@ -3,9 +3,18 @@* Released under the terms of the GNU GPL v2.0. */ -#include <q3listview.h> +#include <QTextBrowser> +#include <QTreeWidget> #include <QMainWindow> +#include <QHeaderView> #include <qsettings.h> +#include <QPushButton> +#include <QSettings> +#include <QLineEdit> +#include <QSplitter> +#include <QCheckBox> +#include <QDialog> +#include "expr.h" class ConfigView;class ConfigLineEdit;
@@ -37,11 +46,11 @@ public: { return (ConfigView*)Parent::parent(); } -void show (Q3ListViewItem *i); +void show (QTreeWidgetItem *i);void keyPressEvent (QKeyEvent *e); public: -Q3ListViewItem *item; +QTreeWidgetItem *item; }; class ConfigView : public QWidget {
@@ -50,7 +59,7 @@ class ConfigView : public QWidget { public: ConfigView(QWidget* parent, const char *name = 0); ~ConfigView (void); -static void updateList (Q3ListViewItem * item); +static void updateList (QTreeWidgetItem * item);static void updateListAll (void );bool showName (void ) const {return false; }// TODO: Implement me.
@@ -66,7 +75,7 @@ signals:void showRangeChanged (bool );void showDataChanged (bool ); public: -Q3ListView * list; +QTreeWidget * list;ConfigLineEdit * lineEdit;static ConfigView * viewList;
@@ -155,9 +164,9 @@ protected:ConfigSearchWindow *searchWindow;ConfigView *menuView; -Q3ListView *menuList; +QTreeWidget *menuList;ConfigView *configView; -Q3ListView *configList; +QTreeWidget *configList;ConfigInfoView *helpText;QToolBar *toolBar;QAction *backAction;
scripts/kconfig/qconf.cc +92 -93
413 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 16/39 Port xconfig to Qt5 - update signals
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 51 ++++++++++++++---------------------------------- 1 file changed, 15 insertions(+), 36 deletions(-)
scripts/kconfig/qconf.cc +15 -36
@@ -90,7 +90,7 @@ bool ConfigSettings::writeSizes(const QString& key, const QList<int>& value) ConfigLineEdit::ConfigLineEdit(ConfigView* parent) : Parent(parent) { - connect(this, SIGNAL(lostFocus()), SLOT(hide())); + connect(this, SIGNAL(editingFinished()), SLOT(hide())); } void ConfigLineEdit::show(QTreeWidgetItem *i)
@@ -484,7 +484,7 @@ ConfigMainWindow::ConfigMainWindow(void) : searchWindow(0) { QMenuBar* menu; - bool ok; + bool ok = true; QVariant x, y; int width, height; char title[256];
@@ -529,54 +529,51 @@ ConfigMainWindow::ConfigMainWindow(void) addToolBar(toolBar); backAction = new QAction(QPixmap(xpm_back), _("Back"), this); - connect(backAction, SIGNAL(activated()), SLOT(goBack())); + connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack())); backAction->setEnabled(false); QAction *quitAction = new QAction(_("&Quit"), this); quitAction->setShortcut(Qt::CTRL + Qt::Key_Q); - connect(quitAction, SIGNAL(activated()), SLOT(close())); + connect(quitAction, SIGNAL(triggered(bool)), SLOT(close())); QAction *loadAction = new QAction(QPixmap(xpm_load), _("&Load"), this); loadAction->setShortcut(Qt::CTRL + Qt::Key_L); - connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); + connect(loadAction, SIGNAL(triggered(bool)), SLOT(loadConfig())); saveAction = new QAction(QPixmap(xpm_save), _("&Save"), this); saveAction->setShortcut(Qt::CTRL + Qt::Key_S); - connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); + connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig())); conf_set_changed_callback(conf_changed); // Set saveAction's initial state conf_changed(); QAction *saveAsAction = new QAction(_("Save &As..."), this); - connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); + connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs())); QAction *searchAction = new QAction(_("&Find"), this); searchAction->setShortcut(Qt::CTRL + Qt::Key_F); - connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); + connect(searchAction, SIGNAL(triggered(bool)), SLOT(searchConfig())); singleViewAction = new QAction(QPixmap(xpm_single_view), _("Single View"), this); singleViewAction->setCheckable(true); - connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); + connect(singleViewAction, SIGNAL(triggered(bool)), SLOT(showSingleView())); splitViewAction = new QAction(QPixmap(xpm_split_view), _("Split View"), this); splitViewAction->setCheckable(true); - connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); + connect(splitViewAction, SIGNAL(triggered(bool)), SLOT(showSplitView())); fullViewAction = new QAction(QPixmap(xpm_tree_view), _("Full View"), this); fullViewAction->setCheckable(true); - connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); + connect(fullViewAction, SIGNAL(triggered(bool)), SLOT(showFullView())); QAction *showNameAction = new QAction(_("Show Name"), this); showNameAction->setCheckable(true); connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); - connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); showNameAction->setChecked(configView->showName()); QAction *showRangeAction = new QAction(_("Show Range"), this); showRangeAction->setCheckable(true); connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); - connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); QAction *showDataAction = new QAction(_("Show Data"), this); showDataAction->setCheckable(true); connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); - connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); QActionGroup *optGroup = new QActionGroup(this); optGroup->setExclusive(true); - connect(optGroup, SIGNAL(selected(QAction *)), configView, + connect(optGroup, SIGNAL(triggered(QAction*)), configView, SLOT(setOptionMode(QAction *))); - connect(optGroup, SIGNAL(selected(QAction *)), menuView, + connect(optGroup, SIGNAL(triggered(QAction *)), menuView, SLOT(setOptionMode(QAction *))); configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup);
@@ -589,13 +586,12 @@ ConfigMainWindow::ConfigMainWindow(void) QAction *showDebugAction = new QAction( _("Show Debug Info"), this); showDebugAction->setCheckable(true); connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); - connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); showDebugAction->setChecked(helpText->showDebug()); QAction *showIntroAction = new QAction( _("Introduction"), this); - connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); + connect(showIntroAction, SIGNAL(triggered(bool)), SLOT(showIntro())); QAction *showAboutAction = new QAction( _("About"), this); - connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); + connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout())); // init tool bar toolBar->addAction(backAction);
@@ -634,23 +630,6 @@ ConfigMainWindow::ConfigMainWindow(void) helpMenu->addAction(showIntroAction); helpMenu->addAction(showAboutAction); - connect(configList, SIGNAL(menuChanged(struct menu *)), - helpText, SLOT(setInfo(struct menu *))); - connect(configList, SIGNAL(menuSelected(struct menu *)), - SLOT(changeMenu(struct menu *))); - connect(configList, SIGNAL(parentSelected()), - SLOT(goBack())); - connect(menuList, SIGNAL(menuChanged(struct menu *)), - helpText, SLOT(setInfo(struct menu *))); - connect(menuList, SIGNAL(menuSelected(struct menu *)), - SLOT(changeMenu(struct menu *))); - - connect(configList, SIGNAL(gotFocus(struct menu *)), - helpText, SLOT(setInfo(struct menu *))); - connect(menuList, SIGNAL(gotFocus(struct menu *)), - helpText, SLOT(setInfo(struct menu *))); - connect(menuList, SIGNAL(gotFocus(struct menu *)), - SLOT(listFocusChanged(void))); connect(helpText, SIGNAL(menuSelected(struct menu *)), SLOT(setMenuLink(struct menu *)));
Signature · 1 line
2.1.4
PATCH 17/39 Port xconfig to Qt5 - Introduce Qt4/5 version of ConfigList and ConfigItem
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 48 ++++++++++++++++++++++++++++++++++++++++++------ scripts/kconfig/qconf.cc | 24 +++++++++++++++++++++--- 2 files changed, 63 insertions(+), 9 deletions(-)
scripts/kconfig/qconf.h +42 -6
@@ -17,6 +17,8 @@#include "expr.h" class ConfigView; +class ConfigList; +class ConfigItem;class ConfigLineEdit;class ConfigMainWindow;
@@ -37,6 +39,40 @@ enum optionMode { normalOpt =0 , allOpt, promptOpt }; +class ConfigList : public QTreeWidget { +Q_OBJECT + typedef class QTreeWidget Parent; +public: + ConfigList(ConfigView* p, const char *name = 0); +}; + +class ConfigItem : public QTreeWidgetItem { + typedef class QTreeWidgetItem Parent; +public: + ConfigItem(QTreeWidgetItem *parent, ConfigItem *after, struct menu *m, bool v) + : Parent(parent, after), menu(m), visible(v), goParent(false) + { +init (); + } + ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) + : Parent(parent, after), menu(m), visible(v), goParent(false) + { +init (); + } + ConfigItem(QTreeWidgetItem *parent, ConfigItem *after, bool v) + : Parent(parent, after), menu(0), visible(v), goParent(true) + { +init (); + } + ~ConfigItem (void); +void init (void ); + +ConfigItem * nextItem; +struct menu *menu; +bool visible; +bool goParent; +}; + class ConfigLineEdit : public QLineEdit {Q_OBJECT typedef class QLineEdit Parent;
@@ -46,11 +82,11 @@ public: { return (ConfigView*)Parent::parent(); } -void show (QTreeWidgetItem *i); +void show (ConfigItem *i);void keyPressEvent (QKeyEvent *e); public: -QTreeWidgetItem *item; +ConfigItem *item; }; class ConfigView : public QWidget {
@@ -59,7 +95,7 @@ class ConfigView : public QWidget { public: ConfigView(QWidget* parent, const char *name = 0); ~ConfigView (void); -static void updateList (QTreeWidgetItem * item); +static void updateList (ConfigItem * item);static void updateListAll (void );bool showName (void ) const {return false; }// TODO: Implement me.
@@ -75,7 +111,7 @@ signals:void showRangeChanged (bool );void showDataChanged (bool ); public: -QTreeWidget * list; +ConfigList * list;ConfigLineEdit * lineEdit;static ConfigView * viewList;
@@ -164,9 +200,9 @@ protected:ConfigSearchWindow *searchWindow;ConfigView *menuView; -QTreeWidget *menuList; +ConfigList *menuList;ConfigView *configView; -QTreeWidget *configList; +ConfigList *configList;ConfigInfoView *helpText;QToolBar *toolBar;QAction *backAction;
scripts/kconfig/qconf.cc +21 -3
@@ -87,13 +87,27 @@ bool ConfigSettings::writeSizes(const QString& key, const QList<int>& value) return true; } +/* + * construct a menu entry + */ +void ConfigItem::init(void) +{ +} + +/* + * destruct a menu entry + */ +ConfigItem::~ConfigItem(void) +{ +} + ConfigLineEdit::ConfigLineEdit(ConfigView* parent) : Parent(parent) { connect(this, SIGNAL(editingFinished()), SLOT(hide())); } -void ConfigLineEdit::show(QTreeWidgetItem *i) +void ConfigLineEdit::show(ConfigItem* i) { item = i; Parent::show();
@@ -118,6 +132,10 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e) hide(); } +ConfigList::ConfigList(ConfigView* p, const char *name) + : Parent(p) +{ +} ConfigView*ConfigView::viewList; QAction *ConfigView::showNormalAction; QAction *ConfigView::showAllAction;
@@ -129,7 +147,7 @@ ConfigView::ConfigView(QWidget* parent, const char *name) QVBoxLayout *verticalLayout = new QVBoxLayout(this); verticalLayout->setContentsMargins(0, 0, 0, 0); - list = new QTreeWidget(this); + list = new ConfigList(this); verticalLayout->addWidget(list); lineEdit = new ConfigLineEdit(this); lineEdit->hide();
@@ -167,7 +185,7 @@ void ConfigView::setShowData(bool b) { } -void ConfigView::updateList(QTreeWidgetItem* item) +void ConfigView::updateList(ConfigItem* item) { }
Signature · 1 line
2.1.4
PATCH 18/39 Port xconfig to Qt5 - Put back some of the old implementation.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 113 +++++++++++++++++++++++++++++++++++++++++-- scripts/kconfig/qconf.cc | 121 +++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 216 insertions(+), 18 deletions(-)
scripts/kconfig/qconf.h +110 -3
@@ -44,6 +44,81 @@ class ConfigList : public QTreeWidget { typedef class QTreeWidget Parent; public: ConfigList(ConfigView* p, const char *name = 0); +void reinit (void ); +ConfigView *parent (void ) const + { + return (ConfigView*)Parent::parent(); + } +ConfigItem *findConfigItem (struct menu *); + +protected: +void keyPressEvent (QKeyEvent *e); +void contentsMousePressEvent (QMouseEvent *e); +void contentsMouseReleaseEvent (QMouseEvent *e); +void contentsMouseMoveEvent (QMouseEvent *e); +void contentsMouseDoubleClickEvent (QMouseEvent *e); +void focusInEvent (QFocusEvent *e); +void contextMenuEvent (QContextMenuEvent *e); + +public slots: +void setRootMenu (struct menu *menu); + +void updateList (ConfigItem *item); +void setValue (ConfigItem * item,tristate val); +void changeValue (ConfigItem * item); +void updateSelection (void ); +void saveSettings (void ); +signals: +void menuChanged (struct menu *menu); +void menuSelected (struct menu *menu); +void parentSelected (void ); +void gotFocus (struct menu *); + +public: + void updateListAll(void) + { + updateAll = true; +updateList (NULL ); + updateAll = false; + } +ConfigList *listView () + { +return this; + } +ConfigItem *firstChild () const + { +// TODO: Implement me. +return NULL ; + } + void addColumn(colIdx idx, const QString& label) + { +// TODO: Implement me. + } +void removeColumn (colIdx idx) + { +// TODO: Implement me. + } +void setAllOpen (bool open); +void setParentMenu (void ); + +bool menuSkip (struct menu *); + + template <class P> + void updateMenuList(P*, struct menu*); + +bool updateAll; + +QPixmap symbolYesPix, symbolModPix, symbolNoPix; +QPixmap choiceYesPix, choiceNoPix; +QPixmap menuPix, menuInvPix, menuBackPix, voidPix; + +bool showName, showRange, showData; +enum listMode mode; +enum optionMode optMode; +struct menu *rootEntry; +QPalette disabledColorGroup; +QPalette inactivedColorGroup; +QMenu * headerPopup; }; class ConfigItem : public QTreeWidgetItem {
@@ -66,6 +141,38 @@ public: } ~ConfigItem (void);void init (void ); +void okRename (int col); +void updateMenu (void ); +void testUpdateMenu (bool v); +ConfigList *listView () const + { + return (ConfigList*)Parent::treeWidget(); + } +ConfigItem *firstChild () const + { + return (ConfigItem *)Parent::child(0); + } +ConfigItem *nextSibling () const + { +return NULL ;// TODO: Implement me + } + void setText(colIdx idx, const QString& text) + { + Parent::setText(idx, text); + } +QString text (colIdx idx) const + { + return Parent::text(idx); + } + void setPixmap(colIdx idx, const QPixmap& pm) + { +// TODO: Implement me + } +const QPixmap *pixmap (colIdx idx) const + { +return NULL ;// TODO: Implement me + } +// Implement paintCell ConfigItem * nextItem;struct menu *menu;
@@ -98,9 +205,9 @@ public:static void updateList (ConfigItem * item);static void updateListAll (void ); -bool showName (void ) const {return false; }// TODO: Implement me. -bool showRange (void ) const {return false; }// TODO: Implement me. -bool showData (void ) const {return false; }// TODO: Implement me. +bool showName (void ) const {return list->showName; } +bool showRange (void ) const {return list->showRange; } +bool showData (void ) const {return list->showData; } public slots:void setShowName (bool );void setShowRange (bool );
scripts/kconfig/qconf.cc +106 -15
150 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 19/39 Port xconfig to Qt5 - Put back some of the old implementation(part 2).
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 45 +-- scripts/kconfig/qconf.cc | 788 ++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 807 insertions(+), 26 deletions(-)
scripts/kconfig/qconf.h +27 -18
@@ -53,10 +53,10 @@ public: protected:void keyPressEvent (QKeyEvent *e); -void contentsMousePressEvent (QMouseEvent *e); -void contentsMouseReleaseEvent (QMouseEvent *e); -void contentsMouseMoveEvent (QMouseEvent *e); -void contentsMouseDoubleClickEvent (QMouseEvent *e); +void mousePressEvent (QMouseEvent *e); +void mouseReleaseEvent (QMouseEvent *e); +void mouseMoveEvent (QMouseEvent *e); +void mouseDoubleClickEvent (QMouseEvent *e);void focusInEvent (QFocusEvent *e);void contextMenuEvent (QContextMenuEvent *e);
@@ -87,16 +87,15 @@ public: }ConfigItem *firstChild () const { -// TODO: Implement me. -return NULL ; +return (ConfigItem *)children ().first (); } - void addColumn(colIdx idx, const QString& label) +void addColumn (colIdx idx) { -// TODO: Implement me. +showColumn (idx); }void removeColumn (colIdx idx) { -// TODO: Implement me. +hideColumn (idx); }void setAllOpen (bool open);void setParentMenu (void );
@@ -124,7 +123,7 @@ public: class ConfigItem : public QTreeWidgetItem { typedef class QTreeWidgetItem Parent; public: - ConfigItem(QTreeWidgetItem *parent, ConfigItem *after, struct menu *m, bool v) + ConfigItem(QTreeWidget *parent, ConfigItem *after, struct menu *m, bool v) : Parent(parent, after), menu(m), visible(v), goParent(false) {init ();
@@ -134,7 +133,7 @@ public: {init (); } - ConfigItem(QTreeWidgetItem *parent, ConfigItem *after, bool v) + ConfigItem(QTreeWidget *parent, ConfigItem *after, bool v) : Parent(parent, after), menu(0), visible(v), goParent(true) {init ();
@@ -152,9 +151,19 @@ public: { return (ConfigItem *)Parent::child(0); } -ConfigItem *nextSibling () const +ConfigItem *nextSibling () { -return NULL ;// TODO: Implement me +ConfigItem *ret =NULL ; +ConfigItem *_parent = (ConfigItem *)parent (); + +if (_parent) { + ret = (ConfigItem *)_parent->child (_parent->indexOfChild (this)+1 ); + }else { +QTreeWidget *_treeWidget =treeWidget (); + ret = (ConfigItem *)_treeWidget->topLevelItem (_treeWidget->indexOfTopLevelItem (this)+1 ); + } + +return ret; } void setText(colIdx idx, const QString& text) {
@@ -164,15 +173,15 @@ public: { return Parent::text(idx); } - void setPixmap(colIdx idx, const QPixmap& pm) + void setPixmap(colIdx idx, const QIcon &icon) { -// TODO: Implement me + Parent::setIcon(idx, icon); } -const QPixmap *pixmap (colIdx idx) const +const QIcon pixmap (colIdx idx) const { -return NULL ;// TODO: Implement me +return icon (idx); } -// Implement paintCell +// TODO: Implement paintCell ConfigItem * nextItem;struct menu *menu;
scripts/kconfig/qconf.cc +780 -8
1,006 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 20/39 Port xconfig to Qt5 - Remove Qt3Support from Makefile.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kconfig/Makefile +2 -2
@@ -265,8 +265,8 @@ $(obj)/.tmp_qtcheck: moc="/usr/bin/moc"; \ fi; \ else \ - cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \ - libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \ + cflags="\$$(shell pkg-config QtCore QtGui --cflags)"; \ + libs="\$$(shell pkg-config QtCore QtGui --libs)"; \ moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \ [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \ fi; \
Signature · 1 line
2.1.4
PATCH 21/39 Port xconfig to Qt5 - Use correct signal names.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kconfig/qconf.cc +2 -2
@@ -270,7 +270,7 @@ ConfigItem::~ConfigItem(void) ConfigLineEdit::ConfigLineEdit(ConfigView* parent) : Parent(parent) { - connect(this, SIGNAL(lostFocus()), SLOT(hide())); + connect(this, SIGNAL(editingFinished()), SLOT(hide())); } void ConfigLineEdit::show(ConfigItem* i)
@@ -318,7 +318,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) setSortingEnabled(-1); setRootIsDecorated(true); - connect(this, SIGNAL(selectionChanged(void)), + connect(this, SIGNAL(itemSelectionChanged(void)), SLOT(updateSelection(void))); if (name) {
Signature · 1 line
2.1.4
PATCH 22/39 Port xconfig to Qt5 - Set ConfigView object name.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 1 + 1 file changed, 1 insertion(+)
scripts/kconfig/qconf.cc +1 -0
@@ -823,6 +823,7 @@ QAction *ConfigView::showPromptAction; ConfigView::ConfigView(QWidget* parent, const char *name) : Parent(parent) { + setObjectName(name); QVBoxLayout *verticalLayout = new QVBoxLayout(this); verticalLayout->setContentsMargins(0, 0, 0, 0);
Signature · 1 line
2.1.4
PATCH 23/39 Port xconfig to Qt5 - Quick workaround to bypass app crash at startup.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 3 --- 1 file changed, 3 deletions(-)
scripts/kconfig/qconf.cc +0 -3
@@ -576,9 +576,6 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) enum prop_type type; if (!menu) { - while ((item = parent->firstChild())) - item->parent()->removeChild(item); - delete item; return; }
Signature · 1 line
2.1.4
PATCH 24/39 Port xconfig to Qt5 - Tree widget set column titles.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 2 ++ 1 file changed, 2 insertions(+)
scripts/kconfig/qconf.cc +2 -0
@@ -318,6 +318,8 @@ ConfigList::ConfigList(ConfigView* p, const char *name) setSortingEnabled(-1); setRootIsDecorated(true); + setHeaderLabels(QStringList() << _("Option") << _("Name") << "N" << "M" << "Y" << _("Value")); + connect(this, SIGNAL(itemSelectionChanged(void)), SLOT(updateSelection(void)));
Signature · 1 line
2.1.4
PATCH 25/39 Port xconfig to Qt5 - Add ConfigItem::nextItem to initializer list.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/kconfig/qconf.h +3 -3
@@ -124,17 +124,17 @@ class ConfigItem : public QTreeWidgetItem { typedef class QTreeWidgetItem Parent; public: ConfigItem(QTreeWidget *parent, ConfigItem *after, struct menu *m, bool v) - : Parent(parent, after), menu(m), visible(v), goParent(false) + : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false) {init (); } ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) - : Parent(parent, after), menu(m), visible(v), goParent(false) + : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false) {init (); } ConfigItem(QTreeWidget *parent, ConfigItem *after, bool v) - : Parent(parent, after), menu(0), visible(v), goParent(true) + : Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true) {init (); }
Signature · 1 line
2.1.4
PATCH 26/39 Port xconfig to Qt5 - Add ConfigList::mode to initializer list.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/qconf.cc +1 -1
@@ -309,7 +309,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), - showName(false), showRange(false), showData(false), optMode(normalOpt), + showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt), rootEntry(0), headerPopup(0) { int i;
Signature · 1 line
2.1.4
PATCH 27/39 Port xconfig to Qt5 - Remove ConfigList::updateMenuList template.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
ConfigItem executes parent->takeChild(0)
while
ConfigList executes parent->takeTopLevelItem(0)
--- scripts/kconfig/qconf.h | 4 +-- scripts/kconfig/qconf.cc | 73 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 73 insertions(+), 4 deletions(-)
scripts/kconfig/qconf.h +2 -2
@@ -102,8 +102,8 @@ public:bool menuSkip (struct menu *); - template <class P> - void updateMenuList(P*, struct menu*); +void updateMenuList (ConfigItem *parent,struct menu *); +void updateMenuList (ConfigList *parent,struct menu *);bool updateAll;
scripts/kconfig/qconf.cc +71 -2
91 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 28/39 Add current selection check.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 7 +++++++ 1 file changed, 7 insertions(+)
scripts/kconfig/qconf.cc +7 -0
@@ -399,6 +399,9 @@ void ConfigList::updateSelection(void) struct menu *menu; enum prop_type type; + if (selectedItems().count() == 0) + return; + ConfigItem* item = (ConfigItem*)selectedItems().first(); if (!item) return;
@@ -1605,6 +1608,10 @@ void ConfigMainWindow::goBack(void) configList->setParentMenu(); if (configList->rootEntry == &rootmenu) backAction->setEnabled(false); + + if (menuList->selectedItems().count() == 0) + return; + item = (ConfigItem*)menuList->selectedItems().first(); while (item) { if (item->menu == configList->rootEntry) {
Signature · 1 line
2.1.4
PATCH 29/39 Port xconfig to Qt5 - Disable ConfigList soring
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/qconf.cc +1 -1
@@ -315,7 +315,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) int i; setObjectName(name); - setSortingEnabled(-1); + setSortingEnabled(false); setRootIsDecorated(true); setHeaderLabels(QStringList() << _("Option") << _("Name") << "N" << "M" << "Y" << _("Value"));
Signature · 1 line
2.1.4
PATCH 30/39 Port xconfig to Qt5 - Change ConfigItem constructor parent type.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kconfig/qconf.h +2 -2
@@ -123,7 +123,7 @@ public: class ConfigItem : public QTreeWidgetItem { typedef class QTreeWidgetItem Parent; public: - ConfigItem(QTreeWidget *parent, ConfigItem *after, struct menu *m, bool v) + ConfigItem(ConfigList *parent, ConfigItem *after, struct menu *m, bool v) : Parent(parent, after), nextItem(0), menu(m), visible(v), goParent(false) {init ();
@@ -133,7 +133,7 @@ public: {init (); } - ConfigItem(QTreeWidget *parent, ConfigItem *after, bool v) + ConfigItem(ConfigList *parent, ConfigItem *after, bool v) : Parent(parent, after), nextItem(0), menu(0), visible(v), goParent(true) {init ();
Signature · 1 line
2.1.4
PATCH 31/39 Port xconfig to Qt5 - Add horizontal scrollbar, and scroll per pixel.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 5 +++++ 1 file changed, 5 insertions(+)
scripts/kconfig/qconf.cc +5 -0
@@ -318,6 +318,9 @@ ConfigList::ConfigList(ConfigView* p, const char *name) setSortingEnabled(false); setRootIsDecorated(true); + setVerticalScrollMode(ScrollPerPixel); + setHorizontalScrollMode(ScrollPerPixel); + setHeaderLabels(QStringList() << _("Option") << _("Name") << "N" << "M" << "Y" << _("Value")); connect(this, SIGNAL(itemSelectionChanged(void)),
@@ -453,11 +456,13 @@ void ConfigList::updateList(ConfigItem* item) updateMenuList(item, rootEntry); update(); + resizeColumnToContents(0); return; } update: updateMenuList(this, rootEntry); update(); + resizeColumnToContents(0); } void ConfigList::setValue(ConfigItem* item, tristate val)
Signature · 1 line
2.1.4
Re: [PATCH 31/39] Port xconfig to Qt5 - Add horizontal scrollbar, and scroll per pixel.
Quoted 24 lines · Thiago Macieira
From: Boris Barbulovski <[email protected]>
Signed-off-by Boris Barbulovski <[email protected]>Signed-off-by Thiago Macieira <[email protected]>--- scripts/kconfig/qconf.cc | 5 +++++ 1 file changed, 5 insertions(+)scripts/kconfig/qconf.cc +3
-0@@ -318,6 +318,9 @@ ConfigList::ConfigList(ConfigView* p, const char *name) setSortingEnabled(false); setRootIsDecorated(true); + setVerticalScrollMode(ScrollPerPixel); + setHorizontalScrollMode(ScrollPerPixel); + setHeaderLabels(QStringList() << _("Option") << _("Name") << "N" << "M" << "Y" << _("Value")); connect(this, SIGNAL(itemSelectionChanged(void)),@@ -453,11 +456,13 @@ void ConfigList::updateList(ConfigItem* item)
scripts/kconfig/qconf.cc void ConfigList::updateList(ConfigItem* item) · line 466
Quoted 10 lines
scripts/kconfig/qconf.cc +2
-0updateMenuList(item, rootEntry); update(); + resizeColumnToContents(0); return; } update: updateMenuList(this, rootEntry); update(); + resizeColumnToContents(0); }
Somehow one of the patches to ConfigList (not this one) caused the columns to take too much space. To reproduce this, enable Show Name, Show Range and Show Data in the Option menu. Do you see the same issue? The following patch fixes it for me, but perhaps there is a cleaner way to do it.
Michal
scripts/kconfig/qconf.cc +6 -2
@@ -451,13 +451,17 @@ void ConfigList::updateList(ConfigItem* item) updateMenuList(item, rootEntry); update(); - resizeColumnToContents(0); + for (int i = 0; i < columnCount(); i++) { + resizeColumnToContents(i); + } return; } update: updateMenuList(this, rootEntry); update(); - resizeColumnToContents(0); + for (int i = 0; i < columnCount(); i++) { + resizeColumnToContents(i); + } } void ConfigList::setValue(ConfigItem* item, tristate val)
PATCH 32/39 Port xconfig to Qt5 - Source format.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/kconfig/qconf.h +3 -3
@@ -157,10 +157,10 @@ public:ConfigItem *_parent = (ConfigItem *)parent ();if (_parent) { - ret = (ConfigItem *)_parent->child (_parent->indexOfChild (this)+1 ); + ret = (ConfigItem *)_parent->child (_parent->indexOfChild (this)+1 ); }else { -QTreeWidget *_treeWidget =treeWidget (); - ret = (ConfigItem *)_treeWidget->topLevelItem (_treeWidget->indexOfTopLevelItem (this)+1 ); +QTreeWidget *_treeWidget =treeWidget (); + ret = (ConfigItem *)_treeWidget->topLevelItem (_treeWidget->indexOfTopLevelItem (this)+1 ); }return ret;
Signature · 1 line
2.1.4
PATCH 33/39 Port xconfig to Qt5 - Remove some commented code.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 4 ---- 1 file changed, 4 deletions(-)
scripts/kconfig/qconf.cc +0 -4
@@ -199,9 +199,6 @@ void ConfigItem::updateMenu(void) data = sym_get_string_value(sym); - //int i = list->mapIdx(dataColIdx); - //if (i >= 0) - // setRenameEnabled(i, true); setText(dataColIdx, data); if (type == S_STRING) prompt = QString("%1: %2").arg(prompt).arg(data);
@@ -1356,7 +1353,6 @@ ConfigMainWindow::ConfigMainWindow(void) configList = configView->list; helpText = new ConfigInfoView(split2, "help"); - //helpText->setTextFormat(Qt::RichText); setTabOrder(configList, helpText); configList->setFocus();
Signature · 1 line
2.1.4
PATCH 34/39 Port xconfig to Qt5 - Add(back) lineedit editing.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 1 + 1 file changed, 1 insertion(+)
scripts/kconfig/qconf.cc +1 -0
@@ -521,6 +521,7 @@ void ConfigList::changeValue(ConfigItem* item) case S_INT: case S_HEX: case S_STRING: + parent()->lineEdit->show(item); break; } }
Signature · 1 line
2.1.4
PATCH 35/39 Port xconfig to Qt5 - Add(back) one click checkbox toggle.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
scripts/kconfig/qconf.cc +17 -1
@@ -779,10 +779,26 @@ void ConfigList::mouseReleaseEvent(QMouseEvent* e) menu = item->menu; x = header()->offset() + p.x(); - idx = header()->sectionPosition(x); + idx = header()->logicalIndexAt(x); switch (idx) { case promptColIdx: icon = item->pixmap(promptColIdx); + if (!icon.isNull()) { + int off = header()->sectionPosition(0) + visualRect(indexAt(p)).x() + 4; // 4 is Hardcoded image offset. There might be a way to do it properly. + if (x >= off && x < off + icon.availableSizes().first().width()) { + if (item->goParent) { + emit parentSelected(); + break; + } else if (!menu) + break; + ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; + if (ptype == P_MENU && rootEntry != menu && + mode != fullMode && mode != menuMode) + emit menuSelected(menu); + else + changeValue(item); + } + } break; case noColIdx: setValue(item, no);
Signature · 1 line
2.1.4
PATCH 36/39 Port xconfig to Qt5 - on Back clicked, deselect old item.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/kconfig/qconf.cc +3 -1
@@ -1621,7 +1621,7 @@ void ConfigMainWindow::listFocusChanged(void) void ConfigMainWindow::goBack(void) { - ConfigItem* item; + ConfigItem* item, *oldSelection; configList->setParentMenu(); if (configList->rootEntry == &rootmenu)
@@ -1631,8 +1631,10 @@ void ConfigMainWindow::goBack(void) return; item = (ConfigItem*)menuList->selectedItems().first(); + oldSelection = item; while (item) { if (item->menu == configList->rootEntry) { + oldSelection->setSelected(false); item->setSelected(true); break; }
Signature · 1 line
2.1.4
PATCH 37/39 Port xconfig to Qt5 - Fix goParent issue.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kconfig/qconf.cc +1 -1
@@ -438,7 +438,7 @@ void ConfigList::updateList(ConfigItem* item) if (rootEntry != &rootmenu && (mode == singleMode || (mode == symbolMode && rootEntry->parent != &rootmenu))) { - item = firstChild(); + item = (ConfigItem *)topLevelItem(0); if (!item) item = new ConfigItem(this, 0, true); last = item;
Signature · 1 line
2.1.4
PATCH 38/39 Port xconfig to Qt5 - Update copyright.
In reply to Thiago MacieiraFrom: Boris Barbulovski <[email protected]>
--- scripts/kconfig/qconf.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/kconfig/qconf.cc +3 -1
@@ -1,5 +1,6 @@ /* * Copyright (C) 2002 Roman Zippel <[email protected]> + * Copyright (C) 2015 Boris Barbulovski <[email protected]> * Released under the terms of the GNU GPL v2.0. */
@@ -1753,7 +1754,8 @@ void ConfigMainWindow::showIntro(void) void ConfigMainWindow::showAbout(void) { - static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel <[email protected]>.\n\n" + static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel <[email protected]>.\n" + "Copyright (C) 2015 Boris Barbulovski <[email protected]>.\n\n" "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"); QMessageBox::information(this, "qconf", str);
Signature · 1 line
2.1.4
PATCH 39/39 Update the buildsystem for KConfig finding Qt
In reply to Thiago MacieiraThe buildsystem will now only search for Qt 4 and Qt 5. Support for Qt 2 and 3 was dropped in the previous commits (Qt 3 was EOL'ed in 2010 or so...).
For Qt 5, to be future-proof with the future direction notice appearing in the 5.5 release, C++11 support is automatically enabled.
--- scripts/kconfig/Makefile | 73 +++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 45 deletions(-)
scripts/kconfig/Makefile +28 -45
@@ -226,53 +226,36 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile # Qt needs some extra effort... $(obj)/.tmp_qtcheck: - @set -e; $(kecho) " CHECK qt"; dir=""; pkg=""; \ - if ! pkg-config --exists QtCore 2> /dev/null; then \ - echo "* Unable to find the Qt4 tool qmake. Trying to use Qt3"; \ - pkg-config --exists qt 2> /dev/null && pkg=qt; \ - pkg-config --exists qt-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 >&2 "*"; \ - echo >&2 "* Unable to find any Qt installation. Please make sure that"; \ - echo >&2 "* the Qt4 or Qt3 development package is correctly installed and"; \ - echo >&2 "* either qmake can be found or install pkg-config or set"; \ - echo >&2 "* the QTDIR environment variable to the correct location."; \ - echo >&2 "*"; \ - 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 \ - cflags="\$$(shell pkg-config QtCore QtGui --cflags)"; \ - libs="\$$(shell pkg-config QtCore QtGui --libs)"; \ - moc="\$$(shell pkg-config QtCore --variable=moc_location)"; \ - [ -n "$$moc" ] || moc="\$$(shell pkg-config QtCore --variable=prefix)/bin/moc"; \ - fi; \ + @set -e; $(kecho) " CHECK qt"; \ + qtver=`qmake -query QT_VERSION` || { \ + echo >&2 "*"; \ + echo >&2 "* qmake failed."; \ + echo >&2 "*"; \ + exit 1; \ + }; \ + qtlibdir=`qmake -query QT_INSTALL_LIBS`; \ + qthdrdir=`qmake -query QT_INSTALL_HEADERS`; \ + qtbindir=`qmake -query QT_INSTALL_BINS`; \ + cflags="-I$$qthdrdir -I$$qthdrdir/QtCore -I$$qthdrdir/QtGui"; \ + case "$$qtver" in \ + 5.*) \ + cflags="$$cflags -I$$qthdrdir/QtWidgets -std=c++11 -fPIC"; \ + libs="-L$$qtlibdir -lQt5Widgets -lQt5Gui -lQt5Core "; \ + ;; \ + 4.*) \ + libs="-L$$qtlibdir -lQtGui -lQtCore"; \ + ;; \ + *) \ + echo >&2 "*"; \ + echo >&2 "* Found qmake but it is for Qt version $$qtver, which is not supported."; \ + echo >&2 "* Please install either Qt 4.8 or 5.x."; \ + echo >&2 "*"; \ + exit 1; \ + ;; \ + esac; \ echo "KC_QT_CFLAGS=$$cflags" > $@; \ echo "KC_QT_LIBS=$$libs" >> $@; \ - echo "KC_QT_MOC=$$moc" >> $@ + echo "KC_QT_MOC=$$qtbindir/moc" >> $@ endif $(obj)/gconf.o: $(obj)/.tmp_gtkcheck
Signature · 1 line
2.1.4
Re: [PATCH 39/39] Update the buildsystem for KConfig finding Qt
Hi
Quoted 6 lines · Thiago Macieira
The buildsystem will now only search for Qt 4 and Qt 5. Support for Qt 2 and 3 was dropped in the previous commits (Qt 3 was EOL'ed in 2010 or so...).
For Qt 5, to be future-proof with the future direction notice appearing in the 5.5 release, C++11 support is automatically enabled.
[...]
Quoted 2 lines
scripts/kconfig/Makefile +0
-0
[...]
scripts/kconfig/Makefile
Quoted 7 lines
scripts/kconfig/Makefile +7
-0+ @set -e; $(kecho) " CHECK qt"; \ + qtver=`qmake -query QT_VERSION` || { \ + echo >&2 "*"; \ + echo >&2 "* qmake failed."; \ + echo >&2 "*"; \ + exit 1; \ + }; \
[...]
"qmake -query QT_VERSION" appears to be a little fragile on Debian with both qt4-qmake and qt5-qmake installed, as it reports back "4.8.7" by default. The actual qmake is hiding behind qtchooser (/usr/bin/qmake -> qtchooser) and will report different environments based on the chosen personality:
$ qmake -query QT_VERSION 4.8.7
$ QT_SELECT=5 qmake -query QT_VERSION 5.4.2
While I'm not quite sure what would be the best kind of test here (and if qtchooser can be commonly expected), the following might provide another approach to query the most recent installed qt version:
$ qtchooser --list-versions | grep ^[0-9]*$ | sort | tac | head -n1 5
(and then exporting QT_SELECT=5 to the rest of the build).
Another approach which appears to work for me (with both qt4 and qt5) would be this, but I'm not quite sure if this would be a good solution:
scripts/kconfig/Makefile +1 -0
@@ -227,6 +227,7 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile # Qt needs some extra effort... $(obj)/.tmp_qtcheck: @set -e; $(kecho) " CHECK qt"; \ + QT_SELECT=5 qmake -query QT_VERSION >/dev/null 2>&1 && export QT_SELECT=5 ||: ; \ qtver=`qmake -query QT_VERSION` || { \ echo >&2 "*"; \ echo >&2 "* qmake failed."; \
Regards
Stefan Lippers-Hollmann
Re: [PATCH 39/39] Update the buildsystem for KConfig finding Qt
Hi
Quoted 1 line · Stefan Lippers-Hollmann
On 2015-09-22, Thiago Macieira wrote:
[...]
Review
Quoted 1 line
(quoted diff) +1
-0+ QT_SELECT=5 qmake -query QT_VERSION >/dev/null 2>&1 && export QT_SELECT=5 ||: ; \
Apparently this fails if qmake isn't guarded by qtchooser, but the following should work (although I'm still not confident if that would be the best approach):
scripts/kconfig/Makefile +1 -0
@@ -227,6 +227,7 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile # Qt needs some extra effort... $(obj)/.tmp_qtcheck: @set -e; $(kecho) " CHECK qt"; \ + qtchooser --list-versions | grep -q ^5$ && export QT_SELECT=5 ||: ; \ qtver=`qmake -query QT_VERSION` || { \ echo >&2 "*"; \ echo >&2 "* qmake failed."; \
Regards
Stefan Lippers-Hollmann
Re: [PATCH 39/39] Update the buildsystem for KConfig finding Qt
In reply to Stefan Lippers-HollmannQuoted 22 lines · Stefan Lippers-Hollmann
Hi
Quoted 6 lines · Thiago Macieira
The buildsystem will now only search for Qt 4 and Qt 5. Support for Qt 2 and 3 was dropped in the previous commits (Qt 3 was EOL'ed in 2010 or so...).
For Qt 5, to be future-proof with the future direction notice appearing in the 5.5 release, C++11 support is automatically enabled.
[...]
Quoted 2 lines
scripts/kconfig/Makefile +0
-0[...]
Quoted 7 lines
scripts/kconfig/Makefile +7
-0+ @set -e; $(kecho) " CHECK qt"; \ + qtver=`qmake -query QT_VERSION` || { \ + echo >&2 "*"; \ + echo >&2 "* qmake failed."; \ + echo >&2 "*"; \ + exit 1; \ + }; \[...]
Quoted 3 lines
"qmake -query
QT_VERSION" appears to be a little fragile on Debian with both qt4-qmake and qt5-qmake installed, as it reports back "4.8.7" by default.
On openSUSE, I had to change qmake and moc to qmake-qt5 and moc-qt5, respectively. But I don't think that it is a reason to call it fragile. make xconfig works fine if qmake defaults to Qt4 (which seems to be the predominant choice nowadays), but it will continue work once distributions start preferring Qt5. I don't think users have such strong preference as to which Qt version to build against. In the end, it's a simple application with three windows and some buttons.
Michal
Re: [PATCH 39/39] Update the buildsystem for KConfig finding Qt
In reply to Stefan Lippers-HollmannQuoted 8 lines · On Friday 16 October 2015 06:12:41 Stefan Lippers-Hollmann wrote:
Review
Quoted 7 lines
(quoted diff) +7
-0+ @set -e; $(kecho) " CHECK qt"; \ + qtver=`qmake -query QT_VERSION` || { \ + echo >&2 "*"; \ + echo >&2 "* qmake failed."; \ + echo >&2 "*"; \ + exit 1; \ + }; \
Quoted 7 lines
[...]
"qmake -query
QT_VERSION" appears to be a little fragile on Debian with both qt4-qmake and qt5-qmake installed, as it reports back "4.8.7" by default. The actual qmake is hiding behind qtchooser (/usr/bin/qmake-> qtchooser) and will report different environments based on the chosen personality:
Since xconfig still builds with Qt 4, I didn't feel the need to force the choice for Qt 5. If your environment is qtchooser, then you can just set QT_SELECT=5 before running "make xconfig".
Signature · 2 lines
Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center
Quoted 6 lines · Thiago Macieira
This patch set contains the port of qconfig to Qt 5. At the same time, it removes Qt 2 and 3 support (the last Qt 3 release was in 2007).
Most of the work was done by Boris Barbulovski, so many thanks! I've reviewed and tested the changes.
Quoted 7 lines
The patch set contains one patch per functionality being ported, for ease of reviewing. The first patch contains the removal of the #ifdef'ed code for older versions and the last one contains an update to the buildsystem to find Qt 5.
Note that the Qt 5 build requires a host compiler that understands the -std=c++11 switch (for GCC, since 4.7).
Merged to kbuild.git#kconfig, sorry for the delay. I have one comment about one of the patches, but this can be solved by an incremental update.
Michal