From 12eb3919dc9c1f76a0f7c375c4c2f67947eb636f Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Fri, 27 Apr 2018 00:33:26 +0300 Subject: [PATCH] [app] Added openrepos variant --- app/app.pro | 3 +- app/settings/harbour-books.json | 14 ++++++++ app/src/main.cpp | 8 +++-- harbour-books.pro | 2 +- rpm/openrepos-books.spec | 60 +++++++++++++++++++++++++++++++++ 5 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 app/settings/harbour-books.json create mode 100644 rpm/openrepos-books.spec diff --git a/app/app.pro b/app/app.pro index 441a7fc..868e7aa 100644 --- a/app/app.pro +++ b/app/app.pro @@ -54,12 +54,13 @@ OTHER_FILES += \ qml/*.qml \ qml/images/* \ settings/*.qml \ + settings/*.json \ data/default/* \ data/zlibrary/core/encodings/* \ data/zlibrary/core/resources/* \ translations/*.ts -TARGET_DATA_DIR = /usr/share/harbour-books +TARGET_DATA_DIR = /usr/share/$$TARGET TARGET_DEFAULT_DATA_DIR = $$TARGET_DATA_DIR/data TARGET_ZLIBRARY_DATA_DIR = $$TARGET_DEFAULT_DATA_DIR TARGET_ICON_ROOT = /usr/share/icons/hicolor diff --git a/app/settings/harbour-books.json b/app/settings/harbour-books.json new file mode 100644 index 0000000..14f0ed7 --- /dev/null +++ b/app/settings/harbour-books.json @@ -0,0 +1,14 @@ +{ + "translation_catalog" : "harbour-books", + "entries": [ + { + "path": "applications/harbour-books.desktop", + "title": "Books", + "type": "page", + "icon": "harbour-books", + "params": { + "source": "/usr/share/harbour-books/settings/BooksSettings.qml" + } + } + ] +} diff --git a/app/src/main.cpp b/app/src/main.cpp index 93b2e25..acbf63b 100644 --- a/app/src/main.cpp +++ b/app/src/main.cpp @@ -1,6 +1,6 @@ /* - * Copyright (C) 2015-2017 Jolla Ltd. - * Copyright (C) 2015-2017 Slava Monich + * Copyright (C) 2015-2018 Jolla Ltd. + * Copyright (C) 2015-2018 Slava Monich * * You may use this file under the terms of the BSD license as follows: * @@ -91,7 +91,11 @@ Q_DECL_EXPORT int main(int argc, char **argv) QLocale locale; QTranslator* translator = new QTranslator(app); +#ifdef OPENREPOS + QString transDir("/usr/share/translations"); +#else QString transDir = SailfishApp::pathTo("translations").toLocalFile(); +#endif QString transFile(BOOKS_APP_NAME); if (translator->load(locale, transFile, "-", transDir) || translator->load(transFile, transDir)) { diff --git a/harbour-books.pro b/harbour-books.pro index 1cee771..6a9a26b 100644 --- a/harbour-books.pro +++ b/harbour-books.pro @@ -4,4 +4,4 @@ SUBDIRS = fribidi linebreak fbreader harbour-lib app OTHER_FILES += \ README.md \ - rpm/harbour-books.spec + rpm/*.spec diff --git a/rpm/openrepos-books.spec b/rpm/openrepos-books.spec new file mode 100644 index 0000000..670ab7a --- /dev/null +++ b/rpm/openrepos-books.spec @@ -0,0 +1,60 @@ +Name: openrepos-books +Summary: E-book reader +Version: 1.0.26 +Release: 1 +License: BSD +Vendor: slava +Group: Applications/File +URL: http://github.com/monich/harbour-books +Source0: %{name}-%{version}.tar.gz + +Requires: sailfishsilica-qt5 +Requires: qt5-qtsvg-plugin-imageformat-svg +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(sailfishapp) +BuildRequires: pkgconfig(Qt5Quick) +BuildRequires: pkgconfig(Qt5Core) +BuildRequires: pkgconfig(Qt5Svg) +BuildRequires: pkgconfig(Qt5Qml) +BuildRequires: pkgconfig(mlite5) +BuildRequires: pkgconfig(expat) +BuildRequires: pkgconfig(libudev) +BuildRequires: file-devel +BuildRequires: bzip2-devel +BuildRequires: desktop-file-utils +BuildRequires: qt5-qttools-linguist + +%{!?qtc_qmake5:%define qtc_qmake5 %qmake5} +%{!?qtc_make:%define qtc_make make} +%{?qtc_builddir:%define _builddir %qtc_builddir} + +%description +FBReader-based e-book reader. + +%prep +%setup -q -n %{name}-%{version} + +%build +%qtc_qmake5 CONFIG+=openrepos CONFIG+=app_settings harbour-books.pro +%qtc_make %{?_smp_mflags} + +%install +rm -rf %{buildroot} +cd app +%qmake5_install + +desktop-file-install --delete-original \ + --dir %{buildroot}%{_datadir}/applications \ + %{buildroot}%{_datadir}/applications/*.desktop + +%files +%defattr(-,root,root,-) +%{_bindir}/%{name} +%{_datadir}/%{name} +%{_datadir}/applications/%{name}.desktop +%{_datadir}/icons/hicolor/*/apps/%{name}.png +%{_datadir}/translations/%{name}*.qm +%{_datadir}/jolla-settings/entries/%{name}.json + +%check +make -C test test