X-Git-Url: https://www.flypig.org.uk/git/?p=harbour-pedalo.git;a=blobdiff_plain;f=src%2Fstatus.h;fp=src%2Fstatus.h;h=8b6b6659cde0813e47e826fb91fd4bb8cce9d553;hp=f0256e03f0a4ecf0ba8966e3d337d5d1023aee2a;hb=5fc520bad80dccf9bf2e0f16552c9f2605417067;hpb=c0284f613fd20fdedc5ef60de9893c74601ede6d diff --git a/src/status.h b/src/status.h index f0256e0..8b6b665 100644 --- a/src/status.h +++ b/src/status.h @@ -3,19 +3,30 @@ #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); + signals: void cyclingChanged(bool cycling); void startTimeChanged(quint64 startTime); @@ -27,6 +38,7 @@ public slots: private: bool cycling; quint64 startTime; + JourneyModel &journeymodel; }; #endif // STATUS_H