1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-01-01 20:38:06 +01:00

Use qBound() instead of multiple ifs.

This commit is contained in:
Andreas 2013-08-20 11:07:58 +02:00
parent e8b43eac1d
commit 5fc6804326

View File

@ -300,11 +300,7 @@ void IncomingDataParser::ClosePlaylist(const pb::remote::Message &msg) {
} }
void IncomingDataParser::RateSong(const pb::remote::Message &msg) { void IncomingDataParser::RateSong(const pb::remote::Message &msg) {
int rating = msg.request_rate_song().rating(); int rating = qBound(0, msg.request_rate_song().rating(), 5);
// Rating is from 0 to 5
if (rating > 5) rating = 5;
if (rating < 0) rating = 0;
emit RateCurrentSong(rating); emit RateCurrentSong(rating);
} }