changed serial reading from lowlevel to boost with hope for more stability, changed a lot of smart pointers to unique_ptr, added fmt for logging

This commit is contained in:
2019-01-06 14:57:27 +01:00
parent bc27278ffb
commit 58f44dc957
21 changed files with 281 additions and 173 deletions

View File

@@ -15,7 +15,7 @@ using std::endl;
using std::string;
using std::vector;
WindowRace::WindowRace(std::shared_ptr<DataBase> db, QWidget * parent)
WindowRace::WindowRace(DataBase * db, QWidget * parent)
: QMainWindow(parent), ui(new Ui::WindowRace) {
ui->setupUi(this);
this->ui->pBNextRace->setEnabled(false);
@@ -55,16 +55,16 @@ WindowRace::WindowRace(std::shared_ptr<DataBase> db, QWidget * parent)
firstTimeShell = true;
started = false;
countdownValue = this->fahrzeit;
countdown = std::make_shared<Countdown>();
countdown = std::make_unique<Countdown>();
startAmpelThread = std::make_shared<Ampel>();
startAmpelThread = std::make_unique<Ampel>();
ampelCounter = 0;
ui->pBStart->setFocus();
paused = false;
Hardware = std::make_shared<HardwareSetup>();
Hardware = std::make_unique<HardwareSetup>();
Hardware->start();
QObject::connect(Hardware.get(), SIGNAL(Dea(int, int)), this,
@@ -211,11 +211,11 @@ void WindowRace::prepareNextRace() {
this->VecDea.clear();
// clear tableview shell
timeModelShell = std::make_shared<TimeModel>(VecShell, minSecTime);
timeModelShell = std::make_unique<TimeModel>(VecShell, minSecTime);
ui->lWShellTime->setModel(timeModelShell.get());
// clear tableview dea
timeModelDea = std::make_shared<TimeModel>(VecDea, minSecTime);
timeModelDea = std::make_unique<TimeModel>(VecDea, minSecTime);
ui->lWDeaTime->setModel(timeModelDea.get());
this->finished = false;
@@ -265,13 +265,12 @@ void WindowRace::stopClicked() {
this->prepareNextRace();
}
void WindowRace::setWindowRennliste(
std::shared_ptr<WindowRennliste> ptrInstance) {
void WindowRace::setWindowRennliste(WindowRennliste * ptrInstance) {
this->wRennliste = ptrInstance;
this->wRennlisteSeted = true;
QObject::connect(this->ui->pBNextRace, SIGNAL(clicked()),
this->wRennliste.get(), SLOT(changeSelection()));
QObject::connect(this->ui->pBNextRace, SIGNAL(clicked()), this->wRennliste,
SLOT(changeSelection()));
}
void WindowRace::setDriverAndCarId(vector<QString> vec) {
this->shellDriverId = vec.at(0).toInt();
@@ -384,7 +383,7 @@ void WindowRace::shellSlot(int time, int sector) {
test.append(1);
test.append(2);
test.append(3);
this->timeModelShell = std::make_shared<TimeModel>(
this->timeModelShell = std::make_unique<TimeModel>(
VecShell, minSecTime, test, this);
// this->ui->lWShellTime->setModel(this->timeModelShell);
ui->lWShellTime->setModel(this->timeModelShell.get());
@@ -404,7 +403,7 @@ void WindowRace::shellSlot(int time, int sector) {
test.append(1);
test.append(2);
test.append(3);
this->timeModelShell = std::make_shared<TimeModel>(
this->timeModelShell = std::make_unique<TimeModel>(
VecShell, minSecTime, test, this);
// timeModelShell = new
// TimeModel(VecShell, this);
@@ -439,7 +438,7 @@ void WindowRace::shellSlot(int time, int sector) {
test.append(1);
test.append(2);
test.append(3);
this->timeModelShell = std::make_shared<TimeModel>(
this->timeModelShell = std::make_unique<TimeModel>(
VecShell, minSecTime, test, this);
// timeModelShell = new
// TimeModel(VecShell, this);
@@ -507,7 +506,7 @@ void WindowRace::deaSlot(int time, int sector) {
VecDea.last().push_back(time);
cout << "Dea Sektor 1" << endl;
timeModelDea =
std::make_shared<TimeModel>(VecDea, minSecTime, this);
std::make_unique<TimeModel>(VecDea, minSecTime, this);
this->ui->lWDeaTime->setModel(timeModelDea.get());
this->ui->lBridgeDea->setText(QString::number(
@@ -520,7 +519,7 @@ void WindowRace::deaSlot(int time, int sector) {
if (VecDea.last().size() == 1) {
cout << time << sector << endl;
VecDea[VecDea.size() - 1].push_back(time);
timeModelDea = std::make_shared<TimeModel>(
timeModelDea = std::make_unique<TimeModel>(
VecDea, minSecTime, this);
this->ui->lWDeaTime->setModel(timeModelDea.get());
this->ui->lStraightDea->setText(QString::number(
@@ -545,7 +544,7 @@ void WindowRace::deaSlot(int time, int sector) {
VecDea.last().push_back(
QVectorHelper::getCurTime(VecDea.last()));
timeModelDea = std::make_shared<TimeModel>(
timeModelDea = std::make_unique<TimeModel>(
VecDea, minSecTime, this);
this->ui->lWDeaTime->setModel(timeModelDea.get());
}