void accelerationstart::on_categorComboBox_currentIndexChanged( int index )
{
stopMeasureSpeed = 0;
- if( index == 1 )
- stopMeasureSpeed = 20;
- else if( index == 2 )
+ if( index == 1 ) {
+ stopMeasureSpeed = 10;
+ measureCategory = "acceleration-0-10";
+ }
+ else if( index == 2 ) {
stopMeasureSpeed = 40;
- else if( index == 3 )
+ measureCategory = "acceleration-0-40";
+ }
+ else if( index == 3 ) {
stopMeasureSpeed = 100;
+ measureCategory = "acceleration-0-100";
+ }
+}
+
+
+QString accelerationstart::getMeasureCategory()
+{
+ return measureCategory;
}
+
public:
accelerationstart(QWidget *parent = 0);
~accelerationstart();
+ QString getMeasureCategory();
protected:
void changeEvent(QEvent *e);
Ui::accelerationstart *ui;
AccRealTimeDialog* accRealTimeDialog;
double stopMeasureSpeed;
+ QString measureCategory;
private slots:
void on_categorComboBox_currentIndexChanged(int index);
*This function is used to get items to top list of the category that is chosen from combobox.
*@param QString category
*@param int size
+ *@todo Now there is only one (the latest top10List). Later picking up the requested category.
*/
QString CategoryList::getTopList( QString category, int size)
{
currentDownload = netManager->post(request, ("xml=" + regbuffer->data()));
connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfRegistration()));
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
- //myMainw->setLabelInfoToUser("Reguesting registration from server");
+ myMainw->settingsDialog->setLabelInfoToUser("Reguesting registration from server");
regbuffer->close();
}
currentDownload = netManager->post(request, ("xml=" + xmlbuffer->data()));
connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfResult()));
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
- //myMainw->setLabelInfoToUser("Sending result to server");
+ myMainw->resultDialog->setLabelInfoToUser("Sending result to server");
xmlbuffer->close();
}
currentDownload = netManager->post(request, ("xml=" + file.readAll()));
connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfRoute()));
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
- //myMainw->setLabelInfoToUser("Sending route to server");
+ myMainw->routeDialog->setLabelInfoToUser("Sending route to server");
file.close();
}
currentDownload = netManager->post(request, ("data=" ));
connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfToplist()));
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
- //myMainw->setLabelInfoToUser("Reguesting top10 list from server");
+ myMainw->topResultDialog->setLabelInfoToUser("Reguesting top10 list from server");
}
currentDownload = netManager->post(request, ("data=" ));
connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfCategories()));
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
- //myMainw->setLabelInfoToUser("Reguesting categories from server");
+ myMainw->topResultDialog->setLabelInfoToUser("Reguesting categories from server");
}
currentDownload = netManager->post(request, ("data=" ));
connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfLogin()));
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
- //myMainw->setLabelInfoToUser("Checking login validity from server");
+ myMainw->settingsDialog->setLabelInfoToUser("Checking login validity from server");
}
{
qDebug() << "_ackOfResult";
- //myMainw->setLabelInfoToUser("");
+ myMainw->resultDialog->setLabelInfoToUser("");
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
errorcode = reply->error();
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- //QMessageBox::about(myMainw, "Server reply to result sending ",reply->errorString());
+ QMessageBox::about(myMainw->resultDialog, "Server reply to result sending ",reply->errorString());
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- //QMessageBox::about(myMainw, "Server reply to result sending", "Result received " + reply->readAll());
+ //QMessageBox::about(myMainw->resultDialog, "Server reply to result sending", "Result received " + reply->readAll());
}
}
{
qDebug() << "_ackOfRoute";
- //myMainw->setLabelInfoToUser("");
+ myMainw->routeDialog->setLabelInfoToUser("");
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
errorcode = reply->error();
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- //QMessageBox::about(myMainw, "Server reply to route sending ",reply->errorString());
+ QMessageBox::about(myMainw->routeDialog, "Server reply to route sending ",reply->errorString());
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
{
qDebug() << "_ackOfRegistration";
- //myMainw->setLabelInfoToUser("");
+ myMainw->settingsDialog->setLabelInfoToUser("");
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
errorcode = reply->error();
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- //QMessageBox::about(myMainw, "Server reply to registration",reply->readAll());
+ QMessageBox::about(myMainw->settingsDialog, "Server reply to registration",reply->readAll());
}
else {
qDebug() << "errorcode=0" << errorcode << reply->errorString();
- //QMessageBox::about(myMainw, "Server reply to registration", "User registration " + reply->readAll());
+ //QMessageBox::about(myMainw->settingsDialog, "Server reply to registration", "User registration " + reply->readAll());
}
}
{
qDebug() << "_ackOfCategories";
- //myMainw->setLabelInfoToUser("");
+ myMainw->topResultDialog->setLabelInfoToUser("");
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
myXmlreader->xmlReadCategories(reply);
errorcode = reply->error();
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- //QMessageBox::about(myMainw, "Server reply to requesting categories",reply->errorString());
+ QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting categories",reply->errorString());
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- //QMessageBox::about(myMainw, "Server reply to requesting categories ", "OK");
+ //QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting categories ", "OK");
}
}
{
qDebug() << "_ackOffLogin";
- //myMainw->setLabelInfoToUser("");
+ myMainw->settingsDialog->setLabelInfoToUser("");
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
errorcode = reply->error();
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- //QMessageBox::about(myMainw, "Server does not recognize your username. Please registrate.",reply->errorString());
+ QMessageBox::about(myMainw->settingsDialog, "Server does not recognize your username. Please registrate.",reply->errorString());
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- //QMessageBox::about(myMainw, "Server reply to login", "User login " + reply->readAll());
+ //QMessageBox::about(myMainw->settingsDialog, "Server reply to login", "User login " + reply->readAll());
}
+
+ myMainw->settingsDialog->close();
}
errorcode = reply->error();
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- //QMessageBox::about(myMainw, "Server reply to requesting top 10 list",reply->errorString());
+ QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting top 10 list",reply->errorString());
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- //QMessageBox::about(myMainw, "Server reply to requesting top 10 list", "OK " + reply->readAll());
+ //QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting top 10 list", "OK " + reply->readAll());
}
}
QCoreApplication::setOrganizationDomain("fudeco.com");
QCoreApplication::setApplicationName("Speed Freak");
+ accstart = NULL;
+
creditsDialog = new CreditsDialog;
routeSaveDialog = new RouteSaveDialog;
+ routeDialog = new RouteDialog;
+ connect(routeDialog,SIGNAL(sendroute()),this,SLOT(clientSendRoute()));
settingsDialog = new SettingsDialog;
- connect(settingsDialog,SIGNAL(sendregistration()),this,SLOT(regUserToServer()));
- connect(settingsDialog,SIGNAL(userNameChanged()),this,SLOT(userLogin()));
+ connect(settingsDialog,SIGNAL(sendregistration()),this,SLOT(clientRegUserToServer()));
+ connect(settingsDialog,SIGNAL(userNameChanged()),this,SLOT(clientUserLogin()));
topResultDialog = new TopResultDialog;
connect(topResultDialog, SIGNAL(refreshCategoryList()), this, SLOT(clientRequestCategoryList()));
connect(topResultDialog, SIGNAL(refreshTopList(int)), this, SLOT(clientRequestTopList(int)));
- accstart = NULL;
-
httpClient = new HttpClient(this);
connect(httpClient->myXmlreader, SIGNAL(receivedCategoryList()), this, SLOT(setCategoryCompoBox()));
connect(httpClient->myXmlreader, SIGNAL(receivedTop10List()), this, SLOT(showTop10()));
+ resultDialog = new ResultDialog;
+ connect(resultDialog, SIGNAL(sendResult(double)), this, SLOT(clientSendResult(double)));
welcomeDialog = new WelcomeDialog;
welcomeDialog->show();
*/
void MainWindow::clientRequestTopList(int index)
{
- qDebug() << "index" << index << httpClient->myXmlreader->myCategoryList->getRecentCategory(index);
QString limit = QString::number(topResultDialog->getLimitNr());
httpClient->requestTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(index), limit);
}
*/
void MainWindow::setCategoryCompoBox()
{
- qDebug() << "_setCategoryCompoBox";
topResultDialog->setCompoBoxCategories(httpClient->myXmlreader->myCategoryList->getCategoryList());
}
*/
void MainWindow::showTop10()
{
- qDebug() << "_showTop10";
int ind = topResultDialog->getRecentCategoryIndex();
setListViewTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(ind), topResultDialog->getLimitNr());
}
*/
void MainWindow::setListViewTopList(QString category, int size)
{
- qDebug() << "_setListViewTopList" << category;
QString topList;
topList.append(httpClient->myXmlreader->myCategoryList->getTopList(category, size));
topResultDialog->showTopList(topList);
}
-void MainWindow::regUserToServer()
+void MainWindow::clientRegUserToServer()
{
httpClient->requestRegistration();
}
-void MainWindow::userLogin()
+void MainWindow::clientUserLogin()
{
httpClient->checkLogin();
}
+
+void MainWindow::clientSendRoute()
+{
+ httpClient->sendRouteXml();
+}
+
+void MainWindow::clientSendResult(double result)
+{
+ if(accstart) {
+ httpClient->sendResultXml(accstart->getMeasureCategory(), result);
+ }
+}
#include <QMessageBox>
#include "creditsdialog.h"
#include "routesavedialog.h"
+#include "routedialog.h"
#include "welcomedialog.h"
#include "settingsdialog.h"
#include "accelerationstart.h"
#include "topresultdialog.h"
#include "httpclient.h"
+#include "resultdialog.h"
namespace Ui {
class MainWindow;
CreditsDialog *creditsDialog;
RouteSaveDialog *routeSaveDialog;
+ RouteDialog *routeDialog;
WelcomeDialog *welcomeDialog;
SettingsDialog *settingsDialog;
accelerationstart* accstart;
TopResultDialog *topResultDialog;
HttpClient *httpClient;
+ ResultDialog *resultDialog;
protected:
void changeEvent(QEvent *e);
void on_pushButtonWWW_clicked();
void clientRequestCategoryList();
void clientRequestTopList(int index);
+ void clientSendRoute();
+ void clientRegUserToServer();
+ void clientUserLogin();
+ void clientSendResult(double result);
void setCategoryCompoBox();
void showTop10();
- void regUserToServer();
- void userLogin();
};
#endif // MAINWINDOW_H
}
return targetChoice;
}
+
+void ResultDialog::setLabelInfoToUser(QString infoText)
+{
+ this->ui->labelInfoToUser->setText(infoText);
+}
+
void setEnd(int pValue);
void setValue(int pSpeed, double pTime);
+ void setLabelInfoToUser(QString infoText);
signals:
- void sendresult(double result);
+ void sendresult(double);
protected:
void changeEvent(QEvent *e);
<property name="geometry">
<rect>
<x>510</x>
- <y>280</y>
+ <y>310</y>
<width>131</width>
<height>71</height>
</rect>
<string>New run</string>
</property>
</widget>
+ <widget class="QLabel" name="labelInfoToUser">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>310</y>
+ <width>471</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
</widget>
<resources/>
<connections/>
void RouteDialog::on_sendPushButton_clicked()
{
- // Send route points file to server
+ emit sendroute();
+}
+
+void RouteDialog::setLabelInfoToUser(QString infoText)
+{
+ this->ui->labelInfoToUser->setText(infoText);
}
int getTop();
int getRight();
int getBottom();
+ void setLabelInfoToUser(QString infoText);
+
+signals:
+ void sendroute();
protected:
void changeEvent(QEvent *e);
<rect>
<x>0</x>
<y>0</y>
- <width>634</width>
- <height>300</height>
+ <width>800</width>
+ <height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>TextLabel</string>
</property>
</widget>
+ <widget class="QLabel" name="labelInfoToUser">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>310</y>
+ <width>521</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
</widget>
<resources/>
<connections/>
{
ui->setupUi(this);
this->setWindowTitle("Settings");
- this->ui->regEMailLineEdit->setText("@meili.fi");
+ this->ui->regEMailLineEdit->setText("@");
instructionsDialog = new InstructionsDialog;
}
emit sendregistration();
- close();
+ //close(); //using close() hides popup-window which reports error from server
}
// Next 6 functions can be removed if Settingsdialog is implemented without
this->password = ui->setUserPasswordLineEdit->text();
emit userNameChanged();
- close();
+
+ //close(); //using close() hides popup-window which reports error from server
}
// Next 4 functions can be removed if Settingsdialog is implemented without
return this->password;
}
+void SettingsDialog::setLabelInfoToUser(QString infoText)
+{
+ this->ui->labelInfoToUser->setText(infoText);
+}
void setPassword(QString password);
QString getUserName();
QString getPassword();
+ void setLabelInfoToUser(QString infoText);
signals:
void sendregistration();
<widget class="QPushButton" name="pushButtonHelp">
<property name="geometry">
<rect>
- <x>280</x>
- <y>300</y>
- <width>241</width>
+ <x>520</x>
+ <y>310</y>
+ <width>221</width>
<height>51</height>
</rect>
</property>
<widget class="QPushButton" name="setUserPushButton">
<property name="geometry">
<rect>
- <x>550</x>
- <y>240</y>
- <width>191</width>
+ <x>520</x>
+ <y>220</y>
+ <width>221</width>
<height>51</height>
</rect>
</property>
<widget class="QPushButton" name="registratePushButton">
<property name="geometry">
<rect>
- <x>550</x>
- <y>120</y>
- <width>191</width>
+ <x>520</x>
+ <y>60</y>
+ <width>221</width>
<height>51</height>
</rect>
</property>
<string>Register</string>
</property>
</widget>
- <widget class="QWidget" name="">
+ <widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
- <width>531</width>
+ <width>491</width>
<height>121</height>
</rect>
</property>
</item>
</layout>
</widget>
- <widget class="QWidget" name="">
+ <widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>210</y>
- <width>531</width>
+ <width>491</width>
<height>81</height>
</rect>
</property>
</item>
</layout>
</widget>
+ <widget class="QLabel" name="labelInfoToUser">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>310</y>
+ <width>521</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
</widget>
<resources/>
<connections/>
emit refreshCategoryList();
}
-void TopResultDialog::on_pushButton_debclose_clicked()
-{
- close();
-}
-
void TopResultDialog::setCompoBoxCategories(QStringList list)
{
ui->comboBoxTopCategory->addItems(list);
recentCategoryIndex = index;
emit refreshTopList(index);
}
+
+void TopResultDialog::setLabelInfoToUser(QString infoText)
+{
+ this->ui->labelInfoToUser->setText(infoText);
+}
int getRecentCategoryIndex();
int getLimitNr();
void setLimitNr(int number);
+ void setLabelInfoToUser(QString infoText);
protected:
void changeEvent(QEvent *e);
private slots:
void on_comboBoxTopCategory_currentIndexChanged(int index);
- void on_pushButton_debclose_clicked();
void on_buttonTopRefresh_clicked();
};
<widget class="QListView" name="listViewTopList">
<property name="geometry">
<rect>
- <x>300</x>
+ <x>280</x>
<y>0</y>
- <width>471</width>
- <height>261</height>
+ <width>491</width>
+ <height>251</height>
</rect>
</property>
<property name="font">
<widget class="QLabel" name="labelTopList">
<property name="geometry">
<rect>
- <x>320</x>
+ <x>300</x>
<y>0</y>
- <width>431</width>
- <height>261</height>
+ <width>451</width>
+ <height>251</height>
</rect>
</property>
<property name="font">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
- <widget class="QPushButton" name="pushButton_debclose">
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>20</y>
- <width>91</width>
- <height>27</height>
- </rect>
- </property>
- <property name="text">
- <string>PushButtondebclose</string>
- </property>
- </widget>
<widget class="QLabel" name="labelCategory">
<property name="geometry">
<rect>
<x>10</x>
- <y>210</y>
+ <y>200</y>
<width>221</width>
<height>51</height>
</rect>
<property name="geometry">
<rect>
<x>10</x>
- <y>269</y>
+ <y>260</y>
<width>601</width>
<height>41</height>
</rect>
</property>
</widget>
+ <widget class="QLabel" name="labelInfoToUser">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>310</y>
+ <width>521</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
</widget>
<resources/>
<connections/>