diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-02-14 10:59:34 +0000 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-02-18 12:35:40 +0100 |
commit | d58f32800a9ad0e37378478fd78c9539c2af3c8a (patch) | |
tree | a9bcfa98823b244a6098cb193a06615ec8ef2480 /avmedia | |
parent | af4469c47a9e6023ecf6d3bd5df6c1f36d90cb22 (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/+/129927
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
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 c572bed7d0e6..dc83204d4228 100644 --- a/avmedia/source/framework/MediaControlBase.cxx +++ b/avmedia/source/framework/MediaControlBase.cxx @@ -133,6 +133,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(); @@ -150,24 +172,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) @@ -226,15 +231,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") { |