Kaydet (Commit) b2ccf5ef authored tarafından Katarina Behrens's avatar Katarina Behrens

tdf#100007: slider and time field update during video playback

To make this happen, restart idle in timeout handler (also start it
when user bonks Play button and stop it when they bonk Pause or Stop
button).
The idle also needs a lower prio than TaskPriority::Repaint,
otherwise the higher-prio events from our idle are going to starve UI
repaints in the scheduler queue

Change-Id: I4c767c3533e0e2ee9015c48b17075db5e0dc7ade
Reviewed-on: https://gerrit.libreoffice.org/70068
Tested-by: Jenkins
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst bac831c8
......@@ -77,6 +77,7 @@ private:
Size maMinSize;
bool mbLocked;
MediaControlStyle meControlStyle;
double mfTime;
};
}
......
......@@ -44,7 +44,8 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl
maIdle( "avmedia MediaControl Idle" ),
maItem( 0, AVMediaSetMask::ALL ),
mbLocked( false ),
meControlStyle( eControlStyle )
meControlStyle( eControlStyle ),
mfTime(0.0)
{
mpPlayToolBox = VclPtr<ToolBox>::Create(this, WB_3DLOOK) ;
mpTimeSlider = VclPtr<Slider>::Create(this, WB_HORZ | WB_DRAG | WB_3DLOOK) ;
......@@ -116,10 +117,10 @@ MediaControl::MediaControl( vcl::Window* pParent, MediaControlStyle eControlStyl
mpZoomToolBox->SetBackground();
mpZoomToolBox->SetPaintTransparent( true );
}
maIdle.SetPriority( TaskPriority::HIGH_IDLE );
// we want time field + progress slider to update as the media plays
// give this task a lower prio than REPAINT so that UI updates are not starved
maIdle.SetPriority( TaskPriority::POST_PAINT );
maIdle.SetInvokeHandler( LINK( this, MediaControl, implTimeoutHdl ) );
maIdle.Start();
}
void MediaControl::InitializeWidgets()
......@@ -245,8 +246,10 @@ void MediaControl::Resize()
void MediaControl::setState( const MediaItem& rItem )
{
if( !mbLocked )
double fTime = rItem.getTime();
if( !mbLocked && fTime != mfTime)
{
mfTime = fTime;
maItem.merge( rItem );
if( rItem.getURL().isEmpty() && meControlStyle == MEDIACONTROLSTYLE_SINGLELINE )
mpPlayToolBox->Disable();
......@@ -310,6 +313,12 @@ IMPL_LINK( MediaControl, implSelectHdl, ToolBox*, p, void )
else
SelectPlayToolBoxItem( aExecItem, maItem, p->GetCurItemId() );
if (aExecItem.getState() == MediaState::Play)
maIdle.Start();
else if (aExecItem.getState() == MediaState::Pause ||
aExecItem.getState() == MediaState::Stop)
maIdle.Stop();
if( aExecItem.getMaskSet() != AVMediaSetMask::NONE )
execute( aExecItem );
}
......@@ -347,6 +356,7 @@ IMPL_LINK( MediaControl, implZoomSelectHdl, ListBox&, p, void )
IMPL_LINK_NOARG(MediaControl, implTimeoutHdl, Timer *, void)
{
update();
maIdle.Start();
}
} // namespace avmedia
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment