diff --git a/gui/components/Footer.qml b/gui/components/Footer.qml index 3c3664bd44ccda24e7728f3002304a040ef880bc..c7bca503fc40f14d1f033940f77f4d22e289e1fa 100644 --- a/gui/components/Footer.qml +++ b/gui/components/Footer.qml @@ -126,9 +126,9 @@ ToolBar { function getSignalColor() { if (ctx && ctx.status == "on") { - return "green" + return "green"; } else { - return "black" + return "black"; } } @@ -155,79 +155,79 @@ ToolBar { function locationStr() { if (ctx && ctx.status == "on") { if (ctx.currentLocation && ctx.currentCountry) { - let s = ctx.currentLocation + ", " + ctx.currentCountry + let s = ctx.currentLocation + ", " + ctx.currentCountry; /* if (root.selectedGateway == "auto") { s = "🗲 " + s } */ - return s + return s; } } if (root.selectedGateway == "auto") { if (ctx && ctx.locations && ctx.bestLocation) { //return "🗲 " + getCanonicalLocation(ctx.bestLocation) - return getCanonicalLocation(ctx.bestLocation) + return getCanonicalLocation(ctx.bestLocation); } else { - return qsTr("Recommended") + return qsTr("Recommended"); } } if (ctx && ctx.locations && ctx.locationLabels) { - return getCanonicalLocation(root.selectedGateway) + return getCanonicalLocation(root.selectedGateway); } } // returns the composite of Location, CC function getCanonicalLocation(label) { try { - let loc = ctx.locationLabels[label] - return loc[0] + ", " + loc[1] - } catch(e) { - return "unknown" + let loc = ctx.locationLabels[label]; + return loc[0] + ", " + loc[1]; + } catch (e) { + return "unknown"; } } function getLocationColor() { if (ctx && ctx.status == "on") { - return "black" + return "black"; } else { // TODO darker gray - return "gray" + return "gray"; } } function hasMultipleGateways() { - let provider = getSelectedProvider(providers) + let provider = getSelectedProvider(providers); if (provider == "riseup") { - return true + return true; } else { if (!ctx) { - return false + return false; } - return ctx.locations.length > 0 + return ctx.locations.length > 0; } } function getSelectedProvider(providers) { - let obj = JSON.parse(providers.getJson()) - return obj['default'] + let obj = JSON.parse(providers.getJson()); + return obj['default']; } function isBridgeSelected() { if (ctx && ctx.transport == "obfs4") { - return true + return true; } else { - return false + return false; } } function isFooterVisible() { if (drawerOn) { - return false + return false; } if (stackView.depth > 1) { - return false + return false; } - return true + return true; } } diff --git a/gui/components/MainView.qml b/gui/components/MainView.qml index bbc6ab32c1b02450659e7d2fdbe818c08f42b769..3c17947c3f83b35104205443d5e46a0e3d6fb153 100644 --- a/gui/components/MainView.qml +++ b/gui/components/MainView.qml @@ -3,14 +3,14 @@ import QtQuick.Controls import QtQuick.Dialogs import QtQuick.Controls.Material import QtQuick.Layouts - import "../themes/themes.js" as Theme Page { StackView { id: stackView anchors.fill: parent - initialItem: Home {} + initialItem: Home { + } } NavigationDrawer { @@ -28,56 +28,58 @@ Page { width: parent.width text: model.text visible: { - if (isDonationService) {return true} - return model.text != qsTr("Donate") + if (isDonationService) { + return true; + } + return model.text != qsTr("Donate"); } highlighted: ListView.isCurrentItem icon.color: "transparent" icon.source: model.icon onClicked: { - settingsDrawer.toggle() - model.triggered() + settingsDrawer.toggle(); + model.triggered(); } } } } - } + } - ListModel { + ListModel { id: navModel ListElement { text: qsTr("Preferences") icon: "../resources/tools.svg" - triggered: function() { - stackView.push("Preferences.qml") + triggered: function () { + stackView.push("Preferences.qml"); } } ListElement { text: qsTr("Donate") icon: "../resources/donate.svg" - triggered: function() { - Qt.openUrlExternally(ctx.donateURL) + triggered: function () { + Qt.openUrlExternally(ctx.donateURL); } } ListElement { text: qsTr("Help") icon: "../resources/help.svg" - triggered: function() { - stackView.push("Help.qml") + triggered: function () { + stackView.push("Help.qml"); } } // -> can link to another dialog with report bug / support / contribute / FAQ ListElement { text: qsTr("About") icon: "../resources/about.svg" - triggered: function() { - stackView.push("About.qml") + triggered: function () { + stackView.push("About.qml"); } } ListElement { text: qsTr("Quit") icon: "../resources/quit.svg" - triggered: function() { - Qt.callLater(backend.quit) + triggered: function () { + Qt.callLater(backend.quit); } } } // end listmodel @@ -93,13 +95,13 @@ Page { // shortcuts for avid users :) // bug: doesnt work until the stack is pushed once if (event.key == Qt.Key_G && stackView.depth == 1) { - console.debug("Open Locations") - stackView.push("Locations.qml") + console.debug("Open Locations"); + stackView.push("Locations.qml"); } } Dialog { - id: donateDialog + id: donateDialog width: root.appWidth title: qsTr("Please donate!") standardButtons: Dialog.Yes | Dialog.No @@ -131,7 +133,6 @@ Page { onLinkActivated: Qt.openUrlExternally(ctx.donateURL) } - Image { height: 40 source: "../resources/donate.svg" @@ -147,14 +148,14 @@ Page { } function getLink(ctx) { - if (!ctx) { - return "" - } - let url = ctx.donateURL - return "<style>a:link {color:'" + Theme.blue + "'; }</style><a href='#'>" + url + "</a>" + if (!ctx) { + return ""; + } + let url = ctx.donateURL; + return "<style>a:link {color:'" + Theme.blue + "'; }</style><a href='#'>" + url + "</a>"; } Component.onCompleted: { - root.openDonateDialog.connect(donateDialog.open) + root.openDonateDialog.connect(donateDialog.open); } } diff --git a/gui/components/StatusBox.qml b/gui/components/StatusBox.qml index a5024ae2c5b0772f57aa279832226a0079e0ee4d..8bd2fe2cbe63581d52465000e3eb03df21cbfdb4 100644 --- a/gui/components/StatusBox.qml +++ b/gui/components/StatusBox.qml @@ -2,12 +2,10 @@ import QtQuick import QtQuick.Controls import QtQuick.Effects import QtQuick.Layouts - import QtQuick.Templates as T import QtQuick.Controls.impl import QtQuick.Controls.Material import QtQuick.Controls.Material.impl - import "../themes/themes.js" as Theme Item { @@ -80,7 +78,8 @@ Item { anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter - FadeBehavior on text { } + FadeBehavior on text { + } } Label { id: snowflakeTip @@ -139,8 +138,8 @@ Item { duration: 1000 } onStatusChanged: { - playing = (status == AnimatedImage.Ready) - fadeIn.start() + playing = (status == AnimatedImage.Ready); + fadeIn.start(); } } @@ -170,18 +169,18 @@ Item { onClicked: { if (vpn.state === "on" | vpn.state === "starting") { - backend.switchOff() + backend.switchOff(); } else if (vpn.state === "off") { - vpn.startingUI = true - backend.switchOn() + vpn.startingUI = true; + backend.switchOn(); } else { - console.debug("unknown state") + console.debug("unknown state"); } } } } function isSnowflakeOn() { - return ctx != undefined && ctx.snowflake == "true" && ctx.snowflakeProgress != "100" + return ctx != undefined && ctx.snowflake == "true" && ctx.snowflakeProgress != "100"; } } diff --git a/gui/components/VPNState.qml b/gui/components/VPNState.qml index acd2b2e5ed030ca25bc7dfaf0fad1af501b5639b..4882d0a20ef1f15a8a9b29309ac430300d426bfc 100644 --- a/gui/components/VPNState.qml +++ b/gui/components/VPNState.qml @@ -1,6 +1,5 @@ import QtQuick import QtQuick.Controls - import "../themes/themes.js" as Theme StateGroup { @@ -29,7 +28,7 @@ StateGroup { } PropertyChanges { target: snowflakeProgressBar - value: parseInt(ctx.snowflakeProgress)/100 + value: parseInt(ctx.snowflakeProgress) / 100 } PropertyChanges { target: snowflakeTag @@ -109,7 +108,7 @@ StateGroup { } StateChangeScript { script: { - console.debug("status off") + console.debug("status off"); } } }, @@ -145,7 +144,7 @@ StateGroup { } StateChangeScript { script: { - vpn.startingUI = false + vpn.startingUI = false; } } }, @@ -182,7 +181,7 @@ StateGroup { } StateChangeScript { script: { - vpn.startingUI = false + vpn.startingUI = false; } } }, @@ -253,51 +252,50 @@ StateGroup { switch (st) { case "off": //: %1 -> application name - return ctx ? qsTr("%1 off").arg(ctx.appName) : qsTr("off") + return ctx ? qsTr("%1 off").arg(ctx.appName) : qsTr("off"); case "on": //: %1 -> application name - return qsTr("%1 on").arg(ctx.appName) + return qsTr("%1 on").arg(ctx.appName); case "connecting": //: %1 -> application name - return qsTr("Connecting to %1").arg(ctx.appName) + return qsTr("Connecting to %1").arg(ctx.appName); case "stopping": //: %1 -> application name - return qsTr("Stopping %1").arg(ctx.appName) + return qsTr("Stopping %1").arg(ctx.appName); case "failed": //: %1 -> application name - return qsTr("%1 blocking internet").arg( - ctx.appName) // TODO failed is not handled yet + return qsTr("%1 blocking internet").arg(ctx.appName); // TODO failed is not handled yet } } function getSnowflakeTag() { switch (ctx.snowflakeTag) { - case 'conn_pt': - return qsTr("pluggable transport connection") - case 'conn_done': - return qsTr("connection done") - case 'handshake': - return qsTr("doing handshake") - case 'handshake_done': - return qsTr("handshake done") - case 'onehop_create': - return qsTr("creating one-hop connection") - case 'requesting_status': - return qsTr("requesting status") - case 'loading_status': - return qsTr("loading status") - case 'loading_keys': - return qsTr("loading keys") - case 'requesting_descriptors': - return qsTr("requesting descriptors") - case 'loading_descriptors': - return qsTr("loading descriptors") - case 'circuit_create': - return qsTr("creating circuit") - case 'done': - return qsTr("done") - default: - return ctx.snowflakeTag + case 'conn_pt': + return qsTr("pluggable transport connection"); + case 'conn_done': + return qsTr("connection done"); + case 'handshake': + return qsTr("doing handshake"); + case 'handshake_done': + return qsTr("handshake done"); + case 'onehop_create': + return qsTr("creating one-hop connection"); + case 'requesting_status': + return qsTr("requesting status"); + case 'loading_status': + return qsTr("loading status"); + case 'loading_keys': + return qsTr("loading keys"); + case 'requesting_descriptors': + return qsTr("requesting descriptors"); + case 'loading_descriptors': + return qsTr("loading descriptors"); + case 'circuit_create': + return qsTr("creating circuit"); + case 'done': + return qsTr("done"); + default: + return ctx.snowflakeTag; } } }