diff options
Diffstat (limited to 'gui/qml')
-rw-r--r-- | gui/qml/BackgroundImage.qml | 16 | ||||
-rw-r--r-- | gui/qml/BridgesItem.qml | 16 | ||||
-rw-r--r-- | gui/qml/VPNSwitch.qml | 1 | ||||
-rw-r--r-- | gui/qml/VpnState.qml | 13 | ||||
-rw-r--r-- | gui/qml/main.qml | 65 | ||||
-rw-r--r-- | gui/qml/readme.txt | 1 |
6 files changed, 54 insertions, 58 deletions
diff --git a/gui/qml/BackgroundImage.qml b/gui/qml/BackgroundImage.qml index 3071bf4..ba2a8af 100644 --- a/gui/qml/BackgroundImage.qml +++ b/gui/qml/BackgroundImage.qml @@ -3,22 +3,22 @@ import QtQuick.Controls 2.4 Rectangle { - anchors.fill: parent; - anchors.topMargin: 40; + anchors.fill: parent + anchors.topMargin: 40 property var backgroundSrc property var backgroundVisible Image { - source: parent.backgroundSrc; - visible: parent.backgroundVisible; - fillMode: Image.PreserveAspectCrop; - anchors.fill: parent; - opacity: 0.8; + source: parent.backgroundSrc + visible: parent.backgroundVisible + fillMode: Image.PreserveAspectCrop + anchors.fill: parent + opacity: 0.8 } Component.onCompleted: { /* default for riseup, needs customizing */ - backgroundSrc = "qrc:/assets/img/bird.jpg"; + backgroundSrc = "qrc:/assets/img/bird.jpg" } } diff --git a/gui/qml/BridgesItem.qml b/gui/qml/BridgesItem.qml index 1343403..f7ccb0f 100644 --- a/gui/qml/BridgesItem.qml +++ b/gui/qml/BridgesItem.qml @@ -26,15 +26,15 @@ Item { anchors.horizontalCenter: parent.horizontalCenter onClicked: { if (checked) { - Logic.setNeedsReconnect(true); - bridgeReconnect.visible = true; - app.useBridges(true); + Logic.setNeedsReconnect(true) + bridgeReconnect.visible = true + app.useBridges(true) } else { // This would also need a "needs reconnect" for de-selecting bridges the next time. // better to wait and see the new connection widgets though - Logic.setNeedsReconnect(false); - bridgeReconnect.visible = false; - app.useBridges(false); + Logic.setNeedsReconnect(false) + bridgeReconnect.visible = false + app.useBridges(false) } } } @@ -45,7 +45,7 @@ Item { color: "grey" text: qsTr("Select a bridge only if you know that you need it to evade censorship in your country or local network.") anchors.horizontalCenter: parent.horizontalCenter - wrapMode: Text.WordWrap + wrapMode: Text.WordWrap visible: !bridgeReconnect.visible } @@ -56,7 +56,7 @@ Item { color: "red" text: qsTr("An obfs4 bridge will be used the next time you connect to the VPN.") anchors.horizontalCenter: parent.horizontalCenter - wrapMode: Text.WordWrap + wrapMode: Text.WordWrap visible: false } } diff --git a/gui/qml/VPNSwitch.qml b/gui/qml/VPNSwitch.qml index 89c455f..c58836e 100644 --- a/gui/qml/VPNSwitch.qml +++ b/gui/qml/VPNSwitch.qml @@ -2,7 +2,6 @@ import QtQuick 2.9 import QtQuick.Layouts 1.12 import QtQuick.Controls 2.4 - SwitchDelegate { text: qsTr("") diff --git a/gui/qml/VpnState.qml b/gui/qml/VpnState.qml index a4bb779..31910c7 100644 --- a/gui/qml/VpnState.qml +++ b/gui/qml/VpnState.qml @@ -14,7 +14,7 @@ StateGroup { State { name: "off" StateChangeScript { - script: Logic.setStatus("off"); + script: Logic.setStatus("off") } PropertyChanges { target: systray @@ -47,16 +47,15 @@ StateGroup { name: "on" StateChangeScript { script: { - Logic.setNeedsReconnect(false); - brReconnect = false; + Logic.setNeedsReconnect(false) + brReconnect = false if (needsDonate && !shownDonate) { - donate.visible = true; - shownDonate = true; - backend.donateSeen(); + donate.visible = true + shownDonate = true + backend.donateSeen() } } - } PropertyChanges { target: systray diff --git a/gui/qml/main.qml b/gui/qml/main.qml index fef68cf..2c94c80 100644 --- a/gui/qml/main.qml +++ b/gui/qml/main.qml @@ -1,9 +1,10 @@ import QtQuick 2.9 -import QtQuick.Dialogs 1.2 // TODO use native dialogs in labs.platform +import QtQuick.Dialogs 1.2 +// TODO use native dialogs in labs.platform import QtQuick.Layouts 1.12 import QtQuick.Controls 2.4 -import Qt.labs.platform 1.0 +import Qt.labs.platform 1.0 as Labs import "logic.js" as Logic @@ -24,7 +25,7 @@ ApplicationWindow { property var needsDonate property var shownDonate - onSceneGraphError: function(error, msg) { + onSceneGraphError: function (error, msg) { console.debug("ERROR while initializing scene") console.debug(msg) } @@ -116,8 +117,8 @@ ApplicationWindow { anchors.centerIn: parent spacing: 10 - //width: parent.width + //width: parent.width RadioButton { id: autoSelectionButton checked: !isManualLocation() @@ -161,6 +162,7 @@ ApplicationWindow { color: { "#ffffff" // FIXME locations is not defined when we launch + /* const fullness = ctx.locations[modelData] if (fullness >= 0 && fullness < 0.4) { @@ -181,7 +183,6 @@ ApplicationWindow { color: "#000000" } } - } Text { @@ -190,7 +191,7 @@ ApplicationWindow { width: 180 font.pixelSize: 12 color: "green" - wrapMode: Text.WordWrap + wrapMode: Text.WordWrap text: qsTr("Reconnecting to the selected gateway…") visible: false } @@ -201,31 +202,29 @@ ApplicationWindow { width: 180 font.pixelSize: 12 color: "green" - wrapMode: Text.WordWrap + wrapMode: Text.WordWrap text: qsTr("This gateway will be used for next connection.") visible: false } - } // end column } // end item BridgesItem { id: bridgesTab } - } // end stacklayout Connections { target: jsonModel function onDataChanged() { ctx = JSON.parse(jsonModel.getJson()) + // TODO pass QML_DEBUG variable to be hyper-verbose //console.debug(jsonModel.getJson()) - gwSelector.model = Object.keys(ctx.locations) if (ctx.donateDialog == 'true') { - Logic.setNeedsDonate(true); + Logic.setNeedsDonate(true) } if (ctx.loginDialog == 'true') { console.debug(jsonModel.getJson()) @@ -294,11 +293,11 @@ ApplicationWindow { function hasMultipleGateways() { // could also count the gateways - let provider = Logic.getSelectedProvider(providers); + let provider = Logic.getSelectedProvider(providers) if (provider == "riseup") { - return true; + return true } else { - return false; + return false } } @@ -319,35 +318,34 @@ ApplicationWindow { } function showMainWindow() { - bar.currentIndex = 0 - app.visible = true - app.show() - app.raise() + bar.currentIndex = 0 + app.visible = true + app.show() + app.raise() } Component.onCompleted: { Logic.debugInit() loginDone = false allowEmptyPass = Logic.shouldAllowEmptyPass(providers) - needsRestart = false; - shownDonate = false; + needsRestart = false + shownDonate = false /* this is a temporary workaround until general GUI revamp for 0.21.8 */ - let provider = Logic.getSelectedProvider(providers); + let provider = Logic.getSelectedProvider(providers) if (provider == "calyx") { - background.color = "#8EA844"; - background.backgroundVisible = false; - gwSelector.visible = false; - manualSelectionButton.visible = false; + background.color = "#8EA844" + background.backgroundVisible = false + gwSelector.visible = false + manualSelectionButton.visible = false } if (!systrayAvailable) { - app.visible = true - app.raise() + app.visible = true + app.raise() } } - property var icons: { "off": "qrc:/assets/icon/png/white/vpn_off.png", "on": "qrc:/assets/icon/png/white/vpn_on.png", @@ -364,6 +362,7 @@ ApplicationWindow { id: systray visible: systrayVisible + /* the systray menu cannot be buried in a child qml file because * otherwise the ids are not available * from other components @@ -501,9 +500,8 @@ ApplicationWindow { if (Qt.platform.os === "windows") { let appname = ctx ? ctx.appName : "VPN" Logic.showNotification( - ctx, - appname - + " is up and running. Please use system tray icon to control it.") + ctx, appname + + " is up and running. Please use system tray icon to control it.") } } } @@ -560,13 +558,12 @@ ApplicationWindow { } function useBridges(value) { - if (value==true) { + if (value == true) { backend.setTransport("obfs4") } else { backend.setTransport("openvpn") } } - property alias brReconnect:bridgesTab.displayReconnect - + property alias brReconnect: bridgesTab.displayReconnect } diff --git a/gui/qml/readme.txt b/gui/qml/readme.txt new file mode 100644 index 0000000..e7d468c --- /dev/null +++ b/gui/qml/readme.txt @@ -0,0 +1 @@ +This folder will be deprecated. |