Commit c4386adf authored by Sam Lade's avatar Sam Lade
Browse files

Lyrics applet scrolls more intelligently

Aim to keep the current position in the lyrics centred, rather than
directly moving the scroll bar based on the position in the song.
Patch by Alexander Potashev.

BUG:283601
FIXED-IN:2.6
REVIEW:104935
parent e3f1c488
......@@ -86,6 +86,8 @@ VERSION 2.6-Beta 1
"1.2 GB free" is shown instead of "85% used"; thicker capacity bar.
BUGFIXES:
* Lyrics applet scrolls more intelligently. Patch by Alexander Potashev.
(BR 283601)
* Fix crash on startup related to ContextView. (BR 258741)
* Fix dragging of "No Labels" and "Various Artists" collection tree items.
* Don't add duplicates to playlist when dragging from collection. (BR 254411)
......
......@@ -407,8 +407,13 @@ LyricsAppletPrivate::_trackPositionChanged( qint64 position, bool userSeek )
if( engine->trackPositionMs() != 0 && !vbar->isSliderDown() && autoScroll )
{
userAutoScrollOffset = userAutoScrollOffset + vbar->value() - oldSliderPosition;
oldSliderPosition = (int)((((double)position/(double)engine->trackLength()))*vbar->maximum()) + userAutoScrollOffset;
vbar->setSliderPosition( oldSliderPosition );
// Scroll to try and keep the current position in the lyrics centred.
int newSliderPosition =
position * (vbar->maximum() + vbar->pageStep()) / engine->trackLength() -
vbar->pageStep() / 2 + userAutoScrollOffset;
vbar->setSliderPosition( newSliderPosition );
oldSliderPosition = vbar->value();
}
}
......
Supports Markdown
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