refactoring qmessageboxes to make them useable on android

This commit is contained in:
doitux
2012-05-17 01:35:59 +02:00
parent 8aaf25de04
commit 93aaabdef3
18 changed files with 146 additions and 124 deletions
+1 -1
View File
@@ -108,7 +108,7 @@ LocalHand::LocalHand(boost::shared_ptr<EngineFactory> f, GuiInterface *g, boost:
//QSqlDatabase * test = myGui->getMyLog()->getMySqliteLogDb(); //QSqlDatabase * test = myGui->getMyLog()->getMySqliteLogDb();
// if(!mySqliteLogDb->open()) { // if(!mySqliteLogDb->open()) {
// QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().c_str(), QMessageBox::Cancel); // MyMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().c_str(), QMessageBox::Cancel);
// } // }
+1 -1
View File
@@ -26,7 +26,7 @@ Replay::Replay() : replaySqliteLogDb(0)
// *replaySqliteLogDb = QSqlDatabase::addDatabase("QSQLITE"); // *replaySqliteLogDb = QSqlDatabase::addDatabase("QSQLITE");
//replaySqliteLogDb->setDatabaseName(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+".pdb"); //replaySqliteLogDb->setDatabaseName(myLogDir->absolutePath()+"/pokerth-log-"+currentTime.toString("yyyy-MM-dd_hh.mm.ss")+".pdb");
//if(!mySqliteLogDb->open()) { //if(!mySqliteLogDb->open()) {
// QMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().c_str(), QMessageBox::Cancel); // MyMessageBox::critical(0, tr("ERROR"),mySqliteLogDb->lastError().text().toUtf8().c_str(), QMessageBox::Cancel);
//} //}
} }
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * * along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/ *****************************************************************************/
#include "changecompleteblindsdialogimpl.h" #include "changecompleteblindsdialogimpl.h"
#include "mymessagebox.h"
#include "configfile.h" #include "configfile.h"
#include <iostream> #include <iostream>
@@ -51,7 +52,7 @@ void changeCompleteBlindsDialogImpl::addBlindValueToList()
{ {
if(listWidget_blinds->count() == 30) { if(listWidget_blinds->count() == 30) {
QMessageBox::warning(this, tr("Manual Blinds Order"), MyMessageBox::warning(this, tr("Manual Blinds Order"),
tr("You cannot set more than 30 manual blinds."), tr("You cannot set more than 30 manual blinds."),
QMessageBox::Close); QMessageBox::Close);
} else { } else {
@@ -44,7 +44,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
//wait start game message //wait start game message
waitStartGameMsgBox = new QMessageBox(this); waitStartGameMsgBox = new MyMessageBox(this);
waitStartGameMsgBox->setText(tr("Starting game. Please wait ...")); waitStartGameMsgBox->setText(tr("Starting game. Please wait ..."));
waitStartGameMsgBox->setWindowModality(Qt::NonModal); waitStartGameMsgBox->setWindowModality(Qt::NonModal);
#ifdef __APPLE__ #ifdef __APPLE__
@@ -53,7 +53,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
waitStartGameMsgBox->setStandardButtons(QMessageBox::NoButton); waitStartGameMsgBox->setStandardButtons(QMessageBox::NoButton);
//wait start game message for rejoin //wait start game message for rejoin
waitRejoinStartGameMsgBox = new QMessageBox(this); waitRejoinStartGameMsgBox = new MyMessageBox(this);
waitRejoinStartGameMsgBox->setText(tr("Waiting for the start of the next hand to rejoin the game ...")); waitRejoinStartGameMsgBox->setText(tr("Waiting for the start of the next hand to rejoin the game ..."));
waitRejoinStartGameMsgBox->setWindowModality(Qt::NonModal); waitRejoinStartGameMsgBox->setWindowModality(Qt::NonModal);
#ifdef __APPLE__ #ifdef __APPLE__
@@ -1256,7 +1256,7 @@ void gameLobbyDialogImpl::kickPlayer()
QString playerName = item->text(0); QString playerName = item->text(0);
if(playerName == QString::fromUtf8(myConfig->readConfigString("MyName").c_str())) { if(playerName == QString::fromUtf8(myConfig->readConfigString("MyName").c_str())) {
{ {
QMessageBox::warning(this, tr("Server Error"), MyMessageBox::warning(this, tr("Server Error"),
tr("You should not kick yourself from this game!"), tr("You should not kick yourself from this game!"),
QMessageBox::Close); QMessageBox::Close);
} }
@@ -2050,7 +2050,7 @@ void gameLobbyDialogImpl::reportBadGameName()
unsigned gameId = selection->selectedRows().first().data(Qt::UserRole).toUInt(); unsigned gameId = selection->selectedRows().first().data(Qt::UserRole).toUInt();
GameInfo info(mySession->getClientGameInfo(gameId)); GameInfo info(mySession->getClientGameInfo(gameId));
int ret = QMessageBox::question(this, tr("PokerTH - Question"), int ret = MyMessageBox::question(this, tr("PokerTH - Question"),
tr("Are you sure you want to report the game name:\n\"%1\" as inappropriate?").arg(QString::fromUtf8(info.name.c_str())), QMessageBox::Yes | QMessageBox::No); tr("Are you sure you want to report the game name:\n\"%1\" as inappropriate?").arg(QString::fromUtf8(info.name.c_str())), QMessageBox::Yes | QMessageBox::No);
if(ret == QMessageBox::Yes) { if(ret == QMessageBox::Yes) {
@@ -165,8 +165,8 @@ private:
CountryStringMap countryStringMap; CountryStringMap countryStringMap;
QString myAppDataPath; QString myAppDataPath;
QMessageBox *waitStartGameMsgBox; MyMessageBox *waitStartGameMsgBox;
QMessageBox *waitRejoinStartGameMsgBox; MyMessageBox *waitRejoinStartGameMsgBox;
myMessageDialogImpl *inviteOnlyInfoMsgBox; myMessageDialogImpl *inviteOnlyInfoMsgBox;
QTimer *waitStartGameMsgBoxTimer; QTimer *waitStartGameMsgBoxTimer;
QTimer *blinkingButtonAnimationTimer; QTimer *blinkingButtonAnimationTimer;
+1 -1
View File
@@ -3694,7 +3694,7 @@ void gameTableImpl::closeGameTable()
if (myStartWindow->getMyServerGuiInterface() && myStartWindow->getMyServerGuiInterface()->getSession()->isNetworkServerRunning()) { if (myStartWindow->getMyServerGuiInterface() && myStartWindow->getMyServerGuiInterface()->getSession()->isNetworkServerRunning()) {
QMessageBox msgBox(QMessageBox::Warning, tr("Closing PokerTH during network game"), MyMessageBox msgBox(QMessageBox::Warning, tr("Closing PokerTH during network game"),
tr("You are the hosting server. Do you want to close PokerTH anyway?"), QMessageBox::Yes | QMessageBox::No, this); tr("You are the hosting server. Do you want to close PokerTH anyway?"), QMessageBox::Yes | QMessageBox::No, this);
if (msgBox.exec() == QMessageBox::Yes ) { if (msgBox.exec() == QMessageBox::Yes ) {
+1 -1
View File
@@ -440,7 +440,7 @@ void MyAvatarLabel::reportBadAvatar()
if(!avatar.isEmpty()) { if(!avatar.isEmpty()) {
QString nick = QString::fromUtf8((*it_c)->getMyName().c_str()); QString nick = QString::fromUtf8((*it_c)->getMyName().c_str());
int ret = QMessageBox::question(this, tr("PokerTH - Question"), int ret = MyMessageBox::question(this, tr("PokerTH - Question"),
tr("Are you sure you want to report the avatar of \"%1\" as inappropriate?").arg(nick), QMessageBox::Yes | QMessageBox::No); tr("Are you sure you want to report the avatar of \"%1\" as inappropriate?").arg(nick), QMessageBox::Yes | QMessageBox::No);
if(ret == QMessageBox::Yes) { if(ret == QMessageBox::Yes) {
@@ -17,6 +17,7 @@
*****************************************************************************/ *****************************************************************************/
#include "joinnetworkgamedialogimpl.h" #include "joinnetworkgamedialogimpl.h"
#include "session.h" #include "session.h"
#include "mymessagebox.h"
#include "configfile.h" #include "configfile.h"
#include <tinyxml.h> #include <tinyxml.h>
#include <net/socket_startup.h> #include <net/socket_startup.h>
@@ -118,7 +119,7 @@ void joinNetworkGameDialogImpl::fillServerProfileList()
TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString()); TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString());
if(!doc.LoadFile()) { if(!doc.LoadFile()) {
QMessageBox::warning(this, tr("Load Server-Profile-File Error"), MyMessageBox::warning(this, tr("Load Server-Profile-File Error"),
tr("Could not load server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()), tr("Could not load server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()),
QMessageBox::Close); QMessageBox::Close);
} }
@@ -169,7 +170,7 @@ void joinNetworkGameDialogImpl::itemFillForm (QTreeWidgetItem* item, int /*colum
TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString()); TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString());
if(!doc.LoadFile()) { if(!doc.LoadFile()) {
QMessageBox::warning(this, tr("Load Server-Profile-File Error"), MyMessageBox::warning(this, tr("Load Server-Profile-File Error"),
tr("Could not load server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()), tr("Could not load server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()),
QMessageBox::Close); QMessageBox::Close);
} }
@@ -196,7 +197,7 @@ void joinNetworkGameDialogImpl::saveServerProfile()
TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString()); TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString());
if(!doc.LoadFile()) { if(!doc.LoadFile()) {
QMessageBox::warning(this, tr("Load Server-Profile-File Error"), MyMessageBox::warning(this, tr("Load Server-Profile-File Error"),
tr("Could not load server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()), tr("Could not load server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()),
QMessageBox::Close); QMessageBox::Close);
} }
@@ -209,7 +210,7 @@ void joinNetworkGameDialogImpl::saveServerProfile()
if( testProfile ) { if( testProfile ) {
// Wenn der Name schon existiert --> Überschreiben? // Wenn der Name schon existiert --> Überschreiben?
QMessageBox msgBox(QMessageBox::Warning, tr("Save Server Profile Error"), MyMessageBox msgBox(QMessageBox::Warning, tr("Save Server Profile Error"),
QString(tr("A profile with the name: %1 already exists.\nWould you like to overwrite ?")).arg(lineEdit_profileName->text()), QMessageBox::Yes | QMessageBox::No, this); QString(tr("A profile with the name: %1 already exists.\nWould you like to overwrite ?")).arg(lineEdit_profileName->text()), QMessageBox::Yes | QMessageBox::No, this);
switch (msgBox.exec()) { switch (msgBox.exec()) {
@@ -247,13 +248,13 @@ void joinNetworkGameDialogImpl::saveServerProfile()
} }
} else { } else {
QMessageBox::warning(this, tr("Read Server-Profile List Error"), MyMessageBox::warning(this, tr("Read Server-Profile List Error"),
tr("Could not read server-profiles list"), tr("Could not read server-profiles list"),
QMessageBox::Close); QMessageBox::Close);
} }
if(!doc.SaveFile()) { if(!doc.SaveFile()) {
QMessageBox::warning(this, tr("Save Server-Profile-File Error"), MyMessageBox::warning(this, tr("Save Server-Profile-File Error"),
tr("Could not save server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()), tr("Could not save server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()),
QMessageBox::Close); QMessageBox::Close);
} }
@@ -266,7 +267,7 @@ void joinNetworkGameDialogImpl::deleteServerProfile()
TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString()); TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString());
if(!doc.LoadFile()) { if(!doc.LoadFile()) {
QMessageBox::warning(this, tr("Load Server-Profile-File Error"), MyMessageBox::warning(this, tr("Load Server-Profile-File Error"),
tr("Could not load server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()), tr("Could not load server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()),
QMessageBox::Close); QMessageBox::Close);
} else { } else {
@@ -279,7 +280,7 @@ void joinNetworkGameDialogImpl::deleteServerProfile()
} }
if(!doc.SaveFile()) { if(!doc.SaveFile()) {
QMessageBox::warning(this, tr("Save Server-Profile-File Error"), MyMessageBox::warning(this, tr("Save Server-Profile-File Error"),
tr("Could not save server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()), tr("Could not save server-profiles-file:\n"+QString::fromUtf8(myServerProfilesFile.c_str()).toAscii()),
QMessageBox::Close); QMessageBox::Close);
} }
+23 -12
View File
@@ -1,22 +1,24 @@
#include "mymessagebox.h" #include "mymessagebox.h"
#include <QMessageBox> #include <QMessageBox>
MyMessageBox::MyMessageBox(QWidget *parent) MyMessageBox::MyMessageBox(QWidget *parent) :
QMessageBox(parent)
{ {
QMessageBox box(parent); #ifdef ANDROID
box.setWindowModality(Qt::WindowModal); this->setWindowModality(Qt::WindowModal);
box.setWindowFlags(Qt::ToolTip); this->setWindowFlags(Qt::ToolTip);
box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }"); this->setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
box.exec(); #endif
} }
MyMessageBox::MyMessageBox(Icon icon, const QString &title, const QString &text, QFlags<QMessageBox::StandardButton> buttons, QWidget *parent, Qt::WindowFlags flags) MyMessageBox::MyMessageBox(Icon icon, const QString &title, const QString &text, QFlags<QMessageBox::StandardButton> buttons, QWidget *parent, Qt::WindowFlags flags) :
QMessageBox(icon, title, text, buttons, parent, flags)
{ {
QMessageBox box(icon, title, text, buttons, parent, flags); #ifdef ANDROID
box.setWindowModality(Qt::WindowModal); this->setWindowModality(Qt::WindowModal);
box.setWindowFlags(Qt::ToolTip); this->setWindowFlags(Qt::ToolTip);
box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }"); this->setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
box.exec(); #endif
} }
MyMessageBox::~MyMessageBox() MyMessageBox::~MyMessageBox()
@@ -27,9 +29,11 @@ MyMessageBox::~MyMessageBox()
QMessageBox::StandardButton MyMessageBox::information(QWidget *parent, const QString &title, const QString &text, QFlags<QMessageBox::StandardButton> buttons, QMessageBox::StandardButton defaultButton) QMessageBox::StandardButton MyMessageBox::information(QWidget *parent, const QString &title, const QString &text, QFlags<QMessageBox::StandardButton> buttons, QMessageBox::StandardButton defaultButton)
{ {
QMessageBox box(QMessageBox::Information, title, text, buttons, parent); QMessageBox box(QMessageBox::Information, title, text, buttons, parent);
#ifdef ANDROID
box.setWindowModality(Qt::WindowModal); box.setWindowModality(Qt::WindowModal);
box.setWindowFlags(Qt::ToolTip); box.setWindowFlags(Qt::ToolTip);
box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }"); box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
#endif
box.setDefaultButton(defaultButton); box.setDefaultButton(defaultButton);
return static_cast<QMessageBox::StandardButton>(box.exec()); return static_cast<QMessageBox::StandardButton>(box.exec());
} }
@@ -37,9 +41,11 @@ QMessageBox::StandardButton MyMessageBox::information(QWidget *parent, const QSt
QMessageBox::StandardButton MyMessageBox::question(QWidget *parent, const QString &title, const QString &text, QFlags<QMessageBox::StandardButton> buttons, QMessageBox::StandardButton defaultButton) QMessageBox::StandardButton MyMessageBox::question(QWidget *parent, const QString &title, const QString &text, QFlags<QMessageBox::StandardButton> buttons, QMessageBox::StandardButton defaultButton)
{ {
QMessageBox box(QMessageBox::Question, title, text, buttons, parent); QMessageBox box(QMessageBox::Question, title, text, buttons, parent);
#ifdef ANDROID
box.setWindowModality(Qt::WindowModal); box.setWindowModality(Qt::WindowModal);
box.setWindowFlags(Qt::ToolTip); box.setWindowFlags(Qt::ToolTip);
box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }"); box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
#endif
box.setDefaultButton(defaultButton); box.setDefaultButton(defaultButton);
return static_cast<QMessageBox::StandardButton>(box.exec()); return static_cast<QMessageBox::StandardButton>(box.exec());
} }
@@ -47,9 +53,11 @@ QMessageBox::StandardButton MyMessageBox::question(QWidget *parent, const QStrin
QMessageBox::StandardButton MyMessageBox::warning(QWidget *parent, const QString &title, const QString &text, QFlags<QMessageBox::StandardButton> buttons, QMessageBox::StandardButton defaultButton) QMessageBox::StandardButton MyMessageBox::warning(QWidget *parent, const QString &title, const QString &text, QFlags<QMessageBox::StandardButton> buttons, QMessageBox::StandardButton defaultButton)
{ {
QMessageBox box(QMessageBox::Warning, title, text, buttons, parent); QMessageBox box(QMessageBox::Warning, title, text, buttons, parent);
#ifdef ANDROID
box.setWindowModality(Qt::WindowModal); box.setWindowModality(Qt::WindowModal);
box.setWindowFlags(Qt::ToolTip); box.setWindowFlags(Qt::ToolTip);
box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }"); box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
#endif
box.setDefaultButton(defaultButton); box.setDefaultButton(defaultButton);
return static_cast<QMessageBox::StandardButton>(box.exec()); return static_cast<QMessageBox::StandardButton>(box.exec());
} }
@@ -57,9 +65,12 @@ QMessageBox::StandardButton MyMessageBox::warning(QWidget *parent, const QString
QMessageBox::StandardButton MyMessageBox::critical(QWidget *parent, const QString &title, const QString &text, QFlags<QMessageBox::StandardButton> buttons, QMessageBox::StandardButton defaultButton) QMessageBox::StandardButton MyMessageBox::critical(QWidget *parent, const QString &title, const QString &text, QFlags<QMessageBox::StandardButton> buttons, QMessageBox::StandardButton defaultButton)
{ {
QMessageBox box(QMessageBox::Critical, title, text, buttons, parent); QMessageBox box(QMessageBox::Critical, title, text, buttons, parent);
#ifdef ANDROID
box.setWindowModality(Qt::WindowModal); box.setWindowModality(Qt::WindowModal);
box.setWindowFlags(Qt::ToolTip); box.setWindowFlags(Qt::ToolTip);
box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }"); box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
#endif
box.setDefaultButton(defaultButton); box.setDefaultButton(defaultButton);
return static_cast<QMessageBox::StandardButton>(box.exec()); return static_cast<QMessageBox::StandardButton>(box.exec());
} }
@@ -17,6 +17,7 @@
*****************************************************************************/ *****************************************************************************/
#include "manualblindsorderdialogimpl.h" #include "manualblindsorderdialogimpl.h"
#include "configfile.h" #include "configfile.h"
#include "mymessagebox.h"
#include <iostream> #include <iostream>
@@ -46,7 +47,7 @@ void manualBlindsOrderDialogImpl::addBlindValueToList()
{ {
if(listWidget_blinds->count() == 30) { if(listWidget_blinds->count() == 30) {
QMessageBox::warning(this, tr("Manual Blinds Order"), MyMessageBox::warning(this, tr("Manual Blinds Order"),
tr("You cannot set more than 30 manual blinds."), tr("You cannot set more than 30 manual blinds."),
QMessageBox::Close); QMessageBox::Close);
} else { } else {
@@ -17,6 +17,7 @@
*****************************************************************************/ *****************************************************************************/
#include "selectavatardialogimpl.h" #include "selectavatardialogimpl.h"
#include "myavatarlistitem.h" #include "myavatarlistitem.h"
#include "mymessagebox.h"
#include "configfile.h" #include "configfile.h"
#include <iostream> #include <iostream>
@@ -237,7 +238,7 @@ void selectAvatarDialogImpl::isAccepted()
if(groupBox->isChecked()) { if(groupBox->isChecked()) {
if(myItemList.size() == 0) { if(myItemList.size() == 0) {
QMessageBox::warning(this, tr("Avatar File Error"), MyMessageBox::warning(this, tr("Avatar File Error"),
tr("Please select an avatar from the list!"), tr("Please select an avatar from the list!"),
QMessageBox::Ok); QMessageBox::Ok);
settingsCorrect = FALSE; settingsCorrect = FALSE;
@@ -252,7 +253,7 @@ void selectAvatarDialogImpl::isAccepted()
externalAvatar = lineEdit->text(); externalAvatar = lineEdit->text();
settingsCorrect = TRUE; settingsCorrect = TRUE;
} else { } else {
QMessageBox::warning(this, tr("Avatar File Error"), MyMessageBox::warning(this, tr("Avatar File Error"),
tr("The file size of the chosen picture is too big. (max. 30KB)\n" tr("The file size of the chosen picture is too big. (max. 30KB)\n"
"Please choose a smaller picture!"), "Please choose a smaller picture!"),
QMessageBox::Ok); QMessageBox::Ok);
@@ -261,7 +262,7 @@ void selectAvatarDialogImpl::isAccepted()
} }
} else { } else {
QMessageBox::warning(this, tr("Avatar File Error"), MyMessageBox::warning(this, tr("Avatar File Error"),
tr("The entered avatar picture doesn't exist.\n" tr("The entered avatar picture doesn't exist.\n"
"Please enter an valid picture!"), "Please enter an valid picture!"),
QMessageBox::Ok); QMessageBox::Ok);
@@ -552,7 +552,7 @@ void settingsDialogImpl::isAccepted()
checkSetPlayerNicks.insert(lineEdit_Opponent9Name->text().trimmed()); checkSetPlayerNicks.insert(lineEdit_Opponent9Name->text().trimmed());
if(checkSetPlayerNicks.count() != 10) { if(checkSetPlayerNicks.count() != 10) {
QMessageBox::warning(this, tr("Settings Error"), MyMessageBox::warning(this, tr("Settings Error"),
tr("The opponent names are not unique.\n" tr("The opponent names are not unique.\n"
"Please choose different names for each Opponent!"), "Please choose different names for each Opponent!"),
QMessageBox::Ok); QMessageBox::Ok);
@@ -633,7 +633,7 @@ void settingsDialogImpl::isAccepted()
myConfig->writeConfigString("InternetServerListAddress", lineEdit_InternetServerListAddress->text().toUtf8().constData()); myConfig->writeConfigString("InternetServerListAddress", lineEdit_InternetServerListAddress->text().toUtf8().constData());
} else { } else {
QMessageBox::warning(this, tr("Settings Error"), MyMessageBox::warning(this, tr("Settings Error"),
tr("The entered server list address is not a valid URL.\n" tr("The entered server list address is not a valid URL.\n"
"Please enter a valid server list address!"), "Please enter a valid server list address!"),
QMessageBox::Ok); QMessageBox::Ok);
@@ -695,7 +695,7 @@ void settingsDialogImpl::isAccepted()
if(ownFlipsideFilename.exists() && lineEdit_OwnFlipsideFilename->text() != "") { if(ownFlipsideFilename.exists() && lineEdit_OwnFlipsideFilename->text() != "") {
myConfig->writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toUtf8().constData()); myConfig->writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toUtf8().constData());
} else { } else {
QMessageBox::warning(this, tr("Settings Error"), MyMessageBox::warning(this, tr("Settings Error"),
tr("The entered flipside picture doesn't exist.\n" tr("The entered flipside picture doesn't exist.\n"
"Please enter an valid picture!"), "Please enter an valid picture!"),
QMessageBox::Ok); QMessageBox::Ok);
@@ -755,7 +755,7 @@ void settingsDialogImpl::isAccepted()
if(logDir.exists() && lineEdit_logDir->text() != "") { if(logDir.exists() && lineEdit_logDir->text() != "") {
myConfig->writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData()); myConfig->writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData());
} else { } else {
QMessageBox::warning(this, tr("Settings Error"), MyMessageBox::warning(this, tr("Settings Error"),
tr("The log file directory doesn't exist.\n" tr("The log file directory doesn't exist.\n"
"Please select an valid directory!"), "Please select an valid directory!"),
QMessageBox::Ok); QMessageBox::Ok);
@@ -785,7 +785,7 @@ void settingsDialogImpl::isAccepted()
myConfig->writeBuffer(); myConfig->writeBuffer();
if(languageIsChanged) { if(languageIsChanged) {
QMessageBox::information(this, tr("Language Changed"), MyMessageBox::information(this, tr("Language Changed"),
tr("You have changed application language to %1.\nPlease restart PokerTH to load new language!").arg(comboBox_switchLanguage->itemText(changedLanguageIndex)), tr("You have changed application language to %1.\nPlease restart PokerTH to load new language!").arg(comboBox_switchLanguage->itemText(changedLanguageIndex)),
QMessageBox::Ok); QMessageBox::Ok);
} }
@@ -925,12 +925,12 @@ void settingsDialogImpl::setLogDir()
if(logDir.exists()) { if(logDir.exists()) {
lineEdit_logDir->setText(dir); lineEdit_logDir->setText(dir);
refreshLogFileList(); refreshLogFileList();
QMessageBox::information(this, tr("Settings Information"), MyMessageBox::information(this, tr("Settings Information"),
tr("You have changed the log file directory.\n" tr("You have changed the log file directory.\n"
"Please restart PokerTH to use the new directory for the log files!"), "Please restart PokerTH to use the new directory for the log files!"),
QMessageBox::Ok); QMessageBox::Ok);
} else { } else {
QMessageBox::warning(this, tr("Settings Error"), MyMessageBox::warning(this, tr("Settings Error"),
tr("The log file directory doesn't exist.\n" tr("The log file directory doesn't exist.\n"
"Please select an valid directory!"), "Please select an valid directory!"),
QMessageBox::Ok); QMessageBox::Ok);
@@ -1033,7 +1033,7 @@ void settingsDialogImpl::setFirstSmallBlindMargin()
if(radioButton_manualBlindsOrder->isChecked() && !myManualBlindsList.empty()) { if(radioButton_manualBlindsOrder->isChecked() && !myManualBlindsList.empty()) {
if(spinBox_firstSmallBlind->value() > myManualBlindsList.front()) { if(spinBox_firstSmallBlind->value() > myManualBlindsList.front()) {
QMessageBox::warning(this, tr("Blinds Error"), MyMessageBox::warning(this, tr("Blinds Error"),
tr("The first element in your manual-blinds-list \nis smaller than current first-small-blind!\nThis first-small-blind-value will be set to maximum allowed value."), tr("The first element in your manual-blinds-list \nis smaller than current first-small-blind!\nThis first-small-blind-value will be set to maximum allowed value."),
QMessageBox::Close); QMessageBox::Close);
} }
@@ -1043,7 +1043,7 @@ void settingsDialogImpl::setFirstSmallBlindMargin()
} }
if(radioButton_netManualBlindsOrder->isChecked() && !myNetManualBlindsList.empty()) { if(radioButton_netManualBlindsOrder->isChecked() && !myNetManualBlindsList.empty()) {
if(spinBox_netFirstSmallBlind->value() > myNetManualBlindsList.front()) { if(spinBox_netFirstSmallBlind->value() > myNetManualBlindsList.front()) {
QMessageBox::warning(this, tr("Blinds Error"), MyMessageBox::warning(this, tr("Blinds Error"),
tr("The first element in your manual-blinds-list \nis smaller than current first-small-blind!\nThis first-small-blind-value will be set to maximum allowed value."), tr("The first element in your manual-blinds-list \nis smaller than current first-small-blind!\nThis first-small-blind-value will be set to maximum allowed value."),
QMessageBox::Close); QMessageBox::Close);
} }
@@ -1161,7 +1161,7 @@ void settingsDialogImpl::addGameTableStyle()
} }
if(fileNameAlreadyFound) { if(fileNameAlreadyFound) {
QMessageBox::warning(this, tr("Game Table Style Error"), MyMessageBox::warning(this, tr("Game Table Style Error"),
tr("Selected game table style file is already in the list. \nPlease select another one to add!"), tr("Selected game table style file is already in the list. \nPlease select another one to add!"),
QMessageBox::Ok); QMessageBox::Ok);
} else { } else {
@@ -1184,7 +1184,7 @@ void settingsDialogImpl::addGameTableStyle()
qDebug() << "settings: " << newStyle.getStyleDescription() << newStyle.getState(); qDebug() << "settings: " << newStyle.getStyleDescription() << newStyle.getState();
if(newStyle.getState() != GT_STYLE_OK) newStyle.showErrorMessage(); if(newStyle.getState() != GT_STYLE_OK) newStyle.showErrorMessage();
} else { } else {
QMessageBox::warning(this, tr("Game Table Style File Error"), MyMessageBox::warning(this, tr("Game Table Style File Error"),
tr("Could not load game table style file correctly. \nStyle will not be placed into list!"), tr("Could not load game table style file correctly. \nStyle will not be placed into list!"),
QMessageBox::Ok); QMessageBox::Ok);
} }
@@ -1287,7 +1287,7 @@ void settingsDialogImpl::addCardDeckStyle()
} }
if(fileNameAlreadyFound) { if(fileNameAlreadyFound) {
QMessageBox::warning(this, tr("Card Deck Style Error"), MyMessageBox::warning(this, tr("Card Deck Style Error"),
tr("Selected card deck style file is already in the list. \nPlease select another one to add!"), tr("Selected card deck style file is already in the list. \nPlease select another one to add!"),
QMessageBox::Ok); QMessageBox::Ok);
} else { } else {
@@ -1304,7 +1304,7 @@ void settingsDialogImpl::addCardDeckStyle()
treeWidget_cardDeckStyles->setCurrentItem(newItem); treeWidget_cardDeckStyles->setCurrentItem(newItem);
treeWidget_cardDeckStyles->sortItems(0, Qt::AscendingOrder); treeWidget_cardDeckStyles->sortItems(0, Qt::AscendingOrder);
} else { } else {
QMessageBox::warning(this, tr("Card Deck Style File Error"), MyMessageBox::warning(this, tr("Card Deck Style File Error"),
tr("Could not load card deck style file correctly. \nStyle will not be placed into list!"), tr("Could not load card deck style file correctly. \nStyle will not be placed into list!"),
QMessageBox::Ok); QMessageBox::Ok);
} }
@@ -1373,7 +1373,7 @@ void settingsDialogImpl::deleteLogFile()
if(!selectedItemsList.isEmpty() && !( selectedItemsList.size() == 1 && selectedItemsList.front()->data(0, Qt::UserRole+1).toString() == "current" )) { if(!selectedItemsList.isEmpty() && !( selectedItemsList.size() == 1 && selectedItemsList.front()->data(0, Qt::UserRole+1).toString() == "current" )) {
int ret = QMessageBox::warning(this, tr("PokerTH - Delete log files"), int ret = MyMessageBox::warning(this, tr("PokerTH - Delete log files"),
tr("Do you really want to delete the selected log files?"), tr("Do you really want to delete the selected log files?"),
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
@@ -1382,7 +1382,7 @@ void settingsDialogImpl::deleteLogFile()
if(selectedItemsList.at(i)->data(0, Qt::UserRole+1).toString() != "current") { if(selectedItemsList.at(i)->data(0, Qt::UserRole+1).toString() != "current") {
if(!QFile::remove(selectedItemsList.at(i)->data(0, Qt::UserRole).toString())) { if(!QFile::remove(selectedItemsList.at(i)->data(0, Qt::UserRole).toString())) {
QMessageBox::warning(this, "Remove log file", "PokerTH cannot remove this log file, please verify that you have write access to this file!", QMessageBox::Close ); MyMessageBox::warning(this, "Remove log file", "PokerTH cannot remove this log file, please verify that you have write access to this file!", QMessageBox::Close );
} }
} }
} }
@@ -1454,7 +1454,7 @@ void settingsDialogImpl::showLogFilePreview()
void settingsDialogImpl::resetSettings() void settingsDialogImpl::resetSettings()
{ {
int ret = QMessageBox::warning(this, tr("PokerTH - Settings"), int ret = MyMessageBox::warning(this, tr("PokerTH - Settings"),
tr("Attention: this will delete all your personal settings and close PokerTH!\n" tr("Attention: this will delete all your personal settings and close PokerTH!\n"
"Do you really want to reset factory settings?"), "Do you really want to reset factory settings?"),
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
@@ -159,7 +159,7 @@ void startNetworkGameDialogImpl::kickPlayer()
QString playerName = item->text(0); QString playerName = item->text(0);
if(playerName == QString::fromUtf8(myConfig->readConfigString("MyName").c_str())) { if(playerName == QString::fromUtf8(myConfig->readConfigString("MyName").c_str())) {
{ {
QMessageBox::warning(this, tr("Server Error"), MyMessageBox::warning(this, tr("Server Error"),
tr("You should not kick yourself from this game!"), tr("You should not kick yourself from this game!"),
QMessageBox::Close); QMessageBox::Close);
} }
+59 -58
View File
@@ -29,6 +29,7 @@
#include "newgamedialogimpl.h" #include "newgamedialogimpl.h"
#include "aboutpokerthimpl.h" #include "aboutpokerthimpl.h"
#include "mymessagedialogimpl.h" #include "mymessagedialogimpl.h"
#include "mymessagebox.h"
#include "settingsdialogimpl.h" #include "settingsdialogimpl.h"
#include "selectavatardialogimpl.h" #include "selectavatardialogimpl.h"
#include "joinnetworkgamedialogimpl.h" #include "joinnetworkgamedialogimpl.h"
@@ -409,7 +410,7 @@ void startWindowImpl::callRejoinPossibleDialog(unsigned gameId)
assert(mySession); assert(mySession);
GameInfo info(mySession->getClientGameInfo(gameId));*/ GameInfo info(mySession->getClientGameInfo(gameId));*/
QMessageBox msgBox; MyMessageBox msgBox;
msgBox.setIcon(QMessageBox::Question); msgBox.setIcon(QMessageBox::Question);
msgBox.setWindowTitle("Rejoin possible!"); msgBox.setWindowTitle("Rejoin possible!");
// msgBox.setText(QString("There is an existing session with the game: %1").arg(QString::fromUtf8(info.name.c_str()))); // msgBox.setText(QString("There is an existing session with the game: %1").arg(QString::fromUtf8(info.name.c_str())));
@@ -648,123 +649,123 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
hideTimeoutDialog(); hideTimeoutDialog();
switch (errorID) { switch (errorID) {
case ERR_SOCK_SERVERADDR_NOT_SET: { case ERR_SOCK_SERVERADDR_NOT_SET: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Server address was not set."), tr("Server address was not set."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_INVALID_PORT: { case ERR_SOCK_INVALID_PORT: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("An invalid port was set (ports 0-1023 are not allowed)."), tr("An invalid port was set (ports 0-1023 are not allowed)."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_CREATION_FAILED: { case ERR_SOCK_CREATION_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Could not create a socket for TCP communication."), tr("Could not create a socket for TCP communication."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_SET_ADDR_FAILED: { case ERR_SOCK_SET_ADDR_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Could not set the IP address."), tr("Could not set the IP address."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_SET_PORT_FAILED: { case ERR_SOCK_SET_PORT_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Could not set the port for this type of address."), tr("Could not set the port for this type of address."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_RESOLVE_FAILED: { case ERR_SOCK_RESOLVE_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("The server name could not be resolved."), tr("The server name could not be resolved."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_BIND_FAILED: { case ERR_SOCK_BIND_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Bind failed - please choose a different port."), tr("Bind failed - please choose a different port."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_LISTEN_FAILED: { case ERR_SOCK_LISTEN_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Internal network error: \"listen\" failed."), tr("Internal network error: \"listen\" failed."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_ACCEPT_FAILED: { case ERR_SOCK_ACCEPT_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Server execution was terminated."), tr("Server execution was terminated."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_CONNECT_FAILED: { case ERR_SOCK_CONNECT_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Could not connect to the server."), tr("Could not connect to the server."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_CONNECT_TIMEOUT: { case ERR_SOCK_CONNECT_TIMEOUT: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Connection timed out.\nPlease check the server address.\n\nIf the server is behind a NAT-Router, make sure port forwarding has been set up on server side."), tr("Connection timed out.\nPlease check the server address.\n\nIf the server is behind a NAT-Router, make sure port forwarding has been set up on server side."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_SELECT_FAILED: { case ERR_SOCK_SELECT_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Internal network error: \"select\" failed."), tr("Internal network error: \"select\" failed."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_SEND_FAILED: { case ERR_SOCK_SEND_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Internal network error: \"send\" failed."), tr("Internal network error: \"send\" failed."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_RECV_FAILED: // Sometimes windows reports recv failed on close. case ERR_SOCK_RECV_FAILED: // Sometimes windows reports recv failed on close.
case ERR_SOCK_CONN_RESET: { case ERR_SOCK_CONN_RESET: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("The connection to the server was lost."), tr("The connection to the server was lost."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_CONN_EXISTS: { case ERR_SOCK_CONN_EXISTS: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Internal network error: Duplicate TCP connection."), tr("Internal network error: Duplicate TCP connection."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_INVALID_PACKET: { case ERR_SOCK_INVALID_PACKET: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("An invalid network packet was received.\nPlease make sure that all players use the same version of PokerTH."), tr("An invalid network packet was received.\nPlease make sure that all players use the same version of PokerTH."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_INVALID_STATE: { case ERR_SOCK_INVALID_STATE: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Internal state error.\nPlease make sure that all players use the same version of PokerTH."), tr("Internal state error.\nPlease make sure that all players use the same version of PokerTH."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_INVALID_SERVERLIST_URL: case ERR_SOCK_INVALID_SERVERLIST_URL:
case ERR_SOCK_TRANSFER_INVALID_URL: { case ERR_SOCK_TRANSFER_INVALID_URL: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Invalid server list URL.\nPlease correct the address in the settings."), tr("Invalid server list URL.\nPlease correct the address in the settings."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_INVALID_SERVERLIST_XML: { case ERR_SOCK_INVALID_SERVERLIST_XML: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("The PokerTH internet server list contains invalid data.\nIf you use a custom server list, please make sure its format is correct."), tr("The PokerTH internet server list contains invalid data.\nIf you use a custom server list, please make sure its format is correct."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_UNZIP_FAILED: { case ERR_SOCK_UNZIP_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Could not unzip the PokerTH internet server list."), tr("Could not unzip the PokerTH internet server list."),
QMessageBox::Close); QMessageBox::Close);
} }
@@ -772,19 +773,19 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
case ERR_SOCK_TRANSFER_INIT_FAILED: case ERR_SOCK_TRANSFER_INIT_FAILED:
case ERR_SOCK_TRANSFER_SELECT_FAILED: case ERR_SOCK_TRANSFER_SELECT_FAILED:
case ERR_SOCK_TRANSFER_FAILED: { case ERR_SOCK_TRANSFER_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Could not download the PokerTH internet server list.\nPlease make sure you are directly connected to the internet."), tr("Could not download the PokerTH internet server list.\nPlease make sure you are directly connected to the internet."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_SOCK_TRANSFER_OPEN_FAILED: { case ERR_SOCK_TRANSFER_OPEN_FAILED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Could not open the target file when downloading the server list."), tr("Could not open the target file when downloading the server list."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_VERSION_NOT_SUPPORTED: { case ERR_NET_VERSION_NOT_SUPPORTED: {
QMessageBox msgBox(QMessageBox::Warning, tr("Network Error"), MyMessageBox msgBox(QMessageBox::Warning, tr("Network Error"),
tr("The PokerTH server does not support this version of the game.<br>Please go to <a href=\"http://www.pokerth.net/\" target=\"_blank\">http://www.pokerth.net</a> and download the latest version."), tr("The PokerTH server does not support this version of the game.<br>Please go to <a href=\"http://www.pokerth.net/\" target=\"_blank\">http://www.pokerth.net</a> and download the latest version."),
QMessageBox::Close, this); QMessageBox::Close, this);
msgBox.setTextFormat(Qt::RichText); msgBox.setTextFormat(Qt::RichText);
@@ -792,19 +793,19 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
} }
break; break;
case ERR_NET_SERVER_FULL: { case ERR_NET_SERVER_FULL: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Sorry, this server is already full."), tr("Sorry, this server is already full."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_INVALID_PASSWORD: { case ERR_NET_INVALID_PASSWORD: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Invalid login.\nPlease check your username and password."), tr("Invalid login.\nPlease check your username and password."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_INVALID_PASSWORD_STR: { case ERR_NET_INVALID_PASSWORD_STR: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("The password is too long. Please choose another one."), tr("The password is too long. Please choose another one."),
QMessageBox::Close); QMessageBox::Close);
} }
@@ -820,120 +821,120 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
} }
break; break;
case ERR_NET_INVALID_GAME_NAME: { case ERR_NET_INVALID_GAME_NAME: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("The game name is either too short or too long. Please choose another one."), tr("The game name is either too short or too long. Please choose another one."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_UNKNOWN_GAME: { case ERR_NET_UNKNOWN_GAME: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("The game could not be found."), tr("The game could not be found."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_INVALID_CHAT_TEXT: { case ERR_NET_INVALID_CHAT_TEXT: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("The chat text is invalid."), tr("The chat text is invalid."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_UNKNOWN_PLAYER_ID: { case ERR_NET_UNKNOWN_PLAYER_ID: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("The server referred to an unknown player. Aborting."), tr("The server referred to an unknown player. Aborting."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_NO_CURRENT_PLAYER: { case ERR_NET_NO_CURRENT_PLAYER: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Internal error: The current player could not be found."), tr("Internal error: The current player could not be found."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_PLAYER_NOT_ACTIVE: { case ERR_NET_PLAYER_NOT_ACTIVE: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Internal error: The current player is not active."), tr("Internal error: The current player is not active."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_PLAYER_KICKED: { case ERR_NET_PLAYER_KICKED: {
mySession->terminateNetworkClient(); mySession->terminateNetworkClient();
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("You were kicked from the server."), tr("You were kicked from the server."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_PLAYER_BANNED: { case ERR_NET_PLAYER_BANNED: {
mySession->terminateNetworkClient(); mySession->terminateNetworkClient();
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("You were temporarily banned from the server."), tr("You were temporarily banned from the server."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_PLAYER_BLOCKED: { case ERR_NET_PLAYER_BLOCKED: {
mySession->terminateNetworkClient(); mySession->terminateNetworkClient();
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Your account is blocked indefinitely."), tr("Your account is blocked indefinitely."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_SESSION_TIMED_OUT: { case ERR_NET_SESSION_TIMED_OUT: {
mySession->terminateNetworkClient(); mySession->terminateNetworkClient();
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Your server connection timed out due to inactivity. You are very welcome to reconnect!"), tr("Your server connection timed out due to inactivity. You are very welcome to reconnect!"),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_INVALID_PLAYER_COUNT: { case ERR_NET_INVALID_PLAYER_COUNT: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("The client player count is invalid."), tr("The client player count is invalid."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_TOO_MANY_MANUAL_BLINDS: { case ERR_NET_TOO_MANY_MANUAL_BLINDS: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Too many manual blinds were set. Please reconfigure the manual blinds."), tr("Too many manual blinds were set. Please reconfigure the manual blinds."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_INVALID_AVATAR_FILE: case ERR_NET_INVALID_AVATAR_FILE:
case ERR_NET_WRONG_AVATAR_SIZE: { case ERR_NET_WRONG_AVATAR_SIZE: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("An invalid avatar file was configured. Please choose a different avatar."), tr("An invalid avatar file was configured. Please choose a different avatar."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_AVATAR_TOO_LARGE: { case ERR_NET_AVATAR_TOO_LARGE: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("The selected avatar file is too large. Please choose a different avatar."), tr("The selected avatar file is too large. Please choose a different avatar."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_INIT_BLOCKED: { case ERR_NET_INIT_BLOCKED: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("You cannot login at this time. Please try again in a few seconds."), tr("You cannot login at this time. Please try again in a few seconds."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_INVALID_REQUEST_ID: { case ERR_NET_INVALID_REQUEST_ID: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("An internal avatar error occured. Please report this to an admin in the lobby chat."), tr("An internal avatar error occured. Please report this to an admin in the lobby chat."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_START_TIMEOUT: { case ERR_NET_START_TIMEOUT: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("Could not start game: Synchronization failed."), tr("Could not start game: Synchronization failed."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case ERR_NET_SERVER_MAINTENANCE: { case ERR_NET_SERVER_MAINTENANCE: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("The server is down for maintenance. Please try again later."), tr("The server is down for maintenance. Please try again later."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
default: { default: {
QMessageBox::warning(this, tr("Network Error"), MyMessageBox::warning(this, tr("Network Error"),
tr("An internal error occured."), tr("An internal error occured."),
QMessageBox::Close); QMessageBox::Close);
} }
@@ -952,14 +953,14 @@ void startWindowImpl::networkNotification(int notificationId)
hideTimeoutDialog(); hideTimeoutDialog();
switch (notificationId) { switch (notificationId) {
case NTF_NET_JOIN_IP_BLOCKED: { case NTF_NET_JOIN_IP_BLOCKED: {
QMessageBox::warning(this, tr("Network Notification"), MyMessageBox::warning(this, tr("Network Notification"),
tr("You cannot join this game, because another player in that game has your network address."), tr("You cannot join this game, because another player in that game has your network address."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case NTF_NET_REMOVED_START_FAILED: { case NTF_NET_REMOVED_START_FAILED: {
myGameLobbyDialog->stopWaitStartGameMsgBoxTimer(); myGameLobbyDialog->stopWaitStartGameMsgBoxTimer();
if(QMessageBox::warning(this, tr("Network Notification"), if(MyMessageBox::warning(this, tr("Network Notification"),
tr("Your connection to the server is very slow, the game had to start without you."), tr("Your connection to the server is very slow, the game had to start without you."),
QMessageBox::Close) == QMessageBox::Close) { QMessageBox::Close) == QMessageBox::Close) {
myGameLobbyDialog->hideWaitStartGameMsgBox(); myGameLobbyDialog->hideWaitStartGameMsgBox();
@@ -967,27 +968,27 @@ void startWindowImpl::networkNotification(int notificationId)
} }
break; break;
case NTF_NET_REMOVED_KICKED: { case NTF_NET_REMOVED_KICKED: {
QMessageBox::warning(this, tr("Network Notification"), MyMessageBox::warning(this, tr("Network Notification"),
tr("You were kicked from the game."), tr("You were kicked from the game."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case NTF_NET_REMOVED_GAME_FULL: case NTF_NET_REMOVED_GAME_FULL:
case NTF_NET_JOIN_GAME_FULL: { case NTF_NET_JOIN_GAME_FULL: {
QMessageBox::warning(this, tr("Network Notification"), MyMessageBox::warning(this, tr("Network Notification"),
tr("Sorry, this game is already full."), tr("Sorry, this game is already full."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case NTF_NET_REMOVED_ALREADY_RUNNING: case NTF_NET_REMOVED_ALREADY_RUNNING:
case NTF_NET_JOIN_ALREADY_RUNNING: { case NTF_NET_JOIN_ALREADY_RUNNING: {
QMessageBox::warning(this, tr("Network Notification"), MyMessageBox::warning(this, tr("Network Notification"),
tr("Unable to join - the server has already started the game."), tr("Unable to join - the server has already started the game."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case NTF_NET_JOIN_NOT_INVITED: { case NTF_NET_JOIN_NOT_INVITED: {
QMessageBox::warning(this, tr("Network Notification"), MyMessageBox::warning(this, tr("Network Notification"),
tr("This game is of type invite-only. You cannot join this game without being invited."), tr("This game is of type invite-only. You cannot join this game without being invited."),
QMessageBox::Close); QMessageBox::Close);
} }
@@ -1009,25 +1010,25 @@ void startWindowImpl::networkNotification(int notificationId)
} }
break; break;
case NTF_NET_REMOVED_TIMEOUT: { case NTF_NET_REMOVED_TIMEOUT: {
QMessageBox::warning(this, tr("Network Notification"), MyMessageBox::warning(this, tr("Network Notification"),
tr("Your admin state timed out due to inactivity. Feel free to create a new game!"), tr("Your admin state timed out due to inactivity. Feel free to create a new game!"),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case NTF_NET_JOIN_INVALID_PASSWORD: { case NTF_NET_JOIN_INVALID_PASSWORD: {
QMessageBox::warning(this, tr("Network Notification"), MyMessageBox::warning(this, tr("Network Notification"),
tr("Invalid password when joining the game.\nPlease reenter the password and try again."), tr("Invalid password when joining the game.\nPlease reenter the password and try again."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case NTF_NET_JOIN_GUEST_FORBIDDEN: { case NTF_NET_JOIN_GUEST_FORBIDDEN: {
QMessageBox::warning(this, tr("Network Notification"), MyMessageBox::warning(this, tr("Network Notification"),
tr("You cannot join this type of game as guest."), tr("You cannot join this type of game as guest."),
QMessageBox::Close); QMessageBox::Close);
} }
break; break;
case NTF_NET_JOIN_INVALID_SETTINGS: { case NTF_NET_JOIN_INVALID_SETTINGS: {
QMessageBox::warning(this, tr("Network Notification"), MyMessageBox::warning(this, tr("Network Notification"),
tr("The settings are invalid for this type of game."), tr("The settings are invalid for this type of game."),
QMessageBox::Close); QMessageBox::Close);
} }
@@ -1059,7 +1060,7 @@ void startWindowImpl::networkNotification(int notificationId)
void startWindowImpl::networkMessage(QString msg) void startWindowImpl::networkMessage(QString msg)
{ {
QMessageBox msgBox(QMessageBox::Information, tr("Server Message"), MyMessageBox msgBox(QMessageBox::Information, tr("Server Message"),
msg, QMessageBox::Close, this); msg, QMessageBox::Close, this);
msgBox.setTextFormat(Qt::RichText); msgBox.setTextFormat(Qt::RichText);
msgBox.exec(); msgBox.exec();
@@ -1100,7 +1101,7 @@ void startWindowImpl::networkMessage(unsigned msgId)
break; break;
} }
QMessageBox msgBox(QMessageBox::Information, tr("Server Message"), MyMessageBox msgBox(QMessageBox::Information, tr("Server Message"),
msgText, QMessageBox::Close, this); msgText, QMessageBox::Close, this);
// msgBox.setTextFormat(Qt::RichText); // msgBox.setTextFormat(Qt::RichText);
msgBox.exec(); msgBox.exec();
+2 -1
View File
@@ -29,6 +29,7 @@
#include "game_defs.h" #include "game_defs.h"
#include <QMessageBox> #include <QMessageBox>
#include "mymessagebox.h"
class GuiInterface; class GuiInterface;
class GuiWrapper; class GuiWrapper;
@@ -178,7 +179,7 @@ private:
serverListDialogImpl *myServerListDialog; serverListDialogImpl *myServerListDialog;
internetGameLoginDialogImpl *myInternetGameLoginDialog; internetGameLoginDialogImpl *myInternetGameLoginDialog;
QMessageBox msgBoxOutdatedVersion; MyMessageBox msgBoxOutdatedVersion;
bool msgBoxOutdatedVersionActive; bool msgBoxOutdatedVersionActive;
friend class GuiWrapper; friend class GuiWrapper;
+6 -5
View File
@@ -20,6 +20,7 @@
#include <sstream> #include <sstream>
#include <cstdlib> #include <cstdlib>
#include <fstream> #include <fstream>
#include "mymessagebox.h"
#include "game_defs.h" #include "game_defs.h"
using namespace std; using namespace std;
@@ -67,7 +68,7 @@ void CardDeckStyleReader::readStyleFile(QString file)
TiXmlElement *GameTableElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "TableStyle" ).ToElement(); TiXmlElement *GameTableElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "TableStyle" ).ToElement();
if(GameTableElement) { if(GameTableElement) {
QMessageBox::warning(myW, tr("Card Deck Style Error"), MyMessageBox::warning(myW, tr("Card Deck Style Error"),
tr("A game table style was selected instead of a card deck style.\nPlease select a card deck style and try again!"), tr("A game table style was selected instead of a card deck style.\nPlease select a card deck style and try again!"),
QMessageBox::Ok); QMessageBox::Ok);
} else { } else {
@@ -138,7 +139,7 @@ void CardDeckStyleReader::readStyleFile(QString file)
if(PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() != POKERTH_CD_STYLE_FILE_VERSION) { if(PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() != POKERTH_CD_STYLE_FILE_VERSION) {
QString EMail; QString EMail;
if(StyleMaintainerEMail != "NULL") EMail = StyleMaintainerEMail; if(StyleMaintainerEMail != "NULL") EMail = StyleMaintainerEMail;
QMessageBox::warning(myW, tr("Card Deck Style Error"), MyMessageBox::warning(myW, tr("Card Deck Style Error"),
tr("Selected card deck style \"%1\" seems to be outdated. \n The current PokerTH card deck style version is \"%2\", but this style has version \"%3\" set. \n\nPlease contact the card deck style builder %4.").arg(StyleDescription).arg(POKERTH_CD_STYLE_FILE_VERSION).arg(PokerTHStyleFileVersion).arg(EMail), tr("Selected card deck style \"%1\" seems to be outdated. \n The current PokerTH card deck style version is \"%2\", but this style has version \"%3\" set. \n\nPlease contact the card deck style builder %4.").arg(StyleDescription).arg(POKERTH_CD_STYLE_FILE_VERSION).arg(PokerTHStyleFileVersion).arg(EMail),
QMessageBox::Ok); QMessageBox::Ok);
} }
@@ -146,7 +147,7 @@ void CardDeckStyleReader::readStyleFile(QString file)
} }
} else { } else {
loadedSuccessfull = 0; loadedSuccessfull = 0;
QMessageBox::warning(myW, tr("Card Deck Style Error"), MyMessageBox::warning(myW, tr("Card Deck Style Error"),
tr("Cannot load card deck style file: %1 \n\nPlease check the style file or choose another style!").arg(currentFileName), tr("Cannot load card deck style file: %1 \n\nPlease check the style file or choose another style!").arg(currentFileName),
QMessageBox::Ok); QMessageBox::Ok);
} }
@@ -159,7 +160,7 @@ void CardDeckStyleReader::showLeftItemsErrorMessage(QString style, QStringList f
QString EMail; QString EMail;
if(email != "NULL") EMail = email; if(email != "NULL") EMail = email;
QMessageBox::warning(myW, tr("Card Deck Style Error"), MyMessageBox::warning(myW, tr("Card Deck Style Error"),
tr("Selected card deck style \"%1\" seems to be incomplete or defective. \n\nThe value(s) of \"%2\" is/are missing. \n\nPlease contact the card deck style builder %3.").arg(style).arg(items).arg(EMail), tr("Selected card deck style \"%1\" seems to be incomplete or defective. \n\nThe value(s) of \"%2\" is/are missing. \n\nPlease contact the card deck style builder %3.").arg(style).arg(items).arg(EMail),
QMessageBox::Ok); QMessageBox::Ok);
} }
@@ -170,7 +171,7 @@ void CardDeckStyleReader::showCardsLeftErrorMessage(QString style, QStringList f
QString EMail; QString EMail;
if(email != "NULL") EMail = email; if(email != "NULL") EMail = email;
QMessageBox::warning(myW, tr("Card Deck Style Error"), MyMessageBox::warning(myW, tr("Card Deck Style Error"),
tr("Selected card deck style \"%1\" seems to be incomplete or defective. \nThe card picture(s) \"%2\" is/are not available. \n\nPlease contact the card deck style builder %3.").arg(style).arg(items).arg(EMail), tr("Selected card deck style \"%1\" seems to be incomplete or defective. \nThe card picture(s) \"%2\" is/are not available. \n\nPlease contact the card deck style builder %3.").arg(style).arg(items).arg(EMail),
QMessageBox::Ok); QMessageBox::Ok);
} }
+3 -3
View File
@@ -102,7 +102,7 @@ void GameTableStyleReader::readStyleFile(QString file)
TiXmlElement *CardDeckElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "CardDeck" ).ToElement(); TiXmlElement *CardDeckElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "CardDeck" ).ToElement();
if(CardDeckElement) { if(CardDeckElement) {
QMessageBox::warning(myW, tr("Game Table Style Error"), MyMessageBox::warning(myW, tr("Game Table Style Error"),
tr("A card deck style was selected instead of a game table style.\nPlease select a game table style and try again!"), tr("A card deck style was selected instead of a game table style.\nPlease select a game table style and try again!"),
QMessageBox::Ok); QMessageBox::Ok);
} else { } else {
@@ -1228,7 +1228,7 @@ void GameTableStyleReader::readStyleFile(QString file)
} }
} else { } else {
loadedSuccessfull = 0; loadedSuccessfull = 0;
QMessageBox::warning(myW, tr("Game Table Style Error"), MyMessageBox::warning(myW, tr("Game Table Style Error"),
tr("Cannot load game table style file: %1 \n\nPlease check the style file or choose another style!").arg(currentFileName), tr("Cannot load game table style file: %1 \n\nPlease check the style file or choose another style!").arg(currentFileName),
QMessageBox::Ok); QMessageBox::Ok);
} }
@@ -1647,7 +1647,7 @@ QString GameTableStyleReader::getFallBackFieldContent(QString field, int type)
TiXmlElement *CardDeckElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "CardDeck" ).ToElement(); TiXmlElement *CardDeckElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "CardDeck" ).ToElement();
if(CardDeckElement) { if(CardDeckElement) {
QMessageBox::warning(myW, tr("Game Table Style Error"), MyMessageBox::warning(myW, tr("Game Table Style Error"),
tr("A card deck style was selected instead of a game table style.\nPlease select a game table style and try again!"), tr("A card deck style was selected instead of a game table style.\nPlease select a game table style and try again!"),
QMessageBox::Ok); QMessageBox::Ok);
} else { } else {
@@ -26,7 +26,11 @@ timeoutMsgBoxImpl::timeoutMsgBoxImpl(QMainWindow *parent)
this->setWindowTitle(tr("Timeout Warning")); this->setWindowTitle(tr("Timeout Warning"));
this->setIcon(QMessageBox::Warning); this->setIcon(QMessageBox::Warning);
this->setInformativeText(tr("Please click \"OK\" to stop the countdown!")); this->setInformativeText(tr("Please click \"OK\" to stop the countdown!"));
#ifdef ANDROID
this->setWindowModality(Qt::WindowModal);
this->setWindowFlags(Qt::ToolTip);
this->setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
#endif
timeOutTimer = new QTimer; timeOutTimer = new QTimer;
connect(timeOutTimer, SIGNAL(timeout()), this, SLOT(timerRefresh())); connect(timeOutTimer, SIGNAL(timeout()), this, SLOT(timerRefresh()));