extragear/multimedia/amarok/src

Leo Franchi lfranchi at kde.org
Tue Nov 25 21:18:23 CET 2008


SVN commit 889025 by lfranchi:

make lyrics cached. this sets the HTML of the lyrics to be cached. reasoning: previously, if you had a track playing and resume on start enabled, and had the lyrics applet visible, when opening amarok you would have to press the refresh button to see the lyrics (this is because the scriptmanager *must* be created after MainWindow). so caching fixes this bug

if you notice *any* lyrics weirdness, please get ahold of me.

CCMAIL: amarok-devel at kde.org

 M  +2 -0      context/LyricsManager.cpp  
 M  +2 -2      context/engines/lyrics/LyricsEngine.cpp  
 M  +4 -4      dialogs/TagDialog.cpp  
 M  +1 -0      scriptengine/AmarokLyricsScript.cpp  
 M  +3 -0      scriptengine/AmarokLyricsScript.h  


--- trunk/extragear/multimedia/amarok/src/context/LyricsManager.cpp #889024:889025
@@ -176,5 +176,7 @@
     {
         sendNewLyricsHtml( lyricsHTML );
     }
+    // cache the Html anyway.
+    The::engineController()->currentTrack()->setCachedLyrics( lyricsHTML );
 }
 
--- trunk/extragear/multimedia/amarok/src/context/engines/lyrics/LyricsEngine.cpp #889024:889025
@@ -1,5 +1,5 @@
 /***************************************************************************
- * copyright            : (C) 2007 Leo Franchi <lfranchi at gmail.com>        *
+ * copyright            : (C) 2007-2008 Leo Franchi <lfranchi at gmail.com>   *
  * copyright            : (C) 2008 Mark Kretschmann <kretschmann at kde.org>  *
  **************************************************************************/
 
@@ -117,7 +117,7 @@
     }
 
     if( cached )
-        LyricsManager::self()->lyricsResult( lyrics.toUtf8(), true );
+        LyricsManager::self()->lyricsResultHtml( lyrics.toUtf8(), true );
     else if( !ScriptManager::instance()->lyricsScriptRunning() ) // no lyrics, and no lyrics script!
     {
         removeAllData( "lyrics" );
--- trunk/extragear/multimedia/amarok/src/dialogs/TagDialog.cpp #889024:889025
@@ -861,7 +861,7 @@
     ui->kLineEdit_location->setText( m_currentTrack->prettyUrl() );
 
     //lyrics
-    ui->kTextEdit_lyrics->setText( m_lyrics );
+    ui->kTextEdit_lyrics->setHtml( m_lyrics );
 
     if( m_currentTrack->album() )
     {
@@ -1312,11 +1312,11 @@
 void
 TagDialog::loadLyrics( const Meta::TrackPtr &track )
 {
-    QString xml = lyricsForTrack( track );
+    QString html = lyricsForTrack( track );
 
     QDomDocument doc;
-    if( doc.setContent( xml ) )
-        m_lyrics = doc.documentElement().text();
+    if( !html.isEmpty() )
+        m_lyrics = html;
     else
         m_lyrics.clear();
 }
--- trunk/extragear/multimedia/amarok/src/scriptengine/AmarokLyricsScript.cpp #889024:889025
@@ -45,6 +45,7 @@
 AmarokLyricsScript::showLyrics( const QString& lyrics ) const
 {
     DEBUG_BLOCK
+    AMAROK_DEPRECATED
     Meta::TrackPtr track = The::engineController()->currentTrack();
     if( !track )
         return;
--- trunk/extragear/multimedia/amarok/src/scriptengine/AmarokLyricsScript.h #889024:889025
@@ -35,7 +35,10 @@
     ~AmarokLyricsScript();
 
 public slots:
+    // NOTE TODO
+    // we really need to pull this out, but shouldn't break the API now
     void showLyrics( const QString& lyrics ) const;
+    
     void showLyricsHtml( const QString& lyrics ) const;
     void setLyricsForTrack( const QString& trackUrl , const QString& lyrics ) const;
     QString toUtf8( const QByteArray& lyrics, const QString& encoding = "UTF-8" );


More information about the Amarok-devel mailing list