Changeset 846 for trunk/demos/qmediaplayer/main.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/demos/qmediaplayer/main.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 43 43 #include "mediaplayer.h" 44 44 45 46 45 47 int main (int argc, char *argv[]) 46 48 { … … 51 53 app.setQuitOnLastWindowClosed(true); 52 54 53 bool hasSmallScreen = 55 QString fileName; 56 qreal volume = DefaultVolume; 57 bool smallScreen = false; 54 58 #ifdef Q_OS_SYMBIAN 55 /* On Symbian, we always want fullscreen. One reason is that it's not 56 * possible to launch any demos from the fluidlauncher due to a 57 * limitation in the emulator. */ 58 true 59 #else 60 false 59 smallScreen = true; 61 60 #endif 62 ;63 61 64 QString fileString; 65 const QStringList args(app.arguments()); 66 /* We have a minor problem here, we accept two arguments, both are 67 * optional: 68 * - A file name 69 * - the option "-small-screen", so let's try to cope with that. 70 */ 71 for (int i = 0; i < args.count(); ++i) { 72 const QString &at = args.at(i); 73 74 if (at == QLatin1String("-small-screen")) 75 hasSmallScreen = true; 76 else if (i > 0) // We don't want the app name. 77 fileString = at; 62 QStringList args(app.arguments()); 63 args.removeFirst(); // remove name of executable 64 while (!args.empty()) { 65 const QString &arg = args.first(); 66 if (QLatin1String("-small-screen") == arg || QLatin1String("--small-screen") == arg) { 67 smallScreen = true; 68 } else if (QLatin1String("-volume") == arg || QLatin1String("--volume") == arg) { 69 if (!args.empty()) { 70 args.removeFirst(); 71 volume = qMax(qMin(args.first().toFloat(), float(1.0)), float(0.0)); 72 } 73 } else if (fileName.isNull()) { 74 fileName = arg; 75 } 76 args.removeFirst(); 78 77 } 79 78 80 MediaPlayer player(fileString, hasSmallScreen); 79 MediaPlayer player; 80 player.setSmallScreen(smallScreen); 81 if (DefaultVolume != volume) 82 player.setVolume(volume); 83 if (!fileName.isNull()) 84 player.setFile(fileName); 81 85 82 if ( hasSmallScreen)86 if (mallScreen) 83 87 player.showMaximized(); 84 88 else
Note:
See TracChangeset
for help on using the changeset viewer.