summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrans Englich <frans.englich@nokia.com>2009-11-16 13:41:57 (GMT)
committerFrans Englich <frans.englich@nokia.com>2009-11-16 14:07:21 (GMT)
commit1bc673c89155119d110861efbc7b6b7b06091b39 (patch)
treeec34e2a3afb6ba5cf184afd26d543a2bed81d0e7
parent6df2f295c7efddac12de87f8bfa347ab28761a6b (diff)
downloadQt-1bc673c89155119d110861efbc7b6b7b06091b39.zip
Qt-1bc673c89155119d110861efbc7b6b7b06091b39.tar.gz
Qt-1bc673c89155119d110861efbc7b6b7b06091b39.tar.bz2
qmediaplayer: pausing behavior for dialog inconvenient.
qmediaplayer when popping up dialogs shouldn't: * play when it's paused * pause when playing only audio Task-number: QTBUG-5851 Reviewed-by: Gareth Stockwell
-rw-r--r--demos/qmediaplayer/mediaplayer.cpp28
-rw-r--r--demos/qmediaplayer/mediaplayer.h2
2 files changed, 18 insertions, 12 deletions
diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp
index 267a225..aa716c5 100644
--- a/demos/qmediaplayer/mediaplayer.cpp
+++ b/demos/qmediaplayer/mediaplayer.cpp
@@ -471,7 +471,7 @@ void MediaPlayer::effectChanged()
void MediaPlayer::showSettingsDialog()
{
- playPauseForDialog();
+ const bool hasPausedForDialog = playPauseForDialog();
if (!settingsDialog)
initSettingsDialog();
@@ -519,7 +519,8 @@ void MediaPlayer::showSettingsDialog()
ui->audioEffectsCombo->setCurrentIndex(currentEffect);
}
- playPauseForDialog();
+ if (hasPausedForDialog)
+ m_MediaObject.play();
}
void MediaPlayer::initVideoWindow()
@@ -656,24 +657,29 @@ void MediaPlayer::setFile(const QString &fileName)
m_MediaObject.play();
}
-void MediaPlayer::playPauseForDialog()
+bool 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();
+ // If we're running on a small screen, we want to pause the video when
+ // popping up dialogs. We neither want to tamper with the state if the
+ // user has paused.
+ if (m_hasSmallScreen && m_MediaObject.hasVideo()) {
+ if (Phonon::PlayingState == m_MediaObject.state()) {
+ m_MediaObject.pause();
+ return true;
+ }
+ }
+ return false;
}
void MediaPlayer::openFile()
{
- playPauseForDialog();
+ const bool hasPausedForDialog = playPauseForDialog();
QStringList fileNames = QFileDialog::getOpenFileNames(this, QString(),
QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
- playPauseForDialog();
+ if (hasPausedForDialog)
+ m_MediaObject.play();
m_MediaObject.clearQueue();
if (fileNames.size() > 0) {
diff --git a/demos/qmediaplayer/mediaplayer.h b/demos/qmediaplayer/mediaplayer.h
index a1c3d92..c181e37 100644
--- a/demos/qmediaplayer/mediaplayer.h
+++ b/demos/qmediaplayer/mediaplayer.h
@@ -111,7 +111,7 @@ private slots:
void hasVideoChanged(bool);
private:
- void playPauseForDialog();
+ bool playPauseForDialog();
QIcon playIcon;
QIcon pauseIcon;