X-Git-Url: https://vaikene.ee/gitweb/pswgen11.html?a=blobdiff_plain;ds=inline;f=src%2Flibs%2FCommon%2Fglobals.cpp;h=6814648532b70058db4362d241713e14a629c8a7;hb=de270ece1b764b19968e14420f538321f1c06b15;hp=e494908e5f64a48ac86c9b030b08adb5c39c4b78;hpb=814d12e0a340ae11fa4a22077b37316aa41716d7;p=evaf
diff --git a/src/libs/Common/globals.cpp b/src/libs/Common/globals.cpp
index e494908..6814648 100644
--- a/src/libs/Common/globals.cpp
+++ b/src/libs/Common/globals.cpp
@@ -3,7 +3,7 @@
* @brief Global constants and macros for eVaf
* @author Enar Vaikene
*
- * Copyright (c) 2011 Enar Vaikene
+ * Copyright (c) 2011-2019 Enar Vaikene
*
* This file is part of the eVaf C++ cross-platform application development framework.
*
@@ -18,11 +18,13 @@
*/
#include "globals.h"
-#include "env.h"
#include "app.h"
+#include "config.h"
+#include "prop.h"
#include "logger.h"
#include "version.h"
#include "ilogger.h"
+#include "iregistry.h"
#include
@@ -31,7 +33,7 @@
bool eVaf::Common::init()
{
- if (QCoreApplication::instance() == 0) {
+ if (QCoreApplication::instance() == nullptr) {
EVAF_FATAL_ERROR("QApplication is not instantiated");
return false;
}
@@ -40,26 +42,44 @@ bool eVaf::Common::init()
// Initialize all the common interface implementations in the proper sequence
- eVaf::Common::Internal::Env * env =
- qobject_cast(eVaf::Common::iEnv::instance());
- if (env) {
- if (!env->init())
+ eVaf::Common::Internal::App * app =
+ qobject_cast(eVaf::Common::iApp::instance());
+ if (app) {
+ if (!app->init())
+ return false;
+ }
+ eVaf::Common::Internal::Config * config =
+ qobject_cast(eVaf::Common::iConfig::instance());
+ if (config) {
+ if (!config->init())
+ return false;
+ }
+ eVaf::Common::Internal::Prop * prop =
+ qobject_cast(eVaf::Common::iProp::instance());
+ if (prop) {
+ if (!prop->init())
return false;
}
eVaf::Common::Internal::Logger * logger =
- qobject_cast(eVaf::Common::iLogger::instance());
+ qobject_cast(eVaf::Common::iLogger::instance());
if (logger) {
if (!logger->init())
return false;
}
- eVaf::Common::Internal::App * app =
- qobject_cast(eVaf::Common::iApp::instance());
- if (app) {
- if (!app->init())
- return false;
- }
EVAF_INFO("%s-Globals initialized", VER_MODULE_NAME_STR);
return true;
}
+
+void eVaf::Common::done()
+{
+ EVAF_INFO("Finalizing %s-Globals", VER_MODULE_NAME_STR);
+
+ //eVaf::Common::Internal::Logger::destroyInstance();
+ eVaf::Common::Internal::Prop::destroyInstance();
+ eVaf::Common::Internal::Config::destroyInstance();
+ eVaf::Common::Internal::App::destroyInstance();
+
+ EVAF_INFO("%s-Globals finalized", VER_MODULE_NAME_STR);
+}