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 caCertFile READ getCaCertFile WRITE setCaCertFile NOTIFY caCertFileChanged)
+ 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)
+
private:
QProcess * vpnProcess;
VPNSTATUS vpnStatus;
+ QStringList arguments;
+ QString logText;
+
+ // Configuration options
+ QString server;
+ unsigned int port;
+ bool compressed;
+ bool useTLS;
+ int tlsDirection;
+ QString caCertFile;
+ QString clientCertFile;
+ QString clientKeyFile;
+ QString tlsKeyFile;
+
+ void collectArguments ();
void setStatus (VPNSTATUS newStatus);
+ void addArgument (QString key, QString value);
+ void addArgument (QString key);
+ void addArgumentNonempty (QString key, QString value);
+ 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 getCaCertFile () const;
+ QString getClientCertFile () const;
+ QString getClientKeyFile () const;
+ QString getTlsKeyFile () 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 caCertFileChanged(QString &caCertFile);
+ void clientCertFileChanged(QString &clientCertFile);
+ void clientKeyFileChanged(QString &clientKeyFile);
+ void tlsKeyFileChanged(QString &tlsKeyFile);
+
+ void logTextChanged (QString &logText);
public slots:
void vpnConnect ();
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 setCaCertFile(const QString &value);
+ 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);
};
#endif // VPNCONTROL_H