carmainwindow.cpp \
resultdialog.cpp \
stringlistmodel.cpp \
- measuredialog.cpp
+ measuredialog.cpp \
+ calculate.cpp \
+ accelerometer.cpp
HEADERS += carmainwindow.h \
resultdialog.h \
stringlistmodel.h \
- measuredialog.h
+ measuredialog.h \
+ calculate.h \
+ accelerometer.h
FORMS += carmainwindow.ui \
resultdialog.ui \
measuredialog.ui
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;
}
/**
}
/**
- *This function is used to init combobox.
+ *This function is used to init unit combobox.
*/
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()
{
QAbstractItemModel *model = new StringListModel(numbers);
ui->listView->setModel(model);
}
+
+/**
+ *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);
+}
*/
#include <QMainWindow>
+#include <QModelIndex>
+#include <QStringList>
#include "resultdialog.h"
#include "measuredialog.h"
-#include <QModelIndex>
namespace Ui {
class CarMainWindow;
CarMainWindow(QWidget *parent = 0);
~CarMainWindow();
+ void setUnitCompoBox(QStringList units);
+ void setSpeedListView(QStringList numbers);
+ void setCategoryCompoBox(QStringList categories);
+
protected:
void changeEvent(QEvent *e);
private:
Ui::CarMainWindow *ui;
ResultDialog *result;
- void initUnitCompoBox();
- void initSpeedListView();
MeasureDialog *measure;
+ void initUnitCompoBox();
+ void initSpeedListView();
+ void initCategoryCompoBox();
private:
QStringList numbers;
QStringList units;
+ QStringList categories;
private slots:
+ void on_comboBoxTopCategory_activated(QString );
void on_autoStartButton_clicked();
void on_listView_clicked(QModelIndex index);
void updateUnitCompoBox(QString unit);
<property name="geometry">
<rect>
<x>10</x>
- <y>0</y>
+ <y>10</y>
<width>781</width>
- <height>365</height>
+ <height>361</height>
</rect>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="StartTab">
<attribute name="title">
</layout>
</widget>
</widget>
+ <widget class="QWidget" name="tab">
+ <attribute name="title">
+ <string>Top</string>
+ </attribute>
+ <widget class="QPushButton" name="buttonTopRefresh">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>270</y>
+ <width>169</width>
+ <height>37</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <family>Bitstream Charter</family>
+ <pointsize>16</pointsize>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Refresh list</string>
+ </property>
+ </widget>
+ <widget class="QListView" name="listViewTopList">
+ <property name="geometry">
+ <rect>
+ <x>360</x>
+ <y>10</y>
+ <width>411</width>
+ <height>311</height>
+ </rect>
+ </property>
+ <property name="font">
+ <font>
+ <family>Bitstream Charter</family>
+ <pointsize>10</pointsize>
+ </font>
+ </property>
+ <property name="flow">
+ <enum>QListView::LeftToRight</enum>
+ </property>
+ </widget>
+ <widget class="QWidget" name="">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>341</width>
+ <height>141</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QLabel" name="labelCategory">
+ <property name="font">
+ <font>
+ <family>Bitstream Charter</family>
+ <pointsize>16</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>Category:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBoxTopCategory"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
<widget class="QWidget" name="settingsTab">
<attribute name="title">
<string>Settings</string>
<property name="geometry">
<rect>
<x>10</x>
- <y>370</y>
+ <y>380</y>
<width>781</width>
- <height>41</height>
+ <height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
#include <QtGui/QApplication>
-#include <QStyleFactory>
#include "carmainwindow.h"
int main(int argc, char *argv[])