Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
tip_of_the_day.h
Go to the documentation of this file.
1
6
7#ifndef TIP_OF_DAY_H
8#define TIP_OF_DAY_H
9
10#include <QAbstractListModel>
11#include <QDate>
12#include <QModelIndex>
13#include <QString>
14#include <qtmetamacros.h>
15
16class QObject;
17template <typename T> class QList;
18
20{
21public:
22 explicit TipOfTheDay(QString _title, QString _content, QString _imagePath, QDate _date);
23 [[nodiscard]] QString getTitle() const
24 {
25 return title;
26 }
27 [[nodiscard]] QString getContent() const
28 {
29 return content;
30 }
31 [[nodiscard]] QString getImagePath() const
32 {
33 return imagePath;
34 }
35 [[nodiscard]] QDate getDate() const
36 {
37 return date;
38 }
39
40private:
42 QDate date;
43};
44
45class TipsOfTheDay : public QAbstractListModel
46{
47 Q_OBJECT
48public:
56
57 explicit TipsOfTheDay(QString xmlPath, QObject *parent = nullptr);
58 ~TipsOfTheDay() override;
59 TipOfTheDay getTip(int tipId);
60 [[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
61 [[nodiscard]] QVariant data(const QModelIndex &index, int role) const override;
62
63private:
65};
66
67#endif
Definition remote_connection_controller.h:20
Definition tip_of_the_day.h:20
QString getTitle() const
Definition tip_of_the_day.h:23
QString getContent() const
Definition tip_of_the_day.h:27
QDate getDate() const
Definition tip_of_the_day.h:35
QString content
Definition tip_of_the_day.h:41
QDate date
Definition tip_of_the_day.h:42
QString getImagePath() const
Definition tip_of_the_day.h:31
QString imagePath
Definition tip_of_the_day.h:41
QString title
Definition tip_of_the_day.h:41
TipOfTheDay(QString _title, QString _content, QString _imagePath, QDate _date)
Definition tip_of_the_day.cpp:21
Definition tip_of_the_day.h:46
TipOfTheDay getTip(int tipId)
Definition tip_of_the_day.cpp:104
Columns
Definition tip_of_the_day.h:50
@ ContentColumn
Definition tip_of_the_day.h:52
@ TitleColumn
Definition tip_of_the_day.h:51
@ ImagePathColumn
Definition tip_of_the_day.h:53
@ DateColumn
Definition tip_of_the_day.h:54
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition tip_of_the_day.cpp:109
QList< TipOfTheDay > * tipList
Definition tip_of_the_day.h:64
TipsOfTheDay(QString xmlPath, QObject *parent=nullptr)
Definition tip_of_the_day.cpp:26
QVariant data(const QModelIndex &index, int role) const override
Definition tip_of_the_day.cpp:83