summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2021-11-24 20:35:09 +0100
committerkali kaneko (leap communications) <kali@leap.se>2021-11-24 20:35:23 +0100
commita234a8ef5bf8564221f615d0010a810e501905bb (patch)
tree100c2d12d0ac1a9c08ec9c3ce9fcc85bf55294f7
parent4e92b1103dc0ea1eba07f2568afd1c250aee31d1 (diff)
[ui] remove old qml folder
-rw-r--r--gui/gui.qrc15
-rw-r--r--gui/qml/AboutDialog.qml40
-rw-r--r--gui/qml/BackgroundImage.qml24
-rw-r--r--gui/qml/BridgesItem.qml63
-rw-r--r--gui/qml/DonateDialog.qml26
-rw-r--r--gui/qml/FailDialog.qml27
-rw-r--r--gui/qml/LocationText.qml8
-rw-r--r--gui/qml/LoginDialog.qml46
-rw-r--r--gui/qml/LoginOKDialog.qml23
-rw-r--r--gui/qml/MainBar.qml15
-rw-r--r--gui/qml/VPNSwitch.qml46
-rw-r--r--gui/qml/VpnState.qml193
-rw-r--r--gui/qml/logic.js77
-rw-r--r--gui/qml/main.qml569
-rw-r--r--gui/qml/readme.txt1
15 files changed, 0 insertions, 1173 deletions
diff --git a/gui/gui.qrc b/gui/gui.qrc
index 3d198fe..b32c708 100644
--- a/gui/gui.qrc
+++ b/gui/gui.qrc
@@ -67,21 +67,6 @@
<file alias="roboto.ttf">resources/fonts/Roboto-Regular.ttf</file>
<file alias="roboto-bold.ttf">resources/fonts/Roboto-Bold.ttf</file>
- <!-- begin, to remove -->
- <file>qml/VpnState.qml</file>
- <file>qml/AboutDialog.qml</file>
- <file>qml/DonateDialog.qml</file>
- <file>qml/LoginDialog.qml</file>
- <file>qml/LoginOKDialog.qml</file>
- <file>qml/FailDialog.qml</file>
- <file>qml/MainBar.qml</file>
- <file>qml/BackgroundImage.qml</file>
- <file>qml/LocationText.qml</file>
- <file>qml/VPNSwitch.qml</file>
- <file>qml/BridgesItem.qml</file>
- <file>qml/logic.js</file>
- <!-- end, to remove -->
-
<file>assets/icon/png/black/vpn_off.png</file>
<file>assets/icon/png/black/vpn_on.png</file>
<file>assets/icon/png/black/vpn_wait_0.png</file>
diff --git a/gui/qml/AboutDialog.qml b/gui/qml/AboutDialog.qml
deleted file mode 100644
index 544d375..0000000
--- a/gui/qml/AboutDialog.qml
+++ /dev/null
@@ -1,40 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Dialogs 1.2
-
-MessageDialog {
- title: qsTr("About")
- text: getText()
- informativeText: getVersion()
- icon: StandardIcon.Information
-
- function getText() {
- var _name = ctx ? ctx.appName : "vpn"
- var _provider = ctx ? ctx.provider : "unknown"
- var _donateURL = ctx ? ctx.donateURL : ""
- var _tosURL = ctx ? ctx.tosURL : "…"
- var _donateTXT = ""
- if (_donateURL) {
- //: donation text of the about dialog
- _donateTXT = qsTr(
- "<p>This service is paid for entirely by donations from users like you. <a href=\"%1\">Please donate</a>.</p>").arg(
- _donateURL)
- }
- //: about dialog
- //: %1 -> application name
- //: %2 -> provider name
- //: %3 -> donation text if activated
- var _txt = qsTr(
- "<p>%1 is an easy, fast, and secure VPN service from %2. %1 does not require a user account, keep logs, or track you in any way.</p> %3 <p>By using this application, you agree to the <a href=\"%4\">Terms of Service</a>. This service is provided as-is, without any warranty, and is intended for people who work to make the world a better place.</p>").arg(
- _name).arg(_provider).arg(_donateTXT).arg(_tosURL)
- return _txt
- }
-
- function getVersion() {
- var _name = ctx ? ctx.appName : "vpn"
- var _ver = ctx ? ctx.version : "unknown"
- //: %1 -> application name
- //: %2 -> version string
- var _txt = qsTr("%1 version: %2").arg(_name).arg(_ver)
- return _txt
- }
-}
diff --git a/gui/qml/BackgroundImage.qml b/gui/qml/BackgroundImage.qml
deleted file mode 100644
index ba2a8af..0000000
--- a/gui/qml/BackgroundImage.qml
+++ /dev/null
@@ -1,24 +0,0 @@
-import QtQuick 2.9
-import QtQuick.Controls 2.4
-
-Rectangle {
-
- 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
- }
-
- Component.onCompleted: {
- /* default for riseup, needs customizing */
- backgroundSrc = "qrc:/assets/img/bird.jpg"
- }
-}
diff --git a/gui/qml/BridgesItem.qml b/gui/qml/BridgesItem.qml
deleted file mode 100644
index f7ccb0f..0000000
--- a/gui/qml/BridgesItem.qml
+++ /dev/null
@@ -1,63 +0,0 @@
-import QtQuick 2.9
-import QtQuick.Layouts 1.12
-import QtQuick.Controls 2.4
-
-import "logic.js" as Logic
-
-Item {
-
- anchors.centerIn: parent
- width: parent.width
- property alias displayReconnect: bridgeReconnect.visible
- // TODO get obfs4Available from backend, in case provider doesn't have it
- visible: true
-
- Column {
-
- anchors.centerIn: parent
- spacing: 10
- width: parent.width
-
- CheckBox {
- id: bridgeCheck
- checked: false
- text: qsTr("Use obfs4 bridges")
- font.pixelSize: 14
- anchors.horizontalCenter: parent.horizontalCenter
- onClicked: {
- if (checked) {
- 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)
- }
- }
- }
-
- Text {
- id: bridgesInfo
- width: 250
- 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
- visible: !bridgeReconnect.visible
- }
-
- Text {
- id: bridgeReconnect
- width: 250
- font.pixelSize: 12
- 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
- visible: false
- }
- }
-}
diff --git a/gui/qml/DonateDialog.qml b/gui/qml/DonateDialog.qml
deleted file mode 100644
index 1604e41..0000000
--- a/gui/qml/DonateDialog.qml
+++ /dev/null
@@ -1,26 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Dialogs 1.2
-
-MessageDialog {
- standardButtons: StandardButton.No | StandardButton.Yes
- title: qsTr("Donate")
- icon: StandardIcon.Warning
- text: getText()
-
- function getText() {
- var _name = ctx ? ctx.appName : "vpn"
- //: donate dialog
- //: %1 -> application name
- var _txt = qsTr(
- "The %1 service is expensive to run. Because we don't want to store personal information about you, there are no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month.\n\nDo you want to donate now?").arg(
- _name)
- return _txt
- }
-
- onAccepted: {
- if (backend) {
- Qt.openUrlExternally(Qt.resolvedUrl(ctx.donateURL))
- backend.donateAccepted()
- }
- }
-}
diff --git a/gui/qml/FailDialog.qml b/gui/qml/FailDialog.qml
deleted file mode 100644
index 401fa25..0000000
--- a/gui/qml/FailDialog.qml
+++ /dev/null
@@ -1,27 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Dialogs 1.2
-
-MessageDialog {
- title: qsTr("Initialization Error")
- modality: Qt.NonModal
- text: ""
- onAccepted: retryOrQuit()
- onRejected: retryOrQuit()
-
- Component.onCompleted: {
- buttons: MessageDialog.Ok
- }
-
- function retryOrQuit() {
- if (ctx.loginDialog == 'true') {
- login.visible = true
- } else {
-
- // FIXME - we probably want to distinguish
- // fatal from recoverable errors. For the time being
- // we can avoid quitting so that people can try reconnects if it's
- // a network problem, it's confusing to quit the app.
- // backend.quit()
- }
- }
-}
diff --git a/gui/qml/LocationText.qml b/gui/qml/LocationText.qml
deleted file mode 100644
index 883a8a4..0000000
--- a/gui/qml/LocationText.qml
+++ /dev/null
@@ -1,8 +0,0 @@
-import QtQuick 2.9
-
-Text {
- font.pixelSize: 10
- color: "black"
- text: qsTr("Location has been manually set.")
- anchors.horizontalCenter: parent.horizontalCenter
-}
diff --git a/gui/qml/LoginDialog.qml b/gui/qml/LoginDialog.qml
deleted file mode 100644
index 5110b14..0000000
--- a/gui/qml/LoginDialog.qml
+++ /dev/null
@@ -1,46 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Dialogs 1.2
-import QtQuick.Controls 2.12
-
-Dialog {
- title: qsTr("Login")
- standardButtons: Dialog.Ok
-
- Column {
- anchors.fill: parent
- Text {
- text: getLoginText()
- font.bold: true
- }
- Text {
- text: getDetailedText()
- }
- TextField {
- id: username
- //: Ask for the library card number
- placeholderText: qsTr("Patron ID")
- }
- TextField {
- id: password
- placeholderText: qsTr("Password")
- echoMode: TextInput.PasswordEchoOnEdit
- visible: !allowEmptyPass
- }
- }
-
- onAccepted: backend.login(username.text, password.text)
- onRejected: backend.quit()
-
- function getLoginText() {
- if (allowEmptyPass) {
- //: Ask for the library card number
- return qsTr("Enter your Patron ID")
- } else {
- return qsTr("Log in with your library credentials")
- }
- }
-
- function getDetailedText() {
- return qsTr("You can check your Patron ID number in the back of your library card")
- }
-}
diff --git a/gui/qml/LoginOKDialog.qml b/gui/qml/LoginOKDialog.qml
deleted file mode 100644
index ba57dbd..0000000
--- a/gui/qml/LoginOKDialog.qml
+++ /dev/null
@@ -1,23 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Dialogs 1.2
-import QtQuick.Controls 2.12
-
-Dialog {
- standardButtons: StandardButton.Ok
- title: qsTr("Login Successful")
- Column {
- anchors.fill: parent
- Text {
- text: qsTr("Login successful. You can now start the VPN.")
- }
- }
-
- function _loginOk() {
- visible: false
- backend.resetNotification("login_ok")
- }
-
- visible: false
- onAccepted: _loginOk()
- onRejected: _loginOk()
-}
diff --git a/gui/qml/MainBar.qml b/gui/qml/MainBar.qml
deleted file mode 100644
index a05c1a1..0000000
--- a/gui/qml/MainBar.qml
+++ /dev/null
@@ -1,15 +0,0 @@
-import QtQuick 2.9
-import QtQuick.Controls 2.4
-
-TabBar {
- width: parent.width
- TabButton {
- text: qsTr("Status")
- }
- TabButton {
- text: qsTr("Location")
- }
- TabButton {
- text: qsTr("Bridges")
- }
-}
diff --git a/gui/qml/VPNSwitch.qml b/gui/qml/VPNSwitch.qml
deleted file mode 100644
index c58836e..0000000
--- a/gui/qml/VPNSwitch.qml
+++ /dev/null
@@ -1,46 +0,0 @@
-import QtQuick 2.9
-import QtQuick.Layouts 1.12
-import QtQuick.Controls 2.4
-
-SwitchDelegate {
-
- text: qsTr("")
- checked: false
- anchors.horizontalCenter: parent.horizontalCenter
-
- contentItem: Text {
- rightPadding: vpntoggle.indicator.width + vpntoggle.spacing
- text: vpntoggle.text
- font: vpntoggle.font
- opacity: enabled ? 1.0 : 0.5
- color: vpntoggle.down ? "#17a81a" : "#21be2b"
- elide: Text.ElideRight
- verticalAlignment: Text.AlignVCenter
- }
-
- indicator: Rectangle {
- implicitWidth: 48
- implicitHeight: 26
- x: vpntoggle.width - width - vpntoggle.rightPadding
- y: parent.height / 2 - height / 2
- radius: 13
- color: vpntoggle.checked ? "#17a81a" : "transparent"
- border.color: vpntoggle.checked ? "#17a81a" : "#cccccc"
-
- Rectangle {
- x: vpntoggle.checked ? parent.width - width : 0
- width: 26
- height: 26
- radius: 13
- color: vpntoggle.down ? "#cccccc" : "#ffffff"
- border.color: vpntoggle.checked ? (vpntoggle.down ? "#17a81a" : "#21be2b") : "#999999"
- }
- }
-
- background: Rectangle {
- implicitWidth: 100
- implicitHeight: 40
- visible: vpntoggle.down || vpntoggle.highlighted
- color: vpntoggle.down ? "#17a81a" : "#eeeeee"
- }
-} // end switchdelegate
diff --git a/gui/qml/VpnState.qml b/gui/qml/VpnState.qml
deleted file mode 100644
index 31910c7..0000000
--- a/gui/qml/VpnState.qml
+++ /dev/null
@@ -1,193 +0,0 @@
-import QtQuick 2.0
-import QtQuick.Controls 2.12
-
-import "logic.js" as Logic
-
-StateGroup {
-
- state: ctx ? ctx.status : ""
-
- states: [
- State {
- name: "initializing"
- },
- State {
- name: "off"
- StateChangeScript {
- script: Logic.setStatus("off")
- }
- PropertyChanges {
- target: systray
- tooltip: Logic.toHuman("off")
- icon.source: icons["off"]
- }
- PropertyChanges {
- target: vpntoggle
- checked: false
- checkable: true
- }
- PropertyChanges {
- target: statusItem
- text: Logic.toHuman("off")
- }
- PropertyChanges {
- target: autoSelectionItem
- text: qsTr("Recommended")
- }
- PropertyChanges {
- target: mainStatus
- text: Logic.toHuman("off")
- }
- PropertyChanges {
- target: mainCurrentGateway
- text: ""
- }
- },
- State {
- name: "on"
- StateChangeScript {
- script: {
- Logic.setNeedsReconnect(false)
- brReconnect = false
-
- if (needsDonate && !shownDonate) {
- donate.visible = true
- shownDonate = true
- backend.donateSeen()
- }
- }
- }
- PropertyChanges {
- target: systray
- tooltip: Logic.toHuman("on")
- icon.source: icons["on"]
- }
- PropertyChanges {
- target: vpntoggle
- checked: true
- checkable: true
- }
- PropertyChanges {
- target: statusItem
- text: Logic.toHuman("on")
- }
- PropertyChanges {
- target: autoSelectionItem
- text: {
- if (autoSelectionButton.checked) {
- //: %1 -> location to which the client is connected to
- qsTr("Recommended (%1)").arg(locationStr())
- } else {
- qsTr("Recommended")
- }
- }
- }
- PropertyChanges {
- target: mainStatus
- text: Logic.toHuman("on")
- }
- PropertyChanges {
- target: mainCurrentGateway
- //: %1 -> location to which the client is connected to
- text: qsTr("Connected to %1").arg(locationStr())
- }
- },
- State {
- name: "starting"
- PropertyChanges {
- target: systray
- tooltip: Logic.toHuman("connecting")
- icon.source: icons["wait"]
- }
- PropertyChanges {
- target: statusItem
- text: Logic.toHuman("connecting")
- }
- PropertyChanges {
- target: autoSelectionItem
- text: {
- if (autoSelectionButton.checked) {
- //: %1 -> location to which the client is connected to
- qsTr("Recommended (%1)").arg(locationStr())
- } else {
- //: Clickable item to switch to the recommended location
- qsTr("Recommended")
- }
- }
- }
- PropertyChanges {
- target: mainStatus
- text: qsTr("Connecting…")
- }
- PropertyChanges {
- target: mainCurrentGateway
- text: ""
- }
- PropertyChanges {
- target: vpntoggle
- checked: true
- checkable: false
- }
- },
- State {
- name: "stopping"
- PropertyChanges {
- target: systray
- tooltip: Logic.toHuman("stopping")
- icon.source: icons["wait"]
- }
- PropertyChanges {
- target: statusItem
- text: Logic.toHuman("stopping")
- }
- PropertyChanges {
- target: autoSelectionItem
- //: Clickable item to switch to the recommended location
- text: qsTr("Recommended")
- }
- PropertyChanges {
- target: mainStatus
- text: Logic.toHuman("stopping")
- }
- PropertyChanges {
- target: mainCurrentGateway
- text: ""
- }
- PropertyChanges {
- target: vpntoggle
- checked: false
- checkable: false
- }
- },
- State {
- name: "failed"
- PropertyChanges {
- target: systray
- tooltip: Logic.toHuman("failed")
- icon.source: icons["wait"]
- }
- PropertyChanges {
- target: statusItem
- text: Logic.toHuman("failed")
- }
- PropertyChanges {
- target: autoSelectionItem
- //: Clickable item to swicth to the recommended location
- text: qsTr("Recommended")
- }
- PropertyChanges {
- target: mainStatus
- text: Logic.toHuman("failed")
- }
- PropertyChanges {
- target: mainCurrentGateway
- text: ""
- }
- PropertyChanges {
- target: vpntoggle
- checked: false
- checkable: true
- }
- }
- ]
-}
diff --git a/gui/qml/logic.js b/gui/qml/logic.js
deleted file mode 100644
index 4709008..0000000
--- a/gui/qml/logic.js
+++ /dev/null
@@ -1,77 +0,0 @@
-var status = 'off';
-var needsReconnect = false;
-
-function setNeedsReconnect(val) {
- needsReconnect = val;
-}
-
-function getNeedsReconnect() {
- return needsReconnect;
-}
-
-function setStatus(st) {
- status = st;
-}
-
-function getStatus() {
- return status;
-}
-
-function setNeedsDonate(val) {
- needsDonate = val;
-}
-
-function toHuman(st) {
- switch (st) {
- case "off":
- //: %1 -> application name
- return qsTr("%1 off").arg(ctx.appName)
- case "on":
- //: %1 -> application name
- return qsTr("%1 on").arg(ctx.appName)
- case "connecting":
- //: %1 -> application name
- return qsTr("Connecting to %1").arg(ctx.appName)
- case "stopping":
- //: %1 -> application name
- 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
- }
-}
-
-// Helper to show notification messages
-function showNotification(ctx, msg) {
- console.log("Going to show notification message: ", msg)
- if (supportsMessages) {
- let appname = ctx ? ctx.appName : "VPN"
- showMessage(appname, msg, null, 15000)
- } else {
- console.log("System doesn't support systray notifications")
- }
-}
-
-function shouldAllowEmptyPass(providers) {
- let obj = JSON.parse(providers.getJson())
- let active = obj['default']
- let allProviders = obj['providers']
- for (var i = 0; i < allProviders.length; i++) {
- if (allProviders[i]['name'] === active) {
- return (allProviders[i]['authEmptyPass'] === 'true')
- }
- }
- return false
-}
-
-function getSelectedProvider(providers) {
- let obj = JSON.parse(providers.getJson())
- return obj['default']
-}
-
-function debugInit() {
- console.debug("Platform:", Qt.platform.os)
- console.debug("DEBUG: Pre-seeded providers:")
- console.debug(providers.getJson())
-}
diff --git a/gui/qml/main.qml b/gui/qml/main.qml
deleted file mode 100644
index 2c94c80..0000000
--- a/gui/qml/main.qml
+++ /dev/null
@@ -1,569 +0,0 @@
-import QtQuick 2.9
-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 as Labs
-
-import "logic.js" as Logic
-
-ApplicationWindow {
- id: app
- visible: false
- width: 300
- height: 600
- maximumWidth: 300
- minimumWidth: 300
- maximumHeight: 500
- minimumHeight: 300
-
- property var ctx
- property var loginDone
- property var allowEmptyPass
- property var needsRestart
- property var needsDonate
- property var shownDonate
-
- onSceneGraphError: function (error, msg) {
- console.debug("ERROR while initializing scene")
- console.debug(msg)
- }
-
- MainBar {
- id: bar
- }
-
- StackLayout {
-
- anchors.fill: parent
- currentIndex: bar.currentIndex
-
- Item {
-
- id: infoTab
- anchors.centerIn: parent
-
- BackgroundImage {
- id: background
- }
-
- Item {
- id: connBox
- anchors.centerIn: parent
-
- width: 300
- height: 300
-
- Rectangle {
- anchors.fill: parent
- color: "white"
- opacity: 0.3
- layer.enabled: true
- }
-
- Column {
-
- anchors.centerIn: parent
- spacing: 5
-
- Text {
- id: mainStatus
- text: "off"
- font.pixelSize: 26
- anchors.horizontalCenter: parent.horizontalCenter
- }
-
- Text {
- id: mainCurrentGateway
- text: ""
- font.pixelSize: 20
- anchors.horizontalCenter: parent.horizontalCenter
- }
-
- VPNSwitch {
- id: vpntoggle
-
- Connections {
- function onCheckedChanged() {
- if (vpntoggle.checked == true
- && ctx.status == "off") {
- backend.switchOn()
- vpntoggle.checkable = false
- }
- if (vpntoggle.checked === false
- && ctx.status == "on") {
- backend.switchOff()
- vpntoggle.checkable = false
- }
- }
- }
- }
-
- LocationText {
- id: manualOverrideWarning
- visible: isManualLocation()
- }
- } // end column
- } // end inner item
- } // end outer item
-
- Item {
-
- id: gatewayTab
- anchors.centerIn: parent
-
- Column {
-
- anchors.centerIn: parent
- spacing: 10
-
- //width: parent.width
- RadioButton {
- id: autoSelectionButton
- checked: !isManualLocation()
- text: qsTr("Recommended")
- onClicked: {
- backend.useAutomaticGateway()
- manualSelectionItem.checked = false
- }
- }
-
- RadioButton {
- id: manualSelectionButton
- checked: isManualLocation()
- text: qsTr("Manual")
- onClicked: setGwSelection()
- }
-
- ComboBox {
- id: gwSelector
- editable: false
- visible: manualSelectionButton.checked
- anchors.horizontalCenter: parent.horizontalCenter
-
- model: [qsTr("Recommended")]
- onActivated: {
- console.debug("Selected gateway:", currentText)
- if (ctx.status == "off") {
- gwNextConnectionText.visible = true
- }
- if (ctx.status == "on") {
- gwReconnectText.visible = true
- }
- backend.useLocation(currentText.toString())
- manualSelectionItem.checked = true
- }
-
- delegate: ItemDelegate {
- // TODO: we could use icons
- // https://doc.qt.io/qt-5/qml-qtquick-controls2-abstractbutton.html#icon-prop
- background: Rectangle {
- color: {
- "#ffffff"
- // FIXME locations is not defined when we launch
-
- /*
- const fullness = ctx.locations[modelData]
- if (fullness >= 0 && fullness < 0.4) {
- "#83fc5a"
- } else if (fullness >= 0.4 && fullness < 0.75) {
- "#fcb149"
- } else if (fullness >= 0.75) {
- "#fc5a5d"
- } else {
- "#ffffff"
- }
- */
- }
- }
- contentItem: Text {
- text: modelData
- font: gwSelector.font
- color: "#000000"
- }
- }
- }
-
- Text {
- id: gwReconnectText
- anchors.horizontalCenter: parent.horizontalCenter
- width: 180
- font.pixelSize: 12
- color: "green"
- wrapMode: Text.WordWrap
- text: qsTr("Reconnecting to the selected gateway…")
- visible: false
- }
-
- Text {
- id: gwNextConnectionText
- anchors.horizontalCenter: parent.horizontalCenter
- width: 180
- font.pixelSize: 12
- color: "green"
- 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)
- }
- if (ctx.loginDialog == 'true') {
- console.debug(jsonModel.getJson())
- console.debug("DEBUG: should display login")
- login.visible = true
- }
- if (ctx.loginOk == 'true') {
- loginOk.visible = true
- }
- if (ctx.errors) {
- login.visible = false
- if (ctx.errors == "nohelpers") {
- showInitFailure(
- qsTr("Could not find helpers. Please check your installation"))
- } else if (ctx.errors == "nopolkit") {
- showInitFailure(qsTr("Could not find polkit agent."))
- } else {
- showInitFailure()
- }
- }
- if (ctx.donateURL) {
- donateItem.visible = true
- }
-
- if (ctx.status == "on") {
- gwNextConnectionText.visible = false
- gwReconnectText.visible = false
- }
- }
- }
-
- function showInitFailure(msg) {
- console.debug("ERRORS:", ctx.errors)
- if (msg == undefined) {
- if (ctx.errors == 'bad_auth_502'
- || ctx.errors == 'bad_auth_timeout') {
- msg = qsTr("Oops! The authentication service seems down. Please try again later")
- initFailure.title = qsTr("Service Error")
- } else if (ctx.errors == 'bad_auth') {
- if (allowEmptyPass) {
- // For now, this is a libraryVPN, so we can be explicit about what credentials are here.
- // Another option to consider is to customize the error strings while vendoring.
- //: Incorrect library card number
- msg = qsTr("Please check your Patron ID")
- } else {
- msg = qsTr("Could not log in with those credentials, please retry")
- }
- initFailure.title = qsTr("Login Error")
- } else {
- //: %1 -> application name
- //: %2 -> error string
- msg = qsTr("Got an error starting %1: %2").arg(ctx.appName).arg(
- ctx.errors)
- }
- }
- initFailure.text = msg
- initFailure.visible = true
- }
-
- function isManualLocation() {
- if (!ctx) {
- return false
- }
- return ctx.manualLocation == "true"
- }
-
- function hasMultipleGateways() {
- // could also count the gateways
- let provider = Logic.getSelectedProvider(providers)
- if (provider == "riseup") {
- return true
- } else {
- return false
- }
- }
-
- function setGwSelection() {
- if (!isManualLocation()) {
- manualSelectionItem.checked = false
- bar.currentIndex = 1
- app.visible = true
- app.show()
- app.raise()
- return
- }
- // last used manual selection
- const location = ctx.currentLocation.toLowerCase()
- const idx = gwSelector.model.indexOf(location)
- gwSelector.currentIndex = idx
- backend.useLocation(location)
- }
-
- function showMainWindow() {
- bar.currentIndex = 0
- app.visible = true
- app.show()
- app.raise()
- }
-
- Component.onCompleted: {
- Logic.debugInit()
- loginDone = false
- allowEmptyPass = Logic.shouldAllowEmptyPass(providers)
- needsRestart = false
- shownDonate = false
-
- /* this is a temporary workaround until general GUI revamp for 0.21.8 */
- let provider = Logic.getSelectedProvider(providers)
- if (provider == "calyx") {
- background.color = "#8EA844"
- background.backgroundVisible = false
- gwSelector.visible = false
- manualSelectionButton.visible = false
- }
-
- if (!systrayAvailable) {
- 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",
- "wait": "qrc:/assets/icon/png/white/vpn_wait_0.png",
- "blocked": "qrc:/assets/icon/png/white/vpn_blocked.png"
- }
-
- VpnState {
- id: vpn
- }
-
- SystemTrayIcon {
-
- 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
- */
- menu: Menu {
-
- id: systrayMenu
-
- MenuItem {
- id: statusItem
- text: qsTr("Checking status…")
- enabled: false
- }
-
- MenuSeparator {}
-
- MenuItem {
- id: autoSelectionItem
- text: qsTr("Recommended")
- checkable: true
- checked: !isManualLocation()
- onTriggered: {
- backend.useAutomaticGateway()
- manualSelectionItem.checked = false
- }
- }
-
- /* a minimal segfault for submenu */
- // Menu {}
- MenuItem {
- id: manualSelectionItem
- text: {
- if (isManualLocation() != "") {
- locationStr()
- } else {
- qsTr("Pick location…")
- }
- }
- checkable: true
- checked: isManualLocation()
- onTriggered: setGwSelection()
- visible: hasMultipleGateways()
- }
-
- MenuItem {
- text: qsTr("Preferences…")
- visible: !hasMultipleGateways()
- onTriggered: showMainWindow()
- }
-
- MenuSeparator {}
-
- MenuItem {
- text: {
- if (vpn.state == "failed")
- qsTr("Reconnect")
- else
- qsTr("Turn on")
- }
- onTriggered: {
- backend.switchOn()
- }
- visible: ctx ? (ctx.status == "off"
- || ctx.status == "failed") : false
- }
-
- MenuItem {
- text: {
- if (ctx && ctx.status == "starting")
- qsTr("Cancel")
- else
- qsTr("Turn off")
- }
- onTriggered: {
- backend.switchOff()
- }
- visible: ctx ? (ctx.status == "on" || ctx.status == "starting"
- || ctx.status == "failed") : false
- }
-
- MenuSeparator {}
-
- MenuItem {
- text: qsTr("About…")
- onTriggered: {
- about.visible = true
- requestActivate()
- }
- }
-
- MenuItem {
- id: donateItem
- text: qsTr("Donate…")
- visible: ctx ? ctx.donateURL : false
- onTriggered: {
- donate.visible = true
- }
- }
-
- MenuSeparator {}
-
- MenuItem {
- text: qsTr("Help…")
-
- onTriggered: {
- console.debug(Qt.resolvedUrl(ctx.helpURL))
- Qt.openUrlExternally(Qt.resolvedUrl(ctx.helpURL))
- }
- }
-
- MenuItem {
- text: qsTr("Report a bug…")
-
- onTriggered: {
- Qt.openUrlExternally(
- Qt.resolvedUrl(
- "https://0xacab.org/leap/bitmask-vpn/issues"))
- }
- }
-
- MenuSeparator {}
-
- MenuItem {
- text: qsTr("Quit")
- onTriggered: backend.quit()
- }
- }
-
- Component.onCompleted: {
- systray.icon.source = icons["off"]
- tooltip = qsTr("Checking status…")
- console.debug("systray init completed")
- if (systrayVisible) {
- console.log("show systray")
- 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.")
- }
- }
- }
- }
-
- DonateDialog {
- id: donate
- visible: false
- }
-
- AboutDialog {
- id: about
- visible: false
- }
-
- LoginDialog {
- id: login
- visible: false
- }
-
- LoginOKDialog {
- id: loginOk
- visible: false
- }
-
- MessageDialog {
- id: errorStartingVPN
- modality: Qt.NonModal
- title: qsTr("Error starting VPN")
- text: ""
- detailedText: ""
- visible: false
- }
-
- MessageDialog {
- id: authAgent
- modality: Qt.NonModal
- title: qsTr("Missing authentication agent")
- text: qsTr("Could not find a polkit authentication agent. Please run one and try again.")
- visible: false
- }
-
- FailDialog {
- id: initFailure
- visible: false
- }
-
- function locationStr() {
- if (ctx.currentLocation && ctx.currentCountry) {
- return ctx.currentLocation + ", " + ctx.currentCountry
- } else {
- return ""
- }
- }
-
- function useBridges(value) {
- if (value == true) {
- backend.setTransport("obfs4")
- } else {
- backend.setTransport("openvpn")
- }
- }
-
- property alias brReconnect: bridgesTab.displayReconnect
-}
diff --git a/gui/qml/readme.txt b/gui/qml/readme.txt
deleted file mode 100644
index e7d468c..0000000
--- a/gui/qml/readme.txt
+++ /dev/null
@@ -1 +0,0 @@
-This folder will be deprecated.