Add icons and images dependent on device resolution
authorDavid Llewellyn-Jones <david@flypig.co.uk>
Sun, 15 Jul 2018 16:31:15 +0000 (17:31 +0100)
committerDavid Llewellyn-Jones <david@flypig.co.uk>
Sun, 15 Jul 2018 16:31:15 +0000 (17:31 +0100)
15 files changed:
generate.sh [new file with mode: 0755]
harbour-pedalo.pro
icons/108x108/harbour-pedalo.png
icons/128x128/harbour-pedalo.png
icons/172x172/harbour-pedalo.png
icons/256x256/harbour-pedalo.png [new file with mode: 0644]
icons/86x86/harbour-pedalo.png
inputs/harbour-pedalo.svg [new file with mode: 0644]
inputs/pedalo-title.svg [new file with mode: 0644]
qml/pages/About.qml
src/harbour-pedalo.cpp
src/imageprovider.cpp [new file with mode: 0644]
src/imageprovider.h [new file with mode: 0644]
src/settings.cpp
src/settings.h

diff --git a/generate.sh b/generate.sh
new file mode 100755 (executable)
index 0000000..170bbf4
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# Generate graphics at different resolutions for different devices
+# 1.0 (jolla phone), 1.25 (jolla c), 1.5 (tablet), 1.75 (xperia)
+ratios="1.0 1.25 1.5 1.75 2.0"
+
+# Generate app icons
+sizes="86 108 128 172 256"
+for size in ${sizes}; do
+       mkdir -p "./icons/${size}x${size}"
+       inkscape -z -e "./icons/${size}x${size}/harbour-pedalo.png" -w $size -h $size "inputs/harbour-pedalo.svg"
+done
+
+# Create the ratio directories
+for ratio in ${ratios}; do
+       mkdir -p "./qml/images/z${ratio}"
+done
+
+# Function for generating PNG images
+function generate {
+       basex=$1
+       basey=$2
+       names=$3
+       for ratio in ${ratios}; do
+               sizex=`echo "${ratio} * ${basex}" | bc`
+               sizey=`echo "${ratio} * ${basey}" | bc`
+               for name in ${names}; do
+                       inkscape -z -e "./qml/images/z${ratio}/${name}.png" -w ${sizex} -h ${sizey} "inputs/${name}.svg"
+               done
+       done
+}
+
+# Generate titles
+generate 303 86 "pedalo-title"
+
index e50d930..9033b75 100644 (file)
@@ -25,12 +25,14 @@ DEFINES += "VERSION_MAJOR=$$VERSION_MAJOR" \
     "VERSION=\\\"$$VERSION\\\""
 
 CONFIG += sailfishapp
-
+PKGCONFIG += mlite5
+B
 SOURCES += src/harbour-pedalo.cpp \
     src/journey.cpp \
     src/journeymodel.cpp \
     src/status.cpp \
-    src/settings.cpp
+    src/settings.cpp \
+    src/imageprovider.cpp
 
 DISTFILES += qml/harbour-pedalo.qml \
     qml/cover/CoverPage.qml \
@@ -66,4 +68,5 @@ HEADERS += \
     src/journeymodel.h \
     src/status.h \
     src/settings.h \
-    src/harbour-pedalo.h
+    src/harbour-pedalo.h \
+    src/imageprovider.h
index ab10628..079936c 100644 (file)
Binary files a/icons/108x108/harbour-pedalo.png and b/icons/108x108/harbour-pedalo.png differ
index 54375c5..f3f691a 100644 (file)
Binary files a/icons/128x128/harbour-pedalo.png and b/icons/128x128/harbour-pedalo.png differ
index 36eee58..bb2136e 100644 (file)
Binary files a/icons/172x172/harbour-pedalo.png and b/icons/172x172/harbour-pedalo.png differ
diff --git a/icons/256x256/harbour-pedalo.png b/icons/256x256/harbour-pedalo.png
new file mode 100644 (file)
index 0000000..0671eb9
Binary files /dev/null and b/icons/256x256/harbour-pedalo.png differ
index ad316d6..a893845 100644 (file)
Binary files a/icons/86x86/harbour-pedalo.png and b/icons/86x86/harbour-pedalo.png differ
diff --git a/inputs/harbour-pedalo.svg b/inputs/harbour-pedalo.svg
new file mode 100644 (file)
index 0000000..9473e77
--- /dev/null
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<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"
+   width="106.62875"
+   height="106.62875"
+   viewBox="0 0 106.62875 106.62876"
+   id="svg8417"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="logo.svg">
+  <defs
+     id="defs8419">
+    <linearGradient
+       id="linearGradient8652-9-6"
+       spreadMethod="pad"
+       gradientTransform="matrix(-90.492659,-90.492659,-90.492659,90.492659,706.82734,475.33513)"
+       gradientUnits="userSpaceOnUse"
+       y2="0"
+       x2="1"
+       y1="0"
+       x1="0">
+      <stop
+         id="stop8654-3-3"
+         offset="0"
+         style="stop-opacity:1;stop-color:#0000ff" />
+      <stop
+         id="stop8656-6-2"
+         offset="1"
+         style="stop-opacity:1;stop-color:#d0baff" />
+    </linearGradient>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath10263">
+      <path
+         d="m 654.04254,384.58597 c -0.66375,0 -1.3225,0.0163 -1.9775,0.05 -20.325,1.03 -36.245,17.7975 -36.245,38.1725 l 0,38.2225 76.445,-0.001 0,-76.44376 -38.2225,0 z"
+         style="fill:none;stroke:#ffffff;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+         id="path10265"
+         inkscape:connector-curvature="0" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath10259">
+      <path
+         d="m 654.04254,384.58597 c -0.66375,0 -1.3225,0.0163 -1.9775,0.05 -20.325,1.03 -36.245,17.7975 -36.245,38.1725 l 0,38.2225 76.445,-0.001 0,-76.44376 -38.2225,0 z"
+         style="fill:none;stroke:#ffffff;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+         id="path10261"
+         inkscape:connector-curvature="0" />
+    </clipPath>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="3.959798"
+     inkscape:cx="26.852986"
+     inkscape:cy="61.425387"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="3200"
+     inkscape:window-height="1773"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     inkscape:window-maximized="1"
+     units="px"
+     fit-margin-top="0"
+     fit-margin-left="0"
+     fit-margin-right="0"
+     fit-margin-bottom="0" />
+  <metadata
+     id="metadata8422">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-313.82848,-429.04783)">
+    <g
+       transform="translate(-286.90031,59.830109)"
+       id="g8389">
+      <path
+         inkscape:connector-curvature="0"
+         id="path8658-0-0"
+         style="fill:url(#linearGradient8652-9-6);stroke:none"
+         d="m 602.50629,475.84647 c -0.9825,0 -1.7775,-0.795 -1.7775,-1.7775 l 0,0 0,-51.5375 c 0,-29.445 23.87,-53.31375 53.31375,-53.31375 l 0,0 51.5375,0 c 0.98125,0 1.7775,0.87 1.7775,1.8525 l 0,0 0,102.99875 c 0,0.9825 -0.79625,1.7775 -1.7775,1.7775 l 0,0 -103.07375,0 z" />
+      <path
+         clip-path="url(#clipPath10263)"
+         sodipodi:nodetypes="cssssssssssscccsssssscscssc"
+         inkscape:connector-curvature="0"
+         id="path8187-2-1"
+         d="m 627.19768,403.64482 c 0,0 7.95997,-5.9621 8.76526,-7.94947 0.80529,-1.98737 0.18584,-3.85052 2.04419,-5.83789 1.85837,-1.98737 5.35827,-4.40947 10.80946,-4.59579 5.45119,-0.18631 10.90237,3.66421 14.4952,11.17894 3.59283,7.51474 1.54863,19.43894 -0.30972,22.66842 -1.85836,3.22947 -7.43344,9.62631 -11.70767,13.35262 -4.27422,3.72632 -7.34522,6.07678 -8.92012,9.25368 -1.55144,3.12956 -0.92918,4.90632 -0.37167,5.46526 0.5575,0.55895 2.23003,-2.4221 8.92012,-2.48421 6.6901,-0.0621 7.12371,-0.74526 12.01739,4.34737 4.89368,5.09263 5.82286,4.53368 8.05289,4.96842 2.23003,0.43474 25.6986,0.12421 25.6986,0.12421 l 0.18584,28.38209 -36.9107,1.92527 c 0,0 -7.74317,-0.31053 -14.18548,-2.2979 -6.44231,-1.98737 -19.2744,-4.10855 -22.86723,-8.39382 -3.59282,-4.28526 -7.06176,-9.5642 -6.87593,-13.97367 0.18584,-4.40948 2.53976,-11.48948 8.11484,-17.32737 5.57508,-5.83789 20.82303,-16.69669 24.84948,-20.73354 4.02644,-4.03683 8.17678,-8.57051 7.80511,-15.65051 -0.37168,-7.08 -3.03532,-8.63263 -3.03532,-8.63263 0,0 -0.24779,0.93158 -4.6459,1.92526 -4.39812,0.99368 -4.52201,0.49684 -4.52201,0.49684 0,0 -2.23003,-0.24842 -5.26535,0.99369 -3.03532,1.2421 -8.42456,4.40947 -10.65459,4.53368 -2.23003,0.12421 -1.48669,-1.73895 -1.48669,-1.73895 z"
+         style="fill:#c3e6e7;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:8.5;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         sodipodi:nodetypes="csczzzcssc"
+         inkscape:connector-curvature="0"
+         id="path8187-1-7-5"
+         d="m 627.19768,403.64482 c 0,0 7.95998,-5.9621 8.76526,-7.94947 0.34285,-0.84611 0.42745,-1.66971 0.55496,-2.48996 2.64037,-1.16436 4.56783,-0.13122 5.7941,-1.04906 1.22627,-0.91784 3.80605,-2.24132 3.87959,-1.22846 0.0735,1.01287 -2.61914,2.34858 -3.44886,3.7246 -0.82973,1.37602 -0.72194,3.02579 -0.2268,5.30939 -0.86725,0.13058 -1.95708,0.38903 -3.17697,0.88823 -3.03532,1.2421 -8.42456,4.40947 -10.65459,4.53368 -2.23003,0.12421 -1.48669,-1.73895 -1.48669,-1.73895 z"
+         style="fill:#21292b;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:8.5;stroke-dasharray:none;stroke-opacity:1" />
+      <path
+         sodipodi:nodetypes="csczcssc"
+         inkscape:connector-curvature="0"
+         id="path8187-9-0-5"
+         d="m 627.19768,403.64482 c 0,0 7.95998,-5.9621 8.76526,-7.94947 0.12087,-0.29828 0.20964,-0.59376 0.2795,-0.88729 1.87045,-0.84829 3.9766,-1.07325 4.59885,-0.0456 0.62225,1.02763 -0.0528,3.53673 0.96356,5.32732 -1.21365,0.25347 -1.55947,0.38939 -2.46589,0.76032 -3.03532,1.2421 -8.42456,4.40947 -10.65459,4.53368 -2.23003,0.12421 -1.48669,-1.73895 -1.48669,-1.73895 z"
+         style="fill:#926d1e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:8.5;stroke-dasharray:none;stroke-opacity:1" />
+      <circle
+         clip-path="url(#clipPath10259)"
+         r="43.676472"
+         cy="460.42014"
+         cx="691.98035"
+         id="path10199-4"
+         style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#74b4b4;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:8.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
+    </g>
+  </g>
+</svg>
diff --git a/inputs/pedalo-title.svg b/inputs/pedalo-title.svg
new file mode 100644 (file)
index 0000000..0a08a3f
--- /dev/null
@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<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:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="150.17216mm"
+   height="40.557007mm"
+   viewBox="0 0 532.1061 143.70593"
+   id="svg13000"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="pedalo-title.svg">
+  <defs
+     id="defs13002">
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath10263-7-4-3-8-7">
+      <path
+         d="m 654.04254,384.58597 c -0.66375,0 -1.3225,0.0163 -1.9775,0.05 -20.325,1.03 -36.245,17.7975 -36.245,38.1725 l 0,38.2225 76.445,-0.001 0,-76.44376 -38.2225,0 z"
+         style="fill:none;stroke:#ffffff;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+         id="path10265-4-3-4-1-1"
+         inkscape:connector-curvature="0" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath10259-9-7-1-7-6">
+      <path
+         d="m 654.04254,384.58597 c -0.66375,0 -1.3225,0.0163 -1.9775,0.05 -20.325,1.03 -36.245,17.7975 -36.245,38.1725 l 0,38.2225 76.445,-0.001 0,-76.44376 -38.2225,0 z"
+         style="fill:none;stroke:#ffffff;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+         id="path10261-3-4-8-6-1"
+         inkscape:connector-curvature="0" />
+    </clipPath>
+    <linearGradient
+       id="linearGradient24"
+       spreadMethod="pad"
+       gradientTransform="matrix(105.70775,-105.70775,105.70775,105.70775,120.89608,611.46604)"
+       gradientUnits="userSpaceOnUse"
+       y2="0"
+       x2="1"
+       y1="0"
+       x1="0">
+      <stop
+         id="stop26"
+         offset="0"
+         style="stop-opacity:1;stop-color:#eb424a" />
+      <stop
+         id="stop28"
+         offset="1"
+         style="stop-opacity:1;stop-color:#ff7500" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient24-5"
+       spreadMethod="pad"
+       gradientTransform="matrix(105.70775,-105.70775,105.70775,105.70775,162.32465,622.89461)"
+       gradientUnits="userSpaceOnUse"
+       y2="0"
+       x2="1"
+       y1="0"
+       x1="0">
+      <stop
+         id="stop26-4"
+         offset="0"
+         style="stop-opacity:1;stop-color:#eb424a" />
+      <stop
+         id="stop28-2"
+         offset="1"
+         style="stop-opacity:1;stop-color:#ff7500" />
+    </linearGradient>
+    <clipPath
+       id="clipPath16"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         inkscape:connector-curvature="0"
+         id="path18"
+         d="M 0.301,43 C 0.301,42.592 0.3,1.723 0.3,1.723 l 0,0 C 0.3,0.937 0.937,0.3 1.723,0.3 l 0,0 82.554,0 c 0.786,0 1.423,0.637 1.423,1.423 l 0,0 0,41.277 C 85.7,66.582 66.583,85.7 43,85.7 l 0,0 C 19.417,85.7 0.301,66.582 0.301,43" />
+    </clipPath>
+    <linearGradient
+       xlink:href="#linearGradient24-5"
+       id="linearGradient24-6"
+       spreadMethod="pad"
+       gradientTransform="matrix(-72.47644,72.47644,72.47644,72.47644,79.238319,-5.327878)"
+       gradientUnits="userSpaceOnUse"
+       y2="0"
+       x2="0.99507397"
+       y1="0"
+       x1="0">
+      <stop
+         id="stop26-3"
+         offset="0"
+         style="stop-opacity:1;stop-color:#ffe6f4" />
+      <stop
+         id="stop28-9"
+         offset="1"
+         style="stop-opacity:1;stop-color:#ffb3dd" />
+    </linearGradient>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="0.98994949"
+     inkscape:cx="-24.547361"
+     inkscape:cy="-187.17427"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     fit-margin-top="0"
+     fit-margin-left="0"
+     fit-margin-right="0"
+     fit-margin-bottom="0"
+     inkscape:window-width="3200"
+     inkscape:window-height="1773"
+     inkscape:window-x="0"
+     inkscape:window-y="27"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata13005">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-98.294618,-270.5373)">
+    <g
+       transform="matrix(1.8964632,0,0,1.8964632,-2056.1463,-1029.024)"
+       style="font-style:normal;font-weight:normal;font-size:61.71240616px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#74b4b4;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       id="text10324-8-1-7-8">
+      <g
+         id="g10581">
+        <path
+           clip-path="url(#clipPath10263-7-4-3-8-7)"
+           sodipodi:nodetypes="cssssssssssscccsssssscscssc"
+           inkscape:connector-curvature="0"
+           id="path8187-2-1-5-0-2-2-4"
+           d="m 627.19768,403.64482 c 0,0 7.95997,-5.9621 8.76526,-7.94947 0.80529,-1.98737 0.18584,-3.85052 2.04419,-5.83789 1.85837,-1.98737 5.35827,-4.40947 10.80946,-4.59579 5.45119,-0.18631 10.90237,3.66421 14.4952,11.17894 3.59283,7.51474 1.54863,19.43894 -0.30972,22.66842 -1.85836,3.22947 -7.43344,9.62631 -11.70767,13.35262 -4.27422,3.72632 -7.34522,6.07678 -8.92012,9.25368 -1.55144,3.12956 -0.92918,4.90632 -0.37167,5.46526 0.5575,0.55895 2.23003,-2.4221 8.92012,-2.48421 6.6901,-0.0621 7.12371,-0.74526 12.01739,4.34737 4.89368,5.09263 5.82286,4.53368 8.05289,4.96842 2.23003,0.43474 25.6986,0.12421 25.6986,0.12421 l 0.18584,28.38209 -36.9107,1.92527 c 0,0 -7.74317,-0.31053 -14.18548,-2.2979 -6.44231,-1.98737 -19.2744,-4.10855 -22.86723,-8.39382 -3.59282,-4.28526 -7.06176,-9.5642 -6.87593,-13.97367 0.18584,-4.40948 2.53976,-11.48948 8.11484,-17.32737 5.57508,-5.83789 20.82303,-16.69669 24.84948,-20.73354 4.02644,-4.03683 8.17678,-8.57051 7.80511,-15.65051 -0.37168,-7.08 -3.03532,-8.63263 -3.03532,-8.63263 0,0 -0.24779,0.93158 -4.6459,1.92526 -4.39812,0.99368 -4.52201,0.49684 -4.52201,0.49684 0,0 -2.23003,-0.24842 -5.26535,0.99369 -3.03532,1.2421 -8.42456,4.40947 -10.65459,4.53368 -2.23003,0.12421 -1.48669,-1.73895 -1.48669,-1.73895 z"
+           style="fill:#89d2d2;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:8.5;stroke-dasharray:none;stroke-opacity:1"
+           transform="translate(520,300)" />
+        <path
+           sodipodi:nodetypes="csczzzcssc"
+           inkscape:connector-curvature="0"
+           id="path8187-1-7-5-2-7-2-03-0"
+           d="m 1147.1976,703.64482 c 0,0 7.96,-5.9621 8.7653,-7.94947 0.3428,-0.84611 0.4274,-1.66971 0.555,-2.48996 2.6403,-1.16436 4.5678,-0.13122 5.7941,-1.04906 1.2262,-0.91784 3.806,-2.24132 3.8795,-1.22846 0.073,1.01287 -2.6191,2.34858 -3.4488,3.7246 -0.8297,1.37602 -0.722,3.02579 -0.2268,5.30939 -0.8673,0.13058 -1.9571,0.38903 -3.177,0.88823 -3.0353,1.2421 -8.4246,4.40947 -10.6546,4.53368 -2.23,0.12421 -1.4867,-1.73895 -1.4867,-1.73895 z"
+           style="fill:#21292b;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:8.5;stroke-dasharray:none;stroke-opacity:1" />
+        <path
+           sodipodi:nodetypes="csczcssc"
+           inkscape:connector-curvature="0"
+           id="path8187-9-0-5-5-8-4-2-2"
+           d="m 1147.1976,703.64482 c 0,0 7.96,-5.9621 8.7653,-7.94947 0.1209,-0.29828 0.2096,-0.59376 0.2795,-0.88729 1.8704,-0.84829 3.9766,-1.07325 4.5988,-0.0456 0.6223,1.02763 -0.053,3.53673 0.9636,5.32732 -1.2137,0.25347 -1.5595,0.38939 -2.4659,0.76032 -3.0353,1.2421 -8.4245,4.40947 -10.6546,4.53368 -2.23,0.12421 -1.4867,-1.73895 -1.4867,-1.73895 z"
+           style="fill:#926d1e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:8.5;stroke-dasharray:none;stroke-opacity:1" />
+        <circle
+           clip-path="url(#clipPath10259-9-7-1-7-6)"
+           r="43.676472"
+           cy="460.42014"
+           cx="691.98035"
+           id="path10199-4-4-6-5-8-5"
+           style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#659d9d;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:8.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
+           transform="translate(520,300)" />
+        <path
+           id="path10543"
+           style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Laksaman;-inkscape-font-specification:'Laksaman Bold';fill:#659d9d;fill-opacity:1"
+           d="m 1230.4738,715.4852 q 7.529,0 12.466,3.45589 4.9987,3.39418 4.9987,9.75056 0,6.78837 -5.4307,10.55282 -5.369,3.76446 -13.3299,3.76446 -1.8514,0 -4.6284,-0.30856 l 0,17.46461 -5.8627,0 0,-43.50725 q 7.0352,-1.17253 11.787,-1.17253 z m 11.602,13.51501 q 0,-8.4546 -11.6637,-8.4546 -3.4559,0 -5.8626,0.24685 l 0,16.60064 q 3.1473,0.55541 5.3072,0.55541 12.2191,0 12.2191,-8.9483 z"
+           inkscape:connector-curvature="0" />
+        <path
+           id="path10545"
+           style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Laksaman;-inkscape-font-specification:'Laksaman Bold';fill:#659d9d;fill-opacity:1"
+           d="m 1258.364,745.29229 q 0.3703,4.87528 3.5176,7.71405 3.2091,2.77706 8.3929,2.77706 5.1838,0 11.8488,-2.40679 l 0.6788,5.12213 q -6.8501,2.53021 -12.8979,2.53021 -7.4055,0 -12.3425,-4.505 -4.937,-4.50501 -4.937,-11.66365 0,-7.71405 4.6285,-12.58933 4.6901,-4.87528 12.2807,-4.87528 14.2556,0 14.5642,17.8966 l -25.7341,0 z m 19.9948,-4.87528 q -0.4937,-3.64103 -3.0239,-5.92439 -2.4685,-2.28336 -6.3564,-2.28336 -3.8261,0 -6.7266,2.40678 -2.8388,2.34507 -3.5176,5.80097 l 19.6245,0 z"
+           inkscape:connector-curvature="0" />
+        <path
+           id="path10547"
+           style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Laksaman;-inkscape-font-specification:'Laksaman Bold';fill:#659d9d;fill-opacity:1"
+           d="m 1322.2296,760.16498 -5.5541,0 q -0.3086,-1.11083 -0.3086,-3.4559 -4.4433,4.31987 -11.2316,4.31987 -7.0353,0 -11.6637,-4.81357 -4.5667,-4.87528 -4.5667,-12.4659 0,-7.15864 4.4433,-11.72536 4.505,-4.62843 11.3551,-4.62843 6.9118,0 11.2933,4.38158 l 0,-18.3903 5.8627,0 0,38.32341 q 0,3.88788 0.3703,8.4546 z m -16.6006,-4.25816 q 4.3815,0 7.3437,-1.97479 3.0239,-2.03651 3.0239,-5.73926 l 0,-7.22035 q 0,-3.4559 -3.5176,-6.10953 -3.4559,-2.65363 -7.2203,-2.65363 -4.7519,0 -7.7141,3.27076 -2.9005,3.27075 -2.9005,8.26946 0,5.55411 2.8388,8.88658 2.9005,3.27076 8.1461,3.27076 z"
+           inkscape:connector-curvature="0" />
+        <path
+           id="path10549"
+           style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Laksaman;-inkscape-font-specification:'Laksaman Bold';fill:#659d9d;fill-opacity:1"
+           d="m 1340.4531,761.02895 q -4.7519,0 -7.9609,-2.59192 -3.2091,-2.59192 -3.2091,-6.91179 0,-11.72536 21.1057,-12.03392 -0.9257,-6.9735 -7.6524,-6.9735 -5.1221,0 -11.0465,2.28336 l -0.6171,-5.24556 q 6.2947,-1.85137 11.9722,-1.85137 13.1447,0 13.1447,13.51502 l 0,10.49111 q 0,3.51761 1.296,8.14604 l -5.4307,1.17253 -0.9257,-4.13473 q -4.8135,4.13473 -10.6762,4.13473 z m 9.9357,-10.86138 0,-5.61583 q -15.1813,0.30856 -15.1813,6.41809 0,4.93699 5.4924,4.93699 3.2091,0 6.4181,-1.66623 3.2708,-1.72795 3.2708,-4.07302 z"
+           inkscape:connector-curvature="0" />
+        <path
+           id="path10551"
+           style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Laksaman;-inkscape-font-specification:'Laksaman Bold';fill:#659d9d;fill-opacity:1"
+           d="m 1379.4389,760.90553 q -13.8236,-0.74055 -13.8236,-16.97091 l 0,-30.54765 5.8627,0 0,29.25168 q 0,6.54152 1.7897,9.62714 1.8513,3.02391 6.8501,3.33247 l -0.6789,5.30727 z"
+           inkscape:connector-curvature="0" />
+        <path
+           id="path10553"
+           style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Laksaman;-inkscape-font-specification:'Laksaman Bold';fill:#659d9d;fill-opacity:1"
+           d="m 1416.6091,744.18146 q 0,7.09693 -4.8136,11.9105 -4.8136,4.81357 -11.9105,4.81357 -7.0969,0 -11.9105,-4.81357 -4.8136,-4.81357 -4.8136,-11.9105 0,-7.03521 4.8136,-11.91049 4.8136,-4.87528 11.9105,-4.87528 7.0969,0 11.9105,4.87528 4.8136,4.87528 4.8136,11.91049 z m -16.7241,11.78707 q 4.8136,0 7.8375,-3.39418 3.0856,-3.39418 3.0856,-8.39289 0,-4.9987 -3.0856,-8.39288 -3.0239,-3.39418 -7.8375,-3.39418 -4.8136,0 -7.8992,3.39418 -3.0856,3.39418 -3.0856,8.39288 0,4.99871 3.0856,8.39289 3.0856,3.39418 7.8992,3.39418 z"
+           inkscape:connector-curvature="0" />
+      </g>
+    </g>
+  </g>
+</svg>
index df656ee..f732dd2 100644 (file)
@@ -30,7 +30,7 @@ Page {
             Image {
                 anchors.topMargin: Theme.paddingLarge
                 anchors.horizontalCenter: parent.horizontalCenter
-                source  : Qt.resolvedUrl("image://theme/icon-m-cloud-download")
+                source  : Qt.resolvedUrl("image://pedalo/pedalo-title")
             }
 
             Label {
index a4218cd..216240d 100644 (file)
@@ -9,6 +9,7 @@
 #include "journeymodel.h"
 #include "status.h"
 #include "settings.h"
+#include "imageprovider.h"
 
 #include "harbour-pedalo.h"
 
@@ -44,6 +45,7 @@ int main(int argc, char *argv[])
     journeys.importFromFile(file);
 
     QScopedPointer<QQuickView> view(SailfishApp::createView());
+    view->engine()->addImageProvider(QLatin1String("pedalo"), new ImageProvider(Settings::getInstance()));
     view->setSource(SailfishApp::pathTo("qml/harbour-pedalo.qml"));
 
     QQmlContext *ctxt = view->rootContext();
diff --git a/src/imageprovider.cpp b/src/imageprovider.cpp
new file mode 100644 (file)
index 0000000..431fd23
--- /dev/null
@@ -0,0 +1,38 @@
+#include <sailfishapp.h>
+#include <QQuickImageProvider>
+#include <QPainter>
+#include <QColor>
+#include <QDebug>
+#include "settings.h"
+
+#include "imageprovider.h"
+
+ImageProvider::ImageProvider(Settings const & settings) : QQuickImageProvider(QQuickImageProvider::Pixmap) {
+    imageDir = settings.getImageDir();
+}
+
+QPixmap ImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) {
+    QPixmap image;
+    QStringList parts = id.split('?');
+    QPixmap sourcePixmap(imageDir + parts.at(0) + ".png");
+
+    if (size) {
+        *size = sourcePixmap.size();
+    }
+    if (parts.length() > 1) {
+        if (QColor::isValidColor(parts.at(1))) {
+            QPainter painter(&sourcePixmap);
+            painter.setCompositionMode(QPainter::CompositionMode_SourceIn);
+            painter.fillRect(sourcePixmap.rect(), parts.at(1));
+            painter.end();
+        }
+    }
+    if (requestedSize.width() > 0 && requestedSize.height() > 0) {
+        image = sourcePixmap.scaled(requestedSize.width(), requestedSize.height(), Qt::IgnoreAspectRatio);
+    }
+    else {
+        image = sourcePixmap;
+    }
+
+    return image;
+}
diff --git a/src/imageprovider.h b/src/imageprovider.h
new file mode 100644 (file)
index 0000000..bc62fbf
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef IMAGEPROVIDER_H
+#define IMAGEPROVIDER_H
+
+#include <QQuickImageProvider>
+#include <sailfishapp.h>
+#include "settings.h"
+
+class ImageProvider : public QQuickImageProvider {
+public:
+    explicit ImageProvider(Settings const & settings);
+
+    QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize);
+private:
+    QString imageDir;
+};
+
+#endif // IMAGEPROVIDER_H
index 0998d37..b1755a7 100644 (file)
@@ -1,6 +1,8 @@
 #include <QDesktopServices>
 #include <QDateTime>
 #include <QDebug>
+#include <sailfishapp.h>
+#include <mlite5/MGConfItem>
 
 #include "settings.h"
 
@@ -10,6 +12,27 @@ Settings::Settings(QObject *parent) : QObject(parent),
     settings(this),
     mainStatus(nullptr)
 {
+    QScopedPointer<MGConfItem> ratioItem(new MGConfItem("/desktop/sailfish/silica/theme_pixel_ratio"));
+    pixelRatio = ratioItem->value(1.0).toDouble();
+    QString dir;
+    if (pixelRatio > 1.75) {
+        dir = "2.0";
+    }
+    else if (pixelRatio > 1.5) {
+        dir = "1.75";
+    }
+    else if (pixelRatio > 1.25) {
+        dir = "1.5";
+    }
+    else if (pixelRatio > 1.0) {
+        dir = "1.25";
+    }
+    else {
+        dir = "1.0";
+    }
+
+    imageDir = SailfishApp::pathTo("qml/images/z" + dir).toString(QUrl::RemoveScheme) + "/";
+    qDebug() << "Image folder: " << imageDir;
 }
 
 Settings::~Settings() {
@@ -36,6 +59,13 @@ QString Settings::getConfigDir() {
     return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
 }
 
+QString Settings::getImageDir() const {
+    return imageDir;
+}
+QString Settings::getImageUrl(const QString &id) const {
+    return imageDir + id + ".png";
+}
+
 void Settings::setMainStatus(Status &value) {
     mainStatus = &value;
 }
index 2390d89..5dc4fa9 100644 (file)
@@ -19,6 +19,8 @@ public:
     static QObject * provider(QQmlEngine *engine, QJSEngine *scriptEngine);
 
     Q_INVOKABLE static QString getConfigDir();
+    Q_INVOKABLE QString getImageDir() const;
+    Q_INVOKABLE QString getImageUrl(const QString &id) const;
 
     void loadSettings();
     void saveSettings();
@@ -31,6 +33,8 @@ public slots:
 private:
     static Settings * instance;
     QSettings settings;
+    double pixelRatio;
+    QString imageDir;
 
     // Configurable values
     Status * mainStatus;