mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-23 15:13:55 -07:00
Tip of the Day (#3118)
* Basic tip of the day with sample widget added * "Show tips on startup" option added to settings * tip cycling implemented * Structure of the tipOfTheDay class and resource created * tip getter function modified * Resources added, feature works properly * clangified * accidental modification rolled back * zach cleanup * tips to spaces; cmake list combined * cleanup img * fix copy * remove TOTD as QObject so we can copy construct it * prevent mem leaks in dlg * changed order of 'next' and 'previous' buttons * Date and tip numbers added; content wraps around * useless sizepolicy removed * link support added & clangified * Initial tips & memory management updates
This commit is contained in:
parent
281e52eaa9
commit
312caae062
24 changed files with 498 additions and 2 deletions
54
cockatrice/src/tip_of_the_day.h
Normal file
54
cockatrice/src/tip_of_the_day.h
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#ifndef TIP_OF_DAY_H
|
||||
#define TIP_OF_DAY_H
|
||||
|
||||
#include <QAbstractListModel>
|
||||
|
||||
class TipOfTheDay
|
||||
{
|
||||
public:
|
||||
explicit TipOfTheDay(QString _title, QString _content, QString _imagePath, QDate _date);
|
||||
QString getTitle() const
|
||||
{
|
||||
return title;
|
||||
}
|
||||
QString getContent() const
|
||||
{
|
||||
return content;
|
||||
}
|
||||
QString getImagePath() const
|
||||
{
|
||||
return imagePath;
|
||||
}
|
||||
QDate getDate() const
|
||||
{
|
||||
return date;
|
||||
}
|
||||
|
||||
private:
|
||||
QString title, content, imagePath;
|
||||
QDate date;
|
||||
};
|
||||
|
||||
class TipsOfTheDay : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
TitleColumn,
|
||||
ContentColumn,
|
||||
ImagePathColumn,
|
||||
DateColumn,
|
||||
};
|
||||
|
||||
explicit TipsOfTheDay(QString xmlPath, QObject *parent = nullptr);
|
||||
~TipsOfTheDay() override;
|
||||
TipOfTheDay getTip(int tipId);
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
private:
|
||||
QList<TipOfTheDay> *tipList;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue