Newer
Older
// SPDX-FileCopyrightText: 2017 Konstantinos Sideris <siderisk@auth.gr>
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
#include <QSharedPointer>
namespace mtx {
namespace requests {
struct CreateRoom;
}
}
class CreateRoom;
class InviteUsers;
class MainWindow final : public QQuickView
static MainWindow *instance() { return instance_; }
void saveCurrentWindowSize();
void openJoinRoomDialog(std::function<void(const QString &room_id)> callback);
MxcImageProvider *imageProvider() { return imgProvider; }
//! Show the chat page and start communicating with the given access token.
void showChatPage();
bool dbusAvailable() const { return dbusAvailable_; }
Q_INVOKABLE void addPerRoomWindow(const QString &room, QWindow *window);
Q_INVOKABLE void removePerRoomWindow(const QString &room, QWindow *window);
QWindow *windowForRoom(const QString &room);
private slots:
//! Handle interaction with the tray icon.
void iconActivated(QSystemTrayIcon::ActivationReason reason);
virtual void setWindowTitle(int notificationCount);
void switchToChatPage();
void switchToWelcomePage();
void showDialog(QWidget *dialog);
bool hasActiveUser();
void restoreWindowSize();
//! Check if the current page supports the "minimize to tray" functionality.
bool pageSupportsTray() const;
static MainWindow *instance_;
//! The initial welcome screen.
WelcomePage *welcome_page_;
//! The register page.
RegisterPage *register_page_;
//! The main chat area.
ChatPage *chat_page_;
QSharedPointer<UserSettings> userSettings_;
//! Tray icon that shows the unread message count.
TrayIcon *trayIcon_;
#ifdef NHEKO_DBUS_SYS
bool dbusAvailable_{false};
#endif