Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…or clarity
  • Loading branch information...
commit a1a47e0d2e62e69bb72b8fddf18510a9240773bc 1 parent 7099789
John Stamp authored
2  src/ScrobbleCache.cpp
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 );
49 src/ScrobblePoint.cpp
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;
+}
10 src/ScrobblePoint.h
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;
Please sign in to comment.
Something went wrong with that request. Please try again.