iOS: handle loading assets with different format than jpg

The current implementation assumed that the image format
of the file loaded would be jpg. This has proven not to be
correct, e.g sometimes the format is png.

This patch will change how the image url is reconstructed so
we doesn't loose/hard code the format.

Change-Id: I22d8ca0108e52d3670c2601f0bb9255406b896cf
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Richard Moe Gustavsen 2015-06-04 13:44:29 +02:00
parent 9ca4c2e71f
commit 45edf00fa8

View File

@ -429,11 +429,11 @@ void QIOSFileEngineAssetsLibrary::setFileName(const QString &file)
// QUrl::fromLocalFile() will remove double slashes. Since the asset url is
// passed around as a file name in the app (and converted to/from a file url, e.g
// in QFileDialog), we need to ensure that m_assetUrl ends up being valid.
int index = file.indexOf(QLatin1String("asset.JPG?"));
int index = file.indexOf(QLatin1String("/asset"));
if (index == -1)
m_assetUrl = QLatin1String("assets-library://");
else
m_assetUrl = QLatin1String("assets-library://asset/") + file.mid(index);
m_assetUrl = QLatin1String("assets-library:/") + file.mid(index);
}
QStringList QIOSFileEngineAssetsLibrary::entryList(QDir::Filters filters, const QStringList &filterNames) const