summaryrefslogtreecommitdiff
path: root/client/Config.h
diff options
context:
space:
mode:
authorAlex Borisov <borisov.alexandr@rambler.ru>2011-11-11 00:42:50 +0200
committerAlex Borisov <borisov.alexandr@rambler.ru>2011-11-11 00:42:50 +0200
commitd9a7ccf4eb0fe6d44cf1a7361b331889a98ff85b (patch)
treea01b1a8265601788d2e4b3003940bc2f33669755 /client/Config.h
parentfe4520fc09dca52c158437f5621f5909d7d6974f (diff)
Self-updated config. Various fixes and improvements. TODO: test client/server communication
Diffstat (limited to 'client/Config.h')
-rw-r--r--client/Config.h52
1 files changed, 13 insertions, 39 deletions
diff --git a/client/Config.h b/client/Config.h
index 11bed90..8640d1e 100644
--- a/client/Config.h
+++ b/client/Config.h
@@ -4,16 +4,11 @@
#define CONFIG_H
#include <client.h>
-#include <QObject>
#include "Proxy.h"
-#include <SslClient.h>
using std::vector;
using std::string;
-class SslClient;
-class QTimer;
-
/**
* @brief Singleton class that represents client configuration<br/>
* At the first time this object is accessed config.cfg is read to
@@ -21,9 +16,8 @@ class QTimer;
* Then retries is made to connect to server and acqire actual config,
* firewall list, etc.
*/
-class Config: public QObject
+class Config
{
- Q_OBJECT
public:
/**
* @brief Class to represent 'firewall' record in the config file
@@ -46,12 +40,6 @@ public:
};
/**
- * @brief Retrieve application-wide instance of Config class
- * @return Pointer to singleton instance of Config class
- */
- static Config *CurrentConfig();
-
- /**
* @brief Time between consecutive program updates
*/
unsigned ClientUpdateInterval;
@@ -168,8 +156,6 @@ public:
*/
const unsigned StaticProxySpeedLow;
protected:
- Config();
-private:
/**
* @brief Class to represend 'server' record in the config file
*/
@@ -203,39 +189,27 @@ private:
/**
* @brief Time (in seconds) between consecutive retries
*/
- unsigned retry;
+ unsigned retryTimeout;
};
/**
- * @brief Pointer to the singleton Config instance
- */
- static Config *self;
-
- /**
- * @brief time interval between consequtive config updates
+ * @brief create new instance (not allowed for use by other classes and functions)
*/
- unsigned updateInterval;
+ Config();
- /**
- * @brief SslCLient instance that connects to server and retrieves config
- */
- SslClient *client;
+ void ParseConfig(string data);
+ void ParseGenericProxies(string data);
+ void ParseStaticPorxies(string data);
+ void ParseFirewalls(string data);
- /**
- * @brief timer that is responsible on config updates
- */
- QTimer *configUpdateTimer;
- bool configValid;
+ unsigned updateInterval;
+ vector<ServerEntry> servers;
+private:
vector<ProxyEntryGeneric> genericProxy;
vector<ProxyEntryStatic> staticProxy;
vector<FirewallEntry> firewalls;
- vector<ServerEntry> servers;
- int ReadGenericProxy();
- int ReadStaticProxy();
-private slots:
- void updateConfig();
- void gotServerReply(SslClient::RequestType &type, QByteArray &confdata);
+ void ReadGenericProxy();
+ void ReadStaticProxy();
};
-
#endif \ No newline at end of file