accelerationStartThreshold = 0.02;
accelerometerTimer = new QTimer(this);
-//tkk connect(accelerometerTimer, SIGNAL(timeout()), this, SLOT(readAccelerometerData()));
+ connect(accelerometerTimer, SIGNAL(timeout()), this, SLOT(readAccelerometerData()));
//accelerometerTimer->start(kAccelerometerSampleRate);
// Calculate
ui->pushButtonShowResultDialog->setEnabled(false);
choice = ui->listViewStartTabAccelerationCategories->currentIndex();
choiceInt = choice.row();
- qDebug() << "choiceInt" << choiceInt << " " << catList.at(choiceInt);
+ //qDebug() << "choiceInt" << choiceInt << " " << catList.at(choiceInt);
if (choiceInt == 0)
{
ui->labelMeasureTabHeader->setText("Accelerate to 40 km/h");
catList.insert(1,"acceleration-0-100");
catList.insert(2,"acceleration-0-10");
- accelerationCategoriesStartTab << "0-40 km/h" << "0-100 km/h" << "0-10 km/h"; //<< "0-1/4 Mile" << "0-1/8 Mile" << "50-100 Mile" << "0-60 Mph" << "0-100 m" << "0-50 ft" << "0-50 yrd" << "0-500 in";
+ accelerationCategoriesStartTab << "0-40 km/h" << "0-100 km/h" << "0-10 km/h";
+ //<< "0-1/4 Mile" << "0-1/8 Mile" << "50-100 Mile" << "0-60 Mph" << "0-100 m" << "0-50 ft" << "0-50 yrd" << "0-500 in";
QAbstractItemModel *model = new StringListModel(accelerationCategoriesStartTab);
ui->listViewStartTabAccelerationCategories->setModel(model);
}
ui->listViewStartTabAccelerationCategories->setModel(model);
}
+void CarMainWindow::setLabelInfoToUser(QString infoText)
+{
+ ui->labelInfoToUser->setText(infoText);
+}
+
/**
*This function is used to set items to category combobox. Top-tab view.
*@param
/**
*@brief Sends registration information to the server in xml format.
*Reads user name, password and emaol address from resuldialogs internal variables.
- *@todo Replace msg box with better reaction to server`s responce.
*/
void HttpClient::requestRegistration()
{
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");
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");
xmlbuffer->close();
}
currentDownload = netManager->post(request, ("xml=" + xmlbuffer->data()));
connect(currentDownload,SIGNAL(finished()),this,SLOT(ackOfRoute()));
//connect(currentDownload,SIGNAL(error(QNetworkReply::NetworkError)),myMainw,SLOT(errorFromServer(QNetworkReply::NetworkError)));
+ myMainw->setLabelInfoToUser("Sending route to server");
xmlbuffer->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");
}
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");
}
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");
}
/**
*@brief React to servers responce after result has been sent.
- *@todo Implement consequencies of reply.
*/
void HttpClient::ackOfResult()
{
qDebug() << "_ackOfResult";
+ myMainw->setLabelInfoToUser("");
+
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
QNetworkReply::NetworkError errorcode;
}
/**
- *@brief React to servers responce after result has been sent.
- *@todo Implement consequencies of reply.
+ *@brief React to servers responce after route has been sent.
*/
void HttpClient::ackOfRoute()
{
qDebug() << "_ackOfRoute";
+ myMainw->setLabelInfoToUser("");
+
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
QNetworkReply::NetworkError errorcode;
{
qDebug() << "_ackOfRegistration";
+ myMainw->setLabelInfoToUser("");
+
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
QNetworkReply::NetworkError errorcode;
qDebug() << "errorcode=0" << errorcode << reply->errorString();
QMessageBox::about(myMainw, "Server reply to registration", "User registration " + reply->readAll());
}
-
}
{
qDebug() << "_ackOfCategories";
+ myMainw->setLabelInfoToUser("");
+
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
myXmlreader->xmlReadCategories(reply);
qDebug() << "errorcode:" << errorcode << reply->errorString();
QMessageBox::about(myMainw, "Server reply to requesting categories ", "OK");
}
-
}
/**
*@brief React to servers responce after request of TopList in certain category has been sent.
- *@todo Implement routing reply`s contents to UI.
*/
void HttpClient::ackOfLogin()
{
qDebug() << "_ackOffLogin";
+ myMainw->setLabelInfoToUser("");
+
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
QNetworkReply::NetworkError errorcode;
{
qDebug() << "_errorFromServer";
+ myMainw->setLabelInfoToUser("");
+
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode;
- //Note that errors are already reported on other ach-functions for server communication
+ //Note that errors are already reported on other each functions for server communication
//QMessageBox::about(myMainw, "Server reported an error", reply->errorString());
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
qDebug() << reply->readAll();
}
-
}
/**
*@brief React to servers responce after request of TopList in certain category has been sent.
- *@todo Implement routing reply`s contents to UI.
*/
void HttpClient::ackOfToplist()
{
qDebug() << "_ackOfToplist";
+ myMainw->setLabelInfoToUser("");
+
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
myXmlreader->xmlReadTop10Results(reply);
qDebug() << "errorcode:" << errorcode << reply->errorString();
QMessageBox::about(myMainw, "Server reply to requesting top 10 list", "OK " + reply->readAll());
}
-
}