summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2021-09-29 20:15:25 -0400
committerLoren Burkholder <computersemiexpert@outlook.com>2021-10-05 20:12:24 -0400
commit81406171a0d6b6751e9eb1777faf6ea895affcc7 (patch)
treec4b0e6aebf8e904556e0c94a4a810c985e2f906f /src
parentFix appimage builder url (diff)
downloadnheko-81406171a0d6b6751e9eb1777faf6ea895affcc7.tar.xz
QML the logout dialog
Diffstat (limited to 'src')
-rw-r--r--src/MainWindow.cpp19
-rw-r--r--src/MainWindow.h1
-rw-r--r--src/ui/NhekoGlobalObject.cpp5
-rw-r--r--src/ui/NhekoGlobalObject.h4
4 files changed, 6 insertions, 23 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp

index bc53b906..0978fc25 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp
@@ -35,7 +35,6 @@ #include "dialogs/CreateRoom.h" #include "dialogs/JoinRoom.h" #include "dialogs/LeaveRoom.h" -#include "dialogs/Logout.h" MainWindow *MainWindow::instance_ = nullptr; @@ -372,24 +371,6 @@ MainWindow::showSolidOverlayModal(QWidget *content, QFlags<Qt::AlignmentFlag> fl modal_->show(); } -void -MainWindow::openLogoutDialog() -{ - auto dialog = new dialogs::Logout(this); - connect(dialog, &dialogs::Logout::loggingOut, this, [this]() { - if (WebRTCSession::instance().state() != webrtc::State::DISCONNECTED) { - if (QMessageBox::question(this, "nheko", "A call is in progress. Log out?") != - QMessageBox::Yes) { - return; - } - WebRTCSession::instance().end(); - } - chat_page_->initiateLogout(); - }); - - showDialog(dialog); -} - bool MainWindow::hasActiveDialogs() const { diff --git a/src/MainWindow.h b/src/MainWindow.h
index eff8fbe7..a3c3c767 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h
@@ -64,7 +64,6 @@ public: void openCreateRoomDialog( std::function<void(const mtx::requests::CreateRoom &request)> callback); void openJoinRoomDialog(std::function<void(const QString &room_id)> callback); - void openLogoutDialog(); void hideOverlay(); void showSolidOverlayModal(QWidget *content, QFlags<Qt::AlignmentFlag> flags = Qt::AlignCenter); diff --git a/src/ui/NhekoGlobalObject.cpp b/src/ui/NhekoGlobalObject.cpp
index d6824996..1a20cbc2 100644 --- a/src/ui/NhekoGlobalObject.cpp +++ b/src/ui/NhekoGlobalObject.cpp
@@ -13,6 +13,7 @@ #include "Logging.h" #include "MainWindow.h" #include "UserSettingsPage.h" +#include "WebRTCSession.h" #include "Utils.h" Nheko::Nheko() @@ -83,9 +84,9 @@ Nheko::showUserSettingsPage() const } void -Nheko::openLogoutDialog() const +Nheko::logout() const { - MainWindow::instance()->openLogoutDialog(); + ChatPage::instance()->initiateLogout(); } void diff --git a/src/ui/NhekoGlobalObject.h b/src/ui/NhekoGlobalObject.h
index aa8435d1..64aad941 100644 --- a/src/ui/NhekoGlobalObject.h +++ b/src/ui/NhekoGlobalObject.h
@@ -48,7 +48,7 @@ public: Q_INVOKABLE void openLink(QString link) const; Q_INVOKABLE void setStatusMessage(QString msg) const; Q_INVOKABLE void showUserSettingsPage() const; - Q_INVOKABLE void openLogoutDialog() const; + Q_INVOKABLE void logout() const; Q_INVOKABLE void openCreateRoomDialog() const; Q_INVOKABLE void openJoinRoomDialog() const; Q_INVOKABLE void reparent(QWindow *win) const; @@ -60,6 +60,8 @@ signals: void colorsChanged(); void profileChanged(); + void openLogoutDialog(); + private: QScopedPointer<UserProfile> currentUser_; };