harbour-tooter/qml/pages/SettingsPage.qml

247 lines
9.8 KiB
QML
Raw Normal View History

2017-07-20 13:14:16 +03:00
import QtQuick 2.0
import Sailfish.Silica 1.0
import "../lib/API.js" as Logic
2017-07-20 13:14:16 +03:00
Page {
id: settingsPage
allowedOrientations: Orientation.All
2017-07-20 13:14:16 +03:00
SilicaFlickable {
contentHeight: column.height + Theme.paddingLarge
contentWidth: parent.width
anchors.fill: parent
RemorsePopup { id: remorsePopup }
2017-07-20 13:14:16 +03:00
VerticalScrollDecorator {}
2020-04-27 18:43:10 +03:00
Column {
2017-07-20 13:14:16 +03:00
id: column
spacing: Theme.paddingMedium
2017-07-20 13:14:16 +03:00
width: parent.width
2017-07-20 13:14:16 +03:00
PageHeader {
title: qsTr("Settings")
}
2020-06-04 12:17:06 +03:00
SectionHeader { text: qsTr("Options")}
IconTextSwitch {
text: qsTr("Load Images in Toots")
description: qsTr("Disable this option if you want to preserve your data connection")
icon.source: "image://theme/icon-m-image"
checked: typeof Logic.conf['loadImages'] !== "undefined" && Logic.conf['loadImages']
onClicked: {
Logic.conf['loadImages'] = checked
}
}
2020-06-18 09:32:52 +03:00
SectionHeader { text: qsTr("Account") }
Item {
id: removeAccount
2017-07-20 13:14:16 +03:00
width: parent.width
height: txtRemoveAccount.height + btnRemoveAccount.height + Theme.paddingLarge
anchors {
left: parent.left
2020-06-04 20:44:12 +03:00
leftMargin: Theme.horizontalPageMargin
right: parent.right
rightMargin: Theme.paddingLarge
}
Icon {
id: icnRemoveAccount
2020-06-04 12:17:06 +03:00
color: Theme.highlightColor
width: Theme.iconSizeMedium
fillMode: Image.PreserveAspectFit
source: Logic.conf['login'] ? "image://theme/icon-m-contact" : "image://theme/icon-m-add"
anchors.right: parent.right
2017-07-20 13:14:16 +03:00
}
Column {
id: clnRemoveAccount
spacing: Theme.paddingMedium
anchors {
left: parent.left
right: icnRemoveAccount.left
2017-07-20 13:14:16 +03:00
}
Button {
id: btnRemoveAccount
text: Logic.conf['login'] ? qsTr("Remove Account") : qsTr("Add Account")
2020-06-19 11:16:13 +03:00
preferredWidth: Theme.buttonWidthMedium
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
remorsePopup.execute(btnRemoveAccount.text, function() {
if (Logic.conf['login']) {
Logic.conf['login'] = false
Logic.conf['instance'] = null;
Logic.conf['api_user_token'] = null;
}
pageStack.push(Qt.resolvedUrl("LoginPage.qml"))
})
}
Timer {
id: timer1
interval: 4700
onTriggered: parent.busy = false
}
}
Label {
id: txtRemoveAccount
text: Logic.conf['login'] ? qsTr("Deauthorize this app from using your account and remove account data from phone") : qsTr("Authorize this app to access your Mastodon account")
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.Wrap
2020-06-04 12:17:06 +03:00
color: Theme.highlightColor
2020-06-15 11:42:10 +03:00
width: parent.width - Theme.paddingMedium
anchors.left: parent.left
}
}
}
2020-06-04 12:17:06 +03:00
SectionHeader {
text: qsTr("Translate")
}
2020-06-04 12:17:06 +03:00
LinkedLabel {
2020-06-10 17:11:42 +03:00
id: translateLbl
//: Full sentence for translation: "Use Transifex to help with app translation to your language." - The word Transifex is a link and doesn't need translation.
text: qsTr("Use")+" "+"<a href='https://www.transifex.com/dysko/tooter/'>Transifex</a>"+" "+qsTr("to help with app translation to your language.")
2020-06-04 12:17:06 +03:00
textFormat: Text.StyledText
color: Theme.highlightColor
linkColor: Theme.primaryColor
font.family: Theme.fontFamilyHeading
font.pixelSize: Theme.fontSizeExtraSmall
wrapMode: Text.Wrap
anchors {
left: parent.left
leftMargin: Theme.horizontalPageMargin
right: parent.right
rightMargin: Theme.paddingLarge
}
2020-06-04 12:17:06 +03:00
}
2017-07-20 13:14:16 +03:00
SectionHeader {
2020-06-19 11:16:13 +03:00
//: Translation alternative: "Development"
2017-07-20 13:14:16 +03:00
text: qsTr("Credits")
}
Column {
width: parent.width
anchors {
left: parent.left
right: parent.right
rightMargin: Theme.paddingLarge
2017-07-20 13:14:16 +03:00
}
2017-07-20 13:14:16 +03:00
Repeater {
model: ListModel {
2017-07-20 13:14:16 +03:00
ListElement {
name: "Duško Angirević"
desc: qsTr("UI/UX design and development")
mastodon: "dysko@mastodon.social"
mail: ""
}
ListElement {
name: "Molan"
2020-04-28 12:43:57 +03:00
desc: qsTr("Development and translations")
mastodon: "molan@fosstodon.org"
mail: ""
}
2020-06-19 11:16:13 +03:00
ListElement {
name: "Miodrag Nikolić"
desc: qsTr("Visual identity")
mastodon: ""
mail: "micotakis@gmail.com"
}
2017-07-20 13:14:16 +03:00
ListElement {
name: "Quentin PAGÈS / Quenti ♏"
2020-01-30 14:50:52 +03:00
desc: qsTr("Occitan & French translation")
2017-07-20 13:14:16 +03:00
mastodon: "Quenti@framapiaf.org"
mail: ""
}
2020-04-27 18:40:16 +03:00
ListElement {
name: "Luchy Kon / dashinfantry"
desc: qsTr("Chinese translation")
mastodon: ""
mail: "dashinfantry@gmail.com"
}
2017-07-20 13:14:16 +03:00
ListElement {
name: "André Koot"
2020-01-30 14:50:52 +03:00
desc: qsTr("Dutch translation")
2017-07-20 13:14:16 +03:00
mastodon: "meneer@mastodon.social"
mail: "https://twitter.com/meneer"
}
2017-07-20 13:14:16 +03:00
ListElement {
2020-02-04 00:52:28 +03:00
name: "CarmenFdez"
2020-01-30 14:50:52 +03:00
desc: qsTr("Spanish translation")
2017-07-20 13:14:16 +03:00
mastodon: ""
2020-02-04 00:52:28 +03:00
mail: ""
2017-07-20 13:14:16 +03:00
}
}
Item {
width: parent.width
height: Theme.itemSizeMedium
2017-07-20 13:14:16 +03:00
IconButton {
id: btn
icon.source: "image://theme/" + (model.mastodon !== "" ? "icon-m-outline-chat" : "icon-m-mail") + "?" + (pressed
? Theme.highlightColor : Theme.primaryColor)
2017-07-20 13:14:16 +03:00
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
}
onClicked: {
if (model.mastodon !== ""){
2020-06-19 11:16:13 +03:00
var m = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject');
pageStack.push(Qt.resolvedUrl("ConversationPage.qml"), {
headerTitle: "Mention",
2017-07-20 13:14:16 +03:00
description: '@'+model.mastodon,
type: "new"
2017-07-20 13:14:16 +03:00
})
} else {
Qt.openUrlExternally("mailto:"+model.mail);
}
}
}
2017-07-20 13:14:16 +03:00
Column {
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: Theme.horizontalPageMargin
right: btn.left
rightMargin: Theme.paddingMedium
}
Label {
id: lblName
text: model.name
color: Theme.highlightColor
2017-07-20 13:14:16 +03:00
font.pixelSize: Theme.fontSizeSmall
}
2017-07-20 13:14:16 +03:00
Label {
text: model.desc
color: Theme.secondaryHighlightColor
font.pixelSize: Theme.fontSizeExtraSmall
}
}
}
}
}
}
}
}