extragear/multimedia/amarok/src/collection/sqlcollection

Maximilian Kossick maximilian.kossick at googlemail.com
Wed Jul 16 08:23:54 CEST 2008


updatecapability is an awful hack imo. this is basically allows the
whole world to make decisions that should be internal to the
collection. the tagdialog could simply check if the collection browser
is visible and force an update if it is (the methods to do that should
already exist). there's no need to add another capability just for
that single use case. Some care would have to be taken to avoid a
circular dependency. Another option would be to trigger the collection
updated signal once after all updates using a timer. control won't
return to the event loop until all tracks were updated, so a timeout
of 0 would be fine. we could add a couple of convenience methods to
collection so we won't have to implement the code again and again.

On Tue, Jul 15, 2008 at 8:15 PM, Alejandro Daniel Wainzinger
<aikawarazuni at gmail.com> wrote:
> SVN commit 832884 by awainzinger:
>
> SqlMeta now implements UpdateCapability.  No more possibility of editing possibly non-existant tracks in collection browser.
>
>
>  M  +21 -0     SqlMeta.cpp
>
>
> --- trunk/extragear/multimedia/amarok/src/collection/sqlcollection/SqlMeta.cpp #832883:832884
> @@ -27,6 +27,7 @@
>  #include "meta/CustomActionsCapability.h"
>  #include "meta/EditCapability.h"
>  #include "meta/OrganiseCapability.h"
> +#include "meta/UpdateCapability.h"
>  #include "MetaUtility.h"
>  #include "ScriptManager.h"
>  #include "servicebrowser/lastfm/SimilarArtistsAction.h"
> @@ -98,6 +99,21 @@
>         KSharedPtr<SqlTrack> m_track;
>  };
>
> +class UpdateCapabilitySql : public Meta::UpdateCapability
> +{
> +    Q_OBJECT
> +    public:
> +        UpdateCapabilitySql( SqlTrack *track )
> +    : Meta::UpdateCapability()
> +                , m_track( track ) {}
> +
> +        virtual void collectionUpdated() const { m_track->collection()->collectionUpdated(); }
> +
> +
> +    private:
> +        KSharedPtr<SqlTrack> m_track;
> +};
> +
>  QString
>  SqlTrack::getTrackReturnValues()
>  {
> @@ -647,6 +663,8 @@
>         case Meta::Capability::CustomActions:
>         case Meta::Capability::Organisable:
>             return true;
> +        case Meta::Capability::Updatable:
> +            return true;
>
>         default:
>             return false;
> @@ -676,6 +694,9 @@
>             return new OrganiseCapabilityImpl( this );
>         }
>
> +        case Meta::Capability::Updatable:
> +            return new UpdateCapabilitySql( this );
> +
>         default:
>             return 0;
>     }
>


More information about the Amarok-devel mailing list