Dorian Zedler
1e09ebe027
Summary: - cleaned some stuff up in qml - separated the timer and the main.qml and put it into "SpeedTimer.qml" - continued on implementing the base conn connection - started to get the whole time meassuring procedure out of qml and into c++ -> added new class (SpeedTimer) for that
47 lines
927 B
C++
47 lines
927 B
C++
#ifndef SPEEDTIMER_H
|
|
#define SPEEDTIMER_H
|
|
|
|
#include <QObject>
|
|
#include <QDateTime>
|
|
#include <QEventLoop>
|
|
#include <QTimer>
|
|
#include <QDebug>
|
|
|
|
class SpeedTimer : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit SpeedTimer(QObject *parent = nullptr);
|
|
|
|
enum timerState { IDLE, STARTING, RUNNING, STOPPED };
|
|
timerState state;
|
|
|
|
// variables for capturing the time
|
|
double startTime;
|
|
double stopTime;
|
|
double stoppedTime;
|
|
double reactionTime;
|
|
|
|
signals:
|
|
void stateChanged(timerState newState);
|
|
void startCanceled(bool falseStart);
|
|
|
|
public slots:
|
|
void start();
|
|
void stop(QString type);
|
|
void reset();
|
|
|
|
void setState(timerState newState);
|
|
QString getState();
|
|
double getCurrTime();
|
|
|
|
void handleStartpadTrigger();
|
|
void handleToppadTrigger();
|
|
|
|
void delay(int mSecs);
|
|
|
|
private:
|
|
QDateTime *date;
|
|
};
|
|
extern SpeedTimer * pGlobalSpeedTimer;
|
|
#endif // SPEEDTIMER_H
|