app/sources/competition/brround.cpp
Dorian Zedler 85c8760bed
- moved some stuff
- results work now (still basic)
2020-11-15 14:48:12 +01:00

66 lines
1.4 KiB
C++

#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);
}
BRRound::BRRoundData BRRound::getData() {
BRRound::BRRoundData data {
this,
this->name,
this->results
};
return data;
}
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();
}