From da228058b9f2a34d9d448b44a9474815dc260b83 Mon Sep 17 00:00:00 2001 From: sgourdas Date: Thu, 21 Mar 2024 19:13:37 +0200 Subject: [PATCH 1/2] Added a condition to check if the fullscreen key sequence is undefined and in that case hardcode it with F11 --- src/kiwixapp.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/kiwixapp.cpp b/src/kiwixapp.cpp index 68bd765..9b01023 100644 --- a/src/kiwixapp.cpp +++ b/src/kiwixapp.cpp @@ -413,8 +413,13 @@ void KiwixApp::createActions() mpa_actions[FindInPageAction]->setShortcuts({QKeySequence::Find, Qt::Key_F3}); connect(mpa_actions[FindInPageAction], &QAction::triggered, this, [=]() { getTabWidget()->openFindInPageBar(); }); - - CREATE_ACTION_ICON_SHORTCUT(ToggleFullscreenAction, "full-screen-enter", gt("set-fullscreen"), QKeySequence::FullScreen); + + bool fullScreenKeyUndefined = (QKeySequence(QKeySequence::FullScreen).toString()).isEmpty(); + if (fullScreenKeyUndefined) { + CREATE_ACTION_ICON_SHORTCUT(ToggleFullscreenAction, "full-screen-enter", gt("set-fullscreen"), Qt::Key_F11); + } else { + CREATE_ACTION_ICON_SHORTCUT(ToggleFullscreenAction, "full-screen-enter", gt("set-fullscreen"), QKeySequence::FullScreen); + } connect(mpa_actions[ToggleFullscreenAction], &QAction::toggled, this, [=](bool checked) { auto action = mpa_actions[ToggleFullscreenAction]; From 95de67c39f4ae71b75b90d0f8ce792ec91d1cba9 Mon Sep 17 00:00:00 2001 From: Dimitris Sgourdas <57002743+sgourdas@users.noreply.github.com> Date: Fri, 22 Mar 2024 11:05:17 +0200 Subject: [PATCH 2/2] Update code based on code review --- src/kiwixapp.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/kiwixapp.cpp b/src/kiwixapp.cpp index 9b01023..5330eb3 100644 --- a/src/kiwixapp.cpp +++ b/src/kiwixapp.cpp @@ -414,12 +414,10 @@ void KiwixApp::createActions() connect(mpa_actions[FindInPageAction], &QAction::triggered, this, [=]() { getTabWidget()->openFindInPageBar(); }); - bool fullScreenKeyUndefined = (QKeySequence(QKeySequence::FullScreen).toString()).isEmpty(); - if (fullScreenKeyUndefined) { - CREATE_ACTION_ICON_SHORTCUT(ToggleFullscreenAction, "full-screen-enter", gt("set-fullscreen"), Qt::Key_F11); - } else { - CREATE_ACTION_ICON_SHORTCUT(ToggleFullscreenAction, "full-screen-enter", gt("set-fullscreen"), QKeySequence::FullScreen); - } + const auto fullScreenKeySeq = QKeySequence(QKeySequence::FullScreen).isEmpty() + ? Qt::Key_F11 + : QKeySequence::FullScreen; + CREATE_ACTION_ICON_SHORTCUT(ToggleFullscreenAction, "full-screen-enter", gt("set-fullscreen"), fullScreenKeySeq); connect(mpa_actions[ToggleFullscreenAction], &QAction::toggled, this, [=](bool checked) { auto action = mpa_actions[ToggleFullscreenAction];