/** * @file Common/globals.cpp * @brief Global constants and macros for eVaf * @author Enar Vaikene * * Copyright (c) 2011-2019 Enar Vaikene * * This file is part of the eVaf C++ cross-platform application development framework. * * This file can be used under the terms of the GNU General Public License * version 3.0 as published by the Free Software Foundation and appearing in * the file LICENSE included in the packaging of this file. Please review the * the following information to ensure the GNU General Public License version * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. * * Alternatively, this file may be used in accordance with the Commercial License * Agreement provided with the Software. */ #include "globals.h" #include "app.h" #include "config.h" #include "prop.h" #include "logger.h" #include "version.h" #include "ilogger.h" #include "iregistry.h" #include //------------------------------------------------------------------- bool eVaf::Common::init() { if (QCoreApplication::instance() == nullptr) { EVAF_FATAL_ERROR("QApplication is not instantiated"); return false; } EVAF_INFO("Initializing %s-Globals", VER_MODULE_NAME_STR); // Initialize all the common interface implementations in the proper sequence 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()); if (logger) { if (!logger->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); }