From cf0919d06a887fc6019997a75d6a2fa295ff5218 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Thu, 16 Nov 2017 14:55:45 -0800 Subject: [PATCH] Add setting to hide photos in the timeline --- assets/PostItem.qml | 2 +- assets/SettingsPage.qml | 39 +++++++++++++++++++++++++++++++++++++++ assets/StreamTab.qml | 9 +++++++++ assets/ThreadPage.qml | 7 +++++++ translations/Goober.ts | 24 +++++++++++++++++------- 5 files changed, 73 insertions(+), 8 deletions(-) diff --git a/assets/PostItem.qml b/assets/PostItem.qml index a6a0b78..6457738 100644 --- a/assets/PostItem.qml +++ b/assets/PostItem.qml @@ -169,7 +169,7 @@ Container { } return isphoto } - defaultImage: ptracker.image + defaultImage: (postitem.ListItem.view.hidePhoto()) ? "" : ptracker.image onClicked: { postitem.ListItem.view.showImage(ptracker.imageSource) } diff --git a/assets/SettingsPage.qml b/assets/SettingsPage.qml index 67b85c1..6f4ce20 100644 --- a/assets/SettingsPage.qml +++ b/assets/SettingsPage.qml @@ -110,6 +110,45 @@ Page { } } Divider {} + Container { + layout: DockLayout {} + horizontalAlignment: HorizontalAlignment.Fill + verticalAlignment: VerticalAlignment.Fill + Container { + verticalAlignment: VerticalAlignment.Center + leftPadding: ui.sdu(3) + Label { + text: qsTr("Hide photos") + textStyle.fontSize: FontSize.Medium + textStyle.fontWeight: FontWeight.Bold + } + Label { + text: qsTr("Hide embeded photos in timeline") + textStyle.fontSize: FontSize.Small + multiline: true + } + } + Container { + id: imgtoggle + rightPadding: ui.sdu(3) + horizontalAlignment: HorizontalAlignment.Right + verticalAlignment: VerticalAlignment.Center + ToggleButton { + checked: _app.setting("hidephoto") + onCheckedChanged: { + if (checked) { + _app.setSetting("hidephoto", true) + reload() + } else { + _app.setSetting("hidephoto", false) + reload() + } + } + accessibility.name: "inlineimages" + } + } + } + Divider {} Container { leftPadding: ui.sdu(3) rightPadding: ui.sdu(3) diff --git a/assets/StreamTab.qml b/assets/StreamTab.qml index c5b0419..86923a5 100644 --- a/assets/StreamTab.qml +++ b/assets/StreamTab.qml @@ -119,6 +119,15 @@ NavigationPane { return false } } + function hidePhoto() { + if (_app.setting("hidephoto") === "true") { + console.log("HIDE IT!") + return true + } else { + console.log("show me da photos") + return false + } + } function copyText(text) { _app.copyText(text) } diff --git a/assets/ThreadPage.qml b/assets/ThreadPage.qml index 357de67..59a7e85 100644 --- a/assets/ThreadPage.qml +++ b/assets/ThreadPage.qml @@ -66,6 +66,13 @@ Page { return false } } + function hidePhoto() { + if (_app.setting("hidephoto") === "true") { + return true + } else { + return false + } + } function showImage(filename) { _app.showImage(filename) } diff --git a/translations/Goober.ts b/translations/Goober.ts index a3a9d54..7959efe 100644 --- a/translations/Goober.ts +++ b/translations/Goober.ts @@ -185,17 +185,27 @@ - + + Hide photos + + + + + Hide embeded photos in timeline + + + + Theme - + Bright - + Dark @@ -203,22 +213,22 @@ StreamTab - + New Post - + To Top - + To Bottom - + Reload