Line data Source code
1 : #ifndef LISVELFEEDITEM_H
2 : #define LISVELFEEDITEM_H
3 :
4 : #include "FeedItem.h"
5 : #include "NewsPosition.h"
6 :
7 : /*!
8 : \brief LISVEL is Fang's secret sauce for keeping a stable order of news
9 : items as you scroll through the view.
10 :
11 : LISVEL stands for:
12 : Limited
13 : Infinite
14 : Scrolling
15 : Via
16 : Exclusion
17 : List
18 :
19 : The NewsList maintains all loaded items in memory with a display window,
20 : allowing paging through previously loaded content without re-fetching
21 : from the database.
22 : */
23 : class LisvelFeedItem : public FeedItem
24 : {
25 : Q_OBJECT
26 : public:
27 : explicit LisvelFeedItem(const qint64 id, const qint32 ordinal, const QString &title, QObject *parent = nullptr);
28 :
29 : /*!
30 : \param proposedBookmarkID
31 : \param allowBackward
32 : \return True if this item can be bookmarked.
33 : */
34 : virtual bool canBookmark(qint64 proposedBookmarkID, bool allowBackward) override;
35 :
36 : /*!
37 : \brief Overrides setBookmark to capture the timestamp for proper ordering.
38 : */
39 : virtual void setBookmark(qint64 toBookmarkID) override;
40 :
41 : /*!
42 : \brief Gets the current bookmark position (timestamp, id tuple).
43 : */
44 53 : inline const NewsPosition& getBookmarkPosition() const { return _bookmarkPosition; }
45 :
46 : private:
47 : // Position of current bookmark (timestamp, id) for proper ordering comparison
48 : NewsPosition _bookmarkPosition;
49 : };
50 :
51 : #endif // LISVELFEEDITEM_H
|