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:
parent
e8b43eac1d
commit
5fc6804326
@ -300,11 +300,7 @@ void IncomingDataParser::ClosePlaylist(const pb::remote::Message &msg) {
|
||||
}
|
||||
|
||||
void IncomingDataParser::RateSong(const pb::remote::Message &msg) {
|
||||
int rating = msg.request_rate_song().rating();
|
||||
|
||||
// Rating is from 0 to 5
|
||||
if (rating > 5) rating = 5;
|
||||
if (rating < 0) rating = 0;
|
||||
int rating = qBound(0, msg.request_rate_song().rating(), 5);
|
||||
|
||||
emit RateCurrentSong(rating);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user