Bugfix: category dublicates
[speedfreak] / Client / topresultdialog.cpp
1 /*
2  * Topresultdialog
3  *
4  * @author     Olavi Pulkkinen <olavi.pulkkinena@fudeco.com>
5  * @author     Toni Jussila <toni.jussila@fudeco.com>
6  * @copyright  (c) 2010 Speed Freak team
7  * @license    http://opensource.org/licenses/gpl-license.php GNU Public License
8  */
9
10 #include <QDebug>
11 #include "topresultdialog.h"
12 #include "ui_topresultdialog.h"
13
14 TopResultDialog::TopResultDialog(QWidget *parent) :
15     QDialog(parent),
16     ui(new Ui::TopResultDialog)
17 {
18     ui->setupUi(this);
19     this->setWindowTitle("Top Results");
20
21     //Set the amount of requested top results here, untill there is user input
22     setLimitNr(10);
23 }
24
25 TopResultDialog::~TopResultDialog()
26 {
27     delete ui;
28 }
29
30 void TopResultDialog::changeEvent(QEvent *e)
31 {
32     QDialog::changeEvent(e);
33     switch (e->type()) {
34     case QEvent::LanguageChange:
35         ui->retranslateUi(this);
36         break;
37     default:
38         break;
39     }
40 }
41
42
43 void TopResultDialog::on_buttonTopRefresh_clicked()
44 {
45     ui->labelTopList->clear();
46     ui->comboBoxTopCategory->clear();
47     emit refreshCategoryList();
48 }
49
50 void TopResultDialog::setCompoBoxCategories(QStringList list)
51 {
52     ui->comboBoxTopCategory->addItems(list);
53 }
54
55 void TopResultDialog::showTopList(QString str)
56 {
57     ui->labelTopList->setText(str);
58 }
59
60 int TopResultDialog::getRecentCategoryIndex()
61 {
62     return recentCategoryIndex;
63 }
64
65 void TopResultDialog::setLimitNr(int number)
66 {
67     limitNr = number;
68 }
69
70 int TopResultDialog::getLimitNr()
71 {
72     return limitNr;
73 }
74
75 void TopResultDialog::on_comboBoxTopCategory_currentIndexChanged(int index)
76 {
77     ui->labelTopList->clear();
78     recentCategoryIndex = index;
79     emit refreshTopList(index);
80 }
81
82 void TopResultDialog::setLabelInfoToUser(QString infoText)
83 {
84     this->ui->labelInfoToUser->setText(infoText);
85 }