diff options
author | Robert C. Helling <helling@atdotde.de> | 2015-03-03 11:12:07 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-16 12:42:37 -0700 |
commit | e0490f305560bef53327ccaab391eb25cf03e260 (patch) | |
tree | 2b3f1bf3876126f7db698ed32c05edadf3f498d5 /qt-ui/divepicturewidget.cpp | |
parent | 6b3b50cc2f8083ebbc013c1d270c1ec1d1252a23 (diff) | |
download | subsurface-e0490f305560bef53327ccaab391eb25cf03e260.tar.gz |
Use QUrl::fromUserInput for image files
... as suggested by Thiago.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divepicturewidget.cpp')
-rw-r--r-- | qt-ui/divepicturewidget.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/qt-ui/divepicturewidget.cpp b/qt-ui/divepicturewidget.cpp index 6de317778..0bf3424bc 100644 --- a/qt-ui/divepicturewidget.cpp +++ b/qt-ui/divepicturewidget.cpp @@ -20,8 +20,11 @@ void loadPicuture(struct picture *picture) download.load(); } -SHashedImage::SHashedImage(struct picture *picture) : QImage(picture->filename) +SHashedImage::SHashedImage(struct picture *picture) : QImage() { + QUrl url = QUrl::fromUserInput(QString(picture->filename)); + if(url.isLocalFile()) + load(url.toLocalFile()); if (isNull()) { // Hash lookup. load(fileFromHash(picture->hash)); @@ -31,7 +34,7 @@ SHashedImage::SHashedImage(struct picture *picture) : QImage(picture->filename) QtConcurrent::run(loadPicuture, picture); } } else { - QByteArray hash = hashFile(QString(picture->filename)); + QByteArray hash = hashFile(url.toLocalFile()); free(picture->hash); picture->hash = strdup(hash.toHex().data()); } @@ -43,7 +46,7 @@ ImageDownloader::ImageDownloader(struct picture *pic) } void ImageDownloader::load(){ - QUrl url(picture->filename); + QUrl url = QUrl::fromUserInput(QString(picture->filename)); if (url.isValid()) { QEventLoop loop; QNetworkRequest request(url); |