summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1473490)
* The iApp interface implementation now registers events and listens for EV_QUIT and EV_RESTART events.
Broadcasting EV_READY and EV_TERMINATING events still needs to be implemented. This is also valid for
iApp::ready() and iApp::terminating() signals.
#include "app.h"
#include "globals.h"
#include "app.h"
#include "globals.h"
+#include "iregistry.h"
+#include "ieventqueue.h"
+#include "event.h"
#include "version.h"
#include <QtCore>
#include "version.h"
#include <QtCore>
: iApp()
, mReady(false)
, mName(VER_PRODUCT_NAME_STR)
: iApp()
, mReady(false)
, mName(VER_PRODUCT_NAME_STR)
+ , mEvQuit(0)
+ , mEvRestart(0)
+ , mEvReady(0)
+ , mEvTerminating(0)
{
setObjectName(QString("%1.iApp").arg(VER_MODULE_NAME_STR));
{
setObjectName(QString("%1.iApp").arg(VER_MODULE_NAME_STR));
// Register our interface
iRegistry::instance()->registerInterface("iApp", this);
// Register our interface
iRegistry::instance()->registerInterface("iApp", this);
+ // Register events
+ mEvQuit = iEventQueue::instance()->subscribeEvent(iEventQueue::instance()->registerEvent(EV_QUIT), this);
+ mEvRestart = iEventQueue::instance()->subscribeEvent(iEventQueue::instance()->registerEvent(EV_RESTART), this);
+ mEvReady = iEventQueue::instance()->registerEvent(EV_READY);
+ mEvTerminating = iEventQueue::instance()->registerEvent(EV_TERMINATING);
+
// Set the default application name and language
mName = VER_PRODUCT_NAME_STR;
mLanguage = QLocale::system().name();
// Set the default application name and language
mName = VER_PRODUCT_NAME_STR;
mLanguage = QLocale::system().name();
+bool App::event(QEvent * e)
+{
+ if (e->type() == Event::eVafEvent) {
+ Event * event = static_cast<Event *>(e);
+ if (event->id() == mEvQuit)
+ quit();
+ else if (event->id() == mEvRestart)
+ restart();
+
+ return false;
+ }
+ else
+ return iApp::event(e);
+}
+
QString const App::dataRootDir() const
{
if (mDataRootDir.isEmpty()) {
QString const App::dataRootDir() const
{
if (mDataRootDir.isEmpty()) {
#include <QObject>
#include <QString>
#include <QObject>
#include <QString>
namespace eVaf {
namespace Common {
namespace Internal {
namespace eVaf {
namespace Common {
namespace Internal {
+ virtual bool event(QEvent *);
+
/// Name of the documentation directory
mutable QString mDocDir;
/// Name of the documentation directory
mutable QString mDocDir;
+ /// Event numbers
+ uint mEvQuit;
+ uint mEvRestart;
+ uint mEvReady;
+ uint mEvTerminating;
+
};
} // namespace eVaf::Common::Internal
};
} // namespace eVaf::Common::Internal
: iEventQueue()
, mNextEventId(1)
{
: iEventQueue()
, mNextEventId(1)
{
+ iRegistry::instance()->registerInterface("iEventQueue", this);
}
EventQueue::~EventQueue()
}
EventQueue::~EventQueue()
/**
* Module/library version number in the form major,minor,release,build
*/
/**
* Module/library version number in the form major,minor,release,build
*/
-#define VER_FILE_VERSION 0,1,2,5
+#define VER_FILE_VERSION 0,1,3,6
/**
* Module/library version number in the string format (shall end with \0)
*/
/**
* Module/library version number in the string format (shall end with \0)
*/
-#define VER_FILE_VERSION_STR "0.1.2.5\0"
+#define VER_FILE_VERSION_STR "0.1.3.6\0"
/**
* Module/library name (shall end with \0)
/**
* Module/library name (shall end with \0)