Currently missing Qt plugin loading using eVaf XML files.
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)
-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)
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)
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)
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)
#include "engine.h"
-#include "version.h"
#include <Common/iLogger>
#include <Common/iRegistry>
#include <QtCore>
VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::FileFinder::Engine::Module)
using namespace eVaf;
using namespace eVaf::FileFinder;
# define __FILEFINDER_ENGINE_ENGINE_H
#include "ifilefinder.h"
+#include "version.h"
#include <Plugins/iPlugin>
{
Q_OBJECT
Q_INTERFACES(eVaf::Plugins::iPlugin)
+ Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
public:
set(TARGET FileFinderGui)
# Qt modules
-include(${QT_USE_FILE})
+#include(${QT_USE_FILE})
# Include files
include_directories(${eVaf_INCLUDE})
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)
*/
#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;
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())
#ifndef __FILEFINDER_GUI_GUI_H
# define __FILEFINDER_GUI_GUI_H
+#include "version.h"
+
#include <Plugins/iPlugin>
#include <Gui/Panel>
{
Q_OBJECT
Q_INTERFACES(eVaf::Plugins::iPlugin)
+ Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
public:
# 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})
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)
*/
#include "cli.h"
-#include "version.h"
#include <Generator/iGenerator>
#include <Storage/iStorage>
#endif
VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::PswGen::CLI::Module)
//-------------------------------------------------------------------
#ifndef __PSWGEN_CLI_CLI_H
# define __PSWGEN_CLI_CLI_H
+#include "version.h"
+
#include <Plugins/iPlugin>
#include <QObject>
{
Q_OBJECT
Q_INTERFACES(eVaf::Plugins::iPlugin)
+ Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
public:
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)
# Name of the target
set(TARGET PswGui)
-# Qt modules
-include(${QT_USE_FILE})
-
# Include files
include_directories(${eVaf_INCLUDE})
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)
*/
#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)
//-------------------------------------------------------------------
#ifndef __PSWGEN_GUI_GUI_H
#define __PSWGEN_GUI_GUI_H
+#include "version.h"
+
#include <Plugins/iPlugin>
#include <QObject>
{
Q_OBJECT
Q_INTERFACES(eVaf::Plugins::iPlugin)
+ Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
public:
# 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)
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)
*/
#include "module.h"
-#include "version.h"
#include <Common/iLogger>
#include <Common/iRegistry>
#include <QtCore>
VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::PswGen::Generator::Module)
using namespace eVaf;
using namespace eVaf::PswGen;
# define __PSWGEN_GENERATOR_MODULE_H
#include "igenerator.h"
+#include "version.h"
#include <Plugins/iPlugin>
{
Q_OBJECT
Q_INTERFACES(eVaf::Plugins::iPlugin)
+ Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
public:
# 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)
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)
*/
#include "module.h"
-#include "version.h"
#include <Common/Globals>
#include <Common/iLogger>
#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;
}
// Store also into the local hash
+ beginResetModel();
mData.insert(name, data);
+ endResetModel();
- // Reset the model
- reset();
}
data->reset();
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;
}
# define __PSWGEN_STORAGE_MODULE_H
#include "istorage.h"
+#include "version.h"
#include <Plugins/iPlugin>
{
Q_OBJECT
Q_INTERFACES(eVaf::Plugins::iPlugin)
+ Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
public:
# Name of the target
set(TARGET ScosTime)
-# Qt modules
-include(${QT_USE_FILE})
-
# Include files
include_directories(${eVaf_INCLUDE})
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)
*/
#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)
//-------------------------------------------------------------------
#ifndef __SCOSTIME_GUI_H
# define __SCOSTIME_GUI_H
+#include "version.h"
+
#include <Plugins/iPlugin>
#include <QObject>
{
Q_OBJECT
Q_INTERFACES(eVaf::Plugins::iPlugin)
+ Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
public:
add_subdirectory(Plugins)
add_subdirectory(Common)
-if(QT_QTGUI_FOUND)
+if(Qt5Widgets_FOUND)
add_subdirectory(Gui)
-endif(QT_QTGUI_FOUND)
+endif(Qt5Widgets_FOUND)
# 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)
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)
iConfig * iConfig::instance()
{
static Internal::Config singleton;
- return singleton.interface();
+ return singleton._interface();
}
done();
}
-iConfig * Config::interface() const
+iConfig * Config::_interface() const
{
return evafQueryInterface<iConfig>("iConfig");
}
/**
* Returns the current implementation of the iConfig interface
*/
- iConfig * interface() const;
+ iConfig * _interface() const;
/**
* Initializes the iConfig interface implementation.
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
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;
}
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;
+ }
}
}
{
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);
+ }
+ }
+}
#include <QString>
#include <QHash>
#include <QVector>
-#include <QWeakPointer>
namespace eVaf {
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);
};
iProp * iProp::instance()
{
static Internal::Prop singleton;
- return singleton.interface();
+ return singleton._interface();
}
done();
}
-iProp * Prop::interface() const
+iProp * Prop::_interface() const
{
return evafQueryInterface<iProp>("iProp");
}
/**
* Returns the current implementation of the iProp interface
*/
- iProp * interface() const;
+ iProp * _interface() const;
/**
* Initializes the iProp interface implementation
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;
+ }
+ }
}
#include <QObject>
#include <QString>
-#include <QWeakPointer>
#include <QHash>
namespace eVaf {
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);
};
# Name of the target
set(TARGET GuiLib)
-# Qt modules
-include(${QT_USE_FILE})
-
# Needed for exporting/importing symbols
add_definitions(-DGUI_LIBRARY)
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)
# 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)
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)
} // 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()));
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;
- }
-}
-
//-------------------------------------------------------------------
*/
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;
-
};
/**
#ifndef __VERSION_RC_H
#define __VERSION_RC_H
+#include <QtCore/qglobal.h>
+
/**
* Product's version number in the format major,minor,release
*/
# 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})
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)
*
* 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;
// 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))
-if(QT_QTGUI_FOUND)
+if(Qt5Widgets_FOUND)
add_subdirectory(GUI)
-endif(QT_QTGUI_FOUND)
+endif(Qt5Widgets_FOUND)
add_subdirectory(CLI)
# Name of the target
set(TARGET eVafGUI)
-# Qt modules
-set(QT_USE_QTMAIN TRUE)
-include(${QT_USE_FILE})
-
# Include files
include_directories(${eVaf_INCLUDE})
)
# 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)
#include "fatalerr.h"
-#include <QtGui>
+#include <QtWidgets>
using namespace eVaf::GUI::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;
// 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))
-if(QT_QTGUI_FOUND)
+if(Qt5Widgets_FOUND)
add_subdirectory(SdiWindow)
add_subdirectory(LogView)
add_subdirectory(Test)
-endif(QT_QTGUI_FOUND)
+endif(Qt5Widgets_FOUND)
# Name of the target
set(TARGET LogView)
-# Qt modules
-include(${QT_USE_FILE})
-
# Needed for exporting/importing symbols
add_definitions(-DLOGVIEW_LIBRARY)
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)
#include "factory.h"
#include "logview.h"
-#include "version.h"
#include <Common/iLogger>
using namespace eVaf::LogView;
VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, Factory)
//-------------------------------------------------------------------
#ifndef __LOGVIEW_FACTORY_H
# define __LOGVIEW_FACTORY_H
+#include "version.h"
+
#include <Plugins/iPluginFactory>
namespace eVaf {
{
Q_OBJECT
Q_INTERFACES(eVaf::Plugins::iPluginFactory)
+ Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
public:
#include <Common/iRegistry>
#include <SdiWindow/iSdiWindow>
-#include <QtGui>
+#include <QtWidgets>
#include <QXmlStreamReader>
# Name of the target
set(TARGET SdiWindow)
-# Qt modules
-include(${QT_USE_FILE})
-
# Needed for exporting/importing symbols
add_definitions(-DSDIWINDOW_LIBRARY)
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)
#include "factory.h"
#include "sdiwindow.h"
-#include "version.h"
#include <Common/iLogger>
using namespace eVaf::SdiWindow;
VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, Factory)
//-------------------------------------------------------------------
#ifndef __SDIWINDOW_FACTORY_H
# define __SDIWINDOW_FACTORY_H
+#include "version.h"
#include <Plugins/iPluginFactory>
namespace eVaf {
{
Q_OBJECT
Q_INTERFACES(eVaf::Plugins::iPluginFactory)
+ Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
public:
#include <Common/iApp>
#include <Common/iProp>
-#include <QtGui>
+#include <QtWidgets>
#include <QXmlStreamReader>
namespace eVaf {
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__));
setWindowTitle(Common::iApp::instance()->name());
- // Start the garbage collector timer
- mTimerId = startTimer(60 * 1000);
-
show();
mReady = true;
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()));
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);
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;
}
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;
}
}
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();
}
// 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();
}
}
}
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;
+ }
}
#include <QList>
#include <QVector>
#include <QHash>
-#include <QWeakPointer>
class QVBoxLayout;
protected: // Methods
- /// Garbage collector timer
- virtual void timerEvent(QTimerEvent * e);
-
private: // Methods
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
/// 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);
+
};
/**
# Name of the target
set(TARGET Test)
-# Qt modules
-include(${QT_USE_FILE})
-
# Include files
include_directories(${eVaf_INCLUDE})
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)
#include "factory.h"
#include "test.h"
-#include "version.h"
#include <Common/iLogger>
using namespace eVaf::Test;
VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, Factory)
//-------------------------------------------------------------------
#ifndef __TEST_FACTORY_H
#define __TEST_FACTORY_H
+#include "version.h"
+
#include <Plugins/iPluginFactory>
namespace eVaf {
{
Q_OBJECT
Q_INTERFACES(eVaf::Plugins::iPluginFactory)
+ Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
public: