diff --git a/src/settings/include/shortcuts.h b/src/settings/include/shortcuts.h index 9331c668..1142f0a5 100644 --- a/src/settings/include/shortcuts.h +++ b/src/settings/include/shortcuts.h @@ -54,6 +54,10 @@ struct ShortcutAction { static constexpr auto MainWindowCloseFile = "mainwindow.close_file"; static constexpr auto MainWindowCloseAll = "mainwindow.close_all"; static constexpr auto MainWindowQuit = "mainwindow.quit"; + static constexpr auto MainWindowFullScreen = "mainwindow.fullscreen"; + static constexpr auto MainWindowMax = "mainwindow.max_window"; + static constexpr auto MainWindowMin = "mainwindow.min_window"; + static constexpr auto MainWindowPreference = "mainwindow.preference"; static constexpr auto MainWindowCopy = "mainwindow.copy_selection"; static constexpr auto MainWindowSelectAll = "mainwindow.select_all"; static constexpr auto MainWindowOpenQf = "mainwindow.open_qf"; diff --git a/src/settings/src/shortcuts.cpp b/src/settings/src/shortcuts.cpp index 7e34fc14..8241c651 100644 --- a/src/settings/src/shortcuts.cpp +++ b/src/settings/src/shortcuts.cpp @@ -146,6 +146,34 @@ const ShortcutAction::ShortcutList& ShortcutAction::defaultShortcutList() QStringList{ "Ctrl+Q" }, }, }, + { + MainWindowFullScreen, + { + QApplication::tr( "Full Screen" ), + QStringList{}, + }, + }, + { + MainWindowMax, + { + QApplication::tr( "Maximize window" ), + QStringList{}, + }, + }, + { + MainWindowMin, + { + QApplication::tr( "Minimize Window" ), + QStringList{}, + }, + }, + { + MainWindowPreference, + { + QApplication::tr( "Preferences" ), + QStringList{}, + }, + }, { MainWindowOpenQf, { diff --git a/src/ui/src/mainwindow.cpp b/src/ui/src/mainwindow.cpp index e5306686..399e8f26 100644 --- a/src/ui/src/mainwindow.cpp +++ b/src/ui/src/mainwindow.cpp @@ -695,6 +695,15 @@ void MainWindow::updateShortcuts() crawler->focusSearchEdit(); } } ); + ShortcutAction::registerShortcut( shortcuts, shortcuts_, this, Qt::WindowShortcut, + ShortcutAction::MainWindowFullScreen, + [ this ] { this->showFullScreen(); } ); + ShortcutAction::registerShortcut( shortcuts, shortcuts_, this, Qt::WindowShortcut, + ShortcutAction::MainWindowMax, + [ this ] { this->showMaximized(); } ); + ShortcutAction::registerShortcut( shortcuts, shortcuts_, this, Qt::WindowShortcut, + ShortcutAction::MainWindowMin, + [ this ] { this->showMinimized(); } ); auto setShortcuts = [ &shortcuts ]( auto* action, const auto& actionName ) { action->setShortcuts( ShortcutAction::shortcutKeys( actionName, shortcuts ) ); @@ -721,6 +730,7 @@ void MainWindow::updateShortcuts() setShortcuts( showScratchPadAction, ShortcutAction::MainWindowScratchpad ); setShortcuts( selectOpenFileAction, ShortcutAction::MainWindowSelectOpenFile ); setShortcuts( goToLineAction, ShortcutAction::LogViewJumpToLine ); + setShortcuts( optionsAction, ShortcutAction::MainWindowPreference ); } void MainWindow::loadIcons()