0.7.5: il corpo JSON delle misure (AiraJson::layoutPayload)
send() prende QByteArray, non la mappa: la build l'ha detto subito.
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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);
|
||||
|
||||
+2
-1
@@ -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);
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
<message>
|
||||
<location filename="../src/apiclient.cpp" line="154"/>
|
||||
<location filename="../src/apiclient.cpp" line="267"/>
|
||||
<location filename="../src/apiclient.cpp" line="310"/>
|
||||
<location filename="../src/apiclient.cpp" line="322"/>
|
||||
<source>Set the bridge address and token</source>
|
||||
<translation>Configura indirizzo e token del bridge</translation>
|
||||
</message>
|
||||
@@ -196,7 +196,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/apiclient.cpp" line="275"/>
|
||||
<location filename="../src/apiclient.cpp" line="319"/>
|
||||
<location filename="../src/apiclient.cpp" line="331"/>
|
||||
<source>Bridge not configured</source>
|
||||
<translation>Bridge non configurato</translation>
|
||||
</message>
|
||||
@@ -206,12 +206,12 @@
|
||||
<translation>Timeout: statistiche non disponibili</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/apiclient.cpp" line="333"/>
|
||||
<location filename="../src/apiclient.cpp" line="345"/>
|
||||
<source>Timeout: command not sent</source>
|
||||
<translation>Timeout: comando non inviato</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/apiclient.cpp" line="340"/>
|
||||
<location filename="../src/apiclient.cpp" line="352"/>
|
||||
<source>Command sent</source>
|
||||
<translation>Comando inviato</translation>
|
||||
</message>
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
<message>
|
||||
<location filename="../src/apiclient.cpp" line="154"/>
|
||||
<location filename="../src/apiclient.cpp" line="267"/>
|
||||
<location filename="../src/apiclient.cpp" line="310"/>
|
||||
<location filename="../src/apiclient.cpp" line="322"/>
|
||||
<source>Set the bridge address and token</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -196,7 +196,7 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/apiclient.cpp" line="275"/>
|
||||
<location filename="../src/apiclient.cpp" line="319"/>
|
||||
<location filename="../src/apiclient.cpp" line="331"/>
|
||||
<source>Bridge not configured</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -206,12 +206,12 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/apiclient.cpp" line="333"/>
|
||||
<location filename="../src/apiclient.cpp" line="345"/>
|
||||
<source>Timeout: command not sent</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/apiclient.cpp" line="340"/>
|
||||
<location filename="../src/apiclient.cpp" line="352"/>
|
||||
<source>Command sent</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
Reference in New Issue
Block a user