#include "channelitemdelegate.h"
#include "channelmodel.h"
-#include "ytuser.h"
+#include "ytchannel.h"
#include "fontutils.h"
#include "channelaggregator.h"
#include "painterutils.h"
void ChannelItemDelegate::paintChannel(QPainter* painter,
const QStyleOptionViewItem& option,
const QModelIndex& index) const {
- const QVariant dataObject = index.data(ChannelModel::DataObjectRole);
- const YTUserPointer channelPointer = dataObject.value<YTUserPointer>();
- YTUser *user = channelPointer.data();
- if (!user) return;
+ YTChannel *channel = index.data(ChannelModel::DataObjectRole).value<YTChannelPointer>().data();
+ if (!channel) return;
painter->save();
// const bool isHovered = index.data(ChannelsModel::HoveredItemRole ).toBool();
// const bool isSelected = option.state & QStyle::State_Selected;
- QPixmap thumbnail = user->getThumbnail();
+ QPixmap thumbnail = channel->getThumbnail();
if (thumbnail.isNull()) {
- user->loadThumbnail();
+ channel->loadThumbnail();
painter->restore();
return;
}
- QString name = user->getDisplayName();
+ QString name = channel->getDisplayName();
drawItem(painter, line, thumbnail, name);
- int notifyCount = user->getNotifyCount();
+ int notifyCount = channel->getNotifyCount();
if (notifyCount > 0)
paintBadge(painter, line, QString::number(notifyCount));