QCoreApplication::setOrganizationDomain("fudeco.com");
QCoreApplication::setApplicationName("Speed Freak");
- //routeDialog = new RouteDialog;
- //connect(routeDialog,SIGNAL(sendroute()),this,SLOT(clientSendRoute()));
-
helpDialog = NULL;
accstart = NULL;
routeSaveDialog = NULL;
connect(httpClient->myXmlreader, SIGNAL(receivedCategoryList()), this, SLOT(setCategoryCompoBox()));
connect(httpClient->myXmlreader, SIGNAL(receivedTop10List()), this, SLOT(showTop10()));
- //creditsDialog = new CreditsDialog;
-
welcomeDialog = new WelcomeDialog;
- welcomeDialog->show();
+ //welcomeDialog->show();
this->setUsernameToMainPanel();
{
if(!helpDialog)
helpDialog = new HelpDialog;
+
helpDialog->show();
- //creditsDialog->show();
}
/**
{
if(!routeSaveDialog)
routeSaveDialog = new RouteSaveDialog;
+
connect(routeSaveDialog, SIGNAL(sendroute()), this, SLOT(clientSendRoute()));
- connect(topResultDialog, SIGNAL(rejected()), this, SLOT(killDialog()));
+ connect(routeSaveDialog, 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(accstart, SIGNAL(rejected()), this, SLOT(killDialog()));
accstart->show();
{
if (!topResultDialog)
topResultDialog = new TopResultDialog;
+
clientRequestCategoryList();
connect(topResultDialog, SIGNAL(refreshCategoryList()), this, SLOT(clientRequestCategoryList()));
connect(topResultDialog, SIGNAL(refreshTopList(int)), this, SLOT(clientRequestTopList(int)));
*/
void MainWindow::clientRequestCategoryList()
{
- httpClient->requestCategories();
+ if(httpClient)
+ httpClient->requestCategories();
}
/**
*/
void MainWindow::clientRequestTopList(int index)
{
- QString limit = QString::number(topResultDialog->getLimitNr());
- httpClient->requestTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(index), limit);
+ QString limit;
+
+ if(topResultDialog && httpClient->myXmlreader->myCategoryList)
+ {
+ limit = QString::number(topResultDialog->getLimitNr());
+ httpClient->requestTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(index), limit);
+ }
}
/**
*/
void MainWindow::setCategoryCompoBox()
{
- topResultDialog->setCompoBoxCategories(httpClient->myXmlreader->myCategoryList->getCategoryList());
+ if(topResultDialog && httpClient->myXmlreader->myCategoryList)
+ topResultDialog->setCompoBoxCategories(httpClient->myXmlreader->myCategoryList->getCategoryList());
}
/**
*/
void MainWindow::showTop10()
{
- int ind = topResultDialog->getRecentCategoryIndex();
- setListViewTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(ind), topResultDialog->getLimitNr());
+ int ind;
+
+ if(topResultDialog && httpClient->myXmlreader->myCategoryList && topResultDialog)
+ {
+ ind = topResultDialog->getRecentCategoryIndex();
+ setListViewTopList(httpClient->myXmlreader->myCategoryList->getRecentCategory(ind), topResultDialog->getLimitNr());
+ }
}
/**
void MainWindow::setListViewTopList(QString category, int size)
{
QString topList;
- topList.append(httpClient->myXmlreader->myCategoryList->getTopList(category, size));
- topResultDialog->showTopList(topList);
+
+ if(httpClient->myXmlreader->myCategoryList && topResultDialog)
+ {
+ topList.append(httpClient->myXmlreader->myCategoryList->getTopList(category, size));
+ topResultDialog->showTopList(topList);
+ }
}
/**
*/
void MainWindow::clientRegUserToServer()
{
- httpClient->requestRegistration();
+ if(httpClient)
+ httpClient->requestRegistration();
}
/**
*/
void MainWindow::clientUserLogin()
{
- connect(httpClient, SIGNAL(loginOK()), this, SLOT(setUsernameToMainPanel()));
- httpClient->checkLogin();
+
+ if(httpClient)
+ {
+ connect(httpClient, SIGNAL(loginOK()), this, SLOT(setUsernameToMainPanel()));
+ httpClient->checkLogin();
+ }
}
/**
*/
void MainWindow::clientSendRoute()
{
- httpClient->sendRouteXml();
+ if(httpClient)
+ httpClient->sendRouteXml();
}
/**
qDebug() << "__clientSendResult";
if(accstart) {
qDebug() << "_clientSendResult, calling server";
- httpClient->sendResultXml(category, result);
+ if(httpClient)
+ httpClient->sendResultXml(category, result);
}
}
/**
{
if(topResultDialog)
{
+ qDebug() << "__MW kill: topResultDialog";
delete topResultDialog;
topResultDialog = NULL;
}
- else if(routeSaveDialog)
+ if(routeSaveDialog)
{
- delete routeSaveDialog;
- routeSaveDialog = NULL;
+ qDebug() << "__MW kill: routeSaveDialog";
+ //delete routeSaveDialog;
+ //routeSaveDialog = NULL;
}
- else if(accstart)
+ if(accstart)
{
+ qDebug() << "__MW kill: accstart";
delete accstart;
accstart = NULL;
}
+ if(welcomeDialog)
+ {
+ qDebug() << "__MW kill: welcomeDialog";
+ delete welcomeDialog;
+ welcomeDialog = NULL;
+ }
+ if(helpDialog)
+ {
+ qDebug() << "__MW kill: helpDialog";
+ delete helpDialog;
+ helpDialog = NULL;
+ }
}
void MainWindow::setUsernameToMainPanel()