Added help for settings dialog.
[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     //Button settings
25     ui->buttonTopRefresh->setAutoFillBackground(true);
26     ui->buttonTopRefresh->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
27
28     //Clear labels
29     ui->labelInfoToUser->setText("");
30     ui->labelTopList->setText("");
31 }
32
33 TopResultDialog::~TopResultDialog()
34 {
35     delete ui;
36 }
37
38 void TopResultDialog::changeEvent(QEvent *e)
39 {
40     QDialog::changeEvent(e);
41     switch (e->type()) {
42     case QEvent::LanguageChange:
43         ui->retranslateUi(this);
44         break;
45     default:
46         break;
47     }
48 }
49
50
51 void TopResultDialog::on_buttonTopRefresh_clicked()
52 {
53     ui->labelTopList->clear();
54     ui->comboBoxTopCategory->clear();
55     emit refreshCategoryList();
56 }
57
58 void TopResultDialog::setCompoBoxCategories(QStringList list)
59 {
60     ui->comboBoxTopCategory->addItems(list);
61 }
62
63 void TopResultDialog::showTopList(QString str)
64 {
65     ui->labelTopList->setText(str);
66 }
67
68 int TopResultDialog::getRecentCategoryIndex()
69 {
70     return recentCategoryIndex;
71 }
72
73 void TopResultDialog::setLimitNr(int number)
74 {
75     limitNr = number;
76 }
77
78 int TopResultDialog::getLimitNr()
79 {
80     return limitNr;
81 }
82
83 void TopResultDialog::on_comboBoxTopCategory_currentIndexChanged(int index)
84 {
85     ui->labelTopList->clear();
86     recentCategoryIndex = index;
87     emit refreshTopList(index);
88 }
89
90 void TopResultDialog::setLabelInfoToUser(QString infoText)
91 {
92     this->ui->labelInfoToUser->setText(infoText);
93 }