KDE/kdebase/workspace/plasma/dataengines/nowplaying

Alex Merry huntedhacker at tiscali.co.uk
Mon Jul 14 14:16:16 CEST 2008


SVN commit 832338 by alexmerry:

org.kde.Amarok.Player is dead.  Long live MPRIS.

The modification to mpris.cpp is necessary for getting the correct track number from Amarok.  Everything else is just scrapping the now-useless Amarok Player interface support.

Note that Amarok support won't be quite right until signal sending is fixed in Amarok.

CCMAIL: panel-devel at kde.org
Is this worth backporting to the RC, or should it wait for 4.1.1 (since Amarok is only at alpha stage)?  If it needs backporting, can someone else do it?



 M  +0 -2      CMakeLists.txt  
 D             amarok.cpp  
 D             amarok.h  
 D             amarok_p.h  
 M  +15 -5     mpris.cpp  
 M  +0 -2      nowplayingengine.cpp  
 D             org.kde.amarok.player.xml  


--- trunk/KDE/kdebase/workspace/plasma/dataengines/nowplaying/CMakeLists.txt #832337:832338
@@ -8,11 +8,9 @@
     pollingwatcher.cpp
     mpris.cpp
     juk.cpp
-    amarok.cpp
 )
 
 QT4_ADD_DBUS_INTERFACE(nowplaying_engine_SRCS org.kde.juk.player.xml juk_interface)
-QT4_ADD_DBUS_INTERFACE(nowplaying_engine_SRCS org.kde.amarok.player.xml amarok_interface)
 QT4_ADD_DBUS_INTERFACE(nowplaying_engine_SRCS mpris_interface.xml mpris_interface)
 
 macro_optional_find_package(GLIB2)
--- trunk/KDE/kdebase/workspace/plasma/dataengines/nowplaying/mpris.cpp #832337:832338
@@ -139,13 +139,23 @@
 
 int Mpris::trackNumber()
 {
+    QVariant track;
     if (m_metadata.contains("trackNumber")) {
-        QString track = m_metadata["trackNumber"].toString();
-        int pos = track.indexOf('/');
-        if (pos >= 0) {
-            track.truncate(pos);
+        track = m_metadata["trackNumber"];
+    } else if (m_metadata.contains("tracknumber")) {
+        track = m_metadata["tracknumber"];
+    }
+    if (track.isValid()) {
+        if (track.canConvert(QVariant::Int)) {
+            return track.toInt();
+        } else {
+            QString text = track.toString();
+            int pos = text.indexOf('/');
+            if (pos >= 0) {
+                text.truncate(pos);
+            }
+            return text.toInt();
         }
-        return track.toInt();
     }
     return 0;
 }
--- trunk/KDE/kdebase/workspace/plasma/dataengines/nowplaying/nowplayingengine.cpp #832337:832338
@@ -31,7 +31,6 @@
 #include "pollingwatcher.h"
 #include "mpris.h"
 #include "juk.h"
-#include "amarok.h"
 #ifdef XMMS_FOUND
 #include "xmms.h"
 #endif // XMMS_FOUND
@@ -55,7 +54,6 @@
 
     dbusWatcher->addFactory(new MprisFactory(dbusWatcher));
     dbusWatcher->addFactory(new JukFactory(dbusWatcher));
-    dbusWatcher->addFactory(new AmarokFactory(dbusWatcher));
 #ifdef XMMS_FOUND
     pollingWatcher->addFactory(new XmmsFactory(pollingWatcher));
 #endif


More information about the Panel-devel mailing list