Merge branch 'fixed_aurora_build'

This commit is contained in:
Denis Fedoseev 2023-11-19 21:30:19 +03:00
commit 0dcbfb4e4e
20 changed files with 226 additions and 220 deletions

12
.gitignore vendored
View file

@ -1,3 +1,13 @@
harbour-books.pro.user
harbour-books.pro.user*
tests.pro.user
build
*.o
moc_*.cpp
*.moc
Makefile
*.a
*.list
org.monich.harbour.books*.qm
org.monich.harbour.books*.ts
org.monich.harbour.books
RPMS/

View file

@ -1,7 +1,8 @@
## E-book reader for Sailfish OS
![icon](app/icons/86x86/harbour-books.png)
![icon](app/icons/harbour-books.svg)
[EN]
The core functionality is based on [FBReader](https://github.com/geometer/FBReader)
source code with a few modifications. Books are imported from the Downloads folder,
where they are saved by the browser or email client. Alternatively, you can
@ -11,3 +12,8 @@ folder. Removable storage is supported as well, the books are stored in the
In theory, it should be able to handle all E-book formats supported by FBReader.
Tested mostly with epub and fb2.
[RUS]
Основная функциональность основана на исходном коде [FBReader](https://github.com/geometer/FBReader) с небольшими изменениями. Книги импортируются из папки Downloads, куда они сохраняются браузером или почтовым клиентом. Также можно вручную скопировать книги в каталог `Documents/Books` в домашней папке. Поддерживается и съемный носитель, там книги хранятся в каталоге `/Books`.
Теоретически, программа должна работать со всеми форматами электронных книг, поддерживаемыми FBReader. Проверено в основном на epub и fb2.

View file

@ -1,4 +1,5 @@
NAME = books
NAME = harbour.books
ORIGINAL_NAME = books
openrepos {
PREFIX = openrepos
@ -7,9 +8,10 @@ openrepos {
PREFIX = harbour
}
TARGET = $${PREFIX}-$${NAME}
CONFIG += sailfishapp link_pkgconfig
PKGCONFIG += sailfishapp mlite5 glib-2.0
PREFIX = org.monich
TARGET = $${PREFIX}.$${NAME}
CONFIG += auroraapp link_pkgconfig
PKGCONFIG += auroraapp mlite5 glib-2.0
app_settings {
# This path is hardcoded in jolla-settings
@ -25,10 +27,10 @@ CONFIG(debug, debug|release) {
}
# Directories
FBREADER_DIR = $$_PRO_FILE_PWD_/../fbreader
FRIBIDI_DIR = $$_PRO_FILE_PWD_/../fribidi
LINEBREAK_DIR = $$_PRO_FILE_PWD_/../linebreak
HARBOUR_LIB_DIR = $$_PRO_FILE_PWD_/../harbour-lib
FBREADER_DIR = ../fbreader
FRIBIDI_DIR = ../fribidi
LINEBREAK_DIR = ../linebreak
HARBOUR_LIB_DIR = ../harbour-lib
HARBOUR_INCLUDE_DIR = $$HARBOUR_LIB_DIR/include
HARBOUR_SRC_DIR = $$HARBOUR_LIB_DIR/src
@ -51,7 +53,7 @@ LIBS += \
OTHER_FILES += \
icons/harbour-books.svg \
*.desktop \
$${TARGET}.desktop \
qml/*.qml \
qml/*.js \
qml/images/* \
@ -194,6 +196,7 @@ openrepos {
HEADERS += \
$$HARBOUR_INCLUDE_DIR/HarbourBase45.h \
$$HARBOUR_INCLUDE_DIR/HarbourBattery.h \
$$HARBOUR_INCLUDE_DIR/HarbourColorEditorModel.h \
$$HARBOUR_INCLUDE_DIR/HarbourDisplayBlanking.h \
$$HARBOUR_INCLUDE_DIR/HarbourJson.h \
@ -206,6 +209,7 @@ HEADERS += \
SOURCES += \
$$HARBOUR_SRC_DIR/HarbourBase45.cpp \
$$HARBOUR_SRC_DIR/HarbourBattery.cpp \
$$HARBOUR_SRC_DIR/HarbourColorEditorModel.cpp \
$$HARBOUR_SRC_DIR/HarbourDisplayBlanking.cpp \
$$HARBOUR_SRC_DIR/HarbourJson.cpp \
@ -229,20 +233,6 @@ qml_components.files = $${HARBOUR_QML_COMPONENTS}
qml_components.path = /usr/share/$${TARGET}/qml/harbour
INSTALLS += qml_components
# Icons
ICON_SIZES = 86 108 128 172 256
for(s, ICON_SIZES) {
icon_target = icon$${s}
icon_dir = icons/$${s}x$${s}
$${icon_target}.files = $${icon_dir}/$${TARGET}.png
$${icon_target}.path = /usr/share/icons/hicolor/$${s}x$${s}/apps
equals(PREFIX, "openrepos") {
$${icon_target}.extra = cp $${icon_dir}/harbour-$${NAME}.png $$eval($${icon_target}.files)
$${icon_target}.CONFIG += no_check_exist
}
INSTALLS += $${icon_target}
}
settings_qml.files = settings/*.qml
settings_qml.path = /usr/share/$${TARGET}/settings/
INSTALLS += settings_qml
@ -271,7 +261,7 @@ defineTest(addTrFile) {
export(OTHER_FILES)
in = $${_PRO_FILE_PWD_}/$${rel}
out = $${OUT_PWD}/translations/$${PREFIX}-$${1}
out = $${OUT_PWD}/translations/$${PREFIX}.harbour.$${1}
s = $$replace(1,-,_)
lupdate_target = lupdate_$$s
@ -299,7 +289,7 @@ defineTest(addTrFile) {
LANGUAGES = de fi hu nl pl pt ru sv es zh_CN
addTrFile($${NAME})
addTrFile($${ORIGINAL_NAME})
for(l, LANGUAGES) {
addTrFile($${NAME}-$$l)
addTrFile($${ORIGINAL_NAME}-$$l)
}

View file

@ -1,44 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
width="86px"
height="86px"
viewBox="0 0 86 86"
enable-background="new 0 0 86 86"
xml:space="preserve"
inkscape:version="0.48.2 r9819">
<rect
y="0"
x="0"
style="opacity:0;fill:#ffffff"
width="86"
height="86"/>
<g>
<linearGradient
id="SVGID_1_"
gradientUnits="userSpaceOnUse"
x1="79.2383"
y1="91.3279"
x2="6.7619"
y2="18.8514">
<stop
offset="0"
style="stop-color:#f5d9a8;stop-opacity:1;"/>
<stop
offset="1"
style="stop-color:#cc9933;stop-opacity:1;"/>
</linearGradient>
<path
fill="url(#SVGID_1_)"
d="M43,0.3C19.417,0.3,0.3,19.418,0.3,43c0,0.408,0,41.277,0,41.277c0,0.786,0.637,1.423,1.423,1.423 h82.553c0.786,0,1.423-0.637,1.423-1.423c0,0,0-40.908,0-41.277C85.7,19.418,66.583,0.3,43,0.3z"/>
</g>
<path
inkscape:connector-curvature="0"
d="m 65.244239,25.145325 2.755924,0 0,52.854675 -39.567187,0 C 22.625852,78 17.999837,73.964541 17.999837,67.960564 l 0,-45.768014 c 0,-3.248053 2.657498,-5.90555 5.905551,-5.90555 l 36.614411,0 0,45.374311 -32.086823,0 c -4.035459,0 -6.889809,2.165368 -6.889809,6.102402 l 0,0.196851 c 0,3.937034 2.85435,6.496106 6.889809,6.496106 l 36.811263,0 0,-49.311345 z m -4.72444,44.193201 -31.69312,0 c -0.885832,0 -1.673239,-0.492128 -1.673239,-1.476387 0,-0.787407 0.787407,-1.279537 1.673239,-1.279537 l 31.69312,0 0,2.755924 z"
style="fill:#cc0000;fill-opacity:1"/>
</svg>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by Pixelmator Pro 3.4.3 -->
<svg width="86" height="86" viewBox="0 0 86 86" xmlns="http://www.w3.org/2000/svg">
<path id="path1" fill="#ffffff" stroke="none" opacity="0" d="M 0 0 L 86 0 L 86 86 L 0 86 Z"/>
<g id="g1">
<linearGradient id="linearGradient1" x1="79.238723" y1="91.3279" x2="6.761477" y2="18.8514" gradientUnits="userSpaceOnUse">
<stop offset="1e-05" stop-color="#f5d9a8" stop-opacity="1"/>
<stop offset="1" stop-color="#cc9933" stop-opacity="1"/>
</linearGradient>
<path id="---" fill="url(#linearGradient1)" fill-rule="evenodd" stroke="none" d="M 0.299502 69.699997 C 0.299502 78.536552 7.462946 85.699997 16.299501 85.699997 L 69.699493 85.699997 C 78.536049 85.699997 85.699493 78.536552 85.699493 69.699997 L 85.699493 16.300003 C 85.699493 7.463448 78.536049 0.300003 69.699493 0.300003 L 16.299501 0.300003 C 7.462946 0.300003 0.299502 7.463448 0.299502 16.300003 Z"/>
</g>
<path id="path2" fill="#cc0000" stroke="none" d="M 65.24424 25.145325 L 68.00016 25.145325 L 68.00016 78 L 28.432976 78 C 22.625853 78 17.999838 73.964539 17.999838 67.960564 L 17.999838 22.192551 C 17.999838 18.944496 20.657335 16.287003 23.905388 16.287003 L 60.519798 16.287003 L 60.519798 61.661312 L 28.432976 61.661312 C 24.397516 61.661312 21.543167 63.826679 21.543167 67.76371 L 21.543167 67.960564 C 21.543167 71.897598 24.397516 74.456673 28.432976 74.456673 L 65.24424 74.456673 L 65.24424 25.145325 Z M 60.519798 69.338524 L 28.826679 69.338524 C 27.940847 69.338524 27.15344 68.846397 27.15344 67.862137 C 27.15344 67.07473 27.940847 66.582603 28.826679 66.582603 L 60.519798 66.582603 L 60.519798 69.338524 Z"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -10,11 +10,13 @@ Name[pt_BR]=Livros
Name[ru]=Книги
Name[sv]=Böcker
Comment=E-Book Reader
Exec=harbour-books
Icon=harbour-books
X-Nemo-Application-Type=generic
Exec=org.monich.harbour.books
Icon=org.monich.harbour.books
X-Nemo-Application-Type=silica-qt5
[X-Sailjail]
[X-Application]
Permissions=Documents;Downloads;RemovableMedia;Audio
OrganizationName=de.whataco
ApplicationName=books
OrganizationName=org.monich
ApplicationName=harbour.books
ExecDBus=/usr/bin/org.monich.harbour.books %u

View file

@ -1,6 +1,6 @@
/*
Copyright (C) 2015-2023 Slava Monich <slava@monich.com>
Copyright (C) 2015-2022 Jolla Ltd.
Copyright (C) 2015-2022 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@ -34,7 +34,7 @@
import QtQuick 2.0
import QtFeedback 5.0
import Sailfish.Silica 1.0
import org.nemomobile.notifications 1.0
import Nemo.Notifications 1.0
import harbour.books 1.0
import "harbour"
@ -280,8 +280,6 @@ Item {
pager.setPage(currentPage)
}
onCurrentIndexChanged: updateModel()
onMovingChanged: updateModel()
delegate: BooksPageView {
@ -368,9 +366,9 @@ Item {
}
function updateModel() {
if (completed && !moving && currentIndex >= 0 && !bookViewWatcher.updatingViewPosition) {
if (completed && !moving && bookViewWatcher.currentIndex >= 0 && !bookViewWatcher.updatingViewPosition) {
hideViews()
stackModel.currentPage = currentIndex
stackModel.currentPage = bookViewWatcher.currentIndex
}
}
@ -378,6 +376,7 @@ Item {
id: bookViewWatcher
listView: bookView
onCurrentIndexChanged: bookView.updateModel()
}
NumberAnimation {

View file

@ -1,6 +1,6 @@
/*
Copyright (C) 2015-2023 Slava Monich <slava@monich.com>
Copyright (C) 2015-2021 Jolla Ltd.
Copyright (C) 2015-2021 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@ -8,27 +8,25 @@
modification, are permitted provided that the following conditions
are met:
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.
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 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.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 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) ARISING
IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import QtQuick 2.0
@ -52,10 +50,12 @@ ApplicationWindow {
property variant currentShelf: mainPage.currentShelf
DisplayBlanking {
HarbourDisplayBlanking {
pauseRequested: Qt.application.active &&
Settings.currentBook &&
Settings.keepDisplayOn
Settings.currentBook && Settings.keepDisplayOn &&
(HarbourBattery.batteryState === HarbourBattery.BatteryStateCharging ||
HarbourBattery.batteryLevel === 0 || // Zero if unknown (not reported by mce)
HarbourBattery.batteryLevel >= Settings.lowBatteryLevel)
}
Binding {

View file

@ -33,7 +33,7 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import org.nemomobile.configuration 1.0
import Nemo.Configuration 1.0
ComboBox {
id: actionComboBox

View file

@ -33,7 +33,7 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import org.nemomobile.configuration 1.0
import Nemo.Configuration 1.0
import "../qml/Books.js" as Books
import "../qml/harbour"
@ -64,11 +64,11 @@ Page {
var parts = Qt.resolvedUrl("dummy").split('/')
if (parts.length > 2) {
var name = parts[parts.length-3]
if (name.indexOf("-books") >= 0) {
if (name.indexOf(".books") >= 0) {
return name
}
}
return "harbour-books"
return "org.monich.harbour.books"
}
Loader {

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2021 Jolla Ltd.
* Copyright (C) 2015-2021 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2023 Slava Monich <slava@monich.com>
* Copyright (C) 2015-2022 Jolla Ltd.
*
* You may use this file under the terms of the BSD license as follows:
*
@ -8,27 +8,25 @@
* modification, are permitted provided that the following conditions
* are met:
*
* 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.
* 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 ``AS IS'' AND ANY EXPRESSED 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 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) ARISING
* IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "BooksBookModel.h"
@ -153,7 +151,7 @@ BooksPos::List BooksBookModel::PagingTask::loadPageMarks() const
uchar* map = file.map(0, size);
if (map) {
HDEBUG("reading" << qPrintable(iPageMarksFile));
if (size > sizeof(MarksHeader)) {
if (size > (int) sizeof(MarksHeader)) {
const qint64 dataSize = size - sizeof(MarksHeader);
const MarksHeader* hdr = (MarksHeader*)map;
if (!memcmp(hdr->magic, MarksFileMagic, sizeof(hdr->magic)) &&

View file

@ -278,7 +278,7 @@ private:
static bool iMissing;
};
const char* BooksCoverWidget::DefaultImage::iImageName = "default-cover.jpg";
const char* BooksCoverWidget::DefaultImage::iImageName = "../qml/images/default-cover.jpg";
QImage* BooksCoverWidget::DefaultImage::iImage = NULL;
QImage* BooksCoverWidget::DefaultImage::iScaledImage = NULL;
int BooksCoverWidget::DefaultImage::iRefCount = 0;

View file

@ -41,7 +41,7 @@
# define BOOKS_APP_NAME "openrepos-books"
# define BOOKS_SETTINGS_MENU false
#else
# define BOOKS_APP_NAME "harbour-books"
# define BOOKS_APP_NAME "org.monich.harbour.books"
# define BOOKS_SETTINGS_MENU true
#endif

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2023 Slava Monich <slava@monich.com>
* Copyright (C) 2015-2022 Jolla Ltd.
* Copyright (C) 2015-2022 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@ -8,27 +8,25 @@
* modification, are permitted provided that the following conditions
* are met:
*
* 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.
* 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 ``AS IS'' AND ANY EXPRESSED 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 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) ARISING
* IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "BooksSettings.h"
@ -54,8 +52,9 @@
#define KEY_CURRENT_BOOK DCONF_PATH_("currentBook")
#define KEY_CURRENT_FOLDER DCONF_PATH_("currentFolder")
#define KEY_REMOVABLE_ROOT DCONF_PATH_("removableRoot")
#define KEY_KEEP_DISPLAY_ON DCONF_PATH_("keepDisplayOn")
#define KEY_BOOK_PULL_DOWN_MENU DCONF_PATH_("bookPullDownMenu")
#define KEY_KEEP_DISPLAY_ON DCONF_PATH_("keepDisplayOn")
#define KEY_LOW_BATTERY_LEVEL DCONF_PATH_("lowBatteryLevel")
#define KEY_VOLUME_UP_ACTION DCONF_PATH_("volumeUpAction")
#define KEY_VOLUME_DOWN_ACTION DCONF_PATH_("volumeDownAction")
#define KEY_ORIENTATION DCONF_PATH_("orientation")
@ -69,11 +68,12 @@
#define DEFAULT_CURRENT_BOOK QString()
#define DEFAULT_CURRENT_FOLDER QString()
#define DEFAULT_REMOVABLE_ROOT "Books"
#define DEFAULT_KEEP_DISPLAY_ON false
#define DEFAULT_BOOK_PULL_DOWN_MENU true
#define DEFAULT_VOLUME_UP_ACTION (BooksSettings::ActionNextPage)
#define DEFAULT_VOLUME_DOWN_ACTION (BooksSettings::ActionPreviousPage)
#define DEFAULT_ORIENTATION (BooksSettings::OrientationAny)
#define DEFAULT_KEEP_DISPLAY_ON false
#define DEFAULT_LOW_BATTERY_LEVEL 20 // percent
#define DEFAULT_VOLUME_UP_ACTION BooksSettings::ActionNextPage
#define DEFAULT_VOLUME_DOWN_ACTION BooksSettings::ActionPreviousPage
#define DEFAULT_ORIENTATION BooksSettings::OrientationAny
// ==========================================================================
// BooksSettings::TextStyle
@ -257,8 +257,9 @@ public:
MGConfItem* iPageDetailsFixedConf;
MGConfItem* iTurnPageByTapConf;
MGConfItem* iSampleBookCopiedConf;
MGConfItem* iKeepDisplayOnConf;
MGConfItem* iBookPullDownMenuConf;
MGConfItem* iKeepDisplayOnConf;
MGConfItem* iLowBatteryLevelConf;
MGConfItem* iVolumeUpActionConf;
MGConfItem* iVolumeDownActionConf;
MGConfItem* iCurrentFolderConf;
@ -282,8 +283,9 @@ BooksSettings::Private::Private(BooksSettings* aParent) :
iPageDetailsFixedConf(new MGConfItem(KEY_PAGE_DETAILS_FIXED, this)),
iTurnPageByTapConf(new MGConfItem(KEY_TURN_PAGE_BY_TAP, this)),
iSampleBookCopiedConf(new MGConfItem(KEY_SAMPLE_BOOK_COPIED, this)),
iKeepDisplayOnConf(new MGConfItem(KEY_KEEP_DISPLAY_ON, this)),
iBookPullDownMenuConf(new MGConfItem(KEY_BOOK_PULL_DOWN_MENU, this)),
iKeepDisplayOnConf(new MGConfItem(KEY_KEEP_DISPLAY_ON, this)),
iLowBatteryLevelConf(new MGConfItem(KEY_LOW_BATTERY_LEVEL, this)),
iVolumeUpActionConf(new MGConfItem(KEY_VOLUME_UP_ACTION, this)),
iVolumeDownActionConf(new MGConfItem(KEY_VOLUME_DOWN_ACTION, this)),
iCurrentFolderConf(new MGConfItem(KEY_CURRENT_FOLDER, this)),
@ -303,8 +305,9 @@ BooksSettings::Private::Private(BooksSettings* aParent) :
connect(iPageDetailsFixedConf, SIGNAL(valueChanged()), aParent, SIGNAL(pageDetailsFixedChanged()));
connect(iTurnPageByTapConf, SIGNAL(valueChanged()), aParent, SIGNAL(turnPageByTapChanged()));
connect(iSampleBookCopiedConf, SIGNAL(valueChanged()), aParent, SIGNAL(sampleBookCopiedChanged()));
connect(iKeepDisplayOnConf, SIGNAL(valueChanged()), aParent, SIGNAL(keepDisplayOnChanged()));
connect(iBookPullDownMenuConf, SIGNAL(valueChanged()), aParent, SIGNAL(bookPullDownMenuChanged()));
connect(iKeepDisplayOnConf, SIGNAL(valueChanged()), aParent, SIGNAL(keepDisplayOnChanged()));
connect(iLowBatteryLevelConf, SIGNAL(valueChanged()), aParent, SIGNAL(lowBatteryLevelChanged()));
connect(iVolumeUpActionConf, SIGNAL(valueChanged()), aParent, SIGNAL(volumeUpActionChanged()));
connect(iVolumeDownActionConf, SIGNAL(valueChanged()), aParent, SIGNAL(volumeDownActionChanged()));
connect(iOrientationConf, SIGNAL(valueChanged()), aParent, SIGNAL(orientationChanged()));
@ -686,20 +689,6 @@ BooksSettings::setTurnPageByTap(
iPrivate->iTurnPageByTapConf->set(aValue);
}
bool
BooksSettings::keepDisplayOn() const
{
return iPrivate->iKeepDisplayOnConf->value(DEFAULT_KEEP_DISPLAY_ON).toBool();
}
void
BooksSettings::setKeepDisplayOn(
bool aValue)
{
HDEBUG(aValue);
iPrivate->iKeepDisplayOnConf->set(aValue);
}
bool
BooksSettings::bookPullDownMenu() const
{
@ -727,6 +716,33 @@ BooksSettings::setSampleBookCopied()
iPrivate->iSampleBookCopiedConf->set(true);
}
bool
BooksSettings::keepDisplayOn() const
{
return iPrivate->iKeepDisplayOnConf->value(DEFAULT_KEEP_DISPLAY_ON).toBool();
}
void
BooksSettings::setKeepDisplayOn(
bool aValue)
{
HDEBUG(aValue);
iPrivate->iKeepDisplayOnConf->set(aValue);
}
int
BooksSettings::lowBatteryLevel() const
{
return iPrivate->iLowBatteryLevelConf->value(DEFAULT_LOW_BATTERY_LEVEL).toInt();
}
void
BooksSettings::setLowBatteryLevel(
int aValue)
{
HDEBUG(aValue);
iPrivate->iLowBatteryLevelConf->set(aValue);
}
BooksSettings::Action
BooksSettings::volumeUpAction() const

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2023 Slava Monich <slava@monich.com>
* Copyright (C) 2015-2022 Jolla Ltd.
* Copyright (C) 2015-2022 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@ -8,27 +8,25 @@
* modification, are permitted provided that the following conditions
* are met:
*
* 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.
* 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 ``AS IS'' AND ANY EXPRESSED 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 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) ARISING
* IN ANY WAY OUT OF THE USE OR INABILITY TO USE THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef BOOKS_SETTINGS_H
@ -54,8 +52,9 @@ class BooksSettings : public BooksSettingsBase
Q_PROPERTY(bool pageDetailsFixed READ pageDetailsFixed WRITE setPageDetailsFixed NOTIFY pageDetailsFixedChanged)
Q_PROPERTY(bool turnPageByTap READ turnPageByTap WRITE setTurnPageByTap NOTIFY turnPageByTapChanged)
Q_PROPERTY(bool sampleBookCopied READ sampleBookCopied NOTIFY sampleBookCopiedChanged)
Q_PROPERTY(bool keepDisplayOn READ keepDisplayOn WRITE setKeepDisplayOn NOTIFY keepDisplayOnChanged)
Q_PROPERTY(bool bookPullDownMenu READ bookPullDownMenu WRITE setBookPullDownMenu NOTIFY bookPullDownMenuChanged)
Q_PROPERTY(bool keepDisplayOn READ keepDisplayOn WRITE setKeepDisplayOn NOTIFY keepDisplayOnChanged)
Q_PROPERTY(int lowBatteryLevel READ lowBatteryLevel WRITE setLowBatteryLevel NOTIFY lowBatteryLevelChanged)
Q_PROPERTY(int volumeUpAction READ volumeUpAction WRITE setVolumeUpAction NOTIFY volumeUpActionChanged)
Q_PROPERTY(int volumeDownAction READ volumeDownAction WRITE setVolumeDownAction NOTIFY volumeDownActionChanged)
Q_PROPERTY(QObject* currentBook READ currentBook WRITE setCurrentBook NOTIFY currentBookChanged)
@ -111,15 +110,18 @@ public:
bool turnPageByTap() const;
void setTurnPageByTap(bool);
bool keepDisplayOn() const;
void setKeepDisplayOn(bool);
bool bookPullDownMenu() const;
void setBookPullDownMenu(bool);
bool sampleBookCopied() const;
void setSampleBookCopied();
bool keepDisplayOn() const;
void setKeepDisplayOn(bool);
int lowBatteryLevel() const;
void setLowBatteryLevel(int);
Action volumeUpAction() const;
void setVolumeUpAction(int);
@ -150,8 +152,9 @@ Q_SIGNALS:
void pageDetailsFixedChanged();
void turnPageByTapChanged();
void sampleBookCopiedChanged();
void keepDisplayOnChanged();
void bookPullDownMenuChanged();
void keepDisplayOnChanged();
void lowBatteryLevelChanged();
void volumeUpActionChanged();
void volumeDownActionChanged();
void currentBookChanged();

View file

@ -50,7 +50,7 @@
#include "formats/xhtml/XHTMLReader.h"
#include "library/Tag.h"
#include <sailfishapp.h>
#include <auroraapp.h>
#include <MGConfItem>
#include <QGuiApplication>

View file

@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2022 Jolla Ltd.
* Copyright (C) 2015-2022 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2015-2023 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@ -52,6 +52,7 @@
#include "BooksHints.h"
#include "BooksUtil.h"
#include "HarbourBattery.h"
#include "HarbourColorEditorModel.h"
#include "HarbourDisplayBlanking.h"
#include "HarbourDebug.h"
@ -60,7 +61,7 @@
#include "ZLibrary.h"
#include "ZLLanguageUtil.h"
#include <sailfishapp.h>
#include <auroraapp.h>
#include <QGuiApplication>
#include <QQuickView>
@ -82,7 +83,7 @@
Q_DECL_EXPORT int main(int argc, char **argv)
{
QGuiApplication* app = SailfishApp::application(argc, argv);
QGuiApplication* app = Aurora::Application::application(argc, argv);
qRegisterMetaType<BooksPos>();
qRegisterMetaType<BooksColorScheme>();
@ -96,14 +97,15 @@ Q_DECL_EXPORT int main(int argc, char **argv)
BOOKS_QML_REGISTER_(BooksPageWidget, "PageWidget");
BOOKS_QML_REGISTER_(BooksListWatcher, "ListWatcher");
BOOKS_QML_REGISTER_(BooksCoverWidget, "BookCover");
BOOKS_QML_REGISTER_(HarbourDisplayBlanking, "DisplayBlanking");
// But these do (and I think it's a good idea)
BOOKS_QML_REGISTER(HarbourColorEditorModel);
BOOKS_QML_REGISTER(HarbourDisplayBlanking);
BOOKS_QML_REGISTER(BooksColorSchemeModel);
BOOKS_QML_REGISTER(BooksImportModel);
BOOKS_QML_REGISTER(BooksPathModel);
BOOKS_QML_REGISTER(BooksPageStack);
BOOKS_QML_REGISTER_SINGLETON(HarbourBattery);
BOOKS_QML_REGISTER_SINGLETON(HarbourUtil);
BOOKS_QML_REGISTER_SINGLETON(BooksHints);
BOOKS_QML_REGISTER_SINGLETON(BooksUtil);
@ -114,9 +116,10 @@ Q_DECL_EXPORT int main(int argc, char **argv)
#ifdef OPENREPOS
QString transDir("/usr/share/translations");
#else
QString transDir = SailfishApp::pathTo("translations").toLocalFile();
QString transDir = Aurora::Application::pathTo("translations").toLocalFile();
#endif
QString transFile(BOOKS_APP_NAME);
if (translator->load(locale, transFile, "-", transDir) ||
translator->load(transFile, transDir)) {
app->installTranslator(translator);
@ -135,7 +138,7 @@ Q_DECL_EXPORT int main(int argc, char **argv)
BOOKS_QML_FILE));
HDEBUG("qml file" << qPrintable(qml));
QQuickView* view = SailfishApp::createView();
QQuickView* view = Aurora::Application::createView();
QQmlContext* root = view->rootContext();
QQmlEngine* engine = root->engine();
QSharedPointer<BooksSettings> settings = BooksSettings::sharedInstance();

@ -1 +1 @@
Subproject commit 323fc6b6c98f85265e55425c22d617991178cc44
Subproject commit 6f745a05d05a236fa8053a4c2f40a807f83141ab

View file

@ -1,16 +1,16 @@
Name: harbour-books
Name: org.monich.harbour.books
Summary: E-book reader
Version: 1.1.5
Release: 1
Release: 2
License: BSD
Group: Applications/File
URL: http://github.com/monich/harbour-books
URL: https://github.com/sprainbrains/harbour-books/tree/auroraos
Source0: %{name}-%{version}.tar.gz
Requires: sailfishsilica-qt5
Requires: qt5-qtsvg-plugin-imageformat-svg
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(sailfishapp)
BuildRequires: pkgconfig(auroraapp)
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Svg)
@ -22,6 +22,7 @@ BuildRequires: file-devel
BuildRequires: bzip2-devel
BuildRequires: desktop-file-utils
BuildRequires: qt5-qttools-linguist
BuildRequires: librsvg-tools
%{!?qtc_qmake5:%define qtc_qmake5 %qmake5}
%{!?qtc_make:%define qtc_make make}
@ -34,7 +35,7 @@ FBReader-based e-book reader.
%setup -q -n %{name}-%{version}
%build
%qtc_qmake5 harbour-books.pro
%qtc_qmake5 %{name}.pro
%qtc_make %{?_smp_mflags}
%install
@ -46,6 +47,15 @@ desktop-file-install --delete-original \
--dir %{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/applications/*.desktop
for size in 86 108 128 172
do
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/
rsvg-convert --width=${size} --height=${size} --output \
%{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps/%{name}.png \
%{_sourcedir}/../app/icons/harbour-books.svg
done
%check
#make -C test test