This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
#include "log.h"
|
||||
#include "configfile.h"
|
||||
|
||||
#include <net/socket_msg.h>
|
||||
#include <net/socket_msg.h>
|
||||
|
||||
#define FORMATLEFT(X) "<p align='center'>(X)"
|
||||
#define FORMATRIGHT(X) "(X)</p>"
|
||||
@@ -498,100 +498,62 @@ mainWindowImpl::~mainWindowImpl() {}
|
||||
|
||||
void mainWindowImpl::callNewGameDialog() {
|
||||
|
||||
|
||||
|
||||
//wenn Dialogfenster gezeigt werden soll
|
||||
|
||||
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")){
|
||||
|
||||
newGameDialogImpl *v = new newGameDialogImpl(this);
|
||||
v->exec();
|
||||
|
||||
if (v->result() == QDialog::Accepted ) {
|
||||
|
||||
// Start new local game - terminate existing network game.
|
||||
mySession->terminateNetworkClient();
|
||||
mySession->terminateNetworkServer();
|
||||
|
||||
if(actualGame) {
|
||||
mySession->deleteGame();
|
||||
actualGame = 0;
|
||||
}
|
||||
|
||||
guiGameSpeed = v->spinBox_gameSpeed->value();
|
||||
// debugMode = v->checkBox_debugMode->isChecked();
|
||||
//Speeds
|
||||
setSpeeds();
|
||||
|
||||
//restliche Singleshots killen!!!
|
||||
stopTimer();
|
||||
|
||||
label_Pot->setText("<p align='center'><span style='font-weight:bold'>Pot Total</span></p>");
|
||||
label_Sets->setText("<p align='center'><span style='font-weight:bold'>Sets:</span></p>");
|
||||
|
||||
|
||||
//Tools und Board aufhellen und enablen
|
||||
QPalette tempPalette = groupBox_board->palette();
|
||||
tempPalette.setColor(QPalette::Window, active);
|
||||
groupBox_board->setPalette(tempPalette);
|
||||
groupBox_right_tools->setDisabled(FALSE);
|
||||
groupBox_left_tools->setDisabled(FALSE);
|
||||
|
||||
|
||||
//positioning Slider
|
||||
horizontalSlider_speed->setValue(guiGameSpeed);
|
||||
|
||||
//Start Game!!!
|
||||
mySession->startGame(v->spinBox_quantityPlayers->value(), v->spinBox_startCash->value(), v->spinBox_smallBlind->value());
|
||||
|
||||
}
|
||||
if (v->result() == QDialog::Accepted ) { startNewLocalGame(v); }
|
||||
}
|
||||
// sonst mit gespeicherten Werten starten
|
||||
else {
|
||||
else { startNewLocalGame(); }
|
||||
}
|
||||
|
||||
// COPY AND PASTE WARNING, see above!!!
|
||||
// TODO
|
||||
// Start new local game - terminate existing network game.
|
||||
mySession->terminateNetworkClient();
|
||||
mySession->terminateNetworkServer();
|
||||
void mainWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
|
||||
|
||||
if(actualGame) {
|
||||
mySession->deleteGame();
|
||||
actualGame = 0;
|
||||
}
|
||||
|
||||
guiGameSpeed = myConfig->readConfigInt("GameSpeed");
|
||||
//Speeds
|
||||
setSpeeds();
|
||||
|
||||
//restliche Singleshots killen!!!
|
||||
stopTimer();
|
||||
|
||||
label_Pot->setText("<p align='center'><span style='font-weight:bold'>Pot Total</span></p>");
|
||||
label_Sets->setText("<p align='center'><span style='font-weight:bold'>Sets:</span></p>");
|
||||
|
||||
|
||||
// debugMode = v->checkBox_debugMode->isChecked();
|
||||
|
||||
//Tools und Board aufhellen und enablen
|
||||
QPalette tempPalette = groupBox_board->palette();
|
||||
tempPalette.setColor(QPalette::Window, active);
|
||||
groupBox_board->setPalette(tempPalette);
|
||||
groupBox_right_tools->setDisabled(FALSE);
|
||||
groupBox_left_tools->setDisabled(FALSE);
|
||||
|
||||
// Start new local game - terminate existing network game.
|
||||
mySession->terminateNetworkClient();
|
||||
mySession->terminateNetworkServer();
|
||||
|
||||
if(actualGame) {
|
||||
mySession->deleteGame();
|
||||
actualGame = 0;
|
||||
}
|
||||
//restliche Singleshots killen!!!
|
||||
stopTimer();
|
||||
|
||||
//positioning Slider
|
||||
horizontalSlider_speed->setValue(guiGameSpeed);
|
||||
label_Pot->setText("<p align='center'><span style='font-weight:bold'>Pot Total</span></p>");
|
||||
label_Sets->setText("<p align='center'><span style='font-weight:bold'>Sets:</span></p>");
|
||||
|
||||
//Tools und Board aufhellen und enablen
|
||||
QPalette tempPalette = groupBox_board->palette();
|
||||
tempPalette.setColor(QPalette::Window, active);
|
||||
groupBox_board->setPalette(tempPalette);
|
||||
groupBox_right_tools->setDisabled(FALSE);
|
||||
groupBox_left_tools->setDisabled(FALSE);
|
||||
|
||||
//positioning Slider
|
||||
horizontalSlider_speed->setValue(guiGameSpeed);
|
||||
|
||||
//get values from local game dialog
|
||||
if(v) {
|
||||
//Speeds
|
||||
guiGameSpeed = v->spinBox_gameSpeed->value();
|
||||
setSpeeds();
|
||||
//Start Game!!!
|
||||
mySession->startGame(v->spinBox_quantityPlayers->value(), v->spinBox_startCash->value(), v->spinBox_smallBlind->value());
|
||||
}
|
||||
// start with default values
|
||||
else {
|
||||
//Speeds
|
||||
guiGameSpeed = myConfig->readConfigInt("GameSpeed");
|
||||
setSpeeds();
|
||||
//Start Game!!!
|
||||
mySession->startGame(myConfig->readConfigInt("NumberOfPlayers"), myConfig->readConfigInt("StartCash"), myConfig->readConfigInt("SmallBlind"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void mainWindowImpl::callAboutPokerthDialog() {
|
||||
|
||||
aboutPokerthImpl *v = new aboutPokerthImpl(this);
|
||||
@@ -2026,85 +1988,85 @@ void mainWindowImpl::paintStartSplash() {
|
||||
|
||||
void mainWindowImpl::networkError(int errorID, int osErrorID) {
|
||||
|
||||
switch (errorID) {
|
||||
|
||||
case ERR_SOCK_SERVERADDR_NOT_SET:
|
||||
{QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Server address was not set."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_INVALID_PORT:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("An invalid port was set (ports 0-1023 are not allowed)."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_CREATION_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Could not create a socket for TCP communication."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_SET_ADDR_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Could not set the IP address."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_SET_PORT_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Could not set the port for this type of address."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_RESOLVE_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("The server name could not be resolved."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_BIND_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Bind failed - please choose a different port."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_LISTEN_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Internal network error: \"listen\" failed."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_ACCEPT_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Server execution was terminated."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_CONNECT_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Could not connect to the server."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_SELECT_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Internal network error: \"select\" failed."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_RECV_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Internal network error: \"recv\" failed."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_SEND_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Internal network error: \"send\" failed."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_CONN_RESET:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Connection was closed by server."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
default: { QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("DEFAULT ERROR"),
|
||||
QMessageBox::Close); }
|
||||
}
|
||||
// close dialogs
|
||||
myConnectToServerDialog->reject();
|
||||
myWaitingForServerGameDialog->reject();
|
||||
switch (errorID) {
|
||||
|
||||
case ERR_SOCK_SERVERADDR_NOT_SET:
|
||||
{QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Server address was not set."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_INVALID_PORT:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("An invalid port was set (ports 0-1023 are not allowed)."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_CREATION_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Could not create a socket for TCP communication."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_SET_ADDR_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Could not set the IP address."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_SET_PORT_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Could not set the port for this type of address."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_RESOLVE_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("The server name could not be resolved."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_BIND_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Bind failed - please choose a different port."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_LISTEN_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Internal network error: \"listen\" failed."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_ACCEPT_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Server execution was terminated."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_CONNECT_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Could not connect to the server."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_SELECT_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Internal network error: \"select\" failed."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_RECV_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Internal network error: \"recv\" failed."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_SEND_FAILED:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Internal network error: \"send\" failed."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
case ERR_SOCK_CONN_RESET:
|
||||
{ QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("Connection was closed by server."),
|
||||
QMessageBox::Close); }
|
||||
break;
|
||||
default: { QMessageBox::warning(this, tr("Network Error"),
|
||||
tr("DEFAULT ERROR"),
|
||||
QMessageBox::Close); }
|
||||
}
|
||||
// close dialogs
|
||||
myConnectToServerDialog->reject();
|
||||
myWaitingForServerGameDialog->reject();
|
||||
}
|
||||
|
||||
void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
|
||||
|
||||
Reference in New Issue
Block a user