summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-02-10 16:05:31 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-02-10 16:05:31 +0200
commit26f221ec23c3ece5bd5b19f080cbfd21c9ffb5f4 (patch)
tree25fd31b89042b303d90a054e4d876bc5519a41fb /include
parentUpdate build instructions (diff)
downloadnheko-26f221ec23c3ece5bd5b19f080cbfd21c9ffb5f4.tar.xz
Move LeaveRoom dialog to MainWindow (#87)
Diffstat (limited to 'include')
-rw-r--r--include/ChatPage.h1
-rw-r--r--include/MainWindow.h19
-rw-r--r--include/RoomList.h7
-rw-r--r--include/TopRoomBar.h7
4 files changed, 11 insertions, 23 deletions
diff --git a/include/ChatPage.h b/include/ChatPage.h
index dcd925e7..67ddd1ed 100644
--- a/include/ChatPage.h
+++ b/include/ChatPage.h
@@ -66,6 +66,7 @@ public:
         void bootstrap(QString userid, QString homeserver, QString token);
         void showQuickSwitcher();
         void showReadReceipts(const QString &event_id);
+        QString currentRoom() const { return current_room_; }
 
         static ChatPage *instance() { return instance_; }
 
diff --git a/include/MainWindow.h b/include/MainWindow.h
index b899e2d3..e4ffe2f4 100644
--- a/include/MainWindow.h
+++ b/include/MainWindow.h
@@ -35,17 +35,22 @@ class SnackBar;
 class TrayIcon;
 class UserSettings;
 
+namespace dialogs {
+class LeaveRoom;
+}
+
 class MainWindow : public QMainWindow
 {
         Q_OBJECT
 
 public:
         explicit MainWindow(QWidget *parent = 0);
-        ~MainWindow();
 
         static MainWindow *instance() { return instance_; };
         void saveCurrentWindowSize();
 
+        void openLeaveRoomDialog(const QString &room_id = "");
+
 protected:
         void closeEvent(QCloseEvent *event);
 
@@ -78,31 +83,27 @@ private:
 
         //! The initial welcome screen.
         WelcomePage *welcome_page_;
-
         //! The login screen.
         LoginPage *login_page_;
-
         //! The register page.
         RegisterPage *register_page_;
-
         //! A stacked widget that handles the transitions between widgets.
         QStackedWidget *pageStack_;
-
         //! The main chat area.
         ChatPage *chat_page_;
         UserSettingsPage *userSettingsPage_;
         QSharedPointer<UserSettings> userSettings_;
-
         //! Used to hide undefined states between page transitions.
         QSharedPointer<OverlayModal> progressModal_;
         QSharedPointer<LoadingIndicator> spinner_;
-
         //! Matrix Client API provider.
         QSharedPointer<MatrixClient> client_;
-
         //! Tray icon that shows the unread message count.
         TrayIcon *trayIcon_;
-
         //! Notifications display.
         QSharedPointer<SnackBar> snackBar_;
+        //! Leave room modal.
+        QSharedPointer<OverlayModal> leaveRoomModal_;
+        //! Leave room dialog.
+        QSharedPointer<dialogs::LeaveRoom> leaveRoomDialog_;
 };
diff --git a/include/RoomList.h b/include/RoomList.h
index ed93f17d..b99b354f 100644
--- a/include/RoomList.h
+++ b/include/RoomList.h
@@ -25,8 +25,6 @@
 
 #include <mtx.hpp>
 
-#include "dialogs/LeaveRoom.h"
-
 class LeaveRoomDialog;
 class MatrixClient;
 class Cache;
@@ -79,8 +77,6 @@ public slots:
         void updateUnreadMessageCount(const QString &roomid, int count);
         void updateRoomDescription(const QString &roomid, const DescInfo &info);
         void closeJoinRoomDialog(bool isJoining, QString roomAlias);
-        void openLeaveRoomDialog(const QString &room_id);
-        void closeLeaveRoomDialog(bool leaving, const QString &room_id);
         void clearRoomMessageCount(const QString &room_id);
 
 protected:
@@ -109,9 +105,6 @@ private:
 
         OverlayModal *joinRoomModal_;
 
-        QSharedPointer<OverlayModal> leaveRoomModal_;
-        QSharedPointer<dialogs::LeaveRoom> leaveRoomDialog_;
-
         std::map<QString, QSharedPointer<RoomInfoListItem>> rooms_;
         QString selectedRoom_;
 
diff --git a/include/TopRoomBar.h b/include/TopRoomBar.h
index 13eaaa38..2ee25361 100644
--- a/include/TopRoomBar.h
+++ b/include/TopRoomBar.h
@@ -53,16 +53,12 @@ public:
         void reset();
 
 signals:
-        void leaveRoom();
         void inviteUsers(QStringList users);
 
 protected:
         void paintEvent(QPaintEvent *event) override;
         void mousePressEvent(QMouseEvent *event) override;
 
-private slots:
-        void closeLeaveRoomDialog(bool leaving);
-
 private:
         QHBoxLayout *topLayout_;
         QVBoxLayout *textLayout_;
@@ -79,9 +75,6 @@ private:
 
         FlatButton *settingsBtn_;
 
-        QSharedPointer<OverlayModal> leaveRoomModal_;
-        QSharedPointer<dialogs::LeaveRoom> leaveRoomDialog_;
-
         QSharedPointer<OverlayModal> inviteUsersModal_;
         QSharedPointer<dialogs::InviteUsers> inviteUsersDialog_;