summaryrefslogtreecommitdiff
path: root/gui/components
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2022-01-25 19:54:21 +0100
committerkali kaneko (leap communications) <kali@leap.se>2022-02-02 12:38:15 +0100
commitfca2ee8d7aeee99e3e24a8cab90c17d7b7c34494 (patch)
tree2fe322f5a3ded25c955328cb3a6d60303227b711 /gui/components
parent3b138181fe893cacf2c39cf224cc9d3ef91da5a4 (diff)
[feat] expose snowflake to ui
Diffstat (limited to 'gui/components')
-rw-r--r--gui/components/StatusBox.qml29
-rw-r--r--gui/components/VPNState.qml64
2 files changed, 92 insertions, 1 deletions
diff --git a/gui/components/StatusBox.qml b/gui/components/StatusBox.qml
index 7715123..5929033 100644
--- a/gui/components/StatusBox.qml
+++ b/gui/components/StatusBox.qml
@@ -80,9 +80,32 @@ Item {
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
- text: ""
FadeBehavior on text { }
}
+ Label {
+ id: snowflakeTip
+ anchors.top: connectionState.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.topMargin: 20
+ horizontalAlignment: Text.AlignHCenter
+ text: qsTr("This can take several minutes")
+ font.pixelSize: Theme.fontSize * 0.8
+ visible: isSnowflakeOn()
+ }
+ ProgressBar {
+ id: snowflakeProgressBar
+ anchors.top: snowflakeTip.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ visible: isSnowflakeOn()
+ value: 0
+ }
+ Label {
+ id: snowflakeTag
+ anchors.top: snowflakeProgressBar.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ horizontalAlignment: Text.AlignHCenter
+ visible: isSnowflakeOn()
+ }
}
Column {
@@ -156,4 +179,8 @@ Item {
}
}
}
+
+ function isSnowflakeOn() {
+ return ctx != undefined && ctx.snowflakeProgress != "" && ctx.snowflakeProgress != "100"
+ }
}
diff --git a/gui/components/VPNState.qml b/gui/components/VPNState.qml
index eeeb51d..3a8d49a 100644
--- a/gui/components/VPNState.qml
+++ b/gui/components/VPNState.qml
@@ -20,10 +20,37 @@ StateGroup {
name: initializing
},
State {
+ when: ctx != undefined && ctx.snowflakeProgress != "" && ctx.snowflakeProgress != "100"
+ // TODO animate image
+ PropertyChanges {
+ target: connectionState
+ text: qsTr("Setting up")
+ font.pixelSize: Theme.fontSize * 1
+ }
+ PropertyChanges {
+ target: snowflakeProgressBar
+ value: parseInt(ctx.snowflakeProgress)/100
+ }
+ PropertyChanges {
+ target: snowflakeTag
+ text: getSnowflakeTag()
+ }
+ PropertyChanges {
+ target: statusBoxBackground
+ border.color: Theme.accentConnecting
+ }
+ PropertyChanges {
+ target: connectionImage
+ source: Theme.iconSnowflake
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ },
+ State {
when: ctx != undefined && ctx.status == "off" && startingUI == true
PropertyChanges {
target: connectionState
text: qsTr("Connecting")
+ font.pixelSize: Theme.fontSize * 1.5
}
PropertyChanges {
target: statusBoxBackground
@@ -56,6 +83,8 @@ StateGroup {
PropertyChanges {
target: connectionState
text: qsTr("Unsecured\nConnection")
+ font.pixelSize: Theme.fontSize * 1.5
+ visible: true
}
PropertyChanges {
target: statusBoxBackground
@@ -89,6 +118,8 @@ StateGroup {
PropertyChanges {
target: connectionState
text: qsTr("Secured\nConnection")
+ font.pixelSize: Theme.fontSize * 1.5
+ visible: true
}
PropertyChanges {
target: statusBoxBackground
@@ -123,6 +154,8 @@ StateGroup {
PropertyChanges {
target: connectionState
text: qsTr("Connecting")
+ font.pixelSize: Theme.fontSize * 1.5
+ visible: true
}
PropertyChanges {
target: statusBoxBackground
@@ -236,4 +269,35 @@ StateGroup {
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
+ }
+ }
}