X-Git-Url: http://git.maemo.org/git/?p=speedfreak;a=blobdiff_plain;f=Client%2Fcarmainwindow.cpp;h=b730a696ac20f9f6694711f5e34c9342ba05aa60;hp=b8af9feb8218412e04e48d635edd53e063331c28;hb=ec2e343485c22d0c34a63e0d0512dbb642a8a4c4;hpb=87caacddd53a392c4b747dc586fb91484fc394ae diff --git a/Client/carmainwindow.cpp b/Client/carmainwindow.cpp index b8af9fe..b730a69 100644 --- a/Client/carmainwindow.cpp +++ b/Client/carmainwindow.cpp @@ -1,9 +1,4 @@ #include "carmainwindow.h" -#include "ui_carmainwindow.h" -#include "stringlistmodel.h" -#include -#include -#include /** *Constructor of this class. @@ -14,10 +9,10 @@ CarMainWindow::CarMainWindow(QWidget *parent):QMainWindow(parent), ui(new Ui::Ca ui->setupUi(this); result = new ResultDialog(); measure = new MeasureDialog(); + xmlreader = new XmlReader(); initUnitCompoBox(); initSpeedListView(); - initCategoryCompoBox(); } /** @@ -28,6 +23,7 @@ CarMainWindow::~CarMainWindow() delete ui; delete result; delete measure; + delete xmlreader; } /** @@ -47,8 +43,7 @@ void CarMainWindow::changeEvent(QEvent *e) } /** - *This slot function is called when ever list view is update. - *@param QModelIndex index. + *This slot function is called when ever list view is update. Start-tab view. */ void CarMainWindow::on_listView_clicked(QModelIndex index) { @@ -62,7 +57,7 @@ void CarMainWindow::on_listView_clicked(QModelIndex index) } /** - *This slot function is called when ever auto start button clicked. + *This slot function is called when ever auto start button clicked. Start-tab view. */ void CarMainWindow::on_autoStartButton_clicked() { @@ -80,7 +75,7 @@ void CarMainWindow::on_autoStartButton_clicked() } /** - *This slot function is called when ever list view is update. + *This slot function is called when ever list view is update. Start-tab view. *@param QString unit. */ void CarMainWindow::updateUnitCompoBox(QString unit) @@ -89,16 +84,16 @@ void CarMainWindow::updateUnitCompoBox(QString unit) } /** - *This function is used to init unit combobox. + *This function is used to init unit combobox. Start-tab view. */ void CarMainWindow::initUnitCompoBox() { - units << "km/h" << "km" << "h" << "m" << "min" << "mil" << "in" << "ft" << "yrd"; + units << "km/h" << "km" << "h" << "m" << "min" << "Mile" << "Mph" << "in" << "ft" << "yrd"; ui->unitComboBox->addItems(units); } /** - *This function is used to set items to unit combobox. + *This function is used to set items to unit combobox. Start-tab view. *@param QStringlist numbers */ void CarMainWindow::setUnitCompoBox(QStringList units) @@ -107,18 +102,17 @@ void CarMainWindow::setUnitCompoBox(QStringList units) } /** - *This function is used to init speed listview. + *This function is used to init speed listview. Start-tab view. */ void CarMainWindow::initSpeedListView() { - numbers << "0-100 km/h" << "0-1/4 mil" << "0-50 km" << "50-100 mil" << "0-100 m" << "0-50 ft" << "0-50 yrd" << "0-500 in"; + numbers << "0-40 km/h" << "0-1/4 Mile" << "0-1/8 Mile" << "0-50 km" << "50-100 Mile" << "0-60 Mph" << "0-100 m" << "0-50 ft" << "0-50 yrd" << "0-500 in"; QAbstractItemModel *model = new StringListModel(numbers); ui->listView->setModel(model); } /** -<<<<<<< HEAD:Client/carmainwindow.cpp - *This function is used to set items to speed listview. + *This function is used to set items to speed listview. Start-tab view. *@param QStringlist numbers */ void CarMainWindow::setSpeedListView(QStringList numbers) @@ -128,36 +122,37 @@ void CarMainWindow::setSpeedListView(QStringList numbers) } /** - *This function is used to init category combobox. - */ -void CarMainWindow::initCategoryCompoBox() -{ - categories << "Top 10 1/4 mile" << "Top 10 0-100 km/h" << "Top 10 car"; - ui->comboBoxTopCategory->addItems(categories); -} - -/** - *This function is used to set items to category combobox. - *@param QStringlist categories + *This function is used to set items to category combobox. Top-tab view. + *@param */ -void CarMainWindow::setCategoryCompoBox(QStringList categories) +void CarMainWindow::setCategoryCompoBox() { - ui->comboBoxTopCategory->addItems(categories); + ui->comboBoxTopCategory->addItems(xmlreader->getTop10List()); } /** - *This slot function is called when ever categories combobox is update. + *This function is used to set items to labelTopList. Top-tab view. *@param QString category */ -void CarMainWindow::on_comboBoxTopCategory_activated(QString category) +void CarMainWindow::setListViewTopList(QString category) { - //TODO: get top list + QString topList; - QStringList topList; - topList << "1. Pertti 7,5s" << "2. Ville 10,2s"; + if (category == "acceleration-0-100") + { + topList.append(xmlreader->getTop10AccelerationList()); + } + + else if (category == "Speed") + { + topList.append(xmlreader->getTop10SpeedList()); + } - QAbstractItemModel *model = new StringListModel(topList); - ui->listViewTopList->setModel(model); + else if (category == "G-force") + { + topList.append(xmlreader->getTop10GforceList()); + } + ui->labelTopList->setText(topList); } /** @@ -168,3 +163,20 @@ void CarMainWindow::openResultView() // Show result dialog. result->show(); } + +/** + *This slot function is called when ever refresh button clicked. Top-tab view. + */ +void CarMainWindow::on_buttonTopRefresh_clicked() +{ + setCategoryCompoBox(); +} + +/** + *This slot function is called when ever category combobox current index changed. Top-tab view. + *@param QString category + */ +void CarMainWindow::on_comboBoxTopCategory_currentIndexChanged(QString category) +{ + setListViewTopList(category); +}