diff options
-rw-r--r-- | demos/mediaplayer/main.cpp | 14 |
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); |