void login::saveLogin_click() { saveLogin(); }
LauncherWindow::LauncherWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::LauncherWindow) { // Setup form from ui-file ui->setupUi(this); // Make news menuitems like radiobuttons (it's impossible from qt-designer) QActionGroup *newsGroup = new QActionGroup(this); newsGroup->addAction(ui->ttyhNews); newsGroup->addAction(ui->officialNews); ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); connect(ui->webView, SIGNAL(linkClicked(const QUrl&)), SLOT(linkClicked(const QUrl&))); // News Menu connections connect(ui->ttyhNews, SIGNAL(changed()), SLOT(loadTtyh())); connect(ui->officialNews, SIGNAL(changed()), SLOT(loadOfficial())); // Options Menu connections connect(ui->runSettings, SIGNAL(triggered()), SLOT(showSettingsDialog())); // Additional Menu connections connect(ui->changePassword, SIGNAL(triggered()), SLOT(showChangePasswordDialog())); connect(ui->changeSkin, SIGNAL(triggered()), SLOT(showSkinLoadDialog())); connect(ui->updateManager, SIGNAL(triggered()), SLOT(showUpdateManagerDialog())); // Help Menu connections connect(ui->bugReport, SIGNAL(triggered()), SLOT(showFeedBackDialog())); connect(ui->aboutLauncher, SIGNAL(triggered()), SLOT(showAboutDialog())); // Connect to settings Settings* settings = Settings::instance(); // Setup login field ui->nickEdit->setText(settings->loadLogin()); // Save login when changed connect(ui->nickEdit, SIGNAL(textChanged(QString)), settings, SLOT(saveLogin(QString))); // Setup password field ui->savePassword->setChecked(settings->loadPassStore()); if (ui->savePassword->isChecked()) ui->passEdit->setText(settings->loadPassword()); // Password are saved on login or exit if savePassword is checked connect(ui->savePassword, SIGNAL(clicked(bool)), settings, SLOT(savePassStore(bool))); // Setup client combobox ui->clientCombo->addItems(settings->getClientsNames()); ui->clientCombo->setCurrentIndex(settings->loadActiveClientId()); connect(ui->clientCombo, SIGNAL(activated(int)), settings, SLOT(saveActiveClientId(int))); // Setup news set ui->ttyhNews->setChecked(true); emit ui->ttyhNews->changed(); // Setup window parameters QRect geometry = settings->loadWindowGeometry(); // Centering window, if loaded default values if (geometry.x() < 0) this->move(QApplication::desktop()->screen()->rect().center() - this->rect().center()); else this->setGeometry(geometry); // Restore maximized state if (settings->loadMaximizedState()) this->showMaximized(); connect(ui->playButton, SIGNAL(clicked()), this, SLOT(startGame())); }