diff options
Diffstat (limited to 'rockwork/screenshotmodel.h')
| -rw-r--r-- | rockwork/screenshotmodel.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/rockwork/screenshotmodel.h b/rockwork/screenshotmodel.h new file mode 100644 index 0000000..bc855f1 --- /dev/null +++ b/rockwork/screenshotmodel.h @@ -0,0 +1,38 @@ +#ifndef SCREENSHOTMODEL_H +#define SCREENSHOTMODEL_H + +#include <QAbstractListModel> + +class ScreenshotModel : public QAbstractListModel +{ + Q_OBJECT + + Q_PROPERTY(QString latestScreenshot READ latestScreenshot NOTIFY latestScreenshotChanged) + +public: + enum Role { + RoleFileName + }; + + ScreenshotModel(QObject *parent = nullptr); + QString path() const; + + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant data(const QModelIndex &index, int role) const override; + QHash<int, QByteArray> roleNames() const override; + + Q_INVOKABLE QString get(int index) const; + QString latestScreenshot() const; + + void clear(); + void insert(const QString &filename); + void remove(const QString &filename); + +signals: + void latestScreenshotChanged(); + +private: + QStringList m_files; +}; + +#endif // SCREENSHOTMODEL_H |
