2020-10-31 15:16:06 +01:00
|
|
|
#ifndef BRCOMPETITION_H
|
|
|
|
#define BRCOMPETITION_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QDate>
|
2020-11-03 15:56:43 +01:00
|
|
|
#include <QUrl>
|
|
|
|
#include <QDebug>
|
|
|
|
|
2020-10-31 15:16:06 +01:00
|
|
|
#include "brwidget.h"
|
|
|
|
#include "brcategory.h"
|
|
|
|
|
2020-11-03 15:56:43 +01:00
|
|
|
class BRLeague;
|
|
|
|
|
2020-10-31 15:16:06 +01:00
|
|
|
class BRCompetition : public BRWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2020-11-03 15:56:43 +01:00
|
|
|
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)
|
2020-11-05 19:37:13 +01:00
|
|
|
Q_PROPERTY(bool pinned READ getPinned WRITE setPinned NOTIFY pinnedChanged)
|
2020-11-03 15:56:43 +01:00
|
|
|
Q_PROPERTY(QList<QObject*> categories READ getCategoriesQML NOTIFY categoriesChanged)
|
2020-11-04 13:55:37 +01:00
|
|
|
Q_PROPERTY(BRCategory* currentCategory READ getCurrentCategory WRITE setCurrentCategory NOTIFY currentCategoryChanged)
|
2020-11-04 17:25:28 +01:00
|
|
|
Q_PROPERTY(QList<QObject*> results READ getResultsQML NOTIFY resultsChanged)
|
2020-11-03 15:56:43 +01:00
|
|
|
|
2020-10-31 15:16:06 +01:00
|
|
|
public:
|
|
|
|
friend class BRProvider;
|
2020-11-03 15:56:43 +01:00
|
|
|
friend class BRLeague;
|
2020-10-31 15:16:06 +01:00
|
|
|
|
2020-11-03 15:56:43 +01:00
|
|
|
typedef struct BRCompetitionData {
|
|
|
|
const BRCompetition* competition;
|
|
|
|
QString name;
|
|
|
|
QDate startDate;
|
|
|
|
QDate endDate;
|
|
|
|
QUrl eventWebsiteUrl;
|
|
|
|
QList<QUrl> infosheetUrls;
|
|
|
|
|
2020-11-05 19:37:13 +01:00
|
|
|
bool pinned;
|
2020-11-04 17:25:28 +01:00
|
|
|
BRCategory* currentCategory;
|
2020-11-03 15:56:43 +01:00
|
|
|
QList<BRCategory*> categories;
|
|
|
|
} BRCompetitionData;
|
2020-10-31 15:16:06 +01:00
|
|
|
|
2020-11-03 15:56:43 +01:00
|
|
|
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();
|
2020-11-05 19:37:13 +01:00
|
|
|
Q_INVOKABLE bool getPinned();
|
|
|
|
Q_INVOKABLE void setPinned(bool pinned);
|
2020-11-03 15:56:43 +01:00
|
|
|
Q_INVOKABLE QList<QObject*> getCategoriesQML();
|
2020-11-04 17:25:28 +01:00
|
|
|
Q_INVOKABLE QList<BRCategory*> getCategories();
|
2020-11-04 13:55:37 +01:00
|
|
|
Q_INVOKABLE BRCategory* getCurrentCategory() const;
|
|
|
|
Q_INVOKABLE void setCurrentCategory(BRCategory* category);
|
2020-11-04 17:25:28 +01:00
|
|
|
Q_INVOKABLE QList<QObject*> getResultsQML();
|
2020-11-03 15:56:43 +01:00
|
|
|
|
|
|
|
static bool lessThan(BRCompetition* competition1, BRCompetition* competition2);
|
|
|
|
|
|
|
|
private:
|
|
|
|
explicit BRCompetition(BRProvider* provider, BRWidget::BRFederation federation, int id, BRCompetitionData initialData);
|
|
|
|
|
|
|
|
void setLeague(BRLeague* league);
|
|
|
|
|
|
|
|
// metadata
|
2020-10-31 15:16:06 +01:00
|
|
|
QString name;
|
|
|
|
QDate startDate;
|
|
|
|
QDate endDate;
|
2020-11-03 15:56:43 +01:00
|
|
|
BRLeague* league;
|
|
|
|
QUrl eventWebsiteUrl;
|
|
|
|
QList<QUrl> infosheetUrls;
|
2020-10-31 15:16:06 +01:00
|
|
|
|
2020-11-03 15:56:43 +01:00
|
|
|
// data
|
2020-11-05 19:37:13 +01:00
|
|
|
bool pinned;
|
2020-10-31 15:16:06 +01:00
|
|
|
QList<BRCategory*> categories;
|
2020-11-04 13:55:37 +01:00
|
|
|
BRCategory* currentCategory;
|
2020-10-31 15:16:06 +01:00
|
|
|
|
2020-11-03 15:56:43 +01:00
|
|
|
void setData(BRCompetitionData data);
|
|
|
|
|
2020-10-31 15:16:06 +01:00
|
|
|
signals:
|
2020-11-03 15:56:43 +01:00
|
|
|
void metadataChanged();
|
2020-11-05 19:37:13 +01:00
|
|
|
void pinnedChanged();
|
2020-11-03 15:56:43 +01:00
|
|
|
void categoriesChanged();
|
2020-11-04 13:55:37 +01:00
|
|
|
void currentCategoryChanged();
|
2020-11-04 17:25:28 +01:00
|
|
|
void resultsChanged();
|
2020-10-31 15:16:06 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BRCOMPETITION_H
|