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:
@ -12,33 +12,45 @@ BiddingRoundProgressLayout::BiddingRoundProgressLayout(const int nCurrentBidding
|
||||
QLabel* nBidsText = new QLabel("Abgegeben:");
|
||||
addWidget(nBidsText);
|
||||
|
||||
m_nBiddings1Label = new QLabel(QString::number(m_nCurrentBiddings));
|
||||
addWidget(m_nBiddings1Label);
|
||||
m_nBiddingsLabel = new QLabel(QString::number(m_nCurrentBiddings));
|
||||
addWidget(m_nBiddingsLabel);
|
||||
|
||||
QLabel* nExpectedText = new QLabel("Erwartet:");
|
||||
addWidget(nExpectedText);
|
||||
|
||||
m_nExpectedBidding1Label = new QLabel(QString::number(m_nExpectedBiddings));
|
||||
addWidget(m_nExpectedBidding1Label);
|
||||
m_nExpectedBiddingLabel = new QLabel(QString::number(m_nExpectedBiddings));
|
||||
addWidget(m_nExpectedBiddingLabel);
|
||||
|
||||
m_biddingRound1ProgressBar = new QProgressBar(parent);
|
||||
m_biddingRound1ProgressBar->setMinimum(0);
|
||||
m_biddingRound1ProgressBar->setMaximum(m_nExpectedBiddings);
|
||||
m_biddingRound1ProgressBar->setValue(m_nCurrentBiddings);
|
||||
m_biddingRoundProgressBar = new QProgressBar(parent);
|
||||
m_biddingRoundProgressBar->setMinimum(0);
|
||||
m_biddingRoundProgressBar->setMaximum(m_nExpectedBiddings);
|
||||
m_biddingRoundProgressBar->setValue(m_nCurrentBiddings);
|
||||
|
||||
addWidget(m_biddingRound1ProgressBar);
|
||||
addWidget(m_biddingRoundProgressBar);
|
||||
|
||||
updateEnabledStatus();
|
||||
}
|
||||
|
||||
void BiddingRoundProgressLayout::setCurrentBiddings(const int value) {
|
||||
m_nCurrentBiddings = value;
|
||||
const QString bidCountString = QString::number(value);
|
||||
m_nBiddings1Label->setText(bidCountString);
|
||||
m_biddingRound1ProgressBar->setValue(value);
|
||||
m_nBiddingsLabel->setText(bidCountString);
|
||||
m_biddingRoundProgressBar->setValue(value);
|
||||
updateEnabledStatus();
|
||||
}
|
||||
|
||||
void BiddingRoundProgressLayout::setExpectedBiddings(const int value) {
|
||||
m_nExpectedBiddings = value;
|
||||
const QString expectedBiddingsString = QString::number(value);
|
||||
m_nExpectedBidding1Label->setText(expectedBiddingsString);
|
||||
m_biddingRound1ProgressBar->setMaximum(value);
|
||||
m_nExpectedBiddingLabel->setText(expectedBiddingsString);
|
||||
m_biddingRoundProgressBar->setMaximum(value);
|
||||
updateEnabledStatus();
|
||||
}
|
||||
|
||||
void BiddingRoundProgressLayout::updateEnabledStatus() {
|
||||
if (m_nCurrentBiddings > m_nExpectedBiddings) {
|
||||
m_biddingRoundProgressBar->setEnabled(false);
|
||||
} else {
|
||||
m_biddingRoundProgressBar->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,9 +20,11 @@ class BiddingRoundProgressLayout : public QHBoxLayout {
|
||||
int m_nCurrentBiddings;
|
||||
int m_nExpectedBiddings;
|
||||
|
||||
QLabel* m_nBiddings1Label = nullptr;
|
||||
QLabel* m_nExpectedBidding1Label = nullptr;
|
||||
QProgressBar* m_biddingRound1ProgressBar = nullptr;
|
||||
QLabel* m_nBiddingsLabel = nullptr;
|
||||
QLabel* m_nExpectedBiddingLabel = nullptr;
|
||||
QProgressBar* m_biddingRoundProgressBar = nullptr;
|
||||
|
||||
void updateEnabledStatus();
|
||||
};
|
||||
|
||||
#endif // BIDDINGROUNDPROGRESSLAYOUT_H
|
||||
|
||||
Reference in New Issue
Block a user