diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-11-11 14:39:27 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-11-12 10:23:47 (GMT) |
commit | b880e4d85caf17e43eb3bd4c9f358ca6f181a790 (patch) | |
tree | da601adaee0e07bd74d1b51235dd4f111fb9e101 | |
parent | dc939f3cf536838ce51620e3450f9be66cb1e32a (diff) | |
download | Qt-b880e4d85caf17e43eb3bd4c9f358ca6f181a790.zip Qt-b880e4d85caf17e43eb3bd4c9f358ca6f181a790.tar.gz Qt-b880e4d85caf17e43eb3bd4c9f358ca6f181a790.tar.bz2 |
Pause playback on small screens when popping up dialogs.
Only done for small screens. Patch simplified by Gareth.
Task-number: QTBUG-5307
Reviewed-by: Gareth Stockwell
-rw-r--r-- | demos/qmediaplayer/mediaplayer.cpp | 19 | ||||
-rw-r--r-- | demos/qmediaplayer/mediaplayer.h | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 8a5420f..267a225 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -471,6 +471,8 @@ void MediaPlayer::effectChanged() void MediaPlayer::showSettingsDialog() { + playPauseForDialog(); + if (!settingsDialog) initSettingsDialog(); @@ -516,6 +518,8 @@ void MediaPlayer::showSettingsDialog() m_videoWidget->setScaleMode(oldScale); ui->audioEffectsCombo->setCurrentIndex(currentEffect); } + + playPauseForDialog(); } void MediaPlayer::initVideoWindow() @@ -652,10 +656,25 @@ void MediaPlayer::setFile(const QString &fileName) m_MediaObject.play(); } +void MediaPlayer::playPauseForDialog() +{ + // If we're running on a small screen, we want to pause the video + // when popping up dialogs. + if (m_hasSmallScreen && + (Phonon::PlayingState == m_MediaObject.state() || + Phonon::PausedState == m_MediaObject.state())) + playPause(); +} + void MediaPlayer::openFile() { + playPauseForDialog(); + QStringList fileNames = QFileDialog::getOpenFileNames(this, QString(), QDesktopServices::storageLocation(QDesktopServices::MusicLocation)); + + playPauseForDialog(); + m_MediaObject.clearQueue(); if (fileNames.size() > 0) { QString fileName = fileNames[0]; diff --git a/demos/qmediaplayer/mediaplayer.h b/demos/qmediaplayer/mediaplayer.h index 08db0e5..a1c3d92 100644 --- a/demos/qmediaplayer/mediaplayer.h +++ b/demos/qmediaplayer/mediaplayer.h @@ -111,6 +111,8 @@ private slots: void hasVideoChanged(bool); private: + void playPauseForDialog(); + QIcon playIcon; QIcon pauseIcon; QMenu *fileMenu; |