0.5.0: riordino come l'app ufficiale (home, Dati, Impianto)
- home: temperatura esterna e in casa/assente in alto, messaggio di stato, scheda impianto con temperatura stanza e acqua calda; comandi sotto - pagina Dati: calore prodotto, elettricita' usata, COP acqua calda e riscaldamento, risparmio, CO2 evitata, Smart Tariff Control (mese per mese) - pagina Impianto: stato, termostato a parete, versioni software, errori - bridge 0.4.0: rotta /stats (servizio statistiche del cloud) e blocco dispositivo in /summary (ID breve, versioni, termostato) - C++: parseStats, formatNumber, formatMoney, monthLabel (separatore e valuta secondo la lingua); 61/61 verifiche del nucleo - anteprime aggiornate (dati, impianto) in inglese e italiano
This commit is contained in:
@@ -21,6 +21,9 @@ class ApiClient : public QObject
|
||||
// le property dell'ApplicationWindow NON sono visibili alle pagine dello
|
||||
// pageStack, quindi la dashboard e la copertina non potrebbero condividerle.
|
||||
Q_PROPERTY(QVariantMap summary READ summary NOTIFY summaryChanged)
|
||||
// Statistiche della pagina "Dati" (calore, elettricita', COP, risparmi).
|
||||
// Separata dal riassunto: e' una chiamata piu' lenta, con cache lato bridge.
|
||||
Q_PROPERTY(QVariantMap stats READ stats NOTIFY statsChanged)
|
||||
|
||||
public:
|
||||
explicit ApiClient(Settings *settings, QObject *parent = 0);
|
||||
@@ -28,10 +31,14 @@ public:
|
||||
bool busy() const { return m_busy; }
|
||||
bool configured() const;
|
||||
QVariantMap summary() const { return m_summary; }
|
||||
QVariantMap stats() const { return m_stats; }
|
||||
|
||||
// Scarica il riassunto e lo emette con summaryChanged().
|
||||
Q_INVOKABLE void refresh();
|
||||
|
||||
// Scarica le statistiche (GET /stats) e le emette con statsChanged().
|
||||
Q_INVOKABLE void refreshStats();
|
||||
|
||||
// Prova GET /health (non richiede token) e risponde con connectionTested().
|
||||
Q_INVOKABLE void testConnection();
|
||||
|
||||
@@ -42,11 +49,16 @@ public:
|
||||
// tests/core_test.cpp), niente duplicazione di logica nel QML.
|
||||
Q_INVOKABLE QString modeLabel(const QString &operatingStatus) const;
|
||||
Q_INVOKABLE QString formatValue(const QVariant &value) const;
|
||||
Q_INVOKABLE QString formatNumber(const QVariant &value, int decimals) const;
|
||||
Q_INVOKABLE QString formatMoney(const QVariant &value, const QString ¤cyCode) const;
|
||||
Q_INVOKABLE QString monthLabel(const QString &yearMonth) const;
|
||||
|
||||
signals:
|
||||
void busyChanged();
|
||||
void configuredChanged();
|
||||
void summaryChanged(const QVariantMap &summary);
|
||||
void statsChanged(const QVariantMap &stats);
|
||||
void statsRefreshed(bool ok, const QString &message);
|
||||
void commandFinished(bool ok, const QString &message);
|
||||
void connectionTested(bool ok, const QString &message);
|
||||
void errorOccurred(const QString &message);
|
||||
@@ -61,6 +73,7 @@ private:
|
||||
QNetworkAccessManager m_nam;
|
||||
bool m_busy;
|
||||
QVariantMap m_summary;
|
||||
QVariantMap m_stats;
|
||||
};
|
||||
|
||||
#endif // APICLIENT_H
|
||||
|
||||
Reference in New Issue
Block a user