Commit 2a8cb378 authored by Yash Ladia's avatar Yash Ladia Committed by Albert Astals Cid
Browse files

Fix Bug 302299 - Autoscrolling Lyrics are scrolling down if a song is rated...

Fix Bug 302299 - Autoscrolling Lyrics are scrolling down if a song is rated via Context Browser's Current Track

The bug was occuring since 'userAutoScrollOffset' and 'oldSliderPosition' were being reset when track metadata was changed. This should not happen.

I split the function: 'void _trackDataChanged( Meta::TrackPtr )' into 'void _trackChanged( Meta::TrackPtr )' and 'void _trackMetadataChanged( Meta::TrackPtr )'

REVIEW: 116641
BUGS: 302299
parent 4bc12434
/****************************************************************************************
* Copyright (c) 2007 Leo Franchi <lfranchi@gmail.com> *
* Copyright (c) 2009 simon.esneault <simon.esneault@gmail.com> *
* Copyright (c) 2014 Yash Ladia <yashladia1@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License as published by the Free Software *
......@@ -80,7 +81,8 @@ public:
void _toggleAutoScroll();
void _suggestionChosen( const LyricsSuggestion &suggestion );
void _unsetCursor();
void _trackDataChanged( Meta::TrackPtr );
void _trackChanged( Meta::TrackPtr );
void _trackMetadataChanged( Meta::TrackPtr );
void _trackPositionChanged( qint64 position, bool userSeek );
void _lyricsChangedMessageButtonPressed( const Plasma::MessageButton button );
......@@ -369,11 +371,17 @@ LyricsAppletPrivate::_unsetCursor()
}
void
LyricsAppletPrivate::_trackDataChanged( Meta::TrackPtr track )
LyricsAppletPrivate::_trackChanged( Meta::TrackPtr track )
{
userAutoScrollOffset = 0;
oldSliderPosition = 0;
// meta data also changed, so to avoid code duplication
_trackMetadataChanged( track );
}
void
LyricsAppletPrivate::_trackMetadataChanged( Meta::TrackPtr track )
{
// Check if we previously had a track.
// If the lyrics currently shown in the browser (which
// additionally is in edit mode) are different from the
......@@ -512,15 +520,15 @@ LyricsApplet::init()
EngineController* engine = The::engineController();
connect( engine, SIGNAL(trackChanged(Meta::TrackPtr)), this, SLOT(_trackDataChanged(Meta::TrackPtr)) );
connect( engine, SIGNAL(trackMetadataChanged(Meta::TrackPtr)), this, SLOT(_trackDataChanged(Meta::TrackPtr)) );
connect( engine, SIGNAL(trackChanged(Meta::TrackPtr)), this, SLOT(_trackChanged(Meta::TrackPtr)) );
connect( engine, SIGNAL(trackMetadataChanged(Meta::TrackPtr)), this, SLOT(_trackMetadataChanged(Meta::TrackPtr)) );
connect( engine, SIGNAL(trackPositionChanged(qint64,bool)), this, SLOT(_trackPositionChanged(qint64,bool)) );
connect( d->suggestView, SIGNAL(selected(LyricsSuggestion)), SLOT(_suggestionChosen(LyricsSuggestion)) );
connect( dataEngine("amarok-lyrics"), SIGNAL(sourceAdded(QString)), this, SLOT(connectSource(QString)) );
// This is needed as a track might be playing when the lyrics applet
// is added to the ContextView.
d->_trackDataChanged( engine->currentTrack() );
d->_trackChanged( engine->currentTrack() );
d->_trackPositionChanged( engine->trackPositionMs(), false );
d->determineActionIconsState();
......
/****************************************************************************************
* Copyright (c) 2007 Leo Franchi <lfranchi@gmail.com> *
* Copyright (c) 2009 simon.esneault <simon.esneault@gmail.com> *
* Copyright (c) 2014 Yash Ladia <yashladia1@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License as published by the Free Software *
......@@ -57,7 +58,8 @@ private:
Q_PRIVATE_SLOT( d_ptr, void _toggleAutoScroll() )
Q_PRIVATE_SLOT( d_ptr, void _suggestionChosen(LyricsSuggestion) )
Q_PRIVATE_SLOT( d_ptr, void _unsetCursor() )
Q_PRIVATE_SLOT( d_ptr, void _trackDataChanged( Meta::TrackPtr ) )
Q_PRIVATE_SLOT( d_ptr, void _trackChanged( Meta::TrackPtr ) )
Q_PRIVATE_SLOT( d_ptr, void _trackMetadataChanged( Meta::TrackPtr ) )
Q_PRIVATE_SLOT( d_ptr, void _trackPositionChanged( qint64 position, bool userSeek ) )
Q_PRIVATE_SLOT( d_ptr, void _lyricsChangedMessageButtonPressed(const Plasma::MessageButton) )
Q_PRIVATE_SLOT( d_ptr, void _refetchMessageButtonPressed(const Plasma::MessageButton) )
......
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