extragear/multimedia/amarok/src

Seb Ruiz ruiz at kde.org
Mon Mar 23 02:11:25 CET 2009


2009/3/23 Valentin Rouet <v.rouet at gmail.com>:
> SVN commit 942962 by vrouet:
>
> Add functions to count the number of tracks in collections that don't have a QueryMaker

Personally, not such a fan of this commit. It pollutes the Collection
API with convenience functions. Where will we draw the line? At
artistCount(), albumCount(), genres() etc?

I suppose the question is, how much work would it be to actually
implement the QueryMakers properly for ipods and mtp devices?

>
>  M  +2 -1      browsers/collectionbrowser/CollectionTreeItem.cpp
>  M  +1 -1      browsers/collectionbrowser/CollectionTreeItem.h
>  M  +3 -0      collection/Collection.h
>  M  +1 -0      collection/ipodcollection/IpodCollection.h
>  M  +1 -0      collection/mtpcollection/MtpCollection.h
>
>
> --- trunk/extragear/multimedia/amarok/src/browsers/collectionbrowser/CollectionTreeItem.cpp #942961:942962
> @@ -111,7 +111,7 @@
>  }
>
>  QVariant
> -CollectionTreeItem::data( int role ) const
> +CollectionTreeItem::data( int role )
>  {
>     if( !m_data.isNull() )
>     {
> @@ -163,6 +163,7 @@
>             return m_parentCollection->icon();
>         else if( role == CustomRoles::ByLineRole )
>         {
> +            m_trackCount = m_parentCollection->trackCount();
>
>             if( m_trackCount < 0 )
>             {
> --- trunk/extragear/multimedia/amarok/src/browsers/collectionbrowser/CollectionTreeItem.h #942961:942962
> @@ -56,7 +56,7 @@
>         int childCount() const { return m_childItems.count(); }
>         int columnCount() const { return 1; }
>
> -        QVariant data( int role ) const;
> +        QVariant data( int role );
>
>         int row() const;
>
> --- trunk/extragear/multimedia/amarok/src/collection/Collection.h #942961:942962
> @@ -146,6 +146,9 @@
>             @return A unique identifier for this type of collection
>         */
>         virtual QString collectionId() const = 0;
> +
> +        // virtual bool hasQueryMaker() const { return true; }
> +        virtual int trackCount() { return -1; }
>         /**
>             @return a user visible name for this collection, to be displayed in the collectionbrowser and elsewhere
>         */
> --- trunk/extragear/multimedia/amarok/src/collection/ipodcollection/IpodCollection.h #942961:942962
> @@ -93,6 +93,7 @@
>         virtual CollectionLocation* location() const;
>
>         virtual QString collectionId() const;
> +        virtual int trackCount() { return trackMap().size(); }
>         virtual QString prettyName() const;
>         virtual KIcon icon() const { return KIcon("multimedia-player-apple-ipod"); };
>
> --- trunk/extragear/multimedia/amarok/src/collection/mtpcollection/MtpCollection.h #942961:942962
> @@ -91,6 +91,7 @@
>     virtual CollectionLocation* location() const;
>
>     virtual QString collectionId() const;
> +    virtual int trackCount() { return trackMap().size(); }
>     virtual QString prettyName() const;
>     virtual KIcon icon() const { return KIcon("multimedia-player"); }
>
>



-- 
Seb Ruiz

http://www.sebruiz.net/
http://amarok.kde.org/


More information about the Amarok-devel mailing list