[app] Colorize SD-card icon according to ambience

This commit is contained in:
Slava Monich 2020-02-04 01:46:27 +02:00
parent d2bc2d10cd
commit 7ba8a502b3
5 changed files with 20 additions and 83 deletions

View file

@ -182,6 +182,7 @@ HEADERS += \
HEADERS += \
$$HARBOUR_INCLUDE_DIR/HarbourDisplayBlanking.h \
$$HARBOUR_INCLUDE_DIR/HarbourImageProvider.h \
$$HARBOUR_INCLUDE_DIR/HarbourJson.h \
$$HARBOUR_INCLUDE_DIR/HarbourPluginLoader.h \
$$HARBOUR_INCLUDE_DIR/HarbourTask.h
@ -191,6 +192,7 @@ HEADERS += \
SOURCES += \
$$HARBOUR_SRC_DIR/HarbourDisplayBlanking.cpp \
$$HARBOUR_SRC_DIR/HarbourImageProvider.cpp \
$$HARBOUR_SRC_DIR/HarbourJson.cpp \
$$HARBOUR_SRC_DIR/HarbourMce.cpp \
$$HARBOUR_SRC_DIR/HarbourPluginLoader.cpp \
@ -268,7 +270,6 @@ defineTest(addTrFile) {
QMAKE_EXTRA_TARGETS += $${lrelease_target} $${lupdate_target}
PRE_TARGETDEPS += $${out}.qm
qm.files += $${out}.qm
export($${lupdate_target}.commands)
export($${lrelease_target}.target)
export($${lrelease_target}.depends)

View file

@ -1,54 +0,0 @@
/*
Copyright (C) 2015 Jolla Ltd.
Contact: Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Jolla Ltd nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
Rectangle {
color: "transparent"
width: image.width
Rectangle {
color: Theme.highlightColor
x: parent.width*3/80
y: parent.height*3/60
width: parent.width*74/80
height: parent.height*47/60
}
Image {
id: image
height: parent.height
sourceSize.height: height
fillMode: Image.PreserveAspectFit
source: "images/sdcard.svg"
}
}

View file

@ -73,7 +73,7 @@ Column {
width: parent.width
height: Math.max(storageLabel.height, bookCount.height)
BooksSDCardIcon {
Image {
id: icon
anchors {
left: parent.left
@ -82,6 +82,9 @@ Column {
}
visible: removableStorage
height: storageLabel.height*3/4
sourceSize.height: height
fillMode: Image.PreserveAspectFit
source: "image://harbour/" + Qt.resolvedUrl("images/sdcard.svg") + "?" + storageLabel.color
}
Label {

View file

@ -9,42 +9,27 @@
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="80.000008"
height="60.001255"
id="svg5195"
width="80"
height="60"
version="1.1"
inkscape:version="0.48.4 r9939"
inkscape:version="0.92.4 (unknown)"
sodipodi:docname="sdcard.svg">
<metadata
id="metadata5200">
<metadata>
<rdf:RDF>
<cc:Work
rdf:about="">
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title/>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-654.28125,-625.21875)">
<path
style="fill:none;stroke:#ffffff;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:3;stroke-opacity:1;stroke-dasharray:none"
inkscape:connector-curvature="0"
stroke-miterlimit="3"
d="m 731.87523,627.52841 0.40612,0.63624 0,46.62096 -0.56399,1.1596 -1.12305,0 -22.24234,0 -8.44016,7.27461 -7.68553,-0.0623 -0.47563,-0.29767 -0.27803,-0.58382 0,-2.04206 -5.07405,0 -3.94305,2.98613 -20.5052,0 -5.20258,0 -0.39718,-0.13334 -0.0694,-0.52447 0,-54.77808 0.0144,-0.0187 0.25471,-0.33121 0.25818,-0.0615 1.2803,0 46.21305,0 4.17044,0 22.66932,-0.15291 z"
id="path308-7-4"
sodipodi:nodetypes="cccccccccccccccccccccccccc" />
<path
style="fill:#000000;fill-opacity:1;stroke:none"
d="m 730.15625,628.22001 -22.0625,0.15625 -4.0625,0 -45,0 -1.25,0 -0.25,0.0625 -0.25,0.3125 0,52.84375 0.0625,0.5 0.40625,0.125 5.0625,0 19.96875,0 3.8125,-2.875 4.9375,0 0,1.96875 0.28125,0.5625 0.46875,0.28125 7.46875,0.0625 8.21875,-7 21.65625,0 1.09375,0 0.5625,-1.125 0,-44.96875 -0.40625,-0.59375 -0.71875,-0.3125 z m -61.125,10.28125 c 1.82713,-0.0787 3.62648,0.47484 4.21875,1.53125 1.48537,-2.34183 9.15625,-2.10021 9.15625,2.25 l 0,19.03125 -4.125,0 0,-17.15625 c -0.56407,-1.32417 -2.82364,-1.29592 -3.3125,-0.125 l 0,17.4375 -1.5,0 -0.46875,-0.0625 -1.46875,0 0,-17.4375 c -0.47005,-1.16523 -2.65468,-1.16223 -3.21875,0.15625 l 0,17.125 -4.03125,0 0,-19.03125 c 0,-2.46854 2.40084,-3.61757 4.75,-3.71875 z m 48.75,0 c 3.4878,0.0824 6.57521,3.26298 6.5,7.09375 0.002,0.0979 0.002,0.21668 0,0.3125 -0.0733,3.83086 -3.0122,6.86173 -6.5,6.78125 -3.4878,-0.0805 -6.54396,-3.26673 -6.46875,-7.09375 -0.002,-0.0977 -0.002,-0.21285 0,-0.3125 0.0733,-3.82899 2.97907,-6.86174 6.46875,-6.78125 z M 685.75,638.65751 c 1.25233,0 2.25,1.03607 2.25,2.3125 0,1.27641 -0.99767,2.3125 -2.25,2.3125 -1.25233,0 -2.28125,-1.03609 -2.28125,-2.3125 0,-1.27643 1.02892,-2.3125 2.28125,-2.3125 z m 8.71875,0.125 2.9375,0 c 1.2541,0 2.28125,0.89041 2.28125,2 0,1.10767 -1.02715,2.03125 -2.28125,2.03125 l -2.21875,0 c -1.01344,0.25296 -1.82345,0.98505 -2.15625,1.9375 -0.54338,1.55419 0.34988,3.22682 1.96875,3.75 l 2.40625,0 0.21875,0.0312 c 0.17298,0.0153 0.36579,0.0439 0.53125,0.0937 1.18078,0.36794 1.79053,1.51231 1.375,2.5625 -0.31776,0.79913 -1.16797,1.34375 -2.125,1.34375 l -2.4375,-0.0312 c -3.34114,-0.19164 -6.06943,-2.69748 -6.5,-5.96875 -0.4945,-3.76 2.18316,-7.19883 6,-7.6875 l 0,-0.0625 z m 10.09375,0 c 0.3134,-0.0123 0.61622,0.0366 0.9375,0.0937 0.62987,-0.11307 1.28578,-0.0985 1.90625,0.0625 2.53641,0.65157 4.07982,3.36426 3.46875,6.0625 l -3.78125,0 -0.0312,-1.09375 c 0.002,-0.0537 0.002,-0.13193 0,-0.1875 -0.0526,-0.82788 -0.80872,-1.45033 -1.71875,-1.40625 -0.91003,0.046 -1.61139,0.76203 -1.5625,1.59375 l 0,4.8125 0,3.125 0,0.6875 -3.78125,0 0,-8.71875 0,-0.34375 c 0.0113,-0.16481 0.0362,-0.30778 0.0625,-0.46875 0.37675,-2.39285 2.30619,-4.1329 4.5,-4.21875 z m 13.21875,3.8125 c -1.61889,0 -2.875,1.35016 -2.875,3 0,1.6502 1.25611,3 2.875,3 1.61889,0 3,-1.3498 3,-3 0,-1.64984 -1.38111,-3 -3,-3 z m -31.9375,1.0625 c 1.25222,0.0632 2.21642,1.12993 2.15625,2.40625 l 0,7.125 -4.53125,0 0,-7.125 c -0.004,-0.0751 -0.004,-0.14402 0,-0.21875 0.062,-1.27632 1.12466,-2.25075 2.375,-2.1875 z m 15.78125,9.875 c 1.77351,0.002 2.96875,0.0312 2.96875,0.0312 l -0.84375,2.4375 c 0,0 -6.58341,0.0146 -8.28125,0.0625 -1.56246,0.0422 -3.8125,-0.011 -3.8125,0.84375 0,0.66881 3.34677,1.44616 5.1875,2 2.71879,0.82404 5.00792,2.08047 4.40625,4.75 -0.84798,3.77911 -5.48319,3.5625 -11.09375,3.5625 -3.93905,0 -7.625,-0.25 -7.625,-0.25 l 1.53125,-4.28125 c 0,0 3.25363,0.39592 7.125,0.46875 2.49881,0.0479 3.34375,0.002 3.34375,-0.59375 0,-0.73206 -2.29471,-1.15725 -3.75,-1.71875 -1.52486,-0.596 -4.05245,-1.90761 -3.84375,-3.8125 0.1523,-1.46796 1.43869,-2.9988 8.21875,-3.34375 2.35027,-0.12074 4.69523,-0.15817 6.46875,-0.15625 z m 5.375,0.0312 c 2.11712,-0.006 2.87095,0.0184 4.78125,0.0625 0.47757,0.0153 1.28849,0.10627 2.28125,0.25 l -4.09375,2.5625 c -0.65243,-0.16865 -1.38653,-0.30027 -2.1875,-0.375 -0.8837,-0.0843 -1.10418,-0.0433 -1.625,-0.0625 L 707,653.56376 z m 10.34375,0.875 c 0.48134,0.13223 1.15307,0.38294 1.625,0.59375 l -6.90625,2.3125 c -0.0395,-0.0268 -0.0874,-0.0376 -0.125,-0.0625 -0.13726,-0.0958 -0.39328,-0.31235 -0.5625,-0.40625 l 5.96875,-2.4375 z m 3.34375,1.3125 c 1.29923,0.65157 2.40092,1.47148 2.96875,2.53125 0.50578,0.93328 0.39913,1.90088 -0.1875,2.84375 -4.67234,5.91493 -16.82844,5.86511 -21.21875,6.0625 l 1.90625,-5.46875 c 1.16009,-0.0441 2.83971,-0.20695 3.84375,-0.40625 1.00216,-0.20314 1.88983,-0.46505 2.625,-0.78125 0.722,-0.31429 1.28773,-0.68498 1.65625,-1.0625 0.36287,-0.37178 0.50143,-0.75956 0.4375,-1.15625 -0.015,-0.0974 -0.0486,-0.18544 -0.0937,-0.28125 -0.0263,-0.0613 -0.0505,-0.1281 -0.0937,-0.1875 l 8.15625,-2.09375 z"
id="path308-7"
inkscape:connector-curvature="0" />
<g
id="g5062"
transform="matrix(1.8802169,0,0,1.9163882,639.48533,-1272.1248)" />
style="fill:#000000;fill-opacity:1;stroke:none"
d="m 730.15625,628.22001 -22.0625,0.15625 -4.0625,0 -45,0 -1.25,0 -0.25,0.0625 -0.25,0.3125 0,52.84375 0.0625,0.5 0.40625,0.125 5.0625,0 19.96875,0 3.8125,-2.875 4.9375,0 0,1.96875 0.28125,0.5625 0.46875,0.28125 7.46875,0.0625 8.21875,-7 21.65625,0 1.09375,0 0.5625,-1.125 0,-44.96875 -0.40625,-0.59375 -0.71875,-0.3125 z m -61.125,10.28125 c 1.82713,-0.0787 3.62648,0.47484 4.21875,1.53125 1.48537,-2.34183 9.15625,-2.10021 9.15625,2.25 l 0,19.03125 -4.125,0 0,-17.15625 c -0.56407,-1.32417 -2.82364,-1.29592 -3.3125,-0.125 l 0,17.4375 -1.5,0 -0.46875,-0.0625 -1.46875,0 0,-17.4375 c -0.47005,-1.16523 -2.65468,-1.16223 -3.21875,0.15625 l 0,17.125 -4.03125,0 0,-19.03125 c 0,-2.46854 2.40084,-3.61757 4.75,-3.71875 z m 48.75,0 c 3.4878,0.0824 6.57521,3.26298 6.5,7.09375 0.002,0.0979 0.002,0.21668 0,0.3125 -0.0733,3.83086 -3.0122,6.86173 -6.5,6.78125 -3.4878,-0.0805 -6.54396,-3.26673 -6.46875,-7.09375 -0.002,-0.0977 -0.002,-0.21285 0,-0.3125 0.0733,-3.82899 2.97907,-6.86174 6.46875,-6.78125 z M 685.75,638.65751 c 1.25233,0 2.25,1.03607 2.25,2.3125 0,1.27641 -0.99767,2.3125 -2.25,2.3125 -1.25233,0 -2.28125,-1.03609 -2.28125,-2.3125 0,-1.27643 1.02892,-2.3125 2.28125,-2.3125 z m 8.71875,0.125 2.9375,0 c 1.2541,0 2.28125,0.89041 2.28125,2 0,1.10767 -1.02715,2.03125 -2.28125,2.03125 l -2.21875,0 c -1.01344,0.25296 -1.82345,0.98505 -2.15625,1.9375 -0.54338,1.55419 0.34988,3.22682 1.96875,3.75 l 2.40625,0 0.21875,0.0312 c 0.17298,0.0153 0.36579,0.0439 0.53125,0.0937 1.18078,0.36794 1.79053,1.51231 1.375,2.5625 -0.31776,0.79913 -1.16797,1.34375 -2.125,1.34375 l -2.4375,-0.0312 c -3.34114,-0.19164 -6.06943,-2.69748 -6.5,-5.96875 -0.4945,-3.76 2.18316,-7.19883 6,-7.6875 l 0,-0.0625 z m 10.09375,0 c 0.3134,-0.0123 0.61622,0.0366 0.9375,0.0937 0.62987,-0.11307 1.28578,-0.0985 1.90625,0.0625 2.53641,0.65157 4.07982,3.36426 3.46875,6.0625 l -3.78125,0 -0.0312,-1.09375 c 0.002,-0.0537 0.002,-0.13193 0,-0.1875 -0.0526,-0.82788 -0.80872,-1.45033 -1.71875,-1.40625 -0.91003,0.046 -1.61139,0.76203 -1.5625,1.59375 l 0,4.8125 0,3.125 0,0.6875 -3.78125,0 0,-8.71875 0,-0.34375 c 0.0113,-0.16481 0.0362,-0.30778 0.0625,-0.46875 0.37675,-2.39285 2.30619,-4.1329 4.5,-4.21875 z m 13.21875,3.8125 c -1.61889,0 -2.875,1.35016 -2.875,3 0,1.6502 1.25611,3 2.875,3 1.61889,0 3,-1.3498 3,-3 0,-1.64984 -1.38111,-3 -3,-3 z m -31.9375,1.0625 c 1.25222,0.0632 2.21642,1.12993 2.15625,2.40625 l 0,7.125 -4.53125,0 0,-7.125 c -0.004,-0.0751 -0.004,-0.14402 0,-0.21875 0.062,-1.27632 1.12466,-2.25075 2.375,-2.1875 z m 15.78125,9.875 c 1.77351,0.002 2.96875,0.0312 2.96875,0.0312 l -0.84375,2.4375 c 0,0 -6.58341,0.0146 -8.28125,0.0625 -1.56246,0.0422 -3.8125,-0.011 -3.8125,0.84375 0,0.66881 3.34677,1.44616 5.1875,2 2.71879,0.82404 5.00792,2.08047 4.40625,4.75 -0.84798,3.77911 -5.48319,3.5625 -11.09375,3.5625 -3.93905,0 -7.625,-0.25 -7.625,-0.25 l 1.53125,-4.28125 c 0,0 3.25363,0.39592 7.125,0.46875 2.49881,0.0479 3.34375,0.002 3.34375,-0.59375 0,-0.73206 -2.29471,-1.15725 -3.75,-1.71875 -1.52486,-0.596 -4.05245,-1.90761 -3.84375,-3.8125 0.1523,-1.46796 1.43869,-2.9988 8.21875,-3.34375 2.35027,-0.12074 4.69523,-0.15817 6.46875,-0.15625 z m 5.375,0.0312 c 2.11712,-0.006 2.87095,0.0184 4.78125,0.0625 0.47757,0.0153 1.28849,0.10627 2.28125,0.25 l -4.09375,2.5625 c -0.65243,-0.16865 -1.38653,-0.30027 -2.1875,-0.375 -0.8837,-0.0843 -1.10418,-0.0433 -1.625,-0.0625 L 707,653.56376 z m 10.34375,0.875 c 0.48134,0.13223 1.15307,0.38294 1.625,0.59375 l -6.90625,2.3125 c -0.0395,-0.0268 -0.0874,-0.0376 -0.125,-0.0625 -0.13726,-0.0958 -0.39328,-0.31235 -0.5625,-0.40625 l 5.96875,-2.4375 z m 3.34375,1.3125 c 1.29923,0.65157 2.40092,1.47148 2.96875,2.53125 0.50578,0.93328 0.39913,1.90088 -0.1875,2.84375 -4.67234,5.91493 -16.82844,5.86511 -21.21875,6.0625 l 1.90625,-5.46875 c 1.16009,-0.0441 2.83971,-0.20695 3.84375,-0.40625 1.00216,-0.20314 1.88983,-0.46505 2.625,-0.78125 0.722,-0.31429 1.28773,-0.68498 1.65625,-1.0625 0.36287,-0.37178 0.50143,-0.75956 0.4375,-1.15625 -0.015,-0.0974 -0.0486,-0.18544 -0.0937,-0.28125 -0.0263,-0.0613 -0.0505,-0.1281 -0.0937,-0.1875 l 8.15625,-2.09375 z"
inkscape:connector-curvature="0"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2019 Jolla Ltd.
* Copyright (C) 2015-2019 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2020 Jolla Ltd.
* Copyright (C) 2015-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@ -41,6 +41,7 @@
#include "BooksSettings.h"
#include "HarbourDebug.h"
#include "HarbourImageProvider.h"
#include "ZLibrary.h"
#include "ZLApplication.h"
@ -247,6 +248,7 @@ void ZLibrary::run(ZLApplication* aApp)
BOOKS_QML_PLUGIN_V1, BOOKS_QML_PLUGIN_V2);
BooksMediaPlugin::registerTypes(engine, BOOKS_QML_PLUGIN,
BOOKS_QML_PLUGIN_V1, BOOKS_QML_PLUGIN_V2);
engine->addImageProvider("harbour", new HarbourImageProvider);
engine->addImageProvider(BooksImageProvider::PROVIDER_ID,
new BooksImageProvider(root));