From 5ff2eb132351f5a289e177300c9472af0616c550 Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Mon, 4 Oct 2021 17:31:41 +0200 Subject: [ui] lightning icon as svg --- gui/components/Footer.qml | 40 ++++++++++++++---- gui/gui.qrc | 1 + gui/main.qml | 8 ++-- gui/resources/lightning.svg | 100 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 138 insertions(+), 11 deletions(-) create mode 100644 gui/resources/lightning.svg diff --git a/gui/components/Footer.qml b/gui/components/Footer.qml index 11f5114..a69f377 100644 --- a/gui/components/Footer.qml +++ b/gui/components/Footer.qml @@ -42,13 +42,33 @@ ToolBar { onClicked: stackView.push("Locations.qml") } + Image { + id: lightning + smooth: true + visible: ctx != undefined & root.selectedGateway == "auto" + width: 16 + source: "../resources/lightning.svg" + fillMode: Image.PreserveAspectFit + anchors { + left: gwButton.right + leftMargin: -10 + verticalCenterOffset: -6 + } + ColorOverlay{ + anchors.fill: lightning + source: lightning + color: getLocationColor() + antialiasing: true + } + } + Label { id: locationLabel anchors { - left: gwButton.right - leftMargin: -7 + left: lightning.right verticalCenter: parent.verticalCenter verticalCenterOffset: 7 + leftMargin: (ctx != undefined & root.selectedGateway == "auto") ? 0 : -12 } text: locationStr() color: getLocationColor() @@ -79,10 +99,12 @@ ToolBar { height: 24 width: 24 source: "../resources/reception-0.svg" - anchors.right: parent.right - anchors.rightMargin: 20 - anchors.verticalCenter: parent.verticalCenter - anchors.verticalCenterOffset: 2 + anchors { + right: parent.right + rightMargin: 20 + verticalCenter: parent.verticalCenter + verticalCenterOffset: 2 + } // TODO refactor with SignalIcon ColorOverlay{ anchors.fill: gwQuality @@ -125,15 +147,18 @@ ToolBar { if (ctx && ctx.status == "on") { if (ctx.currentLocation && ctx.currentCountry) { let s = ctx.currentLocation + ", " + ctx.currentCountry + /* if (root.selectedGateway == "auto") { s = "🗲 " + s } + */ return s } } if (root.selectedGateway == "auto") { if (ctx && ctx.locations && ctx.bestLocation) { - return "🗲 " + getCanonicalLocation(ctx.bestLocation) + //return "🗲 " + getCanonicalLocation(ctx.bestLocation) + return getCanonicalLocation(ctx.bestLocation) } else { return qsTr("Recommended") } @@ -188,7 +213,6 @@ ToolBar { } function isFooterVisible() { - console.debug(stackView.depth) if (stackView.depth > 1) { return false } diff --git a/gui/gui.qrc b/gui/gui.qrc index 31082ee..78be7bc 100644 --- a/gui/gui.qrc +++ b/gui/gui.qrc @@ -39,6 +39,7 @@ resources/location.svg resources/settings.svg resources/power.svg + resources/lightning.svg resources/close.svg resources/donate.svg resources/tools.svg diff --git a/gui/main.qml b/gui/main.qml index 7469620..7fd38ab 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -78,9 +78,6 @@ ApplicationWindow { source: "qrc:/roboto-bold.ttf" } - font.family: robotoFont.name - font.weight: Font.Light - Loader { id: loader asynchronous: true @@ -171,5 +168,10 @@ ApplicationWindow { Component.onCompleted: { loader.source = "components/Splash.qml" + if (Qt.platform.os === "osx") { + // XXX workaround for custom font not working in osx + root.font.family = robotoFont.name + root.font.weight = Font.Light + } } } diff --git a/gui/resources/lightning.svg b/gui/resources/lightning.svg new file mode 100644 index 0000000..64c13eb --- /dev/null +++ b/gui/resources/lightning.svg @@ -0,0 +1,100 @@ + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3