Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable LMMS fullscreen and... (long title, read first line of description) #5563

Merged
merged 14 commits into from
Jul 11, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/Editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ private slots:
/// Called by pressing shift+space. Toggles pause state.
void togglePause();

void toggleMaximise();
ryuukumar marked this conversation as resolved.
Show resolved Hide resolved

signals:

protected:
Expand Down
3 changes: 3 additions & 0 deletions include/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ public slots:
void toggleFxMixerWin();
void togglePianoRollWin();
void toggleControllerRack();
void toggleFullscreen();

void updatePlayPauseIcons();

Expand Down Expand Up @@ -224,6 +225,8 @@ private slots:
ToolButton * m_metronomeToggle;

SessionState m_session;

bool maximised;
ryuukumar marked this conversation as resolved.
Show resolved Hide resolved

private slots:
void browseHelp();
Expand Down
68 changes: 47 additions & 21 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ MainWindow::MainWindow() :

connect(Engine::getSong(), SIGNAL(modified()), SLOT(onSongModified()));
connect(Engine::getSong(), SIGNAL(projectFileNameChanged()), SLOT(onProjectFileNameChanged()));

maximised = isMaximized();
new QShortcut(QKeySequence(Qt::Key_F11), this, SLOT(toggleFullscreen()));
}


Expand Down Expand Up @@ -479,60 +482,60 @@ void MainWindow::finalize()
// window-toolbar
ToolButton * song_editor_window = new ToolButton(
embed::getIconPixmap( "songeditor" ),
tr( "Song Editor" ) + " (F5)",
tr( "Song Editor" ) + " (Ctrl + F5)",
this, SLOT( toggleSongEditorWin() ),
m_toolBar );
song_editor_window->setShortcut( Qt::Key_F5 );
song_editor_window->setShortcut( Qt::CTRL + Qt::Key_F5 );


ToolButton * bb_editor_window = new ToolButton(
embed::getIconPixmap( "bb_track_btn" ),
tr( "Beat+Bassline Editor" ) +
" (F6)",
" (Ctrl + F6)",
this, SLOT( toggleBBEditorWin() ),
m_toolBar );
bb_editor_window->setShortcut( Qt::Key_F6 );
bb_editor_window->setShortcut( Qt::CTRL + Qt::Key_F6 );


ToolButton * piano_roll_window = new ToolButton(
embed::getIconPixmap( "piano" ),
tr( "Piano Roll" ) +
" (F7)",
" (Ctrl + F7)",
this, SLOT( togglePianoRollWin() ),
m_toolBar );
piano_roll_window->setShortcut( Qt::Key_F7 );
piano_roll_window->setShortcut( Qt::CTRL + Qt::Key_F7 );

ToolButton * automation_editor_window = new ToolButton(
embed::getIconPixmap( "automation" ),
tr( "Automation Editor" ) +
" (F8)",
" (Ctrl + F8)",
this,
SLOT( toggleAutomationEditorWin() ),
m_toolBar );
automation_editor_window->setShortcut( Qt::Key_F8 );
automation_editor_window->setShortcut( Qt::CTRL + Qt::Key_F8 );

ToolButton * fx_mixer_window = new ToolButton(
embed::getIconPixmap( "fx_mixer" ),
tr( "FX Mixer" ) + " (F9)",
tr( "FX Mixer" ) + " (Ctrl + F9)",
this, SLOT( toggleFxMixerWin() ),
m_toolBar );
fx_mixer_window->setShortcut( Qt::Key_F9 );
fx_mixer_window->setShortcut( Qt::CTRL + Qt::Key_F9 );

ToolButton * controllers_window = new ToolButton(
embed::getIconPixmap( "controller" ),
tr( "Show/hide controller rack" ) +
" (F10)",
" (Ctrl + F10)",
this, SLOT( toggleControllerRack() ),
m_toolBar );
controllers_window->setShortcut( Qt::Key_F10 );
controllers_window->setShortcut( Qt::CTRL + Qt::Key_F10 );

ToolButton * project_notes_window = new ToolButton(
embed::getIconPixmap( "project_notes" ),
tr( "Show/hide project notes" ) +
" (F11)",
" (Ctrl + F11)",
this, SLOT( toggleProjectNotesWin() ),
m_toolBar );
project_notes_window->setShortcut( Qt::Key_F11 );
project_notes_window->setShortcut( Qt::CTRL + Qt::Key_F11 );

m_toolBarLayout->addWidget( song_editor_window, 1, 1 );
m_toolBarLayout->addWidget( bb_editor_window, 1, 2 );
Expand Down Expand Up @@ -738,6 +741,7 @@ void MainWindow::saveWidgetState( QWidget * _w, QDomElement & _de )
_de.setAttribute( "visible", visible );
_de.setAttribute( "minimized", _w->isMinimized() );
_de.setAttribute( "maximized", _w->isMaximized() );
_de.setAttribute( "fullscreen", _w->isFullScreen() );
ryuukumar marked this conversation as resolved.
Show resolved Hide resolved

_de.setAttribute( "x", normalGeom.x() );
_de.setAttribute( "y", normalGeom.y() );
Expand Down Expand Up @@ -782,6 +786,9 @@ void MainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de )
flags = _de.attribute( "maximized" ).toInt() ?
( flags | Qt::WindowMaximized ) :
( flags & ~Qt::WindowMaximized );
flags = _de.attribute( "fullscreen" ).toInt() ?
( flags | Qt::WindowFullScreen ) :
( flags & ~Qt::WindowFullScreen );
ryuukumar marked this conversation as resolved.
Show resolved Hide resolved
_w->setWindowState( flags );

_w->setVisible( _de.attribute( "visible" ).toInt() );
Expand Down Expand Up @@ -1007,6 +1014,21 @@ void MainWindow::toggleWindow( QWidget *window, bool forceShow )



void MainWindow::toggleFullscreen()
{
if ( !isFullScreen() )
{
maximised = isMaximized();
showFullScreen();
}
else
{
show();
showMaximized();
}
}



/*
* When an editor window with focus is toggled off, attempt to set focus
Expand Down Expand Up @@ -1093,34 +1115,38 @@ 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" ) + " (Ctrl + F5)",
this, SLOT( toggleSongEditorWin() )
);
m_viewMenu->addAction(embed::getIconPixmap( "bb_track" ),
tr( "Beat+Bassline Editor" ) + " (F6)",
tr( "Beat+Bassline Editor" ) + " (Ctrl + F6)",
this, SLOT( toggleBBEditorWin() )
);
m_viewMenu->addAction(embed::getIconPixmap( "piano" ),
tr( "Piano Roll" ) + " (F7)",
tr( "Piano Roll" ) + " (Ctrl + F7)",
this, SLOT( togglePianoRollWin() )
);
m_viewMenu->addAction(embed::getIconPixmap( "automation" ),
tr( "Automation Editor" ) + " (F8)",
tr( "Automation Editor" ) + " (Ctrl + F8)",
this,
SLOT( toggleAutomationEditorWin())
);
m_viewMenu->addAction(embed::getIconPixmap( "fx_mixer" ),
tr( "FX Mixer" ) + " (F9)",
tr( "FX Mixer" ) + " (Ctrl + F9)",
this, SLOT( toggleFxMixerWin() )
);
m_viewMenu->addAction(embed::getIconPixmap( "controller" ),
tr( "Controller Rack" ) + " (F10)",
tr( "Controller Rack" ) + " (Ctrl + F10)",
this, SLOT( toggleControllerRack() )
);
m_viewMenu->addAction(embed::getIconPixmap( "project_notes" ),
tr( "Project Notes" ) + " (F11)",
tr( "Project Notes" ) + " (Ctrl + F11)",
this, SLOT( toggleProjectNotesWin() )
);
m_viewMenu->addAction(embed::getIconPixmap( "maximize" ),
tr( "Fullscreen" ) + " (F11)",
this, SLOT( toggleFullscreen() )
);

m_viewMenu->addSeparator();

Expand Down
6 changes: 6 additions & 0 deletions src/gui/editors/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ void Editor::togglePause()
Engine::getSong()->togglePause();
}

void Editor::toggleMaximise()
{
isMaximized() ? showNormal() : showMaximized();
}

Editor::Editor(bool record, bool stepRecord) :
m_toolBar(new DropToolBar(this)),
m_playAction(nullptr),
Expand Down Expand Up @@ -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(toggleMaximise()));

// Add actions to toolbar
addButton(m_playAction, "playButton");
Expand Down