#include "playlistmodel.h"
#include "fontutils.h"
#include "downloaditem.h"
-#include "utils.h"
+#include "iconutils.h"
#include "videodefinition.h"
#include "video.h"
painter->drawPixmap(playIcon.rect(), playIcon);
// time
- drawTime(painter, video->formattedDuration(), line);
+ if (video->duration() > 0)
+ drawTime(painter, video->formattedDuration(), line);
// separator
painter->setPen(option.palette.color(QPalette::Midlight));
if (line.width() > THUMB_WIDTH + 60) {
- if (isActive) painter->setFont(boldFont);
+ // if (isActive) painter->setFont(boldFont);
// text color
if (isSelected)
- painter->setPen(QPen(option.palette.brush(QPalette::HighlightedText), 0));
+ painter->setPen(QPen(option.palette.highlightedText(), 0));
else
- painter->setPen(QPen(option.palette.brush(QPalette::Text), 0));
+ painter->setPen(QPen(option.palette.text(), 0));
// title
QString videoTitle = video->title();
if (authorHovered)
painter->setPen(QPen(option.palette.brush(QPalette::Highlight), 0));
else
- painter->setPen(QPen(option.palette.brush(QPalette::Mid), 0));
+ painter->setOpacity(.5);
}
- QString authorString = video->author();
+ QString authorString = video->channelTitle();
textLoc.setX(textLoc.x() + stringSize.width() + PADDING);
stringSize = QSize(QFontMetrics(painter->font()).size( Qt::TextSingleLine, authorString ) );
QRect authorTextBox(textLoc , stringSize);
}
if (downloadInfo) {
- QString definitionString = VideoDefinition::getDefinitionName(video->getDefinitionCode());
+ const QString definitionString = VideoDefinition::getDefinitionFor(video->getDefinitionCode()).getName();
textLoc.setX(textLoc.x() + stringSize.width() + PADDING);
stringSize = QSize(QFontMetrics(painter->font()).size( Qt::TextSingleLine, definitionString ) );
QRect viewCountTextBox(textLoc , stringSize);
} else {
- bool isHovered = option.state & QStyle::State_MouseOver;
+ const bool isHovered = index.data(HoveredItemRole).toBool();
if (!isActive && isHovered) {
painter->setFont(smallerFont);
painter->setPen(Qt::white);
if (status != Finished && status != Failed && status != Idle) {
if (downloadButtonHovered) message = tr("Stop downloading");
painter->save();
- QIcon closeIcon = Utils::icon("window-close");
+ QIcon closeIcon = IconUtils::icon("window-close");
painter->drawPixmap(downloadButtonRect(line), closeIcon.pixmap(16, 16, iconMode));
painter->restore();
}
message = tr("Open parent folder");
#endif
painter->save();
- QIcon searchIcon = Utils::icon("system-search");
+ QIcon searchIcon = IconUtils::icon("system-search");
painter->drawPixmap(downloadButtonRect(line), searchIcon.pixmap(16, 16, iconMode));
painter->restore();
}
else if (status == Failed || status == Idle) {
if (downloadButtonHovered) message = tr("Restart downloading");
painter->save();
- QIcon searchIcon = Utils::icon("view-refresh");
+ QIcon searchIcon = IconUtils::icon("view-refresh");
painter->drawPixmap(downloadButtonRect(line), searchIcon.pixmap(16, 16, iconMode));
painter->restore();
}