]> vaikene.ee Git - evaf/blob - src/libs/Common/app.h
* The iEventQueue interface is now properly registered.
[evaf] / src / libs / Common / app.h
1 /**
2 * @file Common/app.h
3 * @brief Application interface implementation
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 #ifndef __COMMON_APP_H
21 #define __COMMON_APP_H
22
23 #include "iapp.h"
24
25 #include <QObject>
26 #include <QString>
27
28 class QEvent;
29
30 namespace eVaf {
31 namespace Common {
32 namespace Internal {
33
34 /**
35 * iApp application interface implementation
36 */
37 class App : public iApp
38 {
39 Q_OBJECT
40
41 public:
42
43 App();
44
45 virtual ~App();
46
47 /**
48 * Initializes the interface implementation
49 * @return True if ok; false if initialization failed
50 */
51 bool init();
52
53 virtual bool event(QEvent *);
54
55 /*
56 iApp interface
57 */
58 virtual QString const name() const { return mName; }
59
60 virtual QString const language() const { return mLanguage; }
61
62 virtual QString const xmlFileName() const;
63
64 virtual void restart();
65
66 virtual void quit(bool err = false);
67
68 virtual bool isReady() const { return mReady; }
69
70 virtual QString const rootDir() const { return mRootDir; }
71
72 virtual QString const dataRootDir() const;
73
74 virtual QString const binDir() const { return mBinDir; }
75
76 virtual QString const etcDir() const;
77
78 virtual QString const logDir() const;
79
80 virtual QString const docDir() const;
81
82 virtual QString const qtPluginsDir() const;
83
84
85 private:
86
87 /// Flag indicating that the eVaf application is ready
88 bool mReady;
89
90 /// Name of the application
91 QString mName;
92
93 /// Language for the application
94 QString mLanguage;
95
96 /// Name of the application's XML file
97 mutable QString mXmlFile;
98
99 /// Name of the root directry
100 QString mRootDir;
101
102 /// Name of the data root directory
103 mutable QString mDataRootDir;
104
105 /// Name of the binary directory
106 QString mBinDir;
107
108 /// Name of the Qt plugins directory
109 mutable QString mQtPluginsDir;
110
111 /// Name of the configuration files directory
112 mutable QString mEtcDir;
113
114 /// Name of the log files directory
115 mutable QString mLogDir;
116
117 /// Name of the documentation directory
118 mutable QString mDocDir;
119
120 /// Event numbers
121 uint mEvQuit;
122 uint mEvRestart;
123 uint mEvReady;
124 uint mEvTerminating;
125
126 };
127
128 } // namespace eVaf::Common::Internal
129 } // namespace eVaf::Common
130 } // namespace eVaf
131
132 #endif // app.h