File indexing completed on 2024-12-08 10:27:07

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 "room.h"
0011 #include <QAbstractSocket>
0012 #include <QPointer>
0013 #include <QWidget>
0014 class QStackedWidget;
0015 class RuqolaMainWidget;
0016 class RuqolaLoginWidget;
0017 class RocketChatAccount;
0018 class ServerErrorInfoMessageWidget;
0019 class Room;
0020 class QVBoxLayout;
0021 
0022 class LIBRUQOLAWIDGETS_TESTS_EXPORT RuqolaCentralWidget : public QWidget
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit RuqolaCentralWidget(QWidget *parent = nullptr);
0027     ~RuqolaCentralWidget() override;
0028     [[nodiscard]] QString roomId() const;
0029 
0030     void setCurrentRocketChatAccount(RocketChatAccount *account);
0031     void selectNextUnreadChannel();
0032     [[nodiscard]] Room::RoomType roomType() const;
0033     Room *room() const;
0034 Q_SIGNALS:
0035     void channelSelected();
0036     void loginPageActivated(bool showLoginPage);
0037 
0038 private:
0039     LIBRUQOLAWIDGETS_NO_EXPORT void slotLoginStatusChanged();
0040     LIBRUQOLAWIDGETS_NO_EXPORT void slotJobFailedInfo(const QString &messageError, const QString &accountName);
0041     LIBRUQOLAWIDGETS_NO_EXPORT void slotSocketError(QAbstractSocket::SocketError error, const QString &errorString);
0042     LIBRUQOLAWIDGETS_NO_EXPORT void slotNewErrorInfo();
0043     LIBRUQOLAWIDGETS_NO_EXPORT void createServerErrorInfoMessageWidget();
0044 
0045     QStackedWidget *const mStackedWidget;
0046     RuqolaMainWidget *const mRuqolaMainWidget;
0047     RuqolaLoginWidget *const mRuqolaLoginWidget;
0048     ServerErrorInfoMessageWidget *mServerErrorInfoMessageWidget = nullptr;
0049     QVBoxLayout *const mMainLayout;
0050     QPointer<RocketChatAccount> mCurrentRocketChatAccount;
0051 };