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->routeDialog->setLabelInfoToUser("Sending route to server");
+ myMainw->routeSaveDialog->routeDialog->setLabelInfoToUser("Sending route to server");
file.close();
}
{
qDebug() << "_ackOfRoute";
- myMainw->routeDialog->setLabelInfoToUser("");
+ myMainw->routeSaveDialog->routeDialog->setLabelInfoToUser("");
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
errorcode = reply->error();
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- QMessageBox::about(myMainw->routeDialog, "Server reply to route sending ",reply->errorString());
+ QMessageBox::about(myMainw->routeSaveDialog->routeDialog, "Server reply to route sending ",reply->errorString());
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
errorcode = reply->error();
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- QMessageBox::about(myMainw->topResultDialog, "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->topResultDialog, "Server reply to requesting categories ", "OK");
+ //QMessageBox::about(myMainw->topResultDialog, "Server reply to requesting categories ", "OK");
}
}
errorcode = reply->error();
if(errorcode != 0) {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- QMessageBox::about(myMainw->topResultDialog, "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();
QCoreApplication::setOrganizationDomain("fudeco.com");
QCoreApplication::setApplicationName("Speed Freak");
- routeDialog = new RouteDialog;
- connect(routeDialog,SIGNAL(sendroute()),this,SLOT(clientSendRoute()));
+ //routeDialog = new RouteDialog;
+ //connect(routeDialog,SIGNAL(sendroute()),this,SLOT(clientSendRoute()));
helpDialog = NULL;
+ accstart = NULL;
routeSaveDialog = NULL;
+ topResultDialog = NULL;
settingsDialog = new SettingsDialog;
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)));
-
httpClient = new HttpClient(this);
connect(httpClient->myXmlreader, SIGNAL(receivedCategoryList()), this, SLOT(setCategoryCompoBox()));
- connect(httpClient->myXmlreader, SIGNAL(receivedTop10List()), this, SLOT(showTop10()));
-
- accstart = NULL;
+ connect(httpClient->myXmlreader, SIGNAL(receivedTop10List()), this, SLOT(showTop10()));
//creditsDialog = new CreditsDialog;
MainWindow::~MainWindow()
{
delete ui;
- delete routeSaveDialog;
- delete routeDialog;
+
+ if(routeSaveDialog)
+ delete routeSaveDialog;
if(accstart)
delete accstart;
+
+ if(topResultDialog)
+ delete topResultDialog;
+
+ if(settingsDialog)
+ delete settingsDialog;
+
+ if(welcomeDialog)
+ delete welcomeDialog;
+
+ if(httpClient)
+ delete httpClient;
+
+ if(helpDialog)
+ delete helpDialog;
}
void MainWindow::changeEvent(QEvent *e)
if(!routeSaveDialog)
routeSaveDialog = new RouteSaveDialog;
connect(routeSaveDialog, SIGNAL(sendroute()), this, SLOT(clientSendRoute()));
+ connect(topResultDialog, SIGNAL(rejected()), this, SLOT(killDialog()));
routeSaveDialog->show();
}
if(!accstart)
accstart = new accelerationstart(this);
connect(accstart, SIGNAL(sendresult(QString, double)), this, SLOT(clientSendResult(QString, double)));
+ connect(topResultDialog, SIGNAL(rejected()), this, SLOT(killDialog()));
accstart->show();
}
*/
void MainWindow::on_pushButtonResults_clicked()
{
+ if (!topResultDialog)
+ topResultDialog = new TopResultDialog;
+ clientRequestCategoryList();
+ connect(topResultDialog, SIGNAL(refreshCategoryList()), this, SLOT(clientRequestCategoryList()));
+ connect(topResultDialog, SIGNAL(refreshTopList(int)), this, SLOT(clientRequestTopList(int)));
+ connect(topResultDialog, SIGNAL(rejected()), this, SLOT(killDialog()));
topResultDialog->show();
}
}
/**
- * This function
+ * This function register user to server.
*/
void MainWindow::clientRegUserToServer()
{
}
/**
- * This function performs login to server
+ * This function performs login to server.
*/
void MainWindow::clientUserLogin()
{
}
/**
- * This function send route to server
+ * This function send route data to server.
*/
void MainWindow::clientSendRoute()
{
}
/**
- * This function send acceleration data to server
+ * This function send acceleration data to server.
*/
void MainWindow::clientSendResult(QString category, double result)
{
httpClient->sendResultXml(category, result);
}
}
+/**
+ * This slot function called when ever dialog finished.
+ */
+void MainWindow::killDialog()
+{
+ if(topResultDialog)
+ {
+ delete topResultDialog;
+ topResultDialog = NULL;
+ }
+ else if(routeSaveDialog)
+ {
+ delete routeSaveDialog;
+ routeSaveDialog = NULL;
+ }
+ else if(accstart)
+ {
+ delete accstart;
+ accstart = NULL;
+ }
+}