]> vaikene.ee Git - evaf/blob - src/libs/Common/globals.cpp
63d4bce2bd6c3a988c333459d3e42220fb56957d
[evaf] / src / libs / Common / globals.cpp
1 /**
2 * @file Common/globals.cpp
3 * @brief Global constants and macros for eVaf
4 * @author Enar Vaikene
5 *
6 * Copyright (c) 2011 Enar Vaikene
7 *
8 * This file is part of the eVaf C++ cross-platform application development framework.
9 *
10 * This file can be used under the terms of the GNU General Public License
11 * version 3.0 as published by the Free Software Foundation and appearing in
12 * the file LICENSE included in the packaging of this file. Please review the
13 * the following information to ensure the GNU General Public License version
14 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
15 *
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
18 */
19
20 #include "globals.h"
21 #include "app.h"
22 #include "logger.h"
23 #include "version.h"
24 #include "ilogger.h"
25
26 #include <QCoreApplication>
27
28
29 //-------------------------------------------------------------------
30
31 bool eVaf::Common::init()
32 {
33 if (QCoreApplication::instance() == 0) {
34 EVAF_FATAL_ERROR("QApplication is not instantiated");
35 return false;
36 }
37
38 EVAF_INFO("Initializing %s-Globals", VER_MODULE_NAME_STR);
39
40 // Initialize all the common interface implementations in the proper sequence
41
42 eVaf::Common::Internal::App * app =
43 qobject_cast<eVaf::Common::Internal::App *>(eVaf::Common::iApp::instance());
44 if (app) {
45 if (!app->init())
46 return false;
47 }
48 eVaf::Common::Internal::Logger * logger =
49 qobject_cast<eVaf::Common::Internal::Logger *>(eVaf::Common::iLogger::instance());
50 if (logger) {
51 if (!logger->init())
52 return false;
53 }
54
55 EVAF_INFO("%s-Globals initialized", VER_MODULE_NAME_STR);
56
57 return true;
58 }