]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/information/phononwidget.cpp
Merge branch 'Applications/14.12' into frameworks
[dolphin.git] / src / panels / information / phononwidget.cpp
index 0de587bf8c56073c47fb22d739691252949a7116..215be200a1daa990f1a380aef15ed5d9cadf6022 100644 (file)
@@ -166,6 +166,12 @@ void PhononWidget::stateChanged(Phonon::State newstate)
         m_stopButton->show();
         m_playButton->hide();
         break;
+    case Phonon::StoppedState:
+        if (m_videoPlayer) {
+            m_videoPlayer->hide();
+        }
+        emit hasVideoChanged(false);
+        // fall through
     default:
         m_stopButton->hide();
         m_playButton->show();
@@ -185,6 +191,13 @@ void PhononWidget::play()
         m_seekSlider->setMediaObject(m_media);
     }
 
+    if (!m_videoPlayer) {
+        m_videoPlayer = new EmbeddedVideoPlayer(this);
+        m_topLayout->insertWidget(0, m_videoPlayer);
+        Phonon::createPath(m_media, m_videoPlayer);
+        applyVideoSize();
+    }
+
     if (!m_audioOutput) {
         m_audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
         Phonon::createPath(m_media, m_audioOutput);
@@ -201,16 +214,7 @@ void PhononWidget::stop()
 {
     if (m_media) {
         m_media->stop();
-
-        m_stopButton->hide();
-        m_playButton->show();
     }
-
-    if (m_videoPlayer) {
-        m_videoPlayer->hide();
-    }
-
-    emit hasVideoChanged(false);
 }
 
 void PhononWidget::slotHasVideoChanged(bool hasVideo)
@@ -218,15 +222,6 @@ void PhononWidget::slotHasVideoChanged(bool hasVideo)
     emit hasVideoChanged(hasVideo);
 
     if (hasVideo) {
-        if (!m_videoPlayer) {
-            // Replay the media to apply path changes
-            m_media->stop();
-            m_videoPlayer = new EmbeddedVideoPlayer(this);
-            m_topLayout->insertWidget(0, m_videoPlayer);
-            Phonon::createPath(m_media, m_videoPlayer);
-            m_media->play();
-        }
-        applyVideoSize();
         m_videoPlayer->show();
     }
 }