Running astyle.

This commit is contained in:
lotodore
2012-12-21 01:01:01 +01:00
parent 7503b1754e
commit d3cd97c666
63 changed files with 4437 additions and 4448 deletions
+15 -15
View File
@@ -9,26 +9,26 @@ BadWordCheck::BadWordCheck()
bool BadWordCheck::run(QString msg) bool BadWordCheck::run(QString msg)
{ {
msg = msg.toLower(); msg = msg.toLower();
bool badMessage(false); bool badMessage(false);
QStringListIterator it(badWords); QStringListIterator it(badWords);
while (it.hasNext()) { while (it.hasNext()) {
QString bw=it.next(); QString bw=it.next();
if(msg.contains(bw)) { if(msg.contains(bw)) {
badMessage=true; badMessage=true;
//exception check //exception check
QStringListIterator it2(badWordsException); QStringListIterator it2(badWordsException);
while (it2.hasNext()) { while (it2.hasNext()) {
QString bwe=it2.next(); QString bwe=it2.next();
if(bwe.contains(bw) && msg.contains(bwe)) { if(bwe.contains(bw) && msg.contains(bwe)) {
badMessage=false; badMessage=false;
} }
} }
} }
} }
if(badMessage) return true; if(badMessage) return true;
else return false; else return false;
} }
+4 -4
View File
@@ -13,16 +13,16 @@ public:
badWords = bw; badWords = bw;
} }
void setBadWordsException(QStringList bwe) { void setBadWordsException(QStringList bwe) {
badWordsException = bwe; badWordsException = bwe;
} }
bool run(QString); bool run(QString);
private: private:
QStringList badWords; QStringList badWords;
QStringList badWordsException; QStringList badWordsException;
}; };
#endif // BADWORDCHECK_H #endif // BADWORDCHECK_H
+4 -4
View File
@@ -43,7 +43,7 @@ using namespace std;
CleanerConfig::CleanerConfig() CleanerConfig::CleanerConfig()
{ {
// !!!! Revisionsnummer der Configdefaults !!!!! // !!!! Revisionsnummer der Configdefaults !!!!!
configRev = 9; configRev = 9;
// Pfad und Dateinamen setzen // Pfad und Dateinamen setzen
#ifdef _WIN32 #ifdef _WIN32
@@ -158,9 +158,9 @@ CleanerConfig::CleanerConfig()
badWordsList.push_back("whore"); badWordsList.push_back("whore");
configList.push_back(ConfigInfo("BadWordsList", CONFIG_TYPE_STRING_LIST, "BadWords", badWordsList)); configList.push_back(ConfigInfo("BadWordsList", CONFIG_TYPE_STRING_LIST, "BadWords", badWordsList));
list<string> badWordsExceptionList; list<string> badWordsExceptionList;
badWordsExceptionList.push_back("idiots end"); badWordsExceptionList.push_back("idiots end");
configList.push_back(ConfigInfo("BadWordsException", CONFIG_TYPE_STRING_LIST, "BadWordsException", badWordsExceptionList)); configList.push_back(ConfigInfo("BadWordsException", CONFIG_TYPE_STRING_LIST, "BadWordsException", badWordsExceptionList));
list<string> urlStringsList; list<string> urlStringsList;
+10 -10
View File
@@ -178,20 +178,20 @@ void MessageFilter::refreshConfig()
// special check settings // special check settings
//Bad Words //Bad Words
std::list<std::string> badWordsList = config->readConfigStringList("BadWordsList"); std::list<std::string> badWordsList = config->readConfigStringList("BadWordsList");
std::list<std::string>::iterator it0; std::list<std::string>::iterator it0;
QStringList bwList; QStringList bwList;
for(it0= badWordsList.begin(); it0 != badWordsList.end(); ++it0) { for(it0= badWordsList.begin(); it0 != badWordsList.end(); ++it0) {
bwList << QString::fromUtf8(it0->c_str()); bwList << QString::fromUtf8(it0->c_str());
} }
myBadWordCheck->setBadWords(bwList); myBadWordCheck->setBadWords(bwList);
std::list<std::string> badWordsExceptionList = config->readConfigStringList("BadWordsList"); std::list<std::string> badWordsExceptionList = config->readConfigStringList("BadWordsList");
std::list<std::string>::iterator it1; std::list<std::string>::iterator it1;
QStringList bweList; QStringList bweList;
for(it1= badWordsExceptionList.begin(); it1 != badWordsExceptionList.end(); ++it1) { for(it1= badWordsExceptionList.begin(); it1 != badWordsExceptionList.end(); ++it1) {
bweList << QString::fromUtf8(it1->c_str()); bweList << QString::fromUtf8(it1->c_str());
} }
myBadWordCheck->setBadWordsException(bweList); myBadWordCheck->setBadWordsException(bweList);
std::list<std::string> urlStringsList = config->readConfigStringList("UrlStringsList"); std::list<std::string> urlStringsList = config->readConfigStringList("UrlStringsList");
std::list<std::string>::iterator it2; std::list<std::string>::iterator it2;
+11 -11
View File
@@ -50,7 +50,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
myConfigState = OK; myConfigState = OK;
// !!!! Revisionsnummer der Configdefaults !!!!! // !!!! Revisionsnummer der Configdefaults !!!!!
configRev = 98; configRev = 98;
//standard defaults //standard defaults
logOnOffDefault = "1"; logOnOffDefault = "1";
@@ -131,7 +131,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
tempIntToString << configRev; tempIntToString << configRev;
configList.push_back(ConfigInfo("ConfigRevision", CONFIG_TYPE_INT, tempIntToString.str())); configList.push_back(ConfigInfo("ConfigRevision", CONFIG_TYPE_INT, tempIntToString.str()));
#ifdef ANDROID #ifdef ANDROID
configList.push_back(ConfigInfo("AppDataDir", CONFIG_TYPE_STRING, ":/android/android-data/")); configList.push_back(ConfigInfo("AppDataDir", CONFIG_TYPE_STRING, ":/android/android-data/"));
#else #else
configList.push_back(ConfigInfo("AppDataDir", CONFIG_TYPE_STRING, myQtToolsInterface->getDataPathStdString(myArgv0))); configList.push_back(ConfigInfo("AppDataDir", CONFIG_TYPE_STRING, myQtToolsInterface->getDataPathStdString(myArgv0)));
#endif #endif
@@ -320,8 +320,8 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
if (tmpStr) tempAppDataPath = tmpStr; if (tmpStr) tempAppDataPath = tmpStr;
//if appdatapath changes directly update it here not in UpdateConfig() //if appdatapath changes directly update it here not in UpdateConfig()
#ifdef ANDROID #ifdef ANDROID
if(tempAppDataPath != ":/android/android-data/") { if(tempAppDataPath != ":/android/android-data/") {
confAppDataPath->SetAttribute("value", ":/android/android-data/"); confAppDataPath->SetAttribute("value", ":/android/android-data/");
#else #else
if(tempAppDataPath != myQtToolsInterface->getDataPathStdString(myArgv0)) { if(tempAppDataPath != myQtToolsInterface->getDataPathStdString(myArgv0)) {
confAppDataPath->SetAttribute("value", myQtToolsInterface->stringToUtf8(myQtToolsInterface->getDataPathStdString(myArgv0))); confAppDataPath->SetAttribute("value", myQtToolsInterface->stringToUtf8(myQtToolsInterface->getDataPathStdString(myArgv0)));
@@ -555,19 +555,19 @@ void ConfigFile::updateConfig(ConfigState myConfigState)
///////// VERSION HACK SECTION /////////////////////// ///////// VERSION HACK SECTION ///////////////////////
//this is the right place for special version depending config hacks: //this is the right place for special version depending config hacks:
//0.9.1 - log interval needs to be set to 1 instead of 0 //0.9.1 - log interval needs to be set to 1 instead of 0
if (configRev >= 95 && configRev <= 98) { // this means 0.9.1 or 0.9.2 or 1.0 if (configRev >= 95 && configRev <= 98) { // this means 0.9.1 or 0.9.2 or 1.0
TiXmlElement * confElement2 = new TiXmlElement( "LogInterval" ); TiXmlElement * confElement2 = new TiXmlElement( "LogInterval" );
config->LinkEndChild( confElement2 ); config->LinkEndChild( confElement2 );
confElement2->SetAttribute("value", 1); confElement2->SetAttribute("value", 1);
noUpdateElemtsList.push_back("LogInterval"); noUpdateElemtsList.push_back("LogInterval");
} }
if (configRev == 98) { // this means 1.0 if (configRev == 98) { // this means 1.0
TiXmlElement * confElement3 = new TiXmlElement( "CurrentCardDeckStyle" ); TiXmlElement * confElement3 = new TiXmlElement( "CurrentCardDeckStyle" );
config->LinkEndChild( confElement3 ); config->LinkEndChild( confElement3 );
confElement3->SetAttribute("value", ""); confElement3->SetAttribute("value", "");
noUpdateElemtsList.push_back("CurrentCardDeckStyle"); noUpdateElemtsList.push_back("CurrentCardDeckStyle");
} }
///////// VERSION HACK SECTION /////////////////////// ///////// VERSION HACK SECTION ///////////////////////
TiXmlHandle oldDocHandle( &oldDoc ); TiXmlHandle oldDocHandle( &oldDoc );
+50 -51
View File
@@ -21,8 +21,8 @@
#include <QtCore> #include <QtCore>
#ifdef ANDROID #ifdef ANDROID
#include <QPlatformNativeInterface> #include <QPlatformNativeInterface>
#include <jni.h> #include <jni.h>
#endif #endif
aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c) aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c)
@@ -39,11 +39,11 @@ aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c)
QPalette myPalette = textBrowser_licence->palette(); QPalette myPalette = textBrowser_licence->palette();
#ifdef GUI_800x480 #ifdef GUI_800x480
#ifdef ANDROID #ifdef ANDROID
myPalette.setColor(QPalette::Base, QColor(255,255,255,255)); myPalette.setColor(QPalette::Base, QColor(255,255,255,255));
myPalette.setColor(QPalette::Text, QColor(0,0,0,255)); myPalette.setColor(QPalette::Text, QColor(0,0,0,255));
#else #else
myPalette.setColor(QPalette::Base, QColor(0,0,0,255)); myPalette.setColor(QPalette::Base, QColor(0,0,0,255));
myPalette.setColor(QPalette::Text, QColor(255,255,255,255)); myPalette.setColor(QPalette::Text, QColor(255,255,255,255));
#endif #endif
#else #else
QColor myColor = myPalette.color(QPalette::Window); QColor myColor = myPalette.color(QPalette::Window);
@@ -52,7 +52,7 @@ aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c)
textBrowser_licence->setPalette(myPalette); textBrowser_licence->setPalette(myPalette);
textBrowser_2->setPalette(myPalette); textBrowser_2->setPalette(myPalette);
textBrowser_3->setPalette(myPalette); textBrowser_3->setPalette(myPalette);
textBrowser_4->setPalette(myPalette); textBrowser_4->setPalette(myPalette);
QFile gplFile(QDir::toNativeSeparators(myAppDataPath+"misc/agpl.html")); QFile gplFile(QDir::toNativeSeparators(myAppDataPath+"misc/agpl.html"));
QString gplString; QString gplString;
@@ -68,32 +68,31 @@ aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c)
label_logo->setPixmap(QPixmap(":/gfx/logoChip3D.png")); label_logo->setPixmap(QPixmap(":/gfx/logoChip3D.png"));
#ifdef GUI_800x480 #ifdef GUI_800x480
label_pokerthVersion->setStyleSheet("QLabel { font-size: 30px; font-weight: bold;}"); label_pokerthVersion->setStyleSheet("QLabel { font-size: 30px; font-weight: bold;}");
#else #else
label_pokerthVersion->setStyleSheet("QLabel { font-size: 16px; font-weight: bold;}"); label_pokerthVersion->setStyleSheet("QLabel { font-size: 16px; font-weight: bold;}");
#endif #endif
#ifdef ANDROID #ifdef ANDROID
JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0); JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0);
JNIEnv* env; JNIEnv* env;
int api = -2; int api = -2;
if (currVM->AttachCurrentThread(&env, NULL)<0) { if (currVM->AttachCurrentThread(&env, NULL)<0) {
qCritical()<<"AttachCurrentThread failed"; qCritical()<<"AttachCurrentThread failed";
} } else {
else { jclass jclassApplicationClass = env->FindClass("android/os/Build$VERSION");
jclass jclassApplicationClass = env->FindClass("android/os/Build$VERSION"); if (jclassApplicationClass) {
if (jclassApplicationClass) { api = env->GetStaticIntField(jclassApplicationClass, env->GetStaticFieldID(jclassApplicationClass,"SDK_INT", "I"));
api = env->GetStaticIntField(jclassApplicationClass, env->GetStaticFieldID(jclassApplicationClass,"SDK_INT", "I")); }
} currVM->DetachCurrentThread();
currVM->DetachCurrentThread(); }
} label_pokerthVersion->setText(QString(tr("PokerTH %1 for Android (API%2)").arg(POKERTH_BETA_RELEASE_STRING).arg(api)));
label_pokerthVersion->setText(QString(tr("PokerTH %1 for Android (API%2)").arg(POKERTH_BETA_RELEASE_STRING).arg(api)));
#else #else
label_pokerthVersion->setText(QString(tr("PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING))); label_pokerthVersion->setText(QString(tr("PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING)));
#endif #endif
this->setWindowTitle(QString(tr("About PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING))); this->setWindowTitle(QString(tr("About PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING)));
//add text to lables and textbrowsers //add text to lables and textbrowsers
QString thxToInfos; QString thxToInfos;
thxToInfos.append(tr("- Wikimedia Commons: for different popular avatar picture resources")+"<br>"); thxToInfos.append(tr("- Wikimedia Commons: for different popular avatar picture resources")+"<br>");
thxToInfos.append(tr("- Benedikt, Erhard, Felix, Florian, Linus, Lothar, Steffi, Caro: for people avatar pictures")+"<br>"); thxToInfos.append(tr("- Benedikt, Erhard, Felix, Florian, Linus, Lothar, Steffi, Caro: for people avatar pictures")+"<br>");
@@ -102,36 +101,36 @@ aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c)
thxToInfos.append(tr("- doc_dos: for self recorded chip sounds")+"<br>"); thxToInfos.append(tr("- doc_dos: for self recorded chip sounds")+"<br>");
thxToInfos.append(tr("- thiger, dunkanx, BerndA, coldz, drull: for different patches")+"<br>"); thxToInfos.append(tr("- thiger, dunkanx, BerndA, coldz, drull: for different patches")+"<br>");
thxToInfos.append(tr("- kraut: for internet-game-server hosting and administration")+"<br>"); thxToInfos.append(tr("- kraut: for internet-game-server hosting and administration")+"<br>");
thxToInfos.append(tr("- danuxi: for startwindow background gfx and danuxi1 table background")+"<br>"); thxToInfos.append(tr("- danuxi: for startwindow background gfx and danuxi1 table background")+"<br>");
thxToInfos.append(tr("- heyn: for moderating forum and organise bugtracker and feature requests")+"<br>"); thxToInfos.append(tr("- heyn: for moderating forum and organise bugtracker and feature requests")+"<br>");
thxToInfos.append(tr("- texas_outlaw: for new table sounds")+"<br>"); thxToInfos.append(tr("- texas_outlaw: for new table sounds")+"<br>");
textBrowser_3->setHtml(thxToInfos); textBrowser_3->setHtml(thxToInfos);
QString infoText; QString infoText;
infoText.append(tr("- Poker engine for the popular Texas Hold'em Poker")+"\n"); infoText.append(tr("- Poker engine for the popular Texas Hold'em Poker")+"\n");
infoText.append(tr("- Singleplayer games with up to 9 computer-opponents")+"\n"); infoText.append(tr("- Singleplayer games with up to 9 computer-opponents")+"\n");
infoText.append(tr("- Multiplayer network games")+"\n"); infoText.append(tr("- Multiplayer network games")+"\n");
infoText.append(tr("- Internet online games")+"\n"); infoText.append(tr("- Internet online games")+"\n");
infoText.append(tr("- Changeable gui with online style gallery")+"\n"); infoText.append(tr("- Changeable gui with online style gallery")+"\n");
infoText.append(tr("- Online ranking website with result tables")+"\n"); infoText.append(tr("- Online ranking website with result tables")+"\n");
infoText.append("\n"); infoText.append("\n");
QString thisYear = QDate::currentDate().toString("yyyy"); QString thisYear = QDate::currentDate().toString("yyyy");
infoText.append("(c)2006-"+thisYear+", Felix Hammer, Florian Thauer, Lothar May"); infoText.append("(c)2006-"+thisYear+", Felix Hammer, Florian Thauer, Lothar May");
label_infotext->setText(infoText); label_infotext->setText(infoText);
QString projectText; QString projectText;
projectText.append("<b>"+tr("Project page:")+"</b><br>"); projectText.append("<b>"+tr("Project page:")+"</b><br>");
projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;<a href='http://www.pokerth.net'>http://www.pokerth.net</a><br>"); projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;<a href='http://www.pokerth.net'>http://www.pokerth.net</a><br>");
projectText.append("<b>IRC:</b><br>"); projectText.append("<b>IRC:</b><br>");
projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;#pokerth (irc.freenode.net)<br>"); projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;#pokerth (irc.freenode.net)<br>");
projectText.append("<b>"+tr("Authors:")+"</b><br>"); projectText.append("<b>"+tr("Authors:")+"</b><br>");
projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;Felix Hammer (<a href=mailto:doitux@pokerth.net>doitux@pokerth.net</a>)<br>"); projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;Felix Hammer (<a href=mailto:doitux@pokerth.net>doitux@pokerth.net</a>)<br>");
projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "+tr("initial idea, basic architecture, gui implementation, gui graphics editing, linux package")+"<br>"); projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "+tr("initial idea, basic architecture, gui implementation, gui graphics editing, linux package")+"<br>");
projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;Florian Thauer (<a href=mailto:floty@pokerth.net>floty@pokerth.net</a>)<br>"); projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;Florian Thauer (<a href=mailto:floty@pokerth.net>floty@pokerth.net</a>)<br>");
projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "+tr("initial idea, basic architecture, engine development")+"<br>"); projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "+tr("initial idea, basic architecture, engine development")+"<br>");
projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;Lothar May (<a href=mailto:lotodore@pokerth.net>lotodore@pokerth.net</a>)<br>"); projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;Lothar May (<a href=mailto:lotodore@pokerth.net>lotodore@pokerth.net</a>)<br>");
projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "+tr("basic architecture, network development, windows package, MacOS package")+"<br>"); projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "+tr("basic architecture, network development, windows package, MacOS package")+"<br>");
projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;Oskar Lindqvist (<a href=mailto:tranberry@pokerth.net>tranberry@pokerth.net</a>)<br>"); projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;Oskar Lindqvist (<a href=mailto:tranberry@pokerth.net>tranberry@pokerth.net</a>)<br>");
projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "+tr("initial gui graphics design")+"<br>"); projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "+tr("initial gui graphics design")+"<br>");
textBrowser_2->setHtml(projectText); textBrowser_2->setHtml(projectText);
} }
@@ -28,7 +28,7 @@ changeCompleteBlindsDialogImpl::changeCompleteBlindsDialogImpl(QWidget *parent,
setWindowModality(Qt::ApplicationModal); setWindowModality(Qt::ApplicationModal);
setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog); setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
#endif #endif
setupUi(this); setupUi(this);
this->installEventFilter(this); this->installEventFilter(this);
connect( pushButton_add, SIGNAL( clicked() ), this, SLOT( addBlindValueToList() ) ); connect( pushButton_add, SIGNAL( clicked() ), this, SLOT( addBlindValueToList() ) );
@@ -54,8 +54,8 @@ void changeCompleteBlindsDialogImpl::addBlindValueToList()
if(listWidget_blinds->count() == 30) { if(listWidget_blinds->count() == 30) {
MyMessageBox::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 {
listWidget_blinds->addItem(QString::number(spinBox_input->value(),10)); listWidget_blinds->addItem(QString::number(spinBox_input->value(),10));
sortBlindsList(); sortBlindsList();
@@ -119,12 +119,10 @@ bool changeCompleteBlindsDialogImpl::eventFilter(QObject *obj, QEvent *event)
} }
event->ignore(); event->ignore();
return false; return false;
} } else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
this->reject(); this->reject();
return true; return true;
} } else {
else {
// pass the event on to the parent class // pass the event on to the parent class
return QDialog::eventFilter(obj, event); return QDialog::eventFilter(obj, event);
} }
@@ -35,7 +35,7 @@ class changeCompleteBlindsDialogImpl: public QDialog, public Ui::changeCompleteB
public: public:
changeCompleteBlindsDialogImpl(QWidget *parent = 0, ConfigFile *c = 0); changeCompleteBlindsDialogImpl(QWidget *parent = 0, ConfigFile *c = 0);
void exec(); void exec();
bool eventFilter(QObject *obj, QEvent *event); bool eventFilter(QObject *obj, QEvent *event);
public slots: public slots:
@@ -123,12 +123,10 @@ bool changeContentDialogImpl::eventFilter(QObject *obj, QEvent *event)
} }
event->ignore(); event->ignore();
return false; return false;
} } else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
this->reject(); this->reject();
return true; return true;
} } else {
else {
// pass the event on to the parent class // pass the event on to the parent class
return QDialog::eventFilter(obj, event); return QDialog::eventFilter(obj, event);
} }
+38 -37
View File
@@ -30,7 +30,7 @@ using namespace std;
ChatTools::ChatTools(QLineEdit* l, ConfigFile *c, ChatType ct, QTextBrowser *b, QStandardItemModel *m, gameLobbyDialogImpl *lo) : nickAutoCompletitionCounter(0), myLineEdit(l), myNickListModel(m), myNickStringList(NULL), myTextBrowser(b), myChatType(ct), myConfig(c), myNick(""), myLobby(lo) ChatTools::ChatTools(QLineEdit* l, ConfigFile *c, ChatType ct, QTextBrowser *b, QStandardItemModel *m, gameLobbyDialogImpl *lo) : nickAutoCompletitionCounter(0), myLineEdit(l), myNickListModel(m), myNickStringList(NULL), myTextBrowser(b), myChatType(ct), myConfig(c), myNick(""), myLobby(lo)
{ {
myNick = QString::fromUtf8(myConfig->readConfigString("MyName").c_str()); myNick = QString::fromUtf8(myConfig->readConfigString("MyName").c_str());
ignoreList = myConfig->readConfigStringList("PlayerIgnoreList"); ignoreList = myConfig->readConfigStringList("PlayerIgnoreList");
} }
ChatTools::~ChatTools() ChatTools::~ChatTools()
@@ -83,7 +83,7 @@ void ChatTools::receiveMessage(QString playerName, QString message, bool pm)
tempMsg = QString("<span style=\"font-weight:bold; color:red;\">"+message+"</span>"); tempMsg = QString("<span style=\"font-weight:bold; color:red;\">"+message+"</span>");
//play beep sound only in INET-lobby-chat //play beep sound only in INET-lobby-chat
if(myLobby->isVisible() && myConfig->readConfigInt("PlayLobbyChatNotification")) { if(myLobby->isVisible() && myConfig->readConfigInt("PlayLobbyChatNotification")) {
myLobby->getMyW()->getMySoundEventHandler()->playSound("lobbychatnotify",0); myLobby->getMyW()->getMySoundEventHandler()->playSound("lobbychatnotify",0);
} }
} else if(message.contains(myNick, Qt::CaseInsensitive)) { } else if(message.contains(myNick, Qt::CaseInsensitive)) {
@@ -93,7 +93,7 @@ void ChatTools::receiveMessage(QString playerName, QString message, bool pm)
//play beep sound only in INET-lobby-chat //play beep sound only in INET-lobby-chat
// TODO dont play when message is from yourself // TODO dont play when message is from yourself
if(myLobby->isVisible() && myConfig->readConfigInt("PlayLobbyChatNotification")) { if(myLobby->isVisible() && myConfig->readConfigInt("PlayLobbyChatNotification")) {
myLobby->getMyW()->getMySoundEventHandler()->playSound("lobbychatnotify",0); myLobby->getMyW()->getMySoundEventHandler()->playSound("lobbychatnotify",0);
} }
} }
break; break;
@@ -154,14 +154,14 @@ void ChatTools::receiveMessage(QString playerName, QString message, bool pm)
if(!nickFoundOnIgnoreList) { if(!nickFoundOnIgnoreList) {
tempMsg = checkForEmotes(tempMsg); tempMsg = checkForEmotes(tempMsg);
if(message.indexOf(QString("/me "))==0) { if(message.indexOf(QString("/me "))==0) {
myTextBrowser->append(tempMsg.replace("/me ","<i>*"+playerName+" ")+"</i>"); myTextBrowser->append(tempMsg.replace("/me ","<i>*"+playerName+" ")+"</i>");
} else if(pm == true) { } else if(pm == true) {
myTextBrowser->append("<i>"+playerName+"(pm): " + tempMsg+"</i>"); myTextBrowser->append("<i>"+playerName+"(pm): " + tempMsg+"</i>");
} else { } else {
myTextBrowser->append(playerName + ": " + tempMsg); myTextBrowser->append(playerName + ": " + tempMsg);
} }
} }
} }
@@ -315,39 +315,40 @@ unsigned ChatTools::parsePrivateMessageTarget(QString &chatText)
return playerId; return playerId;
} }
QString ChatTools::checkForEmotes(QString msg) { QString ChatTools::checkForEmotes(QString msg)
{
msg.replace("0:-)", "<img src=\":emotes/emotes/face-angel.png\" />"); msg.replace("0:-)", "<img src=\":emotes/emotes/face-angel.png\" />");
msg.replace("X-(", "<img src=\":emotes/emotes/face-angry.png\" />"); msg.replace("X-(", "<img src=\":emotes/emotes/face-angry.png\" />");
msg.replace("B-)", "<img src=\":emotes/emotes/face-cool.png\" />"); msg.replace("B-)", "<img src=\":emotes/emotes/face-cool.png\" />");
msg.replace("8-)", "<img src=\":emotes/emotes/face-cool.png\" />"); msg.replace("8-)", "<img src=\":emotes/emotes/face-cool.png\" />");
msg.replace(":'(", "<img src=\":emotes/emotes/face-crying.png\" />"); msg.replace(":'(", "<img src=\":emotes/emotes/face-crying.png\" />");
msg.replace("&gt;:-)", "<img src=\":emotes/emotes/face-devilish.png\" />"); msg.replace("&gt;:-)", "<img src=\":emotes/emotes/face-devilish.png\" />");
msg.replace(":-[", "<img src=\":emotes/emotes/face-embarrassed.png\" />"); msg.replace(":-[", "<img src=\":emotes/emotes/face-embarrassed.png\" />");
msg.replace(":-*", "<img src=\":emotes/emotes/face-kiss.png\" />"); msg.replace(":-*", "<img src=\":emotes/emotes/face-kiss.png\" />");
msg.replace(":-))", "<img src=\":emotes/emotes/face-laugh.png\" />"); msg.replace(":-))", "<img src=\":emotes/emotes/face-laugh.png\" />");
msg.replace(":))", "<img src=\":emotes/emotes/face-laugh.png\" />"); msg.replace(":))", "<img src=\":emotes/emotes/face-laugh.png\" />");
msg.replace(":-|", "<img src=\":emotes/emotes/face-plain.png\" />"); msg.replace(":-|", "<img src=\":emotes/emotes/face-plain.png\" />");
msg.replace(":-P", "<img src=\":emotes/emotes/face-raspberry.png\" />"); msg.replace(":-P", "<img src=\":emotes/emotes/face-raspberry.png\" />");
msg.replace(":-p", "<img src=\":emotes/emotes/face-raspberry.png\" />"); msg.replace(":-p", "<img src=\":emotes/emotes/face-raspberry.png\" />");
msg.replace(":-(", "<img src=\":emotes/emotes/face-sad.png\" />"); msg.replace(":-(", "<img src=\":emotes/emotes/face-sad.png\" />");
msg.replace(":(", "<img src=\":emotes/emotes/face-sad.png\" />"); msg.replace(":(", "<img src=\":emotes/emotes/face-sad.png\" />");
msg.replace(":-&", "<img src=\":emotes/emotes/face-sick.png\" />"); msg.replace(":-&", "<img src=\":emotes/emotes/face-sick.png\" />");
msg.replace(":-D", "<img src=\":emotes/emotes/face-smile-big.png\" />"); msg.replace(":-D", "<img src=\":emotes/emotes/face-smile-big.png\" />");
msg.replace(":D", "<img src=\":emotes/emotes/face-smile-big.png\" />"); msg.replace(":D", "<img src=\":emotes/emotes/face-smile-big.png\" />");
msg.replace(":-!", "<img src=\":emotes/emotes/face-smirk.png\" />"); msg.replace(":-!", "<img src=\":emotes/emotes/face-smirk.png\" />");
msg.replace(":-0", "<img src=\":emotes/emotes/face-surprise.png\" />"); msg.replace(":-0", "<img src=\":emotes/emotes/face-surprise.png\" />");
msg.replace(":-O", "<img src=\":emotes/emotes/face-surprise.png\" />"); msg.replace(":-O", "<img src=\":emotes/emotes/face-surprise.png\" />");
msg.replace(":-o", "<img src=\":emotes/emotes/face-surprise.png\" />"); msg.replace(":-o", "<img src=\":emotes/emotes/face-surprise.png\" />");
msg.replace(":-/", "<img src=\":emotes/emotes/face-uncertain.png\" />"); msg.replace(":-/", "<img src=\":emotes/emotes/face-uncertain.png\" />");
msg.replace(":/", "<img src=\":emotes/emotes/face-uncertain.png\" />"); msg.replace(":/", "<img src=\":emotes/emotes/face-uncertain.png\" />");
msg.replace(";-)", "<img src=\":emotes/emotes/face-wink.png\" />"); msg.replace(";-)", "<img src=\":emotes/emotes/face-wink.png\" />");
msg.replace(";)", "<img src=\":emotes/emotes/face-wink.png\" />"); msg.replace(";)", "<img src=\":emotes/emotes/face-wink.png\" />");
msg.replace(":-S", "<img src=\":emotes/emotes/face-worried.png\" />"); msg.replace(":-S", "<img src=\":emotes/emotes/face-worried.png\" />");
msg.replace(":-s", "<img src=\":emotes/emotes/face-worried.png\" />"); msg.replace(":-s", "<img src=\":emotes/emotes/face-worried.png\" />");
msg.replace(":-)", "<img src=\":emotes/emotes/face-smile.png\" />"); msg.replace(":-)", "<img src=\":emotes/emotes/face-smile.png\" />");
msg.replace(":)", "<img src=\":emotes/emotes/face-smile.png\" />"); msg.replace(":)", "<img src=\":emotes/emotes/face-smile.png\" />");
return msg; return msg;
} }
+1 -1
View File
@@ -74,7 +74,7 @@ public slots:
myStyle = theValue; myStyle = theValue;
} }
void refreshIgnoreList(); void refreshIgnoreList();
QString checkForEmotes(QString); QString checkForEmotes(QString);
protected: protected:
@@ -260,12 +260,10 @@ bool createInternetGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
} }
event->ignore(); event->ignore();
return false; return false;
} } else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
this->reject(); this->reject();
return true; return true;
} } else {
else {
// pass the event on to the parent class // pass the event on to the parent class
return QDialog::eventFilter(obj, event); return QDialog::eventFilter(obj, event);
} }
@@ -151,12 +151,10 @@ bool createNetworkGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
} }
event->ignore(); event->ignore();
return false; return false;
} } else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
this->reject(); this->reject();
return true; return true;
} } else {
else {
// pass the event on to the parent class // pass the event on to the parent class
return QDialog::eventFilter(obj, event); return QDialog::eventFilter(obj, event);
} }
File diff suppressed because it is too large Load Diff
@@ -164,8 +164,8 @@ private:
CountryStringMap countryStringMap; CountryStringMap countryStringMap;
QString myAppDataPath; QString myAppDataPath;
MyMessageBox *waitStartGameMsgBox; MyMessageBox *waitStartGameMsgBox;
MyMessageBox *waitRejoinStartGameMsgBox; MyMessageBox *waitRejoinStartGameMsgBox;
myMessageDialogImpl *inviteOnlyInfoMsgBox; myMessageDialogImpl *inviteOnlyInfoMsgBox;
QTimer *waitStartGameMsgBoxTimer; QTimer *waitStartGameMsgBoxTimer;
QTimer *blinkingButtonAnimationTimer; QTimer *blinkingButtonAnimationTimer;
@@ -20,40 +20,40 @@
#include <QtCore> #include <QtCore>
MyGameListSortFilterProxyModel::MyGameListSortFilterProxyModel(QObject *parent) MyGameListSortFilterProxyModel::MyGameListSortFilterProxyModel(QObject *parent)
: QSortFilterProxyModel(parent) : QSortFilterProxyModel(parent)
{ {
} }
bool MyGameListSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const bool MyGameListSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{ {
QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent); QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
QModelIndex index1 = sourceModel()->index(sourceRow, 1, sourceParent); QModelIndex index1 = sourceModel()->index(sourceRow, 1, sourceParent);
QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent); QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);
QModelIndex index3 = sourceModel()->index(sourceRow, 3, sourceParent); QModelIndex index3 = sourceModel()->index(sourceRow, 3, sourceParent);
QModelIndex index4 = sourceModel()->index(sourceRow, 4, sourceParent); QModelIndex index4 = sourceModel()->index(sourceRow, 4, sourceParent);
QModelIndex index5 = sourceModel()->index(sourceRow, 5, sourceParent); QModelIndex index5 = sourceModel()->index(sourceRow, 5, sourceParent);
return ((sourceModel()->data(index1, 16).toString().contains(column1RegExp) return ((sourceModel()->data(index1, 16).toString().contains(column1RegExp)
&& sourceModel()->data(index2, 16).toString().contains(column2RegExp) && sourceModel()->data(index2, 16).toString().contains(column2RegExp)
&& sourceModel()->data(index3, 16).toString().contains(column3RegExp) && sourceModel()->data(index3, 16).toString().contains(column3RegExp)
&& sourceModel()->data(index4, 16).toString().contains(column4RegExp) && sourceModel()->data(index4, 16).toString().contains(column4RegExp)
&& sourceModel()->data(index5, 16).toString().contains(column5RegExp)) || sourceModel()->data(index0, 16) == "MeInThisGame"); && sourceModel()->data(index5, 16).toString().contains(column5RegExp)) || sourceModel()->data(index0, 16) == "MeInThisGame");
} }
bool MyGameListSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const bool MyGameListSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
{ {
switch(sortColumn()) { switch(sortColumn()) {
case 5: { case 5: {
return sourceModel()->data(left, 16).toString() < sourceModel()->data(right, 16).toString(); return sourceModel()->data(left, 16).toString() < sourceModel()->data(right, 16).toString();
} }
break; break;
default: { default: {
return QSortFilterProxyModel::lessThan(left, right); return QSortFilterProxyModel::lessThan(left, right);
} }
break; break;
} }
return false; return false;
} }
@@ -38,20 +38,20 @@ public:
void setColumn4RegExp(QRegExp column4) { void setColumn4RegExp(QRegExp column4) {
column4RegExp = column4; column4RegExp = column4;
} }
void setColumn5RegExp(QRegExp column5) { void setColumn5RegExp(QRegExp column5) {
column5RegExp = column5; column5RegExp = column5;
} }
protected: protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const; bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
private: private:
QRegExp column1RegExp; QRegExp column1RegExp;
QRegExp column2RegExp; QRegExp column2RegExp;
QRegExp column3RegExp; QRegExp column3RegExp;
QRegExp column4RegExp; QRegExp column4RegExp;
QRegExp column5RegExp; QRegExp column5RegExp;
}; };
+170 -174
View File
@@ -74,7 +74,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
setupUi(this); setupUi(this);
//Sound //Sound
mySoundEventHandler = new SoundEvents(myConfig); mySoundEventHandler = new SoundEvents(myConfig);
// Init game table style // Init game table style
@@ -92,10 +92,10 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
//set myStyle to widgets wich needs it //set myStyle to widgets wich needs it
#ifdef GUI_800x480 #ifdef GUI_800x480
tabsDiag = new QDialog(this); tabsDiag = new QDialog(this);
tabs.setupUi(tabsDiag); tabs.setupUi(tabsDiag);
textLabel_handLabel->hide(); textLabel_handLabel->hide();
#ifdef ANDROID #ifdef ANDROID
tabsDiag->setStyleSheet("QObject { font: 26px; } QDialog { background-image: url(:/android/android-data/gfx/gui/table/default_800x480/table_dark.png); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}"); tabsDiag->setStyleSheet("QObject { font: 26px; } QDialog { background-image: url(:/android/android-data/gfx/gui/table/default_800x480/table_dark.png); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
#endif #endif
tabs.label_chance->setMyStyle(myGameTableStyle); tabs.label_chance->setMyStyle(myGameTableStyle);
#else #else
@@ -303,13 +303,13 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
playerTipLabelArray[9] = label_playerTip9; playerTipLabelArray[9] = label_playerTip9;
#ifdef GUI_800x480 #ifdef GUI_800x480
int j; int j;
for (i=0; i<MAX_NUMBER_OF_PLAYERS; ++i) { for (i=0; i<MAX_NUMBER_OF_PLAYERS; ++i) {
for (j=1; j<=5; ++j) { for (j=1; j<=5; ++j) {
playerStarsArray[j][i]->hide(); playerStarsArray[j][i]->hide();
} }
playerTipLabelArray[i]->hide(); playerTipLabelArray[i]->hide();
} }
#endif #endif
@@ -389,8 +389,8 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
textLabel_Status0->setMyW(this); textLabel_Status0->setMyW(this);
//check position depending on card deck type //check position depending on card deck type
checkActionLabelPosition(); checkActionLabelPosition();
// GroupBoxArray init // GroupBoxArray init
@@ -496,12 +496,12 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
// Dialogs // Dialogs
#ifdef GUI_800x480 #ifdef GUI_800x480
myChat = new ChatTools(tabs.lineEdit_ChatInput, myConfig, INGAME_CHAT, tabs.textBrowser_Chat); myChat = new ChatTools(tabs.lineEdit_ChatInput, myConfig, INGAME_CHAT, tabs.textBrowser_Chat);
myChat->setMyStyle(myGameTableStyle); myChat->setMyStyle(myGameTableStyle);
tabs.lineEdit_ChatInput->installEventFilter(this); tabs.lineEdit_ChatInput->installEventFilter(this);
#else #else
myChat = new ChatTools(lineEdit_ChatInput, myConfig, INGAME_CHAT, textBrowser_Chat); myChat = new ChatTools(lineEdit_ChatInput, myConfig, INGAME_CHAT, textBrowser_Chat);
myChat->setMyStyle(myGameTableStyle); myChat->setMyStyle(myGameTableStyle);
lineEdit_ChatInput->installEventFilter(this); lineEdit_ChatInput->installEventFilter(this);
#endif #endif
this->installEventFilter(this); this->installEventFilter(this);
@@ -510,10 +510,10 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
myUniversalMessageDialog = new myMessageDialogImpl(myConfig, this); myUniversalMessageDialog = new myMessageDialogImpl(myConfig, this);
myUniversalMessageDialog->setParent(this); myUniversalMessageDialog->setParent(this);
//hide left and right icon and menubar from maemo gui for ANDROID //hide left and right icon and menubar from maemo gui for ANDROID
#ifdef ANDROID #ifdef ANDROID
fullscreenButton->hide(); fullscreenButton->hide();
menubar->hide(); menubar->hide();
// tabsButton->hide(); // tabsButton->hide();
#endif #endif
@@ -683,9 +683,9 @@ void gameTableImpl::callSettingsDialog()
void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog)
{ {
//apply card deck style //apply card deck style
myCardDeckStyle->readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentCardDeckStyle").c_str())); myCardDeckStyle->readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentCardDeckStyle").c_str()));
checkActionLabelPosition(); checkActionLabelPosition();
//apply game table style //apply game table style
myGameTableStyle->readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentGameTableStyle").c_str())); myGameTableStyle->readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentGameTableStyle").c_str()));
@@ -837,75 +837,75 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog)
provideMyActions(); provideMyActions();
} }
mySoundEventHandler->reInitSoundEngine(); mySoundEventHandler->reInitSoundEngine();
} }
void gameTableImpl::initGui(int speed) void gameTableImpl::initGui(int speed)
{ {
//kill running Singleshots!!! //kill running Singleshots!!!
stopTimer(); stopTimer();
label_handNumber->setText(HandString+":"); label_handNumber->setText(HandString+":");
label_gameNumber->setText(GameString+":"); label_gameNumber->setText(GameString+":");
//set WindowTitle dynamically //set WindowTitle dynamically
QString titleString = ""; QString titleString = "";
assert(myStartWindow->getSession()); assert(myStartWindow->getSession());
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK) { if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK) {
GameInfo info(myStartWindow->getSession()->getClientGameInfo(myStartWindow->getSession()->getClientCurrentGameId())); GameInfo info(myStartWindow->getSession()->getClientGameInfo(myStartWindow->getSession()->getClientCurrentGameId()));
titleString = QString::fromUtf8(info.name.c_str())+" - "; titleString = QString::fromUtf8(info.name.c_str())+" - ";
} }
//show human player buttons //show human player buttons
for(int i=0; i<6; i++) { for(int i=0; i<6; i++) {
userWidgetsArray[i]->show(); userWidgetsArray[i]->show();
} }
//set speeds for local game and for first network game //set speeds for local game and for first network game
if( !myStartWindow->getSession()->isNetworkClientRunning() || (myStartWindow->getSession()->isNetworkClientRunning() && !myStartWindow->getSession()->getCurrentGame()) ) { if( !myStartWindow->getSession()->isNetworkClientRunning() || (myStartWindow->getSession()->isNetworkClientRunning() && !myStartWindow->getSession()->getCurrentGame()) ) {
guiGameSpeed = speed; guiGameSpeed = speed;
setSpeeds(); setSpeeds();
} }
//set session for chat //set session for chat
myChat->setSession(this->getSession()); myChat->setSession(this->getSession());
#ifdef GUI_800x480 #ifdef GUI_800x480
tabsDiag->setWindowTitle("Tabs"); tabsDiag->setWindowTitle("Tabs");
this->setWindowTitle(QString(titleString + tr("PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING))); this->setWindowTitle(QString(titleString + tr("PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING)));
label_Sets->setText(BetsString); label_Sets->setText(BetsString);
label_Total->setText(TotalString); label_Total->setText(TotalString);
tabs.groupBox_RightToolBox->setDisabled(FALSE); tabs.groupBox_RightToolBox->setDisabled(FALSE);
tabs.groupBox_LeftToolBox->setDisabled(FALSE); tabs.groupBox_LeftToolBox->setDisabled(FALSE);
//set minimum gui speed to prevent gui lags on fast inet games //set minimum gui speed to prevent gui lags on fast inet games
if( myStartWindow->getSession()->isNetworkClientRunning() ) { if( myStartWindow->getSession()->isNetworkClientRunning() ) {
tabs.horizontalSlider_speed->setMinimum(speed); tabs.horizontalSlider_speed->setMinimum(speed);
} else { } else {
tabs.horizontalSlider_speed->setMinimum(1); tabs.horizontalSlider_speed->setMinimum(1);
} }
//positioning Slider //positioning Slider
tabs.horizontalSlider_speed->setValue(guiGameSpeed); tabs.horizontalSlider_speed->setValue(guiGameSpeed);
#else #else
this->setWindowTitle(QString(titleString + tr("PokerTH %1 - The Open-Source Texas Holdem Engine").arg(POKERTH_BETA_RELEASE_STRING))); this->setWindowTitle(QString(titleString + tr("PokerTH %1 - The Open-Source Texas Holdem Engine").arg(POKERTH_BETA_RELEASE_STRING)));
label_Pot->setText(PotString); label_Pot->setText(PotString);
label_Total->setText(TotalString+":"); label_Total->setText(TotalString+":");
label_Sets->setText(BetsString+":"); label_Sets->setText(BetsString+":");
groupBox_RightToolBox->setDisabled(FALSE); groupBox_RightToolBox->setDisabled(FALSE);
groupBox_LeftToolBox->setDisabled(FALSE); groupBox_LeftToolBox->setDisabled(FALSE);
//set minimum gui speed to prevent gui lags on fast inet games //set minimum gui speed to prevent gui lags on fast inet games
if( myStartWindow->getSession()->isNetworkClientRunning() ) { if( myStartWindow->getSession()->isNetworkClientRunning() ) {
horizontalSlider_speed->setMinimum(speed); horizontalSlider_speed->setMinimum(speed);
} else { } else {
horizontalSlider_speed->setMinimum(1); horizontalSlider_speed->setMinimum(1);
} }
horizontalSlider_speed->setValue(guiGameSpeed); horizontalSlider_speed->setValue(guiGameSpeed);
#endif #endif
@@ -1164,7 +1164,7 @@ void gameTableImpl::refreshAction(int playerID, int playerAction)
//play sounds if exist //play sounds if exist
if(myConfig->readConfigInt("PlayGameActions")) if(myConfig->readConfigInt("PlayGameActions"))
mySoundEventHandler->playSound(actionArray[playerAction].toStdString(), playerID); mySoundEventHandler->playSound(actionArray[playerAction].toStdString(), playerID);
} }
if (playerAction == 1) { // FOLD if (playerAction == 1) { // FOLD
@@ -1878,13 +1878,13 @@ void gameTableImpl::meInAction()
myActionIsRaise = 0; myActionIsRaise = 0;
myActionIsBet = 0; myActionIsBet = 0;
/* if(myConfig->readConfigInt("ShowStatusbarMessages")) { /* if(myConfig->readConfigInt("ShowStatusbarMessages")) {
if ( myConfig->readConfigInt("AlternateFKeysUserActionMode") == 0 ) { if ( myConfig->readConfigInt("AlternateFKeysUserActionMode") == 0 ) {
// // statusBar()->showMessage(tr("F1 - Fold | F2 - Check/Call | F3 - Bet/Raise | F4 - All-In"), 15000); // // statusBar()->showMessage(tr("F1 - Fold | F2 - Check/Call | F3 - Bet/Raise | F4 - All-In"), 15000);
} else { } else {
// statusBar()->showMessage(tr("F1 - All-In | F2 - Bet/Raise | F3 - Check/Call | F4 - Fold"), 15000); // statusBar()->showMessage(tr("F1 - All-In | F2 - Bet/Raise | F3 - Check/Call | F4 - Fold"), 15000);
} }
}*/ }*/
QString lastPushButtonFoldString = pushButton_Fold->text(); QString lastPushButtonFoldString = pushButton_Fold->text();
@@ -3232,11 +3232,11 @@ bool gameTableImpl::eventFilter(QObject *obj, QEvent *event)
if (/*obj == lineEdit_ChatInput && lineEdit_ChatInput->text() != "" && */event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Tab) { if (/*obj == lineEdit_ChatInput && lineEdit_ChatInput->text() != "" && */event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Tab) {
myChat->nickAutoCompletition(); myChat->nickAutoCompletition();
return true; return true;
} else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) { } else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
event->ignore(); event->ignore();
closeGameTable(); closeGameTable();
return true; return true;
} else if (event->type() == QEvent::Close) { } else if (event->type() == QEvent::Close) {
event->ignore(); event->ignore();
closeGameTable(); closeGameTable();
return true; return true;
@@ -3707,8 +3707,8 @@ void gameTableImpl::closeGameTable()
if (myStartWindow->getMyServerGuiInterface() && myStartWindow->getMyServerGuiInterface()->getSession()->isNetworkServerRunning()) { if (myStartWindow->getMyServerGuiInterface() && myStartWindow->getMyServerGuiInterface()->getSession()->isNetworkServerRunning()) {
MyMessageBox 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 ) {
myStartWindow->getSession()->terminateNetworkClient(); myStartWindow->getSession()->terminateNetworkClient();
@@ -3722,8 +3722,8 @@ void gameTableImpl::closeGameTable()
bool close = true; bool close = true;
if(myUniversalMessageDialog->checkIfMesssageWillBeDisplayed(CLOSE_GAMETABLE_QUESTION ) && (myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK ) && this->isVisible()) { if(myUniversalMessageDialog->checkIfMesssageWillBeDisplayed(CLOSE_GAMETABLE_QUESTION ) && (myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK ) && this->isVisible()) {
if (myUniversalMessageDialog->exec(CLOSE_GAMETABLE_QUESTION , tr("Really want to exit?"), tr("PokerTH - Close Table?"), QPixmap(":/gfx/logoChip3D.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, true) == QDialog::Rejected) { if (myUniversalMessageDialog->exec(CLOSE_GAMETABLE_QUESTION , tr("Really want to exit?"), tr("PokerTH - Close Table?"), QPixmap(":/gfx/logoChip3D.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, true) == QDialog::Rejected) {
close = false; close = false;
} }
} }
@@ -3741,61 +3741,59 @@ void gameTableImpl::closeGameTable()
void gameTableImpl::changeSpinBoxBetValue(int value) void gameTableImpl::changeSpinBoxBetValue(int value)
{ {
if(betSliderChangedByInput) { if(betSliderChangedByInput) {
//prevent interval cutting of spinBox_betValue input from code below //prevent interval cutting of spinBox_betValue input from code below
betSliderChangedByInput = FALSE; betSliderChangedByInput = FALSE;
} } else {
else {
if(horizontalSlider_bet->value() == horizontalSlider_bet->maximum()) { if(horizontalSlider_bet->value() == horizontalSlider_bet->maximum()) {
spinBox_betValue->setValue(horizontalSlider_bet->value()); spinBox_betValue->setValue(horizontalSlider_bet->value());
} } else {
else {
int temp; int temp;
if(horizontalSlider_bet->maximum() <= 1000 ) { if(horizontalSlider_bet->maximum() <= 1000 ) {
temp = (int)((value/10)*10); temp = (int)((value/10)*10);
} else if(horizontalSlider_bet->maximum() > 1000 && horizontalSlider_bet->maximum() <= 10000) { } else if(horizontalSlider_bet->maximum() > 1000 && horizontalSlider_bet->maximum() <= 10000) {
temp = (int)((value/50)*50); temp = (int)((value/50)*50);
} else if(horizontalSlider_bet->maximum() > 10000 && horizontalSlider_bet->maximum() <= 100000) { } else if(horizontalSlider_bet->maximum() > 10000 && horizontalSlider_bet->maximum() <= 100000) {
temp = (int)((value/500)*500); temp = (int)((value/500)*500);
} else { } else {
temp = (int)((value/5000)*5000); temp = (int)((value/5000)*5000);
} }
if(temp < horizontalSlider_bet->minimum()) if(temp < horizontalSlider_bet->minimum())
spinBox_betValue->setValue(horizontalSlider_bet->minimum()); spinBox_betValue->setValue(horizontalSlider_bet->minimum());
else else
spinBox_betValue->setValue(temp); spinBox_betValue->setValue(temp);
} }
} }
} }
void gameTableImpl::spinBoxBetValueChanged(int value) void gameTableImpl::spinBoxBetValueChanged(int value)
{ {
if(horizontalSlider_bet->isEnabled()) { if(horizontalSlider_bet->isEnabled()) {
QString betRaise = pushButton_BetRaise->text().section("\n",0 ,0); QString betRaise = pushButton_BetRaise->text().section("\n",0 ,0);
if(value >= horizontalSlider_bet->minimum()) { if(value >= horizontalSlider_bet->minimum()) {
if(value > horizontalSlider_bet->maximum()) { // print the maximum if(value > horizontalSlider_bet->maximum()) { // print the maximum
pushButton_BetRaise->setText(betRaise + "\n$" + QString("%L1").arg(horizontalSlider_bet->maximum())); pushButton_BetRaise->setText(betRaise + "\n$" + QString("%L1").arg(horizontalSlider_bet->maximum()));
betSliderChangedByInput = TRUE; betSliderChangedByInput = TRUE;
horizontalSlider_bet->setValue(horizontalSlider_bet->maximum()); horizontalSlider_bet->setValue(horizontalSlider_bet->maximum());
} else { // really print the value } else { // really print the value
pushButton_BetRaise->setText(betRaise + "\n$" + QString("%L1").arg(value)); pushButton_BetRaise->setText(betRaise + "\n$" + QString("%L1").arg(value));
betSliderChangedByInput = TRUE; betSliderChangedByInput = TRUE;
horizontalSlider_bet->setValue(value); horizontalSlider_bet->setValue(value);
} }
} else { // print the minimum } else { // print the minimum
pushButton_BetRaise->setText(betRaise + "\n$" + QString("%L1").arg(horizontalSlider_bet->minimum())); pushButton_BetRaise->setText(betRaise + "\n$" + QString("%L1").arg(horizontalSlider_bet->minimum()));
betSliderChangedByInput = TRUE; betSliderChangedByInput = TRUE;
horizontalSlider_bet->setValue(horizontalSlider_bet->minimum()); horizontalSlider_bet->setValue(horizontalSlider_bet->minimum());
} }
} }
} }
void gameTableImpl::leaveCurrentNetworkGame() void gameTableImpl::leaveCurrentNetworkGame()
@@ -3803,12 +3801,12 @@ void gameTableImpl::leaveCurrentNetworkGame()
if (myStartWindow->getSession()->isNetworkClientRunning()) { if (myStartWindow->getSession()->isNetworkClientRunning()) {
if(!myUniversalMessageDialog->checkIfMesssageWillBeDisplayed(BACKTO_LOBBY_QUESTION)) { if(!myUniversalMessageDialog->checkIfMesssageWillBeDisplayed(BACKTO_LOBBY_QUESTION)) {
assert(myStartWindow->getSession()); assert(myStartWindow->getSession());
myStartWindow->getSession()->sendLeaveCurrentGame(); myStartWindow->getSession()->sendLeaveCurrentGame();
} else { } else {
if (myUniversalMessageDialog->exec(BACKTO_LOBBY_QUESTION, tr("Attention! Do you really want to leave the current game\nand go back to the lobby?"), tr("PokerTH - Internet Game Message"), QPixmap(":/gfx/logoChip3D.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, true) == QDialog::Accepted) { if (myUniversalMessageDialog->exec(BACKTO_LOBBY_QUESTION, tr("Attention! Do you really want to leave the current game\nand go back to the lobby?"), tr("PokerTH - Internet Game Message"), QPixmap(":/gfx/logoChip3D.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, true) == QDialog::Accepted) {
assert(myStartWindow->getSession()); assert(myStartWindow->getSession());
myStartWindow->getSession()->sendLeaveCurrentGame(); myStartWindow->getSession()->sendLeaveCurrentGame();
} }
@@ -4040,7 +4038,7 @@ void gameTableImpl::refreshGameTableStyle()
myGameTableStyle->setWindowsGeometry(this); myGameTableStyle->setWindowsGeometry(this);
#ifdef GUI_800x480 #ifdef GUI_800x480
#ifdef ANDROID #ifdef ANDROID
myGameTableStyle->setChatLogStyle(tabs.textBrowser_Log); myGameTableStyle->setChatLogStyle(tabs.textBrowser_Log);
#endif #endif
myGameTableStyle->setChatLogStyle(tabs.textBrowser_Chat); myGameTableStyle->setChatLogStyle(tabs.textBrowser_Chat);
myGameTableStyle->setChatLogStyle(tabs.textEdit_tipInput); myGameTableStyle->setChatLogStyle(tabs.textEdit_tipInput);
@@ -4061,8 +4059,8 @@ void gameTableImpl::refreshGameTableStyle()
} }
#ifdef GUI_800x480 #ifdef GUI_800x480
myGameTableStyle->setBigFontBoardStyle(label_Sets); myGameTableStyle->setBigFontBoardStyle(label_Sets);
myGameTableStyle->setBigFontBoardStyle(label_Total); myGameTableStyle->setBigFontBoardStyle(label_Total);
myGameTableStyle->setBigFontBoardStyle(textLabel_Sets); myGameTableStyle->setBigFontBoardStyle(textLabel_Sets);
myGameTableStyle->setBigFontBoardStyle(textLabel_Pot); myGameTableStyle->setBigFontBoardStyle(textLabel_Pot);
myGameTableStyle->setBigFontBoardStyle(label_handNumber); myGameTableStyle->setBigFontBoardStyle(label_handNumber);
@@ -4071,8 +4069,8 @@ void gameTableImpl::refreshGameTableStyle()
myGameTableStyle->setBigFontBoardStyle(label_gameNumberValue); myGameTableStyle->setBigFontBoardStyle(label_gameNumberValue);
myGameTableStyle->setBigFontBoardStyle(textLabel_handLabel); myGameTableStyle->setBigFontBoardStyle(textLabel_handLabel);
#else #else
myGameTableStyle->setSmallFontBoardStyle(label_Sets); myGameTableStyle->setSmallFontBoardStyle(label_Sets);
myGameTableStyle->setSmallFontBoardStyle(label_Total); myGameTableStyle->setSmallFontBoardStyle(label_Total);
myGameTableStyle->setSmallFontBoardStyle(textLabel_Sets); myGameTableStyle->setSmallFontBoardStyle(textLabel_Sets);
myGameTableStyle->setSmallFontBoardStyle(textLabel_Pot); myGameTableStyle->setSmallFontBoardStyle(textLabel_Pot);
myGameTableStyle->setSmallFontBoardStyle(label_handNumber); myGameTableStyle->setSmallFontBoardStyle(label_handNumber);
@@ -4261,12 +4259,12 @@ void gameTableImpl::saveGameTableGeometry()
void gameTableImpl::restoreGameTableGeometry() void gameTableImpl::restoreGameTableGeometry()
{ {
#ifdef ANDROID #ifdef ANDROID
this->showFullScreen(); this->showFullScreen();
#else #else
if(myConfig->readConfigInt("GameTableFullScreenSave")) { if(myConfig->readConfigInt("GameTableFullScreenSave")) {
#ifndef GUI_800x480 #ifndef GUI_800x480
if(actionFullScreen->isEnabled()) this->showFullScreen(); if(actionFullScreen->isEnabled()) this->showFullScreen();
#endif #endif
} else { } else {
//resize only if style size allow this and if NOT fixed windows size //resize only if style size allow this and if NOT fixed windows size
if(!myGameTableStyle->getIfFixedWindowSize().toInt() && myConfig->readConfigInt("GameTableHeightSave") <= myGameTableStyle->getMaximumWindowHeight().toInt() && myConfig->readConfigInt("GameTableHeightSave") >= myGameTableStyle->getMinimumWindowHeight().toInt() && myConfig->readConfigInt("GameTableWidthSave") <= myGameTableStyle->getMaximumWindowWidth().toInt() && myConfig->readConfigInt("GameTableWidthSave") >= myGameTableStyle->getMinimumWindowWidth().toInt()) { if(!myGameTableStyle->getIfFixedWindowSize().toInt() && myConfig->readConfigInt("GameTableHeightSave") <= myGameTableStyle->getMaximumWindowHeight().toInt() && myConfig->readConfigInt("GameTableHeightSave") >= myGameTableStyle->getMinimumWindowHeight().toInt() && myConfig->readConfigInt("GameTableWidthSave") <= myGameTableStyle->getMaximumWindowWidth().toInt() && myConfig->readConfigInt("GameTableWidthSave") >= myGameTableStyle->getMinimumWindowWidth().toInt()) {
@@ -4337,7 +4335,7 @@ void gameTableImpl::hide()
//clear log //clear log
#ifdef GUI_800x480 #ifdef GUI_800x480
tabs.textBrowser_Log->clear(); tabs.textBrowser_Log->clear();
tabsDiag->hide(); tabsDiag->hide();
#else #else
textBrowser_Log->clear(); textBrowser_Log->clear();
#endif #endif
@@ -4377,7 +4375,7 @@ void gameTableImpl::enableCallCheckPushButton()
void gameTableImpl::tabsButtonClicked() void gameTableImpl::tabsButtonClicked()
{ {
tabsDiag->setParent(this, Qt::Dialog); tabsDiag->setParent(this, Qt::Dialog);
tabsDiag->showFullScreen(); tabsDiag->showFullScreen();
tabsDiag->show(); tabsDiag->show();
tabsDiag->raise(); tabsDiag->raise();
tabsDiag->activateWindow(); tabsDiag->activateWindow();
@@ -4390,36 +4388,34 @@ void gameTableImpl::tabsButtonClose()
#endif #endif
void gameTableImpl::checkActionLabelPosition() { void gameTableImpl::checkActionLabelPosition()
{
#ifndef GUI_800x480 #ifndef GUI_800x480
int i; int i;
if(myCardDeckStyle->getBigIndexesActionBottom() == "1") { if(myCardDeckStyle->getBigIndexesActionBottom() == "1") {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
if(i>=3 && i<=7) { if(i>=3 && i<=7) {
if(actionLabelArray[i]->y() == 56) { if(actionLabelArray[i]->y() == 56) {
actionLabelArray[i]->move(actionLabelArray[i]->x(), 80); actionLabelArray[i]->move(actionLabelArray[i]->x(), 80);
} }
} } else {
else { if(actionLabelArray[i]->y() == 43) {
if(actionLabelArray[i]->y() == 43) { actionLabelArray[i]->move(actionLabelArray[i]->x(), 67);
actionLabelArray[i]->move(actionLabelArray[i]->x(), 67); }
} }
} }
} } else {
} for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
else { if(i>=3 && i<=7) {
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { if(actionLabelArray[i]->y() == 80) {
if(i>=3 && i<=7) { actionLabelArray[i]->move(actionLabelArray[i]->x(), 56);
if(actionLabelArray[i]->y() == 80) { }
actionLabelArray[i]->move(actionLabelArray[i]->x(), 56); } else {
} if(actionLabelArray[i]->y() == 67) {
} actionLabelArray[i]->move(actionLabelArray[i]->x(), 43);
else { }
if(actionLabelArray[i]->y() == 67) { }
actionLabelArray[i]->move(actionLabelArray[i]->x(), 43); }
} }
}
}
}
#endif #endif
} }
+3 -3
View File
@@ -341,10 +341,10 @@ public slots:
void sendShowMyCardsSignal(); void sendShowMyCardsSignal();
void closeMessageBoxes(); void closeMessageBoxes();
void hide(); void hide();
void soundEvent_blindsWereSet(int); void soundEvent_blindsWereSet(int);
void enableCallCheckPushButton(); void enableCallCheckPushButton();
void checkActionLabelPosition(); void checkActionLabelPosition();
#ifdef GUI_800x480 #ifdef GUI_800x480
void tabsButtonClicked(); void tabsButtonClicked();
+2 -2
View File
@@ -412,7 +412,7 @@ void MyAvatarLabel::putPlayerOnIgnoreList()
if(!playerIsOnIgnoreList(list.at(myId))) { if(!playerIsOnIgnoreList(list.at(myId))) {
myMessageDialogImpl dialog(myW->getMyConfig(), this); myMessageDialogImpl dialog(myW->getMyConfig(), this);
if(dialog.exec(INGNORE_PLAYER_QUESTION, tr("You will no longer receive chat messages or game invitations from this user.<br>Do you really want to put player <b>%1</b> on ignore list?").arg(list.at(myId)), tr("PokerTH - Question"), QPixmap(":/gfx/im-ban-user_64.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, false ) == QDialog::Accepted) { if(dialog.exec(INGNORE_PLAYER_QUESTION, tr("You will no longer receive chat messages or game invitations from this user.<br>Do you really want to put player <b>%1</b> on ignore list?").arg(list.at(myId)), tr("PokerTH - Question"), QPixmap(":/gfx/im-ban-user_64.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, false ) == QDialog::Accepted) {
std::list<std::string> playerIgnoreList = myW->getMyConfig()->readConfigStringList("PlayerIgnoreList"); std::list<std::string> playerIgnoreList = myW->getMyConfig()->readConfigStringList("PlayerIgnoreList");
playerIgnoreList.push_back(list.at(myId).toUtf8().constData()); playerIgnoreList.push_back(list.at(myId).toUtf8().constData());
@@ -440,7 +440,7 @@ void MyAvatarLabel::reportBadAvatar()
QString nick = QString::fromUtf8((*it_c)->getMyName().c_str()); QString nick = QString::fromUtf8((*it_c)->getMyName().c_str());
int ret = MyMessageBox::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) {
QFileInfo fi(avatar); QFileInfo fi(avatar);
+7 -7
View File
@@ -108,7 +108,7 @@ void MyCardsPixmapLabel::startFlipCards(int speed, const QPixmap &frontPix, cons
QLabel::setPixmap(frontPix); QLabel::setPixmap(frontPix);
frameFlipCardsAction1Size = 1.0; frameFlipCardsAction1Size = 1.0;
frameFlipCardsAction2Size = 0.0; frameFlipCardsAction2Size = 0.0;
front = frontPix.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);; front = frontPix.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);;
flipside = flipsidePix.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);; flipside = flipsidePix.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);;
@@ -124,7 +124,7 @@ void MyCardsPixmapLabel::startFlipCards(int speed, const QPixmap &frontPix, cons
} }
if(speed > 8 && speed <= 10) { if(speed > 8 && speed <= 10) {
flipCardsScaleIntervall = 0.5; flipCardsScaleIntervall = 0.5;
} }
if(speed != 11) { if(speed != 11) {
flipCardsAction1 = TRUE; flipCardsAction1 = TRUE;
@@ -146,7 +146,7 @@ void MyCardsPixmapLabel::stopFlipCardsAnimation()
void MyCardsPixmapLabel::nextFlipCardsFrame() void MyCardsPixmapLabel::nextFlipCardsFrame()
{ {
if (frameFlipCardsAction1Size > 0.1 ) { if (frameFlipCardsAction1Size > 0.1 ) {
//erst flipside verkleinern //erst flipside verkleinern
frameFlipCardsAction1Size -= flipCardsScaleIntervall; frameFlipCardsAction1Size -= flipCardsScaleIntervall;
update(); update();
@@ -156,9 +156,9 @@ void MyCardsPixmapLabel::nextFlipCardsFrame()
flipCardsAction2 = TRUE; flipCardsAction2 = TRUE;
} else { } else {
//dann front vergrößern //dann front vergrößern
if (frameFlipCardsAction2Size < 0.95 ) { if (frameFlipCardsAction2Size < 0.95 ) {
frameFlipCardsAction2Size += flipCardsScaleIntervall; frameFlipCardsAction2Size += flipCardsScaleIntervall;
update(); update();
} else { } else {
flipCardsAction2 = FALSE; flipCardsAction2 = FALSE;
flipCardsTimer->stop(); flipCardsTimer->stop();
@@ -264,8 +264,8 @@ void MyCardsPixmapLabel::mouseReleaseEvent(QMouseEvent * event)
void MyCardsPixmapLabel::setFront ( const QPixmap& theValue ) void MyCardsPixmapLabel::setFront ( const QPixmap& theValue )
{ {
#ifdef GUI_800x480 #ifdef GUI_800x480
front = theValue.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);; front = theValue.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);;
#else #else
front = theValue; front = theValue;
#endif #endif
} }
+1 -1
View File
@@ -81,7 +81,7 @@ public slots:
void mousePressEvent ( QMouseEvent *); void mousePressEvent ( QMouseEvent *);
void mouseReleaseEvent ( QMouseEvent *); void mouseReleaseEvent ( QMouseEvent *);
void setFront ( const QPixmap& theValue ); void setFront ( const QPixmap& theValue );
private: private:
+1 -1
View File
@@ -26,7 +26,7 @@ class MyLeftTabWidget : public QTabWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
MyLeftTabWidget(QGroupBox*); MyLeftTabWidget(QGroupBox*);
~MyLeftTabWidget(); ~MyLeftTabWidget();
+1 -1
View File
@@ -25,7 +25,7 @@ class MyRightTabWidget : public QTabWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
MyRightTabWidget(QGroupBox*); MyRightTabWidget(QGroupBox*);
~MyRightTabWidget(); ~MyRightTabWidget();
+1 -1
View File
@@ -96,7 +96,7 @@ void MyTimeoutLabel::nextTimeOutAnimationFrame()
if(timeOutFrame > waitFrames) { if(timeOutFrame > waitFrames) {
//play beep after waitFrames one time //play beep after waitFrames one time
if(isBeep && !isBeepPlayed) { if(isBeep && !isBeepPlayed) {
myW->getMySoundEventHandler()->playSound("yourturn",0); myW->getMySoundEventHandler()->playSound("yourturn",0);
isBeepPlayed = TRUE; isBeepPlayed = TRUE;
} }
//save gfx ressources and never play more the 10 pps //save gfx ressources and never play more the 10 pps
@@ -25,11 +25,11 @@ internetGameLoginDialogImpl::internetGameLoginDialogImpl(QWidget *parent, Config
QDialog(parent), myConfig(c) QDialog(parent), myConfig(c)
{ {
setupUi(this); setupUi(this);
this->installEventFilter(this); this->installEventFilter(this);
//html stuff //html stuff
QString createAccount(QString("<a href='http://create-gaming-account.pokerth.net'>%1</a>").arg(tr("Create new user account"))); QString createAccount(QString("<a href='http://create-gaming-account.pokerth.net'>%1</a>").arg(tr("Create new user account")));
label_createAnAccount->setText(createAccount); label_createAnAccount->setText(createAccount);
connect(groupBox_reguser, SIGNAL(toggled(bool)), this, SLOT(regUserToggled(bool))); connect(groupBox_reguser, SIGNAL(toggled(bool)), this, SLOT(regUserToggled(bool)));
@@ -152,24 +152,24 @@ void internetGameLoginDialogImpl::okButtonCheck()
bool internetGameLoginDialogImpl::eventFilter(QObject *obj, QEvent *event) bool internetGameLoginDialogImpl::eventFilter(QObject *obj, QEvent *event)
{ {
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event); QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
#ifdef ANDROID #ifdef ANDROID
//androi changes for return key behavior (hopefully useless from necessitas beta2) //androi changes for return key behavior (hopefully useless from necessitas beta2)
if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Return) { if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Return) {
if(lineEdit_username->hasFocus()) { if(lineEdit_username->hasFocus()) {
lineEdit_password->setFocus(); lineEdit_password->setFocus();
} }
if(lineEdit_password->hasFocus()) { if(lineEdit_password->hasFocus()) {
QTimer::singleShot(1000, this, SLOT(clickLoginButton())); QTimer::singleShot(1000, this, SLOT(clickLoginButton()));
} }
event->ignore(); event->ignore();
return false; return false;
} else { } else {
// pass the event on to the parent class // pass the event on to the parent class
return QDialog::eventFilter(obj, event); return QDialog::eventFilter(obj, event);
} }
#else #else
return QDialog::eventFilter(obj, event); return QDialog::eventFilter(obj, event);
#endif #endif
} }
@@ -35,13 +35,15 @@ public:
void exec(); void exec();
void accept(); void accept();
bool eventFilter(QObject *obj, QEvent *event); bool eventFilter(QObject *obj, QEvent *event);
public slots: public slots:
void regUserToggled(bool); void regUserToggled(bool);
void guestUserToggled(bool); void guestUserToggled(bool);
void okButtonCheck(); void okButtonCheck();
void clickLoginButton() { pushButton_login->click(); } void clickLoginButton() {
pushButton_login->click();
}
private: private:
@@ -120,8 +120,8 @@ 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()) {
MyMessageBox::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);
} }
TiXmlHandle docHandle( &doc ); TiXmlHandle docHandle( &doc );
@@ -171,8 +171,8 @@ 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()) {
MyMessageBox::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);
} }
TiXmlHandle docHandle( &doc ); TiXmlHandle docHandle( &doc );
@@ -198,8 +198,8 @@ 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()) {
MyMessageBox::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);
} }
TiXmlHandle docHandle( &doc ); TiXmlHandle docHandle( &doc );
@@ -210,8 +210,8 @@ void joinNetworkGameDialogImpl::saveServerProfile()
if( testProfile ) { if( testProfile ) {
// Wenn der Name schon existiert --> Überschreiben? // Wenn der Name schon existiert --> Überschreiben?
MyMessageBox 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()) {
case QMessageBox::Yes: { case QMessageBox::Yes: {
@@ -249,14 +249,14 @@ void joinNetworkGameDialogImpl::saveServerProfile()
} }
} else { } else {
MyMessageBox::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()) {
MyMessageBox::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);
} }
fillServerProfileList(); fillServerProfileList();
@@ -268,8 +268,8 @@ 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()) {
MyMessageBox::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 {
TiXmlHandle docHandle( &doc ); TiXmlHandle docHandle( &doc );
@@ -281,8 +281,8 @@ void joinNetworkGameDialogImpl::deleteServerProfile()
if(!doc.SaveFile()) { if(!doc.SaveFile()) {
MyMessageBox::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);
} }
//Liste Füllen //Liste Füllen
+41 -41
View File
@@ -30,21 +30,21 @@
#include <net/uploaderthread.h> #include <net/uploaderthread.h>
LogFileDialog::LogFileDialog(QWidget *parent, ConfigFile *c) : LogFileDialog::LogFileDialog(QWidget *parent, ConfigFile *c) :
QDialog(parent), myConfig(c), QDialog(parent), myConfig(c),
ui(new Ui::LogFileDialog) ui(new Ui::LogFileDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->label_animation->setMaximumWidth(0); ui->label_animation->setMaximumWidth(0);
ui->horizontalLayout_animation->setSpacing(0); ui->horizontalLayout_animation->setSpacing(0);
connect( ui->pushButton_deleteLog, SIGNAL(clicked()), this, SLOT (deleteLogFile())); connect( ui->pushButton_deleteLog, SIGNAL(clicked()), this, SLOT (deleteLogFile()));
connect( ui->pushButton_exportLogHtml, SIGNAL(clicked()), this, SLOT (exportLogToHtml())); connect( ui->pushButton_exportLogHtml, SIGNAL(clicked()), this, SLOT (exportLogToHtml()));
connect( ui->pushButton_exportLogTxt, SIGNAL(clicked()), this, SLOT (exportLogToTxt())); connect( ui->pushButton_exportLogTxt, SIGNAL(clicked()), this, SLOT (exportLogToTxt()));
connect( ui->pushButton_saveLogAs, SIGNAL(clicked()), this, SLOT (saveLogFileAs())); connect( ui->pushButton_saveLogAs, SIGNAL(clicked()), this, SLOT (saveLogFileAs()));
connect( ui->treeWidget_logFiles, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(showLogFilePreviewInit())); connect( ui->treeWidget_logFiles, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(showLogFilePreviewInit()));
connect( ui->pushButton_analyseLogfile, SIGNAL(clicked()), this, SLOT (uploadFile())); connect( ui->pushButton_analyseLogfile, SIGNAL(clicked()), this, SLOT (uploadFile()));
connect( ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(showLogFilePreviewSelected())); connect( ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(showLogFilePreviewSelected()));
connect( this, SIGNAL(signalUploadCompleted(QString,QString)), this, SLOT(showLogAnalysis(QString,QString))); connect( this, SIGNAL(signalUploadCompleted(QString,QString)), this, SLOT(showLogAnalysis(QString,QString)));
connect( this, SIGNAL(signalUploadError(QString,QString)), this, SLOT(showUploadError(QString,QString))); connect( this, SIGNAL(signalUploadError(QString,QString)), this, SLOT(showUploadError(QString,QString)));
@@ -85,16 +85,16 @@ void LogFileDialog::refreshLogFileList()
QFileInfo currentSqliteLogFile(QString::fromStdString(myGuiLog->getMySqliteLogFileName())); QFileInfo currentSqliteLogFile(QString::fromStdString(myGuiLog->getMySqliteLogFileName()));
ui->treeWidget_logFiles->blockSignals(TRUE); ui->treeWidget_logFiles->blockSignals(TRUE);
ui->treeWidget_logFiles->clear(); ui->treeWidget_logFiles->clear();
int i; int i;
for (i=0; i < dbFilesList.size(); i++) { for (i=0; i < dbFilesList.size(); i++) {
QTreeWidgetItem *item = new QTreeWidgetItem; QTreeWidgetItem *item = new QTreeWidgetItem;
#ifdef GUI_800x480 #ifdef GUI_800x480
item->setText(0, dbFilesList.at(i).fileName().remove("pokerth-log-")); item->setText(0, dbFilesList.at(i).fileName().remove("pokerth-log-"));
#else #else
item->setText(0, dbFilesList.at(i).fileName()); item->setText(0, dbFilesList.at(i).fileName());
#endif #endif
item->setData(0, Qt::UserRole, dbFilesList.at(i).absoluteFilePath()); item->setData(0, Qt::UserRole, dbFilesList.at(i).absoluteFilePath());
if(currentSqliteLogFile.fileName() == dbFilesList.at(i).fileName()) { if(currentSqliteLogFile.fileName() == dbFilesList.at(i).fileName()) {
@@ -105,8 +105,8 @@ void LogFileDialog::refreshLogFileList()
ui->treeWidget_logFiles->addTopLevelItem(item); ui->treeWidget_logFiles->addTopLevelItem(item);
} }
ui->treeWidget_logFiles->sortItems(0, Qt::DescendingOrder); ui->treeWidget_logFiles->sortItems(0, Qt::DescendingOrder);
ui->treeWidget_logFiles->blockSignals(FALSE); ui->treeWidget_logFiles->blockSignals(FALSE);
ui->treeWidget_logFiles->setCurrentItem(ui->treeWidget_logFiles->topLevelItem(0)); ui->treeWidget_logFiles->setCurrentItem(ui->treeWidget_logFiles->topLevelItem(0));
} }
void LogFileDialog::deleteLogFile() void LogFileDialog::deleteLogFile()
@@ -116,8 +116,8 @@ void LogFileDialog::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 = MyMessageBox::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);
if(ret == QMessageBox::Yes) { if(ret == QMessageBox::Yes) {
for (int i = 0; i < selectedItemsList.size(); ++i) { for (int i = 0; i < selectedItemsList.size(); ++i) {
@@ -138,7 +138,7 @@ void LogFileDialog::exportLogToHtml()
QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem(); QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem();
if(selectedItem) { if(selectedItem) {
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString()); QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to HTML"), QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to HTML"),
QDir::homePath()+"/"+fi.baseName()+".html", QDir::homePath()+"/"+fi.baseName()+".html",
tr("PokerTH HTML log (*.html)")); tr("PokerTH HTML log (*.html)"));
@@ -154,7 +154,7 @@ void LogFileDialog::exportLogToTxt()
QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem(); QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem();
if(selectedItem) { if(selectedItem) {
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString()); QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to plain text"), QString fileName = QFileDialog::getSaveFileName(this, tr("Export PokerTH log file to plain text"),
QDir::homePath()+"/"+fi.baseName()+".txt", QDir::homePath()+"/"+fi.baseName()+".txt",
tr("PokerTH plain text log (*.txt)")); tr("PokerTH plain text log (*.txt)"));
@@ -170,7 +170,7 @@ void LogFileDialog::saveLogFileAs()
QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem(); QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem();
if(selectedItem) { if(selectedItem) {
QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString()); QFileInfo fi(selectedItem->data(0, Qt::UserRole).toString());
QString fileName = QFileDialog::getSaveFileName(this, tr("Save PokerTH log file"), QString fileName = QFileDialog::getSaveFileName(this, tr("Save PokerTH log file"),
QDir::homePath()+"/"+fi.baseName()+".pdb", QDir::homePath()+"/"+fi.baseName()+".pdb",
tr("PokerTH SQL log (*.pdb)")); tr("PokerTH SQL log (*.pdb)"));
@@ -185,19 +185,19 @@ void LogFileDialog::showLogFilePreview(ShowLogMode mode)
{ {
QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem(); QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem();
if(mode == INIT_VIEW) { if(mode == INIT_VIEW) {
ui->comboBox->blockSignals(TRUE); ui->comboBox->blockSignals(TRUE);
ui->comboBox->clear(); ui->comboBox->clear();
QList<int> gameIds = myGuiLog->getGameList(selectedItem->data(0, Qt::UserRole).toString()); QList<int> gameIds = myGuiLog->getGameList(selectedItem->data(0, Qt::UserRole).toString());
QList<int>::const_iterator it; QList<int>::const_iterator it;
for (it = gameIds.constBegin(); it != gameIds.constEnd(); ++it) { for (it = gameIds.constBegin(); it != gameIds.constEnd(); ++it) {
ui->comboBox->addItem(QString::number(*it)); ui->comboBox->addItem(QString::number(*it));
} }
ui->comboBox->blockSignals(FALSE); ui->comboBox->blockSignals(FALSE);
} }
if(selectedItem) { if(selectedItem) {
myGuiLog->showLog(selectedItem->data(0, Qt::UserRole).toString(), ui->textBrowser_logPreview, ui->comboBox->itemText(ui->comboBox->currentIndex()).toInt()); myGuiLog->showLog(selectedItem->data(0, Qt::UserRole).toString(), ui->textBrowser_logPreview, ui->comboBox->itemText(ui->comboBox->currentIndex()).toInt());
} }
QTextCursor cursor(ui->textBrowser_logPreview->textCursor()); QTextCursor cursor(ui->textBrowser_logPreview->textCursor());
@@ -209,9 +209,9 @@ void LogFileDialog::keyPressEvent ( QKeyEvent * event )
{ {
if (event->key() == Qt::Key_Delete ) { /*Delete*/ if (event->key() == Qt::Key_Delete ) { /*Delete*/
if(ui->treeWidget_logFiles->hasFocus()) { if(ui->treeWidget_logFiles->hasFocus()) {
ui->pushButton_deleteLog->click(); ui->pushButton_deleteLog->click();
} }
} }
} }
void LogFileDialog::uploadFile() void LogFileDialog::uploadFile()
@@ -237,21 +237,21 @@ void LogFileDialog::uploadInProgressAnimationStart()
//const QString buttonText(tr("Upload in progress")); //const QString buttonText(tr("Upload in progress"));
ui->pushButton_analyseLogfile->setDisabled(TRUE); ui->pushButton_analyseLogfile->setDisabled(TRUE);
QMovie *movie = new QMovie(":/gfx/loader.gif"); QMovie *movie = new QMovie(":/gfx/loader.gif");
ui->label_animation->setMovie(movie); ui->label_animation->setMovie(movie);
ui->label_animation->setMaximumWidth(32); ui->label_animation->setMaximumWidth(32);
ui->horizontalLayout_animation->setSpacing(-1); ui->horizontalLayout_animation->setSpacing(-1);
ui->label_animation->setGeometry(0,0,32,32); ui->label_animation->setGeometry(0,0,32,32);
movie->start(); movie->start();
} }
void LogFileDialog::uploadInProgressAnimationStop() void LogFileDialog::uploadInProgressAnimationStop()
{ {
ui->pushButton_analyseLogfile->setDisabled(FALSE); ui->pushButton_analyseLogfile->setDisabled(FALSE);
ui->label_animation->setMaximumWidth(0); ui->label_animation->setMaximumWidth(0);
ui->horizontalLayout_animation->setSpacing(0); ui->horizontalLayout_animation->setSpacing(0);
ui->label_animation->setGeometry(0,0,0,0); ui->label_animation->setGeometry(0,0,0,0);
} }
void LogFileDialog::showLogAnalysis(QString /*filename*/, QString returnMessage) void LogFileDialog::showLogAnalysis(QString /*filename*/, QString returnMessage)
+24 -17
View File
@@ -26,8 +26,9 @@
class UploaderThread; class UploaderThread;
namespace Ui { namespace Ui
class LogFileDialog; {
class LogFileDialog;
} }
enum ShowLogMode { INIT_VIEW, SELECTED_GAME }; enum ShowLogMode { INIT_VIEW, SELECTED_GAME };
@@ -39,12 +40,14 @@ class Callback;
class LogFileDialog : public QDialog, public UploadCallback class LogFileDialog : public QDialog, public UploadCallback
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit LogFileDialog(QWidget *parent = 0, ConfigFile *c = 0); explicit LogFileDialog(QWidget *parent = 0, ConfigFile *c = 0);
~LogFileDialog(); ~LogFileDialog();
void setGuiLog(guiLog *g) { myGuiLog = g; } void setGuiLog(guiLog *g) {
myGuiLog = g;
}
void exec(); void exec();
virtual void UploadCompleted(const std::string &filename, const std::string &returnMessage); virtual void UploadCompleted(const std::string &filename, const std::string &returnMessage);
@@ -60,25 +63,29 @@ public slots:
void exportLogToHtml(); void exportLogToHtml();
void exportLogToTxt(); void exportLogToTxt();
void saveLogFileAs(); void saveLogFileAs();
void showLogFilePreviewInit() {showLogFilePreview(INIT_VIEW); } void showLogFilePreviewInit() {
void showLogFilePreviewSelected() {showLogFilePreview(SELECTED_GAME); } showLogFilePreview(INIT_VIEW);
void showLogFilePreview(ShowLogMode); }
void keyPressEvent ( QKeyEvent * event ); void showLogFilePreviewSelected() {
void uploadFile(); showLogFilePreview(SELECTED_GAME);
void uploadInProgressAnimationStart(); }
void uploadInProgressAnimationStop(); void showLogFilePreview(ShowLogMode);
void keyPressEvent ( QKeyEvent * event );
void uploadFile();
void uploadInProgressAnimationStart();
void uploadInProgressAnimationStop();
void showLogAnalysis(QString filename, QString returnMessage); void showLogAnalysis(QString filename, QString returnMessage);
void showUploadError(QString filename, QString errorMessage); void showUploadError(QString filename, QString errorMessage);
private: private:
ConfigFile *myConfig; ConfigFile *myConfig;
guiLog *myGuiLog; guiLog *myGuiLog;
Ui::LogFileDialog *ui; Ui::LogFileDialog *ui;
int writer(char *data, size_t size, size_t nmemb,std::string *buffer); int writer(char *data, size_t size, size_t nmemb,std::string *buffer);
QFile file; QFile file;
QString id; QString id;
boost::shared_ptr<UploaderThread> uploader; boost::shared_ptr<UploaderThread> uploader;
}; };
#endif // LOGFILEDIALOG_H #endif // LOGFILEDIALOG_H
+32 -32
View File
@@ -2,22 +2,22 @@
#include <QMessageBox> #include <QMessageBox>
MyMessageBox::MyMessageBox(QWidget *parent) : MyMessageBox::MyMessageBox(QWidget *parent) :
QMessageBox(parent) QMessageBox(parent)
{ {
#ifdef ANDROID #ifdef ANDROID
this->setWindowModality(Qt::WindowModal); this->setWindowModality(Qt::WindowModal);
this->setWindowFlags(Qt::ToolTip); this->setWindowFlags(Qt::ToolTip);
this->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; }");
#endif #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(icon, title, text, buttons, parent, flags)
{ {
#ifdef ANDROID #ifdef ANDROID
this->setWindowModality(Qt::WindowModal); this->setWindowModality(Qt::WindowModal);
this->setWindowFlags(Qt::ToolTip); this->setWindowFlags(Qt::ToolTip);
this->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; }");
#endif #endif
} }
@@ -28,49 +28,49 @@ 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 #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 #endif
box.setDefaultButton(defaultButton); box.setDefaultButton(defaultButton);
return static_cast<QMessageBox::StandardButton>(box.exec()); return static_cast<QMessageBox::StandardButton>(box.exec());
} }
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 #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 #endif
box.setDefaultButton(defaultButton); box.setDefaultButton(defaultButton);
return static_cast<QMessageBox::StandardButton>(box.exec()); return static_cast<QMessageBox::StandardButton>(box.exec());
} }
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 #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 #endif
box.setDefaultButton(defaultButton); box.setDefaultButton(defaultButton);
return static_cast<QMessageBox::StandardButton>(box.exec()); return static_cast<QMessageBox::StandardButton>(box.exec());
} }
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 #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 #endif
box.setDefaultButton(defaultButton); box.setDefaultButton(defaultButton);
return static_cast<QMessageBox::StandardButton>(box.exec()); return static_cast<QMessageBox::StandardButton>(box.exec());
} }
+14 -14
View File
@@ -5,27 +5,27 @@
class MyMessageBox : public QMessageBox class MyMessageBox : public QMessageBox
{ {
Q_OBJECT Q_OBJECT
public: public:
MyMessageBox(QWidget *parent = 0); MyMessageBox(QWidget *parent = 0);
MyMessageBox(Icon icon, const QString &title, const QString &text, MyMessageBox(Icon icon, const QString &title, const QString &text,
QFlags<QMessageBox::StandardButton> buttons = QMessageBox::NoButton, QWidget *parent = 0, QFlags<QMessageBox::StandardButton> buttons = QMessageBox::NoButton, QWidget *parent = 0,
Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
~MyMessageBox(); ~MyMessageBox();
static QMessageBox::StandardButton information(QWidget *parent, const QString &title, static QMessageBox::StandardButton information(QWidget *parent, const QString &title,
const QString &text, QFlags<QMessageBox::StandardButton> buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); const QString &text, QFlags<QMessageBox::StandardButton> buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
static QMessageBox::StandardButton question(QWidget *parent, const QString &title, static QMessageBox::StandardButton question(QWidget *parent, const QString &title,
const QString &text, QFlags<QMessageBox::StandardButton> buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); const QString &text, QFlags<QMessageBox::StandardButton> buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
static QMessageBox::StandardButton warning(QWidget *parent, const QString &title, static QMessageBox::StandardButton warning(QWidget *parent, const QString &title,
const QString &text, QFlags<QMessageBox::StandardButton> buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); const QString &text, QFlags<QMessageBox::StandardButton> buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
static QMessageBox::StandardButton critical(QWidget *parent, const QString &title, static QMessageBox::StandardButton critical(QWidget *parent, const QString &title,
const QString &text, QFlags<QMessageBox::StandardButton> buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); const QString &text, QFlags<QMessageBox::StandardButton> buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
signals: signals:
@@ -25,18 +25,18 @@
#endif #endif
enum MESSAGE_CONTENT { enum MESSAGE_CONTENT {
NONE=0, //0: not set ;) NONE=0, //0: not set ;)
BACKTO_LOBBY_QUESTION, //1: leave lobby during online game: Question(Do you really wanna leave?) BACKTO_LOBBY_QUESTION, //1: leave lobby during online game: Question(Do you really wanna leave?)
INFO_AFTER_JOIN_INVITE_GAME, //2: join invite only game: Info(You can invite people with right click ...) INFO_AFTER_JOIN_INVITE_GAME, //2: join invite only game: Info(You can invite people with right click ...)
JOIN_INVITE_GAME_QUESTION, //3: reciev invite to game: Question(You've been invited to the game <b>%1</b> by <b>%2</b>.<br>Do you want to join this game?) JOIN_INVITE_GAME_QUESTION, //3: reciev invite to game: Question(You've been invited to the game <b>%1</b> by <b>%2</b>.<br>Do you want to join this game?)
INGNORE_PLAYER_QUESTION, //4: click ignore player: Question(Do you really want to put this player on ignore List?) INGNORE_PLAYER_QUESTION, //4: click ignore player: Question(Do you really want to put this player on ignore List?)
GT_VALUES_MISSING, //5: Selected game table style \"%1\" seems to be incomplete or defective. \n\nThe value(s) of: \n%2 \nis/are missing. GT_VALUES_MISSING, //5: Selected game table style \"%1\" seems to be incomplete or defective. \n\nThe value(s) of: \n%2 \nis/are missing.
CLOSE_GAMETABLE_QUESTION, //6: close gametable: Do you really wanna quit? CLOSE_GAMETABLE_QUESTION, //6: close gametable: Do you really wanna quit?
GT_PICS_MISSING, //7: One or more pictures from current game table style \"%1\" were not found: GT_PICS_MISSING, //7: One or more pictures from current game table style \"%1\" were not found:
GT_OUTDATED, //8: Selected game table style \"%1\" seems to be outdated. \nThe current PokerTH game table style version is GT_OUTDATED, //8: Selected game table style \"%1\" seems to be outdated. \nThe current PokerTH game table style version is
CD_VALUES_MISSING, //9: CD_VALUES_MISSING, //9:
CD_PICS_MISSING, //10: CD_PICS_MISSING, //10:
CD_OUTDATED //11: CD_OUTDATED //11:
}; };
@@ -100,12 +100,10 @@ bool newGameDialogImpl::eventFilter(QObject *obj, QEvent *event)
} }
event->ignore(); event->ignore();
return false; return false;
} } else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Back) {
this->reject(); this->reject();
return true; return true;
} } else {
else {
// pass the event on to the parent class // pass the event on to the parent class
return QDialog::eventFilter(obj, event); return QDialog::eventFilter(obj, event);
} }
@@ -42,7 +42,7 @@ public:
return myChangeCompleteBlindsDialog; return myChangeCompleteBlindsDialog;
} }
bool eventFilter(QObject *obj, QEvent *event); bool eventFilter(QObject *obj, QEvent *event);
public slots: public slots:
@@ -48,8 +48,8 @@ void manualBlindsOrderDialogImpl::addBlindValueToList()
if(listWidget_blinds->count() == 30) { if(listWidget_blinds->count() == 30) {
MyMessageBox::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 {
listWidget_blinds->addItem(QString::number(spinBox_input->value(),10)); listWidget_blinds->addItem(QString::number(spinBox_input->value(),10));
sortBlindsList(); sortBlindsList();
@@ -239,8 +239,8 @@ void selectAvatarDialogImpl::isAccepted()
if(groupBox->isChecked()) { if(groupBox->isChecked()) {
if(myItemList.size() == 0) { if(myItemList.size() == 0) {
MyMessageBox::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;
} else settingsCorrect = TRUE;; } else settingsCorrect = TRUE;;
} }
@@ -254,18 +254,18 @@ void selectAvatarDialogImpl::isAccepted()
settingsCorrect = TRUE; settingsCorrect = TRUE;
} else { } else {
MyMessageBox::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);
settingsCorrect = FALSE; settingsCorrect = FALSE;
externalAvatar = ""; externalAvatar = "";
} }
} else { } else {
MyMessageBox::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);
settingsCorrect = FALSE; settingsCorrect = FALSE;
externalAvatar = ""; externalAvatar = "";
} }
@@ -37,11 +37,11 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva
setupUi(this); setupUi(this);
#ifdef ANDROID #ifdef ANDROID
stackedWidget->removeWidget(page_styles); stackedWidget->removeWidget(page_styles);
listWidget->takeItem(1); listWidget->takeItem(1);
label_soundvol->hide(); label_soundvol->hide();
label_soundVolume->hide(); label_soundVolume->hide();
horizontalSlider_soundVolume->hide(); horizontalSlider_soundVolume->hide();
#endif #endif
myManualBlindsOrderDialog = new manualBlindsOrderDialogImpl; myManualBlindsOrderDialog = new manualBlindsOrderDialogImpl;
@@ -131,8 +131,8 @@ settingsDialogImpl::settingsDialogImpl(QWidget *parent, ConfigFile *c, selectAva
connect( pushButton_internetGameRemoveIgnoredPlayer, SIGNAL( clicked()), this, SLOT( removePlayerFromIgnoredPlayersList())); connect( pushButton_internetGameRemoveIgnoredPlayer, SIGNAL( clicked()), this, SLOT( removePlayerFromIgnoredPlayersList()));
#ifdef GUI_800x480 #ifdef GUI_800x480
//make the scrollbar touchable for mobile guis //make the scrollbar touchable for mobile guis
comboBox_switchLanguage->setStyleSheet("QObject {font: 30px} QScrollBar:vertical { border: 1px solid grey; background: white; width: 60px; margin: 0px -1px 0px 0px; } QScrollBar::handle:vertical { border-radius: 3px; border: 2px solid grey; background: LightGrey ; min-height: 60px; } QScrollBar::add-line:vertical { background: none; } QScrollBar::sub-line:vertical { background: none; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical { background: none; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }"); comboBox_switchLanguage->setStyleSheet("QObject {font: 30px} QScrollBar:vertical { border: 1px solid grey; background: white; width: 60px; margin: 0px -1px 0px 0px; } QScrollBar::handle:vertical { border-radius: 3px; border: 2px solid grey; background: LightGrey ; min-height: 60px; } QScrollBar::add-line:vertical { background: none; } QScrollBar::sub-line:vertical { background: none; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical { background: none; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }");
#endif #endif
} }
@@ -211,10 +211,10 @@ void settingsDialogImpl::prepareDialog()
checkBox_useIpv6->setChecked(myConfig->readConfigInt("ServerUseIpv6")); checkBox_useIpv6->setChecked(myConfig->readConfigInt("ServerUseIpv6"));
checkBox_useSctp->setChecked(myConfig->readConfigInt("ServerUseSctp")); checkBox_useSctp->setChecked(myConfig->readConfigInt("ServerUseSctp"));
//Internet Game Settings //Internet Game Settings
checkBox_InternetServerUseSctp->hide(); //temporarely disabled until sctp support is back checkBox_InternetServerUseSctp->hide(); //temporarely disabled until sctp support is back
label_whatIsSctp->hide(); label_whatIsSctp->hide();
lineEdit_InternetServerListAddress->setText(QString::fromUtf8(myConfig->readConfigString("InternetServerListAddress").c_str())); lineEdit_InternetServerListAddress->setText(QString::fromUtf8(myConfig->readConfigString("InternetServerListAddress").c_str()));
lineEdit_InternetServerAddress->setText(QString::fromUtf8(myConfig->readConfigString("InternetServerAddress").c_str())); lineEdit_InternetServerAddress->setText(QString::fromUtf8(myConfig->readConfigString("InternetServerAddress").c_str()));
@@ -237,11 +237,11 @@ void settingsDialogImpl::prepareDialog()
checkBox_InetGane_AutoLeaveTheTableAfterGameFinished->setChecked(myConfig->readConfigInt("NetAutoLeaveGameAfterFinish")); checkBox_InetGane_AutoLeaveTheTableAfterGameFinished->setChecked(myConfig->readConfigInt("NetAutoLeaveGameAfterFinish"));
comboBox_internetGameType->setCurrentIndex(myConfig->readConfigInt("InternetGameType")); comboBox_internetGameType->setCurrentIndex(myConfig->readConfigInt("InternetGameType"));
lineEdit_internetGameName->setText(QString::fromUtf8(myConfig->readConfigString("InternetGameName").c_str())); lineEdit_internetGameName->setText(QString::fromUtf8(myConfig->readConfigString("InternetGameName").c_str()));
if(myConfig->readConfigInt("InternetServerConfigMode")) { if(myConfig->readConfigInt("InternetServerConfigMode")) {
groupBox_manualServerConfig->setChecked(TRUE); groupBox_manualServerConfig->setChecked(TRUE);
} else { } else {
groupBox_automaticServerConfig->setChecked(TRUE); groupBox_automaticServerConfig->setChecked(TRUE);
} }
std::list<std::string> playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList"); std::list<std::string> playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList");
std::list<std::string>::iterator it5; std::list<std::string>::iterator it5;
@@ -275,21 +275,21 @@ void settingsDialogImpl::prepareDialog()
#ifdef GUI_800x480 #ifdef GUI_800x480
// define PokerTH default GameTableStyle for Maemo // define PokerTH default GameTableStyle for Maemo
treeWidget_gameTableStyles->clear(); treeWidget_gameTableStyles->clear();
QString filename; QString filename;
#ifdef MAEMO #ifdef MAEMO
filename = "defaulttablestyle_800x480.xml"; filename = "defaulttablestyle_800x480.xml";
#elif ANDROID #elif ANDROID
filename = "android_tablestyle_800x480.xml"; filename = "android_tablestyle_800x480.xml";
#endif #endif
GameTableStyleReader defaultTableStyle(myConfig, this); GameTableStyleReader defaultTableStyle(myConfig, this);
defaultTableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default_800x480/"+filename); defaultTableStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default_800x480/"+filename);
if(defaultTableStyle.getLoadedSuccessfull()) { if(defaultTableStyle.getLoadedSuccessfull()) {
QStringList tempStringList1; QStringList tempStringList1;
tempStringList1 << defaultTableStyle.getStyleDescription() << defaultTableStyle.getStyleMaintainerName(); tempStringList1 << defaultTableStyle.getStyleDescription() << defaultTableStyle.getStyleMaintainerName();
MyStyleListItem *defaultTableItem = new MyStyleListItem(tempStringList1, treeWidget_gameTableStyles); MyStyleListItem *defaultTableItem = new MyStyleListItem(tempStringList1, treeWidget_gameTableStyles);
defaultTableItem->setData(0, 15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default_800x480/"+filename); defaultTableItem->setData(0, 15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default_800x480/"+filename);
defaultTableItem->setData(0, 16, POKERTH_DISTRIBUTED_STYLE); defaultTableItem->setData(0, 16, POKERTH_DISTRIBUTED_STYLE);
defaultTableItem->setData(0, Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default_800x480/"+filename); defaultTableItem->setData(0, Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/gui/table/default_800x480/"+filename);
defaultTableItem->setData(2, Qt::ToolTipRole, defaultTableStyle.getMyStateToolTipInfo()); defaultTableItem->setData(2, Qt::ToolTipRole, defaultTableStyle.getMyStateToolTipInfo());
if(defaultTableStyle.getState()) defaultTableItem->setIcon(2, QIcon(":/gfx/emblem-important.png")); if(defaultTableStyle.getState()) defaultTableItem->setIcon(2, QIcon(":/gfx/emblem-important.png"));
else defaultTableItem->setIcon(2, QIcon(":/gfx/dialog_ok_apply.png")); else defaultTableItem->setIcon(2, QIcon(":/gfx/dialog_ok_apply.png"));
@@ -383,23 +383,23 @@ void settingsDialogImpl::prepareDialog()
showCurrentGameTableStylePreview(); showCurrentGameTableStylePreview();
//CARDS //CARDS
// define PokerTH 1.0 default carddeck // define PokerTH 1.0 default carddeck
treeWidget_cardDeckStyles->clear(); treeWidget_cardDeckStyles->clear();
CardDeckStyleReader defaultCardStyle10(myConfig, this); CardDeckStyleReader defaultCardStyle10(myConfig, this);
defaultCardStyle10.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default_800x480/defaultdeckstyle_800x480.xml"); defaultCardStyle10.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default_800x480/defaultdeckstyle_800x480.xml");
if(defaultCardStyle10.getLoadedSuccessfull()) { if(defaultCardStyle10.getLoadedSuccessfull()) {
QStringList tempStringList1; QStringList tempStringList1;
tempStringList1 << defaultCardStyle10.getStyleDescription() << defaultCardStyle10.getStyleMaintainerName(); tempStringList1 << defaultCardStyle10.getStyleDescription() << defaultCardStyle10.getStyleMaintainerName();
MyStyleListItem *defaultCardItem = new MyStyleListItem(tempStringList1, treeWidget_cardDeckStyles); MyStyleListItem *defaultCardItem = new MyStyleListItem(tempStringList1, treeWidget_cardDeckStyles);
defaultCardItem->setData(0, 15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default_800x480/defaultdeckstyle_800x480.xml"); defaultCardItem->setData(0, 15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default_800x480/defaultdeckstyle_800x480.xml");
defaultCardItem->setData(0, 16, POKERTH_DISTRIBUTED_STYLE); defaultCardItem->setData(0, 16, POKERTH_DISTRIBUTED_STYLE);
defaultCardItem->setData(0, Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default_800x480/defaultdeckstyle_800x480.xml"); defaultCardItem->setData(0, Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default_800x480/defaultdeckstyle_800x480.xml");
defaultCardItem->setData(2, Qt::ToolTipRole, defaultCardStyle10.getMyStateToolTipInfo()); defaultCardItem->setData(2, Qt::ToolTipRole, defaultCardStyle10.getMyStateToolTipInfo());
if(defaultCardStyle10.getState()) defaultCardItem->setIcon(2, QIcon(":/gfx/emblem-important.png")); if(defaultCardStyle10.getState()) defaultCardItem->setIcon(2, QIcon(":/gfx/emblem-important.png"));
else defaultCardItem->setIcon(2, QIcon(":/gfx/dialog_ok_apply.png")); else defaultCardItem->setIcon(2, QIcon(":/gfx/dialog_ok_apply.png"));
} }
#ifndef GUI_800x480 #ifndef GUI_800x480
//define PokerTH old default CardDeck //define PokerTH old default CardDeck
CardDeckStyleReader defaultCardStyle(myConfig, this); CardDeckStyleReader defaultCardStyle(myConfig, this);
defaultCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml"); defaultCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml");
if(defaultCardStyle.getLoadedSuccessfull()) { if(defaultCardStyle.getLoadedSuccessfull()) {
@@ -409,11 +409,11 @@ void settingsDialogImpl::prepareDialog()
defaultCardItem->setData(0, 15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml"); defaultCardItem->setData(0, 15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml");
defaultCardItem->setData(0, 16, POKERTH_DISTRIBUTED_STYLE); defaultCardItem->setData(0, 16, POKERTH_DISTRIBUTED_STYLE);
defaultCardItem->setData(0, Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml"); defaultCardItem->setData(0, Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default/defaultdeckstyle.xml");
defaultCardItem->setData(2, Qt::ToolTipRole, defaultCardStyle.getMyStateToolTipInfo()); defaultCardItem->setData(2, Qt::ToolTipRole, defaultCardStyle.getMyStateToolTipInfo());
if(defaultCardStyle.getState()) defaultCardItem->setIcon(2, QIcon(":/gfx/emblem-important.png")); if(defaultCardStyle.getState()) defaultCardItem->setIcon(2, QIcon(":/gfx/emblem-important.png"));
else defaultCardItem->setIcon(2, QIcon(":/gfx/dialog_ok_apply.png")); else defaultCardItem->setIcon(2, QIcon(":/gfx/dialog_ok_apply.png"));
} }
//define PokerTH old default CardDeck4c //define PokerTH old default CardDeck4c
CardDeckStyleReader default4cCardStyle(myConfig, this); CardDeckStyleReader default4cCardStyle(myConfig, this);
default4cCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml"); default4cCardStyle.readStyleFile(QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml");
if(default4cCardStyle.getLoadedSuccessfull()) { if(default4cCardStyle.getLoadedSuccessfull()) {
@@ -421,11 +421,11 @@ void settingsDialogImpl::prepareDialog()
tempStringList1 << default4cCardStyle.getStyleDescription() << default4cCardStyle.getStyleMaintainerName(); tempStringList1 << default4cCardStyle.getStyleDescription() << default4cCardStyle.getStyleMaintainerName();
MyStyleListItem *default4cCardItem = new MyStyleListItem(tempStringList1, treeWidget_cardDeckStyles); MyStyleListItem *default4cCardItem = new MyStyleListItem(tempStringList1, treeWidget_cardDeckStyles);
default4cCardItem->setData(0, 15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml"); default4cCardItem->setData(0, 15, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml");
default4cCardItem->setData(0, 16, POKERTH_DISTRIBUTED_STYLE); default4cCardItem->setData(0, 16, POKERTH_DISTRIBUTED_STYLE);
default4cCardItem->setData(0, Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml"); default4cCardItem->setData(0, Qt::ToolTipRole, QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default4c/default4cdeckstyle.xml");
default4cCardItem->setData(2, Qt::ToolTipRole, default4cCardStyle.getMyStateToolTipInfo()); default4cCardItem->setData(2, Qt::ToolTipRole, default4cCardStyle.getMyStateToolTipInfo());
if(default4cCardStyle.getState()) default4cCardItem->setIcon(2, QIcon(":/gfx/emblem-important.png")); if(default4cCardStyle.getState()) default4cCardItem->setIcon(2, QIcon(":/gfx/emblem-important.png"));
else default4cCardItem->setIcon(2, QIcon(":/gfx/dialog_ok_apply.png")); else default4cCardItem->setIcon(2, QIcon(":/gfx/dialog_ok_apply.png"));
} }
#endif #endif
//load secondary card styles into list (if fallback no entry) //load secondary card styles into list (if fallback no entry)
@@ -441,9 +441,9 @@ void settingsDialogImpl::prepareDialog()
nextItem->setData(0, 15,QString::fromUtf8(it2->c_str())); nextItem->setData(0, 15,QString::fromUtf8(it2->c_str()));
nextItem->setData(0, 16, ADDITIONAL_STYLE); nextItem->setData(0, 16, ADDITIONAL_STYLE);
nextItem->setData(0, Qt::ToolTipRole,QString::fromUtf8(it2->c_str())); nextItem->setData(0, Qt::ToolTipRole,QString::fromUtf8(it2->c_str()));
nextItem->setData(2, Qt::ToolTipRole, nextStyle.getMyStateToolTipInfo()); nextItem->setData(2, Qt::ToolTipRole, nextStyle.getMyStateToolTipInfo());
if(nextStyle.getState()) nextItem->setIcon(2, QIcon(":/gfx/emblem-important.png")); if(nextStyle.getState()) nextItem->setIcon(2, QIcon(":/gfx/emblem-important.png"));
else nextItem->setIcon(2, QIcon(":/gfx/dialog_ok_apply.png")); else nextItem->setIcon(2, QIcon(":/gfx/dialog_ok_apply.png"));
treeWidget_cardDeckStyles->addTopLevelItem(nextItem); treeWidget_cardDeckStyles->addTopLevelItem(nextItem);
} }
} }
@@ -579,9 +579,9 @@ void settingsDialogImpl::isAccepted()
if(checkSetPlayerNicks.count() != 10) { if(checkSetPlayerNicks.count() != 10) {
MyMessageBox::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);
settingsCorrect = FALSE; settingsCorrect = FALSE;
} else { } else {
//save nicks and avatars //save nicks and avatars
@@ -660,9 +660,9 @@ void settingsDialogImpl::isAccepted()
myConfig->writeConfigString("InternetServerListAddress", lineEdit_InternetServerListAddress->text().toUtf8().constData()); myConfig->writeConfigString("InternetServerListAddress", lineEdit_InternetServerListAddress->text().toUtf8().constData());
} else { } else {
MyMessageBox::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);
settingsCorrect = FALSE; settingsCorrect = FALSE;
} }
} }
@@ -722,9 +722,9 @@ void settingsDialogImpl::isAccepted()
myConfig->writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toUtf8().constData()); myConfig->writeConfigString("FlipsideOwnFile", lineEdit_OwnFlipsideFilename->text().toUtf8().constData());
} else { } else {
MyMessageBox::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);
settingsCorrect = FALSE; settingsCorrect = FALSE;
} }
} }
@@ -782,9 +782,9 @@ void settingsDialogImpl::isAccepted()
myConfig->writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData()); myConfig->writeConfigString("LogDir", lineEdit_logDir->text().toUtf8().constData());
} else { } else {
MyMessageBox::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);
settingsCorrect = FALSE; settingsCorrect = FALSE;
} }
@@ -812,8 +812,8 @@ void settingsDialogImpl::isAccepted()
if(languageIsChanged) { if(languageIsChanged) {
MyMessageBox::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);
} }
//Wenn alles richtig eingegeben wurde --> Dialog schließen //Wenn alles richtig eingegeben wurde --> Dialog schließen
@@ -951,14 +951,14 @@ void settingsDialogImpl::setLogDir()
if(logDir.exists()) { if(logDir.exists()) {
lineEdit_logDir->setText(dir); lineEdit_logDir->setText(dir);
MyMessageBox::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 {
MyMessageBox::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);
} }
} }
} }
@@ -1059,8 +1059,8 @@ 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()) {
MyMessageBox::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);
} }
spinBox_firstSmallBlind->setMaximum(myManualBlindsList.front()); spinBox_firstSmallBlind->setMaximum(myManualBlindsList.front());
} else { } else {
@@ -1069,8 +1069,8 @@ 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()) {
MyMessageBox::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);
} }
spinBox_netFirstSmallBlind->setMaximum(myNetManualBlindsList.front()); spinBox_netFirstSmallBlind->setMaximum(myNetManualBlindsList.front());
} else { } else {
@@ -1187,8 +1187,8 @@ void settingsDialogImpl::addGameTableStyle()
if(fileNameAlreadyFound) { if(fileNameAlreadyFound) {
MyMessageBox::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 {
GameTableStyleReader newStyle(myConfig, this); GameTableStyleReader newStyle(myConfig, this);
newStyle.readStyleFile(fileName); newStyle.readStyleFile(fileName);
@@ -1210,8 +1210,8 @@ void settingsDialogImpl::addGameTableStyle()
if(newStyle.getState() != GT_STYLE_OK) newStyle.showErrorMessage(); if(newStyle.getState() != GT_STYLE_OK) newStyle.showErrorMessage();
} else { } else {
MyMessageBox::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);
} }
} }
//save current filepath //save current filepath
@@ -1313,8 +1313,8 @@ void settingsDialogImpl::addCardDeckStyle()
if(fileNameAlreadyFound) { if(fileNameAlreadyFound) {
MyMessageBox::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 {
CardDeckStyleReader newStyle(myConfig, this); CardDeckStyleReader newStyle(myConfig, this);
newStyle.readStyleFile(fileName); newStyle.readStyleFile(fileName);
@@ -1325,21 +1325,21 @@ void settingsDialogImpl::addCardDeckStyle()
newItem->setData(0, 15,fileName); newItem->setData(0, 15,fileName);
newItem->setData(0, 16, ADDITIONAL_STYLE); newItem->setData(0, 16, ADDITIONAL_STYLE);
newItem->setData(0, Qt::ToolTipRole,fileName); newItem->setData(0, Qt::ToolTipRole,fileName);
newItem->setData(2, Qt::ToolTipRole, newStyle.getMyStateToolTipInfo()); newItem->setData(2, Qt::ToolTipRole, newStyle.getMyStateToolTipInfo());
if(newStyle.getState() != CD_STYLE_OK) newItem->setIcon(2, QIcon(":/gfx/emblem-important.png")); if(newStyle.getState() != CD_STYLE_OK) newItem->setIcon(2, QIcon(":/gfx/emblem-important.png"));
else newItem->setIcon(2, QIcon(":/gfx/dialog-ok-apply.png")); else newItem->setIcon(2, QIcon(":/gfx/dialog-ok-apply.png"));
qDebug() << "settings: " << newStyle.getStyleDescription() << newStyle.getState(); qDebug() << "settings: " << newStyle.getStyleDescription() << newStyle.getState();
if(newStyle.getState() != CD_STYLE_OK) newStyle.showErrorMessage(); if(newStyle.getState() != CD_STYLE_OK) newStyle.showErrorMessage();
treeWidget_cardDeckStyles->addTopLevelItem(newItem); treeWidget_cardDeckStyles->addTopLevelItem(newItem);
treeWidget_cardDeckStyles->setCurrentItem(newItem); treeWidget_cardDeckStyles->setCurrentItem(newItem);
treeWidget_cardDeckStyles->sortItems(0, Qt::AscendingOrder); treeWidget_cardDeckStyles->sortItems(0, Qt::AscendingOrder);
} else { } else {
MyMessageBox::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);
} }
} }
//save current filepath //save current filepath
@@ -1376,9 +1376,9 @@ void settingsDialogImpl::removePlayerFromIgnoredPlayersList()
void settingsDialogImpl::resetSettings() void settingsDialogImpl::resetSettings()
{ {
int ret = MyMessageBox::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);
if(ret == QMessageBox::Yes) { if(ret == QMessageBox::Yes) {
myConfig->deleteConfigFile(); myConfig->deleteConfigFile();
exit(0); exit(0);
@@ -143,7 +143,7 @@ private:
bool calledIngame; bool calledIngame;
int changedLanguageIndex; int changedLanguageIndex;
guiLog *myGuiLog; guiLog *myGuiLog;
FlickCharm *fc; FlickCharm *fc;
}; };
#endif #endif
+1 -1
View File
@@ -2,7 +2,7 @@
#include "androidapi8dummy.h" #include "androidapi8dummy.h"
AndroidApi8Dummy::AndroidApi8Dummy(ConfigFile *c, QObject *parent) : AndroidApi8Dummy::AndroidApi8Dummy(ConfigFile *c, QObject *parent) :
QObject(parent), myConfig(c) QObject(parent), myConfig(c)
{ {
} }
+10 -10
View File
@@ -6,24 +6,24 @@ class ConfigFile;
class AndroidApi8Dummy : public QObject class AndroidApi8Dummy : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AndroidApi8Dummy(ConfigFile *c, QObject *parent = 0); explicit AndroidApi8Dummy(ConfigFile *c, QObject *parent = 0);
~AndroidApi8Dummy(); ~AndroidApi8Dummy();
signals: signals:
public slots: public slots:
void registerSound(const QString&, const QString&){} void registerSound(const QString&, const QString&) {}
void reallyPlaySound(const QString&){} void reallyPlaySound(const QString&) {}
void playSound(const std::string&, int){} void playSound(const std::string&, int) {}
void initAudio(){} void initAudio() {}
void closeAudio(){} void closeAudio() {}
void reInit(){} void reInit() {}
private: private:
ConfigFile *myConfig; ConfigFile *myConfig;
}; };
+116 -115
View File
@@ -5,103 +5,103 @@
#include <QDebug> #include <QDebug>
AndroidAudio::AndroidAudio(ConfigFile *c, QObject *parent) : AndroidAudio::AndroidAudio(ConfigFile *c, QObject *parent) :
QObject(parent), mEngineObject(NULL), mEngineEngine(NULL), mOutputMixObject(NULL), mSounds(), mSoundCount(0), mPlayerObject(NULL), myConfig(c), audioEnabled(FALSE) QObject(parent), mEngineObject(NULL), mEngineEngine(NULL), mOutputMixObject(NULL), mSounds(), mSoundCount(0), mPlayerObject(NULL), myConfig(c), audioEnabled(FALSE)
{ {
initAudio(); initAudio();
} }
AndroidAudio::~AndroidAudio() AndroidAudio::~AndroidAudio()
{ {
closeAudio(); closeAudio();
} }
void AndroidAudio::initAudio() void AndroidAudio::initAudio()
{ {
if (!audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) { if (!audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
createEngine(); createEngine();
startSoundPlayer(); startSoundPlayer();
audioEnabled = TRUE; audioEnabled = TRUE;
} }
} }
void AndroidAudio::closeAudio() void AndroidAudio::closeAudio()
{ {
if(audioEnabled) { if(audioEnabled) {
destroyEngine(); destroyEngine();
for (int32_t i = 0; i < mSoundCount; ++i) { for (int32_t i = 0; i < mSoundCount; ++i) {
qDeleteAll(mSounds); qDeleteAll(mSounds);
} }
audioEnabled = FALSE; audioEnabled = FALSE;
} }
} }
void AndroidAudio::reInit() void AndroidAudio::reInit()
{ {
initAudio(); initAudio();
} }
// create the engine and output mix objects // create the engine and output mix objects
void AndroidAudio::createEngine() void AndroidAudio::createEngine()
{ {
SLresult result; SLresult result;
// create engine // create engine
result = slCreateEngine(&mEngineObject, 0, NULL, 0, NULL, NULL); result = slCreateEngine(&mEngineObject, 0, NULL, 0, NULL, NULL);
Q_ASSERT(SL_RESULT_SUCCESS == result); Q_ASSERT(SL_RESULT_SUCCESS == result);
// realize the engine // realize the engine
result = (*mEngineObject)->Realize(mEngineObject, SL_BOOLEAN_FALSE); result = (*mEngineObject)->Realize(mEngineObject, SL_BOOLEAN_FALSE);
Q_ASSERT(SL_RESULT_SUCCESS == result); Q_ASSERT(SL_RESULT_SUCCESS == result);
// get the engine interface, which is needed in order to create other objects // get the engine interface, which is needed in order to create other objects
result = (*mEngineObject)->GetInterface(mEngineObject, SL_IID_ENGINE, &mEngineEngine); result = (*mEngineObject)->GetInterface(mEngineObject, SL_IID_ENGINE, &mEngineEngine);
Q_ASSERT(SL_RESULT_SUCCESS == result); Q_ASSERT(SL_RESULT_SUCCESS == result);
// create output mix // create output mix
const SLInterfaceID ids[] = {}; const SLInterfaceID ids[] = {};
const SLboolean req[] = {}; const SLboolean req[] = {};
result = (*mEngineEngine)->CreateOutputMix(mEngineEngine, &mOutputMixObject, 0, ids, req); result = (*mEngineEngine)->CreateOutputMix(mEngineEngine, &mOutputMixObject, 0, ids, req);
Q_ASSERT(SL_RESULT_SUCCESS == result); Q_ASSERT(SL_RESULT_SUCCESS == result);
// realize the output mix // realize the output mix
result = (*mOutputMixObject)->Realize(mOutputMixObject, SL_BOOLEAN_FALSE); result = (*mOutputMixObject)->Realize(mOutputMixObject, SL_BOOLEAN_FALSE);
Q_ASSERT(SL_RESULT_SUCCESS == result); Q_ASSERT(SL_RESULT_SUCCESS == result);
qDebug() << "Created Android Audio Engine"; qDebug() << "Created Android Audio Engine";
} }
void AndroidAudio::destroyEngine() void AndroidAudio::destroyEngine()
{ {
if (mOutputMixObject != NULL) { if (mOutputMixObject != NULL) {
(*mOutputMixObject)->Destroy(mOutputMixObject); (*mOutputMixObject)->Destroy(mOutputMixObject);
} }
if (mEngineObject != NULL) { if (mEngineObject != NULL) {
(*mEngineObject)->Destroy(mEngineObject); (*mEngineObject)->Destroy(mEngineObject);
} }
if (mPlayerObject != NULL) { if (mPlayerObject != NULL) {
(*mPlayerObject)->Destroy(mPlayerObject); (*mPlayerObject)->Destroy(mPlayerObject);
} }
for (int32_t i = 0; i < mSoundCount; ++i) { for (int32_t i = 0; i < mSoundCount; ++i) {
mSounds.values().at(i)->unload(); mSounds.values().at(i)->unload();
} }
qDebug() << "Destroyed Android Audio Engine"; qDebug() << "Destroyed Android Audio Engine";
} }
void AndroidAudio::registerSound(const QString& path, const QString& name) void AndroidAudio::registerSound(const QString& path, const QString& name)
{ {
// qDebug() << "registerSound:" << path << name; // qDebug() << "registerSound:" << path << name;
AndroidSoundEffect *lSound = new AndroidSoundEffect(path, this); AndroidSoundEffect *lSound = new AndroidSoundEffect(path, this);
// qDebug() << "registerSound:created"; // qDebug() << "registerSound:created";
mSounds[name] = lSound; mSounds[name] = lSound;
// qDebug() << "registerSound:loading"; // qDebug() << "registerSound:loading";
lSound->load(); lSound->load();
// qDebug() << "registerSound:loaded"; // qDebug() << "registerSound:loaded";
} }
@@ -109,98 +109,99 @@ void AndroidAudio::startSoundPlayer()
{ {
// qDebug() << "Starting Sound Player"; // qDebug() << "Starting Sound Player";
SLresult lRes; SLresult lRes;
//Configure the sound player input/output //Configure the sound player input/output
SLDataLocator_AndroidSimpleBufferQueue lDataLocatorIn; SLDataLocator_AndroidSimpleBufferQueue lDataLocatorIn;
lDataLocatorIn.locatorType = SL_DATALOCATOR_BUFFERQUEUE; lDataLocatorIn.locatorType = SL_DATALOCATOR_BUFFERQUEUE;
lDataLocatorIn.numBuffers = 1; lDataLocatorIn.numBuffers = 1;
//Set the data format as mono-pcm-16bit-44100 //Set the data format as mono-pcm-16bit-44100
SLDataFormat_PCM lDataFormat; SLDataFormat_PCM lDataFormat;
lDataFormat.formatType = SL_DATAFORMAT_PCM; lDataFormat.formatType = SL_DATAFORMAT_PCM;
lDataFormat.numChannels = 2; lDataFormat.numChannels = 2;
lDataFormat.samplesPerSec = SL_SAMPLINGRATE_44_1; lDataFormat.samplesPerSec = SL_SAMPLINGRATE_44_1;
lDataFormat.bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16; lDataFormat.bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16;
lDataFormat.containerSize = SL_PCMSAMPLEFORMAT_FIXED_16; lDataFormat.containerSize = SL_PCMSAMPLEFORMAT_FIXED_16;
lDataFormat.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT; lDataFormat.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT;
lDataFormat.endianness = SL_BYTEORDER_LITTLEENDIAN; lDataFormat.endianness = SL_BYTEORDER_LITTLEENDIAN;
SLDataSource lDataSource; SLDataSource lDataSource;
lDataSource.pLocator = &lDataLocatorIn; lDataSource.pLocator = &lDataLocatorIn;
lDataSource.pFormat = &lDataFormat; lDataSource.pFormat = &lDataFormat;
SLDataLocator_OutputMix lDataLocatorOut; SLDataLocator_OutputMix lDataLocatorOut;
lDataLocatorOut.locatorType = SL_DATALOCATOR_OUTPUTMIX; lDataLocatorOut.locatorType = SL_DATALOCATOR_OUTPUTMIX;
lDataLocatorOut.outputMix = mOutputMixObject; lDataLocatorOut.outputMix = mOutputMixObject;
SLDataSink lDataSink; SLDataSink lDataSink;
lDataSink.pLocator = &lDataLocatorOut; lDataSink.pLocator = &lDataLocatorOut;
lDataSink.pFormat = NULL; lDataSink.pFormat = NULL;
//Create the sound player //Create the sound player
const SLuint32 lSoundPlayerIIDCount = 2; const SLuint32 lSoundPlayerIIDCount = 2;
const SLInterfaceID lSoundPlayerIIDs[] = { SL_IID_PLAY, SL_IID_BUFFERQUEUE }; const SLInterfaceID lSoundPlayerIIDs[] = { SL_IID_PLAY, SL_IID_BUFFERQUEUE };
const SLboolean lSoundPlayerReqs[] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE }; const SLboolean lSoundPlayerReqs[] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE };
// qDebug() << "Configured Sound Player"; // qDebug() << "Configured Sound Player";
lRes = (*mEngineEngine)->CreateAudioPlayer(mEngineEngine, &mPlayerObject, &lDataSource, &lDataSink, lSoundPlayerIIDCount, lSoundPlayerIIDs, lSoundPlayerReqs); lRes = (*mEngineEngine)->CreateAudioPlayer(mEngineEngine, &mPlayerObject, &lDataSource, &lDataSink, lSoundPlayerIIDCount, lSoundPlayerIIDs, lSoundPlayerReqs);
Q_ASSERT(SL_RESULT_SUCCESS == lRes); Q_ASSERT(SL_RESULT_SUCCESS == lRes);
// qDebug() << "Created Sound Player"; // qDebug() << "Created Sound Player";
lRes = (*mPlayerObject)->Realize(mPlayerObject, SL_BOOLEAN_FALSE); lRes = (*mPlayerObject)->Realize(mPlayerObject, SL_BOOLEAN_FALSE);
Q_ASSERT(SL_RESULT_SUCCESS == lRes); Q_ASSERT(SL_RESULT_SUCCESS == lRes);
qDebug() << "Realised Sound Player"; qDebug() << "Realised Sound Player";
lRes = (*mPlayerObject)->GetInterface(mPlayerObject, SL_IID_PLAY, &mPlayerPlay); lRes = (*mPlayerObject)->GetInterface(mPlayerObject, SL_IID_PLAY, &mPlayerPlay);
Q_ASSERT(SL_RESULT_SUCCESS == lRes); Q_ASSERT(SL_RESULT_SUCCESS == lRes);
lRes = (*mPlayerObject)->GetInterface(mPlayerObject, SL_IID_BUFFERQUEUE, &mPlayerQueue); lRes = (*mPlayerObject)->GetInterface(mPlayerObject, SL_IID_BUFFERQUEUE, &mPlayerQueue);
Q_ASSERT(SL_RESULT_SUCCESS == lRes); Q_ASSERT(SL_RESULT_SUCCESS == lRes);
lRes = (*mPlayerPlay)->SetPlayState(mPlayerPlay, SL_PLAYSTATE_PLAYING); lRes = (*mPlayerPlay)->SetPlayState(mPlayerPlay, SL_PLAYSTATE_PLAYING);
Q_ASSERT(SL_RESULT_SUCCESS == lRes); Q_ASSERT(SL_RESULT_SUCCESS == lRes);
// qDebug() << "Created Buffer Player"; // qDebug() << "Created Buffer Player";
} }
void AndroidAudio::playSound(const std::string& name, int i) { void AndroidAudio::playSound(const std::string& name, int i)
{
if(audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) { if(audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
this->registerSound(QString(":/android/android-data/sounds/default/"+QString::fromStdString(name)+".wav"), QString::fromStdString(name)); this->registerSound(QString(":/android/android-data/sounds/default/"+QString::fromStdString(name)+".wav"), QString::fromStdString(name));
this->reallyPlaySound(QString::fromStdString(name)); this->reallyPlaySound(QString::fromStdString(name));
} }
} }
void AndroidAudio::reallyPlaySound(const QString& name) void AndroidAudio::reallyPlaySound(const QString& name)
{ {
SLresult lRes; SLresult lRes;
SLuint32 lPlayerState; SLuint32 lPlayerState;
AndroidSoundEffect* sound = mSounds[name]; AndroidSoundEffect* sound = mSounds[name];
if (!sound) { if (!sound) {
qDebug() << "No such sound:" << name; qDebug() << "No such sound:" << name;
return; return;
} }
//Get the current state of the player //Get the current state of the player
(*mPlayerObject)->GetState(mPlayerObject, &lPlayerState); (*mPlayerObject)->GetState(mPlayerObject, &lPlayerState);
//If the player is realised //If the player is realised
if (lPlayerState == SL_OBJECT_STATE_REALIZED) { if (lPlayerState == SL_OBJECT_STATE_REALIZED) {
//Get the buffer and length of the effect //Get the buffer and length of the effect
int16_t* lBuffer = (int16_t *)sound->mBuffer; int16_t* lBuffer = (int16_t *)sound->mBuffer;
off_t lLength = sound->mLength; off_t lLength = sound->mLength;
//Remove any sound from the queue //Remove any sound from the queue
lRes = (*mPlayerQueue)->Clear(mPlayerQueue); lRes = (*mPlayerQueue)->Clear(mPlayerQueue);
Q_ASSERT(SL_RESULT_SUCCESS == lRes); Q_ASSERT(SL_RESULT_SUCCESS == lRes);
//Play the new sound //Play the new sound
(*mPlayerQueue)->Enqueue(mPlayerQueue, lBuffer, lLength); (*mPlayerQueue)->Enqueue(mPlayerQueue, lBuffer, lLength);
Q_ASSERT(SL_RESULT_SUCCESS == lRes); Q_ASSERT(SL_RESULT_SUCCESS == lRes);
} }
} }
+25 -25
View File
@@ -17,44 +17,44 @@ class ConfigFile;
class AndroidAudio : public QObject class AndroidAudio : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AndroidAudio(ConfigFile *c, QObject *parent = 0); explicit AndroidAudio(ConfigFile *c, QObject *parent = 0);
~AndroidAudio(); ~AndroidAudio();
signals: signals:
public slots: public slots:
void registerSound(const QString& path, const QString &name); void registerSound(const QString& path, const QString &name);
void reallyPlaySound(const QString& name); void reallyPlaySound(const QString& name);
void playSound(const std::string& name, int i); void playSound(const std::string& name, int i);
void initAudio(); void initAudio();
void closeAudio(); void closeAudio();
void reInit(); void reInit();
private: private:
void createEngine(); void createEngine();
void destroyEngine(); void destroyEngine();
void startSoundPlayer(); void startSoundPlayer();
// engine interfaces // engine interfaces
SLObjectItf mEngineObject; SLObjectItf mEngineObject;
SLEngineItf mEngineEngine; SLEngineItf mEngineEngine;
// output mix interfaces // output mix interfaces
SLObjectItf mOutputMixObject; SLObjectItf mOutputMixObject;
// buffer queue player interfaces - Effects // buffer queue player interfaces - Effects
SLObjectItf mPlayerObject; SLObjectItf mPlayerObject;
SLPlayItf mPlayerPlay; SLPlayItf mPlayerPlay;
SLBufferQueueItf mPlayerQueue; SLBufferQueueItf mPlayerQueue;
QMap<QString, AndroidSoundEffect*> mSounds; QMap<QString, AndroidSoundEffect*> mSounds;
int32_t mSoundCount; int32_t mSoundCount;
ConfigFile *myConfig; ConfigFile *myConfig;
bool audioEnabled; bool audioEnabled;
}; };
#endif // ANDROIDAUDIO_H #endif // ANDROIDAUDIO_H
+60 -60
View File
@@ -6,110 +6,110 @@
#include <QFile> #include <QFile>
AndroidSoundEffect::AndroidSoundEffect(const QString& path, QObject *parent) : AndroidSoundEffect::AndroidSoundEffect(const QString& path, QObject *parent) :
QObject(parent), mBuffer(NULL), mLength(0), mPath(path) QObject(parent), mBuffer(NULL), mLength(0), mPath(path)
{ {
} }
AndroidSoundEffect::~AndroidSoundEffect() AndroidSoundEffect::~AndroidSoundEffect()
{ {
this->unload(); this->unload();
} }
bool AndroidSoundEffect::load() bool AndroidSoundEffect::load()
{ {
QFile lSoundFile(mPath); QFile lSoundFile(mPath);
// qDebug() << "opening:" << mPath; // qDebug() << "opening:" << mPath;
if (!lSoundFile.open(QIODevice::ReadOnly)) { if (!lSoundFile.open(QIODevice::ReadOnly)) {
qDebug() << "Could not open: " << mPath; qDebug() << "Could not open: " << mPath;
return false; return false;
} }
// parse WAV file // parse WAV file
// qDebug() << " reading header:"; // qDebug() << " reading header:";
char id[4]; char id[4];
lSoundFile.read(id, 4); lSoundFile.read(id, 4);
if( strncmp(id, "RIFF", 4) != 0 ) { if( strncmp(id, "RIFF", 4) != 0 ) {
qDebug() << "not a WAV file - header not RIFF"; qDebug() << "not a WAV file - header not RIFF";
lSoundFile.close(); lSoundFile.close();
return false; return false;
} }
int size = 0; int size = 0;
lSoundFile.read((char *)&size, 4); lSoundFile.read((char *)&size, 4);
// qDebug() << " size:" << size; // qDebug() << " size:" << size;
lSoundFile.read(id, 4); lSoundFile.read(id, 4);
if( strncmp(id, "WAVE", 4) != 0 ) { if( strncmp(id, "WAVE", 4) != 0 ) {
qDebug() << "not a WAV file - header not WAVE"; qDebug() << "not a WAV file - header not WAVE";
lSoundFile.close(); lSoundFile.close();
return false; return false;
} }
lSoundFile.read(id, 4); // "fmt " lSoundFile.read(id, 4); // "fmt "
int format_length = 0; int format_length = 0;
lSoundFile.read((char *)&format_length, 4); lSoundFile.read((char *)&format_length, 4);
// qDebug() << " format_length:" << format_length; // qDebug() << " format_length:" << format_length;
short format_tag = 0; short format_tag = 0;
lSoundFile.read((char *)&format_tag, 2); lSoundFile.read((char *)&format_tag, 2);
short n_channels = 0; short n_channels = 0;
lSoundFile.read((char *)&n_channels, 2); lSoundFile.read((char *)&n_channels, 2);
// qDebug() << " n_channels:" << n_channels; // qDebug() << " n_channels:" << n_channels;
int sample_rate = 0; int sample_rate = 0;
lSoundFile.read((char *)&sample_rate, 4); lSoundFile.read((char *)&sample_rate, 4);
// qDebug() << " sample_rate:" << sample_rate; // qDebug() << " sample_rate:" << sample_rate;
int avg_bytes_sec = 0; int avg_bytes_sec = 0;
lSoundFile.read((char *)&avg_bytes_sec, 4); lSoundFile.read((char *)&avg_bytes_sec, 4);
// qDebug() << " avg_bytes_sec:" << avg_bytes_sec; // qDebug() << " avg_bytes_sec:" << avg_bytes_sec;
short block_align = 0; short block_align = 0;
lSoundFile.read((char *)&block_align, 2); lSoundFile.read((char *)&block_align, 2);
short bits_per_sample = 0; short bits_per_sample = 0;
lSoundFile.read((char *)&bits_per_sample, 2); lSoundFile.read((char *)&bits_per_sample, 2);
// qDebug() << " bits_per_sample:" << bits_per_sample; // qDebug() << " bits_per_sample:" << bits_per_sample;
lSoundFile.read(id, 4); lSoundFile.read(id, 4);
if( strncmp(id, "data", 4) != 0 ) { if( strncmp(id, "data", 4) != 0 ) {
qDebug() << "not a WAV file - didn't find data"; qDebug() << "not a WAV file - didn't find data";
lSoundFile.close(); lSoundFile.close();
return false; return false;
} }
lSoundFile.read((char *)&mLength, 4); lSoundFile.read((char *)&mLength, 4);
// qDebug() << " reading data:" << mLength; // qDebug() << " reading data:" << mLength;
mBuffer = (char*)malloc((mLength)); mBuffer = (char*)malloc((mLength));
int dataRead = lSoundFile.read(mBuffer, mLength); int dataRead = lSoundFile.read(mBuffer, mLength);
if (dataRead != mLength) { if (dataRead != mLength) {
qDebug() << "didn't read correct amount of data' :" << mPath; qDebug() << "didn't read correct amount of data' :" << mPath;
lSoundFile.close(); lSoundFile.close();
delete [] mBuffer; delete [] mBuffer;
mBuffer = NULL; mBuffer = NULL;
return false; return false;
} }
// qDebug() << " closing:"; // qDebug() << " closing:";
lSoundFile.close(); lSoundFile.close();
return true; return true;
} }
bool AndroidSoundEffect::unload() bool AndroidSoundEffect::unload()
{ {
delete[] mBuffer; delete[] mBuffer;
mBuffer = NULL; mBuffer = NULL;
mLength = 0; mLength = 0;
return true; return true;
} }
#endif #endif
+10 -10
View File
@@ -12,26 +12,26 @@
class AndroidSoundEffect : public QObject class AndroidSoundEffect : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AndroidSoundEffect(const QString& pPath, QObject *parent = 0); explicit AndroidSoundEffect(const QString& pPath, QObject *parent = 0);
~AndroidSoundEffect(); ~AndroidSoundEffect();
const char* getPath(); const char* getPath();
bool load(); bool load();
bool unload(); bool unload();
signals: signals:
public slots: public slots:
private: private:
char* mBuffer; char* mBuffer;
off_t mLength; off_t mLength;
QString mPath; QString mPath;
friend class AndroidAudio; friend class AndroidAudio;
}; };
#endif // ANDROIDSOUNDEFFECT_H #endif // ANDROIDSOUNDEFFECT_H
+94 -94
View File
@@ -26,128 +26,128 @@
using namespace std; using namespace std;
SDLPlayer::SDLPlayer(ConfigFile *c) SDLPlayer::SDLPlayer(ConfigFile *c)
: sound(NULL), soundData(NULL), currentChannel(0), audioEnabled(FALSE), myConfig(c) : sound(NULL), soundData(NULL), currentChannel(0), audioEnabled(FALSE), myConfig(c)
{ {
myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
SDL_Init(SDL_INIT_AUDIO); SDL_Init(SDL_INIT_AUDIO);
initAudio(); initAudio();
} }
SDLPlayer::~SDLPlayer() SDLPlayer::~SDLPlayer()
{ {
closeAudio(); closeAudio();
SDL_Quit(); SDL_Quit();
} }
void SDLPlayer::initAudio() void SDLPlayer::initAudio()
{ {
if (!audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) { if (!audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
int audio_rate = 44100; int audio_rate = 44100;
Uint16 audio_format = AUDIO_S16; /* 16-bit stereo */ Uint16 audio_format = AUDIO_S16; /* 16-bit stereo */
int audio_channels = 2; int audio_channels = 2;
int audio_buffers = 4096; int audio_buffers = 4096;
sound = NULL; sound = NULL;
if( Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) == 0) { if( Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) == 0) {
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels); Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
audioEnabled = 1; audioEnabled = 1;
} } else {
else { qDebug() << "Mix_OpenAudio() was not successfull, no sound possible :(";
qDebug() << "Mix_OpenAudio() was not successfull, no sound possible :("; }
} }
}
} }
void SDLPlayer::playSound(string audioString, int playerID) void SDLPlayer::playSound(string audioString, int playerID)
{ {
if(audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) { if(audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
QFile myFile(myAppDataPath + "sounds/default/" + QString::fromStdString(audioString)+".wav"); QFile myFile(myAppDataPath + "sounds/default/" + QString::fromStdString(audioString)+".wav");
if(myFile.open(QIODevice::ReadOnly)) { if(myFile.open(QIODevice::ReadOnly)) {
//set 3d position for player //set 3d position for player
int position = 0; int position = 0;
int distance = 0; int distance = 0;
switch (playerID) { switch (playerID) {
case 0: { case 0: {
position = 180; position = 180;
distance = 10; distance = 10;
} }
break; break;
case 1: { case 1: {
position = 281; position = 281;
distance = 50; distance = 50;
} }
break; break;
case 2: { case 2: {
position = 315; position = 315;
distance = 120; distance = 120;
} }
break; break;
case 3: { case 3: {
position = 338; position = 338;
distance = 160; distance = 160;
} }
break; break;
case 4: { case 4: {
position = 23; position = 23;
distance = 160; distance = 160;
} }
break; break;
case 5: { case 5: {
position = 45; position = 45;
distance = 120; distance = 120;
} }
break; break;
case 6: { case 6: {
position = 79; position = 79;
distance = 50; distance = 50;
} }
break; break;
default: { default: {
position = 0; position = 0;
distance = 0; distance = 0;
} }
break; break;
} }
QDataStream in(&myFile); QDataStream in(&myFile);
soundData = new Uint8[(int)myFile.size()]; soundData = new Uint8[(int)myFile.size()];
in.readRawData( (char*)soundData, (int)myFile.size() ); in.readRawData( (char*)soundData, (int)myFile.size() );
sound = Mix_QuickLoad_WAV(soundData); sound = Mix_QuickLoad_WAV(soundData);
// set channel 0 to settings volume // set channel 0 to settings volume
Mix_Volume(-1,myConfig->readConfigInt("SoundVolume")*10); Mix_Volume(-1,myConfig->readConfigInt("SoundVolume")*10);
// set 3d effect // set 3d effect
if(!Mix_SetPosition(0, position, distance)) { if(!Mix_SetPosition(0, position, distance)) {
printf("Mix_SetPosition: %s\n", Mix_GetError()); printf("Mix_SetPosition: %s\n", Mix_GetError());
// no position effect, is it ok? // no position effect, is it ok?
} }
currentChannel = Mix_PlayChannel(-1, sound,0); currentChannel = Mix_PlayChannel(-1, sound,0);
} }
} }
} }
void SDLPlayer::closeAudio() void SDLPlayer::closeAudio()
{ if(audioEnabled) { {
Mix_HaltChannel(currentChannel); if(audioEnabled) {
Mix_FreeChunk(sound); Mix_HaltChannel(currentChannel);
sound = NULL; Mix_FreeChunk(sound);
delete[] soundData; sound = NULL;
soundData = NULL; delete[] soundData;
Mix_CloseAudio(); soundData = NULL;
qDebug() << "Mix_CloseAudio()"; Mix_CloseAudio();
audioEnabled = false; qDebug() << "Mix_CloseAudio()";
} audioEnabled = false;
}
} }
void SDLPlayer::reInit() void SDLPlayer::reInit()
{ {
closeAudio(); closeAudio();
initAudio(); initAudio();
} }
+4 -4
View File
@@ -29,7 +29,7 @@
#include <SDL/SDL_mixer.h> #include <SDL/SDL_mixer.h>
#endif #endif
struct Mix_Chunk; struct Mix_Chunk;
/** /**
@author FThauer FHammer <webmaster@pokerth.net> @author FThauer FHammer <webmaster@pokerth.net>
@@ -46,13 +46,13 @@ public:
void initAudio(); void initAudio();
void playSound(std::string, int playerID); void playSound(std::string, int playerID);
void closeAudio(); void closeAudio();
void reInit(); void reInit();
private: private:
Mix_Chunk *sound; Mix_Chunk *sound;
unsigned char *soundData; unsigned char *soundData;
int currentChannel; int currentChannel;
bool audioEnabled; bool audioEnabled;
ConfigFile *myConfig; ConfigFile *myConfig;
QString myAppDataPath; QString myAppDataPath;
}; };
+18 -18
View File
@@ -1,13 +1,13 @@
#include "soundevents.h" #include "soundevents.h"
#ifdef ANDROID #ifdef ANDROID
#ifdef ANDROID_API8 #ifdef ANDROID_API8
#include "androidapi8dummy.h" #include "androidapi8dummy.h"
#else
#include "androidaudio.h"
#endif
#else #else
#include "sdlplayer.h" #include "androidaudio.h"
#endif
#else
#include "sdlplayer.h"
#endif #endif
@@ -22,25 +22,25 @@ SoundEvents::SoundEvents(ConfigFile *c): myConfig(c), lastSBValue(0), lastSBLeve
{ {
#ifdef ANDROID #ifdef ANDROID
#ifdef ANDROID_API8 #ifdef ANDROID_API8
myPlayer = new AndroidApi8Dummy(myConfig); myPlayer = new AndroidApi8Dummy(myConfig);
#else
myPlayer = new AndroidAudio(myConfig);
#endif
#else #else
myPlayer = new SDLPlayer(myConfig); myPlayer = new AndroidAudio(myConfig);
#endif
#else
myPlayer = new SDLPlayer(myConfig);
#endif #endif
} }
SoundEvents::~SoundEvents() SoundEvents::~SoundEvents()
{ {
myPlayer->deleteLater(); myPlayer->deleteLater();
} }
void SoundEvents::reInitSoundEngine() void SoundEvents::reInitSoundEngine()
{ {
myPlayer->reInit(); myPlayer->reInit();
} }
void SoundEvents::blindsWereSet(int sB) void SoundEvents::blindsWereSet(int sB)
@@ -58,13 +58,13 @@ void SoundEvents::blindsWereSet(int sB)
if(myConfig->readConfigInt("PlayBlindRaiseNotification")) { if(myConfig->readConfigInt("PlayBlindRaiseNotification")) {
if(lastSBLevel == 1 || lastSBLevel == 2) { if(lastSBLevel == 1 || lastSBLevel == 2) {
myPlayer->playSound("blinds_raises_level1", 0); myPlayer->playSound("blinds_raises_level1", 0);
} }
if(lastSBLevel == 3 || lastSBLevel == 4) { if(lastSBLevel == 3 || lastSBLevel == 4) {
myPlayer->playSound("blinds_raises_level2", 0); myPlayer->playSound("blinds_raises_level2", 0);
} }
if(lastSBLevel >= 5) { if(lastSBLevel >= 5) {
myPlayer->playSound("blinds_raises_level3", 0); myPlayer->playSound("blinds_raises_level3", 0);
} }
} }
} }
@@ -78,5 +78,5 @@ void SoundEvents::newGameStarts()
//HACK until playSound is done by events //HACK until playSound is done by events
void SoundEvents::playSound(std::string audioString, int playerID) void SoundEvents::playSound(std::string audioString, int playerID)
{ {
myPlayer->playSound(audioString, playerID); myPlayer->playSound(audioString, playerID);
} }
+14 -14
View File
@@ -4,13 +4,13 @@
#include <string> #include <string>
#ifdef ANDROID #ifdef ANDROID
#ifdef ANDROID_API8 #ifdef ANDROID_API8
class AndroidApi8Dummy; class AndroidApi8Dummy;
#else
class AndroidAudio;
#endif
#else #else
class SDLPlayer; class AndroidAudio;
#endif
#else
class SDLPlayer;
#endif #endif
@@ -23,8 +23,8 @@ public:
void blindsWereSet(int sB); void blindsWereSet(int sB);
void newGameStarts(); void newGameStarts();
void playSound(std::string audioString, int playerID); void playSound(std::string audioString, int playerID);
void reInitSoundEngine(); void reInitSoundEngine();
protected: protected:
// Prevent copy construction. // Prevent copy construction.
@@ -34,13 +34,13 @@ protected:
private: private:
#ifdef ANDROID #ifdef ANDROID
#ifdef ANDROID_API8 #ifdef ANDROID_API8
AndroidApi8Dummy *myPlayer; AndroidApi8Dummy *myPlayer;
#else
AndroidAudio *myPlayer;
#endif
#else #else
SDLPlayer *myPlayer; AndroidAudio *myPlayer;
#endif
#else
SDLPlayer *myPlayer;
#endif #endif
ConfigFile *myConfig; ConfigFile *myConfig;
int lastSBValue; int lastSBValue;
@@ -94,9 +94,9 @@ void startNetworkGameDialogImpl::addConnectedPlayer(unsigned playerId, QString p
if(this->isVisible() && myConfig->readConfigInt("PlayNetworkGameNotification")) { if(this->isVisible() && myConfig->readConfigInt("PlayNetworkGameNotification")) {
if(treeWidget->topLevelItemCount() < info.data.maxNumberOfPlayers) { if(treeWidget->topLevelItemCount() < info.data.maxNumberOfPlayers) {
myW->getMySoundEventHandler()->playSound("playerconnected", 0); myW->getMySoundEventHandler()->playSound("playerconnected", 0);
} else { } else {
myW->getMySoundEventHandler()->playSound("onlinegameready", 0); myW->getMySoundEventHandler()->playSound("onlinegameready", 0);
} }
} }
@@ -161,8 +161,8 @@ void startNetworkGameDialogImpl::kickPlayer()
if(playerName == QString::fromUtf8(myConfig->readConfigString("MyName").c_str())) { if(playerName == QString::fromUtf8(myConfig->readConfigString("MyName").c_str())) {
{ {
MyMessageBox::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);
} }
} else { } else {
assert(mySession); assert(mySession);
+209 -211
View File
@@ -70,53 +70,51 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
this->installEventFilter(this); this->installEventFilter(this);
//Widgets Grafiken per Stylesheets setzen //Widgets Grafiken per Stylesheets setzen
QString myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); QString myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
this->setWindowIcon(QIcon(myAppDataPath+"gfx/gui/misc/windowicon.png")); this->setWindowIcon(QIcon(myAppDataPath+"gfx/gui/misc/windowicon.png"));
this->setStatusBar(0); this->setStatusBar(0);
#ifdef GUI_800x480 #ifdef GUI_800x480
#ifdef ANDROID #ifdef ANDROID
this->menubar->hide(); this->menubar->hide();
//check if custom background picture for the resolution is there. Otherwise create it! //check if custom background picture for the resolution is there. Otherwise create it!
QString UserDataDir = QString::fromUtf8(myConfig->readConfigString("UserDataDir").c_str()); QString UserDataDir = QString::fromUtf8(myConfig->readConfigString("UserDataDir").c_str());
QDesktopWidget dw; QDesktopWidget dw;
int screenWidth = dw.screenGeometry().width(); int screenWidth = dw.screenGeometry().width();
int screenHeight = dw.screenGeometry().height(); int screenHeight = dw.screenGeometry().height();
QString customStartWindowBgFileString(UserDataDir+"/startwindowbg_"+QString::number(screenWidth)+"x"+QString::number(screenHeight)+".png"); QString customStartWindowBgFileString(UserDataDir+"/startwindowbg_"+QString::number(screenWidth)+"x"+QString::number(screenHeight)+".png");
QFile customStartWindowBgFile(customStartWindowBgFileString); QFile customStartWindowBgFile(customStartWindowBgFileString);
if(customStartWindowBgFile.exists()) { if(customStartWindowBgFile.exists()) {
centralwidget->setStyleSheet(".QWidget { background-image: url("+QFileInfo(customStartWindowBgFile).absoluteFilePath()+"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}"); centralwidget->setStyleSheet(".QWidget { background-image: url("+QFileInfo(customStartWindowBgFile).absoluteFilePath()+"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
} } else {
else { QPixmap pix(":/android/android-data/gfx/gui/misc/startwindowbg_800x480.png");
QPixmap pix(":/android/android-data/gfx/gui/misc/startwindowbg_800x480.png"); pix = pix.scaled(screenWidth, screenHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
pix = pix.scaled(screenWidth, screenHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); if(pix.save(customStartWindowBgFileString)) {
if(pix.save(customStartWindowBgFileString)) { centralwidget->setStyleSheet(".QWidget { background-image: url("+QFileInfo(customStartWindowBgFile).absoluteFilePath()+"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
centralwidget->setStyleSheet(".QWidget { background-image: url("+QFileInfo(customStartWindowBgFile).absoluteFilePath()+"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}"); } else {
} centralwidget->setStyleSheet(".QWidget { background-image: url(:/android/android-data/gfx/gui/misc/startwindowbg_800x480.png); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
else { }
centralwidget->setStyleSheet(".QWidget { background-image: url(:/android/android-data/gfx/gui/misc/startwindowbg_800x480.png); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
}
} }
this->showFullScreen(); this->showFullScreen();
#else #else
// this->menubar->setStyleSheet("QMenuBar { background-color: #4B4B4B; font-size:20px; border-width: 0px;} QMenuBar::item { color: #F0F0F0; }"); // this->menubar->setStyleSheet("QMenuBar { background-color: #4B4B4B; font-size:20px; border-width: 0px;} QMenuBar::item { color: #F0F0F0; }");
this->menubar->hide(); this->menubar->hide();
centralwidget->setStyleSheet(".QWidget { background-image: url(\""+myAppDataPath+"gfx/gui/misc/startwindowbg_800x480.png\"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}"); centralwidget->setStyleSheet(".QWidget { background-image: url(\""+myAppDataPath+"gfx/gui/misc/startwindowbg_800x480.png\"); background-position: bottom center; background-origin: content; background-repeat: no-repeat;}");
#endif #endif
pushButtonStart_Local_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); pushButtonStart_Local_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}");
pushButtonInternet_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); pushButtonInternet_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}");
pushButton_Create_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); pushButton_Create_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}");
pushButton_Join_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); pushButton_Join_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}");
pushButton_about->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); pushButton_about->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}");
pushButton_configure->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); pushButton_configure->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}");
pushButton_Logs->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}"); pushButton_Logs->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 3px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:22px; border-width: 0px;}");
connect( pushButton_about, SIGNAL( clicked() ), this, SLOT( callAboutPokerthDialog() ) ); connect( pushButton_about, SIGNAL( clicked() ), this, SLOT( callAboutPokerthDialog() ) );
connect( pushButton_configure, SIGNAL( clicked() ), this, SLOT( callSettingsDialogFromStartwindow() ) ); connect( pushButton_configure, SIGNAL( clicked() ), this, SLOT( callSettingsDialogFromStartwindow() ) );
connect( pushButton_Logs, SIGNAL( clicked() ), this, SLOT( callLogFileDialog() ) ); connect( pushButton_Logs, SIGNAL( clicked() ), this, SLOT( callLogFileDialog() ) );
#else #else
this->menubar->setStyleSheet("QMenuBar { background-color: #4B4B4B; font-size:12px; border-width: 0px;} QMenuBar::item { color: #F0F0F0; }"); this->menubar->setStyleSheet("QMenuBar { background-color: #4B4B4B; font-size:12px; border-width: 0px;} QMenuBar::item { color: #F0F0F0; }");
@@ -127,8 +125,8 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l)
pushButton_Create_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 1px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:12px; border-width: 0px;}"); pushButton_Create_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 1px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:12px; border-width: 0px;}");
pushButton_Join_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 1px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:12px; border-width: 0px;}"); pushButton_Join_Network_Game->setStyleSheet("QPushButton { text-align:left; font-weight:bold; padding-left: 1px; padding-bottom: 3px; padding-top: 3px; padding-right: 3px; background-color: #4B4B4B; color: #F0F0F0; font-size:12px; border-width: 0px;}");
connect( actionAbout_PokerTH, SIGNAL( triggered() ), this, SLOT( callAboutPokerthDialog() ) ); connect( actionAbout_PokerTH, SIGNAL( triggered() ), this, SLOT( callAboutPokerthDialog() ) );
connect( actionConfigure_PokerTH, SIGNAL( triggered() ), this, SLOT( callSettingsDialogFromStartwindow() ) ); connect( actionConfigure_PokerTH, SIGNAL( triggered() ), this, SLOT( callSettingsDialogFromStartwindow() ) );
#endif #endif
@@ -243,7 +241,7 @@ void startWindowImpl::callNewGameDialog()
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")) { if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")) {
#ifdef ANDROID #ifdef ANDROID
myGuiInterface->getMyW()->hide(); myGuiInterface->getMyW()->hide();
#endif #endif
myNewGameDialog->exec(); myNewGameDialog->exec();
if (myNewGameDialog->result() == QDialog::Accepted ) { if (myNewGameDialog->result() == QDialog::Accepted ) {
@@ -440,7 +438,7 @@ void startWindowImpl::callRejoinPossibleDialog(unsigned gameId)
assert(mySession); assert(mySession);
GameInfo info(mySession->getClientGameInfo(gameId));*/ GameInfo info(mySession->getClientGameInfo(gameId));*/
MyMessageBox 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())));
@@ -684,165 +682,165 @@ 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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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);
} }
break; break;
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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox 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);
msgBox.exec(); msgBox.exec();
} }
break; break;
case ERR_NET_SERVER_FULL: { case ERR_NET_SERVER_FULL: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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);
} }
break; break;
case ERR_NET_PLAYER_NAME_IN_USE: { case ERR_NET_PLAYER_NAME_IN_USE: {
@@ -856,122 +854,122 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
} }
break; break;
case ERR_NET_INVALID_GAME_NAME: { case ERR_NET_INVALID_GAME_NAME: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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();
MyMessageBox::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();
MyMessageBox::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();
MyMessageBox::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();
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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);
} }
} }
// close dialogs // close dialogs
@@ -988,44 +986,44 @@ void startWindowImpl::networkNotification(int notificationId)
hideTimeoutDialog(); hideTimeoutDialog();
switch (notificationId) { switch (notificationId) {
case NTF_NET_JOIN_IP_BLOCKED: { case NTF_NET_JOIN_IP_BLOCKED: {
MyMessageBox::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(MyMessageBox::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();
} }
} }
break; break;
case NTF_NET_REMOVED_KICKED: { case NTF_NET_REMOVED_KICKED: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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);
} }
break; break;
case NTF_NET_JOIN_GAME_NAME_IN_USE: { case NTF_NET_JOIN_GAME_NAME_IN_USE: {
@@ -1045,27 +1043,27 @@ void startWindowImpl::networkNotification(int notificationId)
} }
break; break;
case NTF_NET_REMOVED_TIMEOUT: { case NTF_NET_REMOVED_TIMEOUT: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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: {
MyMessageBox::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);
} }
break; break;
case NTF_NET_NEW_RELEASE_AVAILABLE: { case NTF_NET_NEW_RELEASE_AVAILABLE: {
@@ -1095,8 +1093,8 @@ void startWindowImpl::networkNotification(int notificationId)
void startWindowImpl::networkMessage(QString msg) void startWindowImpl::networkMessage(QString msg)
{ {
MyMessageBox 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();
} }
@@ -1136,8 +1134,8 @@ void startWindowImpl::networkMessage(unsigned msgId)
break; break;
} }
MyMessageBox 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();
} }
+155 -157
View File
@@ -38,204 +38,202 @@ CardDeckStyleReader::~CardDeckStyleReader()
void CardDeckStyleReader::readStyleFile(QString file) void CardDeckStyleReader::readStyleFile(QString file)
{ {
BigIndexesActionBottom = ""; BigIndexesActionBottom = "";
#ifdef ANDROID #ifdef ANDROID
//on Android we use just the defaul style packed with the binary via qrc //on Android we use just the defaul style packed with the binary via qrc
currentFileName = ":/android/android-data/gfx/cards/default_800x480/defaultdeckstyle_800x480.xml"; currentFileName = ":/android/android-data/gfx/cards/default_800x480/defaultdeckstyle_800x480.xml";
currentDir = ":/android/android-data/gfx/cards/default_800x480/"; currentDir = ":/android/android-data/gfx/cards/default_800x480/";
#else #else
//if style file failed --> default style fallback //if style file failed --> default style fallback
if(QFile(file).exists()) { if(QFile(file).exists()) {
currentFileName = file; currentFileName = file;
} else { } else {
currentFileName = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default_800x480/defaultdeckstyle_800x480.xml"; currentFileName = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str())+"gfx/cards/default_800x480/defaultdeckstyle_800x480.xml";
fallBack = 1; fallBack = 1;
} }
QFileInfo info(currentFileName); QFileInfo info(currentFileName);
currentDir = info.absolutePath()+"/"; currentDir = info.absolutePath()+"/";
#endif #endif
QFile myFile(currentFileName); QFile myFile(currentFileName);
myFile.open(QIODevice::ReadOnly); myFile.open(QIODevice::ReadOnly);
fileContent = myFile.readAll(); fileContent = myFile.readAll();
//start reading the file and fill vars //start reading the file and fill vars
string tempString1(""); string tempString1("");
TiXmlDocument doc; TiXmlDocument doc;
doc.Parse(fileContent.constData()); doc.Parse(fileContent.constData());
if(doc.RootElement()) { if(doc.RootElement()) {
TiXmlHandle docHandle( &doc ); TiXmlHandle docHandle( &doc );
TiXmlElement *GameTableElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "TableStyle" ).ToElement(); TiXmlElement *GameTableElement = docHandle.FirstChild( "PokerTH" ).FirstChild( "TableStyle" ).ToElement();
if(GameTableElement) { if(GameTableElement) {
MyMessageBox::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 {
TiXmlElement* itemsList = docHandle.FirstChild( "PokerTH" ).FirstChild( "CardDeck" ).FirstChild().ToElement(); TiXmlElement* itemsList = docHandle.FirstChild( "PokerTH" ).FirstChild( "CardDeck" ).FirstChild().ToElement();
for( ; itemsList; itemsList=itemsList->NextSiblingElement()) { for( ; itemsList; itemsList=itemsList->NextSiblingElement()) {
const char *tmpStr1 = itemsList->Attribute("value"); const char *tmpStr1 = itemsList->Attribute("value");
if (tmpStr1) { if (tmpStr1) {
tempString1 = tmpStr1; tempString1 = tmpStr1;
if(itemsList->ValueStr() == "StyleDescription") { if(itemsList->ValueStr() == "StyleDescription") {
StyleDescription = QString::fromUtf8(tempString1.c_str()); StyleDescription = QString::fromUtf8(tempString1.c_str());
} else if(itemsList->ValueStr() == "StyleMaintainerName") { } else if(itemsList->ValueStr() == "StyleMaintainerName") {
StyleMaintainerName = QString::fromUtf8(tempString1.c_str()); StyleMaintainerName = QString::fromUtf8(tempString1.c_str());
} else if(itemsList->ValueStr() == "StyleMaintainerEMail") { } else if(itemsList->ValueStr() == "StyleMaintainerEMail") {
StyleMaintainerEMail = QString::fromUtf8(tempString1.c_str()); StyleMaintainerEMail = QString::fromUtf8(tempString1.c_str());
} else if(itemsList->ValueStr() == "StyleCreateDate") { } else if(itemsList->ValueStr() == "StyleCreateDate") {
StyleCreateDate = QString::fromUtf8(tempString1.c_str()); StyleCreateDate = QString::fromUtf8(tempString1.c_str());
} else if(itemsList->ValueStr() == "PokerTHStyleFileVersion") { } else if(itemsList->ValueStr() == "PokerTHStyleFileVersion") {
PokerTHStyleFileVersion = QString::fromUtf8(tempString1.c_str()); PokerTHStyleFileVersion = QString::fromUtf8(tempString1.c_str());
} else if (itemsList->ValueStr() == "Preview") { } else if (itemsList->ValueStr() == "Preview") {
Preview = currentDir+QString::fromUtf8(tempString1.c_str()); Preview = currentDir+QString::fromUtf8(tempString1.c_str());
} else if (itemsList->ValueStr() == "BigIndexesActionBottom") { } else if (itemsList->ValueStr() == "BigIndexesActionBottom") {
BigIndexesActionBottom = QString::fromUtf8(tempString1.c_str()); BigIndexesActionBottom = QString::fromUtf8(tempString1.c_str());
} }
} }
} }
//check if style items are left and show warning //check if style items are left and show warning
leftItems.clear(); leftItems.clear();
if(StyleDescription == "") { if(StyleDescription == "") {
leftItems << "StyleDescription"; leftItems << "StyleDescription";
} }
if(StyleMaintainerName == "") { if(StyleMaintainerName == "") {
leftItems << "StyleMaintainerName"; leftItems << "StyleMaintainerName";
} }
if(StyleMaintainerEMail == "") { if(StyleMaintainerEMail == "") {
leftItems << "StyleMaintainerEMail"; leftItems << "StyleMaintainerEMail";
} }
if(StyleCreateDate == "") { if(StyleCreateDate == "") {
leftItems << "StyleCreateDate"; leftItems << "StyleCreateDate";
} }
if(PokerTHStyleFileVersion == "") { if(PokerTHStyleFileVersion == "") {
leftItems << "PokerTHStyleFileVersion"; leftItems << "PokerTHStyleFileVersion";
} }
if(BigIndexesActionBottom == "") { if(BigIndexesActionBottom == "") {
//ATTENTION: no fallback action here because default position is mostly CENTER //ATTENTION: no fallback action here because default position is mostly CENTER
BigIndexesActionBottom = "0"; BigIndexesActionBottom = "0";
leftItems << "BigIndexesActionBottom"; leftItems << "BigIndexesActionBottom";
} }
//check if all files are there //check if all files are there
cardsLeft.clear(); cardsLeft.clear();
int i; int i;
for(i=0; i<52; i++) { for(i=0; i<52; i++) {
QString cardString(QString::number(i)+".png"); QString cardString(QString::number(i)+".png");
if(!QDir(currentDir).exists(cardString)) { if(!QDir(currentDir).exists(cardString)) {
cardsLeft << cardString; cardsLeft << cardString;
} }
} }
if(!QDir(currentDir).exists("flipside.png")) { if(!QDir(currentDir).exists("flipside.png")) {
cardsLeft << "flipside.png"; cardsLeft << "flipside.png";
} }
// set loadedSuccessfull TRUE if everything works // set loadedSuccessfull TRUE if everything works
if(leftItems.isEmpty() && cardsLeft.isEmpty() && PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() == POKERTH_CD_STYLE_FILE_VERSION) { if(leftItems.isEmpty() && cardsLeft.isEmpty() && PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() == POKERTH_CD_STYLE_FILE_VERSION) {
myState = CD_STYLE_OK; myState = CD_STYLE_OK;
} } else {
else { //check for style file version
//check for style file version if(PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() != POKERTH_CD_STYLE_FILE_VERSION) {
if(PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() != POKERTH_CD_STYLE_FILE_VERSION) { myState = CD_STYLE_OUTDATED;
myState = CD_STYLE_OUTDATED; } else {
} else { //if one or more items are left
//if one or more items are left if(!leftItems.isEmpty() && myW != 0) myState = CD_STYLE_FIELDS_EMPTY;
if(!leftItems.isEmpty() && myW != 0) myState = CD_STYLE_FIELDS_EMPTY;
//if one or more pictures where not found //if one or more pictures where not found
if(!cardsLeft.isEmpty() && myW != 0) myState = CD_STYLE_PICTURES_MISSING; if(!cardsLeft.isEmpty() && myW != 0) myState = CD_STYLE_PICTURES_MISSING;
} }
} }
loadedSuccessfull = 1; loadedSuccessfull = 1;
} }
} } else {
else { loadedSuccessfull = 0;
loadedSuccessfull = 0; MyMessageBox::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); }
}
} }
void CardDeckStyleReader::showErrorMessage() void CardDeckStyleReader::showErrorMessage()
{ {
switch (myState) { switch (myState) {
case CD_STYLE_PICTURES_MISSING: case CD_STYLE_PICTURES_MISSING:
showCardsLeftErrorMessage(); showCardsLeftErrorMessage();
break; break;
case CD_STYLE_FIELDS_EMPTY: case CD_STYLE_FIELDS_EMPTY:
showLeftItemsErrorMessage(); showLeftItemsErrorMessage();
break; break;
case CD_STYLE_OUTDATED: case CD_STYLE_OUTDATED:
showOutdatedErrorMessage(); showOutdatedErrorMessage();
break; break;
default: default:
; ;
} }
} }
QString CardDeckStyleReader::getMyStateToolTipInfo() QString CardDeckStyleReader::getMyStateToolTipInfo()
{ {
switch (myState) { switch (myState) {
case CD_STYLE_OK: case CD_STYLE_OK:
return QString(tr("Everything OK!")); return QString(tr("Everything OK!"));
break; break;
case CD_STYLE_PICTURES_MISSING: case CD_STYLE_PICTURES_MISSING:
return QString(tr("Some cards pictures are missing, please contact style maintainer for this issue.")); return QString(tr("Some cards pictures are missing, please contact style maintainer for this issue."));
break; break;
case CD_STYLE_FIELDS_EMPTY: case CD_STYLE_FIELDS_EMPTY:
return QString(tr("Some style fields are missing, please contact style maintainer for this issue.")); return QString(tr("Some style fields are missing, please contact style maintainer for this issue."));
break; break;
case CD_STYLE_OUTDATED: case CD_STYLE_OUTDATED:
return QString(tr("This style is outdated, please contact style maintainer for this issue.")); return QString(tr("This style is outdated, please contact style maintainer for this issue."));
break; break;
default: default:
return QString(""); return QString("");
} }
} }
void CardDeckStyleReader::showLeftItemsErrorMessage() void CardDeckStyleReader::showLeftItemsErrorMessage()
{ {
QString items = leftItems.join("\n"); QString items = leftItems.join("\n");
QString EMail; QString EMail;
if(StyleMaintainerEMail != "NULL") EMail = StyleMaintainerEMail; if(StyleMaintainerEMail != "NULL") EMail = StyleMaintainerEMail;
myMessageDialogImpl dialog(myConfig, myW); myMessageDialogImpl dialog(myConfig, myW);
if(dialog.checkIfMesssageWillBeDisplayed(CD_VALUES_MISSING)) { if(dialog.checkIfMesssageWillBeDisplayed(CD_VALUES_MISSING)) {
dialog.exec(CD_VALUES_MISSING, tr("Selected card deck style \"%1\" seems to be incomplete or defective. \n\nThe value(s) of: \n%2 \nis/are missing. \n\nAnyway you can play with this deck, because the missing content will be filled up by PokerTH default card deck. \n\nPlease contact the card deck style builder via \"%3\".").arg(StyleDescription).arg(items).arg(EMail), tr("Card Deck Style Error - Fields content missing"), QPixmap(":/gfx/emblem-important-64.png"), QDialogButtonBox::Ok, true); dialog.exec(CD_VALUES_MISSING, tr("Selected card deck style \"%1\" seems to be incomplete or defective. \n\nThe value(s) of: \n%2 \nis/are missing. \n\nAnyway you can play with this deck, because the missing content will be filled up by PokerTH default card deck. \n\nPlease contact the card deck style builder via \"%3\".").arg(StyleDescription).arg(items).arg(EMail), tr("Card Deck Style Error - Fields content missing"), QPixmap(":/gfx/emblem-important-64.png"), QDialogButtonBox::Ok, true);
} }
} }
void CardDeckStyleReader::showCardsLeftErrorMessage() void CardDeckStyleReader::showCardsLeftErrorMessage()
{ {
QString pics = cardsLeft.join("\n"); QString pics = cardsLeft.join("\n");
QString EMail; QString EMail;
if(StyleMaintainerEMail != "NULL") EMail = StyleMaintainerEMail; if(StyleMaintainerEMail != "NULL") EMail = StyleMaintainerEMail;
myMessageDialogImpl dialog(myConfig, myW); myMessageDialogImpl dialog(myConfig, myW);
if(dialog.checkIfMesssageWillBeDisplayed(CD_PICS_MISSING)) { if(dialog.checkIfMesssageWillBeDisplayed(CD_PICS_MISSING)) {
dialog.exec(CD_PICS_MISSING, tr("One or more pictures from current card deck style \"%1\" were not found: \n\n%2 \n\nPlease contact the card deck style builder via \"%3\".").arg(StyleDescription).arg(pics).arg(EMail), tr("Card Deck Style Error - Pictures missing"), QPixmap(":/gfx/emblem-important-64.png"), QDialogButtonBox::Ok, true); dialog.exec(CD_PICS_MISSING, tr("One or more pictures from current card deck style \"%1\" were not found: \n\n%2 \n\nPlease contact the card deck style builder via \"%3\".").arg(StyleDescription).arg(pics).arg(EMail), tr("Card Deck Style Error - Pictures missing"), QPixmap(":/gfx/emblem-important-64.png"), QDialogButtonBox::Ok, true);
} }
} }
void CardDeckStyleReader::showOutdatedErrorMessage() void CardDeckStyleReader::showOutdatedErrorMessage()
{ {
QString EMail; QString EMail;
if(StyleMaintainerEMail != "NULL") EMail = StyleMaintainerEMail; if(StyleMaintainerEMail != "NULL") EMail = StyleMaintainerEMail;
myMessageDialogImpl dialog(myConfig, myW); myMessageDialogImpl dialog(myConfig, myW);
if(dialog.checkIfMesssageWillBeDisplayed(CD_OUTDATED)) { if(dialog.checkIfMesssageWillBeDisplayed(CD_OUTDATED)) {
dialog.exec(CD_OUTDATED, tr("Selected card deck style \"%1\" seems to be outdated. \nThe current PokerTH card deck style version is \"%2\", but this deck has version \"%3\" set. \n\nAnyway you can play with this deck, because the missing content will be filled up by PokerTH default card deck. \n\nPlease contact the card deck style builder via \"%4\".").arg(StyleDescription).arg(POKERTH_CD_STYLE_FILE_VERSION).arg(PokerTHStyleFileVersion).arg(EMail), tr("Card Deck Style Error - Outdated"), QPixmap(":/gfx/emblem-important-64.png"), QDialogButtonBox::Ok, true); dialog.exec(CD_OUTDATED, tr("Selected card deck style \"%1\" seems to be outdated. \nThe current PokerTH card deck style version is \"%2\", but this deck has version \"%3\" set. \n\nAnyway you can play with this deck, because the missing content will be filled up by PokerTH default card deck. \n\nPlease contact the card deck style builder via \"%4\".").arg(StyleDescription).arg(POKERTH_CD_STYLE_FILE_VERSION).arg(PokerTHStyleFileVersion).arg(EMail), tr("Card Deck Style Error - Outdated"), QPixmap(":/gfx/emblem-important-64.png"), QDialogButtonBox::Ok, true);
} }
} }
+16 -16
View File
@@ -31,7 +31,7 @@ enum CdStyleState {
CD_STYLE_OUTDATED, CD_STYLE_OUTDATED,
CD_STYLE_FIELDS_EMPTY, CD_STYLE_FIELDS_EMPTY,
CD_STYLE_PICTURES_MISSING, CD_STYLE_PICTURES_MISSING,
CD_STYLE_UNDEFINED CD_STYLE_UNDEFINED
}; };
class CardDeckStyleReader : public QObject class CardDeckStyleReader : public QObject
@@ -67,26 +67,26 @@ public:
return Preview; return Preview;
} }
QString getBigIndexesActionBottom() const { QString getBigIndexesActionBottom() const {
return BigIndexesActionBottom; return BigIndexesActionBottom;
} }
bool getFallBack() const { bool getFallBack() const {
return fallBack; return fallBack;
} }
bool getLoadedSuccessfull() const { bool getLoadedSuccessfull() const {
return loadedSuccessfull; return loadedSuccessfull;
} }
CdStyleState getState() const { CdStyleState getState() const {
return myState; return myState;
} }
QString getMyStateToolTipInfo(); QString getMyStateToolTipInfo();
void showErrorMessage(); void showErrorMessage();
void showLeftItemsErrorMessage(); void showLeftItemsErrorMessage();
void showCardsLeftErrorMessage(); void showCardsLeftErrorMessage();
void showOutdatedErrorMessage(); void showOutdatedErrorMessage();
private: private:
@@ -96,7 +96,7 @@ private:
QString StyleCreateDate; QString StyleCreateDate;
QString PokerTHStyleFileVersion; QString PokerTHStyleFileVersion;
QString Preview; QString Preview;
QString BigIndexesActionBottom; QString BigIndexesActionBottom;
QString currentFileName; QString currentFileName;
QString currentDir; QString currentDir;
@@ -109,9 +109,9 @@ private:
QWidget *myW; QWidget *myW;
bool fallBack; bool fallBack;
bool loadedSuccessfull; bool loadedSuccessfull;
CdStyleState myState; CdStyleState myState;
}; };
#endif #endif
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -87,9 +87,9 @@ public:
QString getHandRanking() const { QString getHandRanking() const {
return HandRanking; return HandRanking;
} }
QString getTable() const { QString getTable() const {
return Table; return Table;
} }
QString getActionPic(int); QString getActionPic(int);
@@ -27,9 +27,9 @@ timeoutMsgBoxImpl::timeoutMsgBoxImpl(QMainWindow *parent)
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 #ifdef ANDROID
this->setWindowModality(Qt::WindowModal); this->setWindowModality(Qt::WindowModal);
this->setWindowFlags(Qt::ToolTip); this->setWindowFlags(Qt::ToolTip);
this->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; }");
#endif #endif
timeOutTimer = new QTimer; timeOutTimer = new QTimer;
+20 -21
View File
@@ -560,24 +560,24 @@ AbstractClientStateReceiving::HandlePacket(boost::shared_ptr<ClientThread> clien
client->GetCallback().SignalNetClientWaitDialog(); client->GetCallback().SignalNetClientWaitDialog();
int removeReason; int removeReason;
switch (netRemoved.removedfromgamereason()) { switch (netRemoved.removedfromgamereason()) {
case RemovedFromGameMessage::kickedFromGame : case RemovedFromGameMessage::kickedFromGame :
removeReason = NTF_NET_REMOVED_KICKED; removeReason = NTF_NET_REMOVED_KICKED;
break; break;
case RemovedFromGameMessage::gameIsFull : case RemovedFromGameMessage::gameIsFull :
removeReason = NTF_NET_REMOVED_GAME_FULL; removeReason = NTF_NET_REMOVED_GAME_FULL;
break; break;
case RemovedFromGameMessage::gameIsRunning : case RemovedFromGameMessage::gameIsRunning :
removeReason = NTF_NET_REMOVED_ALREADY_RUNNING; removeReason = NTF_NET_REMOVED_ALREADY_RUNNING;
break; break;
case RemovedFromGameMessage::gameTimeout : case RemovedFromGameMessage::gameTimeout :
removeReason = NTF_NET_REMOVED_TIMEOUT; removeReason = NTF_NET_REMOVED_TIMEOUT;
break; break;
case RemovedFromGameMessage::removedStartFailed : case RemovedFromGameMessage::removedStartFailed :
removeReason = NTF_NET_REMOVED_START_FAILED; removeReason = NTF_NET_REMOVED_START_FAILED;
break; break;
default : default :
removeReason = NTF_NET_REMOVED_ON_REQUEST; removeReason = NTF_NET_REMOVED_ON_REQUEST;
break; break;
} }
client->GetCallback().SignalNetClientRemovedFromGame(removeReason); client->GetCallback().SignalNetClientRemovedFromGame(removeReason);
client->SetState(ClientStateWaitJoin::Instance()); client->SetState(ClientStateWaitJoin::Instance());
@@ -1177,7 +1177,7 @@ ClientStateWaitJoin::InternalHandlePacket(boost::shared_ptr<ClientThread> client
// Player number is 0 on init. Will be set when the game starts. // Player number is 0 on init. Will be set when the game starts.
boost::shared_ptr<PlayerData> playerData( boost::shared_ptr<PlayerData> playerData(
new PlayerData(client->GetGuiPlayerId(), 0, PLAYER_TYPE_HUMAN, new PlayerData(client->GetGuiPlayerId(), 0, PLAYER_TYPE_HUMAN,
context.GetPlayerRights(), netJoinAck.areyougameadmin())); context.GetPlayerRights(), netJoinAck.areyougameadmin()));
playerData->SetName(context.GetPlayerName()); playerData->SetName(context.GetPlayerName());
playerData->SetAvatarFile(context.GetAvatarFile()); playerData->SetAvatarFile(context.GetAvatarFile());
client->AddPlayerData(playerData); client->AddPlayerData(playerData);
@@ -1393,8 +1393,7 @@ void
ClientStateWaitStart::InternalHandlePacket(boost::shared_ptr<ClientThread> client, boost::shared_ptr<NetPacket> tmpPacket) ClientStateWaitStart::InternalHandlePacket(boost::shared_ptr<ClientThread> client, boost::shared_ptr<NetPacket> tmpPacket)
{ {
if (tmpPacket->GetMsg()->messagetype() == PokerTHMessage::Type_GameStartInitialMessage if (tmpPacket->GetMsg()->messagetype() == PokerTHMessage::Type_GameStartInitialMessage
|| tmpPacket->GetMsg()->messagetype() == PokerTHMessage::Type_GameStartRejoinMessage) || tmpPacket->GetMsg()->messagetype() == PokerTHMessage::Type_GameStartRejoinMessage) {
{
PlayerIdList tmpPlayerList; PlayerIdList tmpPlayerList;
unsigned tmpHandId = 0; unsigned tmpHandId = 0;
+1 -2
View File
@@ -85,8 +85,7 @@ ReceiveBuffer::ScanPackets()
uint32_t nativeVal; uint32_t nativeVal;
memcpy(&nativeVal, &recvBuf[0], sizeof(uint32_t)); memcpy(&nativeVal, &recvBuf[0], sizeof(uint32_t));
size_t packetSize = ntohl(nativeVal); size_t packetSize = ntohl(nativeVal);
if (recvBufUsed >= packetSize + NET_HEADER_SIZE) if (recvBufUsed >= packetSize + NET_HEADER_SIZE) {
{
try { try {
tmpPacket = NetPacket::Create(&recvBuf[NET_HEADER_SIZE], packetSize); tmpPacket = NetPacket::Create(&recvBuf[NET_HEADER_SIZE], packetSize);
if (tmpPacket) { if (tmpPacket) {
+6 -6
View File
@@ -549,12 +549,12 @@ ServerGame::InternalDenyVoteKick(boost::shared_ptr<SessionData> byWhom, unsigned
netVoteReply->set_gameid(GetId()); netVoteReply->set_gameid(GetId());
netVoteReply->set_petitionid(petitionId); netVoteReply->set_petitionid(petitionId);
switch(reason) { switch(reason) {
case VOTE_DENIED_ALREADY_VOTED : case VOTE_DENIED_ALREADY_VOTED :
netVoteReply->set_votekickreplytype(VoteKickReplyMessage::voteKickDeniedAlreadyVoted); netVoteReply->set_votekickreplytype(VoteKickReplyMessage::voteKickDeniedAlreadyVoted);
break; break;
default: default:
netVoteReply->set_votekickreplytype(VoteKickReplyMessage::voteKickDeniedInvalid); netVoteReply->set_votekickreplytype(VoteKickReplyMessage::voteKickDeniedInvalid);
break; break;
} }
GetLobbyThread().GetSender().Send(byWhom, packet); GetLobbyThread().GetSender().Send(byWhom, packet);
} }
+1 -1
View File
@@ -904,7 +904,7 @@ ServerLobbyThread::HandlePacket(boost::shared_ptr<SessionData> session, boost::s
} else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_JoinExistingGameMessage) { } else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_JoinExistingGameMessage) {
HandleNetPacketJoinGame(session, packet->GetMsg()->joinexistinggamemessage()); HandleNetPacketJoinGame(session, packet->GetMsg()->joinexistinggamemessage());
} else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_RejoinExistingGameMessage) { } else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_RejoinExistingGameMessage) {
HandleNetPacketRejoinGame(session, packet->GetMsg()->rejoinexistinggamemessage()); HandleNetPacketRejoinGame(session, packet->GetMsg()->rejoinexistinggamemessage());
} else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_ChatRequestMessage) { } else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_ChatRequestMessage) {
HandleNetPacketChatRequest(session, packet->GetMsg()->chatrequestmessage()); HandleNetPacketChatRequest(session, packet->GetMsg()->chatrequestmessage());
} else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_RejectGameInvitationMessage) { } else if (packet->GetMsg()->messagetype() == PokerTHMessage::Type_RejectGameInvitationMessage) {
+3 -3
View File
@@ -74,9 +74,9 @@ UploadHelper::InternalInit(const string &/*url*/, const string &targetFileName,
// Curl will handle file I/O. // Curl will handle file I/O.
struct curl_httppost *last = NULL; struct curl_httppost *last = NULL;
curl_formadd(&GetData()->post, &last, curl_formadd(&GetData()->post, &last,
CURLFORM_COPYNAME, httpPost.c_str(), CURLFORM_COPYNAME, httpPost.c_str(),
CURLFORM_FILE, targetFileName.c_str(), CURLFORM_FILE, targetFileName.c_str(),
CURLFORM_END); CURLFORM_END);
curl_easy_setopt(GetData()->curlHandle, CURLOPT_HTTPPOST, GetData()->post); curl_easy_setopt(GetData()->curlHandle, CURLOPT_HTTPPOST, GetData()->post);
curl_easy_setopt(GetData()->curlHandle, CURLOPT_WRITEFUNCTION, writeFunction); curl_easy_setopt(GetData()->curlHandle, CURLOPT_WRITEFUNCTION, writeFunction);
curl_easy_setopt(GetData()->curlHandle, CURLOPT_WRITEDATA, &GetData()->returnMessage); curl_easy_setopt(GetData()->curlHandle, CURLOPT_WRITEDATA, &GetData()->returnMessage);
+71 -71
View File
@@ -64,102 +64,102 @@ class Game;
int main( int argc, char **argv ) int main( int argc, char **argv )
{ {
//ENABLE_LEAK_CHECK(); //ENABLE_LEAK_CHECK();
//_CrtSetBreakAlloc(49937); //_CrtSetBreakAlloc(49937);
socket_startup(); socket_startup();
curl_global_init(CURL_GLOBAL_NOTHING); curl_global_init(CURL_GLOBAL_NOTHING);
/////// can be removed for non-qt-guis //////////// /////// can be removed for non-qt-guis ////////////
QtSingleApplication a( argc, argv ); QtSingleApplication a( argc, argv );
if (a.sendMessage("Wake up!")) { if (a.sendMessage("Wake up!")) {
return 0; return 0;
} }
#ifdef __APPLE__ #ifdef __APPLE__
// The following needs to be done directly after the application is created. // The following needs to be done directly after the application is created.
QDir dir(QApplication::applicationDirPath()); QDir dir(QApplication::applicationDirPath());
dir.cdUp(); dir.cdUp();
dir.cd("plugins"); dir.cd("plugins");
QApplication::setLibraryPaths(QStringList(dir.absolutePath())); QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
#endif #endif
//create defaultconfig //create defaultconfig
ConfigFile *myConfig = new ConfigFile(argv[0], false); ConfigFile *myConfig = new ConfigFile(argv[0], false);
Log *myLog = new Log(myConfig); Log *myLog = new Log(myConfig);
// set PlastiqueStyle even for mac-version to prevent artefacts on styled widgets // set PlastiqueStyle even for mac-version to prevent artefacts on styled widgets
a.setStyle(new QPlastiqueStyle); a.setStyle(new QPlastiqueStyle);
QString myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
//set QApplication default font
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/n019003l.pfb"); QString myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/VeraBd.ttf"); //set QApplication default font
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/c059013l.pfb");
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/DejaVuSans-Bold.ttf"); QFontDatabase::addApplicationFont (myAppDataPath +"fonts/n019003l.pfb");
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/VeraBd.ttf");
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/c059013l.pfb");
QFontDatabase::addApplicationFont (myAppDataPath +"fonts/DejaVuSans-Bold.ttf");
#ifdef _WIN32 #ifdef _WIN32
QString font1String("QApplication, QWidget, QDialog { font-size: 12px; }"); QString font1String("QApplication, QWidget, QDialog { font-size: 12px; }");
#elif __APPLE__ #elif __APPLE__
// QString font1String("font-family: \"Lucida Grande\";"); // QString font1String("font-family: \"Lucida Grande\";");
QString font1String("QApplication, QWidget, QDialog { font-size: 11px; }"); QString font1String("QApplication, QWidget, QDialog { font-size: 11px; }");
#elif ANDROID #elif ANDROID
QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 26px; }"); QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 26px; }");
QPalette p = a.palette(); QPalette p = a.palette();
p.setColor(QPalette::Button, QColor::fromRgb(80,80,80)); p.setColor(QPalette::Button, QColor::fromRgb(80,80,80));
p.setColor(QPalette::Base, QColor::fromRgb(80,80,80)); p.setColor(QPalette::Base, QColor::fromRgb(80,80,80));
p.setColor(QPalette::Window, QColor::fromRgb(50,50,50)); p.setColor(QPalette::Window, QColor::fromRgb(50,50,50));
p.setColor(QPalette::ButtonText, QColor::fromRgb(255,255,255)); p.setColor(QPalette::ButtonText, QColor::fromRgb(255,255,255));
p.setColor(QPalette::Disabled, QPalette::ButtonText, QColor::fromRgb(100,100,100)); p.setColor(QPalette::Disabled, QPalette::ButtonText, QColor::fromRgb(100,100,100));
p.setColor(QPalette::WindowText, QColor::fromRgb(255,255,255)); p.setColor(QPalette::WindowText, QColor::fromRgb(255,255,255));
p.setColor(QPalette::Disabled, QPalette::WindowText, QColor::fromRgb(100,100,100)); p.setColor(QPalette::Disabled, QPalette::WindowText, QColor::fromRgb(100,100,100));
p.setColor(QPalette::Text, QColor::fromRgb(255,255,255)); p.setColor(QPalette::Text, QColor::fromRgb(255,255,255));
p.setColor(QPalette::Disabled, QPalette::Text, QColor::fromRgb(100,100,100)); p.setColor(QPalette::Disabled, QPalette::Text, QColor::fromRgb(100,100,100));
p.setColor(QPalette::Link, QColor::fromRgb(192,192,255)); p.setColor(QPalette::Link, QColor::fromRgb(192,192,255));
p.setColor(QPalette::LinkVisited, QColor::fromRgb(192,192,255)); p.setColor(QPalette::LinkVisited, QColor::fromRgb(192,192,255));
a.setPalette(p); a.setPalette(p);
#else #else
QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 12px; }"); QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 12px; }");
#endif #endif
a.setStyleSheet(font1String + " QDialogButtonBox, QMessageBox { dialogbuttonbox-buttons-have-icons: 1; dialog-ok-icon: url(:/gfx/dialog_ok_apply.png); dialog-cancel-icon: url(:/gfx/dialog_close.png); dialog-close-icon: url(:/gfx/dialog_close.png); dialog-yes-icon: url(:/gfx/dialog_ok_apply.png); dialog-no-icon: url(:/gfx/dialog_close.png) }"); a.setStyleSheet(font1String + " QDialogButtonBox, QMessageBox { dialogbuttonbox-buttons-have-icons: 1; dialog-ok-icon: url(:/gfx/dialog_ok_apply.png); dialog-cancel-icon: url(:/gfx/dialog_close.png); dialog-close-icon: url(:/gfx/dialog_close.png); dialog-yes-icon: url(:/gfx/dialog_ok_apply.png); dialog-no-icon: url(:/gfx/dialog_close.png) }");
QPixmap pixmap(myAppDataPath + "gfx/gui/misc/welcomepokerth.png"); QPixmap pixmap(myAppDataPath + "gfx/gui/misc/welcomepokerth.png");
#ifdef ANDROID #ifdef ANDROID
QDesktopWidget dw; QDesktopWidget dw;
pixmap = pixmap.scaled(dw.screenGeometry().width(), dw.screenGeometry().height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); pixmap = pixmap.scaled(dw.screenGeometry().width(), dw.screenGeometry().height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
#endif #endif
StartSplash splash(pixmap); StartSplash splash(pixmap);
if(!myConfig->readConfigInt("DisableSplashScreenOnStartup")) { if(!myConfig->readConfigInt("DisableSplashScreenOnStartup")) {
splash.show(); splash.show();
splash.showMessage(QString("Version %1").arg(POKERTH_BETA_RELEASE_STRING), 0x0042, QColor(255,255,255)); splash.showMessage(QString("Version %1").arg(POKERTH_BETA_RELEASE_STRING), 0x0042, QColor(255,255,255));
} }
//Set translations //Set translations
QTranslator qtTranslator; QTranslator qtTranslator;
qtTranslator.load(QString(myAppDataPath +"translations/qt_") + QString::fromStdString(myConfig->readConfigString("Language"))); qtTranslator.load(QString(myAppDataPath +"translations/qt_") + QString::fromStdString(myConfig->readConfigString("Language")));
a.installTranslator(&qtTranslator); a.installTranslator(&qtTranslator);
QTranslator translator; QTranslator translator;
translator.load(QString(myAppDataPath +"translations/pokerth_") + QString::fromStdString(myConfig->readConfigString("Language"))); translator.load(QString(myAppDataPath +"translations/pokerth_") + QString::fromStdString(myConfig->readConfigString("Language")));
a.installTranslator(&translator); a.installTranslator(&translator);
qRegisterMetaType<unsigned>("unsigned"); qRegisterMetaType<unsigned>("unsigned");
qRegisterMetaType<boost::shared_ptr<Game> >("boost::shared_ptr<Game>"); qRegisterMetaType<boost::shared_ptr<Game> >("boost::shared_ptr<Game>");
qRegisterMetaType<ServerStats>("ServerStats"); qRegisterMetaType<ServerStats>("ServerStats");
qRegisterMetaType<DenyGameInvitationReason>("DenyGameInvitationReason"); qRegisterMetaType<DenyGameInvitationReason>("DenyGameInvitationReason");
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
startWindowImpl mainWin(myConfig,myLog); startWindowImpl mainWin(myConfig,myLog);
a.setActivationWindow(&mainWin, true); a.setActivationWindow(&mainWin, true);
int retVal = a.exec(); int retVal = a.exec();
curl_global_cleanup(); curl_global_cleanup();
socket_cleanup(); socket_cleanup();
return retVal; return retVal;
} }
+3 -3
View File
@@ -91,7 +91,7 @@ void Session::startLocalGame(const GameData &gameData, const StartData &startDat
currentGame.reset(); currentGame.reset();
currentGameNum++; currentGameNum++;
myGui->initGui(gameData.guiSpeed); myGui->initGui(gameData.guiSpeed);
@@ -177,10 +177,10 @@ void Session::startInternetClient()
myNetClient->Init( myNetClient->Init(
myConfig->readConfigString("InternetServerAddress"), myConfig->readConfigString("InternetServerAddress"),
// myConfig->readConfigString("InternetServerListAddress"), // myConfig->readConfigString("InternetServerListAddress"),
"pokerth.net/serverlist_testing.xml.z", "pokerth.net/serverlist_testing.xml.z",
myConfig->readConfigString("ServerPassword"), myConfig->readConfigString("ServerPassword"),
// myConfig->readConfigInt("InternetServerConfigMode") == 0, // myConfig->readConfigInt("InternetServerConfigMode") == 0,
true, true,
myConfig->readConfigInt("InternetServerPort"), myConfig->readConfigInt("InternetServerPort"),
myConfig->readConfigInt("InternetServerUseIpv6") == 1, myConfig->readConfigInt("InternetServerUseIpv6") == 1,
myConfig->readConfigInt("InternetServerUseSctp") == 1, myConfig->readConfigInt("InternetServerUseSctp") == 1,