From 774d09b7a10991973aedd5349f3a930702bded52 Mon Sep 17 00:00:00 2001 From: Alexandre Almeida Date: Sun, 9 Feb 2014 18:44:51 -0200 Subject: [PATCH 1/9] Update song_editor.cpp A better way to update the play button icons, which requires less "if" checks and method calls in total. --- src/gui/song_editor.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/gui/song_editor.cpp b/src/gui/song_editor.cpp index 822ef8bc4..d4376fd7f 100644 --- a/src/gui/song_editor.cpp +++ b/src/gui/song_editor.cpp @@ -429,22 +429,15 @@ void songEditor::scrolled( int _new_pos ) -void songEditor::updatePlayPauseIcon() +void songEditor::setPauseIcon( bool pause ) { - if( engine::getSong()->playMode() != song::Mode_PlaySong ) + if( pause == true ) { - m_playButton->setIcon( embed::getIconPixmap( "play" ) ); + m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); } else { - if( engine::getSong()->isPlaying() ) - { - m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); - } - else - { - m_playButton->setIcon( embed::getIconPixmap( "play" ) ); - } + m_playButton->setIcon( embed::getIconPixmap( "play" ) ); } } From 5239afb3e461a61a22f6daf741e9c621d642ba0c Mon Sep 17 00:00:00 2001 From: Alexandre Almeida Date: Sun, 9 Feb 2014 18:46:39 -0200 Subject: [PATCH 2/9] Update piano_roll.cpp A better way to update the play button icons, which requires less "if" checks and method calls in total. --- src/gui/piano_roll.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 46b78b2c8..caaf0d7d0 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -798,22 +798,15 @@ void pianoRoll::loadSettings( const QDomElement & _this ) -void pianoRoll::updatePlayPauseIcon() +void pianoRoll::setPauseIcon( bool pause ) { - if( engine::getSong()->playMode() != song::Mode_PlayPattern ) + if( pause == true ) { - m_playButton->setIcon( embed::getIconPixmap( "play" ) ); + m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); } else { - if( engine::getSong()->isPlaying() ) - { - m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); - } - else - { - m_playButton->setIcon( embed::getIconPixmap( "play" ) ); - } + m_playButton->setIcon( embed::getIconPixmap( "play" ) ); } } From 40c35f2092364576495fafaeb2f335dcbe6e908d Mon Sep 17 00:00:00 2001 From: Alexandre Almeida Date: Sun, 9 Feb 2014 18:47:51 -0200 Subject: [PATCH 3/9] Update AutomationEditor.cpp A better way to update the play button icons, which requires less "if" checks and method calls in total. --- src/gui/AutomationEditor.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/gui/AutomationEditor.cpp b/src/gui/AutomationEditor.cpp index 31e582a7c..b48f2b582 100644 --- a/src/gui/AutomationEditor.cpp +++ b/src/gui/AutomationEditor.cpp @@ -489,22 +489,15 @@ void AutomationEditor::loadSettings( const QDomElement & _this ) -void AutomationEditor::updatePlayPauseIcon() +void AutomationEditor::setPauseIcon( bool pause ) { - if( engine::getSong()->playMode() != song::Mode_PlayPattern ) + if( pause == true ) { - m_playButton->setIcon( embed::getIconPixmap( "play" ) ); + m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); } else { - if( engine::getSong()->isPlaying() ) - { - m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); - } - else - { - m_playButton->setIcon( embed::getIconPixmap( "play" ) ); - } + m_playButton->setIcon( embed::getIconPixmap( "play" ) ); } } From 10b8990ac5dab17faf82854c947c775a3d4d1776 Mon Sep 17 00:00:00 2001 From: Alexandre Almeida Date: Sun, 9 Feb 2014 18:52:11 -0200 Subject: [PATCH 4/9] Update song_editor.h A better way to update the play button icons, which requires less "if" checks and method calls in total. --- include/song_editor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/song_editor.h b/include/song_editor.h index af10cd51c..1b3483778 100644 --- a/include/song_editor.h +++ b/include/song_editor.h @@ -59,12 +59,12 @@ public: songEditor( song * _song, songEditor * & _engine_ptr ); virtual ~songEditor(); + void setPauseIcon( bool pause ); + public slots: void scrolled( int _new_pos ); - void updatePlayPauseIcon(); - private slots: void setHighQuality( bool ); From 2a1f4a61fa089ac7df688b526b72fa0824e9aa8f Mon Sep 17 00:00:00 2001 From: Alexandre Almeida Date: Sun, 9 Feb 2014 18:54:23 -0200 Subject: [PATCH 5/9] Update piano_roll.h A better way to update the play button icons, which requires less "if" checks and method calls in total. --- include/piano_roll.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/piano_roll.h b/include/piano_roll.h index 162a6723c..05993c27f 100644 --- a/include/piano_roll.h +++ b/include/piano_roll.h @@ -89,7 +89,7 @@ public: return "pianoroll"; } - void updatePlayPauseIcon(); + void setPauseIcon( bool pause ); protected: From 64e1c2080ca8a38b3eb910a0737e8def14abd42a Mon Sep 17 00:00:00 2001 From: Alexandre Almeida Date: Sun, 9 Feb 2014 18:55:29 -0200 Subject: [PATCH 6/9] Update bb_editor.h A better way to update the play button icons, which requires less "if" checks and method calls in total. --- include/bb_editor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/bb_editor.h b/include/bb_editor.h index a4bce6253..c1ebd96cd 100644 --- a/include/bb_editor.h +++ b/include/bb_editor.h @@ -48,7 +48,7 @@ public: void removeBBView( int _bb ); - void updatePlayPauseIcon(); + void setPauseIcon( bool pause ); public slots: From f10d856290b27c039600cc859456d4b4bd7ca84e Mon Sep 17 00:00:00 2001 From: Alexandre Almeida Date: Sun, 9 Feb 2014 18:57:03 -0200 Subject: [PATCH 7/9] Update engine.cpp A better way to update the play button icons, which requires less "if" checks and method calls in total. --- src/core/engine.cpp | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/core/engine.cpp b/src/core/engine.cpp index 575f0b474..86d8b8de3 100644 --- a/src/core/engine.cpp +++ b/src/core/engine.cpp @@ -150,10 +150,35 @@ void engine::destroy() void engine::updatePlayPauseIcons() { - s_songEditor->updatePlayPauseIcon(); - s_automationEditor->updatePlayPauseIcon(); - s_bbEditor->updatePlayPauseIcon(); - s_pianoRoll->updatePlayPauseIcon(); + s_songEditor->setPauseIcon( false ); + s_automationEditor->setPauseIcon( false ); + s_bbEditor->setPauseIcon( false ); + s_pianoRoll->setPauseIcon( false ); + + if( s_song->isPlaying() ) + { + switch( s_song->playMode() ) + { + case song::Mode_PlaySong: + s_songEditor->setPauseIcon( true ); + break; + + case song::Mode_PlayAutomationPattern: + s_automationEditor->setPauseIcon( true ); + break; + + case song::Mode_PlayBB: + s_bbEditor->setPauseIcon( true ); + break; + + case song::Mode_PlayPattern: + s_pianoRoll->setPauseIcon( true ); + break; + + default: + break; + } + } } From e6ec93284850292778589b4c0d50d4068ac93d68 Mon Sep 17 00:00:00 2001 From: Alexandre Almeida Date: Sun, 9 Feb 2014 19:02:07 -0200 Subject: [PATCH 8/9] Update bb_editor.cpp --- src/gui/bb_editor.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/gui/bb_editor.cpp b/src/gui/bb_editor.cpp index 3c60ffd74..4630223f6 100644 --- a/src/gui/bb_editor.cpp +++ b/src/gui/bb_editor.cpp @@ -171,22 +171,15 @@ void bbEditor::removeBBView( int _bb ) -void bbEditor::updatePlayPauseIcon() +void bbEditor::setPauseIcon( bool pause ) { - if( engine::getSong()->playMode() != song::Mode_PlayBB ) + if( pause == true ) { - m_playButton->setIcon( embed::getIconPixmap( "play" ) ); + m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); } else { - if( engine::getSong()->isPlaying() ) - { - m_playButton->setIcon( embed::getIconPixmap( "pause" ) ); - } - else - { - m_playButton->setIcon( embed::getIconPixmap( "play" ) ); - } + m_playButton->setIcon( embed::getIconPixmap( "play" ) ); } } From def115497164543a371c55d04b2223778753ed05 Mon Sep 17 00:00:00 2001 From: Alexandre Almeida Date: Sun, 9 Feb 2014 19:04:34 -0200 Subject: [PATCH 9/9] Update AutomationEditor.h --- include/AutomationEditor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/AutomationEditor.h b/include/AutomationEditor.h index 3219cdcc8..9ff61bf25 100644 --- a/include/AutomationEditor.h +++ b/include/AutomationEditor.h @@ -73,7 +73,7 @@ public: return( "automationeditor" ); } - void updatePlayPauseIcon(); + void setPauseIcon( bool pause ); public slots: