File indexing completed on 2024-05-05 04:49:21
0001 /**************************************************************************************** 0002 * Copyright (c) 2013 Konrad Zemek <konrad.zemek@gmail.com> * 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_SIMPLE_TRACK_H 0018 #define STATSYNCING_SIMPLE_TRACK_H 0019 0020 #include "Track.h" 0021 0022 #include "MetaValues.h" 0023 0024 namespace StatSyncing { 0025 0026 /** 0027 * A simple implementation of @see StatSyncing::Track which wraps data contained 0028 * in Meta::FieldHash @param metadata container, and for every function returns value 0029 * corresponding to an adequate Meta::val* key. Labels are passed through @param labels . 0030 * 0031 * This class is thread safe only for reading operations. If you need read-write access, 0032 * @see StatSyncing::SimpleWritableTrack can be used. 0033 */ 0034 class AMAROK_EXPORT SimpleTrack : public Track 0035 { 0036 public: 0037 explicit SimpleTrack( const Meta::FieldHash &metadata, 0038 const QSet<QString> &labels = QSet<QString>() ); 0039 ~SimpleTrack() override; 0040 0041 QString name() const override; 0042 QString album() const override; 0043 QString artist() const override; 0044 QString composer() const override; 0045 int year() const override; 0046 int trackNumber() const override; 0047 int discNumber() const override; 0048 0049 QDateTime firstPlayed() const override; 0050 QDateTime lastPlayed() const override; 0051 int playCount() const override; 0052 int rating() const override; 0053 0054 QSet<QString> labels() const override; 0055 0056 protected: 0057 QDateTime getDateTime( const QVariant &v ) const; 0058 0059 QSet<QString> m_labels; 0060 Meta::FieldHash m_metadata; 0061 }; 0062 0063 } // namespace StatSyncing 0064 0065 #endif // STATSYNCING_SIMPLE_TRACK_H