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
+17 -9
View File
@@ -124,6 +124,9 @@ void WindowRace::prepareNextRace(){
this->ui->lCurRoundTimeShell->setText(""); this->ui->lCurRoundTimeShell->setText("");
this->ui->lCurRoundDea->setText(""); this->ui->lCurRoundDea->setText("");
this->VecShell.clear();
this->VecDea.clear();
this->finished = false; this->finished = false;
this->paused = false; this->paused = false;
@@ -230,6 +233,7 @@ void WindowRace::countdownUpdate(){
} }
if(countdownValue <= -1){ if(countdownValue <= -1){
this->finished = true; this->finished = true;
this->wRennliste->setBesttime(getMinimum(this->VecShell),getMinimum(this->VecDea));
this->ui->pBNextRace->setEnabled(true); this->ui->pBNextRace->setEnabled(true);
} }
else{ else{
@@ -313,18 +317,22 @@ void WindowRace::deaSlot(){
} }
long WindowRace::getMinimum(std::vector<long> a){ 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++){ for(unsigned int i = 0; i < a.size(); i++){
if(a[i] < minimum && a[i] >= this->minimumTime){ if(minimum < 0){
minimum = a[i]; 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;
return minimum;
}
else{
return -1;
}
} }
void WindowRace::ampelSlot(){ void WindowRace::ampelSlot(){
if(ampelCounter == 5){ if(ampelCounter == 5){
+6
View File
@@ -89,6 +89,12 @@ vector<QString> WindowRennliste::getDriverAndCarId(){
return this->tableData[this->selectedRow]; 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){ void WindowRennliste::listClick(const QModelIndex & index){
QString driverShell = this->ui->tWRennliste->item(index.row(), 0)->text(); QString driverShell = this->ui->tWRennliste->item(index.row(), 0)->text();
+1
View File
@@ -26,6 +26,7 @@ public:
vector<QString> getDriverAndCarSettings(); vector<QString> getDriverAndCarSettings();
vector<QString> getDriverAndCarId(); vector<QString> getDriverAndCarId();
void sendIds(); void sendIds();
void setBesttime(int shell, int dea);
private: private:
bool windowClose; bool windowClose;
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);