File indexing completed on 2024-10-06 10:26:01
0001 // SPDX-FileCopyrightText: 2021 kaniini <https://git.pleroma.social/kaniini> 0002 // SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org> 0003 // SPDX-License-Identifier: GPL-3.0-only 0004 0005 #pragma once 0006 0007 #include "timelinemodel.h" 0008 0009 /// Model for displaying and organizing post threads 0010 /// \see TimelineModel 0011 class ThreadModel : public TimelineModel 0012 { 0013 Q_OBJECT 0014 0015 Q_PROPERTY(QString postId READ postId WRITE setPostId NOTIFY postIdChanged) 0016 0017 public: 0018 explicit ThreadModel(QObject *parent = nullptr); 0019 0020 /// The post id of the "root" post of the thread 0021 /// \see setPostId 0022 QString postId() const; 0023 0024 /// Set the post id of the "root" post of the thread 0025 /// \see postId 0026 void setPostId(const QString &postId); 0027 0028 QVariant data(const QModelIndex &index, int role) const override; 0029 0030 QString displayName() const override; 0031 void fillTimeline(const QString &fromId = QString()) override; 0032 bool canFetchMore(const QModelIndex &parent) const override; 0033 0034 Q_SIGNALS: 0035 void postIdChanged(); 0036 0037 private: 0038 QString m_postId; 0039 0040 friend class TimelineTest; 0041 };