From 084c62b65c189e15a3470cd8beac14099976e094 Mon Sep 17 00:00:00 2001 From: tronfortytwo Date: Tue, 2 Feb 2021 20:37:17 +0100 Subject: [PATCH] Hacky fix for #38 --- po/sturmreader.pot | 22 +++++++++++----------- ui/qml/BookPage.qml | 19 +++++-------------- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/po/sturmreader.pot b/po/sturmreader.pot index 2d693c7..c0949c6 100644 --- a/po/sturmreader.pot +++ b/po/sturmreader.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: sturmreader.emanuelesorce\n" "Report-Msgid-Bugs-To: rschroll@gmail.com - emanuele.sorce@hotmail.com\n" -"POT-Creation-Date: 2021-02-02 17:54+0000\n" +"POT-Creation-Date: 2021-02-02 19:35+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -95,50 +95,50 @@ msgstr "" msgid "No outline available" msgstr "" -#: ui/qml/BookPage.qml:662 +#: ui/qml/BookPage.qml:659 msgid "Book Settings" msgstr "" #. / Prefer string of < 16 characters / -#: ui/qml/BookPage.qml:707 +#: ui/qml/BookPage.qml:704 msgid "Color scheme" msgstr "" #. / Prefer string of < 16 characters / -#: ui/qml/BookPage.qml:774 +#: ui/qml/BookPage.qml:771 msgid "Font" msgstr "" -#: ui/qml/BookPage.qml:784 ui/qml/BookPage.qml:794 +#: ui/qml/BookPage.qml:781 ui/qml/BookPage.qml:791 msgid "Default Font" msgstr "" #. / Prefer string of < 16 characters / -#: ui/qml/BookPage.qml:807 +#: ui/qml/BookPage.qml:804 msgid "Font Scaling" msgstr "" #. / Prefer string of < 16 characters / -#: ui/qml/BookPage.qml:831 +#: ui/qml/BookPage.qml:828 msgid "Line Height" msgstr "" #. / Prefer string of < 16 characters / -#: ui/qml/BookPage.qml:855 +#: ui/qml/BookPage.qml:852 msgid "Margins" msgstr "" #. / Prefer < 16 characters / -#: ui/qml/BookPage.qml:878 +#: ui/qml/BookPage.qml:875 msgid "Make Default" msgstr "" #. / Prefer < 16 characters / -#: ui/qml/BookPage.qml:886 +#: ui/qml/BookPage.qml:883 msgid "Load Defaults" msgstr "" -#: ui/qml/BookPage.qml:894 +#: ui/qml/BookPage.qml:891 msgid "Close" msgstr "" diff --git a/ui/qml/BookPage.qml b/ui/qml/BookPage.qml index acb1b5d..2bd79a9 100644 --- a/ui/qml/BookPage.qml +++ b/ui/qml/BookPage.qml @@ -384,11 +384,6 @@ Page { } } - onVisibleChanged: { - if(visible) - bookStyles.loadForBook(); - } - BusyIndicator { id: loadingIndicator width: scaling.dp(50) @@ -551,6 +546,7 @@ Page { function loadForBook() { var saved = getBookSetting("styles") || {} + console.log(JSON.stringify(saved)); load(saved) } @@ -602,9 +598,10 @@ Page { // Set the margins to give us the target width, but no more than 30%. defaults.margin = Math.round(Math.min(50 * (1 - targetwidth/widthgu), 30)) + // load defaults var saveddefault = getSetting("defaultBookStyle") var savedvals = {} - if (saveddefault != null) + if (saveddefault) savedvals = JSON.parse(saveddefault) for (var prop in savedvals) if (prop in defaults) @@ -915,17 +912,9 @@ Page { lineHeightSlider.value = bookStyles.lineHeight marginSlider.value = bookStyles.margin } - /* function onLoadingChanged() { - if (bookStyles.loading == false) - setValues() - } Component.onCompleted: { setValues() - bookStyles.onLoadingChanged.connect(onLoadingChanged) } - Component.onDestruction: { - bookStyles.onLoadingChanged.disconnect(onLoadingChanged) - }*/ } function updateNavButtons(back, forward) { @@ -967,5 +956,7 @@ Page { Component.onCompleted: { server.reader.contentsReady.connect(parseContents) + bookStyles.loadForBook(); + bookStyles.update(); } }