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,6 +39,7 @@
**
****************************************************************************/
#include <QtCore/QStandardPaths>
#include <QtCore/QStringList>
#include <QtDeclarative/QDeclarativeContext>
#include <QtGui/QGuiApplication>
@@ -116,6 +117,18 @@ int main(int argc, char *argv[])
FileReader fileReader;
viewer.rootContext()->setContextProperty("fileReader", &fileReader);
QString imagePath = "../../images";
const QStringList picturesLocation = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
if (!picturesLocation.isEmpty())
imagePath = picturesLocation.first();
viewer.rootContext()->setContextProperty("imagePath", imagePath);
QString videoPath;
const QStringList moviesLocation = QStandardPaths::standardLocations(QStandardPaths::MoviesLocation);
if (!moviesLocation.isEmpty())
videoPath = moviesLocation.first();
viewer.rootContext()->setContextProperty("videoPath", videoPath);
#ifdef SMALL_SCREEN_PHYSICAL
viewer.showFullScreen();
#else