Changes in measuredialog.cpp, .h and carmainwindow.cpp and .h
[speedfreak] / Client / carmainwindow.cpp
index 60b80e6..b8af9fe 100644 (file)
@@ -17,14 +17,17 @@ CarMainWindow::CarMainWindow(QWidget *parent):QMainWindow(parent), ui(new Ui::Ca
 
     initUnitCompoBox();
     initSpeedListView();
+    initCategoryCompoBox();
 }
 
 /**
-  *Destructor of this class.  Should be used to release all allocated resources.
+  *Destructor of this class. Should be used to release all allocated resources.
   */
 CarMainWindow::~CarMainWindow()
 {
     delete ui;
+    delete result;
+    delete measure;
 }
 
 /**
@@ -86,7 +89,7 @@ void CarMainWindow::updateUnitCompoBox(QString unit)
 }
 
 /**
-  *This function is used to init combobox.
+  *This function is used to init unit combobox.
   */
 void CarMainWindow::initUnitCompoBox()
 {
@@ -95,7 +98,16 @@ void CarMainWindow::initUnitCompoBox()
 }
 
 /**
-  *This function is used to init listview.
+  *This function is used to set items to unit combobox.
+  *@param QStringlist numbers
+  */
+void CarMainWindow::setUnitCompoBox(QStringList units)
+{
+    ui->unitComboBox->addItems(units);
+}
+
+/**
+  *This function is used to init speed listview.
   */
 void CarMainWindow::initSpeedListView()
 {
@@ -105,6 +117,50 @@ void CarMainWindow::initSpeedListView()
 }
 
 /**
+<<<<<<< HEAD:Client/carmainwindow.cpp
+  *This function is used to set items to speed listview.
+  *@param QStringlist numbers
+  */
+void CarMainWindow::setSpeedListView(QStringList numbers)
+{
+    QAbstractItemModel *model = new StringListModel(numbers);
+    ui->listView->setModel(model);
+}
+
+/**
+  *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
+  */
+void CarMainWindow::setCategoryCompoBox(QStringList categories)
+{
+    ui->comboBoxTopCategory->addItems(categories);
+}
+
+/**
+  *This slot function is called when ever categories combobox is update.
+  *@param QString category
+  */
+void CarMainWindow::on_comboBoxTopCategory_activated(QString category)
+{
+    //TODO: get top list
+
+    QStringList topList;
+    topList << "1. Pertti 7,5s" << "2. Ville 10,2s";
+
+    QAbstractItemModel *model = new StringListModel(topList);
+    ui->listViewTopList->setModel(model);
+}
+
+/**
   *This slot function is called when speed is achieved in measure dialog. Opens result dialog.
   */
 void CarMainWindow::openResultView()