1 /* 2 SPDX-FileCopyrightText: 2020-2021 Laurent Montel <montel@kde.org> 3 4 SPDX-License-Identifier: LGPL-2.0-or-later 5 */ 6 7 #pragma once 8 9 #include "messagedelegatehelperbase.h" 10 11 #include <QIcon> 12 #include <QModelIndex> 13 #include <QRect> 14 15 class LIBRUQOLAWIDGETS_TESTS_EXPORT MessageAttachmentDelegateHelperVideo : public MessageDelegateHelperBase 16 { 17 public: 18 MessageAttachmentDelegateHelperVideo(); 19 ~MessageAttachmentDelegateHelperVideo() override; 20 void 21 draw(const MessageAttachment &msgAttach, QPainter *painter, QRect messageRect, const QModelIndex &index, const QStyleOptionViewItem &option) const override; 22 Q_REQUIRED_RESULT QSize sizeHint(const MessageAttachment &msgAttach, 23 const QModelIndex &index, 24 int maxWidth, 25 const QStyleOptionViewItem &option) const override; 26 Q_REQUIRED_RESULT bool handleMouseEvent(const MessageAttachment &msgAttach, 27 QMouseEvent *mouseEvent, 28 QRect attachmentsRect, 29 const QStyleOptionViewItem &option, 30 const QModelIndex &index) override; 31 32 private: 33 struct VideoLayout { 34 QString videoPath; 35 QString title; 36 QString description; 37 QSize titleSize; 38 QSize descriptionSize; 39 QRect downloadButtonRect; 40 QRect showButtonRect; 41 }; 42 Q_REQUIRED_RESULT VideoLayout layoutVideo(const MessageAttachment &msgAttach, const QStyleOptionViewItem &option, int attachmentsWidth) const; 43 const QIcon mDownloadIcon; 44 const QIcon mVisibilityIcon; 45 }; 46 47