[ubuntu] Add settings page
Implement the settings page and make sure they all work.
This commit is contained in:
parent
a5bebef931
commit
d1515e6de7
7 changed files with 235 additions and 16 deletions
|
|
@ -17,6 +17,13 @@ Page {
|
|||
title: qsTr("Tiny Tiny RSS Reader")
|
||||
|
||||
head {
|
||||
actions: [
|
||||
Action {
|
||||
iconName: "settings"
|
||||
onTriggered: pageStack.push(Qt.resolvedUrl("Settings.qml"))
|
||||
}
|
||||
]
|
||||
|
||||
sections {
|
||||
model: [ qsTr("Unread"), qsTr("All") ]
|
||||
selectedIndex: settings.showAll ? 1 : 0
|
||||
|
|
@ -41,7 +48,6 @@ Page {
|
|||
/* TODO
|
||||
PullDownMenu {
|
||||
//AboutItem {}
|
||||
SettingsItem {}
|
||||
MenuItem {
|
||||
text: qsTr("Logout")
|
||||
visible: pageStack.depth == 1
|
||||
|
|
@ -49,18 +55,6 @@ Page {
|
|||
pageStack.replace(Qt.resolvedUrl("MainPage.qml"), { doAutoLogin: false })
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Update")
|
||||
enabled: !network.loading
|
||||
onClicked: {
|
||||
categories.update()
|
||||
}
|
||||
}
|
||||
ToggleShowAllItem {
|
||||
onUpdateView: {
|
||||
categories.update()
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ ListItem.Empty {
|
|||
anchors.leftMargin: units.gu(1)
|
||||
anchors.right: countLabel.left
|
||||
iconSource: model.icon
|
||||
iconColor: settings.whiteBackgroundOnIcons ? "white" : undefined
|
||||
bold: model.unreadcount > 0
|
||||
text: model.title
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ Item {
|
|||
id: itemView
|
||||
width: parent.width
|
||||
text: parseContent(root.content, root.attachments)
|
||||
fontSize: Theme.fontSizeSmall
|
||||
fontSize: settings.webviewFontSize
|
||||
color: Theme.palette.selected.baseText
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,13 @@ Page {
|
|||
}
|
||||
|
||||
head {
|
||||
actions: [
|
||||
Action {
|
||||
iconName: "settings"
|
||||
onTriggered: pageStack.push(Qt.resolvedUrl("Settings.qml"))
|
||||
}
|
||||
]
|
||||
|
||||
sections {
|
||||
model: [ qsTr("Unread"), qsTr("All") ]
|
||||
selectedIndex: settings.showAll ? 1 : 0
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ Item {
|
|||
|
||||
property string text
|
||||
property alias color: contentText.color
|
||||
property real fontSize: Theme.fontSizeSmall
|
||||
property real fontSize: 10
|
||||
|
||||
property string _RICHTEXT_STYLESHEET_PREAMBLE: "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><style>a { text-decoration: none; color: 'blue' }</style></head><body>";
|
||||
property string _RICHTEXT_STYLESHEET_APPENDIX: "</body></html>";
|
||||
|
|
@ -71,7 +71,7 @@ Item {
|
|||
scale: scaling
|
||||
|
||||
transformOrigin: Item.TopLeft
|
||||
font.pixelSize: parent.fontSize / scaling
|
||||
font.pixelSize: parent.fontSize * units.gu(1) / scaling
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
textFormat: Text.RichText
|
||||
smooth: true
|
||||
|
|
|
|||
208
qml/ttrss/ubuntu-touch/Settings.qml
Normal file
208
qml/ttrss/ubuntu-touch/Settings.qml
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
/*
|
||||
* This file is part of TTRss, a Tiny Tiny RSS Reader App
|
||||
* for MeeGo Harmattan and Sailfish OS.
|
||||
* Copyright (C) 2012–2014 Hauke Schade
|
||||
*
|
||||
* TTRss is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* TTRss is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with TTRss; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
|
||||
* http://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import Ubuntu.Components 1.1
|
||||
import Ubuntu.Components.ListItems 1.0 as ListItem
|
||||
|
||||
Page {
|
||||
id: settingsPage
|
||||
title: qsTr("Settings")
|
||||
|
||||
Flickable {
|
||||
id: flickable
|
||||
contentHeight: settingsColumn.height
|
||||
anchors.fill: parent
|
||||
|
||||
/* TODO
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: qsTr("About")
|
||||
onClicked: {
|
||||
pageStack.push(Qt.resolvedUrl("AboutPage.qml"));
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Column {
|
||||
id: settingsColumn
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
// -- Startup --
|
||||
Label {
|
||||
font.bold: true
|
||||
text: qsTr("Startup")
|
||||
}
|
||||
|
||||
ListItem.Standard {
|
||||
text: qsTr('Automatically Login')
|
||||
control: Switch {
|
||||
id: autoLoginSetting
|
||||
checked: settings.useAutologin
|
||||
}
|
||||
}
|
||||
|
||||
ListItem.Standard {
|
||||
text: qsTr('Show "All Feeds"')
|
||||
control: Switch {
|
||||
id: useAllFeedsOnStartupSetting
|
||||
//description: qsTr('You need to restart the App for this to take effect.')
|
||||
checked: settings.useAllFeedsOnStartup
|
||||
}
|
||||
}
|
||||
|
||||
ListItem.ItemSelector {
|
||||
id: minimumSSLVersionSetting
|
||||
text: qsTr("Minimum Ssl Version")
|
||||
selectedIndex: settings.minSSLVersion
|
||||
//description: qsTr('Specify a minimum protocol version for your SSL connection. This might be necessary when your server does not allow connections with older (insecure) protocols. However, your server might not support the newest protocol.')
|
||||
|
||||
model: [
|
||||
qsTr("Any"),
|
||||
qsTr("SslV2"),
|
||||
qsTr("SslV3"),
|
||||
qsTr("TlsV1.0"),
|
||||
qsTr("TlsV1.1"),
|
||||
qsTr("TlsV1.2")
|
||||
]
|
||||
}
|
||||
|
||||
ListItem.Divider {}
|
||||
|
||||
// -- Feeds --
|
||||
Label {
|
||||
font.bold: true
|
||||
text: qsTr("Feeds")
|
||||
}
|
||||
|
||||
ListItem.Standard {
|
||||
text: qsTr("Show Icons")
|
||||
control: Switch {
|
||||
id: showIconsSetting
|
||||
checked: settings.displayIcons
|
||||
}
|
||||
}
|
||||
|
||||
ListItem.Standard {
|
||||
enabled: showIconsSetting.checked
|
||||
text: qsTr("White Background on Icons")
|
||||
control: Switch {
|
||||
id: showWhiteBackgroundSetting
|
||||
checked: settings.whiteBackgroundOnIcons
|
||||
}
|
||||
}
|
||||
|
||||
ListItem.Divider {}
|
||||
|
||||
// -- Item List --
|
||||
Label {
|
||||
font.bold: true
|
||||
text: qsTr("Item List")
|
||||
}
|
||||
|
||||
ListItem.ItemSelector {
|
||||
id: orderSetting
|
||||
text: qsTr("Order")
|
||||
selectedIndex: settings.feeditemsOrder
|
||||
|
||||
model: [
|
||||
qsTr("Newest First"),
|
||||
qsTr("Oldest First")
|
||||
]
|
||||
}
|
||||
|
||||
ListItem.Divider {}
|
||||
|
||||
// -- Items --
|
||||
Label {
|
||||
font.bold: true
|
||||
text: qsTr("Items")
|
||||
}
|
||||
|
||||
ListItem.Standard {
|
||||
text: qsTr("Automatically Mark as Read")
|
||||
control: Switch {
|
||||
id: autoMarkReadSetting
|
||||
checked: settings.autoMarkRead
|
||||
}
|
||||
}
|
||||
|
||||
ListItem.Standard {
|
||||
text: qsTr("Show Images")
|
||||
control: Switch {
|
||||
id: displayImagesSetting
|
||||
checked: settings.displayImages
|
||||
}
|
||||
}
|
||||
|
||||
ListItem.Standard {
|
||||
text: qsTr("Strip invisible Images")
|
||||
enabled: displayImagesSetting.checked
|
||||
control: Switch {
|
||||
id: stripInvisibleImgSetting
|
||||
//description: qsTr("height or width < 2")
|
||||
checked: settings.stripInvisibleImg
|
||||
}
|
||||
}
|
||||
|
||||
ListItem.ItemSelector {
|
||||
id: fontSizeSetting
|
||||
text: qsTr('Font Size')
|
||||
selectedIndex: settings.webviewFontSize
|
||||
model: [
|
||||
qsTr("Tiny"),
|
||||
qsTr("Small"),
|
||||
qsTr("Medium"),
|
||||
qsTr("Large"),
|
||||
qsTr("Huge")
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Scrollbar {
|
||||
flickableItem: flickable
|
||||
}
|
||||
|
||||
onActiveChanged: if (!active) {
|
||||
// Startup
|
||||
settings.useAutologin = autoLoginSetting.checked
|
||||
settings.useAllFeedsOnStartup = useAllFeedsOnStartupSetting.checked
|
||||
settings.minSSLVersion = minimumSSLVersionSetting.selectedIndex
|
||||
|
||||
// Feeds
|
||||
settings.displayIcons = showIconsSetting.checked
|
||||
settings.whiteBackgroundOnIcons = showWhiteBackgroundSetting.checked
|
||||
|
||||
// Item List
|
||||
settings.feeditemsOrder = orderSetting.selectedIndex
|
||||
|
||||
// Items
|
||||
settings.autoMarkRead = autoMarkReadSetting.checked
|
||||
settings.displayImages = displayImagesSetting.checked
|
||||
settings.stripInvisibleImg = stripInvisibleImgSetting.checked
|
||||
settings.webviewFontSize = fontSizeSetting.selectedIndex
|
||||
}
|
||||
}
|
||||
|
|
@ -18,6 +18,7 @@ Item {
|
|||
property alias text: titleLabel.text
|
||||
property alias subText: subLabel.text
|
||||
property alias iconSource: icon.source
|
||||
property alias iconColor: backgroundShape.color
|
||||
property bool bold: false
|
||||
|
||||
anchors.top: parent.top
|
||||
|
|
@ -25,6 +26,14 @@ Item {
|
|||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
/* FIXME This duplicate UbuntuShape is a workaround for
|
||||
https://launchpad.net/bugs/1396104 */
|
||||
UbuntuShape {
|
||||
id: backgroundShape
|
||||
anchors.fill: iconShape
|
||||
visible: iconShape.visible
|
||||
}
|
||||
|
||||
UbuntuShape {
|
||||
id: iconShape
|
||||
anchors.left: parent.left
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue