Configuration values are passed between the interface and main code.
[openvpnui.git] / src / vpncontrol.cpp
index 8b0c79a..a519dce 100644 (file)
@@ -4,7 +4,12 @@
 VPNControl::VPNControl(QObject *parent) :
     QObject(parent),
     vpnProcess(NULL),
-    vpnStatus(VPNSTATUS_INVALID)
+    vpnStatus(VPNSTATUS_INVALID),
+    server(""),
+    port(1174),
+    compressed(true),
+    useTLS(true),
+    tlsDirection(1)
 {
 }
 
@@ -21,6 +26,66 @@ void VPNControl::setStatus(VPNSTATUS newStatus)
         printf ("Emitting status %d\n", newStatus);
     }
 }
+int VPNControl::getTlsDirection() const
+{
+    return tlsDirection;
+}
+
+void VPNControl::setTlsDirection(int value)
+{
+    printf ("TLS direction set to %d\n", value);
+    tlsDirection = value;
+    emit tlsDirectionChanged (value);
+}
+
+bool VPNControl::getUseTLS() const
+{
+    return useTLS;
+}
+
+void VPNControl::setUseTLS(bool value)
+{
+    printf ("Use TLS set to %d\n", value);
+    useTLS = value;
+    emit useTLSChanged(useTLS);
+}
+
+bool VPNControl::getCompressed() const
+{
+    return compressed;
+}
+
+void VPNControl::setCompressed(bool value)
+{
+    printf ("Use compression set to %d\n", value);
+    compressed = value;
+    emit compressedChanged(compressed);
+}
+
+unsigned int VPNControl::getPort() const
+{
+    return port;
+}
+
+void VPNControl::setPort(unsigned int value)
+{
+    printf ("Port set to %d\n", value);
+    port = value;
+    emit portChanged(port);
+}
+
+QString VPNControl::getServer() const
+{
+    return server;
+}
+
+void VPNControl::setServer(const QString &value)
+{
+    printf ("Server set to %s\n", value.toUtf8().constData());
+    server = value;
+    emit serverChanged(server);
+}
+
 
 void VPNControl::vpnConnect() {
     if (vpnProcess != NULL) {
@@ -95,3 +160,8 @@ void VPNControl::readError(QProcess::ProcessError error)
     // Disconnect
     vpnDisconnect();
 }
+
+void VPNControl::updateConfiguration()
+{
+    printf ("Update configuration\n");
+}