void MainWindow::on_actionStart_Server_triggered() { ServerDialog *dialog = new ServerDialog(this); if(!dialog->config()) return; Server *server = new Server(this); if(!server->listen()){ QMessageBox::warning(this, tr("Warning"), tr("Can not start server!")); server->deleteOnReadyToClose(); server->stop(); return; } this->server = server; connect(this, SIGNAL(about_to_exit()), server, SLOT(stop())); server->daemonize(); ui->actionStart_Game->disconnect(); connect(ui->actionStart_Game, SIGNAL(triggered()), this, SLOT(startGameInAnotherInstance())); StartScene *start_scene = qobject_cast<StartScene *>(scene); if(start_scene){ start_scene->switchToServer(server); if(Config.value("EnableMinimizeDialog", false).toBool()) this->on_actionMinimize_to_system_tray_triggered(); } }
void MainWindow::on_actionStart_Server_triggered() { ServerDialog *dialog = new ServerDialog(this); int accept_type = dialog->config(); if (accept_type == 0) return; server = new Server(this); if (!server->listen()) { QMessageBox::warning(this, tr("Warning"), tr("Can not start server!")); return; } server->checkUpnpAndListServer(); if (accept_type == 1) { server->daemonize(); ui->actionStart_Game->disconnect(); connect(ui->actionStart_Game, SIGNAL(triggered()), this, SLOT(startGameInAnotherInstance())); StartScene *start_scene = qobject_cast<StartScene *>(scene); if (start_scene) { start_scene->switchToServer(server); if (Config.value("EnableMinimizeDialog", false).toBool()) this->on_actionMinimize_to_system_tray_triggered(); } } else { Config.HostAddress = "127.0.0.1"; startConnection(); } }
void MainWindow::on_actionStart_Server_triggered() { ServerDialog *dialog = new ServerDialog(this); if (!dialog->config()) return; server = new Server(this); if (!server->listen()) { QMessageBox::warning(this, tr("Warning"), tr("Can not start server!")); return; } server->daemonize(); ui->actionStart_Game->disconnect(); #ifdef QT_NO_PROCESS ui->actionStart_Game->setEnabled(false); #else connect(ui->actionStart_Game, SIGNAL(triggered()), this, SLOT(startGameInAnotherInstance())); #endif StartScene *start_scene = qobject_cast<StartScene *>(scene); if (start_scene) { start_scene->switchToServer(server); if (Config.value("EnableMinimizeDialog", false).toBool()) this->on_actionMinimize_to_system_tray_triggered(); } }
void MainWindow::on_actionStart_Server_triggered() { ServerDialog *dialog = new ServerDialog(this); if(!dialog->config()) return; Server *server = new Server(this); if(! server->listen()){ QMessageBox::warning(this, tr("Warning"), tr("Can not start server!")); return; } server->daemonize(); ui->actionStart_Game->disconnect(); connect(ui->actionStart_Game, SIGNAL(triggered()), this, SLOT(startGameInAnotherInstance())); StartScene *start_scene = qobject_cast<StartScene *>(scene); if(start_scene){ start_scene->switchToServer(server); } }