File indexing completed on 2024-05-12 16:27:35

0001 /*
0002    SPDX-FileCopyrightText: 2021-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 "messagelistview.h"
0011 #include "uploadfilejob.h"
0012 #include <QPointer>
0013 #include <QWidget>
0014 
0015 class RoomReplyThreadWidget;
0016 class RoomQuoteMessageWidget;
0017 class QStackedWidget;
0018 class MessageLineWidget;
0019 class ReadOnlyLineEditWidget;
0020 class RocketChatAccount;
0021 class Room;
0022 class UploadFileProgressStatusListWidget;
0023 class QVBoxLayout;
0024 class LIBRUQOLAWIDGETS_TESTS_EXPORT RoomWidgetBase : public QWidget
0025 {
0026     Q_OBJECT
0027 public:
0028     explicit RoomWidgetBase(MessageListView::Mode mode, QWidget *parent = nullptr);
0029     ~RoomWidgetBase() override;
0030 
0031     [[nodiscard]] MessageListView *messageListView() const;
0032 
0033     [[nodiscard]] MessageLineWidget *messageLineWidget() const;
0034 
0035     void setCurrentRocketChatAccount(RocketChatAccount *account);
0036 
0037     [[nodiscard]] QString roomId() const;
0038     void setRoomId(const QString &roomId);
0039 
0040     void updateListView();
0041     void updateRoomReadOnly(Room *room);
0042     void slotCreateNewDiscussion(const QString &messageId, const QString &originalMessage, const QString &channelName);
0043     void closeQuoteAndThreadInfo();
0044 Q_SIGNALS:
0045     void loadHistory();
0046     void createNewDiscussion(const QString &messageId, const QString &originalMessage);
0047     void textToSpeech(const QString &messageText);
0048     void errorMessage(const QString &message);
0049     void successMessage(const QString &message);
0050 
0051 private:
0052     LIBRUQOLAWIDGETS_NO_EXPORT void slotClearNotification();
0053     LIBRUQOLAWIDGETS_NO_EXPORT void slotShowQuoteMessage(const QString &permalink, const QString &text);
0054     LIBRUQOLAWIDGETS_NO_EXPORT void slotCreatePrivateDiscussion(const QString &userName);
0055     LIBRUQOLAWIDGETS_NO_EXPORT void keyPressedInLineEdit(QKeyEvent *ev);
0056     LIBRUQOLAWIDGETS_NO_EXPORT void slotShowThreadMessage(const QString &threadMessageId, const QString &text);
0057     LIBRUQOLAWIDGETS_NO_EXPORT void
0058     slotUploadProgress(const RocketChatRestApi::UploadFileJob::UploadStatusInfo &info, int jobIdentifier, const QString &accountName);
0059     LIBRUQOLAWIDGETS_NO_EXPORT void slotSendFile(const RocketChatRestApi::UploadFileJob::UploadFileInfo &uploadFileInfo);
0060     LIBRUQOLAWIDGETS_NO_EXPORT void slotCancelUpload(int identifier);
0061     QString mRoomId;
0062     UploadFileProgressStatusListWidget *const mUploadFileProgressStatusListWidget;
0063     MessageListView *const mMessageListView;
0064     RoomReplyThreadWidget *const mRoomReplyThreadWidget;
0065     RoomQuoteMessageWidget *const mRoomQuoteMessageWidget;
0066     QStackedWidget *const mStackedWidget;
0067     MessageLineWidget *const mMessageLineWidget;
0068     ReadOnlyLineEditWidget *const mReadOnlyLineEditWidget;
0069     QPointer<RocketChatAccount> mCurrentRocketChatAccount;
0070     QVBoxLayout *const mMainLayout;
0071 };