File indexing completed on 2024-12-01 04:37:02

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 "room.h"
0012 #include "roomheaderwidget.h"
0013 #include <QPointer>
0014 #include <QVBoxLayout>
0015 #include <QWidget>
0016 
0017 class RoomHeaderWidget;
0018 class RocketChatAccount;
0019 class UsersInRoomFlowWidget;
0020 class RoomCounterInfoWidget;
0021 class Room;
0022 class RoomWidgetBase;
0023 class ReconnectInfoWidget;
0024 class OtrWidget;
0025 class OffLineWidget;
0026 class PluginTextMessageWidget;
0027 
0028 namespace TextEditTextToSpeech
0029 {
0030 class TextToSpeechContainerWidget;
0031 }
0032 
0033 class LIBRUQOLAWIDGETS_TESTS_EXPORT RoomWidget : public QWidget
0034 {
0035     Q_OBJECT
0036 public:
0037     explicit RoomWidget(QWidget *parent = nullptr);
0038     ~RoomWidget() override;
0039 
0040     [[nodiscard]] QString roomId() const;
0041     void setRoomId(const QString &roomId);
0042 
0043     void setCurrentRocketChatAccount(RocketChatAccount *account);
0044     [[nodiscard]] Room::RoomType roomType() const;
0045 
0046     Room *room() const;
0047 
0048     void slotShowListOfUsersInRoom(bool checked);
0049     void setChannelSelected(const QString &roomId, Room::RoomType roomType);
0050     void storeRoomSettings();
0051 
0052     void setLayoutSpacing(int spacing);
0053     void scrollToMessageId(const QString &messageId);
0054 
0055     void forceLineEditFocus();
0056 
0057 Q_SIGNALS:
0058     void selectChannelRequested(const QString &channelId);
0059 
0060 protected:
0061     void dragEnterEvent(QDragEnterEvent *event) override;
0062     void dropEvent(QDropEvent *event) override;
0063 
0064 private:
0065     LIBRUQOLAWIDGETS_NO_EXPORT void slotClearNotification();
0066     LIBRUQOLAWIDGETS_NO_EXPORT void updateRoomHeader();
0067     LIBRUQOLAWIDGETS_NO_EXPORT void connectRoom();
0068     LIBRUQOLAWIDGETS_NO_EXPORT void slotChangeFavorite(bool b);
0069     LIBRUQOLAWIDGETS_NO_EXPORT void setRoomType(Room::RoomType roomType);
0070     LIBRUQOLAWIDGETS_NO_EXPORT void slotEncryptedChanged(bool b);
0071     LIBRUQOLAWIDGETS_NO_EXPORT void slotGoBackToRoom();
0072     LIBRUQOLAWIDGETS_NO_EXPORT void slotCreateNewDiscussion(const QString &messageId, const QString &originalMessage);
0073     LIBRUQOLAWIDGETS_NO_EXPORT void slotCreatePrivateDiscussion(const QString &userName);
0074     LIBRUQOLAWIDGETS_NO_EXPORT void slotSearchMessages();
0075     LIBRUQOLAWIDGETS_NO_EXPORT void slotActionRequested(RoomHeaderWidget::ChannelActionType type);
0076     LIBRUQOLAWIDGETS_NO_EXPORT void slotShowDiscussions();
0077     LIBRUQOLAWIDGETS_NO_EXPORT void slotShowThreads();
0078     LIBRUQOLAWIDGETS_NO_EXPORT void slotShowFileAttachments();
0079     LIBRUQOLAWIDGETS_NO_EXPORT void slotStarredMessages();
0080     LIBRUQOLAWIDGETS_NO_EXPORT void slotPinnedMessages();
0081     LIBRUQOLAWIDGETS_NO_EXPORT void slotShowMentions();
0082     LIBRUQOLAWIDGETS_NO_EXPORT void slotConfigureNotification();
0083     LIBRUQOLAWIDGETS_NO_EXPORT void slotLoadHistory();
0084     LIBRUQOLAWIDGETS_NO_EXPORT void
0085     slotOpenThreadRequested(const QString &threadMessageId, const QString &threadMessagePreview, bool threadIsFollowing, const Message &threadMessage);
0086     LIBRUQOLAWIDGETS_NO_EXPORT void slotConfigureAutoTranslate();
0087     LIBRUQOLAWIDGETS_NO_EXPORT void slotChannelInfoRequested();
0088     LIBRUQOLAWIDGETS_NO_EXPORT void slotInviteUsers();
0089     LIBRUQOLAWIDGETS_NO_EXPORT void slotAddUsersInRoom();
0090     LIBRUQOLAWIDGETS_NO_EXPORT void updateListView();
0091     LIBRUQOLAWIDGETS_NO_EXPORT void slotVideoChat();
0092     LIBRUQOLAWIDGETS_NO_EXPORT void slotPruneMessages();
0093     LIBRUQOLAWIDGETS_NO_EXPORT void slotUpdateRoomCounterInfoWidget();
0094     LIBRUQOLAWIDGETS_NO_EXPORT void slotExportMessages();
0095     LIBRUQOLAWIDGETS_NO_EXPORT void clearBeforeSwitching();
0096     LIBRUQOLAWIDGETS_NO_EXPORT void slotTeamChannelsRequested();
0097     LIBRUQOLAWIDGETS_NO_EXPORT void slotJumpToUnreadMessage(qint64 numberOfMessage);
0098     LIBRUQOLAWIDGETS_NO_EXPORT void slotGotoMessage(const QString &messageId, const QString &messageDateTimeUtc);
0099     LIBRUQOLAWIDGETS_NO_EXPORT void slotOpenTeamRequested(const QString &teamId);
0100     LIBRUQOLAWIDGETS_NO_EXPORT void slotTryReconnect();
0101     LIBRUQOLAWIDGETS_NO_EXPORT void slotDisplayReconnectWidget(int seconds);
0102     LIBRUQOLAWIDGETS_NO_EXPORT void slotLoginStatusChanged();
0103     LIBRUQOLAWIDGETS_NO_EXPORT void slotCloseOtr();
0104     LIBRUQOLAWIDGETS_NO_EXPORT void slotRefreshOtrKeys();
0105     LIBRUQOLAWIDGETS_NO_EXPORT void slotCallRequested();
0106     LIBRUQOLAWIDGETS_NO_EXPORT void slotTextToSpeech(const QString &messageText);
0107     LIBRUQOLAWIDGETS_NO_EXPORT void createOtrWidget();
0108     LIBRUQOLAWIDGETS_NO_EXPORT void createOffLineWidget();
0109     LIBRUQOLAWIDGETS_NO_EXPORT void createRoomReconnectInfoWidget();
0110     LIBRUQOLAWIDGETS_NO_EXPORT void createPluginTextMessateWidget();
0111 
0112     Room::RoomType mRoomType = Room::RoomType::Unknown;
0113 
0114     RoomWidgetBase *const mRoomWidgetBase;
0115 
0116     RoomHeaderWidget *const mRoomHeaderWidget;
0117     QPointer<Room> mRoom;
0118     UsersInRoomFlowWidget *const mUsersInRoomFlowWidget;
0119     RoomCounterInfoWidget *const mRoomCounterInfoWidget;
0120     ReconnectInfoWidget *mRoomReconnectInfoWidget = nullptr;
0121     PluginTextMessageWidget *mPluginTextMessageWidget = nullptr;
0122     OtrWidget *mOtrWidget = nullptr;
0123     OffLineWidget *mOffLineWidget = nullptr;
0124     TextEditTextToSpeech::TextToSpeechContainerWidget *const mTextToSpeechWidget = nullptr;
0125     QPointer<RocketChatAccount> mCurrentRocketChatAccount;
0126     QVBoxLayout *mRoomWidgetLayout = nullptr;
0127 };