DrCute
Défi DVP 2
config.h
Go to the documentation of this file.
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 : public QObject
00010 {
00011     Q_OBJECT
00012 
00013 public:
00014     Config(QObject *parent = 0);
00015     ~Config();
00016 
00017     int getPort() { return port; }
00018     QString getIpAddress() { return ipAddress; }
00019     QString getUniqueId() { return uniqueId; }
00020 
00021 public slots:
00022     void setIpAddress(const QString &msg) {
00023         qDebug() << "IP adress:" << msg;
00024         ipAddress = msg;
00025         writeConfig();
00026     }
00027 
00028     void setPort(const QString &msg) {
00029         qDebug() << "Port:" << msg;
00030         port = msg.toInt();
00031         writeConfig();
00032     }
00033 
00034     void readConfig();
00035     void writeConfig();
00036 
00037 private:
00038     QString generateUniqueId();
00039     QString ipAddress;
00040     int port;
00041     QString userName;
00042     QString uniqueId;
00043 };
00044 
00045 #endif // CONFIG_H
 All Classes Files Functions Variables