From d8fcff1a2d6eb61c97c44790dbdb920ba9f52980 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Thu, 4 Apr 2013 15:49:31 +0200 Subject: add showing unread posts --- board.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'board.h') diff --git a/board.h b/board.h index 588219c..698b4b6 100644 --- a/board.h +++ b/board.h @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include #include #include @@ -63,9 +65,13 @@ public slots: void notifyForumsChanged(); void notifyForumTopicsChanged(int forumId, int start, int end); void notifyTopicPostsChanged(int topicId, int start, int end); + void notifyTopicPostsUnread(int topicId, int position); void notifyLogin(const QMap& info); void notifyLogout(); + // Functions for marking posts as read + void markPostAsRead(int postId); + signals: void busyChanged(); void loggedInChanged(); @@ -73,6 +79,7 @@ signals: void forumsChanged(); void forumTopicsChanged(int forumId, int start, int end); void topicPostsChanged(int topicId, int start, int end); + void topicPostsUnread(int topicId, int position); private: static QString createSlug(const QUrl& url); @@ -86,6 +93,7 @@ private: void executeActionFromQueue(); void initializeBbCode(); void initializeSmilies(); + void initializeMarkRead(); void fetchConfigIfOutdated(); void fetchForumsIfOutdated(); @@ -98,13 +106,21 @@ private: QString _slug; QSqlDatabase _db; XmlRpcInterface *_iface; + /** The queue of pending actions. The first one is currently being run. */ QQueue _queue; /** Configuration cache */ mutable QHash _config; + /** Login information, which is obviously not persistent. */ QMap _loginInfo; + /** Bbcodes list and their HTML replacements for quick-and-dirty parsing. */ QList< QPair > _bbcodes; + /** List of smilies and their replacements. */ QHash _smilies; + /** A regular expression that matches every possibly smilie. */ QRegExp _smilieRegexp; + /** This timer helps delay marking topics/posts as read. */ + QTimer *_markReadDelay; + QSet _postsToMarkRead; }; inline bool Board::busy() const -- cgit v1.2.3