- elenco delle macchine e stato in lettura, fasi tradotte in italiano - avvio, stop, spegnimento, ripresa e stop ritardato da 3 a 19 ore - chiave di accesso custodita solo sul telefono, nel file privato dell'app - 44 verifiche automatiche sul nucleo (scripts/test-core.sh) - interfaccia italiana o inglese secondo la lingua del telefono
143 lines
4.8 KiB
QML
143 lines
4.8 KiB
QML
import QtQuick 2.2
|
|
import Sailfish.Silica 1.0
|
|
|
|
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("Machine")
|
|
}
|
|
|
|
Button {
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
text: qsTr("Find my machines")
|
|
onClicked: api.discover()
|
|
}
|
|
|
|
ComboBox {
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
label: qsTr("Machine")
|
|
visible: api.deviceCount > 0
|
|
currentIndex: api.selectedDevice
|
|
menu: ContextMenu {
|
|
Repeater {
|
|
model: api.deviceCount
|
|
MenuItem {
|
|
text: api.deviceLabels[index]
|
|
}
|
|
}
|
|
}
|
|
onCurrentIndexChanged: {
|
|
if (currentIndex >= 0 && currentIndex !== api.selectedDevice)
|
|
api.chooseDevice(currentIndex)
|
|
}
|
|
}
|
|
|
|
Label {
|
|
x: Theme.horizontalPageMargin
|
|
width: parent.width - 2 * Theme.horizontalPageMargin
|
|
visible: appSettings.deviceAlias.length > 0
|
|
color: Theme.secondaryColor
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
text: qsTr("Selected: %1").arg(appSettings.deviceAlias)
|
|
}
|
|
|
|
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 { }
|
|
}
|
|
}
|