added first part of hiding live ranking

This commit is contained in:
2025-12-28 20:56:44 +01:00
parent 9e61e83d0c
commit 6933a4ceef
2 changed files with 20 additions and 3 deletions

View File

@@ -28,9 +28,16 @@ using std::vector;
WindowRace::WindowRace(DataBase * db, QWidget * parent) WindowRace::WindowRace(DataBase * db, QWidget * parent)
: QMainWindow(parent), ui(new Ui::WindowRace) { : QMainWindow(parent), ui(new Ui::WindowRace) {
ui->setupUi(this); ui->setupUi(this);
this->ui->pBNextRace->setEnabled(false); this->ui->pBNextRace->setEnabled(false);
this->finished = false; this->finished = false;
// should be read from db
this->enableLiveRanking = false;
if (!this->enableLiveRanking) {
this->ui->groupBox_15->hide();
}
this->wRennlisteSeted = false; this->wRennlisteSeted = false;
this->db = db; this->db = db;
@@ -177,7 +184,10 @@ WindowRace::WindowRace(DataBase * db, QWidget * parent)
tableRaces = db->getData(statement, 4); tableRaces = db->getData(statement, 4);
this->ui->lRound->setText("1/" + QString::number(tableRaces.size())); this->ui->lRound->setText("1/" + QString::number(tableRaces.size()));
// QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(close())); // QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(close()));
this->prepareLiveRanking();
if (this->enableLiveRanking) {
this->prepareLiveRanking();
}
} }
void WindowRace::prepareLiveRanking() { void WindowRace::prepareLiveRanking() {
@@ -613,7 +623,9 @@ void WindowRace::shellSlot(int time, int sector) {
ui->lWShellTime->scrollToBottom(); ui->lWShellTime->scrollToBottom();
ui->lWShellTime->horizontalHeader()->setSectionResizeMode( ui->lWShellTime->horizontalHeader()->setSectionResizeMode(
QHeaderView::Stretch); QHeaderView::Stretch);
this->updateLiveRanking(); if (this->enableLiveRanking) {
this->updateLiveRanking();
}
} }
void WindowRace::deaSlot(int time, int sector) { void WindowRace::deaSlot(int time, int sector) {
if (started && !paused && !this->finished) { if (started && !paused && !this->finished) {
@@ -727,7 +739,9 @@ void WindowRace::deaSlot(int time, int sector) {
ui->lWDeaTime->scrollToBottom(); ui->lWDeaTime->scrollToBottom();
ui->lWDeaTime->horizontalHeader()->setSectionResizeMode( ui->lWDeaTime->horizontalHeader()->setSectionResizeMode(
QHeaderView::Stretch); QHeaderView::Stretch);
this->updateLiveRanking(); if (this->enableLiveRanking) {
this->updateLiveRanking();
}
} }
long WindowRace::getMinimum(std::vector<long> a) { long WindowRace::getMinimum(std::vector<long> a) {

View File

@@ -49,6 +49,9 @@ class WindowRace : public QMainWindow {
QString getNameDriver(QString driverId); QString getNameDriver(QString driverId);
QStringListModel modelRanking; QStringListModel modelRanking;
// need database implementation
bool enableLiveRanking;
QStringList QSLRanking; QStringList QSLRanking;
// QStandardItemModel modelRanking; // QStandardItemModel modelRanking;
bool started; bool started;