From 1849ed695a555a6e887025206b5c4de815ea50c4 Mon Sep 17 00:00:00 2001 From: Kumar Date: Sat, 11 Jul 2020 15:00:27 +0530 Subject: [PATCH] Enable LMMS fullscreen and... (long title, read first line of description) (#5563) * Enable fullscreen with hotkey & hotkey to toggle maximise in internal window * Fix an obvious blunder * Add fullscreen menu entry * Change Alt+F11 to Shift+F11 (fix Windows bug) * Move F5-F10 to Ctrl+F*, fullscreen by F11 and fix Linux bug * Remove wrongly placed "fullscreen" attribute * Remove temporary fixes for redundant bug * Rename maximise to maximize * Rename maximise to maximize * Use fullscreen icon instead of maximise icon * Actually include the icon in the commit * Replace .svg icon with .png 16x16 icon * Migrate editor hotkeys to Ctrl+1-7 --- data/themes/default/fullscreen.png | Bin 0 -> 568 bytes include/Editor.h | 2 + include/MainWindow.h | 3 ++ src/gui/MainWindow.cpp | 66 ++++++++++++++++++++--------- src/gui/editors/Editor.cpp | 6 +++ 5 files changed, 56 insertions(+), 21 deletions(-) create mode 100755 data/themes/default/fullscreen.png diff --git a/data/themes/default/fullscreen.png b/data/themes/default/fullscreen.png new file mode 100755 index 0000000000000000000000000000000000000000..56f552e104a355891b734c933c5af6b2f642d0e6 GIT binary patch literal 568 zcmV-80>}M{P)EX>4Tx04R}tkv&MmKpe$iQ%n7*IM_kNAwzW#3!);9QpF-zC~bvS9ZW9$5Slb3 zDK3tJYr(;f#j1mgv#t)Vf*|+-;^gS0=prTlFDbN$@!+^0@9sVB-T^|r%v7^u98fjO zNX27fHn$=MUlBwP0vJV?#7sSrUdX_6eBHyx*Sjds@;>+H=vDG21AHR!EYl5(c%689 z)6zNb6NgzzQi#uq#|*k4@gvt|m)|%S9Ts?I*vO>jh{MEUv5n<6W+g)QjhY-gi5=cUXj4C!zhJ`4t8Yw1Hv>)^E4?6xNxny!} zfRSS!6{wILKlmT~?$#_!PPj>-7!Y`|?T=v~xC=CDw*7r<+l>>z{|sDdEq|pB%zTnw zYiW@qpl=(vxNd3k9&ot>3_R(QAvuztrcfvV?`QN)IiUX*=w5YuYwqLp0mx8SOE@|;fceeNT@0n(QKSMNflx>pHFaQ7m24YJ`L;(K){{a7>y{D4^000SaNLh0L z01ejw01ejxLMWSf00007bV*G`2jm9}1u8ibg)Z&@001;eL_t(I%VYfi|NnmmEP#=b zkrA1XOC1vfg@6%eGP;d~08AgnE*N+NM!{%0Kna5Z%Z&i;4Il+TJ77fs0000setShortcut( Qt::Key_F5 ); + song_editor_window->setShortcut( Qt::CTRL + Qt::Key_1 ); ToolButton * bb_editor_window = new ToolButton( embed::getIconPixmap( "bb_track_btn" ), tr( "Beat+Bassline Editor" ) + - " (F6)", + " (Ctrl+2)", this, SLOT( toggleBBEditorWin() ), m_toolBar ); - bb_editor_window->setShortcut( Qt::Key_F6 ); + bb_editor_window->setShortcut( Qt::CTRL + Qt::Key_2 ); ToolButton * piano_roll_window = new ToolButton( embed::getIconPixmap( "piano" ), tr( "Piano Roll" ) + - " (F7)", + " (Ctrl+3)", this, SLOT( togglePianoRollWin() ), m_toolBar ); - piano_roll_window->setShortcut( Qt::Key_F7 ); + piano_roll_window->setShortcut( Qt::CTRL + Qt::Key_3 ); ToolButton * automation_editor_window = new ToolButton( embed::getIconPixmap( "automation" ), tr( "Automation Editor" ) + - " (F8)", + " (Ctrl+4)", this, SLOT( toggleAutomationEditorWin() ), m_toolBar ); - automation_editor_window->setShortcut( Qt::Key_F8 ); + automation_editor_window->setShortcut( Qt::CTRL + Qt::Key_4 ); ToolButton * fx_mixer_window = new ToolButton( embed::getIconPixmap( "fx_mixer" ), - tr( "FX Mixer" ) + " (F9)", + tr( "FX Mixer" ) + " (Ctrl+5)", this, SLOT( toggleFxMixerWin() ), m_toolBar ); - fx_mixer_window->setShortcut( Qt::Key_F9 ); + fx_mixer_window->setShortcut( Qt::CTRL + Qt::Key_5 ); ToolButton * controllers_window = new ToolButton( embed::getIconPixmap( "controller" ), tr( "Show/hide controller rack" ) + - " (F10)", + " (Ctrl+6)", this, SLOT( toggleControllerRack() ), m_toolBar ); - controllers_window->setShortcut( Qt::Key_F10 ); + controllers_window->setShortcut( Qt::CTRL + Qt::Key_6 ); ToolButton * project_notes_window = new ToolButton( embed::getIconPixmap( "project_notes" ), tr( "Show/hide project notes" ) + - " (F11)", + " (Ctrl+7)", this, SLOT( toggleProjectNotesWin() ), m_toolBar ); - project_notes_window->setShortcut( Qt::Key_F11 ); + project_notes_window->setShortcut( Qt::CTRL + Qt::Key_7 ); m_toolBarLayout->addWidget( song_editor_window, 1, 1 ); m_toolBarLayout->addWidget( bb_editor_window, 1, 2 ); @@ -1007,6 +1010,20 @@ void MainWindow::toggleWindow( QWidget *window, bool forceShow ) +void MainWindow::toggleFullscreen() +{ + if ( !isFullScreen() ) + { + maximized = isMaximized(); + showFullScreen(); + } + else + { + maximized ? showMaximized() : showNormal(); + } +} + + /* * When an editor window with focus is toggled off, attempt to set focus @@ -1093,36 +1110,43 @@ void MainWindow::updateViewMenu() // Not that it's straight visible <-> invisible, more like // not on top -> top <-> invisible m_viewMenu->addAction(embed::getIconPixmap( "songeditor" ), - tr( "Song Editor" ) + " (F5)", + tr( "Song Editor" ) + "\tCtrl+1", this, SLOT( toggleSongEditorWin() ) ); m_viewMenu->addAction(embed::getIconPixmap( "bb_track" ), - tr( "Beat+Bassline Editor" ) + " (F6)", + tr( "Beat+Bassline Editor" ) + "\tCtrl+2", this, SLOT( toggleBBEditorWin() ) ); m_viewMenu->addAction(embed::getIconPixmap( "piano" ), - tr( "Piano Roll" ) + " (F7)", + tr( "Piano Roll" ) + "\tCtrl+3", this, SLOT( togglePianoRollWin() ) ); m_viewMenu->addAction(embed::getIconPixmap( "automation" ), - tr( "Automation Editor" ) + " (F8)", + tr( "Automation Editor" ) + "\tCtrl+4", this, SLOT( toggleAutomationEditorWin()) ); m_viewMenu->addAction(embed::getIconPixmap( "fx_mixer" ), - tr( "FX Mixer" ) + " (F9)", + tr( "FX Mixer" ) + "\tCtrl+5", this, SLOT( toggleFxMixerWin() ) ); m_viewMenu->addAction(embed::getIconPixmap( "controller" ), - tr( "Controller Rack" ) + " (F10)", + tr( "Controller Rack" ) + "\tCtrl+6", this, SLOT( toggleControllerRack() ) ); m_viewMenu->addAction(embed::getIconPixmap( "project_notes" ), - tr( "Project Notes" ) + " (F11)", + tr( "Project Notes" ) + "\tCtrl+7", this, SLOT( toggleProjectNotesWin() ) ); m_viewMenu->addSeparator(); + + m_viewMenu->addAction(embed::getIconPixmap( "fullscreen" ), + tr( "Fullscreen" ) + "\tF11", + this, SLOT( toggleFullscreen() ) + ); + + m_viewMenu->addSeparator(); // Here we should put all look&feel -stuff from configmanager // that is safe to change on the fly. There is probably some diff --git a/src/gui/editors/Editor.cpp b/src/gui/editors/Editor.cpp index 00a659d0779..dc86a1789dc 100644 --- a/src/gui/editors/Editor.cpp +++ b/src/gui/editors/Editor.cpp @@ -79,6 +79,11 @@ void Editor::togglePause() Engine::getSong()->togglePause(); } +void Editor::toggleMaximize() +{ + isMaximized() ? showNormal() : showMaximized(); +} + Editor::Editor(bool record, bool stepRecord) : m_toolBar(new DropToolBar(this)), m_playAction(nullptr), @@ -110,6 +115,7 @@ Editor::Editor(bool record, bool stepRecord) : connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stop())); new QShortcut(Qt::Key_Space, this, SLOT(togglePlayStop())); new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Space), this, SLOT(togglePause())); + new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F11), this, SLOT(toggleMaximize())); // Add actions to toolbar addButton(m_playAction, "playButton");