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
11 #include "topresultdialog.h"
12 #include "ui_topresultdialog.h"
15 * Constructor of this class
17 TopResultDialog::TopResultDialog(QWidget *parent) :
18 QDialog(parent), ui(new Ui::TopResultDialog)
22 helpResultsDialog = NULL;
24 this->setWindowTitle("Top Results");
26 //Set the amount of requested top results here, untill there is user input
30 ui->buttonTopRefresh->setAutoFillBackground(true);
31 ui->buttonTopRefresh->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
32 ui->pushButtonInfo->setAutoFillBackground(true);
33 ui->pushButtonInfo->setStyleSheet("background-color: rgb(0, 0, 0); color: rgb(255, 255, 255)");
36 ui->labelInfoToUser->setText("");
37 ui->labelTopList->setText("");
41 * Destructor of this class
43 TopResultDialog::~TopResultDialog()
45 qDebug() << "__~TopResultDialog";
52 void TopResultDialog::changeEvent(QEvent *e)
54 QDialog::changeEvent(e);
56 case QEvent::LanguageChange:
57 ui->retranslateUi(this);
65 * This slot function called when ever refresh button clicked.
67 void TopResultDialog::on_buttonTopRefresh_clicked()
69 ui->labelTopList->clear();
70 ui->comboBoxTopCategory->clear();
71 emit refreshCategoryList();
75 * Set categories compobox.
77 * @param QStringList list
79 void TopResultDialog::setCompoBoxCategories(QStringList list)
81 ui->comboBoxTopCategory->addItems(list);
89 void TopResultDialog::showTopList(QString str)
91 qDebug() << "__showTopList";
92 ui->labelTopList->setText(str);
96 * Get recent category index.
98 * @return int category index
100 int TopResultDialog::getRecentCategoryIndex()
102 return recentCategoryIndex;
110 void TopResultDialog::setLimitNr(int number)
118 * @return int limit nr
120 int TopResultDialog::getLimitNr()
126 * This slot function called when ever top category combobox current index changed.
130 void TopResultDialog::on_comboBoxTopCategory_currentIndexChanged(int index)
132 ui->labelTopList->clear();
133 recentCategoryIndex = index;
134 emit refreshTopList(index);
138 * Set label info to user.
140 * @param QString info text
142 void TopResultDialog::setLabelInfoToUser(QString infoText)
144 this->ui->labelInfoToUser->setText(infoText);
148 * This slot function called when ever info button clicked.
150 void TopResultDialog::on_pushButtonInfo_clicked()
152 if(!helpResultsDialog)
154 helpResultsDialog = new HelpResultsDialog;
156 connect(helpResultsDialog, SIGNAL(rejected()), this, SLOT(killHelpDialog()));
157 helpResultsDialog->show();
161 * This slot function called when ever dialog rejected.
163 void TopResultDialog::killHelpDialog()
165 if(helpResultsDialog)
167 qDebug() << "__Top result kill: helpResultsDialog";
168 delete helpResultsDialog;
169 helpResultsDialog = NULL;