added measunring error recognition

This commit is contained in:
2014-09-26 22:26:26 +02:00
parent 87b0c093d6
commit 9219f20f39
3 changed files with 24 additions and 9 deletions

View File

@@ -124,6 +124,9 @@ void WindowRace::prepareNextRace(){
this->ui->lCurRoundTimeShell->setText("");
this->ui->lCurRoundDea->setText("");
this->VecShell.clear();
this->VecDea.clear();
this->finished = false;
this->paused = false;
@@ -230,6 +233,7 @@ void WindowRace::countdownUpdate(){
}
if(countdownValue <= -1){
this->finished = true;
this->wRennliste->setBesttime(getMinimum(this->VecShell),getMinimum(this->VecDea));
this->ui->pBNextRace->setEnabled(true);
}
else{
@@ -313,18 +317,22 @@ void WindowRace::deaSlot(){
}
long WindowRace::getMinimum(std::vector<long> a){
long minimum = a[0]; //could be wrong
long minimum = -1;
for(unsigned int i = 0; i < a.size(); i++){
if(a[i] < minimum && a[i] >= this->minimumTime){
minimum = a[i];
if(minimum < 0){
if(a[i] >= this->minimumTime){
minimum = a[i];
}
}
else{
if(a[i] < minimum && a[i] >= this->minimumTime){
minimum = a[i];
}
}
}
if(minimum >= this->minimumTime){
return minimum;
}
else{
return -1;
}
return minimum;
}
void WindowRace::ampelSlot(){
if(ampelCounter == 5){

View File

@@ -89,6 +89,12 @@ vector<QString> WindowRennliste::getDriverAndCarId(){
return this->tableData[this->selectedRow];
}
void WindowRennliste::setBesttime(int shell, int dea){
this->ui->tWRennliste->item(this->selectedRow, 2)->setText(QString::number(shell/1000.0));
this->ui->tWRennliste->item(this->selectedRow, 5)->setText(QString::number(dea/1000.0));
std::cout << this->selectedRow << std::endl;
}
void WindowRennliste::listClick(const QModelIndex & index){
QString driverShell = this->ui->tWRennliste->item(index.row(), 0)->text();

View File

@@ -26,6 +26,7 @@ public:
vector<QString> getDriverAndCarSettings();
vector<QString> getDriverAndCarId();
void sendIds();
void setBesttime(int shell, int dea);
private:
bool windowClose;
void closeEvent(QCloseEvent *event);