Revision a512da3...

Go back to digest for 23rd September 2012

Optimization in Multimedia

Matěj Laitl committed changes in [amarok] /:

Meta::Track: move statistics methods into statistics() interface

* introduce Meta::Statistics, an interface to statistics-related
methods. Memory manager using KSharedPtr.
* remove (set)score(), (set)rating(), first/lastPlayed(), playCount()
from Meta::Track and move it to Meta::Statistics
* Because Meta::Statistics uses KSharedPtrs, existing track
implementations can just inherit Statistics and return this; in
Track::Statistics()
* Existing Track subclasses with dummy implementations of (set)score(),
(set)rating(), first/lastPlayed(), playCount() have it removed.
* Existing Track subclasses with meaningful implementations of
(set)score(), (set)rating(), first/lastPlayed(), playCount() turned
into Meta::Statistics and statistics() method is added for them.

Next steps:
* Make StatisticsProvider an implementation of Meta::Statistics, which
will in turn immensely simplify all tracks that use them.
* Add setPlaycount(), setFirst/LastPlayed() to Meta::Statistics and
ditch StatisticsCapability.
* Implement trackPlayed() in Meta::Track, ditch custom implementations.

Heavily based on Ralf's idea and patch in
https://git.reviewboard.kde.org/r/106276/ it is just attribute vs. the
subclass pattern + some minor details like notifyObservers() in
StatisticsStore, circular refcounting avoidance etc.

I want to deal with other track Capabilities in similar way in future,
the next one being EditCapability: I'd like to introduce Meta::Editable
and Meta::Track::editable() and rename {begin,end}MetaDataUpdate() to
just {begin,end}Update() to share even greater portion of code in Track
implementations.

File Changes

Added 2 files
  • /core/meta
  •   src/Statistics.cpp
  •   src/Statistics.h
Modified 64 files
  •   src/MainWindow.cpp
  •   src/TrayIcon.cpp
  •   src/core/CMakeLists.txt
  •   src/dialogs/TagDialog.cpp
  •   src/dialogs/TrackOrganizer.cpp
  •   src/playlist/PlaylistModel.cpp
  •   src/scriptengine/MetaTypeExporter.cpp
  •   src/services/ServiceMetaBase.cpp
  •   src/services/ServiceMetaBase.h
  •   src/widgets/Osd.cpp
  •   tests/mocks/MetaMock.h
  •   src/context/widgets/RecentlyPlayedListWidget.cpp
  •   src/core/meta/Meta.cpp
  •   src/core/meta/Meta.h
  •   src/core/podcasts/PodcastMeta.h
  •   src/playlist/navigators/FavoredRandomTrackNavigator.cpp
  •   src/playlist/proxymodels/GroupingProxy.cpp
  •   src/playlist/proxymodels/ProxyBase.cpp
  •   src/playlist/proxymodels/SortAlgorithms.cpp
  •   src/playlistgenerator/constraints/TagMatch.cpp
  •   tests/core/meta/TestMetaTrack.cpp
  •   src/context/applets/currenttrack/CurrentTrack.cpp
  •   src/core-impl/collections/audiocd/AudioCdMeta.cpp
  •   src/core-impl/collections/audiocd/AudioCdMeta.h
  •   src/core-impl/collections/daap/DaapMeta.cpp
  •   src/core-impl/collections/daap/DaapMeta.h
  •   src/core-impl/collections/ipodcollection/IpodMeta.cpp
  •   src/core-impl/collections/ipodcollection/IpodMeta.h
  •   src/core-impl/collections/mediadevicecollection/MediaDeviceMeta.cpp
  •   src/core-impl/collections/mediadevicecollection/MediaDeviceMeta.h
  •   src/core-impl/collections/playdarcollection/PlaydarMeta.cpp
  •   src/core-impl/collections/playdarcollection/PlaydarMeta.h
  •   src/core-impl/collections/proxycollection/ProxyCollectionMeta.cpp
  •   src/core-impl/collections/proxycollection/ProxyCollectionMeta.h
  •   src/core-impl/collections/support/MemoryCustomValue.cpp
  •   src/core-impl/collections/support/MemoryMeta.h
  •   src/core-impl/collections/upnpcollection/UpnpMeta.cpp
  •   src/core-impl/collections/upnpcollection/UpnpMeta.h
  •   src/core-impl/meta/file/File.cpp
  •   src/core-impl/meta/file/File.h
  •   src/core-impl/meta/file/File_p.h
  •   src/core-impl/meta/multi/MultiTrack.h
  •   src/core-impl/meta/proxy/MetaProxy.cpp
  •   src/core-impl/meta/proxy/MetaProxy.h
  •   src/core-impl/meta/stream/Stream.cpp
  •   src/core-impl/meta/stream/Stream.h
  •   src/core-impl/meta/stream/Stream_p.h
  •   src/core-impl/meta/timecode/TimecodeMeta.cpp
  •   src/core-impl/meta/timecode/TimecodeMeta.h
  •   src/core/meta/support/MetaConstants.cpp
  •   src/core/meta/support/MetaUtility.cpp
  •   src/playlist/view/listview/PrettyItemDelegate.cpp
  •   src/services/lastfm/meta/LastFmMeta.cpp
  •   src/services/lastfm/meta/LastFmMeta.h
  •   src/services/lastfm/meta/LastFmMeta_p.h
  •   playground/src/context/applets/coverbling/CoverBlingApplet.cpp
  •   src/core-impl/collections/db/sql/SqlCollectionLocation.cpp
  •   src/core-impl/collections/db/sql/SqlMeta.cpp
  •   src/core-impl/collections/db/sql/SqlMeta.h
  •   src/core-impl/collections/mediadevicecollection/handler/MediaDeviceHandler.cpp
  •   src/core-impl/collections/nepomukcollection/meta/NepomukTrack.cpp
  •   src/core-impl/collections/nepomukcollection/meta/NepomukTrack.h
  •   src/core-impl/collections/playdarcollection/support/Query.cpp
  •   tests/core-impl/collections/db/sql/TestSqlScanManager.cpp
66 files changed in total