{
setListViewTopList(category);
}
+
+/**
+ *This slot function is called when set/change user button is clicked.
+ */
+void CarMainWindow::on_setUserPushButton_clicked()
+{
+ myLogin->show();
+
+ ui->userNameLabel->setText( "User: " + myLogin->getUserName());
+ ui->setUserPushButton->setText( "Change User");
+}
</rect>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>2</number>
</property>
<widget class="QWidget" name="StartTab">
<attribute name="title">
<attribute name="title">
<string>Settings</string>
</attribute>
+ <widget class="QLabel" name="userNameLabel">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>30</y>
+ <width>141</width>
+ <height>17</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>User:</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="setUserPushButton">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>60</y>
+ <width>93</width>
+ <height>27</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Set User</string>
+ </property>
+ </widget>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget">
</item>
</layout>
</widget>
- <widget class="QPushButton" name="loginLogoutButton">
- <property name="geometry">
- <rect>
- <x>690</x>
- <y>0</y>
- <width>93</width>
- <height>27</height>
- </rect>
- </property>
- <property name="text">
- <string>Login</string>
- </property>
- </widget>
<widget class="QPushButton" name="registratePushButton">
<property name="geometry">
<rect>
- <x>580</x>
+ <x>690</x>
<y>0</y>
<width>93</width>
<height>27</height>
close();
}
+void setUser(QString uN, QString pW);
+
void LoginWindow::on_loginPushButton_clicked()
{
- // To do
- //loginToServer(ui->userNameLineEdit->text(),
- // ui->passwordLineEdit->text());
- //close();
- QMessageBox::about(this,"Login",ui->userNameLineEdit->text()+ui->passwordLineEdit->text());
+ this->username = ui->userNameLineEdit->text();
+ this->password = ui->passwordLineEdit->text();
+ close();
+}
+
+void LoginWindow::setUserName(QString username)
+{
+ this->username = username;
+}
+
+void LoginWindow::setPassword(QString password)
+{
+ this->password = password;
}
+QString LoginWindow::getUserName()
+{
+ return this->username;
+}
+
+QString LoginWindow::getPassword()
+{
+ return this->password;
+}
+
+
+
public:
LoginWindow(QWidget *parent = 0);
~LoginWindow();
+ void setUserName(QString username);
+ void setPassword(QString password);
+ QString getUserName();
+ QString getPassword();
protected:
void changeEvent(QEvent *e);
private:
Ui::LoginWindow *ui;
+ QString username;
+ QString password;
private slots:
void on_loginPushButton_clicked();
/**
- *Constructor of this class.
- *@param QWidget pointer to parent object. By default the value is NULL.
+ * Constructor of this class.
+ * @param QWidget pointer to parent object. By default the value is NULL.
*/
MeasureDialog::MeasureDialog(QWidget *parent) :
QDialog(parent),
}
/**
- *This slot function is called when timer gives timeout signal.
+ * This slot function is called when timer gives timeout signal. Checks current speed
+ * and stores times in measure class.
*/
void MeasureDialog::after_timeout()
{
speed = accelerometer->getCurrentSpeed();
//speed = speed +10;
- if(speed > 9.7 && speed < 10.3)
+ if (speed > 9.7 && speed < 10.3)
{
measures->setTime10kmh(time);
}
}
/**
- *This slot function is called when Abort button is clicked.
+ * This slot function is called when Abort button is clicked.
*/
void MeasureDialog::on_pushButtonAbort_clicked()
{
this->close();
}
+/**
+ * Initializes measures class's member variables.
+ */
void MeasureDialog::initializeMeasures()
{
measures->setTime10kmh(0);
{
}
+/**
+ * Get the value of time10kmh
+ * @return time10kmh the time in qreal when speed has been 10 km/h
+ */
qreal Measures::getTime10kmh()
{
return time10kmh;
return time100kmh;
}
+/**
+ * Set the given time in to the time10kmh
+ * @param pTime is time in qreal
+ */
void Measures::setTime10kmh(qreal pTime)
{
time10kmh = pTime;
void Registration::on_registratePushButton_clicked()
{
// Send username, password and email to SpeedFreak server
- //close(); // Needs some new signal/slot to go forward or ???
- //registrateToServer(ui->newUsernameLineEdit->text(),
- // ui->newPasswordLineEdit->text(),
- // ui->eMailLineEdit->text());
- QMessageBox::about(this,"Registrate",ui->newUsernameLineEdit->text()+ui->newPasswordLineEdit->text()+ui->eMailLineEdit->text());
+ this->username = ui->newUsernameLineEdit->text();
+ this->password = ui->newPasswordLineEdit->text();
+ this->email = ui->eMailLineEdit->text();
+
+ close();
}
void Registration::on_cancelPushButton_clicked()
close();
}
+void Registration::setUserName(QString username)
+{
+ this->username = username;
+}
+
+void Registration::setPassword(QString password)
+{
+ this->password = password;
+}
+
+void Registration::setEmail(QString password)
+{
+ this->email = email;
+}
+
+QString Registration::getUserName()
+{
+ return this->username;
+}
+
+QString Registration::getPassword()
+{
+ return this->password;
+}
+
+QString Registration::getEmail()
+{
+ return this->email;
+}
public:
Registration(QWidget *parent = 0);
~Registration();
+ void setUserName(QString username);
+ void setPassword(QString password);
+ void setEmail(QString email);
+ QString getUserName();
+ QString getPassword();
+ QString getEmail();
protected:
void changeEvent(QEvent *e);
private:
Ui::Registration *ui;
+ QString username;
+ QString password;
+ QString email;
private slots:
void on_cancelPushButton_clicked();
// Test point array for the diagram.
QPoint points[10];
+/**
+ * Constructor of this class.
+ * @param QWidget pointer to parent object. By default the value is NULL.
+ */
ResultDialog::ResultDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ResultDialog)
// ui->labelYLine->setText(ui->labelYLine->text().append(": speed/ km/h"));
}
+/**
+ * Destructor of this class. Should be used to release all allocated resources.
+ */
ResultDialog::~ResultDialog()
{
delete ui;
/**
* Draws speed diagram to the UI
- *
+ * @param QPaintEvent
*/
void ResultDialog::paintEvent(QPaintEvent *)
{
int currentY = diagramStemStart.y();
// Draws diagram's X-axel
- for(int i = 0; i<13; i++)
+ for (int i = 0; i < 13; i++)
{
currentX += diagramGap;
painter.drawLine(currentX, currentY, currentX, currentY - 10);
currentY = diagramStemStart.y();
// Draws diagram's Y-axel
- for(int i = 0; i<10; i++)
+ for (int i = 0; i < 10; i++)
{
currentY -= diagramGap;
painter.drawLine(currentX, currentY, currentX+10, currentY);
}
/**
- *Change the given speed and time to the point for the diagram.
- *@param aSpeed is speed which need to change, aTime is time in seconds which need to change.
- *@return point is calculated from aSpeed and aTime.
- **/
+ * Change the given speed and time to the point for the diagram.
+ * @param aSpeed is speed which need to change, aTime is time in seconds which need to change.
+ * @return point is calculated from aSpeed and aTime.
+ */
QPoint ResultDialog::changeMeasuresToDiagramPoint(int aSpeed, qreal aTime)
{
QPoint point;
}
/**
- *Saves the given measures to array.
- *@param pMeasures has information about acceleration.
- **/
+ * Saves the given measures to array.
+ * @param pMeasures has information about acceleration.
+ */
void ResultDialog::saveMeasuresToArray(Measures *pMeasures)
{
timeArray[0] = pMeasures->getTime10kmh();
timeArray[8] = pMeasures->getTime90kmh();
timeArray[9] = pMeasures->getTime100kmh();
- for(int i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++)
{
points[i] = changeMeasuresToDiagramPoint(speedArray[i], timeArray[i]);
}
this->repaint();
- for(int i = 0; i < 10; i++)
+ for (int i = 0; i < 10; i++)
{
timeArray[i] = 0;
}