Display overall statistics
[harbour-pedalo.git] / src / status.h
index f0256e0..8b6b665 100644 (file)
@@ -3,19 +3,30 @@
 
 #include <QObject>
 
+#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