Integrated file selection dialogue with the main code. Improved the
[openvpnui.git] / src / vpncontrol.h
index d73f344..33dbc38 100644 (file)
@@ -19,17 +19,55 @@ enum VPNSTATUS {
 class VPNControl : public QObject
 {
     Q_OBJECT
+
+    Q_PROPERTY (QString server READ getServer WRITE setServer NOTIFY serverChanged)
+    Q_PROPERTY (unsigned int port READ getPort WRITE setPort NOTIFY portChanged)
+    Q_PROPERTY (bool compressed READ getCompressed WRITE setCompressed NOTIFY compressedChanged)
+    Q_PROPERTY (bool useTLS READ getUseTLS WRITE setUseTLS NOTIFY useTLSChanged)
+    Q_PROPERTY (int tlsDirection READ getTlsDirection WRITE setTlsDirection NOTIFY tlsDirectionChanged)
+
+    Q_PROPERTY (QString logText READ getLogText WRITE setLogText NOTIFY logTextChanged)
+
 private:
     QProcess * vpnProcess;
     VPNSTATUS vpnStatus;
+    QStringList arguments;
+
+    // Configuration options
+    QString server;
+    unsigned int port;
+    bool compressed;
+    bool useTLS;
+    int tlsDirection;
+    QString logText;
+
+    void collectArguments ();
     void setStatus (VPNSTATUS newStatus);
+    void addArgument (QString key, QString value);
+    void addArgument (QString key);
+    void addOption (QString key, bool add);
+    void addValue (QString key);
+    void settingsSetValue (QString key, QString value);
+    void settingsSetValue (QString key, int value);
 
 public:
     explicit VPNControl(QObject *parent = 0);
     void initialise();
+    QString getServer() const;
+    unsigned int getPort() const;
+    bool getCompressed() const;
+    bool getUseTLS() const;
+    int getTlsDirection() const;
+    QString getLogText() const;
 
 signals:
     void statusChanged(int status);
+    void serverChanged(QString server);
+    void portChanged(unsigned int port);
+    void compressedChanged(bool compressed);
+    void useTLSChanged(bool useTLS);
+    void tlsDirectionChanged (int direction);
+    void logTextChanged (QString logText);
 
 public slots:
     void vpnConnect ();
@@ -38,6 +76,14 @@ public slots:
     void started ();
     void finished (int code);
     void readError (QProcess::ProcessError error);
+    void updateConfiguration ();
+    void setServer(const QString &value);
+    void setPort(unsigned int value);
+    void setCompressed(bool value);
+    void setUseTLS(bool value);
+    void setTlsDirection(int value);
+    void setLogText(const QString &value);
+    void logAppend(const QString &text);
 };
 
 #endif // VPNCONTROL_H