From 0efd19b935452a7b0b5561f9cba56b01ba7c627f Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Fri, 24 Sep 2021 20:58:30 +0200 Subject: [feat] persist obfs4 & udp prefs --- gui/backend.go | 5 +++++ gui/components/Preferences.qml | 13 +++++++++++++ gui/handlers.cpp | 5 +++++ gui/handlers.h | 1 + 4 files changed, 24 insertions(+) (limited to 'gui') diff --git a/gui/backend.go b/gui/backend.go index bc056b9..5c07cda 100644 --- a/gui/backend.go +++ b/gui/backend.go @@ -53,6 +53,11 @@ func GetTransport() *C.char { return (*C.char)(backend.GetTransport()) } +//export SetUDP +func SetUDP(udp bool) { + backend.SetUDP(udp) +} + //export Quit func Quit() { backend.Quit() diff --git a/gui/components/Preferences.qml b/gui/components/Preferences.qml index 5c708a3..3620471 100644 --- a/gui/components/Preferences.qml +++ b/gui/components/Preferences.qml @@ -67,6 +67,9 @@ ThemedPage { text: qsTr("UDP") enabled: false checked: false + onClicked: { + doUseUDP(checked) + } } } @@ -131,6 +134,16 @@ ThemedPage { } } + function doUseUDP(value) { + if (value == true) { + console.debug("use udp") + backend.setUDP(true) + } else { + console.debug("use tcp") + backend.setUDP(false) + } + } + Component.onCompleted: { if (ctx && ctx.transport == "obfs4") { useBridgesCheckBox.checked = true diff --git a/gui/handlers.cpp b/gui/handlers.cpp index 29fecf1..b1d060b 100644 --- a/gui/handlers.cpp +++ b/gui/handlers.cpp @@ -57,6 +57,11 @@ void Backend::setTransport(QString transport) SetTransport(toGoStr(transport)); } +void Backend::setUDP(bool udp) +{ + SetUDP(udp); +} + QString Backend::getTransport() { return QString(GetTransport()); diff --git a/gui/handlers.h b/gui/handlers.h index a3812c5..55dd32d 100644 --- a/gui/handlers.h +++ b/gui/handlers.h @@ -39,6 +39,7 @@ public slots: void useLocation(QString username); void useAutomaticGateway(); void setTransport(QString transport); + void setUDP(bool udp); QString getTransport(); void login(QString username, QString password); void resetError(QString errlabel); -- cgit v1.2.3