]> git.sesse.net Git - kdenlive/commitdiff
Round corners in project tree thumbnails
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 14 Oct 2012 22:27:34 +0000 (00:27 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 14 Oct 2012 22:27:34 +0000 (00:27 +0200)
src/clipproperties.cpp
src/projectlist.cpp
src/renderer.cpp

index b0b957093871f26f662cd2dc256dd880e823c82b..adb9ad44a982154b39eac0e3221e8f1ec54eb173 100644 (file)
@@ -42,6 +42,8 @@
 
 
 #include <QDir>
+#include <QPainter>
+
 
 static const int VIDEOTAB = 0;
 static const int AUDIOTAB = 1;
@@ -437,7 +439,17 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg
         int width = 180.0 * KdenliveSettings::project_display_ratio();
         if (width % 2 == 1) width++;
         QPixmap pix = m_clip->thumbProducer()->getImage(url, m_clip->getClipThumbFrame(), width, 180);
-        m_view.clip_thumb->setPixmap(pix);
+       QPixmap framedPix(pix.width(), pix.height());
+       framedPix.fill(Qt::transparent);
+       QPainter p(&framedPix);
+       p.setRenderHint(QPainter::Antialiasing, true);
+       QPainterPath path;
+       path.addRoundedRect(0.5, 0.5, framedPix.width() - 1, framedPix.height() - 1, 4, 4);
+       p.setClipPath(path);
+       p.drawPixmap(0, 0, pix);
+       p.end();
+       
+        m_view.clip_thumb->setPixmap(framedPix);
         if (t == IMAGE || t == VIDEO || t == PLAYLIST) m_view.tabWidget->removeTab(AUDIOTAB);
     } else {
         m_view.tabWidget->removeTab(IMAGETAB);
index c1a03f0647285a4edfd5749b251b00259cd29d34..069a58539a7c1e24e41139e63327d8ffe090efcb 100644 (file)
@@ -2316,7 +2316,15 @@ void ProjectList::slotReplyGetImage(const QString &clipId, const QImage &img)
 {
     ProjectItem *item = getItemById(clipId);
     if (item && !img.isNull()) {
-        QPixmap pix = QPixmap::fromImage(img);
+       QPixmap pix(img.width(), img.height());
+       pix.fill(Qt::transparent);
+       QPainter p(&pix);
+       p.setRenderHint(QPainter::Antialiasing, true);
+       QPainterPath path;
+       path.addRoundedRect(0.5, 0.5, pix.width() - 1, pix.height() - 1, 2, 2);
+       p.setClipPath(path);
+       p.drawImage(0, 0, img);
+       p.end();
         processThumbOverlays(item, pix);
         monitorItemEditing(false);
         item->setData(0, Qt::DecorationRole, pix);
index c163bb12bb6f8c5102d6264bcdd861b401f173ad..482384d8d3af9a5a6692a0468b014f0deaad3fe9 100644 (file)
@@ -128,7 +128,7 @@ Render::Render(Kdenlive::MONITORID rendererName, int winid, QString profile, QWi
     m_mltConsumer->connect(*m_mltProducer);
     m_mltProducer->set_speed(0.0);
     m_refreshTimer.setSingleShot(true);
-    m_refreshTimer.setInterval(70);
+    m_refreshTimer.setInterval(100);
     connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
     connect(this, SIGNAL(multiStreamFound(const QString &,QList<int>,QList<int>,stringMap)), this, SLOT(slotMultiStreamProducerFound(const QString &,QList<int>,QList<int>,stringMap)));
 }
@@ -1653,7 +1653,7 @@ void Render::refresh()
         return;
     if (m_mltConsumer) {
         if (m_mltConsumer->is_stopped()) m_mltConsumer->start();
-        m_mltConsumer->purge();
+        //m_mltConsumer->purge();
         m_mltConsumer->set("refresh", 1);
     }
 }