┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/information/informationpanelcontent.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-05-19 22:27:53 +0200
committerPeter Penz <[email protected]>2012-05-19 22:30:31 +0200
commitc318a3da6c79c35b4d3ba3043d71228cbeda64f8 (patch)
treeb4cec1654cc109e381b4ac60e1daac4bb550b0f7 /src/panels/information/informationpanelcontent.cpp
parente9d29bcf30ccbd7c76ba37ce9efcfac1649fc46e (diff)
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
Diffstat (limited to 'src/panels/information/informationpanelcontent.cpp')
-rw-r--r--src/panels/information/informationpanelcontent.cpp23
1 files changed, 6 insertions, 17 deletions
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));
}