import QtQuick 2.2 import Sailfish.Silica 1.0 // Impostazioni: la chiave, il paese, la lingua. Le macchine non si scelgono // piu' qui: la schermata principale le mostra tutte. Page { id: page property string tokenDraft: appSettings.token SilicaFlickable { anchors.fill: parent contentHeight: column.height + Theme.paddingLarge Column { id: column width: parent.width spacing: Theme.paddingMedium PageHeader { title: qsTr("Settings") } SectionHeader { text: qsTr("LG account") } Label { x: Theme.horizontalPageMargin width: parent.width - 2 * Theme.horizontalPageMargin wrapMode: Text.WordWrap color: Theme.secondaryColor font.pixelSize: Theme.fontSizeExtraSmall text: qsTr("The access token comes from connect-pat.lgthinq.com and stays on this phone only. If LG starts refusing it, paste a new one here.") } TextField { id: tokenField anchors.left: parent.left anchors.right: parent.right label: qsTr("Access token") placeholderText: qsTr("paste the token") echoMode: TextInput.Password text: page.tokenDraft onTextChanged: page.tokenDraft = text } TextField { id: countryField anchors.left: parent.left anchors.right: parent.right label: qsTr("Country code") placeholderText: "IT" // Il valore si carica una volta: legarlo alla property farebbe // riscrivere il campo sotto le dita (il codice paese viene // normalizzato in maiuscolo). onTextChanged: appSettings.country = text Component.onCompleted: text = appSettings.country } Button { anchors.horizontalCenter: parent.horizontalCenter text: qsTr("Save the token") onClicked: { appSettings.token = page.tokenDraft api.reloadCredentials() api.discover() } } SectionHeader { text: qsTr("Machines") } Label { x: Theme.horizontalPageMargin width: parent.width - 2 * Theme.horizontalPageMargin wrapMode: Text.WordWrap color: Theme.secondaryColor font.pixelSize: Theme.fontSizeSmall text: qsTr("%1 found").arg(api.deviceCount) } Button { anchors.horizontalCenter: parent.horizontalCenter text: qsTr("Find my machines") onClicked: api.discover() } SectionHeader { text: qsTr("Language") } ComboBox { anchors.left: parent.left anchors.right: parent.right label: qsTr("Language") currentIndex: translator.language === "it" ? 2 : (translator.language === "en" ? 1 : 0) menu: ContextMenu { MenuItem { text: qsTr("System") } MenuItem { text: "English" } MenuItem { text: "Italiano" } } onCurrentIndexChanged: { translator.language = currentIndex === 2 ? "it" : (currentIndex === 1 ? "en" : "system") } } Label { x: Theme.horizontalPageMargin width: parent.width - 2 * Theme.horizontalPageMargin horizontalAlignment: Text.AlignHCenter color: Theme.secondaryColor font.pixelSize: Theme.fontSizeExtraSmall text: qsTr("Version %1").arg(appVersion) } Item { width: 1; height: Theme.paddingLarge } } VerticalScrollDecorator { } } }