added second part of minimum sector times

This commit is contained in:
2017-09-12 17:17:31 +02:00
parent 75ba41283b
commit ee5db49e52
6 changed files with 55 additions and 20 deletions

View File

@@ -55,12 +55,20 @@ Training::Training(QWidget *parent, DataBase *db) :
QObject::connect(this->ui->pBResetDea, SIGNAL(clicked()), this, SLOT(ResetDea()));
QObject::connect(this->ui->pBResetShell, SIGNAL(clicked()), this, SLOT(ResetShell()));
// fill minSecTimes vector
statement = "select minsec1, minsec2, minsec3 from renndauer order by id DESC limit 1";
vector< vector< QString > > res;
res = db->getData(statement, 3);
this->minSecTime.append(res[0][0].toInt());
this->minSecTime.append(res[0][1].toInt());
this->minSecTime.append(res[0][2].toInt());
}
void Training::ResetShell(){
this->VecShell.clear();
// this->ui->lWShellTime->clear();
timeModelShell = new TimeModel(VecShell, this);
timeModelShell = new TimeModel(VecShell, minSecTime, this);
this->ui->lWShellTime->setModel(timeModelShell);
this->ui->lBestZeitShell->setText("");
@@ -71,7 +79,7 @@ void Training::ResetDea(){
this->VecDea.clear();
//this->ui->lWDeaTime->clear();
timeModelDea = new TimeModel(VecDea, this);
timeModelDea = new TimeModel(VecDea, minSecTime, this);
this->ui->lWDeaTime->setModel(timeModelDea);
this->ui->lBestZeitDea->setText("");
@@ -117,7 +125,7 @@ void Training::shellSlot(int time, int sector){
VecShell.push_back(QVector<int>());
VecShell.last().push_back(time);
timeModelShell = new TimeModel(VecShell, this);
timeModelShell = new TimeModel(VecShell, minSecTime, this);
this->ui->lWShellTime->setModel(timeModelShell);
break;
@@ -126,7 +134,7 @@ void Training::shellSlot(int time, int sector){
if(VecShell.last().size() == 1){
// cout << time << sector << endl;
VecShell.last().push_back(time);
timeModelShell = new TimeModel(VecShell, this);
timeModelShell = new TimeModel(VecShell, minSecTime, this);
this->ui->lWShellTime->setModel(timeModelShell);
}
}
@@ -141,7 +149,7 @@ void Training::shellSlot(int time, int sector){
// add sum to vector
VecShell.last().push_back(QVectorHelper::getCurTime(VecShell.last()));
timeModelShell = new TimeModel(VecShell, this);
timeModelShell = new TimeModel(VecShell, minSecTime, this);
this->ui->lWShellTime->setModel(timeModelShell);
}
// best time on widget
@@ -183,7 +191,7 @@ void Training::deaSlot(int time, int sector){
VecDea.push_back(QVector<int>());
VecDea.last().push_back(time);
// cout << "Dea Sektor 1" << endl;
timeModelDea = new TimeModel(VecDea, this);
timeModelDea = new TimeModel(VecDea, minSecTime, this);
this->ui->lWDeaTime->setModel(timeModelDea);
break;
@@ -192,7 +200,7 @@ void Training::deaSlot(int time, int sector){
if(VecDea.last().size() == 1){
// cout << time << sector << endl;
VecDea[VecDea.size()-1].push_back(time);
timeModelDea = new TimeModel(VecDea, this);
timeModelDea = new TimeModel(VecDea, minSecTime, this);
this->ui->lWDeaTime->setModel(timeModelDea);
}
else{
@@ -210,7 +218,7 @@ void Training::deaSlot(int time, int sector){
// add sum to vector
VecDea.last().push_back(QVectorHelper::getCurTime(VecDea.last()));
timeModelDea = new TimeModel(VecDea, this);
timeModelDea = new TimeModel(VecDea, minSecTime, this);
this->ui->lWDeaTime->setModel(timeModelDea);
}
// best time on widget