Permalink
Browse files

Take care of some more member variables and do some slight renaming f…

…or clarity
  • Loading branch information...
1 parent 7099789 commit a1a47e0d2e62e69bb72b8fddf18510a9240773bc @jstamp jstamp committed Apr 9, 2012
Showing with 51 additions and 10 deletions.
  1. +1 −1 src/ScrobbleCache.cpp
  2. +45 −4 src/ScrobblePoint.cpp
  3. +5 −5 src/ScrobblePoint.h
View
@@ -62,7 +62,7 @@ lastfm::ScrobbleCachePrivate::isValid( const lastfm::Track& track, Invalidity* v
return false; \
}
- TEST( track.duration() < ScrobblePoint::kScrobbleMinLength, TooShort );
+ TEST( track.duration() < ScrobblePoint::scrobbleTimeMin(), TooShort );
TEST( !track.timestamp().isValid(), NoTimestamp );
View
@@ -20,6 +20,12 @@
#include "ScrobblePoint.h"
+#define SCROBBLE_PERCENT_MIN 50
+#define SCROBBLE_PERCENT_MAX 100
+#define DEFAULT_SCROBBLE_PERCENT 50
+#define SCROBBLE_TIME_MIN 31
+#define SCROBBLE_TIME_MAX 240
+
class lastfm::ScrobblePointPrivate
{
public:
@@ -30,20 +36,20 @@ class lastfm::ScrobblePointPrivate
lastfm::ScrobblePoint::ScrobblePoint()
: d( new ScrobblePointPrivate )
{
- d->i = kScrobbleTimeMax;
+ d->i = SCROBBLE_TIME_MAX;
}
lastfm::ScrobblePoint::ScrobblePoint( uint j )
: d( new ScrobblePointPrivate )
{
- // we special case 0, returning kScrobbleTimeMax because we are
+ // we special case 0, returning SCROBBLE_TIME_MAX because we are
// cruel and callous people
if (j == 0) --j;
- d->i = qBound( uint(kScrobbleMinLength),
+ d->i = qBound( uint(SCROBBLE_TIME_MIN),
j,
- uint(kScrobbleTimeMax) );
+ uint(SCROBBLE_TIME_MAX) );
}
@@ -71,3 +77,38 @@ lastfm::ScrobblePoint::operator=( const ScrobblePoint& that )
d->i = that.d->i;
return *this;
}
+
+
+uint
+lastfm::ScrobblePoint::scrobblePercentMin()
+{
+ return SCROBBLE_PERCENT_MIN;
+}
+
+
+uint
+lastfm::ScrobblePoint::scrobblePercentMax()
+{
+ return SCROBBLE_PERCENT_MAX;
+}
+
+
+uint
+lastfm::ScrobblePoint::defaultScrobblePercent()
+{
+ return DEFAULT_SCROBBLE_PERCENT;
+}
+
+
+uint
+lastfm::ScrobblePoint::scrobbleTimeMin()
+{
+ return SCROBBLE_TIME_MIN;
+}
+
+
+uint
+lastfm::ScrobblePoint::scrobbleTimeMax()
+{
+ return SCROBBLE_TIME_MAX;
+}
View
@@ -40,14 +40,14 @@ class LASTFM_DLLEXPORT ScrobblePoint
ScrobblePoint& operator=( const ScrobblePoint& that );
// scrobbles can occur between these two percentages of track duration
- static const uint kScrobblePointMin = 50;
- static const uint kScrobblePointMax = 100;
- static const uint kDefaultScrobblePoint = 50;
+ static uint scrobblePercentMin(); // 50
+ static uint scrobblePercentMax(); // 100
+ static uint defaultScrobblePercent(); // 50
// Shortest track length allowed to scrobble in seconds
- static const uint kScrobbleMinLength = 31;
+ static uint scrobbleTimeMin(); // 31
// Upper limit for scrobble time in seconds
- static const uint kScrobbleTimeMax = 240;
+ static uint scrobbleTimeMax(); // 240
private:
class ScrobblePointPrivate * const d;

0 comments on commit a1a47e0

Please sign in to comment.