/**
*@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());
}
-
}