From c42e7baac98ba4c3db8995ac37c5d020b57b9df7 Mon Sep 17 00:00:00 2001 From: sanevala Date: Tue, 12 Feb 2013 12:18:24 +0200 Subject: [PATCH] User is not able to select file from FileBrowser and play it. When string is converted to Url qrc:// scheme is used. Fix Filebrowser to use file:// scheme instead. Change-Id: I713e704eb52d27d046ace1ff7d65feb98635461d Reviewed-by: Andy Nichols --- examples/multimedia/video/qmlvideofx/main.cpp | 17 +++++++++++------ .../video/qmlvideofx/qml/qmlvideofx/FileBrowser.qml | 5 +++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/examples/multimedia/video/qmlvideofx/main.cpp b/examples/multimedia/video/qmlvideofx/main.cpp index c0490e6..ab613da 100644 --- a/examples/multimedia/video/qmlvideofx/main.cpp +++ b/examples/multimedia/video/qmlvideofx/main.cpp @@ -116,16 +116,21 @@ int main(int argc, char *argv[]) FileReader fileReader; viewer.rootContext()->setContextProperty("fileReader", &fileReader); - QString imagePath = "../../images"; + QUrl appPath(QString("file:///%1").arg(app.applicationDirPath())); + QUrl imagePath; const QStringList picturesLocation = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); - if (!picturesLocation.isEmpty()) - imagePath = picturesLocation.first(); + if (picturesLocation.isEmpty()) + imagePath = appPath.resolved(QUrl("images")); + else + imagePath = QString("file:///%1").arg(picturesLocation.first()); viewer.rootContext()->setContextProperty("imagePath", imagePath); - QString videoPath; + QUrl videoPath; const QStringList moviesLocation = QStandardPaths::standardLocations(QStandardPaths::MoviesLocation); - if (!moviesLocation.isEmpty()) - videoPath = moviesLocation.first(); + if (moviesLocation.isEmpty()) + videoPath = appPath.resolved(QUrl("./")); + else + videoPath = QString("file:///%1").arg(moviesLocation.first()); viewer.rootContext()->setContextProperty("videoPath", videoPath); viewer.setTitle("qmlvideofx"); diff --git a/examples/multimedia/video/qmlvideofx/qml/qmlvideofx/FileBrowser.qml b/examples/multimedia/video/qmlvideofx/qml/qmlvideofx/FileBrowser.qml index e3de7e6..d61d35a 100644 --- a/examples/multimedia/video/qmlvideofx/qml/qmlvideofx/FileBrowser.qml +++ b/examples/multimedia/video/qmlvideofx/qml/qmlvideofx/FileBrowser.qml @@ -101,10 +101,11 @@ Rectangle { Rectangle { id: wrapper function launch() { + var path = "file:///" + filePath if (folders.isFolder(index)) - down(filePath); + down(path); else - fileBrowser.selectFile(filePath) + fileBrowser.selectFile(path) } width: root.width height: 52 -- 2.7.4