From 7fdad87222a963e57031132acce7c06f4b80e64d Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Mon, 6 Sep 2021 21:08:14 +0200 Subject: [ui] transient connecting state --- gui/components/SignalIcon.qml | 62 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 gui/components/SignalIcon.qml (limited to 'gui/components/SignalIcon.qml') 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 + } + } +} -- cgit v1.2.3