Schermata principale con tutte le macchine, avviso di fine lavaggio, IT/EN
- la chiave si chiede una volta sola: poi la schermata principale mostra ogni macchina dell'account col suo stato e il suo comando - avviso di sistema a fine lavaggio, anche se il ciclo e' finito mentre l'app era chiusa (si annota il numero di ciclo gia' avvisato) - comandi per singola macchina: avvio/stop, spegnimento, risveglio, stop ritardato (nel menu della macchina, tocco prolungato sul nome) - le macchine non raggiungibili vengono segnate come non collegate, senza riempire la barra dei messaggi ad ogni aggiornamento - multilingua italiano/inglese, catalogo verificato dal banco di prova (52 controlli)
This commit is contained in:
1 parent
fe961b438c
commit
e2c6f28613
14 files changed
+1015
-541
No files matched your search
+10
-4
@@ -2,7 +2,11 @@ import QtQuick 2.2
|
||||
import Sailfish.Silica 1.0
|
||||
import "../js/status.js" as Status
|
||||
|
||||
// Copertina: la macchina che sta lavorando (se ce n'e' una), altrimenti la
|
||||
// prima. Stesse funzioni della schermata principale: una sola verita'.
|
||||
CoverBackground {
|
||||
property int shown: api.activeIndex()
|
||||
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
width: parent.width - 2 * Theme.paddingMedium
|
||||
@@ -13,7 +17,7 @@ CoverBackground {
|
||||
width: Theme.itemSizeSmall / 2.2
|
||||
height: width
|
||||
radius: width / 2
|
||||
color: Status.statusColor(api.statusLevel)
|
||||
color: Status.statusColor(api.statusLevelAt(shown))
|
||||
}
|
||||
|
||||
Label {
|
||||
@@ -22,16 +26,18 @@ CoverBackground {
|
||||
elide: Text.ElideRight
|
||||
color: Theme.primaryColor
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
text: api.hasState ? api.phaseText : qsTr("No data")
|
||||
text: api.validIndex(shown) && api.hasStateAt(shown)
|
||||
? api.phaseTextAt(shown)
|
||||
: qsTr("No data")
|
||||
}
|
||||
|
||||
Label {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
visible: api.remainText.length > 0
|
||||
visible: api.validIndex(shown) && api.remainTextAt(shown).length > 0
|
||||
color: Theme.secondaryColor
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
text: api.remainText
|
||||
text: api.validIndex(shown) ? api.remainTextAt(shown) : ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import QtQuick 2.2
|
||||
import Sailfish.Silica 1.0
|
||||
import Nemo.Notifications 1.0
|
||||
import "pages"
|
||||
import "cover"
|
||||
|
||||
@@ -8,4 +9,25 @@ ApplicationWindow
|
||||
initialPage: Component { MainPage { } }
|
||||
cover: Component { CoverPage { } }
|
||||
allowedOrientations: Orientation.All
|
||||
|
||||
// Avviso di fine lavaggio. La macchina lo racconta al cloud, l'app lo
|
||||
// chiede al cloud: nessun server di mezzo. Arriva quando l'app e' viva e
|
||||
// ha appena visto il ciclo finire; se nel frattempo era chiusa, arriva
|
||||
// alla prima riapertura.
|
||||
Notification {
|
||||
id: cycleNotice
|
||||
appName: "ThinQ"
|
||||
appIcon: "harbour-thinq"
|
||||
urgency: Notification.Normal
|
||||
expireTimeout: 10000
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: api
|
||||
onCycleFinished: {
|
||||
cycleNotice.summary = qsTr("Washing finished")
|
||||
cycleNotice.body = label
|
||||
cycleNotice.publish()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,20 @@
|
||||
import QtQuick 2.2
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
// Stop ritardato: 3-19 ore, gli unici valori che questa macchina accetta.
|
||||
// Stop ritardato: 3-19 ore, gli unici valori che queste macchine accettano.
|
||||
// Si apre dal menu di UNA macchina: senza l'indice il comando andrebbe a
|
||||
// quella sbagliata.
|
||||
Dialog {
|
||||
id: dialog
|
||||
|
||||
property int deviceIndex: -1
|
||||
property int hours: api.delayHours
|
||||
|
||||
canAccept: true
|
||||
canAccept: api.canCommandAt(deviceIndex)
|
||||
|
||||
onAccepted: {
|
||||
api.setDelayHours(hours)
|
||||
api.sendDelay()
|
||||
api.sendDelayAt(deviceIndex)
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -19,7 +22,8 @@ Dialog {
|
||||
spacing: Theme.paddingMedium
|
||||
|
||||
DialogHeader {
|
||||
title: qsTr("Delayed stop")
|
||||
title: api.validIndex(deviceIndex) ? api.labelAt(deviceIndex)
|
||||
: qsTr("Delayed stop")
|
||||
acceptText: qsTr("Set")
|
||||
}
|
||||
|
||||
|
||||
+199
-122
@@ -2,13 +2,17 @@ import QtQuick 2.2
|
||||
import Sailfish.Silica 1.0
|
||||
import "../js/status.js" as Status
|
||||
|
||||
// Prima schermata. Due volti:
|
||||
// * senza chiave di accesso -> si chiede una volta sola (qui, non nelle
|
||||
// impostazioni) e poi non se ne parla piu';
|
||||
// * con la chiave -> l'elenco delle macchine, ognuna col suo stato.
|
||||
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).
|
||||
// niente ponte, niente servizio che gira di nascosto.
|
||||
onStatusChanged: {
|
||||
if (status === PageStatus.Active)
|
||||
api.startPolling()
|
||||
@@ -23,22 +27,9 @@ Page {
|
||||
PullDownMenu {
|
||||
MenuItem {
|
||||
text: qsTr("Refresh")
|
||||
enabled: api.configured
|
||||
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"))
|
||||
@@ -51,131 +42,217 @@ Page {
|
||||
spacing: Theme.paddingMedium
|
||||
|
||||
PageHeader {
|
||||
title: api.alias
|
||||
title: qsTr("My machines")
|
||||
description: api.configured
|
||||
? (api.stale ? qsTr("Not up to date") : api.updatedText)
|
||||
: qsTr("Not configured")
|
||||
? (api.busy ? qsTr("Updating…") : qsTr("%1 found").arg(api.deviceCount))
|
||||
: qsTr("First setup")
|
||||
}
|
||||
|
||||
// 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 {
|
||||
// ---------------------------------------------------------------
|
||||
// Primo avvio: le credenziali si chiedono qui, una volta sola.
|
||||
// ---------------------------------------------------------------
|
||||
Column {
|
||||
width: parent.width
|
||||
height: Theme.itemSizeLarge
|
||||
visible: api.configured
|
||||
visible: !api.configured
|
||||
spacing: Theme.paddingMedium
|
||||
|
||||
Rectangle {
|
||||
id: lamp
|
||||
Label {
|
||||
x: Theme.horizontalPageMargin
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Theme.itemSizeSmall / 2.2
|
||||
height: width
|
||||
radius: width / 2
|
||||
color: Status.statusColor(api.statusLevel)
|
||||
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.")
|
||||
}
|
||||
|
||||
SequentialAnimation on opacity {
|
||||
running: Status.isActive(api.statusLevel)
|
||||
loops: Animation.Infinite
|
||||
PropertyAnimation { to: 0.35; duration: 900 }
|
||||
PropertyAnimation { to: 1.0; duration: 900 }
|
||||
TextField {
|
||||
id: setupToken
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
label: qsTr("Access token")
|
||||
placeholderText: qsTr("paste the token")
|
||||
echoMode: TextInput.Password
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: setupCountry
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
label: qsTr("Country code")
|
||||
placeholderText: "IT"
|
||||
onTextChanged: appSettings.country = text
|
||||
Component.onCompleted: text = appSettings.country
|
||||
}
|
||||
|
||||
Button {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
height: Theme.itemSizeMedium
|
||||
enabled: setupToken.text.length > 0 && !api.busy
|
||||
text: qsTr("Connect")
|
||||
onClicked: {
|
||||
appSettings.token = setupToken.text
|
||||
api.reloadCredentials()
|
||||
api.discover()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
// ---------------------------------------------------------------
|
||||
// Ogni macchina dell'account, col suo stato e il suo comando.
|
||||
// ---------------------------------------------------------------
|
||||
Repeater {
|
||||
model: api.configured ? api.deviceCount : 0
|
||||
|
||||
delegate: Column {
|
||||
id: machine
|
||||
width: column.width
|
||||
spacing: Theme.paddingSmall
|
||||
|
||||
// Nome e fase: il tocco prolungato apre le azioni della
|
||||
// macchina (stop ritardato, spegni, risveglia).
|
||||
Item {
|
||||
x: Theme.horizontalPageMargin
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
height: Math.max(lamp.height, nameBox.height)
|
||||
|
||||
Rectangle {
|
||||
id: lamp
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: Theme.itemSizeSmall / 2.2
|
||||
height: width
|
||||
radius: width / 2
|
||||
color: Status.statusColor(api.statusLevelAt(index))
|
||||
|
||||
SequentialAnimation on opacity {
|
||||
running: Status.isActive(api.statusLevelAt(index))
|
||||
loops: Animation.Infinite
|
||||
PropertyAnimation { to: 0.35; duration: 900 }
|
||||
PropertyAnimation { to: 1.0; duration: 900 }
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: nameBox
|
||||
anchors.left: lamp.right
|
||||
anchors.leftMargin: Theme.paddingLarge
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.paddingTiny
|
||||
|
||||
Label {
|
||||
width: parent.width
|
||||
truncationMode: TruncationMode.Fade
|
||||
text: api.labelAt(index)
|
||||
color: Theme.highlightColor
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
}
|
||||
|
||||
Label {
|
||||
width: parent.width
|
||||
truncationMode: TruncationMode.Fade
|
||||
text: api.offlineAt(index)
|
||||
? qsTr("Not connected")
|
||||
: api.phaseTextAt(index)
|
||||
color: Theme.secondaryColor
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onPressAndHold: machineMenu.open(this)
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: api.hasStateAt(index)
|
||||
text: api.remainTextAt(index).length > 0 ? api.remainTextAt(index) : "--"
|
||||
color: api.staleAt(index) ? "orange" : Theme.primaryColor
|
||||
font.pixelSize: Theme.fontSizeHuge
|
||||
}
|
||||
|
||||
Label {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: api.totalLineAt(index).length > 0
|
||||
text: api.totalLineAt(index)
|
||||
color: Theme.secondaryColor
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
||||
// Se la macchina non risponde o ha l'avvio a distanza
|
||||
// spento, dirlo con le parole necessarie invece di lasciare
|
||||
// un tasto che non funziona.
|
||||
Label {
|
||||
x: Theme.horizontalPageMargin
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
wrapMode: Text.WordWrap
|
||||
visible: api.hasStateAt(index) && !api.remoteEnabledAt(index)
|
||||
color: Theme.secondaryColor
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
text: qsTr("To send commands, switch remote start on from the machine panel.")
|
||||
}
|
||||
|
||||
Label {
|
||||
x: Theme.horizontalPageMargin
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
wrapMode: Text.WordWrap
|
||||
visible: api.offlineAt(index)
|
||||
color: Theme.secondaryColor
|
||||
font.pixelSize: Theme.fontSizeExtraSmall
|
||||
text: qsTr("The washing machine is not connected (switched off or offline)")
|
||||
}
|
||||
|
||||
// UN comando per macchina, che cambia secondo il suo stato.
|
||||
Button {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
height: Theme.itemSizeMedium
|
||||
visible: api.hasStateAt(index)
|
||||
enabled: api.canCommandAt(index) && !api.busy
|
||||
text: api.primaryLabelAt(index)
|
||||
onClicked: api.runPrimaryAt(index)
|
||||
}
|
||||
|
||||
ContextMenu {
|
||||
id: machineMenu
|
||||
|
||||
MenuItem {
|
||||
text: qsTr("Delayed stop…")
|
||||
enabled: api.canCommandAt(index)
|
||||
onClicked: pageStack.push(Qt.resolvedUrl("DelayDialog.qml"),
|
||||
{ "deviceIndex": index })
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Switch off")
|
||||
enabled: api.canCommandAt(index)
|
||||
onClicked: api.powerOffAt(index)
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Wake the display up")
|
||||
enabled: api.canCommandAt(index)
|
||||
onClicked: api.wakeUpAt(index)
|
||||
}
|
||||
}
|
||||
|
||||
Separator {
|
||||
width: parent.width
|
||||
color: Theme.secondaryHighlightColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- 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.
|
||||
// Chiave presente ma nessuna macchina: dirlo qui, non con una
|
||||
// schermata vuota.
|
||||
Label {
|
||||
x: Theme.horizontalPageMargin
|
||||
width: parent.width - 2 * Theme.horizontalPageMargin
|
||||
visible: api.configured && api.hasState && !api.remoteEnabled
|
||||
wrapMode: Text.WordWrap
|
||||
visible: api.configured && api.deviceCount === 0 && !api.busy
|
||||
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()
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
text: qsTr("No machine found yet. Pull down to search again.")
|
||||
}
|
||||
|
||||
BusyIndicator {
|
||||
|
||||
+12
-30
@@ -1,6 +1,8 @@
|
||||
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
|
||||
|
||||
@@ -67,7 +69,16 @@ Page {
|
||||
}
|
||||
|
||||
SectionHeader {
|
||||
text: qsTr("Machine")
|
||||
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 {
|
||||
@@ -76,35 +87,6 @@ Page {
|
||||
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")
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user