diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2017-10-20 21:39:05 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2017-10-20 21:39:05 +0300 |
commit | 8a9a513ecd352768a7c14d30252394c6973a352e (patch) | |
tree | ab433b5c7c552360bb7ed811b44755b39550007d | |
parent | 9b60fdd620d5091377cca2163b97f856aedd7dca (diff) |
Move ctrl-k callback to the MainWindow
-rw-r--r-- | include/ChatPage.h | 5 | ||||
-rw-r--r-- | include/MainWindow.h | 1 | ||||
-rw-r--r-- | src/ChatPage.cc | 9 | ||||
-rw-r--r-- | src/MainWindow.cc | 9 |
4 files changed, 11 insertions, 13 deletions
diff --git a/include/ChatPage.h b/include/ChatPage.h index e8a40ade..4c8ed05b 100644 --- a/include/ChatPage.h +++ b/include/ChatPage.h @@ -48,6 +48,7 @@ public: // Initialize all the components of the UI. void bootstrap(QString userid, QString homeserver, QString token); + void showQuickSwitcher(); signals: void contentLoaded(); @@ -69,14 +70,10 @@ private slots: void addRoom(const QString &room_id); void removeRoom(const QString &room_id); -protected: - void keyPressEvent(QKeyEvent *event) override; - private: void updateTypingUsers(const QString &roomid, const QList<QString> &user_ids); void updateDisplayNames(const RoomState &state); void loadStateFromCache(); - void showQuickSwitcher(); QHBoxLayout *topLayout_; Splitter *splitter; diff --git a/include/MainWindow.h b/include/MainWindow.h index 0c2316a3..95935c46 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h @@ -43,6 +43,7 @@ public: protected: void closeEvent(QCloseEvent *event); + void keyPressEvent(QKeyEvent *event); private slots: // Handle interaction with the tray icon. diff --git a/src/ChatPage.cc b/src/ChatPage.cc index 514494ea..d8280a4a 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc @@ -577,15 +577,6 @@ ChatPage::loadStateFromCache() } void -ChatPage::keyPressEvent(QKeyEvent *event) -{ - if (event->key() == Qt::Key_K) { - if (event->modifiers() == Qt::ControlModifier) - showQuickSwitcher(); - } -} - -void ChatPage::showQuickSwitcher() { if (quickSwitcher_.isNull()) { diff --git a/src/MainWindow.cc b/src/MainWindow.cc index 8cb2b562..f6276967 100644 --- a/src/MainWindow.cc +++ b/src/MainWindow.cc @@ -101,6 +101,15 @@ MainWindow::MainWindow(QWidget *parent) } void +MainWindow::keyPressEvent(QKeyEvent *e) +{ + if ((e->key() == Qt::Key_K) && (e->modifiers().testFlag(Qt::ControlModifier))) + chat_page_->showQuickSwitcher(); + else + QMainWindow::keyPressEvent(e); +} + +void MainWindow::restoreWindowSize() { QSettings settings; |