2020-10-07 10:36:04 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2020-12-26 19:56:06 +00:00
|
|
|
// Copyright (c) 2020-2021, The Monero Project.
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
#ifndef FEATHER_REDDITMODEL_H
|
|
|
|
#define FEATHER_REDDITMODEL_H
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
#include <QSharedPointer>
|
|
|
|
|
|
|
|
#include "widgets/RedditPost.h"
|
|
|
|
|
|
|
|
class RedditModel : public QAbstractTableModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum ModelColumn
|
|
|
|
{
|
|
|
|
Title = 0,
|
|
|
|
Author,
|
|
|
|
Comments,
|
|
|
|
COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
explicit RedditModel(QObject *parent);
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent) const override;
|
|
|
|
int columnCount(const QModelIndex &parent) const override;
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
void updatePosts(const QList<QSharedPointer<RedditPost>>& posts);
|
|
|
|
|
|
|
|
QSharedPointer<RedditPost> post(int row);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QList<QSharedPointer<RedditPost>> m_posts;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //FEATHER_REDDITMODEL_H
|