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
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#include "changecompleteblindsdialogimpl.h"
#include "mymessagebox.h"
#include "configfile.h"
#include <iostream>
@@ -51,7 +52,7 @@ void changeCompleteBlindsDialogImpl::addBlindValueToList()
{
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."),
QMessageBox::Close);
} else {
@@ -44,7 +44,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
//wait start game message
waitStartGameMsgBox = new QMessageBox(this);
waitStartGameMsgBox = new MyMessageBox(this);
waitStartGameMsgBox->setText(tr("Starting game. Please wait ..."));
waitStartGameMsgBox->setWindowModality(Qt::NonModal);
#ifdef __APPLE__
@@ -53,7 +53,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
waitStartGameMsgBox->setStandardButtons(QMessageBox::NoButton);
//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->setWindowModality(Qt::NonModal);
#ifdef __APPLE__
@@ -1256,7 +1256,7 @@ void gameLobbyDialogImpl::kickPlayer()
QString playerName = item->text(0);
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!"),
QMessageBox::Close);
}
@@ -2050,7 +2050,7 @@ void gameLobbyDialogImpl::reportBadGameName()
unsigned gameId = selection->selectedRows().first().data(Qt::UserRole).toUInt();
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);
if(ret == QMessageBox::Yes) {
@@ -165,8 +165,8 @@ private:
CountryStringMap countryStringMap;
QString myAppDataPath;
QMessageBox *waitStartGameMsgBox;
QMessageBox *waitRejoinStartGameMsgBox;
MyMessageBox *waitStartGameMsgBox;
MyMessageBox *waitRejoinStartGameMsgBox;
myMessageDialogImpl *inviteOnlyInfoMsgBox;
QTimer *waitStartGameMsgBoxTimer;
QTimer *blinkingButtonAnimationTimer;
+1 -1
View File
@@ -3694,7 +3694,7 @@ void gameTableImpl::closeGameTable()
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);
if (msgBox.exec() == QMessageBox::Yes ) {
+1 -1
View File
@@ -440,7 +440,7 @@ void MyAvatarLabel::reportBadAvatar()
if(!avatar.isEmpty()) {
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);
if(ret == QMessageBox::Yes) {
@@ -17,6 +17,7 @@
*****************************************************************************/
#include "joinnetworkgamedialogimpl.h"
#include "session.h"
#include "mymessagebox.h"
#include "configfile.h"
#include <tinyxml.h>
#include <net/socket_startup.h>
@@ -118,7 +119,7 @@ void joinNetworkGameDialogImpl::fillServerProfileList()
TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString());
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()),
QMessageBox::Close);
}
@@ -169,7 +170,7 @@ void joinNetworkGameDialogImpl::itemFillForm (QTreeWidgetItem* item, int /*colum
TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString());
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()),
QMessageBox::Close);
}
@@ -196,7 +197,7 @@ void joinNetworkGameDialogImpl::saveServerProfile()
TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString());
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()),
QMessageBox::Close);
}
@@ -209,7 +210,7 @@ void joinNetworkGameDialogImpl::saveServerProfile()
if( testProfile ) {
// 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);
switch (msgBox.exec()) {
@@ -247,13 +248,13 @@ void joinNetworkGameDialogImpl::saveServerProfile()
}
} 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"),
QMessageBox::Close);
}
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()),
QMessageBox::Close);
}
@@ -266,7 +267,7 @@ void joinNetworkGameDialogImpl::deleteServerProfile()
TiXmlDocument doc(QString::fromUtf8(myServerProfilesFile.c_str()).toStdString());
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()),
QMessageBox::Close);
} else {
@@ -279,7 +280,7 @@ void joinNetworkGameDialogImpl::deleteServerProfile()
}
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()),
QMessageBox::Close);
}
+23 -12
View File
@@ -1,22 +1,24 @@
#include "mymessagebox.h"
#include <QMessageBox>
MyMessageBox::MyMessageBox(QWidget *parent)
MyMessageBox::MyMessageBox(QWidget *parent) :
QMessageBox(parent)
{
QMessageBox box(parent);
box.setWindowModality(Qt::WindowModal);
box.setWindowFlags(Qt::ToolTip);
box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
box.exec();
#ifdef ANDROID
this->setWindowModality(Qt::WindowModal);
this->setWindowFlags(Qt::ToolTip);
this->setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
#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);
box.setWindowModality(Qt::WindowModal);
box.setWindowFlags(Qt::ToolTip);
box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
box.exec();
#ifdef ANDROID
this->setWindowModality(Qt::WindowModal);
this->setWindowFlags(Qt::ToolTip);
this->setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
#endif
}
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 box(QMessageBox::Information, title, text, buttons, parent);
#ifdef ANDROID
box.setWindowModality(Qt::WindowModal);
box.setWindowFlags(Qt::ToolTip);
box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
#endif
box.setDefaultButton(defaultButton);
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 box(QMessageBox::Question, title, text, buttons, parent);
#ifdef ANDROID
box.setWindowModality(Qt::WindowModal);
box.setWindowFlags(Qt::ToolTip);
box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
#endif
box.setDefaultButton(defaultButton);
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 box(QMessageBox::Warning, title, text, buttons, parent);
#ifdef ANDROID
box.setWindowModality(Qt::WindowModal);
box.setWindowFlags(Qt::ToolTip);
box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
#endif
box.setDefaultButton(defaultButton);
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 box(QMessageBox::Critical, title, text, buttons, parent);
#ifdef ANDROID
box.setWindowModality(Qt::WindowModal);
box.setWindowFlags(Qt::ToolTip);
box.setStyleSheet("QDialog{ border: 1px solid black; border-style: solid; border-radius: 4px; }");
#endif
box.setDefaultButton(defaultButton);
return static_cast<QMessageBox::StandardButton>(box.exec());
}
@@ -17,6 +17,7 @@
*****************************************************************************/
#include "manualblindsorderdialogimpl.h"
#include "configfile.h"
#include "mymessagebox.h"
#include <iostream>
@@ -46,7 +47,7 @@ void manualBlindsOrderDialogImpl::addBlindValueToList()
{
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."),
QMessageBox::Close);
} else {
@@ -17,6 +17,7 @@
*****************************************************************************/
#include "selectavatardialogimpl.h"
#include "myavatarlistitem.h"
#include "mymessagebox.h"
#include "configfile.h"
#include <iostream>
@@ -237,7 +238,7 @@ void selectAvatarDialogImpl::isAccepted()
if(groupBox->isChecked()) {
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!"),
QMessageBox::Ok);
settingsCorrect = FALSE;
@@ -252,7 +253,7 @@ void selectAvatarDialogImpl::isAccepted()
externalAvatar = lineEdit->text();
settingsCorrect = TRUE;
} 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"
"Please choose a smaller picture!"),
QMessageBox::Ok);
@@ -261,7 +262,7 @@ void selectAvatarDialogImpl::isAccepted()
}
} else {
QMessageBox::warning(this, tr("Avatar File Error"),
MyMessageBox::warning(this, tr("Avatar File Error"),
tr("The entered avatar picture doesn't exist.\n"
"Please enter an valid picture!"),
QMessageBox::Ok);
@@ -552,7 +552,7 @@ void settingsDialogImpl::isAccepted()
checkSetPlayerNicks.insert(lineEdit_Opponent9Name->text().trimmed());
if(checkSetPlayerNicks.count() != 10) {
QMessageBox::warning(this, tr("Settings Error"),
MyMessageBox::warning(this, tr("Settings Error"),
tr("The opponent names are not unique.\n"
"Please choose different names for each Opponent!"),
QMessageBox::Ok);
@@ -633,7 +633,7 @@ void settingsDialogImpl::isAccepted()
myConfig->writeConfigString("InternetServerListAddress", lineEdit_InternetServerListAddress->text().toUtf8().constData());
} 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"
"Please enter a valid server list address!"),
QMessageBox::Ok);
@@ -695,7 +695,7 @@ void settingsDialogImpl::isAccepted()
if(ownFlipsideFilename.exists() && lineEdit_OwnFlipsideFilename->text() != "") {
myConfig->writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toUtf8().constData());
} else {
QMessageBox::warning(this, tr("Settings Error"),
MyMessageBox::warning(this, tr("Settings Error"),
tr("The entered flipside picture doesn't exist.\n"
"Please enter an valid picture!"),
QMessageBox::Ok);
@@ -755,7 +755,7 @@ void settingsDialogImpl::isAccepted()
if(logDir.exists() && lineEdit_logDir->text() != "") {
myConfig->writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData());
} else {
QMessageBox::warning(this, tr("Settings Error"),
MyMessageBox::warning(this, tr("Settings Error"),
tr("The log file directory doesn't exist.\n"
"Please select an valid directory!"),
QMessageBox::Ok);
@@ -785,7 +785,7 @@ void settingsDialogImpl::isAccepted()
myConfig->writeBuffer();
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)),
QMessageBox::Ok);
}
@@ -925,12 +925,12 @@ void settingsDialogImpl::setLogDir()
if(logDir.exists()) {
lineEdit_logDir->setText(dir);
refreshLogFileList();
QMessageBox::information(this, tr("Settings Information"),
MyMessageBox::information(this, tr("Settings Information"),
tr("You have changed the log file directory.\n"
"Please restart PokerTH to use the new directory for the log files!"),
QMessageBox::Ok);
} else {
QMessageBox::warning(this, tr("Settings Error"),
MyMessageBox::warning(this, tr("Settings Error"),
tr("The log file directory doesn't exist.\n"
"Please select an valid directory!"),
QMessageBox::Ok);
@@ -1033,7 +1033,7 @@ void settingsDialogImpl::setFirstSmallBlindMargin()
if(radioButton_manualBlindsOrder->isChecked() && !myManualBlindsList.empty()) {
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."),
QMessageBox::Close);
}
@@ -1043,7 +1043,7 @@ void settingsDialogImpl::setFirstSmallBlindMargin()
}
if(radioButton_netManualBlindsOrder->isChecked() && !myNetManualBlindsList.empty()) {
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."),
QMessageBox::Close);
}
@@ -1161,7 +1161,7 @@ void settingsDialogImpl::addGameTableStyle()
}
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!"),
QMessageBox::Ok);
} else {
@@ -1184,7 +1184,7 @@ void settingsDialogImpl::addGameTableStyle()
qDebug() << "settings: " << newStyle.getStyleDescription() << newStyle.getState();
if(newStyle.getState() != GT_STYLE_OK) newStyle.showErrorMessage();
} 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!"),
QMessageBox::Ok);
}
@@ -1287,7 +1287,7 @@ void settingsDialogImpl::addCardDeckStyle()
}
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!"),
QMessageBox::Ok);
} else {
@@ -1304,7 +1304,7 @@ void settingsDialogImpl::addCardDeckStyle()
treeWidget_cardDeckStyles->setCurrentItem(newItem);
treeWidget_cardDeckStyles->sortItems(0, Qt::AscendingOrder);
} 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!"),
QMessageBox::Ok);
}
@@ -1373,7 +1373,7 @@ void settingsDialogImpl::deleteLogFile()
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?"),
QMessageBox::Yes | QMessageBox::No);
@@ -1382,7 +1382,7 @@ void settingsDialogImpl::deleteLogFile()
if(selectedItemsList.at(i)->data(0, Qt::UserRole+1).toString() != "current") {
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()
{
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"
"Do you really want to reset factory settings?"),
QMessageBox::Yes | QMessageBox::No);
@@ -159,7 +159,7 @@ void startNetworkGameDialogImpl::kickPlayer()
QString playerName = item->text(0);
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!"),
QMessageBox::Close);
}
+63 -62
View File
@@ -29,6 +29,7 @@
#include "newgamedialogimpl.h"
#include "aboutpokerthimpl.h"
#include "mymessagedialogimpl.h"
#include "mymessagebox.h"
#include "settingsdialogimpl.h"
#include "selectavatardialogimpl.h"
#include "joinnetworkgamedialogimpl.h"
@@ -409,7 +410,7 @@ void startWindowImpl::callRejoinPossibleDialog(unsigned gameId)
assert(mySession);
GameInfo info(mySession->getClientGameInfo(gameId));*/
QMessageBox msgBox;
MyMessageBox msgBox;
msgBox.setIcon(QMessageBox::Question);
msgBox.setWindowTitle("Rejoin possible!");
// 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();
switch (errorID) {
case ERR_SOCK_SERVERADDR_NOT_SET: {
QMessageBox::warning(this, tr("Network Error"),
MyMessageBox::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"),
MyMessageBox::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"),
MyMessageBox::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"),
MyMessageBox::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"),
MyMessageBox::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);
MyMessageBox::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"),
MyMessageBox::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"),
MyMessageBox::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"),
MyMessageBox::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);
MyMessageBox::warning(this, tr("Network Error"),
tr("Could not connect to the server."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
case ERR_SOCK_SELECT_FAILED: {
QMessageBox::warning(this, tr("Network Error"),
MyMessageBox::warning(this, tr("Network Error"),
tr("Internal network error: \"select\" failed."),
QMessageBox::Close);
}
break;
case ERR_SOCK_SEND_FAILED: {
QMessageBox::warning(this, tr("Network Error"),
MyMessageBox::warning(this, tr("Network Error"),
tr("Internal network error: \"send\" failed."),
QMessageBox::Close);
}
break;
case ERR_SOCK_RECV_FAILED: // Sometimes windows reports recv failed on close.
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."),
QMessageBox::Close);
}
break;
case ERR_SOCK_CONN_EXISTS: {
QMessageBox::warning(this, tr("Network Error"),
MyMessageBox::warning(this, tr("Network Error"),
tr("Internal network error: Duplicate TCP connection."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
case ERR_SOCK_INVALID_SERVERLIST_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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
@@ -772,19 +773,19 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
case ERR_SOCK_TRANSFER_INIT_FAILED:
case ERR_SOCK_TRANSFER_SELECT_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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close, this);
msgBox.setTextFormat(Qt::RichText);
@@ -792,19 +793,19 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
}
break;
case ERR_NET_SERVER_FULL: {
QMessageBox::warning(this, tr("Network Error"),
MyMessageBox::warning(this, tr("Network Error"),
tr("Sorry, this server is already full."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
@@ -820,120 +821,120 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
}
break;
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."),
QMessageBox::Close);
}
break;
case ERR_NET_UNKNOWN_GAME: {
QMessageBox::warning(this, tr("Network Error"),
MyMessageBox::warning(this, tr("Network Error"),
tr("The game could not be found."),
QMessageBox::Close);
}
break;
case ERR_NET_INVALID_CHAT_TEXT: {
QMessageBox::warning(this, tr("Network Error"),
MyMessageBox::warning(this, tr("Network Error"),
tr("The chat text is invalid."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
case ERR_NET_PLAYER_KICKED: {
mySession->terminateNetworkClient();
QMessageBox::warning(this, tr("Network Error"),
MyMessageBox::warning(this, tr("Network Error"),
tr("You were kicked from the server."),
QMessageBox::Close);
}
break;
case ERR_NET_PLAYER_BANNED: {
mySession->terminateNetworkClient();
QMessageBox::warning(this, tr("Network Error"),
MyMessageBox::warning(this, tr("Network Error"),
tr("You were temporarily banned from the server."),
QMessageBox::Close);
}
break;
case ERR_NET_PLAYER_BLOCKED: {
mySession->terminateNetworkClient();
QMessageBox::warning(this, tr("Network Error"),
MyMessageBox::warning(this, tr("Network Error"),
tr("Your account is blocked indefinitely."),
QMessageBox::Close);
}
break;
case ERR_NET_SESSION_TIMED_OUT: {
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!"),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
case ERR_NET_INVALID_AVATAR_FILE:
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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
case ERR_NET_START_TIMEOUT: {
QMessageBox::warning(this, tr("Network Error"),
MyMessageBox::warning(this, tr("Network Error"),
tr("Could not start game: Synchronization failed."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
default: {
QMessageBox::warning(this, tr("Network Error"),
MyMessageBox::warning(this, tr("Network Error"),
tr("An internal error occured."),
QMessageBox::Close);
}
@@ -952,14 +953,14 @@ void startWindowImpl::networkNotification(int notificationId)
hideTimeoutDialog();
switch (notificationId) {
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."),
QMessageBox::Close);
}
break;
case NTF_NET_REMOVED_START_FAILED: {
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."),
QMessageBox::Close) == QMessageBox::Close) {
myGameLobbyDialog->hideWaitStartGameMsgBox();
@@ -967,27 +968,27 @@ void startWindowImpl::networkNotification(int notificationId)
}
break;
case NTF_NET_REMOVED_KICKED: {
QMessageBox::warning(this, tr("Network Notification"),
MyMessageBox::warning(this, tr("Network Notification"),
tr("You were kicked from the game."),
QMessageBox::Close);
}
break;
case NTF_NET_REMOVED_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."),
QMessageBox::Close);
}
break;
case NTF_NET_REMOVED_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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
@@ -1009,25 +1010,25 @@ void startWindowImpl::networkNotification(int notificationId)
}
break;
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!"),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
break;
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."),
QMessageBox::Close);
}
@@ -1059,7 +1060,7 @@ void startWindowImpl::networkNotification(int notificationId)
void startWindowImpl::networkMessage(QString msg)
{
QMessageBox msgBox(QMessageBox::Information, tr("Server Message"),
MyMessageBox msgBox(QMessageBox::Information, tr("Server Message"),
msg, QMessageBox::Close, this);
msgBox.setTextFormat(Qt::RichText);
msgBox.exec();
@@ -1100,7 +1101,7 @@ void startWindowImpl::networkMessage(unsigned msgId)
break;
}
QMessageBox msgBox(QMessageBox::Information, tr("Server Message"),
MyMessageBox msgBox(QMessageBox::Information, tr("Server Message"),
msgText, QMessageBox::Close, this);
// msgBox.setTextFormat(Qt::RichText);
msgBox.exec();
+2 -1
View File
@@ -29,6 +29,7 @@
#include "game_defs.h"
#include <QMessageBox>
#include "mymessagebox.h"
class GuiInterface;
class GuiWrapper;
@@ -178,7 +179,7 @@ private:
serverListDialogImpl *myServerListDialog;
internetGameLoginDialogImpl *myInternetGameLoginDialog;
QMessageBox msgBoxOutdatedVersion;
MyMessageBox msgBoxOutdatedVersion;
bool msgBoxOutdatedVersionActive;
friend class GuiWrapper;
+6 -5
View File
@@ -20,6 +20,7 @@
#include <sstream>
#include <cstdlib>
#include <fstream>
#include "mymessagebox.h"
#include "game_defs.h"
using namespace std;
@@ -67,7 +68,7 @@ void CardDeckStyleReader::readStyleFile(QString file)
TiXmlElement *GameTableElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "TableStyle" ).ToElement();
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!"),
QMessageBox::Ok);
} else {
@@ -138,7 +139,7 @@ void CardDeckStyleReader::readStyleFile(QString file)
if(PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() != POKERTH_CD_STYLE_FILE_VERSION) {
QString EMail;
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),
QMessageBox::Ok);
}
@@ -146,7 +147,7 @@ void CardDeckStyleReader::readStyleFile(QString file)
}
} else {
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),
QMessageBox::Ok);
}
@@ -159,7 +160,7 @@ void CardDeckStyleReader::showLeftItemsErrorMessage(QString style, QStringList f
QString 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),
QMessageBox::Ok);
}
@@ -170,7 +171,7 @@ void CardDeckStyleReader::showCardsLeftErrorMessage(QString style, QStringList f
QString 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),
QMessageBox::Ok);
}
+3 -3
View File
@@ -102,7 +102,7 @@ void GameTableStyleReader::readStyleFile(QString file)
TiXmlElement *CardDeckElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "CardDeck" ).ToElement();
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!"),
QMessageBox::Ok);
} else {
@@ -1228,7 +1228,7 @@ void GameTableStyleReader::readStyleFile(QString file)
}
} else {
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),
QMessageBox::Ok);
}
@@ -1647,7 +1647,7 @@ QString GameTableStyleReader::getFallBackFieldContent(QString field, int type)
TiXmlElement *CardDeckElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "CardDeck" ).ToElement();
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!"),
QMessageBox::Ok);
} else {
@@ -26,7 +26,11 @@ timeoutMsgBoxImpl::timeoutMsgBoxImpl(QMainWindow *parent)
this->setWindowTitle(tr("Timeout Warning"));
this->setIcon(QMessageBox::Warning);
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;
connect(timeOutTimer, SIGNAL(timeout()), this, SLOT(timerRefresh()));