#include "app.h"
#include "globals.h"
-#include "registry.h"
+#include "iregistry.h"
+#include "ieventqueue.h"
+#include "event.h"
#include "version.h"
#include <QtCore>
: 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));
// 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();
return true;
}
+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()) {
#include <QObject>
#include <QString>
+class QEvent;
+
namespace eVaf {
namespace Common {
namespace Internal {
*/
bool init();
+ virtual bool event(QEvent *);
+
/*
iApp interface
*/
/// Name of the documentation directory
mutable QString mDocDir;
+ /// Event numbers
+ uint mEvQuit;
+ uint mEvRestart;
+ uint mEvReady;
+ uint mEvTerminating;
+
};
} // namespace eVaf::Common::Internal
/**
* 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)
*/
-#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)