File indexing completed on 2024-02-25 05:11:49

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 "channellist/channellistwidget.h"
0010 #include "libruqolawidgets_private_export.h"
0011 #include "room.h"
0012 #include <QPointer>
0013 #include <QStackedWidget>
0014 #include <QWidget>
0015 class QVBoxLayout;
0016 class ChannelListWidget;
0017 class RoomWidget;
0018 class QSplitter;
0019 class RocketChatAccount;
0020 class Room;
0021 class BannerMessageWidget;
0022 class LIBRUQOLAWIDGETS_TESTS_EXPORT RuqolaMainWidget : public QWidget
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit RuqolaMainWidget(QWidget *parent = nullptr);
0027     ~RuqolaMainWidget() override;
0028     [[nodiscard]] QString roomId() const;
0029     void setCurrentRocketChatAccount(RocketChatAccount *account);
0030     [[nodiscard]] Room::RoomType roomType() const;
0031     Room *room() const;
0032 
0033     void selectNextUnreadChannel();
0034 
0035 Q_SIGNALS:
0036     void channelSelected();
0037 
0038 private:
0039     LIBRUQOLAWIDGETS_NO_EXPORT void selectChannelRoom(const ChannelListView::ChannelSelectedInfo &roomInfo);
0040     LIBRUQOLAWIDGETS_NO_EXPORT void showEvent(QShowEvent *event) override;
0041     LIBRUQOLAWIDGETS_NO_EXPORT void updateBannerInfo();
0042     LIBRUQOLAWIDGETS_NO_EXPORT void slotBannerDismissDone();
0043     LIBRUQOLAWIDGETS_NO_EXPORT void slotMarkBannerAsRead(const QString &identifier);
0044     LIBRUQOLAWIDGETS_NO_EXPORT void slotRoomPressed(const QString &roomId);
0045     LIBRUQOLAWIDGETS_NO_EXPORT void createBannerMessageWidget();
0046 
0047     QSplitter *const mSplitter;
0048     ChannelListWidget *const mChannelList;
0049     QStackedWidget *const mStackedRoomWidget;
0050     RoomWidget *const mRoomWidget;
0051     QWidget *const mEmptyRoomWidget;
0052     BannerMessageWidget *mBannerMessageWidget = nullptr;
0053     QPointer<RocketChatAccount> mCurrentRocketChatAccount;
0054     QVBoxLayout *const mTopLayout;
0055 };