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

@@ -16,7 +16,7 @@ using std::endl;
using std::string;
using std::vector;
Training::Training(QWidget * parent, std::shared_ptr<DataBase> db)
Training::Training(QWidget * parent, DataBase * db)
: QMainWindow(parent), ui(new Ui::Training) {
ui->setupUi(this);
this->db = db;
@@ -93,7 +93,7 @@ void Training::ResetShell() {
this->VecShell.clear();
// this->ui->lWShellTime->clear();
timeModelShell = std::make_shared<TimeModel>(VecShell, minSecTime, this);
timeModelShell = std::make_unique<TimeModel>(VecShell, minSecTime, this);
this->ui->lWShellTime->setModel(timeModelShell.get());
this->ui->lBestZeitShell->setText("");
@@ -111,7 +111,7 @@ void Training::ResetDea() {
this->VecDea.clear();
// this->ui->lWDeaTime->clear();
timeModelDea = std::make_shared<TimeModel>(VecDea, minSecTime, this);
timeModelDea = std::make_unique<TimeModel>(VecDea, minSecTime, this);
this->ui->lWDeaTime->setModel(timeModelDea.get());
this->ui->lBestZeitDea->setText("");
@@ -175,7 +175,7 @@ void Training::shellSlot(int time, int sector) {
VecShell.last().push_back(time);
timeModelShell =
std::make_shared<TimeModel>(VecShell, minSecTime, this);
std::make_unique<TimeModel>(VecShell, minSecTime, this);
this->ui->lWShellTime->setModel(timeModelShell.get());
this->ui->lBridgeShellTop->setText(QString::number(
@@ -189,7 +189,7 @@ void Training::shellSlot(int time, int sector) {
// cout << time << sector <<
// endl;
VecShell.last().push_back(time);
timeModelShell = std::make_shared<TimeModel>(
timeModelShell = std::make_unique<TimeModel>(
VecShell, minSecTime, this);
this->ui->lWShellTime->setModel(timeModelShell.get());
}
@@ -211,7 +211,7 @@ void Training::shellSlot(int time, int sector) {
VecShell.last().push_back(
QVectorHelper::getCurTime(VecShell.last()));
timeModelShell = std::make_shared<TimeModel>(
timeModelShell = std::make_unique<TimeModel>(
VecShell, minSecTime, this);
this->ui->lWShellTime->setModel(timeModelShell.get());
}
@@ -281,7 +281,7 @@ void Training::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->lBridgeDeaTop->setText(QString::number(
static_cast<double>(QVectorHelper::getMinSec1(VecDea)) /
@@ -293,7 +293,7 @@ void Training::deaSlot(int time, int sector) {
// 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());
}
@@ -317,7 +317,7 @@ void Training::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());
}