![]() |
MrHyde
Défi DVP 2
|
00001 #ifndef CONFIG_H 00002 #define CONFIG_H 00003 00004 #include <QObject> 00005 #include <QSettings> 00006 #include <QDebug> 00007 #include <QDateTime> 00008 00009 //class Config //: virtual public QObject 00010 class Config : public QObject 00011 { 00012 Q_OBJECT 00013 00014 public: 00015 Config(QObject *parent = 0); 00016 ~Config(); 00017 00018 int getPort() { return port; } 00019 QString getIpAddress() { return ipAddress; } 00020 QString getUniqueId() { return uniqueId; } 00021 00022 public slots: 00023 void setIpAddress(const QString &msg) { 00024 qDebug() << "IP adress:" << msg; 00025 ipAddress = msg; 00026 writeConfig(); 00027 } 00028 00029 void setPort(const QString &msg) { 00030 qDebug() << "Port:" << msg; 00031 port = msg.toInt(); 00032 writeConfig(); 00033 } 00034 00035 void readConfig(); 00036 void writeConfig(); 00037 00038 private: 00039 QString generateUniqueId(); 00040 QString ipAddress; 00041 int port; 00042 QString userName; 00043 QString uniqueId; 00044 }; 00045 00046 #endif // CONFIG_H