add settings toggle for hiding long posts in the timeline

This commit is contained in:
Morgan McMillian 2018-04-14 13:19:51 -07:00
parent f12a602e4d
commit 0dc89f87fb
5 changed files with 95 additions and 23 deletions

View file

@ -158,7 +158,16 @@ Container {
Container { // long post body Container { // long post body
topMargin: ui.sdu(2.0) topMargin: ui.sdu(2.0)
bottomMargin: ui.sdu(2.0) bottomMargin: ui.sdu(2.0)
visible: (typeof ListItemData.longpost_body !== "undefined") visible: {
if (postitem.ListItem.view.hideLongPosts()) {
return false
} else {
if (typeof ListItemData.longpost_body !== "undefined") {
return true
}
}
return false
}
Divider { Divider {
} }
Label { Label {

View file

@ -34,7 +34,7 @@ Page {
Container { Container {
topPadding: ui.sdu(2) topPadding: ui.sdu(2)
} }
Container { Container { // Unified home
layout: DockLayout {} layout: DockLayout {}
horizontalAlignment: HorizontalAlignment.Fill horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill verticalAlignment: VerticalAlignment.Fill
@ -71,7 +71,7 @@ Page {
} }
} }
Divider {} Divider {}
Container { Container { // CC setting
layout: DockLayout {} layout: DockLayout {}
horizontalAlignment: HorizontalAlignment.Fill horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill verticalAlignment: VerticalAlignment.Fill
@ -110,7 +110,7 @@ Page {
} }
} }
Divider {} Divider {}
Container { Container { // Hide photos setting
layout: DockLayout {} layout: DockLayout {}
horizontalAlignment: HorizontalAlignment.Fill horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill verticalAlignment: VerticalAlignment.Fill
@ -149,7 +149,7 @@ Page {
} }
} }
Divider {} Divider {}
Container { Container { // Hide avatar setting
layout: DockLayout {} layout: DockLayout {}
horizontalAlignment: HorizontalAlignment.Fill horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill verticalAlignment: VerticalAlignment.Fill
@ -188,7 +188,46 @@ Page {
} }
} }
Divider {} Divider {}
Container { Container { // Hide longposts setting
layout: DockLayout {}
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
Container {
verticalAlignment: VerticalAlignment.Center
leftPadding: ui.sdu(3)
Label {
text: qsTr("Hide long posts")
textStyle.fontSize: FontSize.Medium
textStyle.fontWeight: FontWeight.Bold
}
Label {
text: qsTr("Hide long posts in timeline")
textStyle.fontSize: FontSize.Small
multiline: true
}
}
Container {
id: longposttoggle
rightPadding: ui.sdu(3)
horizontalAlignment: HorizontalAlignment.Right
verticalAlignment: VerticalAlignment.Center
ToggleButton {
checked: _app.setting("hidelongp")
onCheckedChanged: {
if (checked) {
_app.setSetting("hidelongp", true)
reload()
} else {
_app.setSetting("hidelongp", false)
reload()
}
}
accessibility.name: "longposts"
}
}
}
Divider {}
Container { // Theme Setting
leftPadding: ui.sdu(3) leftPadding: ui.sdu(3)
rightPadding: ui.sdu(3) rightPadding: ui.sdu(3)
DropDown { DropDown {

View file

@ -134,6 +134,13 @@ NavigationPane {
return false return false
} }
} }
function hideLongPosts() {
if (_app.setting("hidelongp") === "true") {
return true
} else {
return false
}
}
function copyText(text) { function copyText(text) {
_app.copyText(text) _app.copyText(text)
} }

View file

@ -81,6 +81,13 @@ Page {
return false return false
} }
} }
function hideLongPosts() {
if (_app.setting("hidelongp") === "true") {
return true
} else {
return false
}
}
function showImage(filename) { function showImage(filename) {
_app.showImage(filename) _app.showImage(filename)
} }

View file

@ -43,52 +43,52 @@
<context> <context>
<name>PostItem</name> <name>PostItem</name>
<message> <message>
<location filename="../assets/PostItem.qml" line="271"/> <location filename="../assets/PostItem.qml" line="280"/>
<source>Reply</source> <source>Reply</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="280"/> <location filename="../assets/PostItem.qml" line="289"/>
<source>Reply All</source> <source>Reply All</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="290"/> <location filename="../assets/PostItem.qml" line="299"/>
<source>Delete Bookmark</source> <source>Delete Bookmark</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="290"/> <location filename="../assets/PostItem.qml" line="299"/>
<source>Add Bookmark</source> <source>Add Bookmark</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="301"/> <location filename="../assets/PostItem.qml" line="310"/>
<source>Delete Repost</source> <source>Delete Repost</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="301"/> <location filename="../assets/PostItem.qml" line="310"/>
<source>Repost</source> <source>Repost</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="312"/> <location filename="../assets/PostItem.qml" line="321"/>
<source>Quote</source> <source>Quote</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="321"/> <location filename="../assets/PostItem.qml" line="330"/>
<source>View Profile</source> <source>View Profile</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="328"/> <location filename="../assets/PostItem.qml" line="337"/>
<source>Copy text</source> <source>Copy text</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="358"/> <location filename="../assets/PostItem.qml" line="367"/>
<source>Delete</source> <source>Delete</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -205,17 +205,27 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/SettingsPage.qml" line="195"/> <location filename="../assets/SettingsPage.qml" line="199"/>
<source>Hide long posts</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/SettingsPage.qml" line="204"/>
<source>Hide long posts in timeline</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/SettingsPage.qml" line="234"/>
<source>Theme</source> <source>Theme</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/SettingsPage.qml" line="197"/> <location filename="../assets/SettingsPage.qml" line="236"/>
<source>Bright</source> <source>Bright</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/SettingsPage.qml" line="202"/> <location filename="../assets/SettingsPage.qml" line="241"/>
<source>Dark</source> <source>Dark</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -223,22 +233,22 @@
<context> <context>
<name>StreamTab</name> <name>StreamTab</name>
<message> <message>
<location filename="../assets/StreamTab.qml" line="175"/> <location filename="../assets/StreamTab.qml" line="182"/>
<source>New Post</source> <source>New Post</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="189"/> <location filename="../assets/StreamTab.qml" line="196"/>
<source>To Top</source> <source>To Top</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="217"/> <location filename="../assets/StreamTab.qml" line="224"/>
<source>To Bottom</source> <source>To Bottom</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="204"/> <location filename="../assets/StreamTab.qml" line="211"/>
<source>Reload</source> <source>Reload</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>