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:"); 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

View File

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