1 #ifndef CONFIGURATION_H_
2 #define CONFIGURATION_H_
9 class ConnectionSettings;
10 class StartupSettings;
11 class DisplaySettings;
15 //! Domain class. Store application wide configuration values.
17 * Domain class. Store application wide configuration values. The values are read from a configuration
18 * file at initialization time. Since there is one appliation per device normally running, therefore
19 * there is only one instance of this class, which is accessible by using a statis getter method.
21 class Configuration : public QObject
28 * Constructor to initialize an Configuration instance. The method populates the object by reading
29 * through the application's configuration file.
35 virtual ~Configuration();
37 //! Static. Gets the application wide configuration instance.
39 * Static Gets the static instance of this class. It is used to read the configuration information.
40 * \return Pointer to the Configuration instalce.
42 static Configuration* instance();
43 //! Gets the connection settings.
45 * Gets the connection settings.
46 * \return Pointer to ConnectionSettings instance.
48 ConnectionSettings* connectionSettings();
49 //! Gets the detault room.
51 * Gets the default meeting room.
52 * \return Pointer to the default room.
55 //! Gets the language code.
57 * Gets the language code.
58 * \return Language code in ISO 3166-1 alpha-2 format.
60 QString languageCode();
61 //! Gets the list of meeting rooms.
63 * Gets the list of meeting rooms.
64 * \return List of rooms.
67 //! Gets startup settings.
69 * Gets the startup settings.
70 * \return Pointer to StartupSettings instance.
72 StartupSettings* startupSettings();
73 //! Gets display settings.
75 * Gets the display settings.
76 * \return Pointer to DisplaySettings instance.
78 DisplaySettings* displaySettings();
79 //! Gets the administrator's password.
81 * Gets the administrator's password
82 * \return Administration password.
84 QByteArray adminPassword();
88 * \param aRooms List of rooms
90 void setRooms( const QList<Room*> aRooms );
94 //! Saves setting values to file.
96 * Writes setting values to configuration file.
101 //! Static. Reads the configuration instance from XML file.
103 * Static. Reads the configuration information from configuration file.
104 * \param aPath path and name of configuration file
105 * \return Configuration object.
107 static Configuration* readFromXML( const QString &aPath );
108 //! Static. Reads settings of connection from and XML node.
110 * Static. Reads settings of connection from an XML node.
111 * \param aXml QDomNode containing connection parameters.
112 * \return Pointer to ConnectionSettings object.
114 static ConnectionSettings* readConnectionSettings( const QDomNode &aXML );
115 //! Static. Reads rooms from an XML node.
117 * Static. Reads rooms from an XML node.
118 * \param aXml QDomNode containing meeting room parameters
119 * \return List of meetingrooms.
121 static QList<Room*> readRooms( const QDomNode &aXML );
122 //! Static. Reads language code from an XML node.
124 * Static. Reads rooms from an XML node.
125 * \param aXml QDomNode containing language code
126 * \return Language code.
128 static QString readLanguageCode( const QDomNode &aXML );
129 //! Static. Reads settings of startup from an XML node.
131 * Static. Reads settings of startup from an XML node.
132 * \param aXml QDomNode containing startup parameters
133 * \return Pointer to the read StartupSettings object.
135 static StartupSettings* readStartupSettings( const QDomNode &aXML );
137 * Static function to load and store display settings from xml node.
138 * \param aXml QDomNode containing display parameters
139 * \return Pointer to the read DisplaySettings object.
141 static DisplaySettings* readDisplaySettings( const QDomNode &aXML );
142 //! Static. Reads adminstrator's password from an XML node.
144 * Static. Reads adminstrator's password from an XML node.
145 * \param aXml QDomNode containing admin password
146 * \return Admin password.
148 static QByteArray readAdminPassword( const QDomNode &aXML );
150 //! Saves connection data to the document.
152 * Reads data from iConnectionSettings and saves it to the aXML document.
153 * \param aXml QDomNode containing connection parameters.
155 void saveConnectionSettings( const QDomNode &aXML );
156 //! Saves meeting rooms to the document.
158 * Reads data from iRooms list and saves it to the aXML document.
159 * \param aXml QDomNode containing meeting room parameters
161 void saveRooms( const QDomNode &aXML );
162 //! Saves the language code.
164 * Reads data from iLanguageCode and saves it to the aXML document.
165 * \param aXml QDomNode containing language code
167 void saveLanguageCode( const QDomNode &aXML );
168 //! Saves startup setting data to the document.
170 * Reads data from iStartupSettings and saves it to the aXML document.
171 * \param aXml QDomNode containing startup parameters
173 void saveStartupSettings( const QDomNode &aXML );
174 //! Saves display setting data to the document.
176 * Reads data from iDisplaySettings and saves it to the aXML document.
177 * \param aXml QDomNode containing display parameters
179 void saveDisplaySettings( const QDomNode &aXML );
180 //! Saves admin password to the document.
182 * Reads data from iAdminPassword and saves it to the aXML document.
183 * \param aXml QDomNode containing admin password
185 void saveAdminPassword( const QDomNode &aXML );
187 //! Hash password with md5 method.
189 * Hash password with md5 method.
190 * \param aPassword password to be encoded
191 * \return Encoded password.
193 QString hashPassword( const QString aPassword );
196 //! Path and name of configuration file
197 static QString sConfigurationPath;
198 //! The static instance which is in use to read the configuration.
199 static Configuration *sInstance;
200 //! Static constant to store the default interval used for connection refresh.
201 static const unsigned int sDefaultInterval = 60;
202 //! Pointer to the ConnectionSettings object
203 ConnectionSettings *iConnectionSettings;
204 //! Stores startup settings.
205 StartupSettings *iStartupSettings;
206 //! Stores display settings.
207 DisplaySettings *iDisplaySettings;
208 //! List of meeting rooms.
210 //! Stores administrator password.
211 QByteArray iAdminPassword;
212 //! Stores language code
213 QString iLanguageCode;
217 #endif /*CONFIGURATION_H_*/