From c1e9b8ccdc3c4ee4c5022040a3ec31290b2608b6 Mon Sep 17 00:00:00 2001 From: Uli Franke Date: Tue, 21 Jun 2016 14:39:40 +0200 Subject: [PATCH 01/11] Worked on Wt::WServer related crashes: * Removed Wt::WServer wrapping (unnecessary thread doubling) * Fixed missing "virtual"s for Wt application class (MainPage) which caused the applications to dead lock when shutting down WServer because the applications were not shut down properly and dead locking with the Qt event loop * Minor work on Wt application (MainPage) * use private data members and getters * initialize all members in constructor * proper destruction * some safety checks agains double allocation/free Seems to run stable on my machine, requires checks on 64 bit linux and windows though --- src/main/mainpage.cpp | 60 ++++++++++------- src/main/mainpage.h | 19 +++--- src/main/mainwindow.cpp | 125 ++++++++++++++++++++++-------------- src/main/mainwindow.h | 5 +- src/main/wtdesigner.pro | 7 +- src/main/wtserverworker.cpp | 86 ------------------------- src/main/wtserverworker.h | 52 --------------- 7 files changed, 130 insertions(+), 224 deletions(-) delete mode 100644 src/main/wtserverworker.cpp delete mode 100644 src/main/wtserverworker.h diff --git a/src/main/mainpage.cpp b/src/main/mainpage.cpp index fb27d62..f919c98 100644 --- a/src/main/mainpage.cpp +++ b/src/main/mainpage.cpp @@ -24,24 +24,30 @@ bool MainPage::qtConnected = false; -MainPage::MainPage(const Wt::WEnvironment& env, MainWindow *mainwindow) : - Wt::WQApplication(env, true) // [IMPORTANT] : second param has to be set to TRUE +MainPage::MainPage(const Wt::WEnvironment& env, MainWindow *mainwindow) + : Wt::WQApplication(env, true) // [IMPORTANT] : second param has to be set to TRUE + , m_mainwindow(mainwindow) + , m_qtroot(nullptr) + , thisQtConnected(false) { - m_mainwindow = mainwindow; - m_qtroot = NULL; - // necessary to dynamically update webpage - enableUpdates(true); - // don't know if necessary - Wt::WString::setDefaultEncoding(Wt::UTF8); + // necessary to dynamically update webpage + enableUpdates(true); + // don't know if necessary + Wt::WString::setDefaultEncoding(Wt::UTF8); } MainPage::~MainPage() { - } void MainPage::create() { + /* prevent leakage in case of double allocation */ + if (m_qtroot) + { + qCritical() << "main page already initialized"; + return; + } QEventLoop evtblocker; m_qtroot = new SignalEmiter(NULL, this); // from mainwindow to mainpage @@ -143,20 +149,26 @@ void MainPage::create() void MainPage::destroy() { - // mark wtapp disconnected from mainwindow if connected - if (thisQtConnected) - { - // mark as not connected - thisQtConnected = false; - qtConnected = false; - } - // clear connections list - qDeleteAll(m_qtroot->m_listConnections); - m_qtroot->m_listConnections.clear(); - // delete qt object - delete m_qtroot; - + qDebug() << __FUNCTION__; + + // mark wtapp disconnected from mainwindow if connected + if (thisQtConnected) + { + // mark as not connected + thisQtConnected = false; + qtConnected = false; + } + if (m_qtroot) + { + // clear connections list + qDeleteAll(m_qtroot->m_listConnections); + m_qtroot->m_listConnections.clear(); + // delete qt object + delete m_qtroot; + m_qtroot = nullptr; + } } + // TODO : FIX BY SEPARATING INTO TWO DIFFFERENT FUNCTIONS void MainPage::LoadRecursiveTree(QDomElement element, Wt::WContainerWidget *wparent/*=0*/, QObject *qparent/*=0*/, int irow/*=-1*/) { @@ -1103,7 +1115,7 @@ void SignalEmiter::on_InsertConfig(QByteArray strConfigFraction, QString strPare void SignalEmiter::on_GenerateAutoGenCpp(QString strProjName) { - Q_EMIT SendAutoGenCpp(GetAutoGenCpp(mp_owner->m_qtroot, strProjName)); + Q_EMIT SendAutoGenCpp(GetAutoGenCpp(mp_owner->GetQtRoot(), strProjName)); } @@ -1153,7 +1165,7 @@ void SignalEmiter::on_UpdateAllProperties() if (lock) { // Update all properties - HelpUpdateAllProperties(mp_owner->m_qtroot); + HelpUpdateAllProperties(mp_owner->GetQtRoot()); // Push the changes to the browser mp_owner->triggerUpdate(); } diff --git a/src/main/mainpage.h b/src/main/mainpage.h index 3e19bfb..9edb071 100644 --- a/src/main/mainpage.h +++ b/src/main/mainpage.h @@ -51,8 +51,8 @@ class MainPage : public Wt::WQApplication MainPage(const Wt::WEnvironment& env, MainWindow *mainwindow); ~MainPage(); - void create(); - void destroy(); + virtual void create(); + virtual void destroy(); void SetupUi(Wt::WContainerWidget *wtroot); @@ -68,13 +68,16 @@ class MainPage : public Wt::WQApplication bool PerformConnection(Wt_ConnectionConfig *conConfig); bool PerformDisconnection(Wt_ConnectionConfig *conConfig); - SignalEmiter * m_qtroot; + SignalEmiter * GetQtRoot() + { + return m_qtroot; + } +private: + MainWindow *m_mainwindow; + SignalEmiter * m_qtroot; - bool thisQtConnected; - static bool qtConnected; - - MainWindow *m_mainwindow; - + bool thisQtConnected; + static bool qtConnected; }; class SignalEmiter : public WtQtInteractWidget // instead of inheriting WContainerWidget, it contains a ref to one diff --git a/src/main/mainwindow.cpp b/src/main/mainwindow.cpp index 5a90ff6..f3c5dc2 100644 --- a/src/main/mainwindow.cpp +++ b/src/main/mainwindow.cpp @@ -19,11 +19,12 @@ #include "mainwindow.h" #include "helperfunctions.h" +#include "mainpage.h" + + MainWindow::MainWindow(int argc, char **argv, QWidget *parent) : QMainWindow(parent) { - // create the wt server - mp_WtServerWorker = new WtServerWorker(this); // setup the main window ui ui.setupUi(this); // set all icons color @@ -127,8 +128,7 @@ MainWindow::~MainWindow() { // Stop Wt server StopWtServer(); - // Delete Wt server - delete mp_WtServerWorker; + // Delete old local /resources/ and /temp/ folders if (QDir(g_strLocalResourcesPath).exists()) { QDir(g_strLocalResourcesPath).removeRecursively(); } if (QDir(g_strLocalTempPath).exists()) { QDir(g_strLocalTempPath).removeRecursively(); } @@ -425,48 +425,77 @@ void MainWindow::LoadDefaultConfig() void MainWindow::StartWtServer() { - // (re)configure ip address for webview - m_Address = "http://127.0.0.1:" + m_vectWtParams[WT_VALHTTPPORT]; - // set settings related attrs that might have changed in settings dialog - QDomElement docElem = m_treemodel.getDocument().documentElement(); - docElem.setAttribute(g_strThemeAttr, m_strWtTheme); - docElem.setAttribute(g_strTitleAttr, m_strWtTitle); - // start Wt server - mp_WtServerWorker->ConfigureWtServer(m_vectWtParams); - mp_WtServerWorker->start(); - // load page [IMPORTANT] : DO NOT DELETE LINE BELOW OR PAGE WILL NEVER LOAD - on_LoadPage(); -} - -void MainWindow::StopWtServer() -{ - // load something else - m_WebView->load(QUrl("http://www.webtoolkit.eu/wt")); - // shutdown Wt server - if (mp_WtServerWorker->isRunning()) - { - mp_WtServerWorker->quit(); - } - // wait if necessary - int counter = 0; - while (mp_WtServerWorker->isRunning()) - { - QThread::msleep(100); - QApplication::processEvents(); - counter++; - if (counter == 15) - { - break; - } - } - if (counter == 15) - { - qDebug() << "[ERROR] Could not stop Wt Server cleanly"; - mp_WtServerWorker->quit(); - mp_WtServerWorker->terminate(); - } - // [NOTE] very important - m_WebView->settings()->clearMemoryCaches(); + if (m_server) + { + StopWtServer(); + } + + // (re)configure ip address for webview + m_Address = "http://127.0.0.1:" + m_vectWtParams[WT_VALHTTPPORT]; + + // set settings related attrs that might have changed in settings dialog + QDomElement docElem = m_treemodel.getDocument().documentElement(); + docElem.setAttribute(g_strThemeAttr, m_strWtTheme); + docElem.setAttribute(g_strTitleAttr, m_strWtTitle); + + std::vector args; + for (const auto &s : m_vectWtParams) + { + args.emplace_back(s.toStdString()); + } + std::vector argv; + for (const auto &s : args) + { + argv.emplace_back(const_cast(s.c_str())); + } + m_server = std::unique_ptr < Wt::WServer + > (new Wt::WServer(argv.size(), argv.data())); + + auto wtApplicationFactory = [&](const Wt::WEnvironment& env) + { + return new MainPage(env, this); + }; + m_server->addEntryPoint(Wt::Application, wtApplicationFactory); + + try + { + m_server->start(); + } catch (const Wt::WServer::Exception &e) + { + qCritical() << "wt server start failed with: " << e.what(); + m_server = decltype(m_server)(); + return; + } + // load page [IMPORTANT] : DO NOT DELETE LINE BELOW OR PAGE WILL NEVER LOAD + on_LoadPage(); +} + +void MainWindow::StopWtServer() +{ + if (not m_server) + { + return; + } + + // load something else + m_WebView->load(QUrl("http://www.webtoolkit.eu/wt")); + + // shutdown Wt server + if (m_server->isRunning()) + { + try + { + m_server->stop(); + } catch (const Wt::WServer::Exception &e) + { + qCritical() << "wt server stop failed with: " << e.what(); + } + } + // dispose Wt server object by resetting unique_ptr + m_server = decltype(m_server)(); + + // [NOTE] very important + m_WebView->settings()->clearMemoryCaches(); } void MainWindow::LoadFileConfig(QByteArray config) @@ -1341,8 +1370,8 @@ void MainWindow::on_actionPreferences_triggered() void MainWindow::on_ReloadWtServer() { - StopWtServer(); - StartWtServer(); + StopWtServer(); + StartWtServer(); #ifdef Q_OS_WIN // because this is called when config is changed (i.e. the lib path might have changed) m_listLibFileNames.clear(); diff --git a/src/main/mainwindow.h b/src/main/mainwindow.h index 7dece29..5c48f05 100644 --- a/src/main/mainwindow.h +++ b/src/main/mainwindow.h @@ -18,6 +18,8 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H +#include + #include #include #include @@ -44,7 +46,6 @@ #include "myundocommands.h" -#include "wtserverworker.h" #include "myglobals.h" #include "./dialogs/dialogconfig/dialogconfig.h" @@ -202,7 +203,7 @@ public Q_SLOTS: int m_argc; char **m_argv; QVector m_vectWtParams; - WtServerWorker *mp_WtServerWorker; + std::unique_ptr m_server; MyWebView *m_WebView; QString m_Address; diff --git a/src/main/wtdesigner.pro b/src/main/wtdesigner.pro index 10a072e..604fac9 100644 --- a/src/main/wtdesigner.pro +++ b/src/main/wtdesigner.pro @@ -33,10 +33,11 @@ TARGET = WtDesigner CONFIG -= flat CONFIG += no_batch +CONFIG += debug_and_release QT += core xml widgets gui webkitwidgets svg xmlpatterns -DEFINES += QT_DLL QT_WEBKITWIDGETS_LIB QT_WIDGETS_LIB QT_XML_LIB +DEFINES += QT_DLL QT_WEBKITWIDGETS_LIB QT_WIDGETS_LIB QT_XML_LIB DESTDIR = ../../bin/WtDesigner/ @@ -56,7 +57,6 @@ HEADERS += ./myglobals.h \ ./mixedclasses.h \ ./myundocommands.h \ ./mywebview.h \ - ./wtserverworker.h \ ./helperfunctions.h \ ./wtwithqtlib/DispatchThread.h \ ./wtwithqtlib/WQApplication.h \ @@ -81,8 +81,7 @@ SOURCES += ./main.cpp \ ./mainwindow.cpp \ ./mixedclasses.cpp \ ./myundocommands.cpp \ - ./mywebview.cpp \ - ./wtserverworker.cpp \ + ./mywebview.cpp \ ./helperfunctions.cpp \ ./wtwithqtlib/DispatchThread.cpp \ ./wtwithqtlib/WQApplication.cpp \ diff --git a/src/main/wtserverworker.cpp b/src/main/wtserverworker.cpp deleted file mode 100644 index 1f045b1..0000000 --- a/src/main/wtserverworker.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2016 Juan Gonzalez Burgos -// -// This file is part of WtDesigner. -// -// WtDesigner is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// WtDesigner is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with WtDesigner. If not, see . - -#include -#include -#include "mainwindow.h" -#include "mainpage.h" - -QHash m_hashpages; -MainWindow *m_mainwindow; - -Wt::WApplication * createApplication(const Wt::WEnvironment& env) -{ - static int counter = 0; - MainPage * page = new MainPage(env, m_mainwindow); - //m_hashpages.insert(counter, page); - //counter++; - return page; -} - -WtServerWorker::WtServerWorker(MainWindow *mainwindow) : QThread(mainwindow) -{ - // make copy of pointer to main window to be able to pass it to Wt::WApplication (MainPage class instance) - m_mainwindow = mainwindow; -} - -WtServerWorker::~WtServerWorker() -{ - // delete allocated memory - free(m_argv); -} - -void WtServerWorker::run() -{ - // configure wt server - Wt::WServer server(m_argc, m_argv, WTHTTP_CONFIGURATION); - server.addEntryPoint(Wt::Application, createApplication); - // start wt server - try - { - server.start(); - } - catch (...) - { - qDebug() << "[ERROR] Exception occurred while starting Wt Server in WtServerWorker::run"; - } - // eter event loop and wait - exec(); - // stop wt server - try - { - server.stop(); - } - catch (...) - { - qDebug() << "[ERROR] Exception occurred while shutting down Wt Server in WtServerWorker::run"; - } -} - -void WtServerWorker::ConfigureWtServer(QVector vectargs) -{ - // make local copies in class members - m_argc = vectargs.size(); - // allocate memory for copying c strings - m_argv = (char**)malloc(m_argc*sizeof(char**)); - for (int i = 0; i < m_argc; i++) - { - m_argv[i] = (char*)calloc(vectargs[i].size(), sizeof(char)); - // copy each qstring in list as c string - strcpy(m_argv[i], vectargs[i].toStdString().c_str()); - } -} diff --git a/src/main/wtserverworker.h b/src/main/wtserverworker.h deleted file mode 100644 index 6826057..0000000 --- a/src/main/wtserverworker.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2016 Juan Gonzalez Burgos -// -// This file is part of WtDesigner. -// -// WtDesigner is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// WtDesigner is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with WtDesigner. If not, see . - -#ifndef WTSERVERWORKER_H -#define WTSERVERWORKER_H - -#include -#include -#include -#include -#include -#include -#include - -class MainWindow; - -class WtServerWorker : public QThread -{ - Q_OBJECT - -public: - WtServerWorker(MainWindow *mainwindow); - ~WtServerWorker(); - - void run(); - - Wt::WServer *m_pserver; - - void ConfigureWtServer(QVector vectargs); - -private: - int m_argc; - char **m_argv; - - -}; - -#endif // WTSERVERWORKER_H From 468c4dbab7ab85d488c19f6aaf7c35c804a397fb Mon Sep 17 00:00:00 2001 From: Uli Franke Date: Tue, 21 Jun 2016 15:45:02 +0200 Subject: [PATCH 02/11] Fixed shutdown segfault on icon destructor (first version) --- src/main/mainwindow.cpp | 4 ++-- src/main/modelview/mytreemodel.cpp | 2 +- src/main/modelview/mytreemodel.h | 2 +- src/main/modelview/mywidgetmodel.cpp | 19 ++++++++++++------- src/main/modelview/mywidgetmodel.h | 4 +--- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/main/mainwindow.cpp b/src/main/mainwindow.cpp index f3c5dc2..6af486f 100644 --- a/src/main/mainwindow.cpp +++ b/src/main/mainwindow.cpp @@ -33,7 +33,7 @@ MainWindow::MainWindow(int argc, char **argv, QWidget *parent) m_pwidgetmodel = new MyWidgetModel(g_strLocalWidgetsPath, this); // widget model should come first because it loads the icons ui.treeviewWtWidgets->setModel(m_pwidgetmodel); ui.treeviewWtWidgets->expandAll(); - m_treemodel.setMapIconsByClassName(m_pwidgetmodel->getMapIconsByClassName()); // pass icons from widget model to tree model + m_treemodel.setMapIconsByClassName(MyWidgetModel::getMapIconsByClassName()); // pass icons from widget model to tree model ui.treeviewWtTree->setModel(&m_treemodel); ui.treeviewWtProperties->setModel(&m_propertymodel); ui.treeviewWtSignalsSlots->setModel(&m_sigslotmodel); @@ -1417,7 +1417,7 @@ void MainWindow::on_treeviewWtTree_contextMenu(const QPoint &point) QModelIndex index = ui.treeviewWtTree->indexAt(point); // for icons - QMap mapIcons = m_pwidgetmodel->getMapIconsByClassName(); + auto &mapIcons = MyWidgetModel::getMapIconsByClassName(); if (!index.isValid()) { diff --git a/src/main/modelview/mytreemodel.cpp b/src/main/modelview/mytreemodel.cpp index e703f1e..91cdbb8 100644 --- a/src/main/modelview/mytreemodel.cpp +++ b/src/main/modelview/mytreemodel.cpp @@ -880,7 +880,7 @@ void MyTreeModel::getUniqueIdList(QDomElement *elem) } } -void MyTreeModel::setMapIconsByClassName(QMap mapIcons) +void MyTreeModel::setMapIconsByClassName(const QMap &mapIcons) { m_mapIconByClassName = mapIcons; } diff --git a/src/main/modelview/mytreemodel.h b/src/main/modelview/mytreemodel.h index 620d264..d9606f4 100644 --- a/src/main/modelview/mytreemodel.h +++ b/src/main/modelview/mytreemodel.h @@ -93,7 +93,7 @@ class MyTreeModel : public QAbstractItemModel void replaceUniqueId(QString oldId, QString newId); - void setMapIconsByClassName(QMap mapIcons); + void setMapIconsByClassName(const QMap &mapIcons); bool isHiddenRootElem(WDomElem * elem); diff --git a/src/main/modelview/mywidgetmodel.cpp b/src/main/modelview/mywidgetmodel.cpp index 8075620..df6c0d4 100644 --- a/src/main/modelview/mywidgetmodel.cpp +++ b/src/main/modelview/mywidgetmodel.cpp @@ -18,7 +18,7 @@ #include "mywidgetmodel.h" #include "myglobals.h" -QMap WWidgetNode::m_mapIconByClassName; +#include WWidgetNode::WWidgetNode(WWIDGETNODETYPE intNodeType, QString &strPath, int row, WWidgetNode *parent /*= 0*/) : QObject(parent) { @@ -122,7 +122,7 @@ void WWidgetNode::setupNodeChildren() if (m_intNodeType == WIDGET) { - m_mapIconByClassName.insert(m_strName, m_icon); + MyWidgetModel::getMapIconsByClassName().insert(m_strName, m_icon); } // set name for category @@ -437,10 +437,15 @@ QByteArray MyWidgetModel::findWidgetConfigRecursive(WWidgetNode * wparent, QStri return QByteArray(); } -QMap MyWidgetModel::getMapIconsByClassName() +QMap & +MyWidgetModel::getMapIconsByClassName() { - return wRootNode->m_mapIconByClassName; + static QMap cache; + static auto conn = QObject::connect(qApp, + &QCoreApplication::aboutToQuit, + [&]{ + qDebug() << "clearing icon cache"; + cache.clear(); + }); + return cache; } - - - diff --git a/src/main/modelview/mywidgetmodel.h b/src/main/modelview/mywidgetmodel.h index 6f09def..964f4ad 100644 --- a/src/main/modelview/mywidgetmodel.h +++ b/src/main/modelview/mywidgetmodel.h @@ -63,8 +63,6 @@ class WWidgetNode : public QObject void debugPrintState(QString header = ""); - static QMap m_mapIconByClassName; - private: WWIDGETNODETYPE m_intNodeType; // could be "root", "category", "widget" QString m_strPath; @@ -97,7 +95,7 @@ class MyWidgetModel : public QAbstractItemModel QByteArray getWidgetConfigByName(QString strWidgetName); - QMap getMapIconsByClassName(); + static QMap & getMapIconsByClassName(); private: WWidgetNode * wRootNode; From efadd456969d87250a84d9068ccbf842443b77ea Mon Sep 17 00:00:00 2001 From: Uli Franke Date: Tue, 21 Jun 2016 16:12:19 +0200 Subject: [PATCH 03/11] * finetuned global icon cache integration by providing a global icon cache object * eliminated icon cache passing through object hierarchy * changed some pass by value calls to pass by reference Shutdown now clean on linux 32 bit and most probably on 64 bit as well --- src/main/mainpage.cpp | 2 -- src/main/mainwindow.cpp | 3 +-- src/main/modelview/mytreemodel.cpp | 7 +------ src/main/modelview/mytreemodel.h | 4 ---- src/main/modelview/mywidgetmodel.cpp | 17 +---------------- src/main/modelview/mywidgetmodel.h | 3 --- src/main/myglobals.cpp | 23 +++++++++++++++++++++++ src/main/myglobals.h | 12 +++++++++++- src/main/wtdesigner.pro | 1 + 9 files changed, 38 insertions(+), 34 deletions(-) create mode 100644 src/main/myglobals.cpp diff --git a/src/main/mainpage.cpp b/src/main/mainpage.cpp index f919c98..ee0afd2 100644 --- a/src/main/mainpage.cpp +++ b/src/main/mainpage.cpp @@ -149,8 +149,6 @@ void MainPage::create() void MainPage::destroy() { - qDebug() << __FUNCTION__; - // mark wtapp disconnected from mainwindow if connected if (thisQtConnected) { diff --git a/src/main/mainwindow.cpp b/src/main/mainwindow.cpp index 6af486f..7b85437 100644 --- a/src/main/mainwindow.cpp +++ b/src/main/mainwindow.cpp @@ -33,7 +33,6 @@ MainWindow::MainWindow(int argc, char **argv, QWidget *parent) m_pwidgetmodel = new MyWidgetModel(g_strLocalWidgetsPath, this); // widget model should come first because it loads the icons ui.treeviewWtWidgets->setModel(m_pwidgetmodel); ui.treeviewWtWidgets->expandAll(); - m_treemodel.setMapIconsByClassName(MyWidgetModel::getMapIconsByClassName()); // pass icons from widget model to tree model ui.treeviewWtTree->setModel(&m_treemodel); ui.treeviewWtProperties->setModel(&m_propertymodel); ui.treeviewWtSignalsSlots->setModel(&m_sigslotmodel); @@ -1417,7 +1416,7 @@ void MainWindow::on_treeviewWtTree_contextMenu(const QPoint &point) QModelIndex index = ui.treeviewWtTree->indexAt(point); // for icons - auto &mapIcons = MyWidgetModel::getMapIconsByClassName(); + auto &mapIcons = Icons::GetCache(); if (!index.isValid()) { diff --git a/src/main/modelview/mytreemodel.cpp b/src/main/modelview/mytreemodel.cpp index 91cdbb8..12e25da 100644 --- a/src/main/modelview/mytreemodel.cpp +++ b/src/main/modelview/mytreemodel.cpp @@ -341,7 +341,7 @@ QVariant MyTreeModel::data(const QModelIndex &index, int role) const { if ( index.column() == 1 ) { - return m_mapIconByClassName.value(strClassName); + return Icons::GetCache().value(strClassName); } } @@ -880,11 +880,6 @@ void MyTreeModel::getUniqueIdList(QDomElement *elem) } } -void MyTreeModel::setMapIconsByClassName(const QMap &mapIcons) -{ - m_mapIconByClassName = mapIcons; -} - bool MyTreeModel::isHiddenRootElem(WDomElem * elem) { if (elem == wRootHiddenElem) diff --git a/src/main/modelview/mytreemodel.h b/src/main/modelview/mytreemodel.h index d9606f4..b0a5145 100644 --- a/src/main/modelview/mytreemodel.h +++ b/src/main/modelview/mytreemodel.h @@ -93,8 +93,6 @@ class MyTreeModel : public QAbstractItemModel void replaceUniqueId(QString oldId, QString newId); - void setMapIconsByClassName(const QMap &mapIcons); - bool isHiddenRootElem(WDomElem * elem); QString findCloserContainer(QString &name); @@ -139,8 +137,6 @@ class MyTreeModel : public QAbstractItemModel QByteArray execXQueryOnConfig(QString strQuery); QList mstrlistAllIds; - - QMap m_mapIconByClassName; }; #endif // WQTREEMODEL_H diff --git a/src/main/modelview/mywidgetmodel.cpp b/src/main/modelview/mywidgetmodel.cpp index df6c0d4..5663804 100644 --- a/src/main/modelview/mywidgetmodel.cpp +++ b/src/main/modelview/mywidgetmodel.cpp @@ -18,8 +18,6 @@ #include "mywidgetmodel.h" #include "myglobals.h" -#include - WWidgetNode::WWidgetNode(WWIDGETNODETYPE intNodeType, QString &strPath, int row, WWidgetNode *parent /*= 0*/) : QObject(parent) { m_intNodeType = intNodeType; @@ -122,7 +120,7 @@ void WWidgetNode::setupNodeChildren() if (m_intNodeType == WIDGET) { - MyWidgetModel::getMapIconsByClassName().insert(m_strName, m_icon); + Icons::GetCache().insert(m_strName, m_icon); } // set name for category @@ -436,16 +434,3 @@ QByteArray MyWidgetModel::findWidgetConfigRecursive(WWidgetNode * wparent, QStri } return QByteArray(); } - -QMap & -MyWidgetModel::getMapIconsByClassName() -{ - static QMap cache; - static auto conn = QObject::connect(qApp, - &QCoreApplication::aboutToQuit, - [&]{ - qDebug() << "clearing icon cache"; - cache.clear(); - }); - return cache; -} diff --git a/src/main/modelview/mywidgetmodel.h b/src/main/modelview/mywidgetmodel.h index 964f4ad..1033124 100644 --- a/src/main/modelview/mywidgetmodel.h +++ b/src/main/modelview/mywidgetmodel.h @@ -29,7 +29,6 @@ #include #include - //#include enum WWIDGETNODETYPE @@ -95,8 +94,6 @@ class MyWidgetModel : public QAbstractItemModel QByteArray getWidgetConfigByName(QString strWidgetName); - static QMap & getMapIconsByClassName(); - private: WWidgetNode * wRootNode; diff --git a/src/main/myglobals.cpp b/src/main/myglobals.cpp new file mode 100644 index 0000000..4721693 --- /dev/null +++ b/src/main/myglobals.cpp @@ -0,0 +1,23 @@ +/* + * icons.cpp + * + * Created on: Jun 21, 2016 + * Author: uli + */ + +#include "myglobals.h" + +#include + +QMap & +Icons::GetCache() +{ + static QMap cache; + static auto conn = QObject::connect(qApp, + &QCoreApplication::aboutToQuit, + [&]{ + cache.clear(); + }); + return cache; +} + diff --git a/src/main/myglobals.h b/src/main/myglobals.h index 73077af..0e66668 100644 --- a/src/main/myglobals.h +++ b/src/main/myglobals.h @@ -19,6 +19,7 @@ #define MY_GLOBALS_H #include +#include const QString g_strLocalRootPath = "./" ; const QString g_strLocalResourcesPath = "./resources/"; @@ -56,5 +57,14 @@ const QString g_strThemeBootstrat3 = "Boostrap 3"; const QString g_strThemeAttr = "Wt_theme"; const QString g_strTitleAttr = "Wt_title"; +/** Global icon cache. + * + * See https://bugreports.qt.io/browse/QTBUG-50829 + */ +class Icons +{ +public: + static QMap & GetCache(); +}; -#endif \ No newline at end of file +#endif diff --git a/src/main/wtdesigner.pro b/src/main/wtdesigner.pro index 604fac9..3522e11 100644 --- a/src/main/wtdesigner.pro +++ b/src/main/wtdesigner.pro @@ -80,6 +80,7 @@ SOURCES += ./main.cpp \ ./mainpage.cpp \ ./mainwindow.cpp \ ./mixedclasses.cpp \ + ./myglobals.cpp \ ./myundocommands.cpp \ ./mywebview.cpp \ ./helperfunctions.cpp \ From d36df5f3392bb286a2ccb63c250e0fe0bb1c6fb3 Mon Sep 17 00:00:00 2001 From: Uli Franke Date: Tue, 21 Jun 2016 16:24:38 +0200 Subject: [PATCH 04/11] Moved a recurring range check to a local boolean variable and casted vector size correctly to make compiler not warn about signed/unsigned comparison. --- src/main/mainpage.cpp | 68 ++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/src/main/mainpage.cpp b/src/main/mainpage.cpp index ee0afd2..8775a4b 100644 --- a/src/main/mainpage.cpp +++ b/src/main/mainpage.cpp @@ -402,6 +402,8 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon { QObject *object = NULL; + bool validRow = irow >= 0 && irow < static_cast(wparent->children().size()); + if (!wparent) { wparent = GetWContainerParent(qparent); @@ -409,7 +411,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon if (element->attribute("Wt_className").compare("WContainerWidget") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtContainerWidget(NULL, qparent); Wt::WContainerWidget *wwobject = dynamic_cast(object); @@ -420,7 +422,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WAnchor") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtAnchor(NULL, qparent); Wt::WAnchor *wwobject = dynamic_cast(object); // [NOTE] changed casting to wanchor otherwise crash (this is because WtQtAnchor already inerits from a mixed-class) @@ -431,7 +433,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WText") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtText(NULL, qparent); Wt::WText *wwobject = dynamic_cast(object); @@ -442,7 +444,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WLineEdit") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtLineEdit(NULL, qparent); Wt::WLineEdit *wwobject = dynamic_cast(object); @@ -453,7 +455,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WImage") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtImage(NULL, qparent); Wt::WImage *wwobject = dynamic_cast(object); @@ -464,7 +466,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WPushButton") == 0) // [TODO] first part was commented? { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtPushButton(NULL, qparent); Wt::WPushButton *wwobject = dynamic_cast(object); @@ -475,7 +477,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WTemplate") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtTemplate(NULL, qparent); Wt::WTemplate *wwobject = dynamic_cast(object); @@ -486,7 +488,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WSplitButton") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtSplitButton(NULL, qparent); Wt::WSplitButton *wwobject = dynamic_cast(object); @@ -497,7 +499,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WRadioButton") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtRadioButton(NULL, qparent); Wt::WRadioButton *wwobject = dynamic_cast(object); @@ -508,7 +510,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WCheckBox") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtCheckBox(NULL, qparent); Wt::WCheckBox *wwobject = dynamic_cast(object); @@ -519,7 +521,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WComboBox") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtComboBox(NULL, qparent); Wt::WComboBox *wwobject = dynamic_cast(object); @@ -530,7 +532,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WInPlaceEdit") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtInPlaceEdit(NULL, qparent); Wt::WInPlaceEdit *wwobject = dynamic_cast(object); @@ -541,7 +543,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WTextArea") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtTextArea(NULL, qparent); Wt::WTextArea *wwobject = dynamic_cast(object); @@ -552,7 +554,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WSelectionBox") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtSelectionBox(NULL, qparent); Wt::WSelectionBox *wwobject = dynamic_cast(object); @@ -563,7 +565,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WSpinBox") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtSpinBox(NULL, qparent); Wt::WSpinBox *wwobject = dynamic_cast(object); @@ -574,7 +576,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WDoubleSpinBox") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtDoubleSpinBox(NULL, qparent); Wt::WDoubleSpinBox *wwobject = dynamic_cast(object); @@ -585,7 +587,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WTimeEdit") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtTimeEdit(NULL, qparent); Wt::WTimeEdit *wwobject = dynamic_cast(object); @@ -596,7 +598,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WDateEdit") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtDateEdit(NULL, qparent); Wt::WDateEdit *wwobject = dynamic_cast(object); @@ -607,7 +609,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WCalendar") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtWCalendar(NULL, qparent); Wt::WCalendar *wwobject = dynamic_cast(object); @@ -618,7 +620,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WSlider") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtSlider(NULL, qparent); Wt::WSlider *wwobject = dynamic_cast(object); @@ -629,7 +631,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WFileUpload") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtFileUpload(NULL, qparent); Wt::WFileUpload *wwobject = dynamic_cast(object); @@ -640,7 +642,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WProgressBar") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtProgressBar(NULL, qparent); Wt::WProgressBar *wwobject = dynamic_cast(object); @@ -651,7 +653,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WGroupBox") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtGroupBox(NULL, qparent); Wt::WGroupBox *wwobject = dynamic_cast(object); @@ -662,7 +664,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WPanel") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtPanel(NULL, qparent); Wt::WPanel *wwobject = dynamic_cast(object); @@ -673,7 +675,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WStackedWidget") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtStackedWidget(NULL, qparent); Wt::WStackedWidget *wwobject = dynamic_cast(object); @@ -684,7 +686,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WTabWidget") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtTabWidget(NULL, qparent); Wt::WTabWidget *wwobject = dynamic_cast(object); @@ -709,7 +711,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WMenu") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtMenu(NULL, qparent); Wt::WMenu *wwobject = dynamic_cast(object); @@ -734,7 +736,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WPopupMenu") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtPopupMenu(NULL, qparent); Wt::WWidget *wwobject = dynamic_cast(object)->getInternalWWidget(); @@ -762,7 +764,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WTable") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtTable(NULL, qparent); Wt::WTable *wwobject = dynamic_cast(object); @@ -773,7 +775,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WTree") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtTree(NULL, qparent); Wt::WTree *wwobject = dynamic_cast(object); @@ -784,7 +786,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WTreeTable") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtTreeTable(NULL, qparent); Wt::WTreeTable *wwobject = dynamic_cast(object); @@ -795,7 +797,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WNavigationBar") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtNavigationBar(NULL, qparent); Wt::WNavigationBar *wwobject = dynamic_cast(object); @@ -806,7 +808,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon } else if (element->attribute("Wt_className").compare("WPromotedWidget") == 0) { - if (irow >= 0 && irow < wparent->children().size()) + if (validRow) { object = new WtQtPromotedWidget(NULL, qparent); Wt::WContainerWidget *wwobject = dynamic_cast(object); From 6787a804e794f24916bf551f9ea9464f427127b0 Mon Sep 17 00:00:00 2001 From: Uli Franke Date: Tue, 21 Jun 2016 17:51:13 +0200 Subject: [PATCH 05/11] * Renamed WtQtWCalendar to WtQtCalendar for consistancy reasons * Rewrote widget generation function to use a factory lookup scheme which eliminates a lot of redundant code which again is better to maintain and debug --- src/main/helperfunctions.cpp | 2 +- src/main/mainpage.cpp | 522 +++++++---------------------------- src/main/mixedclasses.cpp | 20 +- src/main/mixedclasses.h | 8 +- 4 files changed, 115 insertions(+), 437 deletions(-) diff --git a/src/main/helperfunctions.cpp b/src/main/helperfunctions.cpp index a61505d..6a9d71d 100644 --- a/src/main/helperfunctions.cpp +++ b/src/main/helperfunctions.cpp @@ -391,7 +391,7 @@ QMetaObject GetMetaObjectByClassName(QString strClassName) } else if (strClassName.compare("WCalendar") == 0) { - metaObj = WtQtWCalendar::staticMetaObject; + metaObj = WtQtCalendar::staticMetaObject; } else if (strClassName.compare("WSlider") == 0) { diff --git a/src/main/mainpage.cpp b/src/main/mainpage.cpp index 8775a4b..65f33b8 100644 --- a/src/main/mainpage.cpp +++ b/src/main/mainpage.cpp @@ -398,433 +398,111 @@ bool MainPage::PerformDisconnection(Wt_ConnectionConfig *conConfig) return true; } -QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WContainerWidget * wparent, QObject * qparent) +typedef QObject * (*ElementFactory) (QObject *, Wt::WContainerWidget *, int); + +template +static QObject * +WidgetFactory(QObject *qparent, + Wt::WContainerWidget *wparent, + int row) { - QObject *object = NULL; + if (row >= 0 && row < static_cast(wparent->children().size())) + { + auto *object = new WidgetT(NULL, qparent); + wparent->insertWidget(row, dynamic_cast(object)); + return object; + } + else + { + return new WtQtContainerWidget(wparent, qparent); + } +} - bool validRow = irow >= 0 && irow < static_cast(wparent->children().size()); +template +static QObject * +InternalChildWidgetFactory(QObject *qparent, + Wt::WContainerWidget *, + int) +{ + auto *newparent = dynamic_cast(qparent); + if (newparent) + { + return new WidgetT(newparent); + } + qDebug() << "[ERROR] : Could not cast " << typeid(WidgetT).name() << " parent to " << typeid(WidgetParentT).name() << "."; + qDebug() << "[ERROR] : parent id = " << qparent->property("Wt_id").toString(); + qDebug() << "[ERROR] : parent class = " << qparent->property("Wt_className").toString(); - if (!wparent) - { - wparent = GetWContainerParent(qparent); - } + /* todo: handle this or provide a place holder widget */ + return nullptr; +} - if (element->attribute("Wt_className").compare("WContainerWidget") == 0) - { - if (validRow) - { - object = new WtQtContainerWidget(NULL, qparent); - Wt::WContainerWidget *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtContainerWidget(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WAnchor") == 0) - { - if (validRow) - { - object = new WtQtAnchor(NULL, qparent); - Wt::WAnchor *wwobject = dynamic_cast(object); // [NOTE] changed casting to wanchor otherwise crash (this is because WtQtAnchor already inerits from a mixed-class) - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtAnchor(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WText") == 0) - { - if (validRow) - { - object = new WtQtText(NULL, qparent); - Wt::WText *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtText(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WLineEdit") == 0) - { - if (validRow) - { - object = new WtQtLineEdit(NULL, qparent); - Wt::WLineEdit *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtLineEdit(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WImage") == 0) - { - if (validRow) - { - object = new WtQtImage(NULL, qparent); - Wt::WImage *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtImage(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WPushButton") == 0) // [TODO] first part was commented? - { - if (validRow) - { - object = new WtQtPushButton(NULL, qparent); - Wt::WPushButton *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtPushButton(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WTemplate") == 0) - { - if (validRow) - { - object = new WtQtTemplate(NULL, qparent); - Wt::WTemplate *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtTemplate(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WSplitButton") == 0) - { - if (validRow) - { - object = new WtQtSplitButton(NULL, qparent); - Wt::WSplitButton *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtSplitButton(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WRadioButton") == 0) - { - if (validRow) - { - object = new WtQtRadioButton(NULL, qparent); - Wt::WRadioButton *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtRadioButton(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WCheckBox") == 0) - { - if (validRow) - { - object = new WtQtCheckBox(NULL, qparent); - Wt::WCheckBox *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtCheckBox(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WComboBox") == 0) - { - if (validRow) - { - object = new WtQtComboBox(NULL, qparent); - Wt::WComboBox *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtComboBox(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WInPlaceEdit") == 0) - { - if (validRow) - { - object = new WtQtInPlaceEdit(NULL, qparent); - Wt::WInPlaceEdit *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtInPlaceEdit(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WTextArea") == 0) - { - if (validRow) - { - object = new WtQtTextArea(NULL, qparent); - Wt::WTextArea *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtTextArea(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WSelectionBox") == 0) - { - if (validRow) - { - object = new WtQtSelectionBox(NULL, qparent); - Wt::WSelectionBox *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtSelectionBox(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WSpinBox") == 0) - { - if (validRow) - { - object = new WtQtSpinBox(NULL, qparent); - Wt::WSpinBox *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtSpinBox(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WDoubleSpinBox") == 0) - { - if (validRow) - { - object = new WtQtDoubleSpinBox(NULL, qparent); - Wt::WDoubleSpinBox *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtDoubleSpinBox(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WTimeEdit") == 0) - { - if (validRow) - { - object = new WtQtTimeEdit(NULL, qparent); - Wt::WTimeEdit *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtTimeEdit(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WDateEdit") == 0) - { - if (validRow) - { - object = new WtQtDateEdit(NULL, qparent); - Wt::WDateEdit *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtDateEdit(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WCalendar") == 0) - { - if (validRow) - { - object = new WtQtWCalendar(NULL, qparent); - Wt::WCalendar *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtWCalendar(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WSlider") == 0) - { - if (validRow) - { - object = new WtQtSlider(NULL, qparent); - Wt::WSlider *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtSlider(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WFileUpload") == 0) - { - if (validRow) - { - object = new WtQtFileUpload(NULL, qparent); - Wt::WFileUpload *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtFileUpload(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WProgressBar") == 0) - { - if (validRow) - { - object = new WtQtProgressBar(NULL, qparent); - Wt::WProgressBar *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtProgressBar(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WGroupBox") == 0) - { - if (validRow) - { - object = new WtQtGroupBox(NULL, qparent); - Wt::WGroupBox *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtGroupBox(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WPanel") == 0) - { - if (validRow) - { - object = new WtQtPanel(NULL, qparent); - Wt::WPanel *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtPanel(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WStackedWidget") == 0) - { - if (validRow) - { - object = new WtQtStackedWidget(NULL, qparent); - Wt::WStackedWidget *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtStackedWidget(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WTabWidget") == 0) - { - if (validRow) - { - object = new WtQtTabWidget(NULL, qparent); - Wt::WTabWidget *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtTabWidget(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WTabItem") == 0) - { - WtQtTabWidget *newparent = dynamic_cast(qparent); - if (newparent) - { - object = new WtQtTabItem(newparent); - } - else - { - qDebug() << "[ERROR] : Could not cast WtQtTabItem parent as WtQtWTabWidget."; - qDebug() << "[ERROR] : WtQtTabItem parent id = " << qparent->property("Wt_id").toString(); - qDebug() << "[ERROR] : WtQtTabItem parend class = " << qparent->property("Wt_className").toString(); - } - } - else if (element->attribute("Wt_className").compare("WMenu") == 0) - { - if (validRow) - { - object = new WtQtMenu(NULL, qparent); - Wt::WMenu *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtMenu(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WMenuItem") == 0) - { - WtQtMenu *newparent = dynamic_cast(qparent); - if (newparent) - { - object = new WtQtMenuItem(newparent); - } - else - { - qDebug() << "[ERROR] : Could not cast WtQtMenuItem parent as WtQtMenu."; - qDebug() << "[ERROR] : WtQtMenuItem parent id = " << qparent->property("Wt_id").toString(); - qDebug() << "[ERROR] : WtQtMenuItem parend class = " << qparent->property("Wt_className").toString(); - } - } - else if (element->attribute("Wt_className").compare("WPopupMenu") == 0) - { - if (validRow) - { - object = new WtQtPopupMenu(NULL, qparent); - Wt::WWidget *wwobject = dynamic_cast(object)->getInternalWWidget(); - if (wwobject) - { - wparent->insertWidget(irow, wwobject); - } - } - else - object = new WtQtPopupMenu(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WPopupItem") == 0) - { - WtQtPopupMenu *newparent = dynamic_cast(qparent); - if (newparent) - { - object = new WtQtPopupItem(newparent); - } - else - { - qDebug() << "[ERROR] : Could not cast WtQtPopupItem parent as WtQtPopupMenu."; - qDebug() << "[ERROR] : WtQtPopupItem parent id = " << qparent->property("Wt_id").toString(); - qDebug() << "[ERROR] : WtQtPopupItem parend class = " << qparent->property("Wt_className").toString(); - } - } - else if (element->attribute("Wt_className").compare("WTable") == 0) - { - if (validRow) - { - object = new WtQtTable(NULL, qparent); - Wt::WTable *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtTable(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WTree") == 0) - { - if (validRow) - { - object = new WtQtTree(NULL, qparent); - Wt::WTree *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtTree(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WTreeTable") == 0) - { - if (validRow) - { - object = new WtQtTreeTable(NULL, qparent); - Wt::WTreeTable *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtTreeTable(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WNavigationBar") == 0) - { - if (validRow) - { - object = new WtQtNavigationBar(NULL, qparent); - Wt::WNavigationBar *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtNavigationBar(wparent, qparent); - } - else if (element->attribute("Wt_className").compare("WPromotedWidget") == 0) - { - if (validRow) - { - object = new WtQtPromotedWidget(NULL, qparent); - Wt::WContainerWidget *wwobject = dynamic_cast(object); - wparent->insertWidget(irow, wwobject); - } - else - object = new WtQtPromotedWidget(wparent, qparent); - } - else - { - qDebug() << "[ERROR] : Unknown Wt Element."; // TODO : do something, now it crashes - qDebug() << "[ERROR] : Unknown element className = " << element->attribute("Wt_className"); - qDebug() << "[ERROR] : Unknown element lineNumber = " << element->lineNumber(); - } +#define WTD_MAKE_WIDGET_LUT_ENTRY(BASENAME) \ + {"W" #BASENAME, &WidgetFactory} + +#define WTD_MAKE_WIDGET_LUT_ENTRY_INTL(BASENAME, PARENTBASENAME) \ + {"W" #BASENAME, &InternalChildWidgetFactory} + +#include - return object; +QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WContainerWidget * wparent, QObject * qparent) +{ + static const std::unordered_map lookup({ + WTD_MAKE_WIDGET_LUT_ENTRY(ContainerWidget), + WTD_MAKE_WIDGET_LUT_ENTRY(Anchor), + WTD_MAKE_WIDGET_LUT_ENTRY(Text), + WTD_MAKE_WIDGET_LUT_ENTRY(LineEdit), + WTD_MAKE_WIDGET_LUT_ENTRY(Image), + WTD_MAKE_WIDGET_LUT_ENTRY(PushButton), + WTD_MAKE_WIDGET_LUT_ENTRY(Template), + WTD_MAKE_WIDGET_LUT_ENTRY(SplitButton), + WTD_MAKE_WIDGET_LUT_ENTRY(RadioButton), + WTD_MAKE_WIDGET_LUT_ENTRY(CheckBox), + WTD_MAKE_WIDGET_LUT_ENTRY(ComboBox), + WTD_MAKE_WIDGET_LUT_ENTRY(InPlaceEdit), + WTD_MAKE_WIDGET_LUT_ENTRY(TextArea), + WTD_MAKE_WIDGET_LUT_ENTRY(SelectionBox), + WTD_MAKE_WIDGET_LUT_ENTRY(SpinBox), + WTD_MAKE_WIDGET_LUT_ENTRY(DoubleSpinBox), + WTD_MAKE_WIDGET_LUT_ENTRY(TimeEdit), + WTD_MAKE_WIDGET_LUT_ENTRY(DateEdit), + WTD_MAKE_WIDGET_LUT_ENTRY(Calendar), + WTD_MAKE_WIDGET_LUT_ENTRY(Slider), + WTD_MAKE_WIDGET_LUT_ENTRY(FileUpload), + WTD_MAKE_WIDGET_LUT_ENTRY(ProgressBar), + WTD_MAKE_WIDGET_LUT_ENTRY(GroupBox), + WTD_MAKE_WIDGET_LUT_ENTRY(Panel), + WTD_MAKE_WIDGET_LUT_ENTRY(StackedWidget), + WTD_MAKE_WIDGET_LUT_ENTRY(TabWidget), + WTD_MAKE_WIDGET_LUT_ENTRY_INTL(TabItem, TabWidget), + WTD_MAKE_WIDGET_LUT_ENTRY(Menu), + WTD_MAKE_WIDGET_LUT_ENTRY_INTL(MenuItem, Menu), + WTD_MAKE_WIDGET_LUT_ENTRY(PopupMenu), + WTD_MAKE_WIDGET_LUT_ENTRY_INTL(PopupItem, PopupMenu), + WTD_MAKE_WIDGET_LUT_ENTRY(Table), + WTD_MAKE_WIDGET_LUT_ENTRY(Tree), + WTD_MAKE_WIDGET_LUT_ENTRY(TreeTable), + WTD_MAKE_WIDGET_LUT_ENTRY(NavigationBar), + + /* special/irregular factory entries come here */ + {"WPromotedWidget", &WidgetFactory}, + }); + + try { + auto factory = lookup.at(element->attribute("Wt_className").toStdString()); + return factory(qparent, + wparent ? wparent : GetWContainerParent(qparent), + irow); + } catch (std::out_of_range) { + /* handle special cases which can not be handled by default factories here */ + + qDebug() << "[ERROR] : Unknown Wt Element."; // TODO : do something, now it crashes + qDebug() << "[ERROR] : Unknown element className = " << element->attribute("Wt_className"); + qDebug() << "[ERROR] : Unknown element lineNumber = " << element->lineNumber(); + + /* todo: instead of crashing we should return an place holder widget */ + return nullptr; + } } void MainPage::AddStyleSheetFile(QString &strPath) diff --git a/src/main/mixedclasses.cpp b/src/main/mixedclasses.cpp index ee118f8..0fa976f 100644 --- a/src/main/mixedclasses.cpp +++ b/src/main/mixedclasses.cpp @@ -2079,52 +2079,52 @@ void WtQtDateEdit::Wt_setFormat(QString format) ----------------------------------------------------------------------------------------------------------------------------------------------------------- */ -WtQtWCalendar::WtQtWCalendar(Wt::WContainerWidget *wparent /*= 0*/, QObject *qparent /*= 0*/) : Wt::WCalendar(wparent), WtQtCompositeWidget(qparent) +WtQtCalendar::WtQtCalendar(Wt::WContainerWidget *wparent /*= 0*/, QObject *qparent /*= 0*/) : Wt::WCalendar(wparent), WtQtCompositeWidget(qparent) { } -WtQtWCalendar::WtQtWCalendar(const WtQtWCalendar& other) +WtQtCalendar::WtQtCalendar(const WtQtCalendar& other) { Q_UNUSED(other) } -WtQtWCalendar::~WtQtWCalendar() +WtQtCalendar::~WtQtCalendar() { } -QString WtQtWCalendar::Wt_className() +QString WtQtCalendar::Wt_className() { return "WCalendar"; } -QString WtQtWCalendar::Wt_id() +QString WtQtCalendar::Wt_id() { return QString::fromStdString(id()); } -void WtQtWCalendar::Wt_setId(QString id) +void WtQtCalendar::Wt_setId(QString id) { setId(id.toStdString()); } -QString WtQtWCalendar::Wt_styleClass() +QString WtQtCalendar::Wt_styleClass() { return QString::fromStdString(styleClass().toUTF8()); } -void WtQtWCalendar::Wt_setStyleClass(QString styleclass) +void WtQtCalendar::Wt_setStyleClass(QString styleclass) { setStyleClass(Wt::WString::fromUTF8(styleclass.toStdString())); } -QString WtQtWCalendar::Wt_isInline() +QString WtQtCalendar::Wt_isInline() { return QString("%1").arg(isInline()); } -void WtQtWCalendar::Wt_setInline(QString isinline) +void WtQtCalendar::Wt_setInline(QString isinline) { setInline(isinline.toUInt()); } diff --git a/src/main/mixedclasses.h b/src/main/mixedclasses.h index e742135..3b5eb74 100644 --- a/src/main/mixedclasses.h +++ b/src/main/mixedclasses.h @@ -1018,14 +1018,14 @@ class WtQtDateEdit : public WtQtLineEdit, public Wt::WDateEdit }; -class WtQtWCalendar : public WtQtCompositeWidget, public Wt::WCalendar +class WtQtCalendar : public WtQtCompositeWidget, public Wt::WCalendar { Q_OBJECT public: - WtQtWCalendar(Wt::WContainerWidget *wparent = 0, QObject *qparent = 0); - ~WtQtWCalendar(); - WtQtWCalendar(const WtQtWCalendar& other); + WtQtCalendar(Wt::WContainerWidget *wparent = 0, QObject *qparent = 0); + ~WtQtCalendar(); + WtQtCalendar(const WtQtCalendar& other); QString Wt_className(); // [NOTE] : need to add to helperfunctions::GetMetaObjectByClassName From d1b2ca739e1c201589a4856c677bd1053bebaa6c Mon Sep 17 00:00:00 2001 From: Uli Franke Date: Tue, 21 Jun 2016 18:53:11 +0200 Subject: [PATCH 06/11] Fixed bug introduced with 6787a804e794f24916bf551f9ea9464f427127b0 --- src/main/mainpage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/mainpage.cpp b/src/main/mainpage.cpp index 65f33b8..71792a7 100644 --- a/src/main/mainpage.cpp +++ b/src/main/mainpage.cpp @@ -414,7 +414,7 @@ WidgetFactory(QObject *qparent, } else { - return new WtQtContainerWidget(wparent, qparent); + return new WidgetT(wparent, qparent); } } From d87a66636c63287a6dc9cf06b10e19042e5944e9 Mon Sep 17 00:00:00 2001 From: Uli Franke Date: Tue, 21 Jun 2016 18:54:38 +0200 Subject: [PATCH 07/11] Fixes #4 Fixes #10 --- src/main/mixedclasses.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/mixedclasses.cpp b/src/main/mixedclasses.cpp index 0fa976f..d922e04 100644 --- a/src/main/mixedclasses.cpp +++ b/src/main/mixedclasses.cpp @@ -4286,7 +4286,7 @@ QString WtQtProgressBar::Cpp_value() QString WtQtGroupBox::Cpp_title() { - return Wt_id() + "->setTitle(" + Wt_title() + ");"; + return Wt_id() + "->setTitle(Wt::WString::fromUTF8(\"" + Wt_title() + "\"));"; } QString WtQtGroupBox::Cpp_htmlTagName() @@ -4297,7 +4297,7 @@ QString WtQtGroupBox::Cpp_htmlTagName() QString WtQtPanel::Cpp_title() { - return Wt_id() + "->setTitle(" + Wt_title() + ");"; + return Wt_id() + "->setTitle(Wt::WString::fromUTF8(\"" + Wt_title() + "\"));"; } QString WtQtPanel::Cpp_isCollapsible() From f90a0175df6ff77a9c8bd062ea177dbf72717f8d Mon Sep 17 00:00:00 2001 From: Uli Franke Date: Tue, 21 Jun 2016 19:05:39 +0200 Subject: [PATCH 08/11] Fixed indenting to comply with juan's style --- src/main/mainpage.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/mainpage.cpp b/src/main/mainpage.cpp index 71792a7..b60cf97 100644 --- a/src/main/mainpage.cpp +++ b/src/main/mainpage.cpp @@ -447,7 +447,7 @@ InternalChildWidgetFactory(QObject *qparent, QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WContainerWidget * wparent, QObject * qparent) { - static const std::unordered_map lookup({ + static const std::unordered_map lookup({ WTD_MAKE_WIDGET_LUT_ENTRY(ContainerWidget), WTD_MAKE_WIDGET_LUT_ENTRY(Anchor), WTD_MAKE_WIDGET_LUT_ENTRY(Text), @@ -486,15 +486,15 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon /* special/irregular factory entries come here */ {"WPromotedWidget", &WidgetFactory}, - }); + }); - try { - auto factory = lookup.at(element->attribute("Wt_className").toStdString()); - return factory(qparent, - wparent ? wparent : GetWContainerParent(qparent), - irow); - } catch (std::out_of_range) { - /* handle special cases which can not be handled by default factories here */ + try { + auto factory = lookup.at(element->attribute("Wt_className").toStdString()); + return factory(qparent, + wparent ? wparent : GetWContainerParent(qparent), + irow); + } catch (std::out_of_range) { + /* handle special cases which can not be handled by default factories here */ qDebug() << "[ERROR] : Unknown Wt Element."; // TODO : do something, now it crashes qDebug() << "[ERROR] : Unknown element className = " << element->attribute("Wt_className"); @@ -502,7 +502,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon /* todo: instead of crashing we should return an place holder widget */ return nullptr; - } + } } void MainPage::AddStyleSheetFile(QString &strPath) From 91184b45bcd7026ec2f51f3aafb1b88d411b8c3b Mon Sep 17 00:00:00 2001 From: Uli Franke Date: Tue, 21 Jun 2016 22:03:53 +0200 Subject: [PATCH 09/11] Catch by const reference, addendum to 6787a804e794f24916bf551f9ea9464f427127b0 --- src/main/mainpage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/mainpage.cpp b/src/main/mainpage.cpp index b60cf97..9573626 100644 --- a/src/main/mainpage.cpp +++ b/src/main/mainpage.cpp @@ -493,7 +493,7 @@ QObject * MainPage::CreateWtQtInstance(QDomElement * element, int irow, Wt::WCon return factory(qparent, wparent ? wparent : GetWContainerParent(qparent), irow); - } catch (std::out_of_range) { + } catch (const std::out_of_range &) { /* handle special cases which can not be handled by default factories here */ qDebug() << "[ERROR] : Unknown Wt Element."; // TODO : do something, now it crashes From ae5793b5ec4e7219ac51181b5fe440fc709ee963 Mon Sep 17 00:00:00 2001 From: juangburgos Date: Wed, 22 Jun 2016 21:15:03 +0200 Subject: [PATCH 10/11] Single line adaptation for visual studio compatibility --- src/main/mainwindow.cpp | 2 +- src/wtconfig.pri | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/mainwindow.cpp b/src/main/mainwindow.cpp index 7b85437..cd4786d 100644 --- a/src/main/mainwindow.cpp +++ b/src/main/mainwindow.cpp @@ -471,7 +471,7 @@ void MainWindow::StartWtServer() void MainWindow::StopWtServer() { - if (not m_server) + if (!m_server) { return; } diff --git a/src/wtconfig.pri b/src/wtconfig.pri index dd2f947..5562a28 100644 --- a/src/wtconfig.pri +++ b/src/wtconfig.pri @@ -24,9 +24,7 @@ INCLUDEPATH += . \ DEPENDPATH += . LIBS += -LC:/Wt-3.3.5-msvs2013-Windows-x86-SDK/lib \ - -LC:/Wt-3.3.5-msvs2013-Windows-x86-SDK/bin \ - -LC:/Wt-3.3.5-msvs2013-Windows-x64-SDK/lib \ - -LC:/Wt-3.3.5-msvs2013-Windows-x64-SDK/bin + -LC:/Wt-3.3.5-msvs2013-Windows-x64-SDK/lib CONFIG(debug, debug|release) { From 3f4f0cff03a1a1468d5bc8cf695a7ee4ced6dfaa Mon Sep 17 00:00:00 2001 From: juangburgos Date: Wed, 22 Jun 2016 21:38:49 +0200 Subject: [PATCH 11/11] Standard updates for release branch --- README.md | 16 +++++++++++++--- deploy/README.txt | 4 ++-- deploy/config/config.xml | 2 +- deploy/config/config_nix.xml | 2 +- deploy/packages/WtDesigner/meta/package.xml | 4 ++-- src/main/dialogs/dialogabout/dialogabout.ui | 9 +++++++-- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0b04384..3cde32e 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,19 @@ *** -[Download Windows Binaries (64-bits)](https://sourceforge.net/projects/wtdesigner/files/Windowsx64/v.1.0.2/) +[Download Windows Binaries (64-bits)](https://sourceforge.net/projects/wtdesigner/files/Windowsx64/v.1.0.3/) * Install "vcredist_x64.exe" before running WtDesigner for the first time. * Run WtDesigner with Administrator rights in Windows. *** -[Download Linux Binaries (64-bits)](https://sourceforge.net/projects/wtdesigner/files/Linux64/v.1.0.2/) +[Download Linux Binaries (64-bits)](https://sourceforge.net/projects/wtdesigner/files/Linux64/v.1.0.3/) * Might be necessary to: ```bash -$ chmod +x ./WtDesignerInstallerV.1.0.2.run +$ chmod +x ./WtDesignerInstallerV.1.0.3.run ``` * Tested on **CentOS7** and **Ubuntu14.04** @@ -31,6 +31,16 @@ A WYSIWYG (What You See Is What You Get) front-end editor which serves as bride *** +## Who + +List of contributors: + +* [juangburgos](https://github.com/juangburgos). + +* [cls-nebadje](https://github.com/cls-nebadje). + +*** + ## Why Although C++ doesn’t come into mind as the first language for web development, there is a specific number of scenarios in which it can be advantageous with respect to other languages: diff --git a/deploy/README.txt b/deploy/README.txt index 73dbc49..a0a1aec 100644 --- a/deploy/README.txt +++ b/deploy/README.txt @@ -22,7 +22,7 @@ All Generate installer with: -binarycreator --offline-only -c config/config.xml -p packages WtDesignerInstallerV.1.0.2.exe +binarycreator --offline-only -c config/config.xml -p packages WtDesignerInstallerV.1.0.3.exe PATH=$PATH:/home/juangburgos/Qt/QtIFW2.0.1/bin/ -binarycreator --offline-only -c config/config_nix.xml -p packages WtDesignerInstallerV.1.0.2.run +binarycreator --offline-only -c config/config_nix.xml -p packages WtDesignerInstallerV.1.0.3.run diff --git a/deploy/config/config.xml b/deploy/config/config.xml index b75933a..0e8ebad 100644 --- a/deploy/config/config.xml +++ b/deploy/config/config.xml @@ -1,7 +1,7 @@ WtDesigner - 1.0.2 + 1.0.3 WtDesigner (Windows 64-bits) Juan Gonzalez Burgos WtDesigner diff --git a/deploy/config/config_nix.xml b/deploy/config/config_nix.xml index 5852288..0d3906e 100644 --- a/deploy/config/config_nix.xml +++ b/deploy/config/config_nix.xml @@ -1,7 +1,7 @@ WtDesigner - 1.0.2 + 1.0.3 WtDesigner (Linux 64-bit) Juan Gonzalez Burgos WtDesigner diff --git a/deploy/packages/WtDesigner/meta/package.xml b/deploy/packages/WtDesigner/meta/package.xml index 3cd3ae4..8f8e642 100644 --- a/deploy/packages/WtDesigner/meta/package.xml +++ b/deploy/packages/WtDesigner/meta/package.xml @@ -2,8 +2,8 @@ WtDesigner A WYSIWYG designer for the Wt C++ library. - 1.0.2 - 2016-05-16 + 1.0.3 + 2016-06-16 true true diff --git a/src/main/dialogs/dialogabout/dialogabout.ui b/src/main/dialogs/dialogabout/dialogabout.ui index 6fe6b3d..269c820 100644 --- a/src/main/dialogs/dialogabout/dialogabout.ui +++ b/src/main/dialogs/dialogabout/dialogabout.ui @@ -75,7 +75,7 @@ 0 0 384 - 499 + 506 @@ -99,9 +99,14 @@ p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial,Helvetica,sans'; font-size:16pt; font-weight:600; color:#e1e1e1;">WtDesigner v.1.0.2</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial,Helvetica,sans'; font-size:16pt; font-weight:600; color:#e1e1e1;">WtDesigner v.1.0.3</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt; color:#e1e1e1;">Copyright (c) 2016 Juan Gonzalez Burgos</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; color:#e1e1e1;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt; color:#e1e1e1;">Contributors:</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt; color:#e1e1e1;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt; color:#e1e1e1;">- </span><a href="https://github.com/juangburgos/"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">juangburgos</span></a></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt; color:#e1e1e1;">- </span><a href="https://github.com/cls-nebadje"><span style=" font-size:11pt; text-decoration: underline; color:#0000ff;">cls-nebadje</span></a></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt; color:#e1e1e1;">This project could not have been possible without:</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:11pt;"><br /></p>