summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-10-02 14:10:52 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-10-02 14:10:52 (GMT)
commit4ec4b249c927694be69084582fa32333f21546d6 (patch)
treed39e865035c34eca605edb3cf2e63997ee289e3e /demos
parent71253c45fbc039a2a86981749283822c65bd98bb (diff)
downloadQt-4ec4b249c927694be69084582fa32333f21546d6.zip
Qt-4ec4b249c927694be69084582fa32333f21546d6.tar.gz
Qt-4ec4b249c927694be69084582fa32333f21546d6.tar.bz2
Ensure we can handle file names on the cmdline too.
Diffstat (limited to 'demos')
-rw-r--r--demos/mediaplayer/main.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/demos/mediaplayer/main.cpp b/demos/mediaplayer/main.cpp
index a5bcee2..66aa445 100644
--- a/demos/mediaplayer/main.cpp
+++ b/demos/mediaplayer/main.cpp
@@ -50,8 +50,6 @@ int main (int argc, char *argv[])
app.setOrganizationName("Qt");
app.setQuitOnLastWindowClosed(true);
- QString fileString = app.arguments().value(1);
-
bool hasSmallScreen =
#ifdef Q_OS_SYMBIAN
/* On Symbian, we always want fullscreen. One reason is that it's not
@@ -63,10 +61,20 @@ int main (int argc, char *argv[])
#endif
;
+ QString fileString;
const QStringList args(app.arguments());
+ /* We have a minor problem here, we accept two arguments, both are
+ * optional:
+ * - A file name
+ * - the option "-small-screen", so let's try to cope with that.
+ */
for (int i = 0; i < args.count(); ++i) {
- if (args.at(i) == QLatin1String("-small-screen"))
+ const QString &at = args.at(i);
+
+ if (at == QLatin1String("-small-screen"))
hasSmallScreen = true;
+ else if (i > 0) // We don't want the app name.
+ fileString = at;
}
MediaPlayer player(fileString, hasSmallScreen);