diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2012-02-06 16:10:15 +0000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-08 22:30:34 +0100 |
commit | b6f54c8833347ddb13b12cfd682cd12de72664d8 (patch) | |
tree | 03b4f97059c532c769039343f5687cea4e46faf3 /examples/video/qmlvideofx/qml/qmlvideofx/main-largescreen.qml | |
parent | 87ec3461c135990f9e01d7cb71bc6016c3538db1 (diff) |
Tidy up file browsing in video examples
* Use QStandardPaths to determine the initial folder displayed when
the file browser is launched
* Persist folder between file browser invocations
Change-Id: I5b86dd3d304c3f33802f3189716e1d360774198d
Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Diffstat (limited to 'examples/video/qmlvideofx/qml/qmlvideofx/main-largescreen.qml')
-rw-r--r-- | examples/video/qmlvideofx/qml/qmlvideofx/main-largescreen.qml | 51 |
1 files changed, 16 insertions, 35 deletions
diff --git a/examples/video/qmlvideofx/qml/qmlvideofx/main-largescreen.qml b/examples/video/qmlvideofx/qml/qmlvideofx/main-largescreen.qml index 6d643a1e2..d7e1b12f1 100644 --- a/examples/video/qmlvideofx/qml/qmlvideofx/main-largescreen.qml +++ b/examples/video/qmlvideofx/qml/qmlvideofx/main-largescreen.qml @@ -51,11 +51,6 @@ Rectangle { property bool perfMonitorsLogging: false property bool perfMonitorsVisible: false - QtObject { - id: d - property string openFileType - } - Rectangle { id: inner anchors.fill: parent @@ -131,8 +126,16 @@ Rectangle { } } - Loader { - id: fileBrowserLoader + FileBrowser { + id: imageFileBrowser + anchors.fill: root + Component.onCompleted: fileSelected.connect(content.openImage) + } + + FileBrowser { + id: videoFileBrowser + anchors.fill: root + Component.onCompleted: fileSelected.connect(content.openVideo) } Component.onCompleted: { @@ -144,12 +147,12 @@ Rectangle { function init() { console.log("[qmlvideofx] main.init") + imageFileBrowser.folder = imagePath + videoFileBrowser.folder = videoPath content.init() performanceLoader.init() - if (fileName != "") { - d.openFileType = "video" - openFile(fileName) - } + if (fileName != "") + content.openVideo(fileName) } function qmlFramePainted() { @@ -158,13 +161,11 @@ Rectangle { } function openImage() { - d.openFileType = "image" - showFileBrowser("../../images") + imageFileBrowser.show() } function openVideo() { - d.openFileType = "video" - showFileBrowser("../../videos") + videoFileBrowser.show() } function openCamera() { @@ -174,24 +175,4 @@ Rectangle { function close() { content.openImage("qrc:/images/qt-logo.png") } - - function showFileBrowser(path) { - fileBrowserLoader.source = "FileBrowser.qml" - fileBrowserLoader.item.parent = root - fileBrowserLoader.item.anchors.fill = root - fileBrowserLoader.item.openFile.connect(root.openFile) - fileBrowserLoader.item.folder = path - inner.visible = false - } - - function openFile(path) { - fileBrowserLoader.source = "" - if (path != "") { - if (d.openFileType == "image") - content.openImage(path) - else if (d.openFileType == "video") - content.openVideo(path) - } - inner.visible = true - } } |