From 5a765e391f23d85be4b6c1bee1d8a15e3d8be62e Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Mon, 23 Jul 2018 15:17:22 +0300 Subject: [PATCH] [app] Added settings UI for page payout --- app/settings/BooksDetailMenuItem.qml | 62 ++++++++++++++ app/settings/BooksSettings.qml | 103 ++++++++++++++++++++---- app/translations/harbour-books-de.ts | 55 +++++++++++++ app/translations/harbour-books-es.ts | 55 +++++++++++++ app/translations/harbour-books-fi.ts | 55 +++++++++++++ app/translations/harbour-books-hu.ts | 55 +++++++++++++ app/translations/harbour-books-nl.ts | 55 +++++++++++++ app/translations/harbour-books-pl.ts | 55 +++++++++++++ app/translations/harbour-books-pt_BR.ts | 55 +++++++++++++ app/translations/harbour-books-ru.ts | 55 +++++++++++++ app/translations/harbour-books-sv.ts | 55 +++++++++++++ app/translations/harbour-books.ts | 55 +++++++++++++ 12 files changed, 701 insertions(+), 14 deletions(-) create mode 100644 app/settings/BooksDetailMenuItem.qml diff --git a/app/settings/BooksDetailMenuItem.qml b/app/settings/BooksDetailMenuItem.qml new file mode 100644 index 0000000..908bc01 --- /dev/null +++ b/app/settings/BooksDetailMenuItem.qml @@ -0,0 +1,62 @@ +/* + Copyright (C) 2018 Jolla Ltd. + Copyright (C) 2018 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 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 + +MenuItem { + id: menuItem + property alias valueText: valueLabel.text + property alias detailText: detailLabel.text + Row { + spacing: Theme.paddingMedium + anchors { + top: parent.top + bottom: parent.bottom + horizontalCenter: parent.horizontalCenter + } + Label { + id: valueLabel + height: parent.height + color: menuItem.color + verticalAlignment: menuItem.verticalAlignment + visible: text.length > 0 + } + Label { + id: detailLabel + anchors.baseline: valueLabel.baseline + font.pixelSize: Theme.fontSizeSmall + color: Theme.highlightColor + visible: text.length > 0 + } + } +} diff --git a/app/settings/BooksSettings.qml b/app/settings/BooksSettings.qml index d0a68ef..475cf32 100644 --- a/app/settings/BooksSettings.qml +++ b/app/settings/BooksSettings.qml @@ -115,7 +115,6 @@ Page { //% "Orientation" label: qsTrId("harbour-books-settings-page-orientation_label") value: currentItem ? currentItem.text : "" - property bool ready menu: ContextMenu { id: orientationMenu readonly property int defaultIndex: 0 @@ -123,31 +122,22 @@ Page { //: Combo box value for dynamic orientation //% "Dynamic" text: qsTrId("harbour-books-settings-page-orientation-dynamic") - readonly property int value: 0 + onClicked: orientation.value = 0 } MenuItem { //: Combo box value for portrait orientation //% "Portrait" text: qsTrId("harbour-books-settings-page-orientation-portrait") - readonly property int value: 1 + onClicked: orientation.value = 1 } MenuItem { //: Combo box value for landscape orientation //% "Landscape" text: qsTrId("harbour-books-settings-page-orientation-landscape") - readonly property int value: 2 + onClicked: orientation.value = 2 } } - onCurrentItemChanged: { - if (ready && currentItem) { - orientation.value = currentItem.value - } - } - Component.onCompleted: { - orientation.updateControls() - ready = true - } - + Component.onCompleted: orientation.updateControls() ConfigurationValue { id: orientation key: rootPath + "orientation" @@ -167,6 +157,91 @@ Page { } } + ComboBox { + id: layoutComboBox + //: Combo box label + //% "Page layout" + label: qsTrId("harbour-books-settings-page-page_layout") + value: currentItem ? currentItem.valueText : "" + menu: ContextMenu { + id: layoutMenu + readonly property int defaultIndex: 0 + BooksDetailMenuItem { + //: Combo box value for dynamic page layout + //% "Dynamic" + valueText: qsTrId("harbour-books-settings-page-layout-dynamic") + //: Combo box detail for dynamic page layout + //% "(toggle on tap)" + detailText: qsTrId("harbour-books-settings-page-layout-dynamic-detail") + onClicked: pageDetailsFixed.value = false + } + BooksDetailMenuItem { + //: Combo box value for clean page layout (just the content) + //% "Clean" + valueText: qsTrId("harbour-books-settings-page-layout-clean") + //: Combo box detail for clean page layout (just the content) + //% "(just the content)" + detailText: qsTrId("harbour-books-settings-page-layout-clean-detail") + onClicked: { + pageDetailsFixed.value = true + pageDetails.value = 0 + } + } + BooksDetailMenuItem { + //: Combo box value for minimal page layout (title + page) + //% "Minimal" + valueText: qsTrId("harbour-books-settings-page-layout-minimal") + //: Combo box detail for minimal page layout (title + page) + //% "(title, page)" + detailText: qsTrId("harbour-books-settings-page-layout-minimal-detail") + onClicked: { + pageDetailsFixed.value = true + pageDetails.value = 1 + } + } + BooksDetailMenuItem { + //: Combo box value for normal page layout (title + page + slider) + //% "Regular" + valueText: qsTrId("harbour-books-settings-page-layout-normal") + //: Combo box detail for normal page layout (title + page + slider) + //% "(title, page, slider)" + detailText: qsTrId("harbour-books-settings-page-layout-normal-detail") + onClicked: { + pageDetailsFixed.value = true + pageDetails.value = 2 + } + } + BooksDetailMenuItem { + //: Combo box value for full page layout (title + page + slider) + //% "Full" + valueText: qsTrId("harbour-books-settings-page-layout-full") + //: Combo box detail for full page layout (title + page + slider) + //% "(everything)" + detailText: qsTrId("harbour-books-settings-page-layout-full-detail") + onClicked: { + pageDetailsFixed.value = true + pageDetails.value = 3 + } + } + } + Component.onCompleted: updateSelectedItem() + function updateSelectedItem() { + currentIndex = pageDetailsFixed.value ? (pageDetails.value + 1) : 0 + } + ConfigurationValue { + id: pageDetails + key: rootPath + "pageDetails" + defaultValue: 0 + onValueChanged: layoutComboBox.updateSelectedItem() + } + ConfigurationValue { + id: pageDetailsFixed + key: rootPath + "pageDetailsFixed" + defaultValue: false + onValueChanged: layoutComboBox.updateSelectedItem() + } + } + TextSwitch { automaticCheck: false checked: keepDisplayOn.value diff --git a/app/translations/harbour-books-de.ts b/app/translations/harbour-books-de.ts index 933f370..31690ea 100644 --- a/app/translations/harbour-books-de.ts +++ b/app/translations/harbour-books-de.ts @@ -164,6 +164,61 @@ Combo box value for landscape orientation Querformat + + Page layout + Combo box label + Seitenlayout + + + Dynamic + Combo box value for dynamic page layout + Dynamische + + + (toggle on tap) + Combo box detail for dynamic page layout + + + + Clean + Combo box value for clean page layout (just the content) + Reine + + + (just the content) + Combo box detail for clean page layout (just the content) + + + + Minimal + Combo box value for minimal page layout (title + page) + + + + (title, page) + Combo box detail for minimal page layout (title + page) + + + + Regular + Combo box value for normal page layout (title + page + slider) + + + + (title, page, slider) + Combo box detail for normal page layout (title + page + slider) + + + + Full + Combo box value for full page layout (title + page + slider) + Voll + + + (everything) + Combo box detail for full page layout (title + page + slider) + + Keep display on while reading Text switch label diff --git a/app/translations/harbour-books-es.ts b/app/translations/harbour-books-es.ts index d1c791b..03d5137 100644 --- a/app/translations/harbour-books-es.ts +++ b/app/translations/harbour-books-es.ts @@ -164,6 +164,61 @@ Combo box value for landscape orientation Vertical + + Page layout + Combo box label + Diseño de página + + + Dynamic + Combo box value for dynamic page layout + Dinámica + + + (toggle on tap) + Combo box detail for dynamic page layout + + + + Clean + Combo box value for clean page layout (just the content) + + + + (just the content) + Combo box detail for clean page layout (just the content) + + + + Minimal + Combo box value for minimal page layout (title + page) + + + + (title, page) + Combo box detail for minimal page layout (title + page) + + + + Regular + Combo box value for normal page layout (title + page + slider) + + + + (title, page, slider) + Combo box detail for normal page layout (title + page + slider) + + + + Full + Combo box value for full page layout (title + page + slider) + + + + (everything) + Combo box detail for full page layout (title + page + slider) + + Keep display on while reading Text switch label diff --git a/app/translations/harbour-books-fi.ts b/app/translations/harbour-books-fi.ts index 248f72d..1ce8143 100644 --- a/app/translations/harbour-books-fi.ts +++ b/app/translations/harbour-books-fi.ts @@ -164,6 +164,61 @@ Combo box value for landscape orientation Vaaka + + Page layout + Combo box label + Sivun asettelu + + + Dynamic + Combo box value for dynamic page layout + Dynaaminen + + + (toggle on tap) + Combo box detail for dynamic page layout + + + + Clean + Combo box value for clean page layout (just the content) + Puhdas sivu + + + (just the content) + Combo box detail for clean page layout (just the content) + + + + Minimal + Combo box value for minimal page layout (title + page) + Minimaalinen + + + (title, page) + Combo box detail for minimal page layout (title + page) + + + + Regular + Combo box value for normal page layout (title + page + slider) + Säännöllinen + + + (title, page, slider) + Combo box detail for normal page layout (title + page + slider) + + + + Full + Combo box value for full page layout (title + page + slider) + Kokonainen + + + (everything) + Combo box detail for full page layout (title + page + slider) + + Keep display on while reading Text switch label diff --git a/app/translations/harbour-books-hu.ts b/app/translations/harbour-books-hu.ts index 3c8cc9c..9c3c2fe 100644 --- a/app/translations/harbour-books-hu.ts +++ b/app/translations/harbour-books-hu.ts @@ -162,6 +162,61 @@ Combo box value for landscape orientation Fekvő + + Page layout + Combo box label + Oldal elrendezés + + + Dynamic + Combo box value for dynamic page layout + Dinamikus + + + (toggle on tap) + Combo box detail for dynamic page layout + + + + Clean + Combo box value for clean page layout (just the content) + + + + (just the content) + Combo box detail for clean page layout (just the content) + + + + Minimal + Combo box value for minimal page layout (title + page) + + + + (title, page) + Combo box detail for minimal page layout (title + page) + + + + Regular + Combo box value for normal page layout (title + page + slider) + + + + (title, page, slider) + Combo box detail for normal page layout (title + page + slider) + + + + Full + Combo box value for full page layout (title + page + slider) + + + + (everything) + Combo box detail for full page layout (title + page + slider) + + Keep display on while reading Text switch label diff --git a/app/translations/harbour-books-nl.ts b/app/translations/harbour-books-nl.ts index 5e40406..78f8086 100644 --- a/app/translations/harbour-books-nl.ts +++ b/app/translations/harbour-books-nl.ts @@ -164,6 +164,61 @@ Combo box value for landscape orientation Landschap + + Page layout + Combo box label + Pagina layout + + + Dynamic + Combo box value for dynamic page layout + Dynamisch + + + (toggle on tap) + Combo box detail for dynamic page layout + + + + Clean + Combo box value for clean page layout (just the content) + + + + (just the content) + Combo box detail for clean page layout (just the content) + + + + Minimal + Combo box value for minimal page layout (title + page) + + + + (title, page) + Combo box detail for minimal page layout (title + page) + + + + Regular + Combo box value for normal page layout (title + page + slider) + + + + (title, page, slider) + Combo box detail for normal page layout (title + page + slider) + + + + Full + Combo box value for full page layout (title + page + slider) + + + + (everything) + Combo box detail for full page layout (title + page + slider) + + Keep display on while reading Text switch label diff --git a/app/translations/harbour-books-pl.ts b/app/translations/harbour-books-pl.ts index 4abbd3e..c02b3c0 100644 --- a/app/translations/harbour-books-pl.ts +++ b/app/translations/harbour-books-pl.ts @@ -166,6 +166,61 @@ Combo box value for landscape orientation Poziome + + Page layout + Combo box label + Układ strony + + + Dynamic + Combo box value for dynamic page layout + Dynamiczne + + + (toggle on tap) + Combo box detail for dynamic page layout + + + + Clean + Combo box value for clean page layout (just the content) + + + + (just the content) + Combo box detail for clean page layout (just the content) + + + + Minimal + Combo box value for minimal page layout (title + page) + + + + (title, page) + Combo box detail for minimal page layout (title + page) + + + + Regular + Combo box value for normal page layout (title + page + slider) + + + + (title, page, slider) + Combo box detail for normal page layout (title + page + slider) + + + + Full + Combo box value for full page layout (title + page + slider) + + + + (everything) + Combo box detail for full page layout (title + page + slider) + + Keep display on while reading Text switch label diff --git a/app/translations/harbour-books-pt_BR.ts b/app/translations/harbour-books-pt_BR.ts index d7f3681..216ebc9 100644 --- a/app/translations/harbour-books-pt_BR.ts +++ b/app/translations/harbour-books-pt_BR.ts @@ -164,6 +164,61 @@ Combo box value for landscape orientation Paisagem + + Page layout + Combo box label + Layout da página + + + Dynamic + Combo box value for dynamic page layout + Dinâmica + + + (toggle on tap) + Combo box detail for dynamic page layout + + + + Clean + Combo box value for clean page layout (just the content) + + + + (just the content) + Combo box detail for clean page layout (just the content) + + + + Minimal + Combo box value for minimal page layout (title + page) + + + + (title, page) + Combo box detail for minimal page layout (title + page) + + + + Regular + Combo box value for normal page layout (title + page + slider) + + + + (title, page, slider) + Combo box detail for normal page layout (title + page + slider) + + + + Full + Combo box value for full page layout (title + page + slider) + + + + (everything) + Combo box detail for full page layout (title + page + slider) + + Keep display on while reading Text switch label diff --git a/app/translations/harbour-books-ru.ts b/app/translations/harbour-books-ru.ts index 3d4914b..8fd9ce6 100644 --- a/app/translations/harbour-books-ru.ts +++ b/app/translations/harbour-books-ru.ts @@ -166,6 +166,61 @@ Combo box value for landscape orientation Альбомная + + Page layout + Combo box label + Разметка страницы + + + Dynamic + Combo box value for dynamic page layout + Динамическая + + + (toggle on tap) + Combo box detail for dynamic page layout + (переключается касанием) + + + Clean + Combo box value for clean page layout (just the content) + Чистая + + + (just the content) + Combo box detail for clean page layout (just the content) + (ничего лишнего) + + + Minimal + Combo box value for minimal page layout (title + page) + Минимальная + + + (title, page) + Combo box detail for minimal page layout (title + page) + (название, страница) + + + Regular + Combo box value for normal page layout (title + page + slider) + Регулярная + + + (title, page, slider) + Combo box detail for normal page layout (title + page + slider) + (название, страница, слайдер) + + + Full + Combo box value for full page layout (title + page + slider) + Полная + + + (everything) + Combo box detail for full page layout (title + page + slider) + (вообще всё) + Keep display on while reading Text switch label diff --git a/app/translations/harbour-books-sv.ts b/app/translations/harbour-books-sv.ts index e8dbb5a..8a2cee8 100644 --- a/app/translations/harbour-books-sv.ts +++ b/app/translations/harbour-books-sv.ts @@ -164,6 +164,61 @@ Combo box value for landscape orientation Liggande + + Page layout + Combo box label + Sidlayout + + + Dynamic + Combo box value for dynamic page layout + Dynamisk + + + (toggle on tap) + Combo box detail for dynamic page layout + + + + Clean + Combo box value for clean page layout (just the content) + + + + (just the content) + Combo box detail for clean page layout (just the content) + + + + Minimal + Combo box value for minimal page layout (title + page) + + + + (title, page) + Combo box detail for minimal page layout (title + page) + + + + Regular + Combo box value for normal page layout (title + page + slider) + + + + (title, page, slider) + Combo box detail for normal page layout (title + page + slider) + + + + Full + Combo box value for full page layout (title + page + slider) + + + + (everything) + Combo box detail for full page layout (title + page + slider) + + Keep display on while reading Text switch label diff --git a/app/translations/harbour-books.ts b/app/translations/harbour-books.ts index abe7807..a009d6b 100644 --- a/app/translations/harbour-books.ts +++ b/app/translations/harbour-books.ts @@ -164,6 +164,61 @@ Combo box value for landscape orientation Landscape + + Page layout + Combo box label + Page layout + + + Dynamic + Combo box value for dynamic page layout + Dynamic + + + (toggle on tap) + Combo box detail for dynamic page layout + (toggle on tap) + + + Clean + Combo box value for clean page layout (just the content) + Clean + + + (just the content) + Combo box detail for clean page layout (just the content) + (just the content) + + + Minimal + Combo box value for minimal page layout (title + page) + Minimal + + + (title, page) + Combo box detail for minimal page layout (title + page) + (title, page) + + + Regular + Combo box value for normal page layout (title + page + slider) + Regular + + + (title, page, slider) + Combo box detail for normal page layout (title + page + slider) + (title, page, slider) + + + Full + Combo box value for full page layout (title + page + slider) + Full + + + (everything) + Combo box detail for full page layout (title + page + slider) + (everything) + Keep display on while reading Text switch label