diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2013-04-02 00:51:58 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2013-04-02 00:51:58 +0200 |
commit | 427004acc6a80004f69c6ce059667465023269a9 (patch) | |
tree | bfa65471cc6411225016def30813623fdbc63f05 /board.h | |
parent | 28bb9f9ee55b4899204bb9f860f2cda6f90b4806 (diff) | |
download | tapasboard-427004acc6a80004f69c6ce059667465023269a9.tar.gz tapasboard-427004acc6a80004f69c6ce059667465023269a9.zip |
parse bbcode, show usernames, ....
Diffstat (limited to 'board.h')
-rw-r--r-- | board.h | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -1,7 +1,9 @@ #ifndef BOARD_H #define BOARD_H +#include <QtCore/QDateTime> #include <QtCore/QObject> +#include <QtCore/QPair> #include <QtCore/QQueue> #include <QtSql/QSqlDatabase> @@ -15,17 +17,27 @@ public: explicit Board(const QString& boardUrl, QObject *parent = 0); ~Board(); + static const QLatin1String CURRENT_DB_VERSION; + bool busy() const; void enqueueAction(Action* action); QSqlDatabase database(); XmlRpcInterface *service(); + // Configuration table QString getConfig(const QString& key) const; void setConfig(const QString& key, const QString &value); - int rootForumId() const; + // Some helper functions + QString removeHtml(QString text) const; + QString removeBbcode(QString text) const; + QString bbcodeToRichText(QString text) const; + + QString renderHumanDate(const QDateTime& dateTime); + QString renderHumanTime(const QDateTime& dateTime); + // These functions wrap emitting the signals below void notifyConfigChanged(); void notifyForumsChanged(); void notifyForumTopicsChanged(int forumId, int start, int end); @@ -42,11 +54,14 @@ private: static QString createSlug(const QString& forumUrl); static QString getDbDir(); static QString getDbPathFor(const QString& slug); + static QString getTempDbPathFor(const QString& slug); + bool checkCompatibleDb(); bool initializeDb(); bool eraseDb(); bool cleanDb(); bool removeFromActionQueue(Action *action); void executeActionFromQueue(); + void initializeBbCode(); void fetchConfigIfOutdated(); void fetchForumsIfOutdated(); @@ -60,6 +75,7 @@ private: QSqlDatabase _db; XmlRpcInterface *_iface; QQueue<Action*> _queue; + QList< QPair<QRegExp, QString> > _bbcodes; }; inline bool Board::busy() const |