]> git.sur5r.net Git - minitube/blobdiff - src/channelitemdelegate.cpp
Imported Upstream version 2.4
[minitube] / src / channelitemdelegate.cpp
index b06e8612c1ad59e78e2b7db68704653178ebdc84..797b82a539a2ea502776ce60a75e0367c4543e3b 100644 (file)
@@ -20,7 +20,7 @@ $END_LICENSE */
 
 #include "channelitemdelegate.h"
 #include "channelmodel.h"
-#include "ytuser.h"
+#include "ytchannel.h"
 #include "fontutils.h"
 #include "channelaggregator.h"
 #include "painterutils.h"
@@ -94,10 +94,8 @@ void ChannelItemDelegate::paintUnwatched(QPainter* painter,
 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();
 
@@ -108,17 +106,17 @@ void ChannelItemDelegate::paintChannel(QPainter* painter,
     // 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));