From 8e910f26a28b1b1beae363e6c19f39224f74e2e8 Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Mon, 29 Jun 2020 20:17:42 +0200 Subject: Paves road for new favourite system: Refactors the favourites into tree structure instead of flat list. --- src/favouritecollection.hpp.bak | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/favouritecollection.hpp.bak (limited to 'src/favouritecollection.hpp.bak') diff --git a/src/favouritecollection.hpp.bak b/src/favouritecollection.hpp.bak new file mode 100644 index 0000000..043fdf2 --- /dev/null +++ b/src/favouritecollection.hpp.bak @@ -0,0 +1,48 @@ +#ifndef FAVOURITECOLLECTION_HPP +#define FAVOURITECOLLECTION_HPP + +#include +#include +#include +#include + + +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 save(QSettings & settings) const; + + bool load(QString const & fileName); + bool load(QSettings & settings); + + QVector getAll() const { + return this->items; + } + +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 items; + +}; + +#endif // FAVOURITECOLLECTION_HPP -- cgit v1.2.3