/** * This function performs login to server. */ void MainWindow::clientUserLogin() { if(httpClient) { connect(httpClient, SIGNAL(loginOK()), this, SLOT(setUsernameToMainPanel())); httpClient->checkLogin(); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QCoreApplication::setOrganizationName("Fudeco Oy"); QCoreApplication::setOrganizationDomain("fudeco.com"); QCoreApplication::setApplicationName("Speed Freak"); 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())); connect(settingsDialog, SIGNAL(logout()), this, SLOT(setUsernameToMainPanel())); connect(settingsDialog, SIGNAL(saveprofile()), this, SLOT(saveProfile())); httpClient = new HttpClient(this); connect(httpClient->myXmlreader, SIGNAL(receivedCategoryList()), this, SLOT(setCategoryCompoBox())); connect(httpClient->myXmlreader, SIGNAL(receivedTop10List()), this, SLOT(showTop10())); welcomeDialog = new WelcomeDialog; welcomeDialog->show(); this->setUsernameToMainPanel(); //Create icon for acceleration start button QIcon* icon = new QIcon(); icon->addFile(QString(":/new/prefix1/Graphics/Speedometer.png"), QSize(125,125), QIcon::Normal, QIcon::Off); icon->addFile(QString(":/new/prefix1/Graphics/Speedometer2.png"), QSize(125,125), QIcon::Normal, QIcon::On); //Acceleration start button customButtonAccelerate = new CustomButton(this,icon); delete icon; int buttons_x = 50,buttons_y = 165; customButtonAccelerate->setGeometry(buttons_x,buttons_y,130,130); connect(customButtonAccelerate, SIGNAL(OpenDialog()), this, SLOT(OpenAccStartDialog())); customButtonAccelerate->show(); //Create icon for route dialog button icon = new QIcon(); icon->addFile(QString(":/new/prefix1/Graphics/route.png"), QSize(125,125), QIcon::Normal, QIcon::Off); icon->addFile(QString(":/new/prefix1/Graphics/route_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On); //Route dialog button customButtonRoute = new CustomButton(this,icon); delete icon; buttons_x += 140; customButtonRoute->setGeometry(buttons_x,buttons_y,130,130); connect(customButtonRoute, SIGNAL(OpenDialog()), this, SLOT(OpenRouteDialog())); customButtonRoute->show(); //Create icon for results dialog button icon = new QIcon(); icon->addFile(QString(":/new/prefix1/Graphics/trophy_gold.png"), QSize(125,125), QIcon::Normal, QIcon::Off); icon->addFile(QString(":/new/prefix1/Graphics/trophy_gold_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On); //Results dialog button customButtonResults = new CustomButton(this,icon); delete icon; buttons_x += 140; customButtonResults->setGeometry(buttons_x,buttons_y,130,130); connect(customButtonResults, SIGNAL(OpenDialog()), this, SLOT(OpenResultDialog())); customButtonResults->show(); //Create icon for settings dialog button icon = new QIcon(); icon->addFile(QString(":/new/prefix1/Graphics/settings.png"), QSize(125,125), QIcon::Normal, QIcon::Off); icon->addFile(QString(":/new/prefix1/Graphics/settings_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On); //Settings dialog button customButtonSettings = new CustomButton(this,icon); delete icon; buttons_x += 140; customButtonSettings->setGeometry(buttons_x,buttons_y,130,130); connect(customButtonSettings, SIGNAL(OpenDialog()), this, SLOT(OpenSettingsDialog())); customButtonSettings->show(); //Create icon for www page button icon = new QIcon(); icon->addFile(QString(":/new/prefix1/Graphics/applications_internet.png"), QSize(125,125), QIcon::Normal, QIcon::Off); icon->addFile(QString(":/new/prefix1/Graphics/applications_internet_selected.png"), QSize(125,125), QIcon::Normal, QIcon::On); //WWW page button customButtonWWW = new CustomButton(this,icon); delete icon; buttons_x += 140; customButtonWWW->setGeometry(buttons_x,buttons_y,130,130); connect(customButtonWWW, SIGNAL(OpenDialog()), this, SLOT(OpenWWWPage())); customButtonWWW->show(); //Create icon for help dialog button icon = new QIcon(); icon->addFile(QString(":/new/prefix1/Graphics/info.png"), QSize(105,105), QIcon::Normal, QIcon::Off); icon->addFile(QString(":/new/prefix1/Graphics/info_selected.png"), QSize(105,105), QIcon::Normal, QIcon::On); //Help dialog button customButtonHelp = new CustomButton(this,icon); delete icon; customButtonHelp->setGeometry(670,10,105,105); connect(customButtonHelp, SIGNAL(OpenDialog()), this, SLOT(OpenHelpDialog())); customButtonHelp->show(); }