diff options
author | David Boddie <dboddie@trolltech.com> | 2009-11-19 13:53:04 (GMT) |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2009-11-19 13:53:04 (GMT) |
commit | 4e53466f63bf05e90a69f80fda8580dabc1e9ed0 (patch) | |
tree | 0978f427af78291d8dd16004cc4ca33dbe1af433 /demos/qmediaplayer | |
parent | 5bd71902f97ba75dc93ccf709dbfdd2ffeb361b2 (diff) | |
parent | fbbdf8698fb0444d5170b7d0a14e870ea789398f (diff) | |
download | Qt-4e53466f63bf05e90a69f80fda8580dabc1e9ed0.zip Qt-4e53466f63bf05e90a69f80fda8580dabc1e9ed0.tar.gz Qt-4e53466f63bf05e90a69f80fda8580dabc1e9ed0.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6
Diffstat (limited to 'demos/qmediaplayer')
-rw-r--r-- | demos/qmediaplayer/mediaplayer.cpp | 31 | ||||
-rw-r--r-- | demos/qmediaplayer/mediaplayer.h | 2 |
2 files changed, 27 insertions, 6 deletions
diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 624bab7..4021352 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -270,7 +270,7 @@ MediaPlayer::MediaPlayer(const QString &filePath, fileMenu->addSeparator(); QMenu *aspectMenu = fileMenu->addMenu(tr("&Aspect ratio")); QActionGroup *aspectGroup = new QActionGroup(aspectMenu); - connect(aspectGroup, SIGNAL(triggered(QAction *)), this, SLOT(aspectChanged(QAction *))); + connect(aspectGroup, SIGNAL(triggered(QAction*)), this, SLOT(aspectChanged(QAction*))); aspectGroup->setExclusive(true); QAction *aspectActionAuto = aspectMenu->addAction(tr("Auto")); aspectActionAuto->setCheckable(true); @@ -288,7 +288,7 @@ MediaPlayer::MediaPlayer(const QString &filePath, QMenu *scaleMenu = fileMenu->addMenu(tr("&Scale mode")); QActionGroup *scaleGroup = new QActionGroup(scaleMenu); - connect(scaleGroup, SIGNAL(triggered(QAction *)), this, SLOT(scaleChanged(QAction *))); + connect(scaleGroup, SIGNAL(triggered(QAction*)), this, SLOT(scaleChanged(QAction*))); scaleGroup->setExclusive(true); QAction *scaleActionFit = scaleMenu->addAction(tr("Fit in view")); scaleActionFit->setCheckable(true); @@ -313,13 +313,13 @@ MediaPlayer::MediaPlayer(const QString &filePath, connect(openUrlAction, SIGNAL(triggered(bool)), this, SLOT(openUrl())); connect(openFileAction, SIGNAL(triggered(bool)), this, SLOT(openFile())); - connect(m_videoWidget, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(showContextMenu(const QPoint &))); - connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(showContextMenu(const QPoint &))); + connect(m_videoWidget, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showContextMenu(QPoint))); + connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showContextMenu(QPoint))); connect(&m_MediaObject, SIGNAL(metaDataChanged()), this, SLOT(updateInfo())); connect(&m_MediaObject, SIGNAL(totalTimeChanged(qint64)), this, SLOT(updateTime())); connect(&m_MediaObject, SIGNAL(tick(qint64)), this, SLOT(updateTime())); connect(&m_MediaObject, SIGNAL(finished()), this, SLOT(finished())); - connect(&m_MediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), this, SLOT(stateChanged(Phonon::State, Phonon::State))); + connect(&m_MediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(stateChanged(Phonon::State,Phonon::State))); connect(&m_MediaObject, SIGNAL(bufferStatus(int)), this, SLOT(bufferStatus(int))); connect(&m_MediaObject, SIGNAL(hasVideoChanged(bool)), this, SLOT(hasVideoChanged(bool))); @@ -355,13 +355,13 @@ void MediaPlayer::stateChanged(Phonon::State newstate, Phonon::State oldstate) switch (newstate) { case Phonon::ErrorState: - QMessageBox::warning(this, "Phonon Mediaplayer", m_MediaObject.errorString(), QMessageBox::Close); if (m_MediaObject.errorType() == Phonon::FatalError) { playButton->setEnabled(false); rewindButton->setEnabled(false); } else { m_MediaObject.pause(); } + QMessageBox::warning(this, "Phonon Mediaplayer", m_MediaObject.errorString(), QMessageBox::Close); break; case Phonon::PausedState: case Phonon::StoppedState: @@ -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; |