57 lines
1.9 KiB
C++
57 lines
1.9 KiB
C++
#include "biddingroundprogresslayout.h"
|
|
|
|
#include <QLabel>
|
|
#include <QProgressBar>
|
|
|
|
BiddingRoundProgressLayout::BiddingRoundProgressLayout(const int nCurrentBiddings,
|
|
const int nExpectedBiddings,
|
|
QWidget* parent)
|
|
: QHBoxLayout(parent)
|
|
, m_nCurrentBiddings(nCurrentBiddings)
|
|
, m_nExpectedBiddings(nExpectedBiddings) {
|
|
QLabel* nBidsText = new QLabel("Abgegeben:");
|
|
addWidget(nBidsText);
|
|
|
|
m_nBiddingsLabel = new QLabel(QString::number(m_nCurrentBiddings));
|
|
addWidget(m_nBiddingsLabel);
|
|
|
|
QLabel* nExpectedText = new QLabel("Erwartet:");
|
|
addWidget(nExpectedText);
|
|
|
|
m_nExpectedBiddingLabel = new QLabel(QString::number(m_nExpectedBiddings));
|
|
addWidget(m_nExpectedBiddingLabel);
|
|
|
|
m_biddingRoundProgressBar = new QProgressBar(parent);
|
|
m_biddingRoundProgressBar->setMinimum(0);
|
|
m_biddingRoundProgressBar->setMaximum(m_nExpectedBiddings);
|
|
m_biddingRoundProgressBar->setValue(m_nCurrentBiddings);
|
|
|
|
addWidget(m_biddingRoundProgressBar);
|
|
|
|
updateEnabledStatus();
|
|
}
|
|
|
|
void BiddingRoundProgressLayout::setCurrentBiddings(const int value) {
|
|
m_nCurrentBiddings = value;
|
|
const QString bidCountString = QString::number(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_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);
|
|
}
|
|
}
|