added windowtitle
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
<string>Rennmessung</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
||||
77
training.cpp
77
training.cpp
@@ -20,7 +20,7 @@ Training::Training(QWidget *parent, DataBase *db) :
|
||||
this->db = db;
|
||||
string statement = "select mindestrundendauer from renndauer where id like 1";
|
||||
|
||||
this->minTimeOneRound = this->db->getData(statement, 1)[0][0].toInt();
|
||||
this->minimumTime = this->db->getData(statement, 1)[0][0].toInt();
|
||||
this->finished = false;
|
||||
|
||||
firstTimeDea = true;
|
||||
@@ -38,6 +38,42 @@ Training::Training(QWidget *parent, DataBase *db) :
|
||||
|
||||
QShortcut *shortcut = new QShortcut(QKeySequence("Ctrl+Q"), this);
|
||||
QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(close()));
|
||||
QObject::connect(this->ui->pBReset, SIGNAL(clicked()), this, SLOT(Reset()));
|
||||
QObject::connect(this->ui->pBResetDea, SIGNAL(clicked()), this, SLOT(ResetDea()));
|
||||
QObject::connect(this->ui->pBResetShell, SIGNAL(clicked()), this, SLOT(ResetShell()));
|
||||
|
||||
}
|
||||
void Training::ResetShell(){
|
||||
this->VecShell.clear();
|
||||
|
||||
this->ui->lWShellTime->clear();
|
||||
|
||||
this->ui->lBestZeitShell->setText("∞");
|
||||
this->ui->lCurRoundTimeShell->setText("∞");
|
||||
this->firstTimeShell = true;
|
||||
}
|
||||
void Training::ResetDea(){
|
||||
this->VecDea.clear();
|
||||
|
||||
this->ui->lWDeaTime->clear();
|
||||
|
||||
this->ui->lBestZeitDea->setText("∞");
|
||||
|
||||
this->ui->lCurRoundDea->setText("∞");
|
||||
this->firstTimeDea = true;
|
||||
}
|
||||
void Training::Reset(){
|
||||
this->VecShell.clear();
|
||||
this->VecDea.clear();
|
||||
this->ui->lWDeaTime->clear();
|
||||
this->ui->lWShellTime->clear();
|
||||
|
||||
this->ui->lBestZeitDea->setText("∞");
|
||||
this->ui->lBestZeitShell->setText("∞");
|
||||
this->ui->lCurRoundTimeShell->setText("∞");
|
||||
this->ui->lCurRoundDea->setText("∞");
|
||||
this->firstTimeShell = true;
|
||||
this->firstTimeDea = true;
|
||||
}
|
||||
void Training::prepareNextRace(){
|
||||
this->firstTimeShell = true;
|
||||
@@ -70,10 +106,16 @@ void Training::shellSlot(){
|
||||
if(getMinimum(VecShell) == zeit && VecShell.size() > 1){
|
||||
item->setBackgroundColor(Qt::green);
|
||||
}
|
||||
if(zeit < this->minimumTime){
|
||||
item->setBackgroundColor(Qt::red);
|
||||
}
|
||||
item->setText(QString::number((double)zeit/1000));
|
||||
ui->lWShellTime->addItem(item);
|
||||
|
||||
ui->lWShellTime->scrollToBottom();
|
||||
if(getMinimum(VecShell) > 0){
|
||||
ui->lBestZeitShell->setText(QString::number((double)getMinimum(VecShell)/1000));
|
||||
}
|
||||
ui->lCurRoundTimeShell->setText(QString::number((double)zeit/1000));
|
||||
}
|
||||
}
|
||||
@@ -89,6 +131,7 @@ void Training::deaSlot(){
|
||||
counterDea.start();
|
||||
}
|
||||
else{
|
||||
/*
|
||||
long zeit = counterDea.getTime();
|
||||
VecDea.push_back(zeit);
|
||||
QListWidgetItem *item = new QListWidgetItem;
|
||||
@@ -97,20 +140,48 @@ void Training::deaSlot(){
|
||||
}
|
||||
item->setText(QString::number((double)zeit/1000));
|
||||
ui->lWDeaTime->addItem(item);
|
||||
ui->lWDeaTime->scrollToBottom();
|
||||
|
||||
ui->lBestZeitDea->setText(QString::number((double)getMinimum(VecDea)/1000));
|
||||
ui->lCurRoundDea->setText(QString::number((double)zeit/1000));
|
||||
*/
|
||||
//
|
||||
long zeit = counterDea.getTime();
|
||||
VecDea.push_back(zeit);
|
||||
QListWidgetItem *item = new QListWidgetItem;
|
||||
if(getMinimum(VecDea) == zeit && VecDea.size() > 1){
|
||||
item->setBackgroundColor(Qt::green);
|
||||
}
|
||||
if(zeit < this->minimumTime){
|
||||
item->setBackgroundColor(Qt::red);
|
||||
}
|
||||
item->setText(QString::number((double)zeit/1000));
|
||||
ui->lWDeaTime->addItem(item);
|
||||
|
||||
ui->lWDeaTime->scrollToBottom();
|
||||
if(getMinimum(VecDea) > 0){
|
||||
ui->lBestZeitDea->setText(QString::number((double)getMinimum(VecDea)/1000));
|
||||
}
|
||||
ui->lCurRoundDea->setText(QString::number((double)zeit/1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long Training::getMinimum(std::vector<long> a){
|
||||
long minimum = a[0];
|
||||
long minimum = -1;
|
||||
for(unsigned int i = 0; i < a.size(); i++){
|
||||
if(a[i] < minimum){
|
||||
if(minimum < 0){
|
||||
if(a[i] >= this->minimumTime){
|
||||
minimum = a[i];
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(a[i] < minimum && a[i] >= this->minimumTime){
|
||||
minimum = a[i];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return minimum;
|
||||
}
|
||||
Training::~Training()
|
||||
|
||||
@@ -38,7 +38,12 @@ private:
|
||||
Counter counterDea;
|
||||
DataBase *db;
|
||||
long minTimeOneRound;
|
||||
int minimumTime;
|
||||
|
||||
public slots:
|
||||
void ResetShell();
|
||||
void ResetDea();
|
||||
void Reset();
|
||||
void deaSlot();
|
||||
void shellSlot();
|
||||
|
||||
|
||||
27
training.ui
27
training.ui
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
<string>Training</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_18">
|
||||
@@ -217,6 +217,31 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pBResetShell">
|
||||
<property name="text">
|
||||
<string>Reset Shell</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pBReset">
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pBResetDea">
|
||||
<property name="text">
|
||||
<string>Reset Dea</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
|
||||
@@ -341,7 +341,6 @@ long WindowRace::getMinimum(std::vector<long> a){
|
||||
|
||||
}
|
||||
return minimum;
|
||||
|
||||
}
|
||||
void WindowRace::ampelSlot(){
|
||||
if(ampelCounter == 5){
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
<string>Rennliste</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
<string>Einstellungen</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
||||
Reference in New Issue
Block a user