From: Flavio Tordini Date: Wed, 4 Nov 2009 23:34:49 +0000 (+0100) Subject: Prettier playlist borders X-Git-Tag: 0.8~27 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=95fbdc027cd9db7a13e97c104c72c60b68110349;p=minitube Prettier playlist borders Don't draw time when there's no thumb --- 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();