From 23aff7c89078749e65843da4a6e5d24f51be05df Mon Sep 17 00:00:00 2001 From: Andreas Date: Tue, 20 Aug 2013 11:07:58 +0200 Subject: [PATCH] Use qBound() instead of multiple ifs. (cherry picked from commit 5fc6804326fa34cf2402b95c500f1fa25164cfae) --- src/networkremote/incomingdataparser.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/networkremote/incomingdataparser.cpp b/src/networkremote/incomingdataparser.cpp index 8df26bd21..cd17f3281 100644 --- a/src/networkremote/incomingdataparser.cpp +++ b/src/networkremote/incomingdataparser.cpp @@ -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); }