HaikuDepot: Avoid showing ugly rating info when there are no ratings.
This commit is contained in:
parent
735ec4c018
commit
cb67ac0163
@ -442,17 +442,22 @@ public:
|
|||||||
|
|
||||||
fRatingView->SetRating(ratingSummary.averageRating);
|
fRatingView->SetRating(ratingSummary.averageRating);
|
||||||
|
|
||||||
BString avgRating;
|
if (ratingSummary.ratingCount > 0) {
|
||||||
avgRating.SetToFormat("%.1f", ratingSummary.averageRating);
|
BString avgRating;
|
||||||
fAvgRating->SetText(avgRating);
|
avgRating.SetToFormat("%.1f", ratingSummary.averageRating);
|
||||||
|
fAvgRating->SetText(avgRating);
|
||||||
|
|
||||||
|
BString votes;
|
||||||
|
votes.SetToFormat("%d", ratingSummary.ratingCount);
|
||||||
|
|
||||||
|
BString voteInfo(B_TRANSLATE("(%Votes%)"));
|
||||||
|
voteInfo.ReplaceAll("%Votes%", votes);
|
||||||
|
|
||||||
BString votes;
|
fVoteInfo->SetText(voteInfo);
|
||||||
votes.SetToFormat("%d", ratingSummary.ratingCount);
|
} else {
|
||||||
|
fAvgRating->SetText("");
|
||||||
BString voteInfo(B_TRANSLATE("(%Votes%)"));
|
fVoteInfo->SetText(B_TRANSLATE("n/a"));
|
||||||
voteInfo.ReplaceAll("%Votes%", votes);
|
}
|
||||||
|
|
||||||
fVoteInfo->SetText(voteInfo);
|
|
||||||
|
|
||||||
InvalidateLayout();
|
InvalidateLayout();
|
||||||
Invalidate();
|
Invalidate();
|
||||||
|
Loading…
Reference in New Issue
Block a user