summaryrefslogtreecommitdiff
path: root/gui/components/SignalIcon.qml
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2021-09-06 21:08:14 +0200
committerkali kaneko (leap communications) <kali@leap.se>2021-11-23 21:51:01 +0100
commit8543125fa656ddc2c114072adfc27e4e7c461695 (patch)
tree176f90c03f64c2645932dbaf3d87f2ad22b61489 /gui/components/SignalIcon.qml
parentb8e0fe3b5003d22043042110e8036f4383602545 (diff)
[ui] transient connecting state
Diffstat (limited to 'gui/components/SignalIcon.qml')
-rw-r--r--gui/components/SignalIcon.qml62
1 files changed, 62 insertions, 0 deletions
diff --git a/gui/components/SignalIcon.qml b/gui/components/SignalIcon.qml
new file mode 100644
index 0000000..63bde5c
--- /dev/null
+++ b/gui/components/SignalIcon.qml
@@ -0,0 +1,62 @@
+import QtQuick 2.9
+import QtQuick.Controls 2.2
+import QtQuick.Layouts 1.14
+import QtGraphicalEffects 1.0
+
+import "../themes/themes.js" as Theme
+
+Image {
+ id: icon
+ height: 16
+ width: 16
+ // one of: good, medium, low
+ property var quality: "good"
+
+ ColorOverlay{
+ anchors.fill: icon
+ source: icon
+ color: getQualityColor()
+ antialiasing: true
+ }
+
+ StateGroup {
+ state: quality
+ states: [
+ State {
+ name: "good"
+ PropertyChanges {
+ target: icon
+ source: "../resources/reception-4.svg"
+ }
+ },
+ State {
+ name: "medium"
+ PropertyChanges {
+ target: icon
+ source: "../resources/reception-2.svg"
+ }
+ },
+ State {
+ name: "low"
+ PropertyChanges {
+ target: icon
+ source: "../resources/reception-0.svg"
+ }
+ }
+ ]
+ }
+
+ function getQualityColor() {
+ // I like this better than with states
+ switch (quality) {
+ case "good":
+ return Theme.signalGood
+ case "medium":
+ return Theme.signalMedium
+ case "low":
+ return Theme.signalLow
+ default:
+ return Theme.signalGood
+ }
+ }
+}