From 091c85d1cec5da1148cfd34a0b0b1b7bb6c1ccdd Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sat, 13 Nov 2021 18:03:10 +0200 Subject: [PATCH] [app] Added option to hide pulley menu in the book view --- app/qml/BooksBookView.qml | 4 +-- app/settings/BooksSettings.qml | 24 +++++++++++++ app/src/BooksSettings.cpp | 46 ++++++++++++++++++------- app/src/BooksSettings.h | 15 +++++--- app/translations/harbour-books-de.ts | 12 ++++++- app/translations/harbour-books-es.ts | 10 ++++++ app/translations/harbour-books-fi.ts | 12 ++++++- app/translations/harbour-books-hu.ts | 10 ++++++ app/translations/harbour-books-nl.ts | 12 ++++++- app/translations/harbour-books-pl.ts | 10 ++++++ app/translations/harbour-books-pt.ts | 12 ++++++- app/translations/harbour-books-ru.ts | 10 ++++++ app/translations/harbour-books-sv.ts | 10 ++++++ app/translations/harbour-books-zh_CN.ts | 10 ++++++ app/translations/harbour-books.ts | 10 ++++++ 15 files changed, 183 insertions(+), 24 deletions(-) diff --git a/app/qml/BooksBookView.qml b/app/qml/BooksBookView.qml index 67a9b29..bf6ccdd 100644 --- a/app/qml/BooksBookView.qml +++ b/app/qml/BooksBookView.qml @@ -65,8 +65,8 @@ Item { property alias viewInteractive: bookView.interactive property alias pullDownMenu: menu - property alias isCurrentView: menu.visible property alias loadingBackgroundOpacity: loadingBackground.opacity + property bool isCurrentView property bool pageActive readonly property bool viewActive: pageActive && Qt.application.active && !!book @@ -147,7 +147,7 @@ Item { PullDownMenu { id: menu - visible: false // BooksMainPage will make it visible when it's needed + visible: isCurrentView && Settings.bookPullDownMenu property real backToLibrary diff --git a/app/settings/BooksSettings.qml b/app/settings/BooksSettings.qml index 952dc2f..361b828 100644 --- a/app/settings/BooksSettings.qml +++ b/app/settings/BooksSettings.qml @@ -456,6 +456,12 @@ Page { } } + Item { + width: 1 + height: 1 + visible: landscapeLayout // To occupy the grid slot + } + TextSwitch { width: parent.columnWidth automaticCheck: false @@ -473,6 +479,24 @@ Page { defaultValue: false } } + + TextSwitch { + width: parent.columnWidth + automaticCheck: false + checked: bookPullDownMenu.value + //: Text switch label + //% "Show pulley menu when the book is open" + text: qsTrId("harbour-books-settings-page-book_pulldown_menu") + //: Text switch description + //% "Without the pulley menu, the book has to be closed by swiping it up." + description: qsTrId("harbour-books-settings-page-book_pulldown_menu-description") + onClicked: bookPullDownMenu.value = !bookPullDownMenu.value + ConfigurationValue { + id: bookPullDownMenu + key: rootPath + "bookPullDownMenu" + defaultValue: true + } + } } // =============== Memory card =============== diff --git a/app/src/BooksSettings.cpp b/app/src/BooksSettings.cpp index b577094..b913bc8 100644 --- a/app/src/BooksSettings.cpp +++ b/app/src/BooksSettings.cpp @@ -55,6 +55,7 @@ #define KEY_REMOVABLE_ROOT "removableRoot" #define KEY_INVERT_COLORS "invertColors" #define KEY_KEEP_DISPLAY_ON "keepDisplayOn" +#define KEY_BOOK_PULL_DOWN_MENU "bookPullDownMenu" #define KEY_VOLUME_UP_ACTION "volumeUpAction" #define KEY_VOLUME_DOWN_ACTION "volumeDownAction" #define KEY_ORIENTATION "orientation" @@ -70,6 +71,7 @@ #define DEFAULT_REMOVABLE_ROOT "Books" #define DEFAULT_INVERT_COLORS false #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) @@ -257,6 +259,7 @@ public: MGConfItem* iInvertColorsConf; MGConfItem* iSampleBookCopiedConf; MGConfItem* iKeepDisplayOnConf; + MGConfItem* iBookPullDownMenuConf; MGConfItem* iVolumeUpActionConf; MGConfItem* iVolumeDownActionConf; MGConfItem* iCurrentFolderConf; @@ -282,6 +285,7 @@ BooksSettings::Private::Private(BooksSettings* aParent) : iInvertColorsConf(new MGConfItem(DCONF_PATH KEY_INVERT_COLORS, this)), iSampleBookCopiedConf(new MGConfItem(DCONF_PATH KEY_SAMPLE_BOOK_COPIED, this)), iKeepDisplayOnConf(new MGConfItem(DCONF_PATH KEY_KEEP_DISPLAY_ON, this)), + iBookPullDownMenuConf(new MGConfItem(DCONF_PATH KEY_BOOK_PULL_DOWN_MENU, this)), iVolumeUpActionConf(new MGConfItem(DCONF_PATH KEY_VOLUME_UP_ACTION, this)), iVolumeDownActionConf(new MGConfItem(DCONF_PATH KEY_VOLUME_DOWN_ACTION, this)), iCurrentFolderConf(new MGConfItem(DCONF_PATH KEY_CURRENT_FOLDER, this)), @@ -302,6 +306,7 @@ BooksSettings::Private::Private(BooksSettings* aParent) : 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(iVolumeUpActionConf, SIGNAL(valueChanged()), aParent, SIGNAL(volumeUpActionChanged())); connect(iVolumeDownActionConf, SIGNAL(valueChanged()), aParent, SIGNAL(volumeDownActionChanged())); connect(iOrientationConf, SIGNAL(valueChanged()), aParent, SIGNAL(orientationChanged())); @@ -701,19 +706,6 @@ BooksSettings::setInvertColors( iPrivate->iInvertColorsConf->set(aValue); } -bool -BooksSettings::sampleBookCopied() const -{ - return iPrivate->iSampleBookCopiedConf->value(DEFAULT_SAMPLE_BOOK_COPIED).toBool(); -} - -void -BooksSettings::setSampleBookCopied() -{ - HDEBUG(""); - iPrivate->iSampleBookCopiedConf->set(true); -} - bool BooksSettings::keepDisplayOn() const { @@ -728,6 +720,34 @@ BooksSettings::setKeepDisplayOn( iPrivate->iKeepDisplayOnConf->set(aValue); } +bool +BooksSettings::bookPullDownMenu() const +{ + return iPrivate->iBookPullDownMenuConf->value(DEFAULT_BOOK_PULL_DOWN_MENU).toBool(); +} + +void +BooksSettings::setBookPullDownMenu( + bool aValue) +{ + HDEBUG(aValue); + iPrivate->iBookPullDownMenuConf->set(aValue); +} + +bool +BooksSettings::sampleBookCopied() const +{ + return iPrivate->iSampleBookCopiedConf->value(DEFAULT_SAMPLE_BOOK_COPIED).toBool(); +} + +void +BooksSettings::setSampleBookCopied() +{ + HDEBUG(""); + iPrivate->iSampleBookCopiedConf->set(true); +} + + BooksSettings::Action BooksSettings::volumeUpAction() const { diff --git a/app/src/BooksSettings.h b/app/src/BooksSettings.h index f2ad4e4..6bd475f 100644 --- a/app/src/BooksSettings.h +++ b/app/src/BooksSettings.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 2015-2020 Jolla Ltd. - * Copyright (C) 2015-2020 Slava Monich + * Copyright (C) 2015-2021 Jolla Ltd. + * Copyright (C) 2015-2021 Slava Monich * * You may use this file under the terms of the BSD license as follows: * @@ -55,6 +55,7 @@ class BooksSettings : public QObject Q_PROPERTY(bool invertColors READ invertColors WRITE setInvertColors NOTIFY invertColorsChanged) 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(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) @@ -117,12 +118,15 @@ public: bool invertColors() const; // Night mode void setInvertColors(bool aValue); - bool sampleBookCopied() const; - void setSampleBookCopied(); - bool keepDisplayOn() const; void setKeepDisplayOn(bool aValue); + bool bookPullDownMenu() const; + void setBookPullDownMenu(bool aValue); + + bool sampleBookCopied() const; + void setSampleBookCopied(); + Action volumeUpAction() const; void setVolumeUpAction(int aValue); @@ -158,6 +162,7 @@ Q_SIGNALS: void invertColorsChanged(); void sampleBookCopiedChanged(); void keepDisplayOnChanged(); + void bookPullDownMenuChanged(); void volumeUpActionChanged(); void volumeDownActionChanged(); void currentBookChanged(); diff --git a/app/translations/harbour-books-de.ts b/app/translations/harbour-books-de.ts index 35529bf..befd26d 100644 --- a/app/translations/harbour-books-de.ts +++ b/app/translations/harbour-books-de.ts @@ -277,13 +277,23 @@ Turn pages by tapping the screen Text switch label - + Blättern um, indem auf den Bildschirm tippen Tapping near the left edge of the screen returns to the previous page, tapping near the right edge gets you to the next page. Text switch description + + Show pulley menu when the book is open + Text switch label + Schiebemenü anzeigen, wenn das Buch geöffnet ist + + + Without the pulley menu, the book has to be closed by swiping it up. + Text switch description + Ohne Schiebemenü muss das Buch durch Hochstreichen geschlossen werden. + Memory card Section header for memory card settings diff --git a/app/translations/harbour-books-es.ts b/app/translations/harbour-books-es.ts index 51120e7..d2435c5 100644 --- a/app/translations/harbour-books-es.ts +++ b/app/translations/harbour-books-es.ts @@ -284,6 +284,16 @@ Text switch description Tocando cerca del borde izquierdo de la pantalla, se regresa a la página anterior; si se toca cerca del borde derecho, se pasa a la página siguiente. + + Show pulley menu when the book is open + Text switch label + Mostrar menú actualizable cuando el libro está abierto + + + Without the pulley menu, the book has to be closed by swiping it up. + Text switch description + Sin menú actualizable, el libro debe cerrarse deslizándose hacia arriba. + Memory card Section header for memory card settings diff --git a/app/translations/harbour-books-fi.ts b/app/translations/harbour-books-fi.ts index 1738017..338b9a1 100644 --- a/app/translations/harbour-books-fi.ts +++ b/app/translations/harbour-books-fi.ts @@ -277,13 +277,23 @@ Turn pages by tapping the screen Text switch label - + Käännä sivuja napauttamalla näyttöä Tapping near the left edge of the screen returns to the previous page, tapping near the right edge gets you to the next page. Text switch description + + Show pulley menu when the book is open + Text switch label + Näytä vetovalikko kun kirja on auki + + + Without the pulley menu, the book has to be closed by swiping it up. + Text switch description + Ilman vetovalikkoa kirja on suljettava pyyhkäisemällä sitä ylös. + Memory card Section header for memory card settings diff --git a/app/translations/harbour-books-hu.ts b/app/translations/harbour-books-hu.ts index 2b61d83..059eb71 100644 --- a/app/translations/harbour-books-hu.ts +++ b/app/translations/harbour-books-hu.ts @@ -282,6 +282,16 @@ Text switch description Ha a képernyő bal szélét megérinted, az előző oldalra, a jobb szélét megérintve pedig a következő oldalra kerülsz. + + Show pulley menu when the book is open + Text switch label + A lehúzható menü megjelenítése, amikor a könyv nyitva van + + + Without the pulley menu, the book has to be closed by swiping it up. + Text switch description + Lehúzható menü nélkül a könyvet felfelé húzással kell bezárni. + Memory card Section header for memory card settings diff --git a/app/translations/harbour-books-nl.ts b/app/translations/harbour-books-nl.ts index 7537e1f..e3b5e83 100644 --- a/app/translations/harbour-books-nl.ts +++ b/app/translations/harbour-books-nl.ts @@ -277,13 +277,23 @@ Turn pages by tapping the screen Text switch label - + Pagina's omslaan door op het scherm te tikken Tapping near the left edge of the screen returns to the previous page, tapping near the right edge gets you to the next page. Text switch description + + Show pulley menu when the book is open + Text switch label + Toon uittrekmenu wanneer het boek is geopend + + + Without the pulley menu, the book has to be closed by swiping it up. + Text switch description + Zonder uittrekmenu moet het boek worden gesloten door het omhoog te vegen. + Memory card Section header for memory card settings diff --git a/app/translations/harbour-books-pl.ts b/app/translations/harbour-books-pl.ts index 224fd12..2e1fc40 100644 --- a/app/translations/harbour-books-pl.ts +++ b/app/translations/harbour-books-pl.ts @@ -286,6 +286,16 @@ Text switch description Dotknięcie blisko lewej krawędzi ekranu powoduje powrót do wcześniejszej strony, dotknięcie prawej zmienia stronę na nastepną. + + Show pulley menu when the book is open + Text switch label + Pokaż menu wysuwane, gdy książka jest otwarta + + + Without the pulley menu, the book has to be closed by swiping it up. + Text switch description + Aby zamknąć książkę w przypadku braku menu wysuwane, należy ją przesunąć w górę o ponad pół ekranu. + Memory card Section header for memory card settings diff --git a/app/translations/harbour-books-pt.ts b/app/translations/harbour-books-pt.ts index 39bd0b0..8f8c211 100644 --- a/app/translations/harbour-books-pt.ts +++ b/app/translations/harbour-books-pt.ts @@ -277,13 +277,23 @@ Turn pages by tapping the screen Text switch label - + Vire as páginas tocando na tela Tapping near the left edge of the screen returns to the previous page, tapping near the right edge gets you to the next page. Text switch description + + Show pulley menu when the book is open + Text switch label + Mostrar o menu deslizante quando o livro estiver aberto + + + Without the pulley menu, the book has to be closed by swiping it up. + Text switch description + Sem o menu deslizante, o livro deve ser fechado deslizando-o para cima. + Memory card Section header for memory card settings diff --git a/app/translations/harbour-books-ru.ts b/app/translations/harbour-books-ru.ts index bdbaba3..4eafa7d 100644 --- a/app/translations/harbour-books-ru.ts +++ b/app/translations/harbour-books-ru.ts @@ -291,6 +291,16 @@ Section header for memory card settings Карта памяти + + Show pulley menu when the book is open + Text switch label + Показывать вытягиваемое меню при открытой книге + + + Without the pulley menu, the book has to be closed by swiping it up. + Text switch description + Чтобы закрыть книгу в отсутствие вытягиваемого меню, её надо будет сдвинуть вверх больше, чем на пол-экрана. + Books folder Settings field label diff --git a/app/translations/harbour-books-sv.ts b/app/translations/harbour-books-sv.ts index b4b2a79..573aef5 100644 --- a/app/translations/harbour-books-sv.ts +++ b/app/translations/harbour-books-sv.ts @@ -284,6 +284,16 @@ Text switch description Tryck nära vänster skärmkant, för att återvända till föregående sida. Tryck nära höger skärmkant, för att komma till nästa sida. + + Show pulley menu when the book is open + Text switch label + Visa rullgardinsmeny när boken är öppen + + + Without the pulley menu, the book has to be closed by swiping it up. + Text switch description + Utan rullgardinsmeny måste boken stängas genom att svepa uppåt. + Memory card Section header for memory card settings diff --git a/app/translations/harbour-books-zh_CN.ts b/app/translations/harbour-books-zh_CN.ts index 381a21d..680e872 100644 --- a/app/translations/harbour-books-zh_CN.ts +++ b/app/translations/harbour-books-zh_CN.ts @@ -283,6 +283,16 @@ Text switch description 点击屏幕左侧边缘即可返回上一页,点击右边缘附近即可翻到下一页。 + + Show pulley menu when the book is open + Text switch label + + + + Without the pulley menu, the book has to be closed by swiping it up. + Text switch description + + Memory card Section header for memory card settings diff --git a/app/translations/harbour-books.ts b/app/translations/harbour-books.ts index 0e9c39b..140ed3c 100644 --- a/app/translations/harbour-books.ts +++ b/app/translations/harbour-books.ts @@ -284,6 +284,16 @@ Text switch description Tapping near the left edge of the screen returns to the previous page, tapping near the right edge gets you to the next page. + + Show pulley menu when the book is open + Text switch label + Show pulley menu when the book is open + + + Without the pulley menu, the book has to be closed by swiping it up. + Text switch description + Without the pulley menu, the book has to be closed by swiping it up. + Memory card Section header for memory card settings