File indexing completed on 2024-05-19 05:04:30

0001 /*
0002    SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolawidgets_private_export.h"
0010 #include "messages/message.h"
0011 #include <QPointer>
0012 #include <QWidget>
0013 class RocketChatAccount;
0014 class Room;
0015 class QLabel;
0016 class RoomWidgetBase;
0017 class QToolButton;
0018 
0019 namespace TextEditTextToSpeech
0020 {
0021 class TextToSpeechContainerWidget;
0022 }
0023 
0024 class LIBRUQOLAWIDGETS_TESTS_EXPORT ThreadMessageWidget : public QWidget
0025 {
0026     Q_OBJECT
0027 public:
0028     struct LIBRUQOLAWIDGETS_TESTS_EXPORT ThreadMessageInfo {
0029         Message messageThread;
0030         QString threadMessageId;
0031         QString threadMessagePreview;
0032         Room *room = nullptr;
0033         bool threadIsFollowing = false;
0034     };
0035     explicit ThreadMessageWidget(RocketChatAccount *account, QWidget *parent = nullptr);
0036     ~ThreadMessageWidget() override;
0037 
0038     void setThreadMessageInfo(const ThreadMessageWidget::ThreadMessageInfo &info);
0039 
0040 protected:
0041     void dragEnterEvent(QDragEnterEvent *event) override;
0042     void dropEvent(QDropEvent *event) override;
0043 
0044 private:
0045     LIBRUQOLAWIDGETS_NO_EXPORT void initialize();
0046     LIBRUQOLAWIDGETS_NO_EXPORT void slotCreateNewDiscussion(const QString &messageId, const QString &originalMessage);
0047     LIBRUQOLAWIDGETS_NO_EXPORT void updateFollowThreadIcon(bool followThread);
0048     LIBRUQOLAWIDGETS_NO_EXPORT void slotFollowThreadChanged(bool clicked);
0049     QString mThreadMessageId;
0050     QLabel *const mThreadPreview;
0051     RoomWidgetBase *const mRoomWidgetBase;
0052     RocketChatAccount *const mRocketChatAccount;
0053     QToolButton *const mFollowButton;
0054     QPointer<Room> mRoom;
0055     TextEditTextToSpeech::TextToSpeechContainerWidget *const mTextToSpeechWidget = nullptr;
0056 };