File indexing completed on 2024-05-19 04:50:28
0001 /**************************************************************************************** 0002 * Copyright (c) 2012 Matěj Laitl <matej@laitl.cz> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef STATSYNCING_COLLECTIONTRACK_H 0018 #define STATSYNCING_COLLECTIONTRACK_H 0019 0020 #include "core/meta/forward_declarations.h" 0021 #include "statsyncing/Track.h" 0022 0023 namespace StatSyncing 0024 { 0025 0026 class CollectionTrack : public Track 0027 { 0028 public: 0029 explicit CollectionTrack(Meta::TrackPtr track ); 0030 ~CollectionTrack() override; 0031 0032 QString name() const override; 0033 QString album() const override; 0034 QString artist() const override; 0035 QString composer() const override; 0036 int year() const override; 0037 int trackNumber() const override; 0038 int discNumber() const override; 0039 0040 int rating() const override; 0041 void setRating( int rating ) override; 0042 QDateTime firstPlayed() const override; 0043 void setFirstPlayed( const QDateTime &firstPlayed ) override; 0044 QDateTime lastPlayed() const override; 0045 void setLastPlayed( const QDateTime &lastPlayed ) override; 0046 int playCount() const override; 0047 int recentPlayCount() const override; 0048 void setPlayCount( int playCount ) override; 0049 QSet<QString> labels() const override; 0050 void setLabels( const QSet<QString> &labels ) override; 0051 0052 Meta::TrackPtr metaTrack() const override; 0053 void commit() override; 0054 0055 private: 0056 Q_DISABLE_COPY( CollectionTrack ) 0057 0058 /** 0059 * Calls m_trackStats->beginUpdate() if it hasn't been already called 0060 */ 0061 void beginUpdate(); 0062 0063 Meta::TrackPtr m_track; 0064 Meta::StatisticsPtr m_trackStats; 0065 bool m_beginUpdateAlreadyCalled; 0066 }; 0067 0068 } // namespace StatSyncing 0069 0070 #endif // STATSYNCING_COLLECTIONTRACK_H