Compare commits

...

2 Commits

3 changed files with 34 additions and 21 deletions

View File

@ -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);
}
}

View File

@ -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

View File

@ -312,15 +312,14 @@ int TableModel::nExpectedBiddings() const {
if (biddingType.isEmpty()) {
continue;
}
const QString shareType = (*i)->data(ShareTypeRole).toString();
if (shareType.isEmpty() || shareType == "erarbeitet") {
continue;
}
const double shareAmount = (*i)->data(ShareAmountRole).toDouble();
if (shareAmount == 0.0) {
continue;
}
result++;
const QString shareType = (*i)->data(ShareTypeRole).toString();
if (shareType == "bezahlt" || shareType == "teils/teils") {
result++;
}
}
return result;
}