Show confidential meeting details setting added
[qtmeetings] / src / Domain / Configuration / Configuration.h
1 #ifndef CONFIGURATION_H_
2 #define CONFIGURATION_H_
3
4 #include <QObject>
5 #include <QString>
6 #include <QList>
7 #include <QTime>
8 #include <QUrl>
9
10 class ConnectionSettings;
11 class StartupSettings;
12 class DisplaySettings;
13 class Room;
14 class QDomNode;
15 class DateTimeSettings;
16
17 //! Domain class. Store application wide configuration values.
18 /*!
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.
22  */
23 class Configuration: public QObject {
24 Q_OBJECT
25
26 private:
27         //! Constructor.
28         /*!
29          * Constructor to initialize an Configuration instance. The method populates the object by reading
30          * through the application's configuration file.
31          */
32         Configuration();
33
34 public:
35         //! Destructor
36         virtual ~Configuration();
37
38         //! Static. Gets the application wide configuration instance.
39         /*!
40          * Static Gets the static instance of this class. It is used to read the configuration information.
41          * \return Pointer to the Configuration instalce.
42          */
43         static Configuration* instance();
44         //! Gets the connection settings.
45         /*!
46          * Gets the connection settings.
47          * \return Pointer to ConnectionSettings instance.
48          */
49         //ConnectionSettings* connectionSettings();
50         /**
51          * Returns the current server URL
52          */
53         QUrl getServerUrl();
54         /**
55          * Returns the current username
56          */
57         QString getUsername();
58         /**
59          * Returns the current users password
60          */
61         QString getPassword();
62         /**
63          * Returns the refresh interval
64          */
65         unsigned int getRefreshinterval();
66         /**
67          * Sets the current server URL
68          */
69         void setServerUrl(QUrl serverUrl);
70         /**
71          * Sets the current username
72          */
73         void setUsername(QString username);
74         /**
75          * Sets the current users password
76          */
77         void setPassword(QString password);
78         /**
79          * Sets the refresh interval
80          */
81         void setRefreshinterval(unsigned int refreshinterval);
82         
83         //! Sets the confidential meeting details showing setting.
84         /*!
85          * Sets the confidential meeting details showing setting.
86          * \param confidential meeting details showing setting.
87          */
88         bool setShowConfidentialMeetingDetails(bool showconfidentialmeetingdetails);
89         
90         //! Gets the detault room.
91         /*!
92          * Gets the default meeting room.
93          * \return Pointer to the default room.
94          */
95         Room* defaultRoom();
96         //! Gets the language code.
97         /*!
98          * Gets the language code.
99          * \return Language code in ISO 3166-1 alpha-2 format.
100          */
101         QString languageCode();
102         //! Gets the list of meeting rooms.
103         /*!
104          * Gets the list of meeting rooms.
105          * \return List of rooms.
106          */
107         QList<Room*> rooms();
108         //! Gets startup settings.
109         /*!
110          * Gets the startup settings.
111          * \return Pointer to StartupSettings instance.
112          */
113         StartupSettings* startupSettings();
114         //! Gets display settings.
115         /*!
116          * Gets the display settings.
117          * \return Pointer to DisplaySettings instance.
118          */
119         DisplaySettings* displaySettings();
120         //! Gets date/time settings.
121         /*!
122          * Gets the date/time settings.
123          * \return Pointer to DateTimeSettings instance.
124          */
125         DateTimeSettings* dateTimeSettings();
126         //! Gets the administrator's password.
127         /*!
128          * Gets the administrator's password
129          * \return Administration password.
130          */
131         QByteArray adminPassword();
132         //! Sets room list.
133         /*!
134          * Sets room list.
135          * \param aRooms List of rooms
136          */
137         void setRooms(const QList<Room*> aRooms);
138
139         //! Gets the confidential meeting details showing setting.
140         /*!
141          * Gets the confidential meeting details showing setting.
142          * \return confidential meeting details showing setting.
143          */
144         bool showConfidentialMeetingDetails();
145         
146 signals:
147         void configurationChanged();
148
149 public slots:
150
151         //! Saves setting values to file.
152         /*!
153          * Writes setting values to configuration file.
154          */
155         void save();
156
157 private:
158         //! Static. Reads the configuration instance from XML file.
159         /*!
160          * Static. Reads the configuration information from configuration file.
161          * \param aPath path and name of configuration file
162          * \return Configuration object.
163          */
164         void readFromXML(const QString &aPath);
165         //! Static. Reads settings of connection from and XML node.
166         /*!
167          * Static. Reads settings of connection from an XML node.
168          * \param aXml QDomNode containing connection parameters.
169          * \return Pointer to ConnectionSettings object.
170          */
171         ConnectionSettings* readConnectionSettings(const QDomNode &aXML);
172         //! Static. Reads rooms from an XML node.
173         /*!
174          * Static. Reads rooms from an XML node.
175          * \param aXml QDomNode containing meeting room parameters
176          * \return List of meetingrooms.
177          */
178         QList<Room*> readRooms(const QDomNode &aXML);
179         //! Static. Reads language code from an XML node.
180         /*!
181          * Static. Reads rooms from an XML node.
182          * \param aXml QDomNode containing language code
183          * \return Language code.
184          */
185         QString readLanguageCode(const QDomNode &aXML);
186         //! Static. Reads settings of startup from an XML node.
187         /*!
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.
191          */
192         StartupSettings* readStartupSettings(const QDomNode &aXML);
193         /*!
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.
197          */
198         DisplaySettings* readDisplaySettings(const QDomNode &aXML);
199         //! Static. Reads the date/time settings from an XML node.
200         /*!
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.
204          */
205         DateTimeSettings* readDateTimeSettings(const QDomNode &aXML);
206
207         //! Static. Reads adminstrator's password from an XML node.
208         /*!
209          * Static. Reads adminstrator's password from an XML node.
210          * \param aXml QDomNode containing admin password
211          * \return Admin password.
212          */
213         QByteArray readAdminPassword(const QDomNode &aXML);
214
215         //! Static. Reads confidential meeting details setting from an XML node.
216         /*!
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.
220          */
221         void readPrivacySettings(const QDomNode &aXML);
222         
223         //! Saves connection data to the document.
224         /*!
225          * Reads data from iConnectionSettings and saves it to the aXML document.
226          * \param aXml QDomNode containing connection parameters.
227          */
228         void saveConnectionSettings(const QDomNode &aXML);
229         //! Saves meeting rooms to the document.
230         /*!
231          * Reads data from iRooms list and saves it to the aXML document.
232          * \param aXml QDomNode containing meeting room parameters
233          */
234         void saveRooms(const QDomNode &aXML);
235         //! Saves the language code.
236         /*!
237          * Reads data from iLanguageCode and saves it to the aXML document.
238          * \param aXml QDomNode containing language code
239          */
240         void saveLanguageCode(const QDomNode &aXML);
241         //! Saves startup setting data to the document.
242         /*!
243          * Reads data from iStartupSettings and saves it to the aXML document.
244          * \param aXml QDomNode containing startup parameters
245          */
246         void saveStartupSettings(const QDomNode &aXML);
247         //! Saves display setting data to the document.
248         /*!
249          * Reads data from iDisplaySettings and saves it to the aXML document.
250          * \param aXml QDomNode containing display parameters
251          */
252         void saveDisplaySettings(const QDomNode &aXML);
253         //! Saves date/time setting data to the document.
254         /*!
255          * Reads data from iDateTimeSettings and saves it to the aXML document.
256          * \param aXml QDomNode containing the date/time settings
257          */
258         void saveDateTimeSettings(const QDomNode &aXML);
259
260         //! Saves admin password to the document.
261         /*!
262          * Reads data from iAdminPassword and saves it to the aXML document.
263          * \param aXml QDomNode containing admin password
264          */
265         void saveAdminPassword(const QDomNode &aXML);
266
267         //! Saves confidential meeting details setting to the document.
268         /*!
269          * Reads data from iShowConfidentialMeetingDetails and saves it to the aXML document.
270          * \param aXml QDomNode confidential meeting details setting
271          */
272         void savePrivacySettings(QDomNode &aXML);
273                 
274         //! Hash password with md5 method.
275         /*!
276          * Hash password with md5 method.
277          * \param aPassword password to be encoded
278          * \return Encoded password.
279          */
280         QString hashPassword(const QString aPassword);
281
282 private:
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.
298         QList<Room*> iRooms;
299         //! Stores administrator password.
300         QByteArray iAdminPassword;
301         //! Stores language code
302         QString iLanguageCode;
303
304         bool iShowConfidentialMeetingDetails;
305 };
306
307 #endif /*CONFIGURATION_H_*/