app/sources/competition/brround.cpp

66 lines
1.4 KiB
C++
Raw Permalink Normal View History

#include "brround.h"
#include "brprovider.h"
BRRound::BRRound(BRProvider* provider, BRWidget::BRFederation federation, int id, BRRoundData initialData, bool generalResult) : BRWidget(provider, federation, id)
{
this->generalResult = generalResult;
this->results = {};
this->setData(initialData);
}
BRCategory* BRRound::getCategory() const {
return this->category;
}
bool BRRound::isGeneralResult() const {
return this->generalResult;
}
QString BRRound::getName() {
return this->name;
}
QList<BRResult*> BRRound::getResults() {
return this->results;
}
QList<QObject*> BRRound::getResultsQML() {
return this->listToQmlList(this->results);
}
2020-11-04 17:25:28 +01:00
BRRound::BRRoundData BRRound::getData() {
BRRound::BRRoundData data {
this,
2020-11-04 17:25:28 +01:00
this->name,
this->results
};
2020-11-04 17:25:28 +01:00
return data;
}
2020-11-04 17:25:28 +01:00
BRWidget::BRWidgetStatusCode BRRound::load() {
return BRWidget::OpeationNotSupportedError;
}
void BRRound::setData(BRRoundData data) {
this->name = data.name;
emit this->metadataChanged();
if(this->results != data.results) {
this->results.clear();
this->results = data.results;
for(BRResult* result : this->results)
result->round = this;
emit this->resultsChanged();
}
}
bool BRRound::lessThan(BRRound* round1, BRRound* round2) {
// TODO ??
return round1->getId() < round2->getId();
}