diff --git a/app/app.pro b/app/app.pro index c4914b9..feae011 100644 --- a/app/app.pro +++ b/app/app.pro @@ -32,6 +32,7 @@ HARBOUR_LIB_DIR = $$_PRO_FILE_PWD_/../harbour-lib HARBOUR_INCLUDE_DIR = $$HARBOUR_LIB_DIR/include HARBOUR_SRC_DIR = $$HARBOUR_LIB_DIR/src +HARBOUR_LIB_QML = $$HARBOUR_LIB_DIR/qml # Libraries FBREADER_LIB = $$OUT_PWD/../fbreader/libfbreader.a @@ -191,6 +192,16 @@ SOURCES += \ $$HARBOUR_SRC_DIR/HarbourPluginLoader.cpp \ $$HARBOUR_SRC_DIR/HarbourTask.cpp +HARBOUR_QML_COMPONENTS = \ + $$HARBOUR_LIB_QML/HarbourFitLabel.qml \ + $$HARBOUR_LIB_QML/HarbourHorizontalSwipeHint.qml + +OTHER_FILES += $${HARBOUR_QML_COMPONENTS} + +qml_components.files = $${HARBOUR_QML_COMPONENTS} +qml_components.path = /usr/share/$${TARGET}/qml/harbour +INSTALLS += qml_components + # Icons ICON_SIZES = 86 108 128 256 for(s, ICON_SIZES) { diff --git a/app/qml/BooksBookView.qml b/app/qml/BooksBookView.qml index 9a91cc8..14c9692 100644 --- a/app/qml/BooksBookView.qml +++ b/app/qml/BooksBookView.qml @@ -1,6 +1,6 @@ /* - Copyright (C) 2015-2018 Jolla Ltd. - Copyright (C) 2015-2018 Slava Monich + Copyright (C) 2015-2019 Jolla Ltd. + Copyright (C) 2015-2019 Slava Monich You may use this file under the terms of BSD license as follows: @@ -8,14 +8,15 @@ 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 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. + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. 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. + 3. Neither the names of the copyright holders 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 @@ -38,6 +39,8 @@ import harbour.books 1.0 //import Sailfish.Media 1.0 // Not allowed //import org.nemomobile.policy 1.0 // Not allowed +import "harbour" + SilicaFlickable { id: root @@ -362,7 +365,7 @@ SilicaFlickable { running: loading } - BooksFitLabel { + HarbourFitLabel { anchors.fill: busyIndicator text: bookModel.progress > 0 ? bookModel.progress : "" opacity: (loading && bookModel.progress > 0) ? 1 : 0 diff --git a/app/qml/BooksFitLabel.qml b/app/qml/BooksFitLabel.qml deleted file mode 100644 index 0d652df..0000000 --- a/app/qml/BooksFitLabel.qml +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2015 Jolla Ltd. - Contact: Slava Monich - - 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 - -Label { - property int minFontSize: Theme.fontSizeTiny - property int maxFontSize: Theme.fontSizeMedium - - smooth: true - visible: opacity > 0 - color: Theme.highlightColor - anchors.margins: Theme.paddingMedium - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - - Behavior on opacity { FadeAnimation {} } - - Component.onCompleted: refitText() - - onWidthChanged: refitText() - onHeightChanged: refitText() - onTextChanged: refitText() - onMaxFontSizeChanged: refitText() - onMinFontSizeChanged: refitText() - - function refitText() { - if (paintedHeight > 0 && paintedWidth > 0) { - if (font.pixelSize % 2) font.pixelSize++ - while (paintedWidth > width || paintedHeight > height) { - if ((font.pixelSize -= 2) <= minFontSize) - break - } - while (paintedWidth < width && paintedHeight < height) { - font.pixelSize += 2 - } - font.pixelSize -= 2 - if (font.pixelSize >= maxFontSize) { - font.pixelSize = maxFontSize - return - } - } - } -} diff --git a/app/qml/BooksImport.qml b/app/qml/BooksImport.qml index e0ce5fc..56d29e6 100644 --- a/app/qml/BooksImport.qml +++ b/app/qml/BooksImport.qml @@ -1,6 +1,6 @@ /* - Copyright (C) 2015-2017 Jolla Ltd. - Contact: Slava Monich + Copyright (C) 2015-2019 Jolla Ltd. + Copyright (C) 2015-2019 Slava Monich You may use this file under the terms of BSD license as follows: @@ -8,14 +8,15 @@ 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 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. + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. 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. + 3. Neither the names of the copyright holders 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 @@ -34,6 +35,8 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 import harbour.books 1.0 +import "harbour" + Dialog { id: root allowedOrientations: window.allowedOrientations @@ -117,7 +120,7 @@ Dialog { running: _loading && !importModel.count } - BooksFitLabel { + HarbourFitLabel { anchors.fill: busyIndicator text: importModel.progress > 0 ? importModel.progress : "" opacity: (busyIndicator.running && importModel.progress > 0) ? 1 : 0 diff --git a/app/qml/BooksShelfView.qml b/app/qml/BooksShelfView.qml index 5130514..706f62b 100644 --- a/app/qml/BooksShelfView.qml +++ b/app/qml/BooksShelfView.qml @@ -1,40 +1,42 @@ /* - Copyright (C) 2015-2016 Jolla Ltd. - Contact: Slava Monich + Copyright (C) 2015-2019 Jolla Ltd. + Copyright (C) 2015-2019 Slava Monich - You may use this file under the terms of the BSD license as follows: + 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 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. + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. 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. + 3. Neither the names of the copyright holders 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 - OWNER 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. + 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 +import "harbour" + Item { id: shelfView @@ -314,22 +316,18 @@ Item { active: globalHints.storageLeftSwipe < MaximumHintCount || running property bool running sourceComponent: Component { - BooksStorageLeftSwipeHint { - property bool hintCanBeEnabled: !_loading && + HarbourHorizontalSwipeHint { + hintEnabled: !_loading && storageView.visible && shelfIndex == storageListWatcher.currentIndex && (shelfIndex+1) < storageModel.count && globalHints.storageLeftSwipe < MaximumHintCount - hintEnabled: hintCanBeEnabled && !hintDelayTimer.running + //% "Swipe left to see what's on the SD-card" + text: qsTrId("harbour-books-storage-view-swipe_left_hint") + swipeRight: false onHintShown: globalHints.storageLeftSwipe++ onHintRunningChanged: leftSwipeHintLoader.running = hintRunning - onHintCanBeEnabledChanged: if (hintCanBeEnabled) hintDelayTimer.restart() - Component.onCompleted: if (hintCanBeEnabled) hintDelayTimer.restart() - Timer { - id: hintDelayTimer - interval: 1000 - } } } } diff --git a/app/qml/BooksStorageLeftSwipeHint.qml b/app/qml/BooksStorageLeftSwipeHint.qml deleted file mode 100644 index 96fd8e3..0000000 --- a/app/qml/BooksStorageLeftSwipeHint.qml +++ /dev/null @@ -1,47 +0,0 @@ -import QtQuick 2.0 -import Sailfish.Silica 1.0 - -Loader { - id: root - anchors.fill: parent - active: hintEnabled || hintRunning - - property bool hintEnabled - property bool hintRunning - signal hintShown() - - sourceComponent: Component { - Item { - anchors.fill: parent - property bool cancelled - function showHint() { - hintRunning = true - hintShownTimer.restart() - touchInteractionHint.start() - } - Connections { - target: root - onHintEnabledChanged: if (root.hintEnabled) showHint(); - } - Component.onCompleted: if (root.hintEnabled) showHint(); - InteractionHintLabel { - //% "Swipe left to see what's on the SD-card" - text: qsTrId("harbour-books-storage-view-swipe_left_hint") - anchors.bottom: parent.bottom - opacity: touchInteractionHint.running ? 1.0 : 0.0 - Behavior on opacity { FadeAnimation { duration: 1000 } } - } - TouchInteractionHint { - id: touchInteractionHint - direction: TouchInteraction.Left - anchors.verticalCenter: parent.verticalCenter - onRunningChanged: hintRunning = running - } - Timer { - id: hintShownTimer - interval: 1000 - onTriggered: root.hintShown() - } - } - } -} diff --git a/harbour-lib b/harbour-lib index 1ee8f17..0aac368 160000 --- a/harbour-lib +++ b/harbour-lib @@ -1 +1 @@ -Subproject commit 1ee8f17898e140bc160f1222d3f1c502ea0b30e0 +Subproject commit 0aac36828346324bb8ab99f821ac90361bc82ec9