Disabling the progress status bar if more biddings are placed than expected. (Easy way to indicate a problem in the GUI).

This commit is contained in:
2026-02-17 09:05:45 +01:00
parent c38bacc387
commit bfb8e43c34
2 changed files with 30 additions and 16 deletions

View File

@ -12,33 +12,45 @@ BiddingRoundProgressLayout::BiddingRoundProgressLayout(const int nCurrentBidding
QLabel* nBidsText = new QLabel("Abgegeben:"); QLabel* nBidsText = new QLabel("Abgegeben:");
addWidget(nBidsText); addWidget(nBidsText);
m_nBiddings1Label = new QLabel(QString::number(m_nCurrentBiddings)); m_nBiddingsLabel = new QLabel(QString::number(m_nCurrentBiddings));
addWidget(m_nBiddings1Label); addWidget(m_nBiddingsLabel);
QLabel* nExpectedText = new QLabel("Erwartet:"); QLabel* nExpectedText = new QLabel("Erwartet:");
addWidget(nExpectedText); addWidget(nExpectedText);
m_nExpectedBidding1Label = new QLabel(QString::number(m_nExpectedBiddings)); m_nExpectedBiddingLabel = new QLabel(QString::number(m_nExpectedBiddings));
addWidget(m_nExpectedBidding1Label); addWidget(m_nExpectedBiddingLabel);
m_biddingRound1ProgressBar = new QProgressBar(parent); m_biddingRoundProgressBar = new QProgressBar(parent);
m_biddingRound1ProgressBar->setMinimum(0); m_biddingRoundProgressBar->setMinimum(0);
m_biddingRound1ProgressBar->setMaximum(m_nExpectedBiddings); m_biddingRoundProgressBar->setMaximum(m_nExpectedBiddings);
m_biddingRound1ProgressBar->setValue(m_nCurrentBiddings); m_biddingRoundProgressBar->setValue(m_nCurrentBiddings);
addWidget(m_biddingRound1ProgressBar); addWidget(m_biddingRoundProgressBar);
updateEnabledStatus();
} }
void BiddingRoundProgressLayout::setCurrentBiddings(const int value) { void BiddingRoundProgressLayout::setCurrentBiddings(const int value) {
m_nCurrentBiddings = value; m_nCurrentBiddings = value;
const QString bidCountString = QString::number(value); const QString bidCountString = QString::number(value);
m_nBiddings1Label->setText(bidCountString); m_nBiddingsLabel->setText(bidCountString);
m_biddingRound1ProgressBar->setValue(value); m_biddingRoundProgressBar->setValue(value);
updateEnabledStatus();
} }
void BiddingRoundProgressLayout::setExpectedBiddings(const int value) { void BiddingRoundProgressLayout::setExpectedBiddings(const int value) {
m_nExpectedBiddings = value; m_nExpectedBiddings = value;
const QString expectedBiddingsString = QString::number(value); const QString expectedBiddingsString = QString::number(value);
m_nExpectedBidding1Label->setText(expectedBiddingsString); m_nExpectedBiddingLabel->setText(expectedBiddingsString);
m_biddingRound1ProgressBar->setMaximum(value); m_biddingRoundProgressBar->setMaximum(value);
updateEnabledStatus();
}
void BiddingRoundProgressLayout::updateEnabledStatus() {
if (m_nCurrentBiddings > m_nExpectedBiddings) {
m_biddingRoundProgressBar->setEnabled(false);
} else {
m_biddingRoundProgressBar->setEnabled(true);
}
} }

View File

@ -20,9 +20,11 @@ class BiddingRoundProgressLayout : public QHBoxLayout {
int m_nCurrentBiddings; int m_nCurrentBiddings;
int m_nExpectedBiddings; int m_nExpectedBiddings;
QLabel* m_nBiddings1Label = nullptr; QLabel* m_nBiddingsLabel = nullptr;
QLabel* m_nExpectedBidding1Label = nullptr; QLabel* m_nExpectedBiddingLabel = nullptr;
QProgressBar* m_biddingRound1ProgressBar = nullptr; QProgressBar* m_biddingRoundProgressBar = nullptr;
void updateEnabledStatus();
}; };
#endif // BIDDINGROUNDPROGRESSLAYOUT_H #endif // BIDDINGROUNDPROGRESSLAYOUT_H