diff options
Diffstat (limited to 'board.h')
-rw-r--r-- | board.h | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -22,6 +22,7 @@ class Board : public QObject Q_PROPERTY(bool loggedIn READ loggedIn NOTIFY loggedInChanged) Q_PROPERTY(int rootForumId READ rootForumId CONSTANT) Q_ENUMS(TopicType) + Q_FLAGS(DateTimePrecisionOptions) public: explicit Board(QObject *parent = 0); @@ -34,6 +35,14 @@ public: Announcement = 2 }; + enum DateTimePrecisionOption { + ShowTime = 1 << 0, + RelativeTime = 1 << 1, // "n second(s) ago" instead of "Today HH:MM" + TodayYesterday = 1 << 2, // "Today", "Yesterday" and "Today HH:MM" if ShowTime + RelativeDate = 1 << 3 // "n week(s) ago", incompatible with ShowTime + }; + Q_DECLARE_FLAGS(DateTimePrecisionOptions, DateTimePrecisionOption) + static const QLatin1String CURRENT_DB_VERSION; bool busy() const; @@ -68,8 +77,7 @@ public: QString bbcodeToRichText(QString text) const; QString parseSmilies(QString text) const; - Q_INVOKABLE QString renderHumanDate(const QDateTime& dateTime, bool monthOnly = false); - Q_INVOKABLE QString renderHumanDateTime(const QDateTime& dateTime); + Q_INVOKABLE QString formatDateTime(const QDateTime& dateTime, DateTimePrecisionOptions precision) const; public slots: void cancelAllActions(); @@ -139,6 +147,8 @@ private: QRegExp _smilieRegexp; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(Board::DateTimePrecisionOptions) + inline bool Board::busy() const { return !_queue.empty(); |