Files
Rennbahn/windowrace.h

111 lines
2.6 KiB
C++

#ifndef WINDOWRACE_H
#define WINDOWRACE_H
#include "ampel.h"
#include "countdown.h"
#include "counter.h"
#include "database.h"
#include "hardwaresetup.h"
#include "timemodel.h"
#include "windowrennliste.h"
#include <QMainWindow>
#include <QMessageBox>
#include <QShortcut>
#include <memory>
#include <qchar.h>
#include <qlist.h>
#include <qstandarditemmodel.h>
#include <qvector.h>
#include <string>
#include <vector>
using std::string;
namespace Ui {
class WindowRace;
}
class WindowRace : public QMainWindow {
Q_OBJECT
public:
explicit WindowRace(DataBase * db, QWidget * parent = nullptr);
~WindowRace();
void setWindowRennliste(WindowRennliste * ptrInstance);
void setDriverAndCar(vector<QString> vec);
void setRoundCounter(uint currentRound, uint rounds);
void setDriverAndCarId(vector<QString> vec);
private:
int shellDriverId;
int deaDriverId;
int deaCarId;
int shellCarId;
void closeEvent(QCloseEvent * event);
void updateLiveRanking();
void prepareLiveRanking();
int getAvgDriver(QString driverId);
QString getNameDriver(QString driverId);
QStringListModel modelRanking;
// need database implementation
bool enableLiveRanking;
QStringList QSLRanking;
// QStandardItemModel modelRanking;
bool started;
std::unique_ptr<Countdown> countdown;
std::unique_ptr<HardwareSetup> Hardware;
Ui::WindowRace * ui;
Counter counterShell;
Counter counterDea;
bool firstTimeShell;
bool firstTimeDea;
QVector<QVector<int>> VecShell;
QVector<QVector<int>> VecDea;
std::unique_ptr<TimeModel> timeModelShell;
std::unique_ptr<TimeModel> timeModelDea;
long getMinimum(std::vector<long> a);
QString timeWrapper(long zahl);
long countdownValue; // in sec
std::unique_ptr<Ampel> startAmpelThread;
int ampelCounter;
bool paused;
DataBase * db;
bool finished;
WindowRennliste * wRennliste;
bool wRennlisteSeted;
int fahrzeit;
int renn_id;
int minimumTime;
QVector<int> minSecTime;
vector<QString> carIds;
vector<QString> driverIds;
vector<QString> lanes;
// sector top times
int theoreticalMinShell;
int deltaShell;
int theoreticalMinDea;
int deltaDea;
// shortcuts
std::shared_ptr<QShortcut> keyReturn;
public slots:
void stopClicked();
void prepareNextRace();
void breakCounter();
void countdownUpdate();
void go();
void ampelSlot();
void laufcheck();
void deaSlot(int, int);
void shellSlot(int, int);
void ReturnPress();
};
#endif // WINDOWRACE_H