L'elenco delle macchine si aggiorna davvero (stato, fase, tempo)

Difetto: le scritte leggevano lo stato con funzioni per indice
(phaseTextAt, remainTextAt, ...). In QML un binding che chiama una
funzione non registra nessuna dipendenza, quindi veniva valutato una
volta sola — all'apertura, prima che i dati arrivassero — e non si
aggiornava mai: si vedevano i nomi delle macchine ma nessuno stato.

Correzione: il client espone l'elenco come DATO (QVariantList di mappe,
proprieta' devices con NOTIFY) piu' la mappa active per la copertina;
le schermate leggono modelData.*, e ricevono devicesChanged ad ogni
aggiornamento di stato.

Verificato nel pacchetto: le chiavi nuove sono presenti, le funzioni
rimosse non ci sono piu', MainPage legge modelData.
This commit is contained in:
kaneda committed 2026-10-12 12:58:59 +02:00
1 parent e2c6f28613
commit c6621e5968
8 files changed
+173 -217

No files matched your search

+6 -9
View File
@@ -3,10 +3,9 @@ import Sailfish.Silica 1.0
import "../js/status.js" as Status import "../js/status.js" as Status
// Copertina: la macchina che sta lavorando (se ce n'e' una), altrimenti la // Copertina: la macchina che sta lavorando (se ce n'e' una), altrimenti la
// prima. Stesse funzioni della schermata principale: una sola verita'. // prima. Legge la stessa proprieta' della schermata principale: una sola
// verita', e si aggiorna da sola quando i dati cambiano.
CoverBackground { CoverBackground {
property int shown: api.activeIndex()
Column { Column {
anchors.centerIn: parent anchors.centerIn: parent
width: parent.width - 2 * Theme.paddingMedium width: parent.width - 2 * Theme.paddingMedium
@@ -17,7 +16,7 @@ CoverBackground {
width: Theme.itemSizeSmall / 2.2 width: Theme.itemSizeSmall / 2.2
height: width height: width
radius: width / 2 radius: width / 2
color: Status.statusColor(api.statusLevelAt(shown)) color: Status.statusColor(api.active.level)
} }
Label { Label {
@@ -26,18 +25,16 @@ CoverBackground {
elide: Text.ElideRight elide: Text.ElideRight
color: Theme.primaryColor color: Theme.primaryColor
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
text: api.validIndex(shown) && api.hasStateAt(shown) text: api.active.hasState ? api.active.phase : qsTr("No data")
? api.phaseTextAt(shown)
: qsTr("No data")
} }
Label { Label {
width: parent.width width: parent.width
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
visible: api.validIndex(shown) && api.remainTextAt(shown).length > 0 visible: api.active.remain !== undefined && api.active.remain.length > 0
color: Theme.secondaryColor color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
text: api.validIndex(shown) ? api.remainTextAt(shown) : "" text: api.active.remain !== undefined ? api.active.remain : ""
} }
} }
+6 -5
View File
@@ -2,15 +2,17 @@ import QtQuick 2.2
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
// Stop ritardato: 3-19 ore, gli unici valori che queste macchine accettano. // 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 // Si apre dal menu di UNA macchina: l'indice e il nome arrivano dalla voce
// quella sbagliata. // aperta, cosi' il comando non puo' finire sulla macchina sbagliata.
Dialog { Dialog {
id: dialog id: dialog
property int deviceIndex: -1 property int deviceIndex: -1
property string deviceLabel: ""
property bool enableAccept: false
property int hours: api.delayHours property int hours: api.delayHours
canAccept: api.canCommandAt(deviceIndex) canAccept: enableAccept
onAccepted: { onAccepted: {
api.setDelayHours(hours) api.setDelayHours(hours)
@@ -22,8 +24,7 @@ Dialog {
spacing: Theme.paddingMedium spacing: Theme.paddingMedium
DialogHeader { DialogHeader {
title: api.validIndex(deviceIndex) ? api.labelAt(deviceIndex) title: dialog.deviceLabel.length > 0 ? dialog.deviceLabel : qsTr("Delayed stop")
: qsTr("Delayed stop")
acceptText: qsTr("Set") acceptText: qsTr("Set")
} }
+27 -24
View File
@@ -6,6 +6,9 @@ import "../js/status.js" as Status
// * senza chiave di accesso -> si chiede una volta sola (qui, non nelle // * senza chiave di accesso -> si chiede una volta sola (qui, non nelle
// impostazioni) e poi non se ne parla piu'; // impostazioni) e poi non se ne parla piu';
// * con la chiave -> l'elenco delle macchine, ognuna col suo stato. // * con la chiave -> l'elenco delle macchine, ognuna col suo stato.
//
// L'elenco arriva come DATO (api.devices), non con funzioni di lettura: solo
// cosi' le scritte si aggiornano quando lo stato cambia.
Page { Page {
id: page id: page
@@ -102,7 +105,7 @@ Page {
// Ogni macchina dell'account, col suo stato e il suo comando. // Ogni macchina dell'account, col suo stato e il suo comando.
// --------------------------------------------------------------- // ---------------------------------------------------------------
Repeater { Repeater {
model: api.configured ? api.deviceCount : 0 model: api.devices
delegate: Column { delegate: Column {
id: machine id: machine
@@ -122,10 +125,10 @@ Page {
width: Theme.itemSizeSmall / 2.2 width: Theme.itemSizeSmall / 2.2
height: width height: width
radius: width / 2 radius: width / 2
color: Status.statusColor(api.statusLevelAt(index)) color: Status.statusColor(modelData.level)
SequentialAnimation on opacity { SequentialAnimation on opacity {
running: Status.isActive(api.statusLevelAt(index)) running: Status.isActive(modelData.level)
loops: Animation.Infinite loops: Animation.Infinite
PropertyAnimation { to: 0.35; duration: 900 } PropertyAnimation { to: 0.35; duration: 900 }
PropertyAnimation { to: 1.0; duration: 900 } PropertyAnimation { to: 1.0; duration: 900 }
@@ -143,7 +146,7 @@ Page {
Label { Label {
width: parent.width width: parent.width
truncationMode: TruncationMode.Fade truncationMode: TruncationMode.Fade
text: api.labelAt(index) text: modelData.label
color: Theme.highlightColor color: Theme.highlightColor
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
} }
@@ -151,9 +154,7 @@ Page {
Label { Label {
width: parent.width width: parent.width
truncationMode: TruncationMode.Fade truncationMode: TruncationMode.Fade
text: api.offlineAt(index) text: modelData.offline ? qsTr("Not connected") : modelData.phase
? qsTr("Not connected")
: api.phaseTextAt(index)
color: Theme.secondaryColor color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
} }
@@ -167,28 +168,28 @@ Page {
Label { Label {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: api.hasStateAt(index) visible: modelData.hasState
text: api.remainTextAt(index).length > 0 ? api.remainTextAt(index) : "--" text: modelData.remain.length > 0 ? modelData.remain : "--"
color: api.staleAt(index) ? "orange" : Theme.primaryColor color: modelData.stale ? "orange" : Theme.primaryColor
font.pixelSize: Theme.fontSizeHuge font.pixelSize: Theme.fontSizeHuge
} }
Label { Label {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
visible: api.totalLineAt(index).length > 0 visible: modelData.totalLine.length > 0
text: api.totalLineAt(index) text: modelData.totalLine
color: Theme.secondaryColor color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
} }
// Se la macchina non risponde o ha l'avvio a distanza // Se l'avvio a distanza e' spento sulla macchina, dirlo con
// spento, dirlo con le parole necessarie invece di lasciare // le parole necessarie invece di lasciare un tasto che non
// un tasto che non funziona. // funziona.
Label { Label {
x: Theme.horizontalPageMargin x: Theme.horizontalPageMargin
width: parent.width - 2 * Theme.horizontalPageMargin width: parent.width - 2 * Theme.horizontalPageMargin
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
visible: api.hasStateAt(index) && !api.remoteEnabledAt(index) visible: modelData.hasState && !modelData.remote
color: Theme.secondaryColor color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
text: qsTr("To send commands, switch remote start on from the machine panel.") text: qsTr("To send commands, switch remote start on from the machine panel.")
@@ -198,7 +199,7 @@ Page {
x: Theme.horizontalPageMargin x: Theme.horizontalPageMargin
width: parent.width - 2 * Theme.horizontalPageMargin width: parent.width - 2 * Theme.horizontalPageMargin
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
visible: api.offlineAt(index) visible: modelData.offline
color: Theme.secondaryColor color: Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
text: qsTr("The washing machine is not connected (switched off or offline)") text: qsTr("The washing machine is not connected (switched off or offline)")
@@ -209,9 +210,9 @@ Page {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 2 * Theme.horizontalPageMargin width: parent.width - 2 * Theme.horizontalPageMargin
height: Theme.itemSizeMedium height: Theme.itemSizeMedium
visible: api.hasStateAt(index) visible: modelData.hasState
enabled: api.canCommandAt(index) && !api.busy enabled: modelData.canCommand && !api.busy
text: api.primaryLabelAt(index) text: modelData.action
onClicked: api.runPrimaryAt(index) onClicked: api.runPrimaryAt(index)
} }
@@ -220,18 +221,20 @@ Page {
MenuItem { MenuItem {
text: qsTr("Delayed stop…") text: qsTr("Delayed stop…")
enabled: api.canCommandAt(index) enabled: modelData.canCommand
onClicked: pageStack.push(Qt.resolvedUrl("DelayDialog.qml"), onClicked: pageStack.push(Qt.resolvedUrl("DelayDialog.qml"),
{ "deviceIndex": index }) { "deviceIndex": index,
"deviceLabel": modelData.label,
"enableAccept": modelData.canCommand })
} }
MenuItem { MenuItem {
text: qsTr("Switch off") text: qsTr("Switch off")
enabled: api.canCommandAt(index) enabled: modelData.canCommand
onClicked: api.powerOffAt(index) onClicked: api.powerOffAt(index)
} }
MenuItem { MenuItem {
text: qsTr("Wake the display up") text: qsTr("Wake the display up")
enabled: api.canCommandAt(index) enabled: modelData.canCommand
onClicked: api.wakeUpAt(index) onClicked: api.wakeUpAt(index)
} }
} }
+6 -1
View File
@@ -1,6 +1,6 @@
Name: harbour-thinq Name: harbour-thinq
Summary: Control an LG ThinQ washing machine Summary: Control an LG ThinQ washing machine
Version: 0.2.0 Version: 0.2.1
Release: 1 Release: 1
Group: Qt/Qt Group: Qt/Qt
License: MIT License: MIT
@@ -26,6 +26,11 @@ ThinQ Connect cloud from the phone: no server in between. The access token
is stored only on the device, in the app private configuration file. is stored only on the device, in the app private configuration file.
%changelog %changelog
* Mon Oct 12 2026 Carlo - 0.2.1-1
- l'elenco delle macchine si aggiorna davvero: stato, fase e tempo rimanente
erano letti con funzioni, che in QML non si aggiornano da sole (si vedevano i
nomi ma nessuno stato)
* Mon Oct 12 2026 Carlo - 0.2.0-1 * Mon Oct 12 2026 Carlo - 0.2.0-1
- la schermata principale chiede la chiave una volta sola, poi mostra tutte le - la schermata principale chiede la chiave una volta sola, poi mostra tutte le
macchine dell'account con lo stato di ciascuna macchine dell'account con lo stato di ciascuna
+2 -2
View File
@@ -21,7 +21,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
app->setOrganizationName(QStringLiteral("harbour")); app->setOrganizationName(QStringLiteral("harbour"));
app->setApplicationName(QStringLiteral("thinq")); app->setApplicationName(QStringLiteral("thinq"));
app->setApplicationVersion(QStringLiteral("0.2.0")); app->setApplicationVersion(QStringLiteral("0.2.1"));
Settings settings; Settings settings;
ThinQClient api(&settings); ThinQClient api(&settings);
@@ -34,7 +34,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
QQuickView *view = SailfishApp::createView(); QQuickView *view = SailfishApp::createView();
// Prima riga del log: dice se il device sta girando la build nuova o una stale. // Prima riga del log: dice se il device sta girando la build nuova o una stale.
qDebug() << "harbour-thinq v0.2.0 build" << __DATE__ << __TIME__; qDebug() << "harbour-thinq v0.2.1 build" << __DATE__ << __TIME__;
view->rootContext()->setContextProperty(QStringLiteral("appSettings"), &settings); view->rootContext()->setContextProperty(QStringLiteral("appSettings"), &settings);
view->rootContext()->setContextProperty(QStringLiteral("api"), &api); view->rootContext()->setContextProperty(QStringLiteral("api"), &api);
+54 -110
View File
@@ -45,17 +45,63 @@ bool ThinQClient::configured() const
return !m_settings->token().isEmpty(); return !m_settings->token().isEmpty();
} }
int ThinQClient::activeIndex() const QVariantList ThinQClient::devices() const
{ {
// Tutto quello che le schermate devono mostrare, gia' pronto. I binding QML
// si aggiornano quando questa proprieta' cambia (devicesChanged): con le
// funzioni di lettura, invece, non si sarebbero mai aggiornati.
QVariantList list;
for (int i = 0; i < m_devices.size(); ++i) { for (int i = 0; i < m_devices.size(); ++i) {
const DeviceEntry &e = m_devices.at(i);
const QString total = ThinQJson::durationText(e.state.totalMinutes);
QVariantMap item;
item.insert(QStringLiteral("id"), e.id);
item.insert(QStringLiteral("label"), e.label.isEmpty()
? QCoreApplication::translate("ThinQ", "Washing machine") : e.label);
item.insert(QStringLiteral("hasState"), e.hasState);
item.insert(QStringLiteral("offline"), e.offline);
item.insert(QStringLiteral("stale"), e.stale);
item.insert(QStringLiteral("updated"), e.updated);
item.insert(QStringLiteral("phase"), e.hasState
? ThinQJson::phaseLabel(e.state)
: QCoreApplication::translate("ThinQ", "No data"));
item.insert(QStringLiteral("level"), ThinQJson::statusLevel(e.state));
item.insert(QStringLiteral("remain"), ThinQJson::durationText(e.state.remainMinutes));
item.insert(QStringLiteral("totalLine"), total.isEmpty() ? QString()
: QCoreApplication::translate("ThinQ", "of %1").arg(total));
item.insert(QStringLiteral("cycle"), e.state.cycleCount);
item.insert(QStringLiteral("remote"), e.state.remoteEnabled);
item.insert(QStringLiteral("action"), e.hasState
? ThinQJson::primaryActionLabel(e.state)
: QCoreApplication::translate("ThinQ", "Start"));
item.insert(QStringLiteral("canCommand"),
e.hasState && !e.offline && e.state.remoteEnabled);
list << item;
}
return list;
}
QVariantMap ThinQClient::active() const
{
// Per la copertina: la macchina che sta lavorando, altrimenti la prima che
// sa dire qualcosa di se'.
int chosen = -1;
for (int i = 0; i < m_devices.size() && chosen < 0; ++i) {
if (ThinQJson::statusLevel(m_devices.at(i).state) == 1) if (ThinQJson::statusLevel(m_devices.at(i).state) == 1)
return i; chosen = i;
} }
for (int i = 0; i < m_devices.size(); ++i) { for (int i = 0; i < m_devices.size() && chosen < 0; ++i) {
if (m_devices.at(i).hasState) if (m_devices.at(i).hasState)
return i; chosen = i;
} }
return m_devices.isEmpty() ? -1 : 0; if (chosen < 0 && !m_devices.isEmpty())
chosen = 0;
const QVariantList list = devices();
if (chosen < 0 || chosen >= list.size())
return QVariantMap();
return list.at(chosen).toMap();
} }
bool ThinQClient::validIndex(int index) const bool ThinQClient::validIndex(int index) const
@@ -63,110 +109,6 @@ bool ThinQClient::validIndex(int index) const
return index >= 0 && index < m_devices.size(); return index >= 0 && index < m_devices.size();
} }
QString ThinQClient::labelAt(int index) const
{
if (!validIndex(index))
return QString();
const QString label = m_devices.at(index).label;
return label.isEmpty()
? QCoreApplication::translate("ThinQ", "Washing machine")
: label;
}
bool ThinQClient::hasStateAt(int index) const
{
return validIndex(index) && m_devices.at(index).hasState;
}
bool ThinQClient::offlineAt(int index) const
{
return validIndex(index) && m_devices.at(index).offline;
}
bool ThinQClient::staleAt(int index) const
{
return validIndex(index) && m_devices.at(index).stale;
}
QString ThinQClient::phaseTextAt(int index) const
{
if (!hasStateAt(index))
return QCoreApplication::translate("ThinQ", "No data");
return ThinQJson::phaseLabel(m_devices.at(index).state);
}
int ThinQClient::statusLevelAt(int index) const
{
if (!validIndex(index))
return -1;
return ThinQJson::statusLevel(m_devices.at(index).state);
}
QString ThinQClient::remainTextAt(int index) const
{
if (!validIndex(index))
return QString();
return ThinQJson::durationText(m_devices.at(index).state.remainMinutes);
}
QString ThinQClient::totalTextAt(int index) const
{
if (!validIndex(index))
return QString();
return ThinQJson::durationText(m_devices.at(index).state.totalMinutes);
}
QString ThinQClient::totalLineAt(int index) const
{
const QString total = totalTextAt(index);
if (total.isEmpty())
return QString();
return QCoreApplication::translate("ThinQ", "of %1").arg(total);
}
int ThinQClient::cycleCountAt(int index) const
{
if (!validIndex(index))
return 0;
return m_devices.at(index).state.cycleCount;
}
bool ThinQClient::remoteEnabledAt(int index) const
{
if (!hasStateAt(index))
return false;
return m_devices.at(index).state.remoteEnabled;
}
QString ThinQClient::primaryLabelAt(int index) const
{
if (!hasStateAt(index))
return QCoreApplication::translate("ThinQ", "Start");
return ThinQJson::primaryActionLabel(m_devices.at(index).state);
}
bool ThinQClient::canCommandAt(int index) const
{
if (!hasStateAt(index))
return false;
const DeviceEntry &e = m_devices.at(index);
return !e.offline && e.state.remoteEnabled;
}
QString ThinQClient::updatedTextAt(int index) const
{
if (!validIndex(index))
return QString();
return m_devices.at(index).updated;
}
QString ThinQClient::deviceIdAt(int index) const
{
if (!validIndex(index))
return QString();
return m_devices.at(index).id;
}
void ThinQClient::setDelayHours(int hours) void ThinQClient::setDelayHours(int hours)
{ {
const int clamped = qBound(3, hours, 19); const int clamped = qBound(3, hours, 19);
@@ -292,7 +234,7 @@ void ThinQClient::discover()
void ThinQClient::runPrimaryAt(int index) void ThinQClient::runPrimaryAt(int index)
{ {
if (!hasStateAt(index)) { if (!validIndex(index) || !m_devices.at(index).hasState) {
setNotice(QCoreApplication::translate("ThinQ", "No data from the machine yet"), true); setNotice(QCoreApplication::translate("ThinQ", "No data from the machine yet"), true);
return; return;
} }
@@ -502,6 +444,7 @@ void ThinQClient::applyState(int deviceIndex, bool hadState, int previousLevel,
if (m_pollInterval != kPollFastMs) if (m_pollInterval != kPollFastMs)
m_pollInterval = kPollFastMs; m_pollInterval = kPollFastMs;
emit devicesChanged();
emit stateChanged(); emit stateChanged();
noteFinished(deviceIndex, hadState, previousLevel); noteFinished(deviceIndex, hadState, previousLevel);
} }
@@ -566,6 +509,7 @@ void ThinQClient::handleFailure(int httpStatus, const QByteArray &body,
entry.hasState = false; entry.hasState = false;
entry.updated.clear(); entry.updated.clear();
entry.stale = false; entry.stale = false;
emit devicesChanged();
emit stateChanged(); emit stateChanged();
return; return;
} }
+12 -22
View File
@@ -6,6 +6,8 @@
#include <QObject> #include <QObject>
#include <QStringList> #include <QStringList>
#include <QTimer> #include <QTimer>
#include <QVariantList>
#include <QVariantMap>
#include "thinqjson.h" #include "thinqjson.h"
@@ -15,14 +17,17 @@ class QNetworkReply;
// Tutte le macchine dell'account, ognuna col suo stato. Una sola classe parla // Tutte le macchine dell'account, ognuna col suo stato. Una sola classe parla
// col cloud LG: nessun ponte, nessun server di mezzo, nessun servizio. // col cloud LG: nessun ponte, nessun server di mezzo, nessun servizio.
// //
// Il QML legge per indice (labelAt/phaseTextAt/...): l'elenco cambia raramente e // L'elenco si espone come DATO (QVariantList di mappe), non con funzioni di
// cosi' le stesse funzioni servono la schermata principale e la copertina. // lettura per indice: in QML un binding che chiama una funzione non registra
// nessuna dipendenza e quindi non si aggiorna mai — le macchine si vedevano, ma
// lo stato restava vuoto per sempre.
class ThinQClient : public QObject class ThinQClient : public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool configured READ configured NOTIFY infoChanged) Q_PROPERTY(bool configured READ configured NOTIFY infoChanged)
Q_PROPERTY(int deviceCount READ deviceCount NOTIFY devicesChanged) Q_PROPERTY(int deviceCount READ deviceCount NOTIFY devicesChanged)
Q_PROPERTY(int activeIndex READ activeIndex NOTIFY stateChanged) Q_PROPERTY(QVariantList devices READ devices NOTIFY devicesChanged)
Q_PROPERTY(QVariantMap active READ active NOTIFY devicesChanged)
Q_PROPERTY(bool busy READ busy NOTIFY busyChanged) Q_PROPERTY(bool busy READ busy NOTIFY busyChanged)
Q_PROPERTY(bool polling READ polling NOTIFY pollingChanged) Q_PROPERTY(bool polling READ polling NOTIFY pollingChanged)
Q_PROPERTY(QString notice READ notice NOTIFY noticeChanged) Q_PROPERTY(QString notice READ notice NOTIFY noticeChanged)
@@ -36,8 +41,8 @@ public:
// invece di chiedere le credenziali. // invece di chiedere le credenziali.
bool configured() const; bool configured() const;
int deviceCount() const { return m_devices.size(); } int deviceCount() const { return m_devices.size(); }
// La macchina che sta lavorando (per la copertina), altrimenti la prima. QVariantList devices() const;
int activeIndex() const; QVariantMap active() const;
bool busy() const { return m_busy; } bool busy() const { return m_busy; }
bool polling() const { return m_pollTimer.isActive(); } bool polling() const { return m_pollTimer.isActive(); }
QString notice() const { return m_notice; } QString notice() const { return m_notice; }
@@ -45,23 +50,6 @@ public:
int delayHours() const { return m_delayHours; } int delayHours() const { return m_delayHours; }
void setDelayHours(int hours); void setDelayHours(int hours);
Q_INVOKABLE QString labelAt(int index) const;
Q_INVOKABLE bool hasStateAt(int index) const;
Q_INVOKABLE bool offlineAt(int index) const;
Q_INVOKABLE bool staleAt(int index) const;
Q_INVOKABLE QString phaseTextAt(int index) const;
Q_INVOKABLE int statusLevelAt(int index) const;
Q_INVOKABLE QString remainTextAt(int index) const;
Q_INVOKABLE QString totalTextAt(int index) const;
Q_INVOKABLE QString totalLineAt(int index) const;
Q_INVOKABLE int cycleCountAt(int index) const;
Q_INVOKABLE bool remoteEnabledAt(int index) const;
Q_INVOKABLE QString primaryLabelAt(int index) const;
Q_INVOKABLE bool canCommandAt(int index) const;
Q_INVOKABLE QString updatedTextAt(int index) const;
Q_INVOKABLE QString deviceIdAt(int index) const;
Q_INVOKABLE bool validIndex(int index) const;
Q_INVOKABLE void refresh(); Q_INVOKABLE void refresh();
Q_INVOKABLE void discover(); Q_INVOKABLE void discover();
Q_INVOKABLE void runPrimaryAt(int index); Q_INVOKABLE void runPrimaryAt(int index);
@@ -89,6 +77,8 @@ signals:
private: private:
enum RequestKind { KindDevices, KindState, KindCommand }; enum RequestKind { KindDevices, KindState, KindCommand };
bool validIndex(int index) const;
struct DeviceEntry { struct DeviceEntry {
QString id; QString id;
QString label; QString label;
+60 -44
View File
@@ -4,7 +4,7 @@
<context> <context>
<name>CoverPage</name> <name>CoverPage</name>
<message> <message>
<location filename="../qml/cover/CoverPage.qml" line="31"/> <location filename="../qml/cover/CoverPage.qml" line="28"/>
<source>No data</source> <source>No data</source>
<translation>Nessun dato</translation> <translation>Nessun dato</translation>
<translation>Nessun dato</translation> <translation>Nessun dato</translation>
@@ -13,19 +13,19 @@
<context> <context>
<name>DelayDialog</name> <name>DelayDialog</name>
<message> <message>
<location filename="../qml/pages/DelayDialog.qml" line="26"/> <location filename="../qml/pages/DelayDialog.qml" line="27"/>
<source>Delayed stop</source> <source>Delayed stop</source>
<translation>Stop ritardato</translation> <translation>Stop ritardato</translation>
<translation>Stop ritardato</translation> <translation>Stop ritardato</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/DelayDialog.qml" line="27"/> <location filename="../qml/pages/DelayDialog.qml" line="28"/>
<source>Set</source> <source>Set</source>
<translation>Imposta</translation> <translation>Imposta</translation>
<translation>Imposta</translation> <translation>Imposta</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/DelayDialog.qml" line="36"/> <location filename="../qml/pages/DelayDialog.qml" line="37"/>
<source>The machine will stop on its own after the chosen time, then resume its programme.</source> <source>The machine will stop on its own after the chosen time, then resume its programme.</source>
<translation>La macchina si ferma da sola allo scadere del tempo scelto, poi riprende il programma.</translation> <translation>La macchina si ferma da sola allo scadere del tempo scelto, poi riprende il programma.</translation>
<translation>La macchina si ferma da sola allo scadere del tempo scelto, poi riprende il programma.</translation> <translation>La macchina si ferma da sola allo scadere del tempo scelto, poi riprende il programma.</translation>
@@ -34,91 +34,101 @@
<context> <context>
<name>MainPage</name> <name>MainPage</name>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="29"/> <location filename="../qml/pages/MainPage.qml" line="32"/>
<source>Refresh</source> <source>Refresh</source>
<translation>Aggiorna</translation> <translation>Aggiorna</translation>
<translation>Aggiorna</translation> <translation>Aggiorna</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="45"/> <location filename="../qml/pages/MainPage.qml" line="48"/>
<source>My machines</source> <source>My machines</source>
<translation>Le mie macchine</translation> <translation>Le mie macchine</translation>
<translation>Le mie macchine</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="47"/> <location filename="../qml/pages/MainPage.qml" line="50"/>
<source>Updating…</source> <source>Updating…</source>
<translation>Aggiornamento…</translation> <translation>Aggiornamento…</translation>
<translation>Aggiornamento…</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="47"/> <location filename="../qml/pages/MainPage.qml" line="50"/>
<source>%1 found</source> <source>%1 found</source>
<translation>%1 trovate</translation> <translation>%1 trovate</translation>
<translation>%1 trovate</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="48"/> <location filename="../qml/pages/MainPage.qml" line="51"/>
<source>First setup</source> <source>First setup</source>
<translation>Primo avvio</translation> <translation>Primo avvio</translation>
<translation>Primo avvio</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="65"/> <location filename="../qml/pages/MainPage.qml" line="68"/>
<source>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.</source> <source>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.</source>
<translation>La chiave di accesso si crea su connect-pat.lgthinq.com e resta solo su questo telefono. Se LG non la accetta piu', incollane una nuova qui.</translation> <translation>La chiave di accesso si crea su connect-pat.lgthinq.com e resta solo su questo telefono. Se LG non la accetta piu', incollane una nuova qui.</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="72"/> <location filename="../qml/pages/MainPage.qml" line="75"/>
<source>Access token</source> <source>Access token</source>
<translation>Chiave di accesso</translation> <translation>Chiave di accesso</translation>
<translation>Chiave di accesso</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="73"/> <location filename="../qml/pages/MainPage.qml" line="76"/>
<source>paste the token</source> <source>paste the token</source>
<translation>incolla la chiave</translation> <translation>incolla la chiave</translation>
<translation>incolla la chiave</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="81"/> <location filename="../qml/pages/MainPage.qml" line="84"/>
<source>Country code</source> <source>Country code</source>
<translation>Paese</translation> <translation>Paese</translation>
<translation>Paese</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="92"/> <location filename="../qml/pages/MainPage.qml" line="95"/>
<source>Connect</source> <source>Connect</source>
<translation>Collega</translation> <translation>Collega</translation>
<translation>Collega</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="155"/> <location filename="../qml/pages/MainPage.qml" line="157"/>
<source>Not connected</source> <source>Not connected</source>
<translation>Non collegata</translation> <translation>Non collegata</translation>
<translation>Non collegata</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="204"/> <location filename="../qml/pages/MainPage.qml" line="205"/>
<source>The washing machine is not connected (switched off or offline)</source> <source>The washing machine is not connected (switched off or offline)</source>
<translation>La lavatrice non e' collegata (spenta o senza rete)</translation> <translation>La lavatrice non e' collegata (spenta o senza rete)</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="222"/> <location filename="../qml/pages/MainPage.qml" line="223"/>
<source>Delayed stop…</source> <source>Delayed stop…</source>
<translation>Stop ritardato…</translation> <translation>Stop ritardato…</translation>
<translation>Stop ritardato…</translation> <translation>Stop ritardato…</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="228"/> <location filename="../qml/pages/MainPage.qml" line="231"/>
<source>Switch off</source> <source>Switch off</source>
<translation>Spegni</translation> <translation>Spegni</translation>
<translation>Spegni</translation> <translation>Spegni</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="233"/> <location filename="../qml/pages/MainPage.qml" line="236"/>
<source>Wake the display up</source> <source>Wake the display up</source>
<translation>Risveglia il display</translation> <translation>Risveglia il display</translation>
<translation>Risveglia il display</translation> <translation>Risveglia il display</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="255"/> <location filename="../qml/pages/MainPage.qml" line="258"/>
<source>No machine found yet. Pull down to search again.</source> <source>No machine found yet. Pull down to search again.</source>
<translation>Nessuna macchina trovata. Trascina in basso per cercare di nuovo.</translation> <translation>Nessuna macchina trovata. Trascina in basso per cercare di nuovo.</translation>
<translation>Nessuna macchina trovata. Trascina in basso per cercare di nuovo.</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="34"/> <location filename="../qml/pages/MainPage.qml" line="37"/>
<source>Settings</source> <source>Settings</source>
<translation>Impostazioni</translation> <translation>Impostazioni</translation>
<translation>Impostazioni</translation> <translation>Impostazioni</translation>
@@ -156,7 +166,7 @@
<translation>spento</translation> <translation>spento</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/MainPage.qml" line="194"/> <location filename="../qml/pages/MainPage.qml" line="195"/>
<source>To send commands, switch remote start on from the machine panel.</source> <source>To send commands, switch remote start on from the machine panel.</source>
<translation>Per inviare comandi, accendi l'avvio a distanza dal pannello della macchina.</translation> <translation>Per inviare comandi, accendi l'avvio a distanza dal pannello della macchina.</translation>
</message> </message>
@@ -208,11 +218,13 @@
<location filename="../qml/pages/SettingsPage.qml" line="72"/> <location filename="../qml/pages/SettingsPage.qml" line="72"/>
<source>Machines</source> <source>Machines</source>
<translation>Macchine</translation> <translation>Macchine</translation>
<translation>Macchine</translation>
</message> </message>
<message> <message>
<location filename="../qml/pages/SettingsPage.qml" line="81"/> <location filename="../qml/pages/SettingsPage.qml" line="81"/>
<source>%1 found</source> <source>%1 found</source>
<translation>%1 trovate</translation> <translation>%1 trovate</translation>
<translation>%1 trovate</translation>
</message> </message>
<message> <message>
<source>Machine</source> <source>Machine</source>
@@ -251,31 +263,32 @@
<context> <context>
<name>ThinQ</name> <name>ThinQ</name>
<message> <message>
<location filename="../src/thinqclient.cpp" line="72"/> <location filename="../src/thinqclient.cpp" line="61"/>
<source>Washing machine</source> <source>Washing machine</source>
<translation>Lavatrice</translation> <translation>Lavatrice</translation>
<translation>Lavatrice</translation> <translation>Lavatrice</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="94"/> <location filename="../src/thinqclient.cpp" line="68"/>
<source>No data</source> <source>No data</source>
<translation>Nessun dato</translation> <translation>Nessun dato</translation>
<translation>Nessun dato</translation> <translation>Nessun dato</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="124"/> <location filename="../src/thinqclient.cpp" line="72"/>
<source>of %1</source> <source>of %1</source>
<translation>su %1</translation> <translation>su %1</translation>
<translation>su %1</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="144"/> <location filename="../src/thinqclient.cpp" line="77"/>
<location filename="../src/thinqjson.cpp" line="162"/> <location filename="../src/thinqjson.cpp" line="162"/>
<source>Start</source> <source>Start</source>
<translation>Avvia</translation> <translation>Avvia</translation>
<translation>Avvia</translation> <translation>Avvia</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="287"/> <location filename="../src/thinqclient.cpp" line="229"/>
<source>Enter the access token first</source> <source>Enter the access token first</source>
<translation>Inserisci prima la chiave di accesso</translation> <translation>Inserisci prima la chiave di accesso</translation>
<translation>Inserisci prima la chiave di accesso</translation> <translation>Inserisci prima la chiave di accesso</translation>
@@ -285,26 +298,26 @@
<translation>Macchina scelta</translation> <translation>Macchina scelta</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="296"/> <location filename="../src/thinqclient.cpp" line="238"/>
<source>No data from the machine yet</source> <source>No data from the machine yet</source>
<translation>Ancora nessun dato dalla macchina</translation> <translation>Ancora nessun dato dalla macchina</translation>
<translation>Ancora nessun dato dalla macchina</translation> <translation>Ancora nessun dato dalla macchina</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="411"/> <location filename="../src/thinqclient.cpp" line="353"/>
<source>No washing machine found on this account</source> <source>No washing machine found on this account</source>
<translation>Nessuna lavatrice trovata su questo account</translation> <translation>Nessuna lavatrice trovata su questo account</translation>
<translation>Nessuna lavatrice trovata su questo account</translation> <translation>Nessuna lavatrice trovata su questo account</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="414"/> <location filename="../src/thinqclient.cpp" line="356"/>
<source>Machines found: %1</source> <source>Machines found: %1</source>
<translation>Macchine trovate: %1</translation> <translation>Macchine trovate: %1</translation>
<translation>Macchine trovate: %1</translation> <translation>Macchine trovate: %1</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="438"/> <location filename="../src/thinqclient.cpp" line="380"/>
<location filename="../src/thinqclient.cpp" line="483"/> <location filename="../src/thinqclient.cpp" line="425"/>
<source>Command sent</source> <source>Command sent</source>
<translation>Comando inviato</translation> <translation>Comando inviato</translation>
<translation>Comando inviato</translation> <translation>Comando inviato</translation>
@@ -314,63 +327,65 @@
<translation>Imposta prima la chiave di accesso e la macchina</translation> <translation>Imposta prima la chiave di accesso e la macchina</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="446"/> <location filename="../src/thinqclient.cpp" line="388"/>
<source>The access token is missing</source> <source>The access token is missing</source>
<translation>Manca la chiave di accesso</translation> <translation>Manca la chiave di accesso</translation>
<translation>Manca la chiave di accesso</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="450"/> <location filename="../src/thinqclient.cpp" line="392"/>
<source>No machine to command</source> <source>No machine to command</source>
<translation>Nessuna macchina da comandare</translation> <translation>Nessuna macchina da comandare</translation>
<translation>Nessuna macchina da comandare</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="455"/> <location filename="../src/thinqclient.cpp" line="397"/>
<location filename="../src/thinqclient.cpp" line="582"/> <location filename="../src/thinqclient.cpp" line="526"/>
<source>Remote start is off on the machine: switch it on from its panel</source> <source>Remote start is off on the machine: switch it on from its panel</source>
<translation>L'avvio a distanza e' spento sulla macchina: accendilo dal pannello</translation> <translation>L'avvio a distanza e' spento sulla macchina: accendilo dal pannello</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="499"/> <location filename="../src/thinqclient.cpp" line="441"/>
<source>Updated at %1</source> <source>Updated at %1</source>
<translation>Aggiornato alle %1</translation> <translation>Aggiornato alle %1</translation>
<translation>Aggiornato alle %1</translation> <translation>Aggiornato alle %1</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="575"/> <location filename="../src/thinqclient.cpp" line="519"/>
<source>The access token is no longer valid: enter a new one in Settings</source> <source>The access token is no longer valid: enter a new one in Settings</source>
<translation>La chiave di accesso non e' piu' valida: inseriscine una nuova nelle Impostazioni</translation> <translation>La chiave di accesso non e' piu' valida: inseriscine una nuova nelle Impostazioni</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="578"/> <location filename="../src/thinqclient.cpp" line="522"/>
<source>Too many requests to LG: slowing down</source> <source>Too many requests to LG: slowing down</source>
<translation>Troppe richieste a LG: rallento gli aggiornamenti</translation> <translation>Troppe richieste a LG: rallento gli aggiornamenti</translation>
<translation>Troppe richieste a LG: rallento gli aggiornamenti</translation> <translation>Troppe richieste a LG: rallento gli aggiornamenti</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="580"/> <location filename="../src/thinqclient.cpp" line="524"/>
<source>The washing machine is not connected (switched off or offline)</source> <source>The washing machine is not connected (switched off or offline)</source>
<translation>La lavatrice non e' collegata (spenta o senza rete)</translation> <translation>La lavatrice non e' collegata (spenta o senza rete)</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="584"/> <location filename="../src/thinqclient.cpp" line="528"/>
<source>The machine does not accept this command</source> <source>The machine does not accept this command</source>
<translation>La macchina non accetta questo comando</translation> <translation>La macchina non accetta questo comando</translation>
<translation>La macchina non accetta questo comando</translation> <translation>La macchina non accetta questo comando</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="586"/> <location filename="../src/thinqclient.cpp" line="530"/>
<source>LG error %1: %2</source> <source>LG error %1: %2</source>
<translation>Errore LG %1: %2</translation> <translation>Errore LG %1: %2</translation>
<translation>Errore LG %1: %2</translation> <translation>Errore LG %1: %2</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="588"/> <location filename="../src/thinqclient.cpp" line="532"/>
<source>No answer from the LG cloud: %1</source> <source>No answer from the LG cloud: %1</source>
<translation>Nessuna risposta dal cloud LG: %1</translation> <translation>Nessuna risposta dal cloud LG: %1</translation>
<translation>Nessuna risposta dal cloud LG: %1</translation> <translation>Nessuna risposta dal cloud LG: %1</translation>
</message> </message>
<message> <message>
<location filename="../src/thinqclient.cpp" line="590"/> <location filename="../src/thinqclient.cpp" line="534"/>
<source>The LG cloud refused the request (HTTP %1)</source> <source>The LG cloud refused the request (HTTP %1)</source>
<translation>Il cloud LG ha rifiutato la richiesta (HTTP %1)</translation> <translation>Il cloud LG ha rifiutato la richiesta (HTTP %1)</translation>
<translation>Il cloud LG ha rifiutato la richiesta (HTTP %1)</translation> <translation>Il cloud LG ha rifiutato la richiesta (HTTP %1)</translation>
@@ -496,6 +511,7 @@
<location filename="../qml/harbour-thinq.qml" line="28"/> <location filename="../qml/harbour-thinq.qml" line="28"/>
<source>Washing finished</source> <source>Washing finished</source>
<translation>Lavaggio finito</translation> <translation>Lavaggio finito</translation>
<translation>Lavaggio finito</translation>
</message> </message>
</context> </context>
</TS> </TS>