From 3a20a4ba43e609c96385f25c1a9a20e55cbfa4fa Mon Sep 17 00:00:00 2001 From: Yuri Date: Sun, 5 Feb 2017 00:38:25 -0800 Subject: [PATCH] feat(shortcut): Implemented F11 shortcut for toggling fullscreen. Allow to make qTox fullscreen, similar to how browsers switch to fullscreen. --- doc/user_manual_en.md | 1 + src/widget/widget.cpp | 12 ++++++++++++ src/widget/widget.h | 1 + 3 files changed, 14 insertions(+) diff --git a/doc/user_manual_en.md b/doc/user_manual_en.md index c2d2d584a..eeddde262 100644 --- a/doc/user_manual_en.md +++ b/doc/user_manual_en.md @@ -415,6 +415,7 @@ The following shortcuts are currently supported: | `CTRL` + `TAB` | Switch to the next contact | | `CTRL` + `SHIFT` + `TAB` | Switch to the previous contact| | `ALT` + `q` | Quote selected text | +| `F11` | Toggle fullscreen mode | ## Emoji Packs diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 318fb0600..2a206fae5 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -261,6 +261,7 @@ void Widget::init() new QShortcut(Qt::CTRL + Qt::Key_Tab, this, SLOT(nextContact())); new QShortcut(Qt::CTRL + Qt::Key_PageUp, this, SLOT(previousContact())); new QShortcut(Qt::CTRL + Qt::Key_PageDown, this, SLOT(nextContact())); + new QShortcut(Qt::Key_F11, this, SLOT(toggleFullscreen())); #ifdef Q_OS_MAC QMenuBar* globalMenu = Nexus::getInstance().globalMenuBar; @@ -1576,6 +1577,17 @@ void Widget::onGroupDialogShown(Group* g) onDialogShown(g->getGroupWidget()); } +void Widget::toggleFullscreen() { + if (windowState().testFlag(Qt::WindowFullScreen)) + { + setWindowState(windowState() & ~Qt::WindowFullScreen); + } + else + { + setWindowState(windowState() | Qt::WindowFullScreen); + } +} + ContentDialog* Widget::createContentDialog() const { ContentDialog* contentDialog = new ContentDialog(settingsWidget); diff --git a/src/widget/widget.h b/src/widget/widget.h index 3b6ac3d6e..cd9165d53 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -151,6 +151,7 @@ public slots: void previousContact(); void onFriendDialogShown(Friend* f); void onGroupDialogShown(Group* g); + void toggleFullscreen(); signals: void friendRequestAccepted(const ToxPk& friendPk);