X-Git-Url: https://www.flypig.org.uk/git/?p=openvpnui.git;a=blobdiff_plain;f=src%2Fvpncontrol.h;fp=src%2Fvpncontrol.h;h=d89120ffa236ca4929c17d7a908a642b0dc65404;hp=12ff2489da99bd552b0598d9cce629cc5f65a384;hb=7a870818f95f0dd0ced94643aac1bbae6f68b2fd;hpb=052fa14434d3ca4b7d08c2c2fccf3791e20afbaa diff --git a/src/vpncontrol.h b/src/vpncontrol.h index 12ff248..d89120f 100644 --- a/src/vpncontrol.h +++ b/src/vpncontrol.h @@ -20,6 +20,10 @@ class VPNControl : public QObject { Q_OBJECT + // General properties + Q_PROPERTY (QString logText READ getLogText WRITE setLogText NOTIFY logTextChanged) + + // Configuration properties 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) @@ -29,10 +33,10 @@ class VPNControl : public QObject Q_PROPERTY (QString clientCertFile READ getClientCertFile WRITE setClientCertFile NOTIFY clientCertFileChanged) Q_PROPERTY (QString clientKeyFile READ getClientKeyFile WRITE setClientKeyFile NOTIFY clientKeyFileChanged) Q_PROPERTY (QString tlsKeyFile READ getTlsKeyFile WRITE setTlsKeyFile NOTIFY tlsKeyFileChanged) - - Q_PROPERTY (QString logText READ getLogText WRITE setLogText NOTIFY logTextChanged) + Q_PROPERTY (QString configFile READ getConfigFile WRITE setConfigFile NOTIFY configFileChanged) private: + // General variables QProcess * vpnProcess; VPNSTATUS vpnStatus; QStringList arguments; @@ -48,7 +52,9 @@ private: QString clientCertFile; QString clientKeyFile; QString tlsKeyFile; + QString configFile; + // Internal methods void collectArguments (); void setStatus (VPNSTATUS newStatus); void addArgument (QString key, QString value); @@ -60,8 +66,12 @@ private: void settingsSetValue (QString key, int value); public: + // General methods explicit VPNControl(QObject *parent = 0); void initialise(); + QString getLogText() const; + + // Configuration retreival methods QString getServer() const; unsigned int getPort() const; bool getCompressed() const; @@ -71,11 +81,14 @@ public: QString getClientCertFile () const; QString getClientKeyFile () const; QString getTlsKeyFile () const; - - QString getLogText() const; + QString getConfigFile () const; signals: + // General signals void statusChanged(int status); + void logTextChanged (QString &logText); + + // Configuration change signals void serverChanged(QString &server); void portChanged(unsigned int port); void compressedChanged(bool compressed); @@ -85,10 +98,10 @@ signals: void clientCertFileChanged(QString &clientCertFile); void clientKeyFileChanged(QString &clientKeyFile); void tlsKeyFileChanged(QString &tlsKeyFile); - - void logTextChanged (QString &logText); + void configFileChanged(QString &configFile); public slots: + // General methods void vpnConnect (); void vpnDisconnect (); void readData (); @@ -96,6 +109,10 @@ public slots: void finished (int code); void readError (QProcess::ProcessError error); void updateConfiguration (); + void setLogText(const QString &value); + void logAppend(const QString &text); + + // Configuration setting void setServer(const QString &value); void setPort(unsigned int value); void setCompressed(bool value); @@ -105,9 +122,7 @@ public slots: void setClientCertFile(const QString &value); void setClientKeyFile(const QString &value); void setTlsKeyFile(const QString &value); - - void setLogText(const QString &value); - void logAppend(const QString &text); + void setConfigFile(const QString &value); }; #endif // VPNCONTROL_H