]> vaikene.ee Git - evaf/blob - src/libs/Common/iapp.h
Added more files to the project.
[evaf] / src / libs / Common / iapp.h
1 /**
2 * @file Common/iapp.h
3 * @brief eVaf application interface
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_IAPP_H
21 #define __COMMON_IAPP_H
22
23 #include "libcommon.h"
24
25 #include <QObject>
26 #include <QString>
27
28 namespace eVaf {
29 namespace Common {
30
31 /**
32 * eVaf application interface
33 * @code#include <Common/iApp>@endcode
34 *
35 * The iApp interface provides information about current eVaf application.
36 *
37 * All the resources returned by this interface have default values, that should work in most of the cases.
38 *
39 * Default values can be overwritten with environment variables and command line arguments. If both are used,
40 * then command line arguments have higher priorities.
41 */
42 class COMMON_EXPORT iApp : public QObject
43 {
44 Q_OBJECT
45
46 public:
47
48 /// Interface constructor
49 iApp() : QObject() {}
50
51 /// Empty virtual destructor
52 virtual ~iApp() {}
53
54 /**
55 * Returns the iApp interface instance
56 * @return The iApp interface
57 *
58 * This function returns the global iApp interface instance. As all the eVaf modules and applications
59 * are expected to be linked against the common library, then this is the preferred method of obtaining
60 * the iApp interface. The other method is by using the iRegistry interface.
61 */
62 static iApp * instance();
63
64 /**
65 * Returns the name of the eVaf application
66 *
67 * This function returns the name of the eVaf application, which is a string that identifies the application.
68 * The default name of the application is "eVaf".
69 *
70 * This name of the application can be changed with the EVAF_APP_NAME environment variable or with the
71 * -app[lication]=&lt;name&gt; command line argument.
72 */
73 virtual QString const name() const = 0;
74
75 /**
76 * Returns the current language and country used by the application.
77 *
78 * This function returns the current lowercase two-letter ISO 639 language code and uppercase
79 * two-letter ISO 3166 country code if set.
80 *
81 * The default language is queried from the operating system.
82 *
83 * The language can be changed with the EVAF_LANGUAGE environment variabel or with the
84 * -lang[uage]=&lt;language&gt; command line argument.
85 */
86 virtual QString const language() const = 0;
87
88 /**
89 * Returns the name of the application's XML file.
90 *
91 * This function returns the name of the application's XML file.
92 * It tries to find the most specific file name for the given language. If not found, then
93 * defaults to the generic name.
94 *
95 * For example, if the language is set to "et_EE" and the application's name is "eVaf", then
96 * it tries to find XML files with the following names "eVaf_et_EE.xml" and "eVaf_et.xml". If
97 * neither is found, defaults to the name "eVaf.xml".
98 *
99 * The path is not included in the returned file name. Use the eVaf::Common::iEnv::etcDir() function
100 * for the location of the file.
101 */
102 virtual QString const xmlFileName() const = 0;
103
104
105 signals:
106
107 /**
108 * Ready signal.
109 *
110 * This signal is emitted when the eVaf application is ready, ie the application initialized and all the
111 * modules loaded.
112 */
113 void ready();
114
115 /**
116 * Terminating signal.
117 *
118 * This signal is emitted when the eVaf application is about to terminate.
119 */
120 void terminating();
121
122 };
123
124 } // namespace eVaf::Common
125 } // namespace eVaf
126
127 #endif