summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-11-11 15:39:27 +0100
committerFrans Englich <frans.englich@nokia.com>2009-11-12 11:23:47 +0100
commitb880e4d85caf17e43eb3bd4c9f358ca6f181a790 (patch)
treeda601adaee0e07bd74d1b51235dd4f111fb9e101 /demos
parentdc939f3cf536838ce51620e3450f9be66cb1e32a (diff)
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
Diffstat (limited to 'demos')
-rw-r--r--demos/qmediaplayer/mediaplayer.cpp19
-rw-r--r--demos/qmediaplayer/mediaplayer.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp
index 8a5420fc0c..267a22526a 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 08db0e5de6..a1c3d92dae 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;