47 lines
1.1 KiB
C++
47 lines
1.1 KiB
C++
#include "../headers/brround.h"
|
|
#include "headers/brprovider.h"
|
|
|
|
BRRound::BRRound(BRProvider* provider, BRWidget::BRFederation federation, int id, BRRoundData initialData) : BRWidget(provider, federation, id)
|
|
{
|
|
this->setData(initialData);
|
|
}
|
|
|
|
BRCategory* BRRound::getCategory() const {
|
|
return this->category;
|
|
}
|
|
|
|
QString BRRound::getName() {
|
|
return this->name;
|
|
}
|
|
|
|
QList<QObject*> BRRound::getResultsQML() {
|
|
return this->listToQmlList(this->results);
|
|
}
|
|
|
|
BRWidget::BRWidgetStatusCode BRRound::load() {
|
|
BRRoundData newData {
|
|
this,
|
|
this->name,
|
|
this->results
|
|
};
|
|
|
|
BRWidget::BRWidgetStatusCode statusCode = this->getProvider()->getWidgetData(&newData);
|
|
|
|
if(statusCode != BRWidget::Success)
|
|
return statusCode;
|
|
|
|
this->setData(newData);
|
|
|
|
return BRWidget::Success;
|
|
}
|
|
|
|
void BRRound::setData(BRRoundData data) {
|
|
this->name = data.name;
|
|
emit this->metadataChanged();
|
|
|
|
if(this->results != data.results) {
|
|
this->results.clear();
|
|
this->results = data.results;
|
|
emit this->resultsChanged();
|
|
}
|
|
}
|