1 #ifndef CONFIGURATION_H_
2 #define CONFIGURATION_H_
9 class ConnectionSettings;
10 class StartupSettings;
11 class DisplaySettings;
14 class DateTimeSettings;
16 //! Domain class. Store application wide configuration values.
18 * Domain class. Store application wide configuration values. The values are read from a configuration
19 * file at initialization time. Since there is one appliation per device normally running, therefore
20 * there is only one instance of this class, which is accessible by using a statis getter method.
22 class Configuration : public QObject
29 * Constructor to initialize an Configuration instance. The method populates the object by reading
30 * through the application's configuration file.
36 virtual ~Configuration();
38 //! Static. Gets the application wide configuration instance.
40 * Static Gets the static instance of this class. It is used to read the configuration information.
41 * \return Pointer to the Configuration instalce.
43 static Configuration* instance();
44 //! Gets the connection settings.
46 * Gets the connection settings.
47 * \return Pointer to ConnectionSettings instance.
49 ConnectionSettings* connectionSettings();
50 //! Gets the detault room.
52 * Gets the default meeting room.
53 * \return Pointer to the default room.
56 //! Gets the language code.
58 * Gets the language code.
59 * \return Language code in ISO 3166-1 alpha-2 format.
61 QString languageCode();
62 //! Gets the list of meeting rooms.
64 * Gets the list of meeting rooms.
65 * \return List of rooms.
68 //! Gets startup settings.
70 * Gets the startup settings.
71 * \return Pointer to StartupSettings instance.
73 StartupSettings* startupSettings();
74 //! Gets display settings.
76 * Gets the display settings.
77 * \return Pointer to DisplaySettings instance.
79 DisplaySettings* displaySettings();
80 //! Gets date/time settings.
82 * Gets the date/time settings.
83 * \return Pointer to DateTimeSettings instance.
85 DateTimeSettings* dateTimeSettings();
86 //! Gets the administrator's password.
88 * Gets the administrator's password
89 * \return Administration password.
91 QByteArray adminPassword();
95 * \param aRooms List of rooms
97 void setRooms(const QList<Room*> aRooms);
101 //! Saves setting values to file.
103 * Writes setting values to configuration file.
108 //! Static. Reads the configuration instance from XML file.
110 * Static. Reads the configuration information from configuration file.
111 * \param aPath path and name of configuration file
112 * \return Configuration object.
114 static Configuration* readFromXML(const QString &aPath);
115 //! Static. Reads settings of connection from and XML node.
117 * Static. Reads settings of connection from an XML node.
118 * \param aXml QDomNode containing connection parameters.
119 * \return Pointer to ConnectionSettings object.
121 static ConnectionSettings* readConnectionSettings(const QDomNode &aXML);
122 //! Static. Reads rooms from an XML node.
124 * Static. Reads rooms from an XML node.
125 * \param aXml QDomNode containing meeting room parameters
126 * \return List of meetingrooms.
128 static QList<Room*> readRooms(const QDomNode &aXML);
129 //! Static. Reads language code from an XML node.
131 * Static. Reads rooms from an XML node.
132 * \param aXml QDomNode containing language code
133 * \return Language code.
135 static QString readLanguageCode(const QDomNode &aXML);
136 //! Static. Reads settings of startup from an XML node.
138 * Static. Reads settings of startup from an XML node.
139 * \param aXml QDomNode containing startup parameters
140 * \return Pointer to the read StartupSettings object.
142 static StartupSettings* readStartupSettings(const QDomNode &aXML);
144 * Static function to load and store display settings from xml node.
145 * \param aXml QDomNode containing display parameters
146 * \return Pointer to the read DisplaySettings object.
148 static DisplaySettings* readDisplaySettings(const QDomNode &aXML);
149 //! Static. Reads the date/time settings from an XML node.
151 * Static. Reads the date/time settings from an XML node.
152 * \param aXml QDomNode containing the date/time settings
153 * \return The date/time settings.
155 static DateTimeSettings* readDateTimeSettings(const QDomNode &aXML);
157 //! Static. Reads adminstrator's password from an XML node.
159 * Static. Reads adminstrator's password from an XML node.
160 * \param aXml QDomNode containing admin password
161 * \return Admin password.
163 static QByteArray readAdminPassword(const QDomNode &aXML);
165 //! Saves connection data to the document.
167 * Reads data from iConnectionSettings and saves it to the aXML document.
168 * \param aXml QDomNode containing connection parameters.
170 void saveConnectionSettings(const QDomNode &aXML);
171 //! Saves meeting rooms to the document.
173 * Reads data from iRooms list and saves it to the aXML document.
174 * \param aXml QDomNode containing meeting room parameters
176 void saveRooms(const QDomNode &aXML);
177 //! Saves the language code.
179 * Reads data from iLanguageCode and saves it to the aXML document.
180 * \param aXml QDomNode containing language code
182 void saveLanguageCode(const QDomNode &aXML);
183 //! Saves startup setting data to the document.
185 * Reads data from iStartupSettings and saves it to the aXML document.
186 * \param aXml QDomNode containing startup parameters
188 void saveStartupSettings(const QDomNode &aXML);
189 //! Saves display setting data to the document.
191 * Reads data from iDisplaySettings and saves it to the aXML document.
192 * \param aXml QDomNode containing display parameters
194 void saveDisplaySettings(const QDomNode &aXML);
195 //! Saves date/time setting data to the document.
197 * Reads data from iDateTimeSettings and saves it to the aXML document.
198 * \param aXml QDomNode containing the date/time settings
200 void saveDateTimeSettings(const QDomNode &aXML);
202 //! Saves admin password to the document.
204 * Reads data from iAdminPassword and saves it to the aXML document.
205 * \param aXml QDomNode containing admin password
207 void saveAdminPassword(const QDomNode &aXML);
209 //! Hash password with md5 method.
211 * Hash password with md5 method.
212 * \param aPassword password to be encoded
213 * \return Encoded password.
215 QString hashPassword(const QString aPassword);
218 //! Path and name of configuration file
219 static QString sConfigurationPath;
220 //! The static instance which is in use to read the configuration.
221 static Configuration *sInstance;
222 //! Static constant to store the default interval used for connection refresh.
223 static const unsigned int sDefaultInterval = 60;
224 //! Pointer to the ConnectionSettings object
225 ConnectionSettings *iConnectionSettings;
226 //! Stores startup settings.
227 StartupSettings *iStartupSettings;
228 //! Stores display settings.
229 DisplaySettings *iDisplaySettings;
230 //! Stores date/time settings.
231 DateTimeSettings *iDateTimeSettings;
232 //! List of meeting rooms.
234 //! Stores administrator password.
235 QByteArray iAdminPassword;
236 //! Stores language code
237 QString iLanguageCode;
241 #endif /*CONFIGURATION_H_*/