added ui tweaks in traing mode for shell track
This commit is contained in:
@@ -13,6 +13,77 @@ int QVectorHelper::getCurTime(const QVector<int> x) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int QVectorHelper::getMinSec1(const QVector<QVector<int>> x) {
|
||||||
|
int min;
|
||||||
|
if (x.size() > 0) {
|
||||||
|
if (x.at(0).size() >= 3) {
|
||||||
|
min = getCurTime(x.at(0));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 9999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i < x.size(); i++) {
|
||||||
|
if(x.at(i).size() >= 1){
|
||||||
|
if (x.at(i).at(0) < min) {
|
||||||
|
min = x.at(i).at(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
int QVectorHelper::getMinSec2(const QVector<QVector<int>> x) {
|
||||||
|
int min;
|
||||||
|
if (x.size() > 0) {
|
||||||
|
if (x.at(0).size() >= 3) {
|
||||||
|
min = getCurTime(x.at(1));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 9999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i < x.size(); i++) {
|
||||||
|
if (x.at(0).size() >= 2) {
|
||||||
|
if (x.at(i).at(1) < min) {
|
||||||
|
min = x.at(i).at(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
int QVectorHelper::getMinSec3(const QVector<QVector<int>> x) {
|
||||||
|
int min;
|
||||||
|
if (x.size() > 0) {
|
||||||
|
if (x.at(0).size() >= 3) {
|
||||||
|
min = getCurTime(x.at(2));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 9999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i < x.size(); i++) {
|
||||||
|
if(x.at(i).size() >= 3){
|
||||||
|
if (x.at(i).at(2) < min) {
|
||||||
|
min = x.at(i).at(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
int QVectorHelper::getMin(const QVector<QVector<int>> x) {
|
int QVectorHelper::getMin(const QVector<QVector<int>> x) {
|
||||||
int min;
|
int min;
|
||||||
if (x.size() > 0) {
|
if (x.size() > 0) {
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
#define QVECTORHELPER_H
|
#define QVECTORHELPER_H
|
||||||
#include <qvector.h>
|
#include <qvector.h>
|
||||||
|
|
||||||
class QVectorHelper
|
class QVectorHelper {
|
||||||
{
|
public:
|
||||||
public:
|
|
||||||
QVectorHelper();
|
QVectorHelper();
|
||||||
static int getCurTime(const QVector<int> x);
|
static int getCurTime(const QVector<int> x);
|
||||||
static int getMin(const QVector<QVector<int>> x);
|
static int getMin(const QVector<QVector<int>> x);
|
||||||
|
static int getMinSec1(const QVector<QVector<int>> x);
|
||||||
|
static int getMinSec2(const QVector<QVector<int>> x);
|
||||||
|
static int getMinSec3(const QVector<QVector<int>> x);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QVECTORHELPER_H
|
#endif // QVECTORHELPER_H
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ QVariant TimeModel::headerData(int section, Qt::Orientation orientation,
|
|||||||
if (orientation == Qt::Horizontal) {
|
if (orientation == Qt::Horizontal) {
|
||||||
switch (section) {
|
switch (section) {
|
||||||
case 0:
|
case 0:
|
||||||
return QString("Sektor 1");
|
return QString("Brücke");
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
return QString("Sektor 2");
|
return QString("Gerade");
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
return QString("Sektor 3");
|
return QString("Kruven");
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
return QString("Runde");
|
return QString("Runde");
|
||||||
|
|||||||
18
training.cpp
18
training.cpp
@@ -129,6 +129,18 @@ void Training::shellSlot(int time, int sector) {
|
|||||||
timeModelShell = new TimeModel(VecShell, minSecTime, this);
|
timeModelShell = new TimeModel(VecShell, minSecTime, this);
|
||||||
this->ui->lWShellTime->setModel(timeModelShell);
|
this->ui->lWShellTime->setModel(timeModelShell);
|
||||||
|
|
||||||
|
this->ui->lbridgeShellTop->setText(QString::number(
|
||||||
|
(double)QVectorHelper::getMinSec1(VecShell) / 1000));
|
||||||
|
|
||||||
|
theoreticalMinShell = 9999;
|
||||||
|
theoreticalMinShell = QVectorHelper::getMinSec1(VecShell) +
|
||||||
|
QVectorHelper::getMinSec2(VecShell) +
|
||||||
|
QVectorHelper::getMinSec3(VecShell);
|
||||||
|
deltaShell =
|
||||||
|
QVectorHelper::getMin(VecShell) - theoreticalMinShell;
|
||||||
|
this->ui->lDeltaTopTimeShell->setText(
|
||||||
|
QString::number((double)deltaShell / 1000));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (VecShell.size() > 0) {
|
if (VecShell.size() > 0) {
|
||||||
@@ -141,6 +153,9 @@ void Training::shellSlot(int time, int sector) {
|
|||||||
this->ui->lWShellTime->setModel(timeModelShell);
|
this->ui->lWShellTime->setModel(timeModelShell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->ui->lbridgeShellTop->setText(QString::number(
|
||||||
|
(double)QVectorHelper::getMinSec2(VecShell) / 1000));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (VecShell.size() > 0) {
|
if (VecShell.size() > 0) {
|
||||||
@@ -170,6 +185,9 @@ void Training::shellSlot(int time, int sector) {
|
|||||||
1000));
|
1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->ui->lbridgeShellTop->setText(QString::number(
|
||||||
|
(double)QVectorHelper::getMinSec3(VecShell) / 1000));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ui->lWShellTime->scrollToBottom();
|
ui->lWShellTime->scrollToBottom();
|
||||||
|
|||||||
35
training.h
35
training.h
@@ -1,33 +1,32 @@
|
|||||||
#ifndef TRAINING_H
|
#ifndef TRAINING_H
|
||||||
#define TRAINING_H
|
#define TRAINING_H
|
||||||
#include "hardwaresetup.h"
|
|
||||||
#include <vector>
|
|
||||||
#include <string>
|
|
||||||
#include "counter.h"
|
#include "counter.h"
|
||||||
#include <QMainWindow>
|
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
|
#include "hardwaresetup.h"
|
||||||
#include "timemodel.h"
|
#include "timemodel.h"
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Training;
|
class Training;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Training : public QMainWindow
|
class Training : public QMainWindow {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Training(QWidget *parent, DataBase *db);
|
explicit Training(QWidget * parent, DataBase * db);
|
||||||
~Training();
|
~Training();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void prepareNextRace();
|
void prepareNextRace();
|
||||||
|
|
||||||
Ui::Training *ui;
|
Ui::Training * ui;
|
||||||
|
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent * event);
|
||||||
bool started;
|
bool started;
|
||||||
HardwareSetup *Hardware;
|
HardwareSetup * Hardware;
|
||||||
bool firstTimeShell;
|
bool firstTimeShell;
|
||||||
bool firstTimeDea;
|
bool firstTimeDea;
|
||||||
QVector<QVector<int>> VecShell;
|
QVector<QVector<int>> VecShell;
|
||||||
@@ -38,22 +37,24 @@ private:
|
|||||||
bool finished;
|
bool finished;
|
||||||
Counter counterShell;
|
Counter counterShell;
|
||||||
Counter counterDea;
|
Counter counterDea;
|
||||||
DataBase *db;
|
DataBase * db;
|
||||||
long minTimeOneRound;
|
long minTimeOneRound;
|
||||||
int minimumTime;
|
int minimumTime;
|
||||||
|
|
||||||
|
int theoreticalMinShell;
|
||||||
|
int deltaShell;
|
||||||
|
|
||||||
// timeModel
|
// timeModel
|
||||||
TimeModel *timeModelDea;
|
TimeModel * timeModelDea;
|
||||||
TimeModel *timeModelShell;
|
TimeModel * timeModelShell;
|
||||||
QVector<int> minSecTime;
|
QVector<int> minSecTime;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ResetShell();
|
void ResetShell();
|
||||||
void ResetDea();
|
void ResetDea();
|
||||||
void Reset();
|
void Reset();
|
||||||
void deaSlot(int time, int sector);
|
void deaSlot(int time, int sector);
|
||||||
void shellSlot(int time, int sector);
|
void shellSlot(int time, int sector);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRAINING_H
|
#endif // TRAINING_H
|
||||||
|
|||||||
146
training.ui
146
training.ui
@@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>907</width>
|
||||||
<height>600</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0">
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@@ -90,6 +90,78 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_7">
|
||||||
|
<property name="title">
|
||||||
|
<string>Brücke</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lbridgeShellTop">
|
||||||
|
<property name="text">
|
||||||
|
<string>∞</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_6">
|
||||||
|
<property name="title">
|
||||||
|
<string>Gerade</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lStraightShellTop">
|
||||||
|
<property name="text">
|
||||||
|
<string>∞</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_8">
|
||||||
|
<property name="title">
|
||||||
|
<string>Kurven</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lCurvesShellTop">
|
||||||
|
<property name="text">
|
||||||
|
<string>∞</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
|
<property name="title">
|
||||||
|
<string>Delta Topzeit</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_17">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lDeltaTopTimeShell">
|
||||||
|
<property name="text">
|
||||||
|
<string>∞</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -198,6 +270,74 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="lbridgeDeaTop">
|
||||||
|
<property name="title">
|
||||||
|
<string>Brücke</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_19">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>∞</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_11">
|
||||||
|
<property name="title">
|
||||||
|
<string>Gerade</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_20">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lStraightDeaTop">
|
||||||
|
<property name="text">
|
||||||
|
<string>∞</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_10">
|
||||||
|
<property name="title">
|
||||||
|
<string>Kurven</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_21">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lCurvesDeaTop">
|
||||||
|
<property name="text">
|
||||||
|
<string>∞</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_9">
|
||||||
|
<property name="title">
|
||||||
|
<string>Delta Topzeit</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_22">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lDeltaTopTimeDea">
|
||||||
|
<property name="text">
|
||||||
|
<string>∞</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -249,7 +389,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>907</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user