Warning, file /network/alligator/src/entriesmodel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /**
0002  * SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #pragma once
0008 
0009 #include <QAbstractListModel>
0010 #include <QHash>
0011 #include <QObject>
0012 #include <QString>
0013 
0014 #include "entry.h"
0015 #include "feed.h"
0016 
0017 class EntriesModel : public QAbstractListModel
0018 {
0019     Q_OBJECT
0020 
0021     Q_PROPERTY(Feed *feed READ feed CONSTANT)
0022 
0023 public:
0024     explicit EntriesModel(Feed *feed = nullptr);
0025     ~EntriesModel() override;
0026     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
0027     QHash<int, QByteArray> roleNames() const override;
0028     int rowCount(const QModelIndex &parent) const override;
0029 
0030     Feed *feed() const;
0031 
0032 private:
0033     void loadEntry(int index) const;
0034 
0035     Feed *m_feed;
0036     mutable QHash<int, Entry *> m_entries;
0037 };