45 lines
1 KiB
C++
45 lines
1 KiB
C++
|
#include "../headers/brcalendar.h"
|
||
|
#include "headers/brprovider.h"
|
||
|
|
||
|
BRCalendar::BRCalendar(BRProvider* provider, BRFederation federation, int year, int league) : BRWidget(provider, federation)
|
||
|
{
|
||
|
this->year = year;
|
||
|
this->league = league;
|
||
|
}
|
||
|
|
||
|
|
||
|
int BRCalendar::getYear() {
|
||
|
return this->year;
|
||
|
}
|
||
|
|
||
|
int BRCalendar::getLeague() {
|
||
|
return this->league;
|
||
|
}
|
||
|
|
||
|
QList<BRCompetition*> BRCalendar::getCompetitions() {
|
||
|
return this->competitions;
|
||
|
}
|
||
|
|
||
|
QList<QObject*> BRCalendar::getCompetitionsQML() {
|
||
|
QList<QObject*> tmpCompetitions;
|
||
|
|
||
|
for(BRCompetition* competition : this->competitions)
|
||
|
tmpCompetitions.append(competition);
|
||
|
|
||
|
return tmpCompetitions;
|
||
|
}
|
||
|
|
||
|
BRWidget::BRWidgetStatusCode BRCalendar::load() {
|
||
|
if(this->getProvider() == nullptr)
|
||
|
return BRWidget::NoProviderError;
|
||
|
|
||
|
// reload all comp data using our providers
|
||
|
this->competitions.clear();
|
||
|
this->categories.clear();
|
||
|
this->cups.clear();
|
||
|
|
||
|
// TODO: handle changes dynamically
|
||
|
|
||
|
return this->getProvider()->loadCalendarData(this);
|
||
|
}
|