diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2013-04-02 13:25:14 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2013-04-02 13:25:14 +0200 |
commit | 07abe301396f9b0fbfca67d4b4f6df6b9fdf6e82 (patch) | |
tree | 0aae75aadd6aa1d0eeba91229922711a291bab07 /board.cpp | |
parent | 7107c0f96f10303ea49bf5dc27f525e4cbc191d9 (diff) | |
download | tapasboard-07abe301396f9b0fbfca67d4b4f6df6b9fdf6e82.tar.gz tapasboard-07abe301396f9b0fbfca67d4b4f6df6b9fdf6e82.zip |
use a qnetworkdiskcache for images instead of custom provider
Diffstat (limited to 'board.cpp')
-rw-r--r-- | board.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -118,19 +118,6 @@ QString Board::bbcodeToRichText(QString text) const text.replace(pair.first, pair.second); } - // Unfortunately, we have to process images separately - static QRegExp img_bbcode("\\[img\\]([^[]*)\\[/img\\]", Qt::CaseInsensitive); - int pos = 0; - while ((pos = img_bbcode.indexIn(text, pos)) != -1) { - QString imageUrl = img_bbcode.cap(1); - QString providerUrl = image_provider->getProviderImageUrl(imageUrl); - qDebug() << "Image" << imageUrl << "->" << providerUrl; - text.replace(pos, img_bbcode.matchedLength(), "<img src=\"" + providerUrl + "\" />"); - } - - // HTML newlines - text.replace("\n", "<br>"); - return text; } @@ -323,7 +310,11 @@ void Board::initializeBbCode() _bbcodes << qMakePair(QRegExp("\\[url=([^]]*)\\]", Qt::CaseInsensitive), QString("<a href=\"\\1\">")); _bbcodes << qMakePair(QRegExp("\\[/url\\]", Qt::CaseInsensitive), QString("</a>")); + _bbcodes << qMakePair(QRegExp("\\[img\\]([^[]*)\\[/img\\]", Qt::CaseInsensitive), QString("<img src=\"\\1\" />")); + _bbcodes << qMakePair(QRegExp("\\[hr\\]", Qt::CaseInsensitive), QString("<hr>")); + + _bbcodes << qMakePair(QRegExp("\n"), QString("<br>")); } void Board::fetchConfigIfOutdated() |