diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-02-14 10:59:34 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-02-14 16:23:19 +0100 |
commit | 3d61c9026a8a562022fa3099472a82b60172f112 (patch) | |
tree | e048f361c367c97eddbbe52d1cddbb2a04260c6e /avmedia | |
parent | 0414b84a8ad5a436df4354a5af1e8486334acb42 (diff) |
update play/pause/stop when one of the other changes
so (esp under gtk) that when pause is enabled and pause
is clicked again that it remains visually enabled
Change-Id: I779bb1491d2473db926b8075a0b574ef5767337d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129909
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'avmedia')
-rw-r--r-- | avmedia/source/framework/MediaControlBase.cxx | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/avmedia/source/framework/MediaControlBase.cxx b/avmedia/source/framework/MediaControlBase.cxx index eac8fc3923c5..16ab1df32aa2 100644 --- a/avmedia/source/framework/MediaControlBase.cxx +++ b/avmedia/source/framework/MediaControlBase.cxx @@ -128,6 +128,28 @@ void MediaControlBase::InitializeWidgets() mxTimeSlider->set_tooltip_text( AvmResId( AVMEDIA_STR_POSITION )); } +void MediaControlBase::UpdatePlayState(const MediaItem& rMediaItem) +{ + if (rMediaItem.getState() == MediaState::Play) + { + mxPlayToolBox->set_item_active("play", true); + mxPlayToolBox->set_item_active("pause", false); + mxPlayToolBox->set_item_active("stop", false); + } + else if( rMediaItem.getState() == MediaState::Pause ) + { + mxPlayToolBox->set_item_active("play", false); + mxPlayToolBox->set_item_active("pause", true); + mxPlayToolBox->set_item_active("stop", false); + } + else + { + mxPlayToolBox->set_item_active("play", false); + mxPlayToolBox->set_item_active("pause", false); + mxPlayToolBox->set_item_active("stop", true); + } +} + void MediaControlBase::UpdateToolBoxes(const MediaItem& rMediaItem) { const bool bValidURL = !rMediaItem.getURL().isEmpty(); @@ -145,24 +167,7 @@ void MediaControlBase::UpdateToolBoxes(const MediaItem& rMediaItem) { mxPlayToolBox->set_sensitive(true); mxMuteToolBox->set_sensitive(true); - if( rMediaItem.getState() == MediaState::Play ) - { - mxPlayToolBox->set_item_active("play", true); - mxPlayToolBox->set_item_active("pause", false); - mxPlayToolBox->set_item_active("stop", false); - } - else if( rMediaItem.getState() == MediaState::Pause ) - { - mxPlayToolBox->set_item_active("play", false); - mxPlayToolBox->set_item_active("pause", true); - mxPlayToolBox->set_item_active("stop", false); - } - else - { - mxPlayToolBox->set_item_active("play", false); - mxPlayToolBox->set_item_active("pause", false); - mxPlayToolBox->set_item_active("stop", true); - } + UpdatePlayState(rMediaItem); mxPlayToolBox->set_item_active("loop", rMediaItem.isLoop()); mxMuteToolBox->set_item_active("mute", rMediaItem.isMute()); if (!mbCurrentlySettingZoom) @@ -221,15 +226,21 @@ void MediaControlBase::SelectPlayToolBoxItem( MediaItem& aExecItem, MediaItem co aExecItem.setTime( 0.0 ); else aExecItem.setTime( aItem.getTime() ); + + UpdatePlayState(aExecItem); } else if (rId == "pause") { aExecItem.setState( MediaState::Pause ); + + UpdatePlayState(aExecItem); } else if (rId == "stop") { aExecItem.setState( MediaState::Stop ); aExecItem.setTime( 0.0 ); + + UpdatePlayState(aExecItem); } else if (rId == "mute") { |