| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2020 Dan Leinir Turthra Jensen <admin@leinir.dk> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 5 | */ |
| 6 | |
| 7 | #ifndef KNSRCMODEL_H |
| 8 | #define KNSRCMODEL_H |
| 9 | |
| 10 | #include <QAbstractListModel> |
| 11 | #include <QUrl> |
| 12 | |
| 13 | class KNSRCModel : public QAbstractListModel |
| 14 | { |
| 15 | Q_OBJECT |
| 16 | public: |
| 17 | explicit KNSRCModel(QObject *parent = nullptr); |
| 18 | ~KNSRCModel() override; |
| 19 | |
| 20 | enum Roles { |
| 21 | NameRole = Qt::UserRole + 1, |
| 22 | FilePathRole, |
| 23 | }; |
| 24 | |
| 25 | QHash<int, QByteArray> roleNames() const override; |
| 26 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; |
| 27 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; |
| 28 | |
| 29 | private: |
| 30 | struct Entry { |
| 31 | QString name; |
| 32 | QString filePath; |
| 33 | }; |
| 34 | QList<Entry *> m_entries; |
| 35 | }; |
| 36 | |
| 37 | #endif // KNSRCMODEL_H |
| 38 | |