1 #ifndef CONFIGURATION_H_
2 #define CONFIGURATION_H_
10 class ConnectionSettings;
11 class StartupSettings;
12 class DisplaySettings;
15 class DateTimeSettings;
17 //! Domain class. Store application wide configuration values.
19 * Domain class. Store application wide configuration values. The values are read from a configuration
20 * file at initialization time. Since there is one appliation per device normally running, therefore
21 * there is only one instance of this class, which is accessible by using a statis getter method.
23 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();
51 * Returns the current server URL
55 * Returns the current username
57 QString getUsername();
59 * Returns the current users password
61 QString getPassword();
63 * Returns the refresh interval
65 unsigned int getRefreshinterval();
67 * Sets the current server URL
69 void setServerUrl(QUrl serverUrl);
71 * Sets the current username
73 void setUsername(QString username);
75 * Sets the current users password
77 void setPassword(QString password);
79 * Sets the refresh interval
81 void setRefreshinterval(unsigned int refreshinterval);
83 //! Sets the confidential meeting details showing setting.
85 * Sets the confidential meeting details showing setting.
86 * \param confidential meeting details showing setting.
88 bool setShowConfidentialMeetingDetails(bool showconfidentialmeetingdetails);
90 //! Gets the detault room.
92 * Gets the default meeting room.
93 * \return Pointer to the default room.
96 //! Gets the language code.
98 * Gets the language code.
99 * \return Language code in ISO 3166-1 alpha-2 format.
101 QString languageCode();
102 //! Gets the list of meeting rooms.
104 * Gets the list of meeting rooms.
105 * \return List of rooms.
107 QList<Room*> rooms();
108 //! Gets startup settings.
110 * Gets the startup settings.
111 * \return Pointer to StartupSettings instance.
113 StartupSettings* startupSettings();
114 //! Gets display settings.
116 * Gets the display settings.
117 * \return Pointer to DisplaySettings instance.
119 DisplaySettings* displaySettings();
120 //! Gets date/time settings.
122 * Gets the date/time settings.
123 * \return Pointer to DateTimeSettings instance.
125 DateTimeSettings* dateTimeSettings();
126 //! Gets the administrator's password.
128 * Gets the administrator's password
129 * \return Administration password.
131 QByteArray adminPassword();
135 * \param aRooms List of rooms
137 void setRooms(const QList<Room*> aRooms);
139 //! Gets the confidential meeting details showing setting.
141 * Gets the confidential meeting details showing setting.
142 * \return confidential meeting details showing setting.
144 bool showConfidentialMeetingDetails();
147 void configurationChanged();
151 //! Saves setting values to file.
153 * Writes setting values to configuration file.
158 //! Static. Reads the configuration instance from XML file.
160 * Static. Reads the configuration information from configuration file.
161 * \param aPath path and name of configuration file
162 * \return Configuration object.
164 void readFromXML(const QString &aPath);
165 //! Static. Reads settings of connection from and XML node.
167 * Static. Reads settings of connection from an XML node.
168 * \param aXml QDomNode containing connection parameters.
169 * \return Pointer to ConnectionSettings object.
171 ConnectionSettings* readConnectionSettings(const QDomNode &aXML);
172 //! Static. Reads rooms from an XML node.
174 * Static. Reads rooms from an XML node.
175 * \param aXml QDomNode containing meeting room parameters
176 * \return List of meetingrooms.
178 QList<Room*> readRooms(const QDomNode &aXML);
179 //! Static. Reads language code from an XML node.
181 * Static. Reads rooms from an XML node.
182 * \param aXml QDomNode containing language code
183 * \return Language code.
185 QString readLanguageCode(const QDomNode &aXML);
186 //! Static. Reads settings of startup from an XML node.
188 * Static. Reads settings of startup from an XML node.
189 * \param aXml QDomNode containing startup parameters
190 * \return Pointer to the read StartupSettings object.
192 StartupSettings* readStartupSettings(const QDomNode &aXML);
194 * Static function to load and store display settings from xml node.
195 * \param aXml QDomNode containing display parameters
196 * \return Pointer to the read DisplaySettings object.
198 DisplaySettings* readDisplaySettings(const QDomNode &aXML);
199 //! Static. Reads the date/time settings from an XML node.
201 * Static. Reads the date/time settings from an XML node.
202 * \param aXml QDomNode containing the date/time settings
203 * \return The date/time settings.
205 DateTimeSettings* readDateTimeSettings(const QDomNode &aXML);
207 //! Static. Reads adminstrator's password from an XML node.
209 * Static. Reads adminstrator's password from an XML node.
210 * \param aXml QDomNode containing admin password
211 * \return Admin password.
213 QByteArray readAdminPassword(const QDomNode &aXML);
215 //! Static. Reads confidential meeting details setting from an XML node.
217 * Static. Reads confidential meeting details setting from an XML node.
218 * \param aXml QDomNode containing confidential meeting details setting
219 * \return Confidential meeting details setting.
221 void readPrivacySettings(const QDomNode &aXML);
223 //! Saves connection data to the document.
225 * Reads data from iConnectionSettings and saves it to the aXML document.
226 * \param aXml QDomNode containing connection parameters.
228 void saveConnectionSettings(const QDomNode &aXML);
229 //! Saves meeting rooms to the document.
231 * Reads data from iRooms list and saves it to the aXML document.
232 * \param aXml QDomNode containing meeting room parameters
234 void saveRooms(const QDomNode &aXML);
235 //! Saves the language code.
237 * Reads data from iLanguageCode and saves it to the aXML document.
238 * \param aXml QDomNode containing language code
240 void saveLanguageCode(const QDomNode &aXML);
241 //! Saves startup setting data to the document.
243 * Reads data from iStartupSettings and saves it to the aXML document.
244 * \param aXml QDomNode containing startup parameters
246 void saveStartupSettings(const QDomNode &aXML);
247 //! Saves display setting data to the document.
249 * Reads data from iDisplaySettings and saves it to the aXML document.
250 * \param aXml QDomNode containing display parameters
252 void saveDisplaySettings(const QDomNode &aXML);
253 //! Saves date/time setting data to the document.
255 * Reads data from iDateTimeSettings and saves it to the aXML document.
256 * \param aXml QDomNode containing the date/time settings
258 void saveDateTimeSettings(const QDomNode &aXML);
260 //! Saves admin password to the document.
262 * Reads data from iAdminPassword and saves it to the aXML document.
263 * \param aXml QDomNode containing admin password
265 void saveAdminPassword(const QDomNode &aXML);
267 //! Saves confidential meeting details setting to the document.
269 * Reads data from iShowConfidentialMeetingDetails and saves it to the aXML document.
270 * \param aXml QDomNode confidential meeting details setting
272 void savePrivacySettings(QDomNode &aXML);
274 //! Hash password with md5 method.
276 * Hash password with md5 method.
277 * \param aPassword password to be encoded
278 * \return Encoded password.
280 QString hashPassword(const QString aPassword);
283 //! Path and name of configuration file
284 static QString sConfigurationPath;
285 //! The static instance which is in use to read the configuration.
286 static Configuration *sInstance;
287 //! Static constant to store the default interval used for connection refresh.
288 static const unsigned int sDefaultInterval = 60;
289 //! Pointer to the ConnectionSettings object
290 ConnectionSettings *iConnectionSettings;
291 //! Stores startup settings.
292 StartupSettings *iStartupSettings;
293 //! Stores display settings.
294 DisplaySettings *iDisplaySettings;
295 //! Stores date/time settings.
296 DateTimeSettings *iDateTimeSettings;
297 //! List of meeting rooms.
299 //! Stores administrator password.
300 QByteArray iAdminPassword;
301 //! Stores language code
302 QString iLanguageCode;
304 bool iShowConfidentialMeetingDetails;
307 #endif /*CONFIGURATION_H_*/