1 // Copyright 2010 Jochen Becher
3 // This file is part of MovieSchedule.
5 // MovieSchedule is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // MovieSchedule is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with MovieSchedule. If not, see <http://www.gnu.org/licenses/>.
18 #include "ratingprovider.h"
22 RatingProvider::RatingProvider()
27 void RatingProvider::Load()
30 The files loaded here are created from files in svg format under license
31 Creative Commons Attribution-Share Alike 2.5 Generic from author "Andreas 06"
32 on commons.wikimedia.org/wiki.
34 _rating_stars.reserve(11);
35 for (int i = 0; i < 10; ++i) {
36 _rating_stars.append(QPixmap(QString(":/resources/%1.png").arg(i)));
40 QPixmap RatingProvider::GetRating(double percentage)
42 if (percentage < 0.0 || percentage > 1.0) {
45 return _rating_stars[(int) (percentage * 10.0)];
48 RatingProvider *RatingProvider::_instance;
50 RatingSingleton::RatingSingleton()