Add graph animation; support for line graphs
[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 Q_INVOKABLE QList<float> getGraphData();
31 signals:
32 void cyclingChanged(bool cycling);
33 void startTimeChanged(quint64 startTime);
34
35 public slots:
36 void setCycling(bool value);
37 void setStartTime(quint64 value);
38
39 private:
40 bool cycling;
41 quint64 startTime;
42 JourneyModel &journeymodel;
43 };
44
45 #endif // STATUS_H