Prima versione di ThinQ: stato e comandi della lavasciuga via cloud LG
- 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
This commit is contained in:
commit
b5f6e79146
32 files changed
+2859
No files matched your search
@@ -0,0 +1,220 @@
|
||||
import QtQuick 2.2
|
||||
import Sailfish.Silica 1.0
|
||||
import "../js/status.js" as Status
|
||||
|
||||
Page {
|
||||
id: page
|
||||
|
||||
allowedOrientations: Orientation.All
|
||||
|
||||
// La macchina si aggiorna solo mentre la schermata e' in primo piano:
|
||||
// e' quello che l'utente ha scelto (niente ponte, niente servizio).
|
||||
onStatusChanged: {
|
||||
if (status === PageStatus.Active)
|
||||
api.startPolling()
|
||||
else
|
||||
api.stopPolling()
|
||||
}
|
||||
|
||||
SilicaFlickable {
|
||||
anchors.fill: parent
|
||||
contentHeight: column.height + Theme.paddingLarge
|
||||
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: qsTr("Refresh")
|
||||
onClicked: api.refresh()
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Delayed stop…")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("DelayDialog.qml"))
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Switch off")
|
||||
enabled: api.canCommand
|
||||
onClicked: api.powerOff()
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Wake the display up")
|
||||
enabled: api.canCommand
|
||||
onClicked: api.wakeUp()
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Settings")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"))
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: column
|
||||
width: parent.width
|
||||
spacing: Theme.paddingMedium
|
||||
|
||||
PageHeader {
|
||||
title: api.alias
|
||||
description: api.configured
|
||||
? (api.stale ? qsTr("Not up to date") : api.updatedText)
|
||||
: qsTr("Not configured")
|
||||
}
|
||||
|
||||
// Prima di tutto: se manca qualcosa per parlare con la macchina,
|
||||
// dirlo qui invece di mostrare una schermata vuota.
|
||||
Label {
|
||||
x: Theme.horizontalPageMargin
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
visible: !api.configured
|
||||
wrapMode: Text.WordWrap
|
||||
color: Theme.secondaryColor
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
text: qsTr("Enter the LG access token in Settings and pick your machine.")
|
||||
}
|
||||
|
||||
Button {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: !api.configured
|
||||
text: qsTr("Settings")
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"))
|
||||
}
|
||||
|
||||
// --- stato ---
|
||||
Item {
|
||||
width: parent.width
|
||||
height: Theme.itemSizeLarge
|
||||
visible: api.configured
|
||||
|
||||
Rectangle {
|
||||
id: lamp
|
||||
x: Theme.horizontalPageMargin
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Theme.itemSizeSmall / 2.2
|
||||
height: width
|
||||
radius: width / 2
|
||||
color: Status.statusColor(api.statusLevel)
|
||||
|
||||
SequentialAnimation on opacity {
|
||||
running: Status.isActive(api.statusLevel)
|
||||
loops: Animation.Infinite
|
||||
PropertyAnimation { to: 0.35; duration: 900 }
|
||||
PropertyAnimation { to: 1.0; duration: 900 }
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
anchors.left: lamp.right
|
||||
anchors.leftMargin: Theme.paddingLarge
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.horizontalPageMargin
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
truncationMode: TruncationMode.Fade
|
||||
text: api.phaseText
|
||||
color: Theme.primaryColor
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
}
|
||||
}
|
||||
|
||||
// --- tempo rimanente ---
|
||||
Column {
|
||||
width: parent.width
|
||||
visible: api.configured
|
||||
|
||||
Label {
|
||||
x: Theme.horizontalPageMargin
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: api.remainText.length > 0 ? api.remainText : "--"
|
||||
color: api.stale ? "orange" : Theme.primaryColor
|
||||
font.pixelSize: Theme.fontSizeHuge
|
||||
}
|
||||
|
||||
Label {
|
||||
x: Theme.horizontalPageMargin
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
visible: api.totalText.length > 0
|
||||
text: qsTr("of %1").arg(api.totalText)
|
||||
color: Theme.secondaryColor
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
}
|
||||
|
||||
// --- righe informative ---
|
||||
Column {
|
||||
width: parent.width
|
||||
visible: api.configured
|
||||
spacing: Theme.paddingSmall
|
||||
|
||||
DetailItem {
|
||||
label: qsTr("Cycle")
|
||||
value: api.cycleCount > 0 ? String(api.cycleCount) : "--"
|
||||
}
|
||||
|
||||
DetailItem {
|
||||
label: qsTr("Remote start")
|
||||
value: api.remoteEnabled ? qsTr("on") : qsTr("off")
|
||||
}
|
||||
}
|
||||
|
||||
// Se il comando a distanza e' spento, dirlo con le parole necessarie
|
||||
// invece di lasciare un tasto che non funziona.
|
||||
Label {
|
||||
x: Theme.horizontalPageMargin
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
visible: api.configured && api.hasState && !api.remoteEnabled
|
||||
wrapMode: Text.WordWrap
|
||||
color: Theme.secondaryColor
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
text: qsTr("To send commands, switch remote start on from the machine panel.")
|
||||
}
|
||||
|
||||
// --- UN comando, che cambia secondo lo stato ---
|
||||
Button {
|
||||
id: primaryButton
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
height: Theme.itemSizeLarge
|
||||
visible: api.configured
|
||||
enabled: api.canCommand && !api.busy
|
||||
text: api.primaryLabel
|
||||
onClicked: api.runPrimary()
|
||||
}
|
||||
|
||||
BusyIndicator {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
size: BusyIndicatorSize.Small
|
||||
running: api.busy
|
||||
}
|
||||
|
||||
Item { width: 1; height: Theme.paddingLarge }
|
||||
}
|
||||
|
||||
VerticalScrollDecorator { }
|
||||
}
|
||||
|
||||
// Banner dei messaggi: ancorato al bordo e di altezza fissa, cosi' non
|
||||
// sposta ne' copre il contenuto.
|
||||
Rectangle {
|
||||
id: noticeBar
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
height: api.notice.length > 0 ? Theme.itemSizeSmall : 0
|
||||
color: api.noticeIsError ? "#b3261e" : "#2e5d3a"
|
||||
visible: height > 0
|
||||
|
||||
Label {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Theme.horizontalPageMargin
|
||||
anchors.rightMargin: Theme.horizontalPageMargin
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideRight
|
||||
color: "white"
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
text: api.notice
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: api.clearNotice()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user