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

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 <QWidget>
0010 
0011 #include "libruqolawidgets_private_export.h"
0012 #include "model/roommodel.h"
0013 class QLabel;
0014 class QToolButton;
0015 class ChannelActionPopupMenu;
0016 class RocketChatAccount;
0017 class Room;
0018 class TeamNameLabel;
0019 class RoomHeaderLabel;
0020 class LIBRUQOLAWIDGETS_TESTS_EXPORT RoomHeaderWidget : public QWidget
0021 {
0022     Q_OBJECT
0023 public:
0024     enum ChannelActionType {
0025         ShowMentions = 1,
0026         ShowPinned = 2,
0027         ShowStarred = 3,
0028         ShowDiscussions = 4,
0029         ShowThreads = 5,
0030         ShowAttachment = 6,
0031         Notification = 7,
0032         AutoTranslate = 8,
0033         InviteUsers = 9,
0034         AddUsersInRoom = 10,
0035         VideoChat = 11,
0036         PruneMessages = 12,
0037         ExportMessages = 13,
0038         OtrMessages = 14,
0039         EncryptMessages = 15,
0040     };
0041     Q_ENUM(ChannelActionType)
0042 
0043     explicit RoomHeaderWidget(QWidget *parent = nullptr);
0044     ~RoomHeaderWidget() override;
0045     void setRoomName(const QString &name);
0046     [[nodiscard]] QString roomName() const;
0047     void setRoomAnnouncement(const QString &name);
0048     void setRoomTopic(const QString &name);
0049 
0050     void setFavoriteStatus(bool b);
0051     void setEncypted(bool b);
0052 
0053     void setIsDiscussion(bool isDiscussion);
0054 
0055     void setCurrentRocketChatAccount(RocketChatAccount *account);
0056     void setRoom(Room *room);
0057 
0058     void setIsMainTeam(bool isMainTeam);
0059     void setTeamRoomInfo(const Room::TeamRoomInfo &name);
0060     void setCallEnabled(bool b);
0061     void setIsDirectGroup(bool state);
0062 Q_SIGNALS:
0063     void favoriteChanged(bool b);
0064     void encryptedChanged(bool b);
0065     void goBackToRoom();
0066     void listOfUsersChanged(bool b);
0067     void searchMessageRequested();
0068     void actionRequested(RoomHeaderWidget::ChannelActionType type);
0069     void channelInfoRequested();
0070     void teamChannelsRequested();
0071     void callRequested();
0072     void openTeam(const QString &identifier);
0073 
0074 private:
0075     QLabel *const mRoomName;
0076     TeamNameLabel *const mTeamName;
0077     RoomHeaderLabel *const mRoomHeaderLabel;
0078     QToolButton *const mFavoriteButton;
0079     QToolButton *const mEncryptedButton;
0080     QToolButton *const mDiscussionBackButton;
0081     QToolButton *const mListOfUsersButton;
0082     QToolButton *const mSearchMessageButton;
0083     QToolButton *const mChannelAction;
0084     QToolButton *const mChannelInfoButton;
0085     QToolButton *const mTeamChannelsButton;
0086     QToolButton *const mCallButton;
0087     ChannelActionPopupMenu *mChannelActionPopupMenu = nullptr;
0088 };