app/headers/competition/brcategory.h

81 lines
2.3 KiB
C
Raw Permalink Normal View History

2020-10-31 15:16:06 +01:00
#ifndef BRCATEGORY_H
#define BRCATEGORY_H
#include <QObject>
#include "brwidget.h"
#include "brround.h"
#include "brathlete.h"
#include "brresultdetailsgeneralresult.h"
class BRCompetition;
class BRCategory : public BRWidget
2020-10-31 15:16:06 +01:00
{
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(BRRound* generalResult READ getGeneralResult NOTIFY generalResultChanged)
Q_PROPERTY(QList<QObject*> rounds READ getRoundsQML NOTIFY roundsChanged)
2020-10-31 15:16:06 +01:00
public:
friend class BRProvider;
friend class BRCompetition;
enum BRCategoryStatus {
UnknownStatus = -1,
Registration,
Startlist,
Result
};
Q_ENUM(BRCategoryStatus)
typedef struct {
const BRCategory* category;
QString name;
BRDiscipline discipline;
BRCategoryStatus status;
BRRound* currentRound;
BRRound* generalResult;
QList<BRRound*> 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 = nullptr);
Q_INVOKABLE BRRound* getGeneralResult();
Q_INVOKABLE QList<BRRound*> getRounds(bool includeGeneralResult = false) const;
Q_INVOKABLE QList<QObject*> getRoundsQML();
2020-11-04 17:25:28 +01:00
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;
BRRound* generalResult;
QList<BRRound*> rounds;
2020-10-31 15:16:06 +01:00
signals:
void metadataChanged();
void currentRoundChanged();
void roundsChanged();
void generalResultChanged();
2020-11-04 17:25:28 +01:00
void resultsChanged();
2020-10-31 15:16:06 +01:00
};
#endif // BRCATEGORY_H