X-Git-Url: https://www.flypig.org.uk/git/?p=harbour-pedalo.git;a=blobdiff_plain;f=src%2Fstatus.h;h=58db7266bbe43a3b4314a36bc2fd72b30df8f46b;hp=f0256e03f0a4ecf0ba8966e3d337d5d1023aee2a;hb=54ab3ebfadf8cb258561a4641249da8c6469dc0f;hpb=371dcf3335b355f8d421352a394161dc6d9b9f24 diff --git a/src/status.h b/src/status.h index f0256e0..58db726 100644 --- a/src/status.h +++ b/src/status.h @@ -3,19 +3,31 @@ #include +#include "journeymodel.h" + class Status : public QObject { Q_OBJECT public: - explicit Status(QObject *parent = nullptr); + explicit Status(JourneyModel &journeymodel, QObject *parent = nullptr); Q_PROPERTY(bool cycling READ getCycling WRITE setCycling NOTIFY cyclingChanged) Q_PROPERTY(quint64 startTime READ getStartTime WRITE setStartTime NOTIFY startTimeChanged) + // Current journey bool getCycling() const; quint64 getStartTime() const; Q_INVOKABLE void startJourney(); Q_INVOKABLE quint64 getDuration() const; + // Statistics + Q_INVOKABLE quint64 getJourneyCount() const; + Q_INVOKABLE quint64 getTimeSpentCycling() const; + Q_INVOKABLE double getAverageDuration() const; + Q_INVOKABLE double getSpeedPercentile() const; + + Q_INVOKABLE static QString getFormattedTime(quint64 seconds, int min, int max); + + Q_INVOKABLE QList getGraphData(); signals: void cyclingChanged(bool cycling); void startTimeChanged(quint64 startTime); @@ -27,6 +39,7 @@ public slots: private: bool cycling; quint64 startTime; + JourneyModel &journeymodel; }; #endif // STATUS_H