diff --git a/src/airajson.cpp b/src/airajson.cpp index a3f9673..91857ab 100644 --- a/src/airajson.cpp +++ b/src/airajson.cpp @@ -292,6 +292,12 @@ QString stateLong(const QVariantMap &summary) return QCoreApplication::translate("AiraJson", "Relax: the heat pump is running smoothly."); } +QByteArray layoutPayload(const QVariantMap &info) +{ + return QJsonDocument(QJsonObject::fromVariantMap(info)) + .toJson(QJsonDocument::Compact); +} + int statusLevel(const QVariantMap &summary) { if (summary.isEmpty()) diff --git a/src/airajson.h b/src/airajson.h index c6d071c..5f7c6d1 100644 --- a/src/airajson.h +++ b/src/airajson.h @@ -64,6 +64,11 @@ QString monthLabel(const QString &yearMonth); QByteArray commandPayload(const QString &id, const QVariant &value, const QVariantMap &extra = QVariantMap()); +// Corpo JSON per POST /layout: le misure della Home come le manda il QML +// (versione, altezza dello schermo, del contenuto, e y/h/testo di ogni riga). +// Serve a correggere la disposizione leggendo i numeri veri del telefono. +QByteArray layoutPayload(const QVariantMap &info); + // Conto alla rovescia leggibile da secondi: 1800 -> "30:00", 65 -> "01:05", // 0 -> "00:00". Oltre l'ora i minuti continuano (240 min -> "240:00"). QString countdown(int seconds); diff --git a/src/apiclient.cpp b/src/apiclient.cpp index 4daef30..e3d0716 100644 --- a/src/apiclient.cpp +++ b/src/apiclient.cpp @@ -309,7 +309,8 @@ void ApiClient::refreshStats() // screenshot da interpretare a occhio. void ApiClient::reportLayout(const QVariantMap &info) { - QNetworkReply *reply = send("POST", QStringLiteral("/layout"), info, 5); + QNetworkReply *reply = send("POST", QStringLiteral("/layout"), + AiraJson::layoutPayload(info), 5); if (!reply) return; connect(reply, &QNetworkReply::finished, reply, &QObject::deleteLater); diff --git a/translations/harbour-aira-it.ts b/translations/harbour-aira-it.ts index 118f4f7..fb54bcc 100644 --- a/translations/harbour-aira-it.ts +++ b/translations/harbour-aira-it.ts @@ -159,7 +159,7 @@ - + Set the bridge address and token Configura indirizzo e token del bridge @@ -196,7 +196,7 @@ - + Bridge not configured Bridge non configurato @@ -206,12 +206,12 @@ Timeout: statistiche non disponibili - + Timeout: command not sent Timeout: comando non inviato - + Command sent Comando inviato diff --git a/translations/harbour-aira.ts b/translations/harbour-aira.ts index eeb4f31..4ab5e5a 100644 --- a/translations/harbour-aira.ts +++ b/translations/harbour-aira.ts @@ -159,7 +159,7 @@ - + Set the bridge address and token @@ -196,7 +196,7 @@ - + Bridge not configured @@ -206,12 +206,12 @@ - + Timeout: command not sent - + Command sent