diff options
| author | Andrew Branson <andrew.branson@jolla.com> | 2026-02-13 06:26:11 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@jolla.com> | 2026-02-13 06:26:11 +0100 |
| commit | ce4447024641c0ee793539d79a6d9be7a34a000b (patch) | |
| tree | 9fc690b3c5e8c0f6f6b027f2d8461f5907397a55 /eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.h | |
| parent | 8c09980c00061a97eab050a4f0fd5fb4135d6ee7 (diff) | |
Drop libsocialcache files in MastodonPostsModel
Diffstat (limited to 'eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.h')
| -rw-r--r-- | eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.h b/eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.h index 565b2bb..e30437d 100644 --- a/eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.h +++ b/eventsview-plugins/eventsview-plugin-mastodon/mastodonpostsmodel.h @@ -19,14 +19,15 @@ #ifndef MASTODONPOSTSMODEL_H #define MASTODONPOSTSMODEL_H -#include "abstractsocialcachemodel.h" +#include "mastodonpostsdatabase.h" +#include <QtCore/QAbstractListModel> +#include <QtCore/QMap> -class MastodonPostsModelPrivate; - -class MastodonPostsModel: public AbstractSocialCacheModel +class MastodonPostsModel: public QAbstractListModel { Q_OBJECT Q_PROPERTY(QVariantList accountIdFilter READ accountIdFilter WRITE setAccountIdFilter NOTIFY accountIdFilterChanged) + Q_PROPERTY(int count READ rowCount NOTIFY countChanged) public: enum MastodonPostsRole { @@ -52,21 +53,27 @@ public: }; explicit MastodonPostsModel(QObject *parent = 0); - QHash<int, QByteArray> roleNames() const; + + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant data(const QModelIndex &index, int role) const override; + QHash<int, QByteArray> roleNames() const override; QVariantList accountIdFilter() const; void setAccountIdFilter(const QVariantList &accountIds); - void refresh(); + Q_INVOKABLE void refresh(); signals: void accountIdFilterChanged(); + void countChanged(); private slots: void postsChanged(); private: - Q_DECLARE_PRIVATE(MastodonPostsModel) + typedef QMap<int, QVariant> RowData; + QList<RowData> m_data; + MastodonPostsDatabase m_database; }; #endif // MASTODONPOSTSMODEL_H |
