Add images to buttons on main page
[harbour-pedalo.git] / src / status.h
1 #ifndef STATUS_H
2 #define STATUS_H
3
4 #include <QObject>
5
6 #include "journeymodel.h"
7
8 class Status : public QObject
9 {
10 Q_OBJECT
11 public:
12 explicit Status(JourneyModel &journeymodel, QObject *parent = nullptr);
13 Q_PROPERTY(bool cycling READ getCycling WRITE setCycling NOTIFY cyclingChanged)
14 Q_PROPERTY(quint64 startTime READ getStartTime WRITE setStartTime NOTIFY startTimeChanged)
15
16 // Current journey
17 bool getCycling() const;
18 quint64 getStartTime() const;
19 Q_INVOKABLE void startJourney();
20 Q_INVOKABLE quint64 getDuration() const;
21
22 // Statistics
23 Q_INVOKABLE quint64 getJourneyCount() const;
24 Q_INVOKABLE quint64 getTimeSpentCycling() const;
25 Q_INVOKABLE double getAverageDuration() const;
26 Q_INVOKABLE double getSpeedPercentile() const;
27
28 Q_INVOKABLE static QString getFormattedTime(quint64 seconds, int min, int max);
29
30 signals:
31 void cyclingChanged(bool cycling);
32 void startTimeChanged(quint64 startTime);
33
34 public slots:
35 void setCycling(bool value);
36 void setStartTime(quint64 value);
37
38 private:
39 bool cycling;
40 quint64 startTime;
41 JourneyModel &journeymodel;
42 };
43
44 #endif // STATUS_H