app/headers/brleague.h

63 lines
1.6 KiB
C
Raw Normal View History

#ifndef BRLEAGUE_H
#define BRLEAGUE_H
#include <QObject>
#include <QColor>
#include "brwidget.h"
#include "brcompetition.h"
#include "brcategory.h"
#include "brcup.h"
class BRLeague : public BRWidget
{
Q_OBJECT
Q_PROPERTY(QString name READ getName NOTIFY metadataChanged)
Q_PROPERTY(QColor color READ getColor NOTIFY metadataChanged)
Q_PROPERTY(bool enabled READ getEnabled WRITE setEnabled NOTIFY enabledChanged)
Q_PROPERTY(QList<QObject*> competitions READ getCompetitionsQML NOTIFY competitionsChanged)
Q_PROPERTY(QList<QObject*> cups READ getCupsQML NOTIFY cupsChanged)
public:
friend class BRProvider;
typedef struct {
const BRLeague* league;
QString name;
QColor color;
bool enabled;
QList<BRCompetition*> competitions;
QList<BRCup*> cups;
} BRLeagueData;
BRWidget::BRWidgetStatusCode load() override;
Q_INVOKABLE QString getName();
Q_INVOKABLE QColor getColor();
Q_INVOKABLE bool getEnabled();
Q_INVOKABLE void setEnabled(bool enabled);
Q_INVOKABLE QList<BRCompetition*> getCompetitions();
Q_INVOKABLE QList<QObject*> getCompetitionsQML();
Q_INVOKABLE QList<QObject*> getCupsQML();
private:
BRLeague(BRProvider* provider, BRWidget::BRFederation federation, int id, BRLeagueData initialData);
void setData(BRLeagueData data);
QString name;
QColor color;
bool enabled;
QList<BRCompetition*> competitions;
QList<BRCup*> cups;
signals:
void metadataChanged();
void enabledChanged();
void competitionsChanged();
void cupsChanged();
};
#endif // BRLEAGUE_H