summaryrefslogtreecommitdiff
path: root/board.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-04-02 13:25:14 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-04-02 13:25:14 +0200
commit07abe301396f9b0fbfca67d4b4f6df6b9fdf6e82 (patch)
tree0aae75aadd6aa1d0eeba91229922711a291bab07 /board.cpp
parent7107c0f96f10303ea49bf5dc27f525e4cbc191d9 (diff)
downloadtapasboard-07abe301396f9b0fbfca67d4b4f6df6b9fdf6e82.tar.gz
tapasboard-07abe301396f9b0fbfca67d4b4f6df6b9fdf6e82.zip
use a qnetworkdiskcache for images instead of custom provider
Diffstat (limited to 'board.cpp')
-rw-r--r--board.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/board.cpp b/board.cpp
index 1be4076..fc9e0ad 100644
--- a/board.cpp
+++ b/board.cpp
@@ -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()