[app] Moved font controls from pulley menu to toolbar

Tool icon replaces double-click as the night/day mode switch.
This commit is contained in:
Slava Monich 2015-08-23 14:47:25 +03:00
parent de7028bf5a
commit c90983070c
16 changed files with 582 additions and 133 deletions

View file

@ -51,27 +51,6 @@ SilicaFlickable {
]
PullDownMenu {
MenuItem {
id: defaultFontMenuItem
//% "Use default fonts"
text: qsTrId("book-font-default")
enabled: globalSettings.fontSize != BooksSettings.DefaultFontSize
onClicked: globalSettings.fontSize = BooksSettings.DefaultFontSize
}
MenuItem {
id: smallerFontMenuItem
//% "Use smaller fonts"
text: qsTrId("book-font-smaller")
enabled: globalSettings.fontSize >= BooksSettings.MinFontSize
onClicked: globalSettings.fontSize -= 1
}
MenuItem {
id: largerFontMenuItem
//% "Use larger fonts"
text: qsTrId("book-font-larger")
enabled: globalSettings.fontSize <= BooksSettings.MaxFontSize
onClicked: globalSettings.fontSize += 1
}
MenuItem {
//% "Back to library"
text: qsTrId("book-view-back")
@ -153,6 +132,8 @@ SilicaFlickable {
rightMargin: bookModel.rightMargin
topMargin: bookModel.topMargin
bottomMargin: bookModel.bottomMargin
leftSpaceReserved: pageTools.visible ? pageTools.leftSpaceUsed : 0
rightSpaceReserved: pageTools.visible ? pageTools.rightSpaceUsed: 0
titleVisible: _currentState.title
pageNumberVisible: _currentState.page
title: bookModel.title
@ -176,35 +157,34 @@ SilicaFlickable {
}
Behavior on opacity { FadeAnimation {} }
}
/*
BooksPageTools {
anchors {
top: parent.top
left: parent.left
right: parent.right
BooksPageTools {
id: pageTools
anchors {
top: parent.top
left: parent.left
right: parent.right
}
leftMargin: bookModel.leftMargin
rightMargin: bookModel.rightMargin
opacity: _currentState.tools ? 1 : 0
visible: opacity > 0 && book && bookModel.pageCount && !_loading
Behavior on opacity { FadeAnimation {} }
}
opacity: _currentState.tools ? 1 : 0
visible: opacity > 0
Behavior on opacity { FadeAnimation {} }
}
*/
BooksPager {
id: pager
anchors {
bottom: parent.bottom
bottomMargin: (Theme.itemSizeExtraSmall + 2*(bookModel.bottomMargin - height))/4
BooksPager {
id: pager
anchors {
bottom: parent.bottom
bottomMargin: (Theme.itemSizeExtraSmall + 2*(bookModel.bottomMargin - height))/4
}
pageCount: bookModel.pageCount
width: parent.width
opacity: (_currentState.pager && book && bookModel.pageCount) ? 0.75 : 0
visible: opacity > 0
onPageChanged: bookView.jumpTo(page)
Behavior on opacity { FadeAnimation {} }
}
pageCount: bookModel.pageCount
width: parent.width
opacity: _currentState.pager ? 1 : 0
visible: opacity > 0 && book && bookModel.pageCount && !_loading
onPageChanged: bookView.jumpTo(page)
Behavior on opacity { FadeAnimation {} }
}
BusyIndicator {

133
app/qml/BooksPageTools.qml Normal file
View file

@ -0,0 +1,133 @@
/*
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
import harbour.books 1.0
Item {
id: pageTools
height: Theme.itemSizeExtraSmall
property real leftMargin: Theme.horizontalPageMargin
property real rightMargin: Theme.horizontalPageMargin
property real spacing: Theme.paddingLarge
property real leftSpaceUsed: dayNightModeSwitch.x + dayNightModeSwitch.width
property real rightSpaceUsed: width - decreaseFontSizeButton.x
property real _spacingBy2: Math.ceil(spacing/2)
// Left side
MouseArea {
id: dayNightModeSwitch
height: parent.height
width: leftMargin + dayModeImage.width + spacing
anchors {
left: parent.left
verticalCenter: parent.verticalCenter
}
onClicked: globalSettings.invertColors = !globalSettings.invertColors
Image {
id: dayModeImage
source: "images/day-mode.svg"
anchors {
left: parent.left
leftMargin: pageTools.leftMargin
verticalCenter: parent.verticalCenter
}
height: Math.ceil(parent.height/2)
sourceSize.height: height
opacity: globalSettings.invertColors ? 0.5 : 0
visible: opacity > 0
Behavior on opacity { FadeAnimation {} }
}
Image {
source: "images/night-mode.svg"
anchors.fill: dayModeImage
sourceSize.height: height
opacity: globalSettings.invertColors ? 0 : 0.25
visible: opacity > 0
Behavior on opacity { FadeAnimation {} }
}
}
// Right side
MouseArea {
id: increaseFontSizeButton
width: leftMargin + increaseFontSizeButtonImage.width + _spacingBy2
height: parent.height
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
Image {
id: increaseFontSizeButtonImage
source: "images/font-larger.svg"
anchors {
left: parent.left
leftMargin: _spacingBy2
verticalCenter: parent.verticalCenter
}
height: Math.ceil(parent.height/2)
sourceSize.height: height
opacity: globalSettings.invertColors ? 1 : 0.5
Behavior on opacity { FadeAnimation {} }
}
onClicked: globalSettings.increaseFontSize()
}
MouseArea {
id: decreaseFontSizeButton
width: decreaseFontSizeButtonImage.width + spacing + _spacingBy2
height: parent.height
anchors {
right: increaseFontSizeButton.left
verticalCenter: parent.verticalCenter
}
Image {
id: decreaseFontSizeButtonImage
source: "images/font-smaller.svg"
anchors {
right: parent.right
rightMargin: _spacingBy2
verticalCenter: parent.verticalCenter
}
height: Math.ceil(parent.height/2)
sourceSize.height: height
opacity: globalSettings.invertColors ? 1 : 0.5
Behavior on opacity { FadeAnimation {} }
}
onClicked: globalSettings.decreaseFontSize()
}
}

View file

@ -43,9 +43,10 @@ Item {
property alias topMargin: widget.topMargin
property alias bottomMargin: widget.bottomMargin
property alias title: titleLabel.text
property real leftSpaceReserved
property real rightSpaceReserved
property bool titleVisible
property bool pageNumberVisible
property color extraInfoColor: "#808080"
signal pageClicked()
@ -56,24 +57,19 @@ Item {
model: bookModel
}
Label {
BooksTitleLabel {
id: titleLabel
anchors {
top: parent.top
left: parent.left
right: parent.right
leftMargin: Theme.paddingLarge
rightMargin: Theme.paddingLarge
leftMargin: Math.max(view.leftMargin, leftSpaceReserved)
rightMargin: Math.max(view.rightMargin, rightSpaceReserved)
}
centerX: Math.floor(view.width/2) - anchors.leftMargin
height: Theme.itemSizeExtraSmall
font.pixelSize: Theme.fontSizeSmall
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: extraInfoColor
elide: Text.ElideRight
color: globalSettings.primaryPageToolColor
opacity: titleVisible ? 1 : 0
visible: opacity > 0
Behavior on opacity { FadeAnimation {} }
}
BusyIndicator {
@ -94,32 +90,14 @@ Item {
height: Theme.itemSizeExtraSmall
font.pixelSize: Theme.fontSizeSmall
verticalAlignment: Text.AlignVCenter
color: extraInfoColor
color: globalSettings.primaryPageToolColor
opacity: pageNumberVisible ? 1 : 0
visible: opacity > 0
Behavior on opacity { FadeAnimation {} }
}
// For some reason this MouseArea receives clicks but not double-click
// events. It was easier to reimplement double-click functionality than
// to figure out what's wrong with double clicks.
MouseArea {
anchors.fill: parent
onClicked: {
if (!clickTimer.running) {
// If there're no more clicks within DoubleClickInterval
// then it's a single click
clickTimer.start()
} else {
// Otherwise it's a double click
clickTimer.stop()
globalSettings.invertColors = !globalSettings.invertColors
}
}
Timer {
id: clickTimer
interval: DoubleClickInterval
onTriggered: view.pageClicked()
}
onClicked: view.pageClicked()
}
}

View file

@ -56,13 +56,10 @@ Item {
minimumValue: 0
valueText: ""
label: ""
//highlightColor: primaryColor
//secondaryHighlightColor: secondaryColor
//highlightColor: "#000000"
//secondaryHighlightColor: "#808080"
//primaryColor: "#808080"
primaryColor: highlightColor
secondaryColor: secondaryHighlightColor
primaryColor: globalSettings.primaryPageToolColor
secondaryColor: globalSettings.primaryPageToolColor
highlightColor: globalSettings.highlightPageToolColor
secondaryHighlightColor: globalSettings.highlightPageToolColor
onValueChanged: root.pageChanged(value)
}
}

View file

@ -0,0 +1,80 @@
/*
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
Item {
id: title
property real centerX: Math.floor(width/2)
property alias text: label.text
property alias color: label.color
visible: opacity > 0
Behavior on opacity { FadeAnimation {} }
Component.onCompleted: updateLayout()
onWidthChanged: updateLayout()
onHeightChanged: updateLayout()
onCenterXChanged: updateLayout()
onTextChanged: updateLayout()
function updateLayout() {
if (centerX > 0 && centerX < width) {
var left = Math.ceil(centerX)
var right = Math.floor(width - centerX)
var preferredWidth = Math.floor(Math.min(left, right))*2
label.anchors.leftMargin = 0
label.anchors.rightMargin = 0
if (label.paintedWidth <= preferredWidth) {
if (left < right) {
label.anchors.leftMargin = 0
label.anchors.rightMargin = right - left
} else {
label.anchors.leftMargin = left - right
label.anchors.rightMargin = 0
}
}
}
}
Label {
id: label
anchors.fill: parent
smooth: true
height: Theme.itemSizeExtraSmall
font.pixelSize: Theme.fontSizeSmall
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
}

View file

@ -0,0 +1,94 @@
<?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="100"
height="100"
id="svg3832"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="day-mode.svg">
<defs
id="defs3834" />
<metadata
id="metadata3837">
<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(0,-952.36218)">
<g
transform="matrix(2.0833333,0,0,2.0833333,7.9999999e-7,952.36218)">
<rect
id="rect3842"
height="48"
width="48"
style="fill:none"
x="0"
y="0" />
<path
id="path3844"
d="m 24,13.5 c -5.797,0 -10.5,4.682 -10.5,10.5 0,5.816 4.703,10.5 10.5,10.5 5.796,0 10.5,-4.684 10.5,-10.5 0,-5.818 -4.704,-10.5 -10.5,-10.5 z"
style="fill:#ffffff;fill-opacity:1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cssscc" />
<path
id="path3846"
d="m 24,0.75 c -1.5,0 -2.25,0.75 -2.25,1.5 V 9 c 0,0.75 0.75,1.5 2.25,1.5 1.5,0 2.25,-0.75 2.25,-1.5 V 2.25 C 26.25,1.5 25.5,0.75 24,0.75 z"
style="fill:#ffffff;fill-opacity:1"
inkscape:connector-curvature="0" />
<path
id="path3848"
d="M 10.5,24.003 C 10.5,22.5 9.75,21.75 9,21.75 H 2.25 c -0.75,0 -1.5,0.75 -1.5,2.248 0,1.502 0.75,2.252 1.5,2.252 H 9 c 0.75,0 1.5,-0.75 1.5,-2.247 z"
style="fill:#ffffff;fill-opacity:1"
inkscape:connector-curvature="0" />
<path
id="path3850"
d="M 47.25,24.003 C 47.25,22.5 46.5,21.75 45.75,21.75 H 39 c -0.75,0 -1.5,0.75 -1.5,2.248 0,1.502 0.75,2.252 1.5,2.252 h 6.75 c 0.75,0 1.5,-0.75 1.5,-2.247 z"
style="fill:#ffffff;fill-opacity:1"
inkscape:connector-curvature="0" />
<path
id="path3852"
d="M 14.584,11.631 10.642,7.674 c -0.708,-0.71 -1.949,-0.71 -2.655,0 l -0.5,0.501 c -0.731,0.733 -0.731,1.931 0,2.663 l 3.944,3.959 c 0.354,0.355 0.824,0.55 1.327,0.55 0.503,0 0.974,-0.194 1.328,-0.55 l 0.499,-0.5 c 0.354,-0.355 0.548,-0.83 0.548,-1.332 0,-0.506 -0.195,-0.979 -0.549,-1.334 z"
style="fill:#ffffff;fill-opacity:1"
inkscape:connector-curvature="0" />
<path
id="path3854"
d="m 40.562,8.174 -0.498,-0.5 c -0.708,-0.711 -1.948,-0.711 -2.655,0 l -3.943,3.956 c -0.731,0.736 -0.731,1.931 0,2.667 l 0.5,0.5 c 0.353,0.355 0.824,0.55 1.326,0.55 0.504,0 0.975,-0.194 1.328,-0.55 l 3.943,-3.959 c 0.731,-0.733 0.731,-1.93 -0.001,-2.664 z"
style="fill:#ffffff;fill-opacity:1"
inkscape:connector-curvature="0" />
<path
id="path3856"
d="m 24,47.25 c 1.5,0 2.25,-0.75 2.25,-1.5 V 39 c 0,-0.75 -0.75,-1.5 -2.25,-1.5 -1.5,0 -2.25,0.75 -2.25,1.5 v 6.75 c 0,0.75 0.75,1.5 2.25,1.5 z"
style="fill:#ffffff;fill-opacity:1"
inkscape:connector-curvature="0" />
<path
id="path3858"
d="m 33.465,36.424 3.943,3.957 c 0.707,0.71 1.948,0.71 2.654,0 l 0.499,-0.5 c 0.731,-0.734 0.731,-1.932 0,-2.665 l -3.942,-3.958 c -0.354,-0.355 -0.825,-0.55 -1.328,-0.55 -0.502,0 -0.974,0.194 -1.326,0.55 l -0.5,0.5 c -0.354,0.354 -0.547,0.829 -0.547,1.332 0,0.506 0.193,0.978 0.547,1.334 z"
style="fill:#ffffff;fill-opacity:1"
inkscape:connector-curvature="0" />
<path
id="path3860"
d="m 7.488,39.881 0.499,0.5 c 0.708,0.71 1.947,0.71 2.655,0 l 3.942,-3.956 c 0.733,-0.736 0.733,-1.932 0,-2.667 l -0.498,-0.5 c -0.354,-0.355 -0.825,-0.549 -1.328,-0.549 -0.502,0 -0.974,0.193 -1.326,0.549 l -3.944,3.959 c -0.732,0.732 -0.732,1.929 0,2.664 z"
style="fill:#ffffff;fill-opacity:1"
inkscape:connector-curvature="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -0,0 +1,57 @@
<?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="49"
height="32"
id="svg4459"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="font-larger.svg">
<defs
id="defs4461" />
<metadata
id="metadata4464">
<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(-14,-978.02223)">
<g
style="fill:#808080;fill-opacity:1;stroke:none"
id="text4477"
transform="matrix(0.96982759,0,0,0.91092979,0.42241384,86.533764)">
<path
d="m 14,994.18217 7.12,0 0,-7.84 4.32,0 0,7.84 7.12,0 0,4.08 -7.12,0 0,7.84003 -4.32,0 0,-7.84003 -7.12,0 0,-4.08"
id="path5549"
inkscape:connector-curvature="0" />
</g>
<g
transform="matrix(1.0154062,0,0,1.0144928,8.614845,973.73237)"
style="fill:#808080;fill-opacity:1;stroke:none"
id="text5562">
<path
d="m 53.56,33.8 -11.16,0 0,-1.8 c 1.013315,-0.05333 1.719981,-0.159998 2.12,-0.32 0.39998,-0.159998 0.59998,-0.439997 0.6,-0.84 -2e-5,-0.346663 -0.28002,-1.199996 -0.84,-2.56 L 43,25.12 l -9.76,0 c -0.106675,0.320008 -0.360008,0.920008 -0.76,1.8 -0.400007,0.853339 -0.720007,1.626672 -0.96,2.32 -0.240006,0.666671 -0.360006,1.200003 -0.36,1.6 -6e-6,0.480002 0.22666,0.800002 0.68,0.96 0.479993,0.133335 1.173325,0.200002 2.08,0.2 l 0,1.8 -8.92,0 0,-1.72 c 0.293333,-0.02667 0.573333,-0.08 0.84,-0.16 0.266666,-0.08 0.519999,-0.199998 0.76,-0.36 0.239998,-0.186664 0.453331,-0.346664 0.64,-0.48 0.186664,-0.159997 0.373331,-0.399997 0.56,-0.72 0.21333,-0.319996 0.37333,-0.573329 0.48,-0.76 0.13333,-0.186662 0.306663,-0.493329 0.52,-0.92 0.213329,-0.453328 0.359996,-0.786661 0.44,-1 0.106662,-0.213327 0.266662,-0.58666 0.48,-1.12 0.239995,-0.559992 0.413328,-0.946658 0.52,-1.16 l 8.04,-19.2 1.76,0 9.68,22.24 c 0.639975,1.493337 1.119974,2.400003 1.44,2.72 0.533307,0.560002 1.333306,0.840002 2.4,0.84 l 0,1.8 m -11.52,-11.24 -3.96,-9.28 -3.8,9.28 7.76,0"
id="path5570"
inkscape:connector-curvature="0"
style="fill:#808080;fill-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -0,0 +1,57 @@
<?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="31"
height="32"
id="svg4449"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="font-smaller.svg">
<defs
id="defs4451" />
<metadata
id="metadata4454">
<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
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer"
transform="translate(-14,17.620001)">
<g
style="fill:#808080;fill-opacity:1;stroke:none"
id="text4469"
transform="matrix(1.0223048,0,0,0.9009009,-0.31226766,-6.1245039)">
<path
d="m 14,2.7799982 10.76,0 0,4.44 -10.76,0 0,-4.44"
id="path5540"
inkscape:connector-curvature="0" />
</g>
<g
transform="matrix(1.0493827,0,0,1.0127932,7.0123457,-22.375865)"
style="fill:#808080;fill-opacity:1;stroke:none"
id="text5558">
<path
d="m 20.72,15.14 c -2e-6,-0.293319 0.09333,-0.653319 0.28,-1.08 0.186664,-0.453318 0.49333,-0.946651 0.92,-1.48 0.453329,-0.559983 1.159995,-1.026649 2.12,-1.4 0.959993,-0.373315 2.106659,-0.559982 3.44,-0.56 2.186655,1.8e-5 3.679987,0.520018 4.48,1.56 0.826652,1.013349 1.239985,2.773347 1.24,5.28 l 0,8.4 c -1.5e-5,0.826669 0.306652,1.240001 0.92,1.24 0.479984,10e-7 1.173316,-0.306665 2.08,-0.92 l 0,1.04 c -0.400017,0.480001 -0.93335,0.96 -1.6,1.44 -0.640016,0.479999 -1.213348,0.719999 -1.72,0.72 -0.960014,-10e-7 -1.666679,-0.293334 -2.12,-0.88 -0.453345,-0.586666 -0.706678,-1.319999 -0.76,-2.2 -2.213343,2.053334 -4.133341,3.079999 -5.76,3.08 -1.200005,-10e-7 -2.213337,-0.413334 -3.04,-1.24 -0.800002,-0.826665 -1.200002,-1.826664 -1.2,-3 -2e-6,-0.586663 0.09333,-1.133329 0.28,-1.64 0.213331,-0.533328 0.466664,-0.999994 0.76,-1.4 0.29333,-0.399993 0.69333,-0.786659 1.2,-1.16 0.506662,-0.399992 0.973329,-0.733325 1.4,-1 0.426661,-0.266658 0.959994,-0.533324 1.6,-0.8 0.666659,-0.293324 1.199992,-0.51999 1.6,-0.68 0.426658,-0.15999 0.959991,-0.35999 1.6,-0.6 0.666656,-0.239989 1.133322,-0.413322 1.4,-0.52 -1.1e-5,-2.239986 -0.186678,-3.759985 -0.56,-4.56 -0.373344,-0.82665 -1.16001,-1.239983 -2.36,-1.24 -0.453341,1.7e-5 -0.960008,0.106684 -1.52,0.32 -0.53334,0.21335 -0.906673,0.480016 -1.12,0.8 -0.05334,0.213349 -0.08001,0.413349 -0.08,0.6 -6e-6,0.133349 0.01333,0.400015 0.04,0.8 0.02666,0.373348 0.03999,0.680014 0.04,0.92 -6e-6,0.453347 -0.186672,0.86668 -0.56,1.24 -0.346672,0.373345 -0.746671,0.560012 -1.2,0.56 -0.58667,1.2e-5 -1.040003,-0.146655 -1.36,-0.44 -0.293336,-0.319987 -0.440002,-0.719987 -0.44,-1.2 m 9.12,10.04 0,-6.8 c -0.266678,0.106677 -0.706677,0.28001 -1.32,0.52 -0.613343,0.213343 -1.106676,0.400009 -1.48,0.56 -0.373342,0.133342 -0.813341,0.346675 -1.32,0.64 -0.506673,0.266675 -0.906673,0.560008 -1.2,0.88 -0.266673,0.293341 -0.506672,0.680007 -0.72,1.16 -0.213339,0.453339 -0.320005,0.973339 -0.32,1.56 -5e-6,0.933337 0.239995,1.720003 0.72,2.36 0.50666,0.613335 1.213326,0.920002 2.12,0.92 0.479992,2e-6 1.133324,-0.186665 1.96,-0.56 0.853323,-0.399997 1.373322,-0.81333 1.56,-1.24"
id="path5567"
inkscape:connector-curvature="0"
style="fill:#808080;fill-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -0,0 +1,74 @@
<?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="100"
height="100"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="night-mode.svg">
<defs
id="defs4" />
<metadata
id="metadata7">
<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(0,-952.36215)">
<path
sodipodi:type="arc"
style="opacity:0;fill:#000000;fill-opacity:0.50196078;stroke:#808080;stroke-width:10;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3778"
sodipodi:cx="42.5"
sodipodi:cy="52.5"
sodipodi:rx="27.5"
sodipodi:ry="27.5"
d="m 70,52.5 a 27.5,27.5 0 1 1 -55,0 27.5,27.5 0 1 1 55,0 z"
transform="translate(0,952.36215)" />
<path
sodipodi:type="arc"
style="opacity:0;fill:#000000;fill-opacity:0.50196078;stroke:#000000;stroke-width:10;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3790"
sodipodi:cx="47.5"
sodipodi:cy="50"
sodipodi:rx="32.5"
sodipodi:ry="35"
d="m 80,50 a 32.5,35 0 1 1 -65,0 32.5,35 0 1 1 65,0 z"
transform="translate(0,952.36215)" />
<g
transform="matrix(0.70710678,-0.70710678,0.70710678,0.70710678,-18.537197,1011.201)">
<rect
id="rect3794"
height="48"
width="48"
style="fill:none"
x="0"
y="0" />
<path
id="path3800"
d="m 54.714286,-7.78571 c -27.611111,0 -50.0000003,22.388889 -50.0000003,50 0,27.611111 22.3888893,50 50.0000003,50 27.611111,0 50.000004,-22.388889 50.000004,-50 0,-27.611111 -22.388893,-50 -50.000004,-50 z m 9.781481,83.492593 c -2.925925,0.8 -5.996296,1.229629 -9.174074,1.229629 -19.177777,0 -34.388888,-15.540741 -34.388888,-34.722222 0,-19.174074 15.211111,-34.722222 34.388888,-34.722222 3.174074,0 6.248149,0.433333 9.174074,1.237037 -14.729629,4.018518 -25.04074,17.485185 -25.04074,33.485185 0,16 10.311111,29.462963 25.04074,33.492593 z"
style="fill:#000000;fill-opacity:1"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ssssscssscsc" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -53,6 +53,10 @@
#define DEFAULT_CURRENT_FOLDER QString()
#define DEFAULT_INVERT_COLORS false
#define PAGETOOL_COLOR QColor(128,128,128) // any bg
#define NORMAL_PAGETOOL_HIGHLIGHT_COLOR QColor(64,64,64) // on white
#define INVERTED_PAGETOOL_HIGHLIGHT_COLOR QColor(192,192,192) // on black
// ==========================================================================
// BooksSettings::TextStyle
// ==========================================================================
@ -212,6 +216,30 @@ BooksSettings::BooksSettings(QObject* aParent) :
connect(iCurrentBookPath, SIGNAL(valueChanged()), SLOT(onCurrentBookPathChanged()));
}
bool
BooksSettings::increaseFontSize()
{
int size = fontSize();
if (size < MaxFontSize) {
setFontSize(size+1);
return true;
} else {
return false;
}
}
bool
BooksSettings::decreaseFontSize()
{
int size = fontSize();
if (size > MinFontSize) {
setFontSize(size-1);
return true;
} else {
return false;
}
}
int
BooksSettings::fontSize() const
{
@ -362,3 +390,17 @@ BooksSettings::onCurrentBookPathChanged()
Q_EMIT currentBookChanged();
}
}
QColor
BooksSettings::primaryPageToolColor() const
{
return PAGETOOL_COLOR;
}
QColor
BooksSettings::highlightPageToolColor() const
{
return invertColors() ?
INVERTED_PAGETOOL_HIGHLIGHT_COLOR :
NORMAL_PAGETOOL_HIGHLIGHT_COLOR;
}

View file

@ -36,6 +36,7 @@
#include "BooksTypes.h"
#include "ZLTextStyle.h"
#include <QColor>
#include <QtQml>
class MGConfItem;
@ -50,6 +51,8 @@ class BooksSettings : public QObject
Q_PROPERTY(QObject* currentBook READ currentBook WRITE setCurrentBook NOTIFY currentBookChanged)
Q_PROPERTY(QString currentFolder READ currentFolder WRITE setCurrentFolder NOTIFY currentFolderChanged)
Q_PROPERTY(QString currentStorage READ currentStorage NOTIFY currentStorageChanged)
Q_PROPERTY(QColor primaryPageToolColor READ primaryPageToolColor CONSTANT)
Q_PROPERTY(QColor highlightPageToolColor READ highlightPageToolColor NOTIFY invertColorsChanged)
class TextStyle;
public:
@ -61,6 +64,9 @@ public:
explicit BooksSettings(QObject* aParent = NULL);
Q_INVOKABLE bool increaseFontSize();
Q_INVOKABLE bool decreaseFontSize();
int fontSize() const;
void setFontSize(int aValue);
@ -79,6 +85,8 @@ public:
void setCurrentFolder(QString aValue);
QString currentStorage() const { return iCurrentStorageDevice; }
QColor primaryPageToolColor() const;
QColor highlightPageToolColor() const;
signals:
void fontSizeChanged();

View file

@ -51,7 +51,6 @@
#include <QGuiApplication>
#include <QStandardPaths>
#include <QStyleHints>
#include <QQuickView>
#include <QQmlContext>
@ -170,8 +169,6 @@ void ZLibrary::run(ZLApplication* aApp)
QQmlContext* root = view->rootContext();
root->setContextProperty("PointsPerInch", BOOKS_PPI);
root->setContextProperty("MaximumHintCount", 1);
root->setContextProperty("DoubleClickInterval",
qApp->styleHints()->mouseDoubleClickInterval());
view->setSource(QUrl::fromLocalFile(qml));
view->show();

View file

@ -3,18 +3,6 @@
<TS version="2.1" language="fi">
<context>
<name></name>
<message id="book-font-default">
<source>Use default fonts</source>
<translation>Oletuskirjasimet</translation>
</message>
<message id="book-font-smaller">
<source>Use smaller fonts</source>
<translation>Pienemmät kirjasimet</translation>
</message>
<message id="book-font-larger">
<source>Use larger fonts</source>
<translation>Suuremmat kirjasimet</translation>
</message>
<message id="book-view-back">
<source>Back to library</source>
<translation>Takaisin kirjalistaan</translation>

View file

@ -3,18 +3,6 @@
<TS version="2.1" language="ru">
<context>
<name></name>
<message id="book-font-default">
<source>Use default fonts</source>
<translation>Шрифты по умолчанию</translation>
</message>
<message id="book-font-smaller">
<source>Use smaller fonts</source>
<translation>Шрифты поменьше</translation>
</message>
<message id="book-font-larger">
<source>Use larger fonts</source>
<translation>Шрифты побольше</translation>
</message>
<message id="book-view-back">
<source>Back to library</source>
<translation>Вернуться в библиотеку</translation>

View file

@ -3,18 +3,6 @@
<TS version="2.1" language="sv">
<context>
<name></name>
<message id="book-font-default">
<source>Use default fonts</source>
<translation>Standardteckensnitt</translation>
</message>
<message id="book-font-smaller">
<source>Use smaller fonts</source>
<translation>Mindre teckensnitt</translation>
</message>
<message id="book-font-larger">
<source>Use larger fonts</source>
<translation>Större teckensnitt</translation>
</message>
<message id="book-view-back">
<source>Back to library</source>
<translation>Tillbaka till biblioteket</translation>

View file

@ -3,18 +3,6 @@
<TS version="2.1" language="en">
<context>
<name></name>
<message id="book-font-default">
<source>Use default fonts</source>
<translation>Use default fonts</translation>
</message>
<message id="book-font-smaller">
<source>Use smaller fonts</source>
<translation>Use smaller fonts</translation>
</message>
<message id="book-font-larger">
<source>Use larger fonts</source>
<translation>Use larger fonts</translation>
</message>
<message id="book-view-back">
<source>Back to library</source>
<translation>Back to library</translation>