extragear/multimedia/amarok/src

Maximilian Kossick maximilian.kossick at googlemail.com
Mon May 12 10:13:39 CEST 2008


what's the use case for this? and please figure out another way to
solve this. this breaks the principle of information hiding, and
that's a Very Bad Thing(tm).

On Mon, May 12, 2008 at 6:39 AM, Dan Meltzer
<hydrogen at notyetimplemented.com> wrote:
> SVN commit 806695 by dmeltzer:
>
> Add a totalTime method to dbus that returns the length of the collection in seconds.
>
>
>  M  +9 -0      amarokdbushandler.cpp
>  M  +4 -4      amarokdbushandler.h
>  M  +3 -0      org.kde.amarok.collection.xml
>
>
> --- trunk/extragear/multimedia/amarok/src/amarokdbushandler.cpp #806694:806695
> @@ -841,6 +841,15 @@
>         return final;
>     }
>
> +    int DbusCollectionHandler::totalTime()
> +    {
> +        // The total length of ones primary collection, in seconds
> +        QStringList totalTime = CollectionManager::instance()->sqlStorage()->query( "SELECT SUM( length ) from tracks;" );
> +        if( totalTime.size() < 0 )
> +            return 0;
> +        return totalTime[ 0 ].toInt();
> +    }
> +
>     bool DbusCollectionHandler::isDirInCollection( const QString& path )
>     {
>         AMAROK_NOTIMPLEMENTED
> --- trunk/extragear/multimedia/amarok/src/amarokdbushandler.h #806694:806695
> @@ -23,9 +23,8 @@
>  #include "amarok_export.h"
>
>  #include <QObject>
> -//Added by qt3to4:
>  #include <QByteArray>
> -#include <kurl.h>
> +#include <KUrl>
>
>  namespace Amarok
>  {
> @@ -175,13 +174,14 @@
>    public:
>        DbusCollectionHandler();
>
> -   public /* DCOP */ slots:
> +   public slots:
>       virtual int totalAlbums();
>       virtual int totalArtists();
>       virtual int totalComposers();
>       virtual int totalCompilations();
>       virtual int totalGenres();
>       virtual int totalTracks();
> +      virtual int totalTime();
>       virtual bool isDirInCollection( const QString &path );
>       virtual bool moveFile( const QString &oldURL, const QString &newURL, bool overwrite );
>       virtual QStringList query(const QString& sql);
> @@ -202,7 +202,7 @@
>    public:
>        DbusScriptHandler();
>
> -   public /* DCOP */ slots:
> +   public slots:
>       virtual bool runScript(const QString&);
>       virtual bool stopScript(const QString&);
>       virtual QStringList listRunningScripts();
> --- trunk/extragear/multimedia/amarok/src/org.kde.amarok.collection.xml #806694:806695
> @@ -20,6 +20,9 @@
>     <method name="totalTracks" >
>       <arg type="i" direction="out"/>
>     </method>
> +    <method name="totalTime" >
> +        <arg type="i" direction="out"/>
> +    </method>
>     <method name="isDirInCollection" >
>       <arg type="b" direction="out"/>
>       <arg name="name" type="s" direction="in"/>
>


More information about the Amarok-devel mailing list