aboutsummaryrefslogtreecommitdiff
path: root/favouritecollection.hpp
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-05-30 19:33:47 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-05-30 19:33:47 +0200
commitea39cc542e17ce592dc3c4f2053d534bc458d88e (patch)
treec3c6a369d5b6d8a6a4e0b3e3667a56ca19e93173 /favouritecollection.hpp
parent79ff338a3427a236ef53adf806c56616faa3426c (diff)
downloadkristall-ea39cc542e17ce592dc3c4f2053d534bc458d88e.tar.gz
More usability, survives conmans torture nearly with 100%
Diffstat (limited to 'favouritecollection.hpp')
-rw-r--r--favouritecollection.hpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/favouritecollection.hpp b/favouritecollection.hpp
new file mode 100644
index 0000000..dd68b93
--- /dev/null
+++ b/favouritecollection.hpp
@@ -0,0 +1,41 @@
+#ifndef FAVOURITECOLLECTION_HPP
+#define FAVOURITECOLLECTION_HPP
+
+#include <QObject>
+#include <QAbstractListModel>
+#include <QUrl>
+
+
+class FavouriteCollection : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ explicit FavouriteCollection(QObject *parent = nullptr);
+
+ void add(QUrl const & url);
+
+ void remove(QUrl const & url);
+
+ bool contains(QUrl const & url);
+
+ QUrl get(QModelIndex const & index) const ;
+
+ bool save(QString const & fileName) const;
+
+ bool load(QString const & fileName);
+
+public:
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+
+signals:
+
+private:
+ QVector<QUrl> items;
+
+};
+
+#endif // FAVOURITECOLLECTION_HPP