Fix for url bug in the qmlvideo examples.

In the FileBrowser paths where being prepended with file:///, since all
the paths already starts with a forward slash, navigating away from the
initial directory was therefore not possible.

To make the examples work on Android, QT += multimedia was added.

Change-Id: Iff96729d476c4292999b022bdd6d5770b6b011e7
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
This commit is contained in:
Christian Strømme
2013-06-12 17:49:08 +02:00
committed by The Qt Project
parent fca12620b1
commit ccc4138304
6 changed files with 9 additions and 9 deletions

View File

@@ -132,10 +132,10 @@ int main(int argc, char *argv[])
QUrl videoPath; QUrl videoPath;
const QStringList moviesLocation = QStandardPaths::standardLocations(QStandardPaths::MoviesLocation); const QStringList moviesLocation = QStandardPaths::standardLocations(QStandardPaths::MoviesLocation);
if (moviesLocation.isEmpty()) { if (moviesLocation.isEmpty()) {
QUrl appPath(QString("file:///%1").arg(app.applicationDirPath())); QUrl appPath(QString("file://%1").arg(app.applicationDirPath()));
videoPath = appPath.resolved(QUrl("./")); videoPath = appPath.resolved(QUrl("./"));
} else } else
videoPath = QString("file:///%1").arg(moviesLocation.first()); videoPath = QString("file://%1").arg(moviesLocation.first());
viewer.rootContext()->setContextProperty("videoPath", videoPath); viewer.rootContext()->setContextProperty("videoPath", videoPath);
QMetaObject::invokeMethod(rootObject, "init"); QMetaObject::invokeMethod(rootObject, "init");

View File

@@ -101,7 +101,7 @@ Rectangle {
Rectangle { Rectangle {
id: wrapper id: wrapper
function launch() { function launch() {
var path = "file:///" + filePath; var path = "file://" + filePath;
if (folders.isFolder(index)) if (folders.isFolder(index))
down(path); down(path);
else else

View File

@@ -1,7 +1,7 @@
TEMPLATE = app TEMPLATE = app
TARGET = qmlvideo TARGET = qmlvideo
QT += quick QT += quick multimedia
LOCAL_SOURCES = main.cpp LOCAL_SOURCES = main.cpp
LOCAL_HEADERS = trace.h LOCAL_HEADERS = trace.h

View File

@@ -116,13 +116,13 @@ int main(int argc, char *argv[])
FileReader fileReader; FileReader fileReader;
viewer.rootContext()->setContextProperty("fileReader", &fileReader); viewer.rootContext()->setContextProperty("fileReader", &fileReader);
QUrl appPath(QString("file:///%1").arg(app.applicationDirPath())); QUrl appPath(QString("file://%1").arg(app.applicationDirPath()));
QUrl imagePath; QUrl imagePath;
const QStringList picturesLocation = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); const QStringList picturesLocation = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
if (picturesLocation.isEmpty()) if (picturesLocation.isEmpty())
imagePath = appPath.resolved(QUrl("images")); imagePath = appPath.resolved(QUrl("images"));
else else
imagePath = QString("file:///%1").arg(picturesLocation.first()); imagePath = QString("file://%1").arg(picturesLocation.first());
viewer.rootContext()->setContextProperty("imagePath", imagePath); viewer.rootContext()->setContextProperty("imagePath", imagePath);
QUrl videoPath; QUrl videoPath;
@@ -130,7 +130,7 @@ int main(int argc, char *argv[])
if (moviesLocation.isEmpty()) if (moviesLocation.isEmpty())
videoPath = appPath.resolved(QUrl("./")); videoPath = appPath.resolved(QUrl("./"));
else else
videoPath = QString("file:///%1").arg(moviesLocation.first()); videoPath = QString("file://%1").arg(moviesLocation.first());
viewer.rootContext()->setContextProperty("videoPath", videoPath); viewer.rootContext()->setContextProperty("videoPath", videoPath);
viewer.setTitle("qmlvideofx"); viewer.setTitle("qmlvideofx");

View File

@@ -102,7 +102,7 @@ Rectangle {
Rectangle { Rectangle {
id: wrapper id: wrapper
function launch() { function launch() {
var path = "file:///" + filePath var path = "file://" + filePath
if (folders.isFolder(index)) if (folders.isFolder(index))
down(path); down(path);
else else

View File

@@ -1,7 +1,7 @@
TEMPLATE = app TEMPLATE = app
TARGET = qmlvideofx TARGET = qmlvideofx
QT += quick QT += quick multimedia
SOURCES += filereader.cpp main.cpp SOURCES += filereader.cpp main.cpp
HEADERS += filereader.h trace.h HEADERS += filereader.h trace.h