From c318a3da6c79c35b4d3ba3043d71228cbeda64f8 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 19 May 2012 22:27:53 +0200 Subject: Show video previews according to file content instead of the mimetype-string Show a video widget depending on the video content instead of the mimetype string: There are container formats which can be either audios or videos. Besides, the rmvb video files have a mimetype of "application/vnd.rn-realmedia", and these files can be recognized as videos correctly now. The patch has been provided by Hui Ni. REVIEW: 104988 FIXED-IN: 4.9 --- src/panels/information/informationpanelcontent.cpp | 23 ++++++---------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'src/panels/information/informationpanelcontent.cpp') diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index 4a96bd1b6..1cbe0cd31 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -90,10 +90,8 @@ InformationPanelContent::InformationPanelContent(QWidget* parent) : m_phononWidget = new PhononWidget(parent); m_phononWidget->hide(); m_phononWidget->setMinimumWidth(minPreviewWidth); - connect(m_phononWidget, SIGNAL(playingStarted()), - this, SLOT(slotPlayingStarted())); - connect(m_phononWidget, SIGNAL(playingStopped()), - this, SLOT(slotPlayingStopped())); + connect(m_phononWidget, SIGNAL(hasVideoChanged(bool)), + this, SLOT(slotHasVideoChanged(bool))); // name m_nameLabel = new QLabel(parent); @@ -200,12 +198,8 @@ void InformationPanelContent::showItem(const KFileItem& item) // thinks it supports PNG images if (usePhonon) { m_phononWidget->show(); - PhononWidget::Mode mode = mimeType.startsWith(QLatin1String("video")) - ? PhononWidget::Video - : PhononWidget::Audio; - m_phononWidget->setMode(mode); m_phononWidget->setUrl(item.targetUrl()); - if ((mode == PhononWidget::Video) && m_preview->isVisible()) { + if (m_preview->isVisible()) { m_phononWidget->setVideoSize(m_preview->size()); } } else { @@ -338,14 +332,9 @@ void InformationPanelContent::markOutdatedPreview() m_preview->setPixmap(disabledPixmap); } -void InformationPanelContent::slotPlayingStarted() +void InformationPanelContent::slotHasVideoChanged(bool hasVideo) { - m_preview->setVisible(m_phononWidget->mode() != PhononWidget::Video); -} - -void InformationPanelContent::slotPlayingStopped() -{ - m_preview->setVisible(true); + m_preview->setVisible(!hasVideo); } void InformationPanelContent::refreshMetaData() @@ -423,7 +412,7 @@ void InformationPanelContent::adjustWidgetSizes(int width) // try to increase the preview as large as possible m_preview->setSizeHint(QSize(maxWidth, maxWidth)); - if (m_phononWidget->isVisible() && (m_phononWidget->mode() == PhononWidget::Video)) { + if (m_phononWidget->isVisible()) { // assure that the size of the video player is the same as the preview size m_phononWidget->setVideoSize(QSize(maxWidth, maxWidth)); } -- cgit v1.3