diff options
-rw-r--r-- | demos/embedded/fluidlauncher/config_s60/config.xml | 2 | ||||
-rw-r--r-- | demos/mediaplayer/main.cpp | 26 | ||||
-rw-r--r-- | demos/mediaplayer/mediaplayer.cpp | 22 | ||||
-rw-r--r-- | demos/mediaplayer/mediaplayer.h | 4 |
4 files changed, 41 insertions, 13 deletions
diff --git a/demos/embedded/fluidlauncher/config_s60/config.xml b/demos/embedded/fluidlauncher/config_s60/config.xml index 68c3f2f..fefa3dd 100644 --- a/demos/embedded/fluidlauncher/config_s60/config.xml +++ b/demos/embedded/fluidlauncher/config_s60/config.xml @@ -20,7 +20,7 @@ <example filename="weatherinfo" name="Weather Info" image="screenshots/weatherinfo.png"/> <example filename="flickable" name="Kinetic Scrolling" image="screenshots/flickable.png"/> <example filename="digiflip" name="Flipping Clock" image="screenshots/digiflip.png"/> - <example filename="qmediaplayer" name="Media Player" image="screenshots/mediaplayer.png"/> + <example filename="qmediaplayer" name="Media Player" image="screenshots/mediaplayer.png" args="-small-screen"/> </demos> <slideshow timeout="60000" interval="10000"> <imagedir dir="slides"/> diff --git a/demos/mediaplayer/main.cpp b/demos/mediaplayer/main.cpp index fd1431d..a5bcee2 100644 --- a/demos/mediaplayer/main.cpp +++ b/demos/mediaplayer/main.cpp @@ -51,8 +51,30 @@ int main (int argc, char *argv[]) app.setQuitOnLastWindowClosed(true); QString fileString = app.arguments().value(1); - MediaPlayer player(fileString); - player.show(); + + bool hasSmallScreen = +#ifdef Q_OS_SYMBIAN + /* On Symbian, we always want fullscreen. One reason is that it's not + * possible to launch any demos from the fluidlauncher due to a + * limitation in the emulator. */ + true +#else + false +#endif + ; + + const QStringList args(app.arguments()); + for (int i = 0; i < args.count(); ++i) { + if (args.at(i) == QLatin1String("-small-screen")) + hasSmallScreen = true; + } + + MediaPlayer player(fileString, hasSmallScreen); + + if (hasSmallScreen) + player.showMaximized(); + else + player.show(); return app.exec(); } diff --git a/demos/mediaplayer/mediaplayer.cpp b/demos/mediaplayer/mediaplayer.cpp index 8dd0609..5d9a793 100644 --- a/demos/mediaplayer/mediaplayer.cpp +++ b/demos/mediaplayer/mediaplayer.cpp @@ -147,10 +147,12 @@ private: }; -MediaPlayer::MediaPlayer(const QString &filePath) : +MediaPlayer::MediaPlayer(const QString &filePath, + const bool hasSmallScreen) : playButton(0), nextEffect(0), settingsDialog(0), ui(0), m_AudioOutput(Phonon::VideoCategory), - m_videoWidget(new MediaVideoWidget(this)) + m_videoWidget(new MediaVideoWidget(this)), + m_hasSmallScreen(hasSmallScreen) { setWindowTitle(tr("Media Player")); setContextMenuPolicy(Qt::CustomContextMenu); @@ -341,13 +343,15 @@ void MediaPlayer::stateChanged(Phonon::State newstate, Phonon::State oldstate) info->setVisible(!m_MediaObject.hasVideo()); QRect videoHintRect = QRect(QPoint(0, 0), m_videoWindow.sizeHint()); QRect newVideoRect = QApplication::desktop()->screenGeometry().intersected(videoHintRect); - if (m_MediaObject.hasVideo()){ - // Flush event que so that sizeHint takes the - // recently shown/hidden m_videoWindow into account: - qApp->processEvents(); - resize(sizeHint()); - } else - resize(minimumSize()); + if (!m_hasSmallScreen) { + if (m_MediaObject.hasVideo()) { + // Flush event que so that sizeHint takes the + // recently shown/hidden m_videoWindow into account: + qApp->processEvents(); + resize(sizeHint()); + } else + resize(minimumSize()); + } } switch (newstate) { diff --git a/demos/mediaplayer/mediaplayer.h b/demos/mediaplayer/mediaplayer.h index 38ace26..40ffa40 100644 --- a/demos/mediaplayer/mediaplayer.h +++ b/demos/mediaplayer/mediaplayer.h @@ -72,7 +72,8 @@ class MediaPlayer : { Q_OBJECT public: - MediaPlayer(const QString &); + MediaPlayer(const QString &, + const bool hasSmallScreen); void dragEnterEvent(QDragEnterEvent *e); void dragMoveEvent(QDragMoveEvent *e); @@ -132,6 +133,7 @@ private: Phonon::AudioOutput m_AudioOutput; Phonon::VideoWidget *m_videoWidget; Phonon::Path m_audioOutputPath; + const bool m_hasSmallScreen; }; #endif //MEDIAPLAYER_H |