diff --git a/.gitignore b/.gitignore
index 359e01e..5f7e50e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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/
diff --git a/README.md b/README.md
index ff30934..a132ec5 100644
--- a/README.md
+++ b/README.md
@@ -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.
diff --git a/app/app.pro b/app/app.pro
index b4efb69..75b323b 100644
--- a/app/app.pro
+++ b/app/app.pro
@@ -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)
+}
\ No newline at end of file
diff --git a/app/icons/harbour-books.svg b/app/icons/harbour-books.svg
index a4ae421..b7880e4 100644
--- a/app/icons/harbour-books.svg
+++ b/app/icons/harbour-books.svg
@@ -1,44 +1,13 @@
-
-
+
+
+
diff --git a/app/openrepos-books.desktop b/app/openrepos-books.desktop.old
similarity index 100%
rename from app/openrepos-books.desktop
rename to app/openrepos-books.desktop.old
diff --git a/app/harbour-books.desktop b/app/org.monich.harbour.books.desktop
similarity index 54%
rename from app/harbour-books.desktop
rename to app/org.monich.harbour.books.desktop
index 94027a9..2c0aa73 100644
--- a/app/harbour-books.desktop
+++ b/app/org.monich.harbour.books.desktop
@@ -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
+
diff --git a/app/qml/BooksBookView.qml b/app/qml/BooksBookView.qml
index 48a6240..c8b8656 100644
--- a/app/qml/BooksBookView.qml
+++ b/app/qml/BooksBookView.qml
@@ -1,6 +1,6 @@
/*
+ Copyright (C) 2015-2023 Slava Monich
Copyright (C) 2015-2022 Jolla Ltd.
- Copyright (C) 2015-2022 Slava Monich
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 {
diff --git a/app/qml/BooksMain.qml b/app/qml/BooksMain.qml
index 4824e29..e3deee1 100644
--- a/app/qml/BooksMain.qml
+++ b/app/qml/BooksMain.qml
@@ -1,6 +1,6 @@
/*
+ Copyright (C) 2015-2023 Slava Monich
Copyright (C) 2015-2021 Jolla Ltd.
- Copyright (C) 2015-2021 Slava Monich
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 {
diff --git a/app/settings/BooksActionSelector.qml b/app/settings/BooksActionSelector.qml
index e26202e..f2d2747 100644
--- a/app/settings/BooksActionSelector.qml
+++ b/app/settings/BooksActionSelector.qml
@@ -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
diff --git a/app/settings/BooksSettingsBase.qml b/app/settings/BooksSettingsBase.qml
index 4ed74c3..e437f6d 100644
--- a/app/settings/BooksSettingsBase.qml
+++ b/app/settings/BooksSettingsBase.qml
@@ -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 {
diff --git a/app/src/BooksBookModel.cpp b/app/src/BooksBookModel.cpp
index d563216..c7e31b2 100644
--- a/app/src/BooksBookModel.cpp
+++ b/app/src/BooksBookModel.cpp
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2015-2021 Jolla Ltd.
- * Copyright (C) 2015-2021 Slava Monich
+ * Copyright (C) 2015-2023 Slava Monich
+ * 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)) &&
diff --git a/app/src/BooksCoverWidget.cpp b/app/src/BooksCoverWidget.cpp
index e4f96d9..2474ae8 100644
--- a/app/src/BooksCoverWidget.cpp
+++ b/app/src/BooksCoverWidget.cpp
@@ -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;
diff --git a/app/src/BooksDefs.h b/app/src/BooksDefs.h
index 50d3157..b00139b 100644
--- a/app/src/BooksDefs.h
+++ b/app/src/BooksDefs.h
@@ -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
diff --git a/app/src/BooksSettings.cpp b/app/src/BooksSettings.cpp
index 8547555..266eda1 100644
--- a/app/src/BooksSettings.cpp
+++ b/app/src/BooksSettings.cpp
@@ -1,6 +1,6 @@
/*
+ * Copyright (C) 2015-2023 Slava Monich
* Copyright (C) 2015-2022 Jolla Ltd.
- * Copyright (C) 2015-2022 Slava Monich
*
* 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
diff --git a/app/src/BooksSettings.h b/app/src/BooksSettings.h
index f23fd11..8b39572 100644
--- a/app/src/BooksSettings.h
+++ b/app/src/BooksSettings.h
@@ -1,6 +1,6 @@
/*
+ * Copyright (C) 2015-2023 Slava Monich
* Copyright (C) 2015-2022 Jolla Ltd.
- * Copyright (C) 2015-2022 Slava Monich
*
* 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();
diff --git a/app/src/ZLibrary.cpp b/app/src/ZLibrary.cpp
index 50a70cf..4401797 100644
--- a/app/src/ZLibrary.cpp
+++ b/app/src/ZLibrary.cpp
@@ -50,7 +50,7 @@
#include "formats/xhtml/XHTMLReader.h"
#include "library/Tag.h"
-#include
+#include
#include
#include
diff --git a/app/src/main.cpp b/app/src/main.cpp
index 2593dce..b1ae57e 100644
--- a/app/src/main.cpp
+++ b/app/src/main.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2015-2022 Jolla Ltd.
- * Copyright (C) 2015-2022 Slava Monich
+ * Copyright (C) 2015-2023 Slava Monich
*
* 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
+#include
#include
#include
@@ -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();
qRegisterMetaType();
@@ -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 settings = BooksSettings::sharedInstance();
diff --git a/harbour-lib b/harbour-lib
index 323fc6b..6f745a0 160000
--- a/harbour-lib
+++ b/harbour-lib
@@ -1 +1 @@
-Subproject commit 323fc6b6c98f85265e55425c22d617991178cc44
+Subproject commit 6f745a05d05a236fa8053a4c2f40a807f83141ab
diff --git a/harbour-books.pro b/org.monich.harbour.books.pro
similarity index 100%
rename from harbour-books.pro
rename to org.monich.harbour.books.pro
diff --git a/rpm/harbour-books.spec b/rpm/org.monich.harbour.books.spec
similarity index 70%
rename from rpm/harbour-books.spec
rename to rpm/org.monich.harbour.books.spec
index ae09739..748230c 100644
--- a/rpm/harbour-books.spec
+++ b/rpm/org.monich.harbour.books.spec
@@ -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