X-Git-Url: https://vaikene.ee/gitweb/pswgen11.html?a=blobdiff_plain;f=src%2Flibs%2FCommon%2Fapp.cpp;h=60ee5bf698d00b809e6050bd2b6f17c9b4f8d76c;hb=bb631d7ca67c86dd758428fb0e18b905514a16e3;hp=21818f9ebe7d1e67e1e6eff9c911ac17bd22efdf;hpb=60aebc188674bbfb67be51958ec33171c72986b9;p=evaf
diff --git a/src/libs/Common/app.cpp b/src/libs/Common/app.cpp
index 21818f9..60ee5bf 100644
--- a/src/libs/Common/app.cpp
+++ b/src/libs/Common/app.cpp
@@ -274,6 +274,14 @@ QString const App::xmlFileName() const
return mXmlFile;
}
+int App::exec()
+{
+ setReady(true);
+ int rval = QCoreApplication::exec();
+ setReady(false);
+ return rval;
+}
+
void App::restart()
{
QCoreApplication::exit(RC_Restart);
@@ -283,3 +291,15 @@ void App::quit(bool err)
{
QCoreApplication::exit(err ? RC_Error : RC_Quit);
}
+
+void App::setReady(bool value)
+{
+ if (mReady != value) {
+ mReady = value;
+ iEventQueue::instance()->broadcastEvent(new Event(mReady ? mEvReady : mEvTerminating));
+ if (mReady)
+ emit ready();
+ else
+ emit terminating();
+ }
+}