blob: 8c76c9b288a1bacfbac8d78e7ad5252db47e39ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "track/playcounter.h"
void PlayCounter::updateLastPlayedNowAndTimesPlayed(bool setPlayed) {
if (setPlayed) {
// Increment unconditionally
incTimesPlayed();
setLastPlayedNow();
} else if (isPlayed()) {
// Decrement only if already marked as played during
// the current session. Keep the last played at time
// stamp!
decTimesPlayed();
}
setPlayedFlag(setPlayed);
}
bool operator==(const PlayCounter& lhs, const PlayCounter& rhs) {
return lhs.getTimesPlayed() == rhs.getTimesPlayed() &&
lhs.getLastPlayedAt() == rhs.getLastPlayedAt() &&
lhs.isPlayed() == rhs.isPlayed();
}
QDebug operator<<(QDebug dbg, const PlayCounter& arg) {
return dbg << "timesPlayed =" << arg.getTimesPlayed()
<< '/'
<< "lastPlayedAt =" << arg.getLastPlayedAt()
<< '/'
<< "isPlayed =" << arg.isPlayed();
}
|