[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/multimedia/amarok/src
From: Peter Zhou <peterzhoulei () gmail ! com>
Date: 2008-09-04 16:18:15
Message-ID: 1220545095.392155.28452.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 857079 by peterzl:
isDirInCollection() is working for both dbus and qtscript scripting interface
M +2 -0 App.cpp
M +2 -0 CMakeLists.txt
A dbus/AmarokCollectionDBusHandler.cpp [License: GPL (v2+)]
A dbus/AmarokCollectionDBusHandler.h [License: GPL (v2+)]
A dbus/org.freedesktop.MediaPlayer.collection.xml
M +23 -3 scriptengine/AmarokCollectionScript.cpp
M +3 -2 scripts/qtscript_debug/main.js
--- trunk/extragear/multimedia/amarok/src/App.cpp #857078:857079
@@ -17,6 +17,7 @@
#include "App.h"
#include "Amarok.h"
+#include "AmarokCollectionDBusHandler.h"
#include "amarokconfig.h"
#include "CollectionManager.h"
#include "ConfigDialog.h"
@@ -537,6 +538,7 @@
new Amarok::RootDBusHandler();
new Amarok::PlayerDBusHandler();
new Amarok::TracklistDBusHandler();
+ new Amarok::AmarokCollectionDBusHandler();
QDBusConnection::sessionBus().registerService("org.mpris.amarok");
PERF_LOG( "Done creating DBus handlers" )
//DON'T DELETE THIS NEXT LINE or the app crashes when you click the X (unless we \
reimplement closeEvent)
--- trunk/extragear/multimedia/amarok/src/CMakeLists.txt #857078:857079
@@ -346,6 +346,7 @@
dbus/RootDBusHandler.cpp
dbus/PlayerDBusHandler.cpp
dbus/TracklistDBusHandler.cpp
+ dbus/AmarokCollectionDBusHandler.cpp
)
@@ -518,6 +519,7 @@
qt4_add_dbus_adaptor( amaroklib_LIB_SRCS dbus/org.freedesktop.MediaPlayer.root.xml \
RootDBusHandler.h Amarok::RootDBusHandler RootAdaptor RootAdaptor) \
qt4_add_dbus_adaptor( amaroklib_LIB_SRCS dbus/org.freedesktop.MediaPlayer.player.xml \
PlayerDBusHandler.h Amarok::PlayerDBusHandler PlayerAdaptor PlayerAdaptor) \
qt4_add_dbus_adaptor( amaroklib_LIB_SRCS \
dbus/org.freedesktop.MediaPlayer.tracklist.xml TracklistDBusHandler.h \
Amarok::TracklistDBusHandler TracklistAdaptor TracklistAdaptor) \
+qt4_add_dbus_adaptor( amaroklib_LIB_SRCS \
dbus/org.freedesktop.MediaPlayer.collection.xml AmarokCollectionDBusHandler.h \
Amarok::AmarokCollectionDBusHandler CollectionAdaptor CollectionAdaptor)
set( amaroklib_DEPENDS "amarokplasma" "amarokpud" )
--- trunk/extragear/multimedia/amarok/src/scriptengine/AmarokCollectionScript.cpp \
#857078:857079 @@ -17,10 +17,12 @@
#include "AmarokCollectionScript.h"
+#include "amarokconfig.h"
#include "App.h"
#include "collection/CollectionManager.h"
#include "collection/SqlStorage.h"
#include "collection/sqlcollection/SqlCollectionLocation.h"
+#include "Debug.h"
#include <QtScript>
@@ -109,11 +111,29 @@
bool AmarokCollectionScript::isDirInCollection( const QString& path )
{
- Q_UNUSED( path );
+ DEBUG_BLOCK
+
+ KUrl url = KUrl( path );
+ KUrl parentUrl;
+ foreach( const QString &dir, collectionLocation() )
+ {
+ debug() << "Collection Location: " << dir;
+ debug() << "path: " << path;
+ debug() << "scan Recursively: " << AmarokConfig::scanRecursively();
+ parentUrl.setPath( dir );
+ if ( !AmarokConfig::scanRecursively() )
+ {
+ if ( ( dir == path ) || ( dir + "/" == path ) )
+ return true;
+ }
+ else //scan recursively
+ {
+ if ( parentUrl.isParentOf( path ) )
+ return true;
+ }
+ }
return false;
}
-
-
}
#include "AmarokCollectionScript.moc"
--- trunk/extragear/multimedia/amarok/src/scripts/qtscript_debug/main.js \
#857078:857079 @@ -1,5 +1,5 @@
Importer.loadQtBinding( "qt.core" );
-Importer.include( "debug/debug.js" );
+//Importer.include( "debug/debug.js" );
//test engine:
@@ -96,4 +96,5 @@
for ( var x in location )
{
print ( location[x] );
-}
\ No newline at end of file
+}
+print( Amarok.Collection.isDirInCollection( "/home/eagle/Music" ) );
\ No newline at end of file
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic