mirror of
https://github.com/LMMS/lmms.git
synced 2026-04-01 21:04:18 -04:00
Control play/pause buttons in slot of MainWindow via signal in Song class
The engine class as the component instance manager is the wrong place to control the play/pause buttons. Instead emit a signal in the Song class and update the buttons in a slot in MainWindow. This fixes problems with GUI/pixmap operations happening outside the GUI thread when exporting a project. Closes #435.
This commit is contained in:
@@ -190,6 +190,9 @@ MainWindow::MainWindow() :
|
||||
connect(&m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(autoSave()));
|
||||
m_autoSaveTimer.start(1000 * 60); // 1 minute
|
||||
}
|
||||
|
||||
connect( engine::getSong(), SIGNAL( playbackStateChanged() ),
|
||||
this, SLOT( updatePlayPauseIcons() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -926,6 +929,42 @@ void MainWindow::toggleControllerRack()
|
||||
|
||||
|
||||
|
||||
void MainWindow::updatePlayPauseIcons()
|
||||
{
|
||||
engine::songEditor()->setPauseIcon( false );
|
||||
engine::automationEditor()->setPauseIcon( false );
|
||||
engine::getBBEditor()->setPauseIcon( false );
|
||||
engine::pianoRoll()->setPauseIcon( false );
|
||||
|
||||
if( engine::getSong()->isPlaying() )
|
||||
{
|
||||
switch( engine::getSong()->playMode() )
|
||||
{
|
||||
case song::Mode_PlaySong:
|
||||
engine::songEditor()->setPauseIcon( true );
|
||||
break;
|
||||
|
||||
case song::Mode_PlayAutomationPattern:
|
||||
engine::automationEditor()->setPauseIcon( true );
|
||||
break;
|
||||
|
||||
case song::Mode_PlayBB:
|
||||
engine::getBBEditor()->setPauseIcon( true );
|
||||
break;
|
||||
|
||||
case song::Mode_PlayPattern:
|
||||
engine::pianoRoll()->setPauseIcon( true );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MainWindow::undo()
|
||||
{
|
||||
engine::projectJournal()->undo();
|
||||
|
||||
Reference in New Issue
Block a user