]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/information/informationpanelcontent.cpp
Add missing includes
[dolphin.git] / src / panels / information / informationpanelcontent.cpp
index b051603fd807242d198c574b0968af1394d04958..5c7c7c3f158936286b187716e9a2a4e688e3ff0e 100644 (file)
@@ -27,6 +27,7 @@
 #include <KLocalizedString>
 #include <KSeparator>
 #include <KStringHandler>
+#include <QPainterPath>
 
 #include <QIcon>
 #include <QTextDocument>
@@ -166,11 +167,13 @@ InformationPanelContent::~InformationPanelContent()
 
 void InformationPanelContent::showItem(const KFileItem& item)
 {
-    if (item != m_item) {
+    // compares item entries, comparing items only compares urls
+    if (m_item.entry() != item.entry()) {
         m_item = item;
-
+        m_preview->stopAnimatedImage();
         refreshMetaData();
     }
+
     refreshPreview();
 }
 
@@ -230,14 +233,15 @@ void InformationPanelContent::refreshPreview()
             // in the case of a search-URL the URL is not readable for humans
             // (at least not useful to show in the Information Panel)
             m_preview->setPixmap(
-                QIcon::fromTheme(QStringLiteral("nepomuk")).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous)
+                QIcon::fromTheme(QStringLiteral("baloo")).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous)
             );
         } else {
 
             refreshPixmapView();
 
             const QString mimeType = m_item.mimetype();
-            m_isVideo = mimeType.startsWith(QLatin1String("video/"));
+            const bool isAnimatedImage = m_preview->isAnimatedImage(itemUrl.toLocalFile());
+            m_isVideo = !isAnimatedImage && mimeType.startsWith(QLatin1String("video/"));
             usePhonon = m_isVideo || mimeType.startsWith(QLatin1String("audio/"));
 
             if (usePhonon) {
@@ -268,6 +272,9 @@ void InformationPanelContent::refreshPreview()
                     adjustWidgetSizes(parentWidget()->width());
                 }
             } else {
+                if (isAnimatedImage) {
+                    m_preview->setAnimatedImageFileName(itemUrl.toLocalFile());
+                }
                 // When we don't need it, hide the phonon widget first to avoid flickering
                 m_phononWidget->hide();
                 m_preview->show();
@@ -276,6 +283,7 @@ void InformationPanelContent::refreshPreview()
             }
         }
     } else {
+        m_preview->stopAnimatedImage();
         m_preview->hide();
         m_phononWidget->hide();
     }
@@ -303,6 +311,8 @@ void InformationPanelContent::showItems(const KFileItemList& items)
         m_previewJob->kill();
     }
 
+    m_preview->stopAnimatedImage();
+
     m_preview->setPixmap(
         QIcon::fromTheme(QStringLiteral("dialog-information")).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous)
     );