diff options
author | Alex Borisov <borisov.alexandr@rambler.ru> | 2011-11-11 00:42:50 +0200 |
---|---|---|
committer | Alex Borisov <borisov.alexandr@rambler.ru> | 2011-11-11 00:42:50 +0200 |
commit | d9a7ccf4eb0fe6d44cf1a7361b331889a98ff85b (patch) | |
tree | a01b1a8265601788d2e4b3003940bc2f33669755 /client/UpdatedConfig.h | |
parent | fe4520fc09dca52c158437f5621f5909d7d6974f (diff) |
Self-updated config. Various fixes and improvements. TODO: test client/server communication
Diffstat (limited to 'client/UpdatedConfig.h')
-rw-r--r-- | client/UpdatedConfig.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/client/UpdatedConfig.h b/client/UpdatedConfig.h new file mode 100644 index 0000000..669c126 --- /dev/null +++ b/client/UpdatedConfig.h @@ -0,0 +1,72 @@ + +#ifndef UPDATED_CONFIG_H +#define UPDATED_CONFIG_H + +#include <QObject> +#include "Config.h" +#include "SslClient.h" + +class QTimer; + +class UpdatedConfig: public QObject, public Config +{ + Q_OBJECT +public: + + /** + * @brief Retrieve application-wide instance of Config class + * @return Pointer to singleton instance of Config class + */ + static UpdatedConfig *CurrentConfig(); +private: + UpdatedConfig(); + + /** + * @brief Pointer to the singleton Config instance + */ + static UpdatedConfig *self; + + /** + * @brief SslCLient instance that connects to server and retrieves config + */ + SslClient *client; + + /** + * @brief timer that is responsible on config updates + */ + QTimer *configUpdateTimer; + + /** + * @brief bool value that is true if config is actual and was updated recently<br/> + * and false if it isn't actual and has to be updated + */ + bool configValid; + + /** + * @brief Count time between subsequent request retries + */ + unsigned time; + + /** + * @brief index of Config::servers that is currently being tried to connect or being worked with + */ + unsigned activeSrvIndex; + + /** + * @brief value indicating whether last connetion attempt failed or not + */ + bool retryFailed; + + /** + * @brief value indicating which config parts are already updated<br/> + * to check if some part is updated just apply && to this<br/> + * value and any of SslClient::RequestType values + */ + unsigned char updateStatus; +private slots: + void update(); + void connectionError(); + void gotServerReply(SslClient::RequestType &type, QByteArray &confdata); +}; + +#endif
\ No newline at end of file |