#ifndef BRCATEGORY_H #define BRCATEGORY_H #include #include "brwidget.h" #include "brround.h" #include "brathlete.h" class BRCompetition; class BRCategory : public BRWidget { Q_OBJECT Q_PROPERTY(QString name READ getName NOTIFY metadataChanged) Q_PROPERTY(BRDiscipline discipline READ getDiscipline NOTIFY metadataChanged) Q_PROPERTY(BRCategoryStatus status READ getStatus NOTIFY metadataChanged) Q_PROPERTY(BRRound* currentRound READ getCurrentRound WRITE setCurrentRound NOTIFY currentRoundChanged) Q_PROPERTY(QList rounds READ getRoundsQML NOTIFY roundsChanged) public: friend class BRProvider; friend class BRCompetition; enum BRDiscipline { UnknownDiscipline = -1, Speed, Lead, Boulder, Combined }; enum BRCategoryStatus { UnknownStatus = -1, Registration, Startlist, Result }; typedef struct { const BRCategory* category; QString name; BRDiscipline discipline; BRCategoryStatus status; BRRound* currentRound; QList rounds; } BRCategoryData; Q_INVOKABLE BRWidget::BRWidgetStatusCode load() override; Q_INVOKABLE BRCompetition* getCompetition() const; Q_INVOKABLE QString getName(); Q_INVOKABLE BRDiscipline getDiscipline(); Q_INVOKABLE BRCategoryStatus getStatus(); Q_INVOKABLE BRRound* getCurrentRound() const; Q_INVOKABLE void setCurrentRound(BRRound* round); Q_INVOKABLE QList getRounds() const; Q_INVOKABLE QList getRoundsQML(); BRCategoryData getData(); private: BRCategory(BRProvider* provider, BRWidget::BRFederation federation, int id, BRCategoryData initialData); void setData(BRCategoryData data); BRCompetition* competition; BRRound* currentRound; QString name; BRDiscipline discipline; BRCategoryStatus status; QList rounds; signals: void metadataChanged(); void currentRoundChanged(); void roundsChanged(); void resultsChanged(); }; #endif // BRCATEGORY_H