File indexing completed on 2024-07-21 12:44:00

0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 #pragma once
0005 
0006 #include "timelinemodel.h"
0007 
0008 class AbstractAccount;
0009 
0010 /// Model for the three main timelines (Home, Public, and Federated)
0011 /// \see TimelineModel
0012 class MainTimelineModel : public TimelineModel
0013 {
0014     Q_OBJECT
0015     Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
0016 
0017 public:
0018     explicit MainTimelineModel(QObject *parent = nullptr);
0019 
0020     /// Name of the timeline
0021     /// \see setName
0022     QString name() const;
0023 
0024     /// Set the name of the timeline to fetch ("home", "public" or "federated")
0025     void setName(const QString &name);
0026 
0027     void fillTimeline(const QString &fromId) override;
0028     QString displayName() const override;
0029     void handleEvent(AbstractAccount::StreamingEventType eventType, const QByteArray &payload) override;
0030 
0031 private:
0032     QString m_timelineName;
0033     QUrl m_next;
0034 };