File indexing completed on 2024-12-08 04:34:09
0001 /* 0002 SPDX-FileCopyrightText: 2020 David Faure <faure@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "utils.h" 0010 #include <QItemDelegate> 0011 class RocketChatAccount; 0012 class AvatarCacheManager; 0013 class ChannelListDelegate : public QItemDelegate 0014 { 0015 Q_OBJECT 0016 public: 0017 explicit ChannelListDelegate(QObject *parent = nullptr); 0018 ~ChannelListDelegate() override; 0019 0020 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; 0021 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; 0022 0023 void setCurrentRocketChatAccount(RocketChatAccount *currentRocketChatAccount); 0024 0025 private: 0026 [[nodiscard]] QString makeUnreadText(const QModelIndex &index) const; 0027 0028 RocketChatAccount *mRocketChatAccount = nullptr; 0029 AvatarCacheManager *const mAvatarCacheManager; 0030 };