[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/amarok/src/scriptengine
From:       Peter Zhou <peterzhoulei () gmail ! com>
Date:       2009-05-30 16:09:32
Message-ID: 1243699772.225275.21256.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 975645 by peterzl:

this fix the Amarok.Playlist.addMediaList problem, maybe need to verify the QVariant \
before using it?

 M  +3 -5      AmarokPlaylistScript.cpp  
 M  +3 -2      AmarokPlaylistScript.h  


--- trunk/extragear/multimedia/amarok/src/scriptengine/AmarokPlaylistScript.cpp \
#975644:975645 @@ -38,8 +38,6 @@
         , m_wrapperList( wrapperList )
         , m_scriptEngine( scriptEngine )
     {
-        qRegisterMetaType<QList<QUrl> >( "QList<QUrl>" ); //Needed for \
                addMediaList()
-
         connect( The::playlistModel(), SIGNAL( rowsInserted( const QModelIndex&, \
                int, int ) ), this, SLOT ( slotTrackInserted( const QModelIndex&, \
                int, int ) ) );
         connect( The::playlistModel(), SIGNAL( rowsRemoved( const QModelIndex&, int, \
                int ) ), this, SLOT ( slotTrackRemoved( const QModelIndex&, int, int \
                ) ) );
         connect( The::playlistModel(), SIGNAL( activeRowChanged( int ) ), this, \
SIGNAL( activeRowChanged( int ) ) ); @@ -71,11 +69,11 @@
         The::playlistController()->insertOptioned( track, Playlist::Append );
     }
 
-    void AmarokPlaylistScript::addMediaList( const QList<QUrl> &urls )
+	void AmarokPlaylistScript::addMediaList( const QVariantList &urls )
     {
         KUrl::List list;
-        foreach( const QUrl &url, urls )
-            list << url;
+        foreach( const QVariant &url, urls )
+            list << url.toUrl();
         Meta::TrackList tracks = CollectionManager::instance()->tracksForUrls( list \
                );
         The::playlistController()->insertOptioned( tracks, Playlist::Append );
     }
--- trunk/extragear/multimedia/amarok/src/scriptengine/AmarokPlaylistScript.h \
#975644:975645 @@ -26,13 +26,14 @@
 #include <QObject>
 #include <QUrl>
 #include <QtScript>
+#include <QVariant>
 
 namespace AmarokScript
 {
     class AmarokPlaylistScript : public QObject
     {
         Q_OBJECT
-
+		
         public:
             AmarokPlaylistScript( QScriptEngine* ScriptEngine, QList<QObject*>* \
wrapperList );  ~AmarokPlaylistScript();
@@ -42,7 +43,7 @@
             int totalTrackCount();
             QString saveCurrentPlaylist();
             void addMedia( const QUrl &url );
-            void addMediaList( const QList<QUrl> &urls );
+            void addMediaList( const QVariantList &urls );
             void clearPlaylist();
             void playByIndex( int index );
             void playMedia( const QUrl &url );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic