File indexing completed on 2024-05-12 05:04:17

0001 // SPDX-FileCopyrightText: 2022 Carl Schwan <carlschwan@kde.org>
0002 // SPDX-License-Identifier: LGPL-2.1-or-later
0003 
0004 #pragma once
0005 
0006 #include "timelinemodel.h"
0007 
0008 /// Model used for fetching posts for a specific tag (like searching for #KDE)
0009 /// \see TimelineModel
0010 class TagsTimelineModel : public TimelineModel
0011 {
0012     Q_OBJECT
0013     QML_ELEMENT
0014 
0015     Q_PROPERTY(QString hashtag READ hashtag WRITE setHashtag NOTIFY hashtagChanged)
0016 
0017 public:
0018     explicit TagsTimelineModel(QObject *parent = nullptr);
0019     ~TagsTimelineModel() override;
0020 
0021     void fillTimeline(const QString &fromId) override;
0022     QString displayName() const override;
0023 
0024     /// The hashtag the timeline is searching for
0025     /// \see setHashtag
0026     QString hashtag() const;
0027 
0028     /// Sets the hashtag the timeline is searching for
0029     /// Once called, will start re-filling the timeline
0030     /// \see hashtag
0031     void setHashtag(const QString &hashtag);
0032 
0033     void reset() override;
0034 
0035 Q_SIGNALS:
0036     /// Emitted if the hashtag is changed
0037     /// \see setHashtag
0038     void hashtagChanged();
0039 
0040 private:
0041     QString m_hashtag;
0042 };