From 90cee03534a1f078a144648f676ec6b0364fd726 Mon Sep 17 00:00:00 2001
From: "kali kaneko (leap communications)" <kali@leap.se>
Date: Mon, 4 Oct 2021 17:31:41 +0200
Subject: [PATCH] [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 11f51142..a69f3777 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 31082eeb..78be7bcc 100644
--- a/gui/gui.qrc
+++ b/gui/gui.qrc
@@ -39,6 +39,7 @@
         <file>resources/location.svg</file>
         <file>resources/settings.svg</file>
         <file>resources/power.svg</file>
+        <file>resources/lightning.svg</file>
         <file>resources/close.svg</file>
         <file>resources/donate.svg</file>
         <file>resources/tools.svg</file>
diff --git a/gui/main.qml b/gui/main.qml
index 7469620f..7fd38abc 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 00000000..64c13ebd
--- /dev/null
+++ b/gui/resources/lightning.svg
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   version="1.1"
+   id="Capa_1"
+   x="0px"
+   y="0px"
+   viewBox="0 0 27.793 27.793"
+   style="enable-background:new 0 0 27.793 27.793;"
+   xml:space="preserve"
+   sodipodi:docname="lightning.svg"
+   inkscape:version="1.0.2 (e86c870879, 2021-01-15)"><metadata
+   id="metadata43"><rdf:RDF><cc:Work
+       rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+         rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+   id="defs41" /><sodipodi:namedview
+   pagecolor="#ffffff"
+   bordercolor="#666666"
+   borderopacity="1"
+   objecttolerance="10"
+   gridtolerance="10"
+   guidetolerance="10"
+   inkscape:pageopacity="0"
+   inkscape:pageshadow="2"
+   inkscape:window-width="1953"
+   inkscape:window-height="1275"
+   id="namedview39"
+   showgrid="false"
+   inkscape:zoom="36.268126"
+   inkscape:cx="13.8965"
+   inkscape:cy="13.8965"
+   inkscape:window-x="0"
+   inkscape:window-y="25"
+   inkscape:window-maximized="0"
+   inkscape:current-layer="Capa_1" />
+<g
+   id="g6"
+   transform="matrix(0.8595902,0,0,0.8595902,0.71272014,0)">
+	<g
+   id="c1_ray">
+		<polygon
+   points="5.076,15.803 10.972,15.803 6.44,27.793 22.716,11.989 16.819,11.989 20.972,0 "
+   id="polygon2" />
+	</g>
+	<g
+   id="Capa_1_29_">
+	</g>
+</g>
+<g
+   id="g8">
+</g>
+<g
+   id="g10">
+</g>
+<g
+   id="g12">
+</g>
+<g
+   id="g14">
+</g>
+<g
+   id="g16">
+</g>
+<g
+   id="g18">
+</g>
+<g
+   id="g20">
+</g>
+<g
+   id="g22">
+</g>
+<g
+   id="g24">
+</g>
+<g
+   id="g26">
+</g>
+<g
+   id="g28">
+</g>
+<g
+   id="g30">
+</g>
+<g
+   id="g32">
+</g>
+<g
+   id="g34">
+</g>
+<g
+   id="g36">
+</g>
+</svg>
-- 
GitLab