94 lines
2.9 KiB
C++
94 lines
2.9 KiB
C++
#ifndef BRCOMPETITION_H
|
|
#define BRCOMPETITION_H
|
|
|
|
#include <QObject>
|
|
#include <QDate>
|
|
#include <QUrl>
|
|
#include <QDebug>
|
|
|
|
#include "brwidget.h"
|
|
#include "brcategory.h"
|
|
|
|
class BRLeague;
|
|
|
|
class BRCompetition : public BRWidget
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(QString name READ getName NOTIFY metadataChanged)
|
|
Q_PROPERTY(QDate startDate READ getStartDate NOTIFY metadataChanged)
|
|
Q_PROPERTY(QDate endDate READ getEndDate NOTIFY metadataChanged)
|
|
Q_PROPERTY(QString dateSpan READ getDateSpan NOTIFY metadataChanged)
|
|
Q_PROPERTY(BRLeague* league READ getLeague NOTIFY metadataChanged)
|
|
Q_PROPERTY(QUrl eventWebsiteUrl READ getEventWebsiteUrl NOTIFY metadataChanged)
|
|
Q_PROPERTY(QList<QUrl> infosheetUrls READ getInfosheetUrls NOTIFY metadataChanged)
|
|
Q_PROPERTY(bool pinned READ getPinned WRITE setPinned NOTIFY pinnedChanged)
|
|
Q_PROPERTY(QList<QObject*> categories READ getCategoriesQML NOTIFY categoriesChanged)
|
|
Q_PROPERTY(BRCategory* currentCategory READ getCurrentCategory WRITE setCurrentCategory NOTIFY currentCategoryChanged)
|
|
Q_PROPERTY(QList<QObject*> results READ getResultsQML NOTIFY resultsChanged)
|
|
|
|
public:
|
|
friend class BRProvider;
|
|
friend class BRLeague;
|
|
|
|
typedef struct BRCompetitionData {
|
|
const BRCompetition* competition;
|
|
QString name;
|
|
QDate startDate;
|
|
QDate endDate;
|
|
QUrl eventWebsiteUrl;
|
|
QList<QUrl> infosheetUrls;
|
|
|
|
bool pinned;
|
|
BRCategory* currentCategory;
|
|
QList<BRCategory*> categories;
|
|
} BRCompetitionData;
|
|
|
|
Q_INVOKABLE BRWidget::BRWidgetStatusCode load() override;
|
|
|
|
Q_INVOKABLE QString getName();
|
|
Q_INVOKABLE QDate getStartDate();
|
|
Q_INVOKABLE QDate getEndDate();
|
|
Q_INVOKABLE QString getDateSpan();
|
|
Q_INVOKABLE BRLeague* getLeague();
|
|
Q_INVOKABLE QUrl getEventWebsiteUrl();
|
|
Q_INVOKABLE QList<QUrl> getInfosheetUrls();
|
|
Q_INVOKABLE bool getPinned();
|
|
Q_INVOKABLE void setPinned(bool pinned);
|
|
Q_INVOKABLE QList<QObject*> getCategoriesQML();
|
|
Q_INVOKABLE QList<BRCategory*> getCategories();
|
|
Q_INVOKABLE BRCategory* getCurrentCategory() const;
|
|
Q_INVOKABLE void setCurrentCategory(BRCategory* category);
|
|
Q_INVOKABLE QList<QObject*> getResultsQML();
|
|
|
|
static bool lessThan(BRCompetition* competition1, BRCompetition* competition2);
|
|
|
|
private:
|
|
explicit BRCompetition(BRProvider* provider, BRWidget::BRFederation federation, int id, BRCompetitionData initialData);
|
|
|
|
void setLeague(BRLeague* league);
|
|
|
|
// metadata
|
|
QString name;
|
|
QDate startDate;
|
|
QDate endDate;
|
|
BRLeague* league;
|
|
QUrl eventWebsiteUrl;
|
|
QList<QUrl> infosheetUrls;
|
|
|
|
// data
|
|
bool pinned;
|
|
QList<BRCategory*> categories;
|
|
BRCategory* currentCategory;
|
|
|
|
void setData(BRCompetitionData data);
|
|
|
|
signals:
|
|
void metadataChanged();
|
|
void pinnedChanged();
|
|
void categoriesChanged();
|
|
void currentCategoryChanged();
|
|
void resultsChanged();
|
|
|
|
};
|
|
|
|
#endif // BRCOMPETITION_H
|