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>
This commit is contained in:
Gareth Stockwell
2012-02-06 16:10:15 +00:00
committed by Qt by Nokia
parent 87ec3461c1
commit b6f54c8833
7 changed files with 680 additions and 640 deletions

View File

@@ -39,8 +39,10 @@
**
****************************************************************************/
#include <QtCore/QStandardPaths>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtDeclarative/QDeclarativeContext>
#include <QtGui/QGuiApplication>
#include <QtQuick/QQuickItem>
#include "qmlapplicationviewer.h"
@@ -124,6 +126,12 @@ int main(int argc, char *argv[])
rootObject, SLOT(qmlFramePainted()));
#endif
QString videoPath;
const QStringList moviesLocation = QStandardPaths::standardLocations(QStandardPaths::MoviesLocation);
if (!moviesLocation.isEmpty())
videoPath = moviesLocation.first();
viewer.rootContext()->setContextProperty("videoPath", videoPath);
QMetaObject::invokeMethod(rootObject, "init");
viewer.showExpanded();