summaryrefslogtreecommitdiff
path: root/gui/qml/logic.js
diff options
context:
space:
mode:
Diffstat (limited to 'gui/qml/logic.js')
-rw-r--r--gui/qml/logic.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/gui/qml/logic.js b/gui/qml/logic.js
new file mode 100644
index 0000000..4fdbb99
--- /dev/null
+++ b/gui/qml/logic.js
@@ -0,0 +1,39 @@
+let status = 'off';
+let needsReconnect = false;
+
+function setStatus(st) {
+ status = st;
+}
+
+function getStatus() {
+ return status;
+}
+
+function setNeedsReconnect(val) {
+ needsReconnect = val;
+}
+
+function getNeedsReconnect() {
+ return needsReconnect;
+}
+
+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 handed yet
+ }
+}