Change DatabaseUpdater for new multiple-tags format
[amarok:rengelss-amarok.git] / src / core / statistics / StatisticsProvider.h
1 /****************************************************************************************
2  * Copyright (c) 2009 Maximilian Kossick <maximilian.kossick@googlemail.com>            *
3  *                                                                                      *
4  * This program is free software; you can redistribute it and/or modify it under        *
5  * the terms of the GNU General Public License as published by the Free Software        *
6  * Foundation; either version 2 of the License, or (at your option) any later           *
7  * version.                                                                             *
8  *                                                                                      *
9  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
10  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
11  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
12  *                                                                                      *
13  * You should have received a copy of the GNU General Public License along with         *
14  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
15  ****************************************************************************************/
16
17 #ifndef STATISTICS_STATISTICSPROVIDER_H
18 #define STATISTICS_STATISTICSPROVIDER_H
19
20 #include "shared/amarok_export.h"
21 #include "core/meta/Meta.h"
22
23 #include <QDateTime>
24
25 namespace Statistics
26 {
27     class AMAROK_CORE_EXPORT StatisticsProvider
28     {                
29         public:
30             StatisticsProvider();
31             virtual ~StatisticsProvider();
32
33              /** Returns the score of this track */
34             double score() const;
35             void setScore( double newScore );
36             /** Returns the rating of this track */
37             int rating() const;
38             void setRating( int newRating );
39             /** Returns the time the song was last played, or 0 if it has not been played yet */
40             QDateTime lastPlayed() const;
41             void setLastPlayed( const QDateTime &dt );
42             /** Returns the time the song was first played, or 0 if it has not been played yet */
43             QDateTime firstPlayed() const;
44             void setFirstPlayed( const QDateTime &dt );
45
46             /** Returns the number of times the track was played (what about unknown?)*/
47             int playCount() const;
48             void setPlayCount( int playCount );
49             /** indicate to the statistics provider that a song was played */
50             void played( double playedFraction, Meta::TrackPtr track );
51
52         protected:
53             virtual void save() = 0;
54
55             QDateTime m_lastPlayed;
56             QDateTime m_firstPlayed;
57             double m_score;
58             int m_rating;
59             int m_playCount;
60     };
61 }
62
63 #endif