QTfrontend/hwform.cpp
changeset 8416 e691acd778f5
parent 8415 02acf6b92f52
child 8424 225ede46e3dc
equal deleted inserted replaced
8415:02acf6b92f52 8416:e691acd778f5
  1730     ui.pageNetGame->pNetTeamsWidget->setInteractivity(true);
  1730     ui.pageNetGame->pNetTeamsWidget->setInteractivity(true);
  1731 
  1731 
  1732     if (hwnet)
  1732     if (hwnet)
  1733     {
  1733     {
  1734         // disconnect connections first to ensure their inexistance and not to connect twice
  1734         // disconnect connections first to ensure their inexistance and not to connect twice
  1735         ui.pageNetGame->BtnStart->disconnect(hwnet);
  1735         ui.pageNetGame->BtnStart->disconnect(this);
  1736         ui.pageNetGame->BtnUpdate->disconnect(hwnet);
  1736         ui.pageNetGame->BtnUpdate->disconnect(hwnet);
  1737         ui.pageNetGame->leRoomName->disconnect(hwnet);
  1737         ui.pageNetGame->leRoomName->disconnect(hwnet);
  1738         ui.pageNetGame->restrictJoins->disconnect(hwnet);
  1738         ui.pageNetGame->restrictJoins->disconnect(hwnet);
  1739         ui.pageNetGame->restrictTeamAdds->disconnect(hwnet);
  1739         ui.pageNetGame->restrictTeamAdds->disconnect(hwnet);
  1740         ui.pageNetGame->disconnect(hwnet, SLOT(updateRoomName(const QString&)));
  1740         ui.pageNetGame->disconnect(hwnet, SLOT(updateRoomName(const QString&)));
  1741 
  1741 
  1742         ui.pageNetGame->setRoomName(hwnet->getRoom());
  1742         ui.pageNetGame->setRoomName(hwnet->getRoom());
  1743 
  1743 
  1744         connect(ui.pageNetGame->BtnStart, SIGNAL(clicked()), hwnet, SLOT(startGame()));
  1744         connect(ui.pageNetGame->BtnStart, SIGNAL(clicked()), this, SLOT(startGame()));
  1745         connect(ui.pageNetGame, SIGNAL(askForUpdateRoomName(const QString &)), hwnet, SLOT(updateRoomName(const QString &)));
  1745         connect(ui.pageNetGame, SIGNAL(askForUpdateRoomName(const QString &)), hwnet, SLOT(updateRoomName(const QString &)));
  1746         connect(ui.pageNetGame->restrictJoins, SIGNAL(triggered()), hwnet, SLOT(toggleRestrictJoins()));
  1746         connect(ui.pageNetGame->restrictJoins, SIGNAL(triggered()), hwnet, SLOT(toggleRestrictJoins()));
  1747         connect(ui.pageNetGame->restrictTeamAdds, SIGNAL(triggered()), hwnet, SLOT(toggleRestrictTeamAdds()));
  1747         connect(ui.pageNetGame->restrictTeamAdds, SIGNAL(triggered()), hwnet, SLOT(toggleRestrictTeamAdds()));
  1748         connect(ui.pageNetGame->pGameCFG->GameSchemes->model(),
  1748         connect(ui.pageNetGame->pGameCFG->GameSchemes->model(),
  1749                 SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
  1749                 SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
  1969 void HWForm::showFeedbackDialog()
  1969 void HWForm::showFeedbackDialog()
  1970 {
  1970 {
  1971     FeedbackDialog dialog(this);
  1971     FeedbackDialog dialog(this);
  1972     dialog.exec();
  1972     dialog.exec();
  1973 }
  1973 }
       
  1974 
       
  1975 void HWForm::startGame()
       
  1976 {
       
  1977     QMessageBox questionMsg(this);
       
  1978     questionMsg.setIcon(QMessageBox::Question);
       
  1979     questionMsg.setWindowTitle(QMessageBox::tr("Not all players are ready"));
       
  1980     questionMsg.setText(QMessageBox::tr("Are you sure you want to start this game?\nNot all players are ready."));
       
  1981     questionMsg.setWindowModality(Qt::WindowModal);
       
  1982     questionMsg.addButton(QMessageBox::Yes);
       
  1983     questionMsg.addButton(QMessageBox::Cancel);
       
  1984 
       
  1985     if (hwnet->allPlayersReady() || questionMsg.exec() == QMessageBox::Yes)
       
  1986         hwnet->startGame();
       
  1987 }