]> vaikene.ee Git - evaf/commitdiff
Ported to Qt5
authorEnar Väikene <enar@vaikene.net>
Thu, 7 Nov 2013 12:01:25 +0000 (14:01 +0200)
committerEnar Väikene <enar@vaikene.net>
Thu, 7 Nov 2013 12:01:25 +0000 (14:01 +0200)
Currently missing Qt plugin loading using eVaf XML files.

59 files changed:
CMakeLists.txt
src/apps/CMakeLists.txt
src/apps/FileFinder/CMakeLists.txt
src/apps/FileFinder/Engine/CMakeLists.txt
src/apps/FileFinder/Engine/engine.cpp
src/apps/FileFinder/Engine/engine.h
src/apps/FileFinder/GUI/CMakeLists.txt
src/apps/FileFinder/GUI/gui.cpp
src/apps/FileFinder/GUI/gui.h
src/apps/PswGen/CLI/CMakeLists.txt
src/apps/PswGen/CLI/cli.cpp
src/apps/PswGen/CLI/cli.h
src/apps/PswGen/CMakeLists.txt
src/apps/PswGen/GUI/CMakeLists.txt
src/apps/PswGen/GUI/gui.cpp
src/apps/PswGen/GUI/gui.h
src/apps/PswGen/Generator/CMakeLists.txt
src/apps/PswGen/Generator/module.cpp
src/apps/PswGen/Generator/module.h
src/apps/PswGen/Storage/CMakeLists.txt
src/apps/PswGen/Storage/module.cpp
src/apps/PswGen/Storage/module.h
src/apps/ScosTime/CMakeLists.txt
src/apps/ScosTime/gui.cpp
src/apps/ScosTime/gui.h
src/libs/CMakeLists.txt
src/libs/Common/CMakeLists.txt
src/libs/Common/config.cpp
src/libs/Common/config.h
src/libs/Common/eventqueue.cpp
src/libs/Common/eventqueue.h
src/libs/Common/prop.cpp
src/libs/Common/prop.h
src/libs/Common/registry.cpp
src/libs/Common/registry.h
src/libs/Gui/CMakeLists.txt
src/libs/Plugins/CMakeLists.txt
src/libs/Plugins/pluginmanager.cpp
src/libs/Plugins/pluginmanager_p.h
src/libs/version_rc.h
src/main/CLI/CMakeLists.txt
src/main/CLI/main.cpp
src/main/CMakeLists.txt
src/main/GUI/CMakeLists.txt
src/main/GUI/fatalerr.cpp
src/main/GUI/main.cpp
src/plugins/CMakeLists.txt
src/plugins/LogView/CMakeLists.txt
src/plugins/LogView/factory.cpp
src/plugins/LogView/factory.h
src/plugins/LogView/logview.cpp
src/plugins/SdiWindow/CMakeLists.txt
src/plugins/SdiWindow/factory.cpp
src/plugins/SdiWindow/factory.h
src/plugins/SdiWindow/sdiwindow.cpp
src/plugins/SdiWindow/sdiwindow.h
src/plugins/Test/CMakeLists.txt
src/plugins/Test/factory.cpp
src/plugins/Test/factory.h

index e7b58d0c24a31b8e75e87bfa719f3d467192860f..7fbcdd6783b5dd40b2c649e9d714c24f45547988 100644 (file)
@@ -1,17 +1,22 @@
 project(eVaf)
 
-set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
-cmake_minimum_required(VERSION 2.6.0)
+cmake_minimum_required(VERSION 2.8.9)
 
 if(COMMAND cmake_policy)
     cmake_policy(SET CMP0003 NEW)
+    cmake_policy(SET CMP0020 NEW)
 endif(COMMAND cmake_policy)
 
+# Find Qt packages
+find_package(Qt5Core REQUIRED)
+find_package(Qt5Xml REQUIRED)
+find_package(Qt5Widgets)
+find_package(Qt5Sql)
+
 # Include our own cmake modules
 set(CMAKE_MODULE_PATH ${eVaf_SOURCE_DIR}/mk/cmake)
 
-# Find Qt4
-find_package(Qt4 4.6 REQUIRED)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
 
 # Default to the Debug build type if none is specified
 IF(NOT CMAKE_BUILD_TYPE)
index 65cc4c47b3cf29ace6ed94eec7a8fcb77138ce68..d9521a3b3709c12c4b9ac4f89ab7f00734594f43 100644 (file)
@@ -1,5 +1,7 @@
-add_subdirectory(PswGen)
+if(Qt5Sql_FOUND)
+  add_subdirectory(PswGen)
+endif(Qt5Sql_FOUND)
 add_subdirectory(FileFinder)
-if(QT_QTGUI_FOUND)
+if(Qt5Widgets_FOUND)
   add_subdirectory(ScosTime)
-endif(QT_QTGUI_FOUND)
+endif(Qt5Widgets_FOUND)
index 1e6d01c06ac744a84f82439d1248be71eb4c8f2d..3b7324fcb1ac74b4c15eff387469fd740829ae97 100644 (file)
@@ -1,6 +1,6 @@
 set(eVaf_INCLUDE ${eVaf_INCLUDE} ${CMAKE_SOURCE_DIR}/src/apps/FileFinder)
 
 add_subdirectory(Engine)
-if(QT_QTGUI_FOUND)
+if(Qt5Widgets_FOUND)
   add_subdirectory(GUI)
-endif(QT_QTGUI_FOUND)
+endif(Qt5Widgets_FOUND)
index af9c24a7bebc6785f29a30eeb8d59a7d1df17c40..310d5090a9d9950ed6613407b591ba4a0b7a867e 100644 (file)
@@ -2,8 +2,8 @@
 set(TARGET FileFinderEngine)
 
 # Qt modules
-set(QT_DONT_USE_QTGUI TRUE)
-include(${QT_USE_FILE})
+#set(QT_DONT_USE_QTGUI TRUE)
+#include(${QT_USE_FILE})
 
 # Needed for exporting/importing symbols
 add_definitions(-DFILEFINDER_ENGINE_LIBRARY)
@@ -30,10 +30,12 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index 5c79cfd468f6f5f69da3f3fcbd51d28ef8efb756..bd15220e0f051fd3682be9bb036953b08c92eec8 100644 (file)
@@ -19,7 +19,6 @@
 
 
 #include "engine.h"
-#include "version.h"
 
 #include <Common/iLogger>
 #include <Common/iRegistry>
@@ -27,7 +26,6 @@
 #include <QtCore>
 
 VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::FileFinder::Engine::Module)
 
 using namespace eVaf;
 using namespace eVaf::FileFinder;
index 341df0a8cd8f9cb179cba3658045d9cf4853c664..a17d3ccfbcb22cab08805b46f6ca1c085d7bf94f 100644 (file)
@@ -21,6 +21,7 @@
 #  define __FILEFINDER_ENGINE_ENGINE_H
 
 #include "ifilefinder.h"
+#include "version.h"
 
 #include <Plugins/iPlugin>
 
@@ -62,6 +63,7 @@ class Module : public Plugins::iPlugin
 {
     Q_OBJECT
     Q_INTERFACES(eVaf::Plugins::iPlugin)
+    Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
 
 public:
 
index 56b5db42eab939034fef713301928b53200da9bb..3c9d64cfd08ddfd77b68e5b7bfccd77b3a440699 100644 (file)
@@ -2,7 +2,7 @@
 set(TARGET FileFinderGui)
 
 # Qt modules
-include(${QT_USE_FILE})
+#include(${QT_USE_FILE})
 
 # Include files
 include_directories(${eVaf_INCLUDE})
@@ -30,12 +30,14 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_add_resources(RCC_SRCS ${RCCS})
+qt5_add_resources(RCC_SRCS ${RCCS})
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS} ${RCC_SRCS})
 
+qt5_use_modules(${TARGET} Core Widgets)
+
 target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index e664dd7703d484f06e62890ee6ccc8f73a2f04c9..9574df1e61004998b22e5ddd12cd5c061f73f62f 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include "gui.h"
-#include "version.h"
 
 #include "Engine/iFileFinder"
 
 #include <Common/iApp>
 #include <SdiWindow/iSdiWindow>
 
-#include <QtGui>
+#include <QtWidgets>
 
 VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::FileFinder::GUI::Module)
 
 using namespace eVaf;
 
@@ -44,7 +42,7 @@ void FileFinder::GUI::Internal::MainWidget::keyPressEvent(QKeyEvent * e)
         switch (e->key()) {
             case Qt::Key_Enter:
             case Qt::Key_Return: {
-                QList<QPushButton *> buttons = qFindChildren<QPushButton *>(this);
+                QList<QPushButton *> buttons = findChildren<QPushButton *>();
                 foreach (QPushButton * btn, buttons) {
                     if (btn->isDefault() && btn->isVisible()) {
                         if (btn->isEnabled())
index 4d22d0b0d7636d14722fa6d28a1094a42a6d5d80..283b1676f3384e197b0d4ae7b2f67c6a3ad6055e 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __FILEFINDER_GUI_GUI_H
 #  define __FILEFINDER_GUI_GUI_H
 
+#include "version.h"
+
 #include <Plugins/iPlugin>
 #include <Gui/Panel>
 
@@ -82,6 +84,7 @@ class Module : public Plugins::iPlugin
 {
     Q_OBJECT
     Q_INTERFACES(eVaf::Plugins::iPlugin)
+    Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
 
 public:
 
index ef8ee227b25460bc7df9638cce94fb5f0f8aaf1e..862916895593be2fae47294bade7f14493625eff 100644 (file)
@@ -1,10 +1,6 @@
 # Name of the target
 set(TARGET PswCli)
 
-# Qt modules
-set(QT_DONT_USE_QTGUI TRUE)
-include(${QT_USE_FILE})
-
 # Include files
 include_directories(${eVaf_INCLUDE})
 
@@ -26,10 +22,12 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index 51ea2b6690351cafa0dc2f654156a856fd2a03b8..56a49fbaed94fa684806b3f92220d0bf94e0cb90 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include "cli.h"
-#include "version.h"
 
 #include <Generator/iGenerator>
 #include <Storage/iStorage>
@@ -42,7 +41,6 @@
 #endif
 
 VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::PswGen::CLI::Module)
 
 
 //-------------------------------------------------------------------
index 9747565483fc7621cc2465f33037cb3e02e08c7a..cf53859331f2df2509e08bafc170a5d32500a7d7 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __PSWGEN_CLI_CLI_H
 #  define __PSWGEN_CLI_CLI_H
 
+#include "version.h"
+
 #include <Plugins/iPlugin>
 
 #include <QObject>
@@ -46,6 +48,7 @@ class Module : public Plugins::iPlugin
 {
     Q_OBJECT
     Q_INTERFACES(eVaf::Plugins::iPlugin)
+    Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
 
 public:
 
index 3eadf22269486732b3c9eae9d7aad342a5298cc6..d6128529a0d96f91a91e3c51d62fe0dc9cbfaefc 100644 (file)
@@ -1,8 +1,8 @@
 set(eVaf_INCLUDE ${eVaf_INCLUDE} ${CMAKE_SOURCE_DIR}/src/apps/PswGen)
 
-if(QT_QTGUI_FOUND)
+if(Qt5Widgets_FOUND)
   add_subdirectory(GUI)
-endif(QT_QTGUI_FOUND)
+endif(Qt5Widgets_FOUND)
 add_subdirectory(CLI)
 add_subdirectory(Generator)
 add_subdirectory(Storage)
index 561060ec6898ac85241e031cd804784a53c9e892..89e947384745249b26cf59448576b59b4ed6799b 100644 (file)
@@ -1,9 +1,6 @@
 # Name of the target
 set(TARGET PswGui)
 
-# Qt modules
-include(${QT_USE_FILE})
-
 # Include files
 include_directories(${eVaf_INCLUDE})
 
@@ -25,10 +22,12 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core Widgets)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index 9ab2645b9bb745b5aa61ab95bbb0a5a8beecb64c..6f94ce9ce5f66afe5880520d6dbe1ce505620f5b 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include "gui.h"
-#include "version.h"
 
 #include "Generator/iGenerator"
 #include "Storage/iStorage"
 #include <SdiWindow/iSdiWindow>
 #include <Gui/Panel>
 
-#include <QtGui>
+#include <QtWidgets>
 
 
 VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::PswGen::GUI::Module)
 
 
 //-------------------------------------------------------------------
index 246b556ac6c37a038920ef8e5052ce6f70e00c1b..f4abd248b0399d02480c454b5dc1422f5d1222fb 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __PSWGEN_GUI_GUI_H
 #define __PSWGEN_GUI_GUI_H
 
+#include "version.h"
+
 #include <Plugins/iPlugin>
 
 #include <QObject>
@@ -45,6 +47,7 @@ class Module : public Plugins::iPlugin
 {
     Q_OBJECT
     Q_INTERFACES(eVaf::Plugins::iPlugin)
+    Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
 
 public:
 
index 3d7c7ebe514aea2d68153a65fddab79a4fbc7c9e..c4ca65fb543479ec63ae85e50c566069384ad9b5 100644 (file)
@@ -1,10 +1,6 @@
 # Name of the target
 set(TARGET PswGen)
 
-# Qt modules
-set(QT_DONT_USE_QTGUI TRUE)
-include(${QT_USE_FILE})
-
 # Needed for exporting/importing symbols
 add_definitions(-DPSWGEN_GENERATOR_LIBRARY)
 
@@ -29,10 +25,12 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index 9e24e561f39d16d317ab6b2371694366a393dd3c..bca195479139b33c2e953b0f9c7a0bc2366f3605 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include "module.h"
-#include "version.h"
 
 #include <Common/iLogger>
 #include <Common/iRegistry>
@@ -26,7 +25,6 @@
 #include <QtCore>
 
 VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::PswGen::Generator::Module)
 
 using namespace eVaf;
 using namespace eVaf::PswGen;
index 90affff876b68a6aada6de05cf2e6ffa5ba2afb1..68cdb4ccb4cf2e976d979f6b8900af2077fcca79 100644 (file)
@@ -21,6 +21,7 @@
 #  define __PSWGEN_GENERATOR_MODULE_H
 
 #include "igenerator.h"
+#include "version.h"
 
 #include <Plugins/iPlugin>
 
@@ -45,6 +46,7 @@ class Module : public Plugins::iPlugin
 {
     Q_OBJECT
     Q_INTERFACES(eVaf::Plugins::iPlugin)
+    Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
 
 public:
 
index 2169469e2613cc63b7baf1a8d37a720a62b549c0..e3ffd48ab4bc9aefe3e3b31712c6dabc26155479 100644 (file)
@@ -1,11 +1,6 @@
 # Name of the target
 set(TARGET PswStorage)
 
-# Qt modules
-set(QT_USE_QTSQL TRUE)
-set(QT_DONT_USE_QTGUI TRUE)
-include(${QT_USE_FILE})
-
 # Needed for exporting symbols
 add_definitions(-DPSWGEN_STORAGE_LIBRARY)
 
@@ -30,10 +25,12 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core Sql)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index 12fda4213118132b30768af23720beb78cfbd5bd..3c18b9a7cf64b3870eefa0b1aa9d0a16e357a623 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include "module.h"
-#include "version.h"
 
 #include <Common/Globals>
 #include <Common/iLogger>
@@ -29,7 +28,6 @@
 #include <QtSql/QtSql>
 
 VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::PswGen::Storage::Module)
 
 using namespace eVaf;
 using namespace eVaf::PswGen;
@@ -170,10 +168,10 @@ bool StorageImpl::save(QString const & name, QExplicitlySharedDataPointer<Storag
         }
 
         // Store also into the local hash
+        beginResetModel();
         mData.insert(name, data);
+        endResetModel();
 
-        // Reset the model
-        reset();
     }
 
     data->reset();
@@ -253,14 +251,14 @@ bool StorageImpl::loadData()
         return false;
     }
 
+    beginResetModel();
     while (q.next()) {
         QString name = q.value(0).toString();
         QExplicitlySharedDataPointer<Storage::Data> data(
                     new Storage::Data(name, q.value(1).toString(), q.value(2).toInt(), uint(q.value(3).toInt())));
         mData.insert(name, data);
     }
-
-    reset();
+    endResetModel();
 
     return true;
 }
index 7f53b268d23718b04d65d828a79ce9fbdf998337..49c7e6a2f02a836198aee8c2b73cb1002ff86e71 100644 (file)
@@ -21,6 +21,7 @@
 #  define __PSWGEN_STORAGE_MODULE_H
 
 #include "istorage.h"
+#include "version.h"
 
 #include <Plugins/iPlugin>
 
@@ -49,6 +50,7 @@ class Module : public Plugins::iPlugin
 {
     Q_OBJECT
     Q_INTERFACES(eVaf::Plugins::iPlugin)
+    Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
 
 public:
 
index c56fb72c3b576954f2a2458191203978a1c1d4f3..e32c9efd4a44967a69bda62e6cde0f580464a780 100644 (file)
@@ -1,9 +1,6 @@
 # Name of the target
 set(TARGET ScosTime)
 
-# Qt modules
-include(${QT_USE_FILE})
-
 # Include files
 include_directories(${eVaf_INCLUDE})
 
@@ -30,12 +27,14 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_add_resources(RCC_SRCS ${RCCS})
+qt5_add_resources(RCC_SRCS ${RCCS})
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS} ${RCC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core Widgets)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index 1ea9ba1d744866a62f2a58dc7c023536d78a4009..1a978afa34612aafc6ac15ce13bfbd3472596a04 100644 (file)
@@ -18,7 +18,6 @@
  */
 
 #include "gui.h"
-#include "version.h"
 
 #include <Common/Globals>
 #include <Common/iLogger>
 #include <SdiWindow/iSdiWindow>
 #include <Gui/Panel>
 
-#include <QtGui>
+#include <QtWidgets>
 
 
 VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::ScosTime::Module)
 
 
 //-------------------------------------------------------------------
index fe6b5e3f3dcad059f2b9c6d0f6983bf1570c4d26..581760bc1daaab003b29e944dbd2c4593067d894 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __SCOSTIME_GUI_H
 #  define __SCOSTIME_GUI_H
 
+#include "version.h"
+
 #include <Plugins/iPlugin>
 
 #include <QObject>
@@ -41,6 +43,7 @@ class Module : public Plugins::iPlugin
 {
     Q_OBJECT
     Q_INTERFACES(eVaf::Plugins::iPlugin)
+    Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
 
 public:
 
index eabd2bc16def37539d1a6960c3c83cb787285286..458a3d02d6194e7ef9e7bd3c722095d4b20f6128 100644 (file)
@@ -1,5 +1,5 @@
 add_subdirectory(Plugins)
 add_subdirectory(Common)
-if(QT_QTGUI_FOUND)
+if(Qt5Widgets_FOUND)
   add_subdirectory(Gui)
-endif(QT_QTGUI_FOUND)
+endif(Qt5Widgets_FOUND)
index 83affd4f2c5130191a4136f76a948bd08efeeb64..ce5f10cda42580644eb007deaf79a305272b55ac 100644 (file)
@@ -1,10 +1,6 @@
 # Name of the target
 set(TARGET CommonLib)
 
-# Qt modules
-set(QT_DONT_USE_QTGUI TRUE)
-include(${QT_USE_FILE})
-
 # Needed for exporting/importing symbols
 add_definitions(-DCOMMON_LIBRARY)
 
@@ -49,10 +45,12 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index c4f09970ff13e5ccf47a7a5ae2afb63f5612c5ce..5303bb86e8747ea84b3e55fb21b0bea389b9e976 100644 (file)
@@ -33,7 +33,7 @@ using namespace eVaf::Common;
 iConfig * iConfig::instance()
 {
     static Internal::Config singleton;
-    return singleton.interface();
+    return singleton._interface();
 }
 
 
@@ -55,7 +55,7 @@ Config::~Config()
     done();
 }
 
-iConfig * Config::interface() const
+iConfig * Config::_interface() const
 {
     return evafQueryInterface<iConfig>("iConfig");
 }
index 3c19aafc8fc3f012a475cc575a8fe28aeaae93fb..49f2c8e3c5998a32fe09e74f1f39f489a4da357c 100644 (file)
@@ -65,7 +65,7 @@ public:
     /**
      * Returns the current implementation of the iConfig interface
      */
-    iConfig * interface() const;
+    iConfig * _interface() const;
 
     /**
      * Initializes the iConfig interface implementation.
index 795224c8fbc42022801da892670789897e54b59f..647d892368ecbcdc13302da68086861ab795805b 100644 (file)
@@ -62,26 +62,20 @@ bool EventQueue::event(QEvent * e)
         uint id = event->id();
 
         // Verify that this event is registered
-        QHash<uint, QString>::const_iterator eventsIt = mEvents.constFind(id);
+        Events::const_iterator eventsIt = mEvents.constFind(id);
         if (eventsIt == mEvents.constEnd()) {
             return true; // We don't know it, but it is an eVaf event and we should handle it
         }
 
         // Send the event to all the subscribers
-        QHash<uint, QVector<QWeakPointer<QObject> > >::const_iterator subscribersIt = mSubscribers.constFind(id);
+        Subscribers::const_iterator subscribersIt = mSubscribers.constFind(id);
         if (subscribersIt != mSubscribers.constEnd()) {
-            QVector<QWeakPointer<QObject> > subscribers = *subscribersIt;
-            int sz = subscribers.size();
+            QVector<QObject *> subscribers = *subscribersIt;
+            int const sz = subscribers.size();
             for (int i = 0; i < sz; ++i) {
 
-                // Get the subscriber object and make sure that it is still alive
-                QWeakPointer<QObject> obj = subscribers.at(i);
-                if (obj.isNull()) {
-                    continue;
-                }
-
                 // Notify the subscriber
-                bool rval = QCoreApplication::sendEvent(obj.data(), e);
+                bool const rval = QCoreApplication::sendEvent(subscribers.at(i), e);
 
                 if (rval) {
                     // The event was consumed and should be sent to any other subscribers
@@ -133,7 +127,9 @@ uint EventQueue::subscribeEvent(uint id, QObject * obj)
     if (mSubscribers[id].indexOf(obj) != -1)
         return id;
 
+    // Add to the list of subscribers and connect to the destroyed() signal
     mSubscribers[id].append(obj);
+    connect(obj, SIGNAL(destroyed(QObject *)), this, SLOT(subscriberDestroyed(QObject *)));
 
     return id;
 }
@@ -148,13 +144,16 @@ void EventQueue::unsubscribeEvent(uint id, QObject * obj)
         return;
 
     // Remove from the list of subscribers
-    QVector<QWeakPointer<QObject> >::iterator it = mSubscribers[id].begin();
-    QVector<QWeakPointer<QObject> >::iterator e = mSubscribers[id].end();
+    QVector<QObject *>::iterator it = mSubscribers[id].begin();
+    QVector<QObject *>::const_iterator e = mSubscribers[id].end();
     while (it != e) {
-        if (!it->isNull() && it->data() == obj)
+        if (*it == obj) {
             it = mSubscribers[id].erase(it);
-        else
+            disconnect(*it, SIGNAL(destroyed(QObject *)), this, SLOT(subscriberDestroyed(QObject*)));
+        }
+        else {
             ++it;
+        }
     }
 }
 
@@ -162,3 +161,16 @@ void EventQueue::broadcastEvent(Event * event)
 {
     QCoreApplication::postEvent(this, event);
 }
+
+void EventQueue::subscriberDestroyed(QObject * obj)
+{
+    // Remove the subscriber from all the subscriber lists
+    Subscribers::iterator it = mSubscribers.begin();
+    Subscribers::const_iterator e = mSubscribers.end();
+    for (; it != e; ++it) {
+        int const idx = it->indexOf(obj);
+        if (idx != -1) {
+            it->remove(idx);
+        }
+    }
+}
index b02937692129f83c74fc3151d392e7c70e180718..a4b834be5efef4ee253f50244cb1c983e0d428b4 100644 (file)
@@ -26,7 +26,6 @@
 #include <QString>
 #include <QHash>
 #include <QVector>
-#include <QWeakPointer>
 
 
 namespace eVaf {
@@ -72,10 +71,19 @@ private: // Members
     uint mNextEventId;
 
     /// List of registered events
-    QHash<uint, QString> mEvents;
+    typedef QHash<uint, QString> Events;
+    Events mEvents;
 
     /// List of subscribers
-    QHash<uint, QVector<QWeakPointer<QObject> > > mSubscribers;
+    typedef QHash<uint, QVector<QObject *> > Subscribers;
+    Subscribers mSubscribers;
+
+
+private slots:
+
+    /// One of the subscribers is destroyed
+    /// We need to remove it from the list of subscribers.
+    void subscriberDestroyed(QObject * obj = 0);
 
 };
 
index 86d3b1e61558a034dbab336e8b821aa394699ceb..f6cfec6395b2813131aa91103d071dcd33cde47b 100644 (file)
@@ -34,7 +34,7 @@ using namespace eVaf::Common;
 iProp * iProp::instance()
 {
     static Internal::Prop singleton;
-    return singleton.interface();
+    return singleton._interface();
 }
 
 
@@ -57,7 +57,7 @@ Prop::~Prop()
     done();
 }
 
-iProp * Prop::interface() const
+iProp * Prop::_interface() const
 {
     return evafQueryInterface<iProp>("iProp");
 }
index 4e44e27e29e6c55343610445c97bbc3abd41f7ca..1574f2546cb3744b2ad51a9b419d02007eb7908f 100644 (file)
@@ -51,7 +51,7 @@ public:
     /**
      * Returns the current implementation of the iProp interface
      */
-    iProp * interface() const;
+    iProp * _interface() const;
 
     /**
      * Initializes the iProp interface implementation
index 661d2c7d6717d2ad9bd1f43768a3679fb38b96d3..6c8cc620151009086eb7cb186661bb91a0170824 100644 (file)
@@ -54,13 +54,32 @@ Registry::~Registry()
 
 bool Registry::registerInterface(QString const & name, QObject * obj)
 {
-    mInterfaces.insert(name, QWeakPointer<QObject>(obj));
+    // Add the interface to the list of registered interfaces and connect to
+    // the destroyed() signal.
+    mInterfaces.insert(name, obj);
+    connect(obj, SIGNAL(destroyed()), this, SLOT(interfaceDestroyed(QObject *)));
 
     return true;
 }
 
 QObject * Registry::queryInterface(QString const & name) const
 {
-    QHash<QString, QWeakPointer<QObject> >::const_iterator it = mInterfaces.constFind(name);
-    return it != mInterfaces.constEnd() ? (*it).data() : 0;
+    Interfaces::const_iterator it = mInterfaces.constFind(name);
+    return it != mInterfaces.constEnd() ? *it : 0;
+}
+
+void Registry::interfaceDestroyed(QObject * obj)
+{
+    // Interface object destroyed. Remove it from the list of registered
+    // interfaces.
+    Interfaces::iterator it = mInterfaces.begin();
+    Interfaces::const_iterator e = mInterfaces.end();
+    while (it != e) {
+        if (*it == obj) {
+            it = mInterfaces.erase(it);
+        }
+        else {
+            ++it;
+        }
+    }
 }
index 9c05c5040e9f119fce27700bb84d6939b9def930..e8bf68b13128e1ab6e48b6787ad8093fc398eea6 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <QObject>
 #include <QString>
-#include <QWeakPointer>
 #include <QHash>
 
 namespace eVaf {
@@ -59,7 +58,15 @@ public:
 private:
 
     /// All the registered interfaces
-    QHash<QString, QWeakPointer<QObject> > mInterfaces;
+    typedef QHash<QString, QObject *> Interfaces;
+    Interfaces mInterfaces;
+
+
+private slots:
+
+    /// Interface object destroyed
+    /// We need to remove the interface from the list of registered interfaces
+    void interfaceDestroyed(QObject * obj = 0);
 
 };
 
index 8821dc1cbf40f2af6141de7ebd8e55bf7c16304f..eea9014f4915cd1f299aa4f2dde423d7ee56d5f1 100644 (file)
@@ -1,9 +1,6 @@
 # Name of the target
 set(TARGET GuiLib)
 
-# Qt modules
-include(${QT_USE_FILE})
-
 # Needed for exporting/importing symbols
 add_definitions(-DGUI_LIBRARY)
 
@@ -28,10 +25,12 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS})
 
+qt5_use_modules(${TARGET} Core Widgets)
+
 target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index edcfae664d4f74cec71c1c7afc11c55377d21003..c0c958ea4f1e82340d05573d78f2d9cd02eca5ee 100644 (file)
@@ -1,11 +1,6 @@
 # Name of the target
 set(TARGET PluginsLib)
 
-# Qt modules
-set(QT_DONT_USE_QTGUI TRUE)
-set(QT_USE_QTXML TRUE)
-include(${QT_USE_FILE})
-
 # Needed for exporting/importing symbols
 add_definitions(-DPLUGINS_LIBRARY)
 
@@ -33,10 +28,12 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core Xml)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index dac188f4a6a4addd612fce260fc98dee043f6c1d..5d08dcb10ddff65bf4ed64d207371d139ec542d6 100644 (file)
@@ -291,14 +291,8 @@ bool PluginManagerPrivate::loadPlugins()
         } // End element?
     }
 
-    // Load Qt plugins
-    int i;
-    for (i = 0; i < qtPlugins.size(); ++i) {
-        loadQtPlugin(qtPlugins.at(i));
-    }
-
     // Load eVaf plugins
-    i = 0;
+    int i = 0;
     while (i < mPlugins.size()) {
         if (!mPlugins.at(i)->load()) {
             EVAF_ERROR("Failed to load module '%s'", qPrintable(mPlugins.at(i)->name()));
@@ -348,57 +342,6 @@ Module * PluginManagerPrivate::moduleByName(QString const & name) const
     return 0;
 }
 
-bool PluginManagerPrivate::loadQtPlugin(QString const & name) const
-{
-    // Get the Qt plugin file name with the full path
-    QString fileName;
-
-#ifdef Q_OS_LINUX
-    fileName = QString("%1libq%2.so").arg(Common::iApp::instance()->qtPluginsDir()).arg(name);
-#  ifndef QT_NO_DEBUG
-    QString t = QString("%1libq%2.so.debug").arg(Common::iApp::instance()->qtPluginsDir()).arg(name);
-    if (QFile::exists(t))
-        fileName = t;
-#  endif
-#endif
-
-#ifdef Q_OS_WIN32
-    fileName = QString("%1q%2%3").arg(Common::iApp::instance()->qtPluginsDir()).arg(name).arg("4.dll");
-#  ifndef QT_NO_DEBUG
-    QString t = QString("%1q%2%3").arg(Common::iApp::instance()->qtPluginsDir()).arg(name).arg("d4.dll");
-    if (!QFile::exists(t))
-        fileName = t;
-#  endif
-#endif
-
-#ifdef Q_OS_CYGWIN
-    fileName = QString("%1cygq%2.dll").arg(Common::iApp::instance()->qtPluginsDir()).arg(name);
-#  ifndef QT_NO_DEBUG
-    QString t = QString("%1libq%2.dll.debug").arg(Common::iApp::instance()->qtPluginsDir()).arg(name);
-    if (QFile::exists(t))
-        fileName = t;
-#  endif
-#endif
-
-    if (fileName.isEmpty()) {
-        EVAF_ERROR("Don\'t know how to load Qt plugin '%s'", qPrintable(name));
-        return false;
-    }
-
-    EVAF_INFO("Loading Qt plugin '%s'", qPrintable(fileName));
-
-    QLibrary lib(fileName);
-    void * fn = lib.resolve("qt_plugin_instance");
-    if (fn) {
-        qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunction(fn));
-        return true;
-    }
-    else {
-        EVAF_ERROR("Failed to load Qt plugin '%s' : %s", qPrintable(fileName), qPrintable(lib.errorString()));
-        return false;
-    }
-}
-
 
 //-------------------------------------------------------------------
 
index 22a0de17258cd8e6833f19ad35dcb835c8045566..9033d15b3209ef39211b7f78848dbc3a5b9c7a17 100644 (file)
@@ -91,13 +91,6 @@ private: // Methods
      */
     Module * moduleByName(QString const & name) const;
 
-    /**
-     * Loads the Qt plugin
-     * @param Name of the Qt plugin
-     * @return True; false if failed
-     */
-    bool loadQtPlugin(QString const & name) const;
-
 };
 
 /**
index ed8a20fddd2eb814039174c6af5a613b55a98275..6920cf10e77221ad46774307addde04552d1dc39 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __VERSION_RC_H
 #define __VERSION_RC_H
 
+#include <QtCore/qglobal.h>
+
 /**
  * Product's version number in the format major,minor,release
  */
index a3983a6fb3e45e982329054a1af202f4ac903ca9..d86dcc51c47cb40bd43d93a466529b79f33f8dbf 100644 (file)
@@ -1,10 +1,6 @@
 # Name of the target
 set(TARGET eVafCLI)
 
-# Qt modules
-set(QT_DONT_USE_QTGUI TRUE)
-include(${QT_USE_FILE})
-
 # Include files
 include_directories(${eVaf_INCLUDE})
 
@@ -27,10 +23,12 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc cli.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_executable(${TARGET} ${SRCS} ${MOC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index 0c3cbb65d597548617cb14500c21d561306297f8..691db7a3f63cf6da24cc68b323c0fe13085d95e2 100644 (file)
@@ -49,7 +49,7 @@ namespace Internal {
  *
  * This function outputs messages to the console and to the log file.
  */
-static void messageOutput(QtMsgType type, char const * const msg)
+static void messageOutput(QtMsgType type, QMessageLogContext const &, QString const & msg)
 {
     static bool inHandler = false;
 
@@ -238,7 +238,7 @@ int main(int argc, char ** argv)
 
     // Install our onw message handlers
     Common::iLogger::instance()->installFatalMsgHandler(Internal::fatalMsgHandler);
-    qInstallMsgHandler(Internal::messageOutput);
+    qInstallMessageHandler(Internal::messageOutput);
 
     // Process command-line arguments
     if (!Application::processCommandLine(argc, argv))
index e5169f78393f277d4e60918a31f2ac473b8ed77f..29d32a72ab6f0d62589e9dbea6ff484ba25c1713 100644 (file)
@@ -1,4 +1,4 @@
-if(QT_QTGUI_FOUND)
+if(Qt5Widgets_FOUND)
   add_subdirectory(GUI)
-endif(QT_QTGUI_FOUND)
+endif(Qt5Widgets_FOUND)
 add_subdirectory(CLI)
index 367e2f53a1c61cb24b865900a735220b9126d261..cfb011c9750947b4f8f39b75f33ecfb08aa71697 100644 (file)
@@ -1,10 +1,6 @@
 # Name of the target
 set(TARGET eVafGUI)
 
-# Qt modules
-set(QT_USE_QTMAIN TRUE)
-include(${QT_USE_FILE})
-
 # Include files
 include_directories(${eVaf_INCLUDE})
 
@@ -33,21 +29,23 @@ set(MOC_HDRS
 )
 
 # Resources
-#set(RCCS
-#    gui.qrc
-#)
+set(RCCS
+    gui.qrc
+)
 
 # Version info resource file for Windows builds
 if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc gui.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_add_resources(RCC_SRCS ${RCCS})
+qt5_add_resources(RCC_SRCS ${RCCS})
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_executable(${TARGET} WIN32 ${SRCS} ${MOC_SRCS} ${RCC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core Widgets)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index 3c37b0f46119d554230649e85c9536a936566526..24e6a593663fce82f21787ba6e123b003ff71dc9 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "fatalerr.h"
 
-#include <QtGui>
+#include <QtWidgets>
 
 using namespace eVaf::GUI::Internal;
 
index f0e765f5f574ff10e002f0cbf68a7b6519734b7a..313d21073e7996df216b055bbc57ea5a6072babc 100644 (file)
@@ -82,7 +82,7 @@ static eVaf::Common::iLogger::Severity ConsoleSeverityLevel = eVaf::Common::iLog
  *
  * This function outputs messages to the console and to the log file.
  */
-static void messageOutput(QtMsgType type, char const * const msg)
+static void messageOutput(QtMsgType type, QMessageLogContext const &, QString const & msg)
 {
     static bool inHandler = false;
 
@@ -357,7 +357,7 @@ int main(int argc, char ** argv)
 
     // Install our own message handlers
     Common::iLogger::instance()->installFatalMsgHandler(Internal::fatalMsgHandler);
-    qInstallMsgHandler(Internal::messageOutput);
+    qInstallMessageHandler(Internal::messageOutput);
 
     // Process command-line arguments
     if (!Application::processCommandLine(argc, argv))
index bffa7961512e4641e477405b7fa2c0e922c6f0fa..b4bf96d75ea21f142e0e8bb1312e06b1a796af0f 100644 (file)
@@ -1,5 +1,5 @@
-if(QT_QTGUI_FOUND)
+if(Qt5Widgets_FOUND)
   add_subdirectory(SdiWindow)
   add_subdirectory(LogView)
   add_subdirectory(Test)
-endif(QT_QTGUI_FOUND)
+endif(Qt5Widgets_FOUND)
index ac0d07f98fdf19a7bb111ae4047912b83b25f83e..1d4b839c0483dcdbff12f7f49be62682efa4f509 100644 (file)
@@ -1,9 +1,6 @@
 # Name of the target
 set(TARGET LogView)
 
-# Qt modules
-include(${QT_USE_FILE})
-
 # Needed for exporting/importing symbols
 add_definitions(-DLOGVIEW_LIBRARY)
 
@@ -30,10 +27,12 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core Widgets)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index c4d5d093f90e09f9b84436b0fb49b8834487a9e7..52a7773290c2267509857c08a6aa7e5c10c7c6b5 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "factory.h"
 #include "logview.h"
-#include "version.h"
 
 #include <Common/iLogger>
 
@@ -28,7 +27,6 @@
 using namespace eVaf::LogView;
 
 VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, Factory)
 
 
 //-------------------------------------------------------------------
index 4d36f9147fd8e7df4739f77a6a4b510714bb3e27..bdf396285404c15ba861786d58bbeda38d82b9ca 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __LOGVIEW_FACTORY_H
 #  define __LOGVIEW_FACTORY_H
 
+#include "version.h"
+
 #include <Plugins/iPluginFactory>
 
 namespace eVaf {
@@ -36,6 +38,7 @@ class Factory : public Plugins::iPluginFactory
 {
     Q_OBJECT
     Q_INTERFACES(eVaf::Plugins::iPluginFactory)
+    Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
 
 public:
 
index 1f75c58759a43c873a24bc376e06cd661ffcf764..75e973eec3e993d759fab4c9376c3fbb7247498d 100644 (file)
@@ -26,7 +26,7 @@
 #include <Common/iRegistry>
 #include <SdiWindow/iSdiWindow>
 
-#include <QtGui>
+#include <QtWidgets>
 #include <QXmlStreamReader>
 
 
index cd0a8c01829a59f639edbb3c4c398177bacb4c39..75f9ce79085cf78b8a3b3f467594db1c5cc81dd2 100644 (file)
@@ -1,9 +1,6 @@
 # Name of the target
 set(TARGET SdiWindow)
 
-# Qt modules
-include(${QT_USE_FILE})
-
 # Needed for exporting/importing symbols
 add_definitions(-DSDIWINDOW_LIBRARY)
 
@@ -30,10 +27,12 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core Widgets Xml)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index 5ce4d1a90651bbf75960853d8affe13f1a5bfff0..a8a9a8b9c57f6d6959d1d5cbb2d9227d35f6eb7d 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "factory.h"
 #include "sdiwindow.h"
-#include "version.h"
 
 #include <Common/iLogger>
 
@@ -28,7 +27,6 @@
 using namespace eVaf::SdiWindow;
 
 VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, Factory)
 
 
 //-------------------------------------------------------------------
index 5010928f5f9ed5182a9f90c51dc338befbce2910..78b2f72bf18f54dd1fe6382e72bc4d6c13da4e47 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef __SDIWINDOW_FACTORY_H
 #  define __SDIWINDOW_FACTORY_H
 
+#include "version.h"
 #include <Plugins/iPluginFactory>
 
 namespace eVaf {
@@ -46,6 +47,7 @@ class Factory : public Plugins::iPluginFactory
 {
     Q_OBJECT
     Q_INTERFACES(eVaf::Plugins::iPluginFactory)
+    Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
 
 public:
 
index c0e3587711afa35e00cbab88a421d4c38b634e47..eb1a449ab3f84dc6884972f3da38e0a82481da4f 100644 (file)
@@ -25,7 +25,7 @@
 #include <Common/iApp>
 #include <Common/iProp>
 
-#include <QtGui>
+#include <QtWidgets>
 #include <QXmlStreamReader>
 
 namespace eVaf {
@@ -53,7 +53,6 @@ SdiWindow::iSdiWindow * SdiWindow::iSdiWindow::instance()
 SdiWindow::Internal::MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags flags)
     : QWidget(parent, flags)
     , mReady(false)
-    , mTimerId(0)
 {
     setObjectName(QString("%1-%2").arg(VER_MODULE_NAME_STR).arg(__FUNCTION__));
 
@@ -103,9 +102,6 @@ bool SdiWindow::Internal::MainWindow::init(QString const & args)
 
     setWindowTitle(Common::iApp::instance()->name());
 
-    // Start the garbage collector timer
-    mTimerId = startTimer(60 * 1000);
-
     show();
 
     mReady = true;
@@ -121,21 +117,15 @@ void SdiWindow::Internal::MainWindow::done()
 
     close();
 
-    if (mTimerId) {
-        killTimer(mTimerId);
-        mTimerId = 0;
-    }
-
     // Delete all the panels
     for (int i = mPanels.size() - 1; i >= 0; --i) {
-        QWeakPointer<Gui::Panel> p = mPanels.at(i);
-        if (p)
-            delete p.data();
+        disconnect(mPanels.at(i), SIGNAL(destroyed(QObject *)), this, SLOT(panelDestroyed(QObject *)));
+        delete mPanels.at(i);
     }
     mPanels.clear();
     mMinimizedPanels.clear();
     mPanelNames.clear();
-    mMainPanel.clear();
+    mMainPanel = 0;
     mMainPanelName.clear();
 
     EVAF_INFO("%s finalized", qPrintable(objectName()));
@@ -143,6 +133,7 @@ void SdiWindow::Internal::MainWindow::done()
 
 void SdiWindow::Internal::MainWindow::addPanel(QString const & name, Gui::Panel * panel)
 {
+    connect(panel, SIGNAL(destroyed(QObject *)), this, SLOT(panelDestroyed(QObject*)));
     mPanels.append(panel);
     mPanelNames.insert(name, panel);
 
@@ -165,9 +156,9 @@ void SdiWindow::Internal::MainWindow::addPanel(QString const & name, Gui::Panel
 
 Gui::Panel * SdiWindow::Internal::MainWindow::panel(QString const & name) const
 {
-    QHash<QString, QWeakPointer<Gui::Panel> >::const_iterator it = mPanelNames.constFind(name);
+    QHash<QString, Gui::Panel *>::const_iterator it = mPanelNames.constFind(name);
     if (it != mPanelNames.constEnd())
-        return it.value().data();
+        return it.value();
     return 0;
 }
 
@@ -246,12 +237,10 @@ void SdiWindow::Internal::MainWindow::setWindowSize()
 void SdiWindow::Internal::MainWindow::closeEvent(QCloseEvent * e)
 {
     // Try to close all the managed panels; ignore the event if one of the managed panels refuses to close
-    foreach (QWeakPointer<Gui::Panel> p, mPanels) {
-        if (p) {
-            if (!p.data()->close()) {
-                e->ignore();
-                return;
-            }
+    foreach (Gui::Panel * p, mPanels) {
+        if (!p->close()) {
+            e->ignore();
+            return;
         }
     }
 
@@ -266,9 +255,9 @@ void SdiWindow::Internal::MainWindow::changeEvent(QEvent * e)
         if (windowState() == Qt::WindowNoState && wse->oldState() == Qt::WindowMinimized) {
 
             // Restore all the managed panels that were previously minimized
-            foreach (QWeakPointer<Gui::Panel> p, mMinimizedPanels) {
-                if (p && p.data()->isVisible())
-                    p.data()->showNormal();
+            foreach (Gui::Panel * p, mMinimizedPanels) {
+                if (p->isVisible())
+                    p->showNormal();
             }
             mMinimizedPanels.clear();
         }
@@ -277,13 +266,10 @@ void SdiWindow::Internal::MainWindow::changeEvent(QEvent * e)
 
             // Minimize all the managed panels that are not minimized yet
             mMinimizedPanels.clear();
-            foreach (QWeakPointer<Gui::Panel> p, mPanels) {
-                if (!p)
-                    continue;
-
-                if (p.data()->windowState() != Qt::WindowMinimized && p.data()->isVisible()) {
+            foreach (Gui::Panel * p, mPanels) {
+                if (p->windowState() != Qt::WindowMinimized && p->isVisible()) {
                     mMinimizedPanels.append(p);
-                    p.data()->showMinimized();
+                    p->showMinimized();
                 }
             }
         }
@@ -291,36 +277,37 @@ void SdiWindow::Internal::MainWindow::changeEvent(QEvent * e)
     QWidget::changeEvent(e);
 }
 
-void SdiWindow::Internal::MainWindow::timerEvent(QTimerEvent * e)
+void SdiWindow::Internal::MainWindow::panelDestroyed(QObject * obj)
 {
-    if (e->timerId() == mTimerId) {
-
-        // Remove panels that are deleted
-        {
-            QList<QWeakPointer<Gui::Panel> >::iterator it = mPanels.begin();
-            while (it != mPanels.end()) {
-                QWeakPointer<Gui::Panel> p = *it;
-                if (!p)
-                    it = mPanels.erase(it);
-                else
-                    ++it;
+    // Remove panels that are deleted
+    {
+        QList<Gui::Panel *>::iterator it = mPanels.begin();
+        while (it != mPanels.end()) {
+            if (*it == obj) {
+                it = mPanels.erase(it);
+            }
+            else {
+                ++it;
             }
         }
+    }
 
-        // Do the same with panel names
-        {
-            QHash<QString, QWeakPointer<Gui::Panel> >::iterator it = mPanelNames.begin();
-            while (it != mPanelNames.end()) {
-                QWeakPointer<Gui::Panel> p = it.value();
-                if (!p)
-                    it = mPanelNames.erase(it);
-                else
-                    ++it;
+    // Do the same with panel names
+    {
+        QHash<QString, Gui::Panel *>::iterator it = mPanelNames.begin();
+        while (it != mPanelNames.end()) {
+            if (it.value() == obj) {
+                it = mPanelNames.erase(it);
+            }
+            else {
+                ++it;
             }
         }
     }
-    else
-        QWidget::timerEvent(e);
+
+    if (mMainPanel == obj) {
+        mMainPanel = 0;
+    }
 }
 
 
index 757ed28cfeaa51f452954cc7ee0c62992aa3a71d..4c46eea83617e083813905eae322f5e80cbcbe63 100644 (file)
@@ -31,7 +31,6 @@
 #include <QList>
 #include <QVector>
 #include <QHash>
-#include <QWeakPointer>
 
 class QVBoxLayout;
 
@@ -72,9 +71,6 @@ public:
 
 protected: // Methods
 
-    /// Garbage collector timer
-    virtual void timerEvent(QTimerEvent * e);
-
 
 private: // Methods
 
@@ -97,19 +93,16 @@ private: // Members
     QString mMainPanelName;
 
     /// List of GUI::Panel objects added to the manager
-    QList<QWeakPointer<Gui::Panel> > mPanels;
+    QList<Gui::Panel *> mPanels;
 
     /// List of minimized GUI::Panel objects
-    QVector<QWeakPointer<Gui::Panel> > mMinimizedPanels;
+    QVector<Gui::Panel *> mMinimizedPanels;
 
     /// Hash with panel names
-    QHash<QString, QWeakPointer<Gui::Panel> > mPanelNames;
+    QHash<QString, Gui::Panel *> mPanelNames;
 
     /// Current main panel added to this window
-    QWeakPointer<Gui::Panel> mMainPanel;
-
-    /// Garbage collector timer ID
-    int mTimerId;
+    Gui::Panel * mMainPanel;
 
 
 private: // Methods
@@ -117,6 +110,13 @@ private: // Methods
     /// Gets the main panel name from module attributes
     QString getMainPanelName(QString const & args) const;
 
+
+private slots:
+
+    /// Panel destroyed signal. We need to remove the panel from all the
+    /// lists.
+    void panelDestroyed(QObject * obj = 0);
+
 };
 
 /**
index bbf03ba17fb1bc698fe00e6d82d2f2a10a92e750..f4aa339b5969f2a410a33ad71334265d20100039 100644 (file)
@@ -1,9 +1,6 @@
 # Name of the target
 set(TARGET Test)
 
-# Qt modules
-include(${QT_USE_FILE})
-
 # Include files
 include_directories(${eVaf_INCLUDE})
 
@@ -27,10 +24,12 @@ if(WIN32 AND NOT MINGW)
     set(SRCS ${SRCS} version.rc)
 endif(WIN32 AND NOT MINGW)
 
-qt4_wrap_cpp(MOC_SRCS ${MOC_HDRS})
+qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS})
 
 add_library(${TARGET} SHARED ${SRCS} ${MOC_SRCS})
 
-target_link_libraries(${TARGET} ${QT_LIBRARIES} ${eVaf_LIBRARIES})
+qt5_use_modules(${TARGET} Core Widgets)
+
+target_link_libraries(${TARGET} ${eVaf_LIBRARIES})
 
 install(TARGETS ${TARGET} DESTINATION bin)
index feb433ff6432f9d6ff9b55d0a3acc762c5d421fb..e3cba8be677313e42eb31525f0905937dd411663 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "factory.h"
 #include "test.h"
-#include "version.h"
 
 #include <Common/iLogger>
 
@@ -28,7 +27,6 @@
 using namespace eVaf::Test;
 
 VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, Factory)
 
 
 //-------------------------------------------------------------------
index 089d86962c2db23cbdd27f2aec05f486372c003c..fbb40c93486043cdd3c34c3d523baca69006eceb 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __TEST_FACTORY_H
 #define __TEST_FACTORY_H
 
+#include "version.h"
+
 #include <Plugins/iPluginFactory>
 
 namespace eVaf {
@@ -44,6 +46,7 @@ class Factory : public Plugins::iPluginFactory
 {
     Q_OBJECT
     Q_INTERFACES(eVaf::Plugins::iPluginFactory)
+    Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
 
 public: