From 95fbdc027cd9db7a13e97c104c72c60b68110349 Mon Sep 17 00:00:00 2001 From: Flavio Tordini Date: Thu, 5 Nov 2009 00:34:49 +0100 Subject: [PATCH] Prettier playlist borders Don't draw time when there's no thumb --- src/playlist/PrettyItemDelegate.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/playlist/PrettyItemDelegate.cpp b/src/playlist/PrettyItemDelegate.cpp index c916d0d..5c55ebf 100644 --- a/src/playlist/PrettyItemDelegate.cpp +++ b/src/playlist/PrettyItemDelegate.cpp @@ -89,16 +89,17 @@ void PrettyItemDelegate::paintBody( QPainter* painter, // play icon overlayed on the thumb if (isActive) paintPlayIcon(painter); - } - // time - QString timeString; - int duration = video->duration(); - if ( duration > 3600 ) - timeString = QTime().addSecs(duration).toString("h:mm:ss"); - else - timeString = QTime().addSecs(duration).toString("m:ss"); - drawTime(painter, timeString, line); + // time + QString timeString; + int duration = video->duration(); + if ( duration > 3600 ) + timeString = QTime().addSecs(duration).toString("h:mm:ss"); + else + timeString = QTime().addSecs(duration).toString("m:ss"); + drawTime(painter, timeString, line); + + } if (isActive) painter->setFont(boldFont); const QFontMetricsF fm(painter->font()); @@ -164,7 +165,10 @@ void PrettyItemDelegate::paintBody( QPainter* painter, // separator painter->setPen(option.palette.color(QPalette::Midlight)); - painter->drawLine(0, THUMB_HEIGHT, line.width(), THUMB_HEIGHT); + painter->drawLine(THUMB_WIDTH, THUMB_HEIGHT, line.width(), THUMB_HEIGHT); + if (!video->thumbnail().isNull()) + painter->setPen(Qt::black); + painter->drawLine(0, THUMB_HEIGHT, THUMB_WIDTH, THUMB_HEIGHT); painter->restore(); -- 2.39.5