diff --git a/src/config/configfile.cpp b/src/config/configfile.cpp index dcb84058..557d9bcd 100644 --- a/src/config/configfile.cpp +++ b/src/config/configfile.cpp @@ -50,7 +50,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) myConfigState = OK; // !!!! Revisionsnummer der Configdefaults !!!!! - configRev = 88; + configRev = 89; //standard defaults logOnOffDefault = "1"; @@ -135,6 +135,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly) configList.push_back(ConfigInfo("Language", CONFIG_TYPE_INT, myQtToolsInterface->getDefaultLanguage())); /*configList.push_back(ConfigInfo("InternetServerAddressIRCChannelUpdateDone", CONFIG_TYPE_INT, "1"));*/ //HACK configList.push_back(ConfigInfo("ShowLeftToolBox", CONFIG_TYPE_INT, "1")); + configList.push_back(ConfigInfo("ShowCountryFlagInAvatar", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("ShowRightToolBox", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("ShowFadeOutCardsAnimation", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("ShowFlipCardsAnimation", CONFIG_TYPE_INT, "1")); diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index f3a206d0..f626f300 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -817,17 +817,20 @@ void gameTableImpl::refreshPlayerAvatar() { QPixmap onePix = QPixmap::fromImage(QImage(myAppDataPath +"gfx/gui/misc/1px.png")); HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); - + int seatPlace; PlayerListConstIterator it_c; - for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) { + for (it_c=currentHand->getSeatsList()->begin(), seatPlace=0; it_c!=currentHand->getSeatsList()->end(); it_c++, seatPlace++) { + QString countryString(QString(myStartWindow->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).countryCode.c_str()).toLower()); + countryString = QString(":/cflags/cflags/%1.png").arg(countryString); + if((*it_c)->getMyActiveStatus()) { QFile myAvatarFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str())); if((*it_c)->getMyAvatar() == "" || !myAvatarFile.exists()) { - playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap::fromImage(QImage(myGameTableStyle->getDefaultAvatar()))); + playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(QPixmap::fromImage(QImage(myGameTableStyle->getDefaultAvatar())),countryString,seatPlace); } else { - playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap::fromImage(QImage(QString::fromUtf8((*it_c)->getMyAvatar().c_str())))); + playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(QPixmap::fromImage(QImage(QString::fromUtf8((*it_c)->getMyAvatar().c_str()))),countryString,seatPlace); } } else { @@ -835,10 +838,10 @@ void gameTableImpl::refreshPlayerAvatar() { if((*it_c)->getMyStayOnTableStatus() == TRUE && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER) { QFile myAvatarFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str())); if((*it_c)->getMyAvatar() == "" || !myAvatarFile.exists()) { - playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap::fromImage(QImage(myGameTableStyle->getDefaultAvatar())), TRUE); + playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(QPixmap::fromImage(QImage(myGameTableStyle->getDefaultAvatar())), countryString, seatPlace, TRUE); } else { - playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap::fromImage(QImage(QString::fromUtf8((*it_c)->getMyAvatar().c_str()))), TRUE); + playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(QPixmap::fromImage(QImage(QString::fromUtf8((*it_c)->getMyAvatar().c_str()))),countryString,seatPlace, TRUE); } } else { diff --git a/src/gui/qt/gametable/myavatarlabel.cpp b/src/gui/qt/gametable/myavatarlabel.cpp index f506877c..6950d1dc 100644 --- a/src/gui/qt/gametable/myavatarlabel.cpp +++ b/src/gui/qt/gametable/myavatarlabel.cpp @@ -112,6 +112,29 @@ void MyAvatarLabel::setPixmap ( const QPixmap &pix, const bool trans) { } +void MyAvatarLabel::setPixmapAndCountry ( const QPixmap &pix,QString countryString, int seatPlace, const bool trans) { + + QPixmap resultAvatar(pix.scaled(50,50, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); + QPainter painter(&resultAvatar); + int showCountryFlags = myW->getMyConfig()->readConfigInt("ShowCountryFlagInAvatar"); + if(showCountryFlags && !countryString.isEmpty()) + { + if(seatPlace<=2||seatPlace>=8) + { + painter.drawPixmap(resultAvatar.width()-(QPixmap(countryString)).width(),resultAvatar.height()-(QPixmap(countryString)).height(),QPixmap(countryString)); + } + else + { + painter.drawPixmap(resultAvatar.width()-(QPixmap(countryString)).width(),0,QPixmap(countryString)); + } + } + painter.end(); + myPixmap = resultAvatar; + transparent = trans; + update(); + +} + void MyAvatarLabel::paintEvent(QPaintEvent*) { QPainter painter(this); diff --git a/src/gui/qt/gametable/myavatarlabel.h b/src/gui/qt/gametable/myavatarlabel.h index fd6acb83..4464374b 100644 --- a/src/gui/qt/gametable/myavatarlabel.h +++ b/src/gui/qt/gametable/myavatarlabel.h @@ -38,6 +38,7 @@ public slots: void setVoteOnKickContextMenuEnabled(bool); void setVoteRunning ( bool theValue ) { voteRunning = theValue; } void setPixmap ( const QPixmap &, const bool = FALSE); + void setPixmapAndCountry ( const QPixmap &, QString country, int seatPlace, const bool = FALSE); void paintEvent(QPaintEvent*); void putPlayerOnIgnoreList(); bool playerIsOnIgnoreList(QString playerName); diff --git a/src/gui/qt/settingsdialog.ui b/src/gui/qt/settingsdialog.ui index d6efc457..887989d6 100644 --- a/src/gui/qt/settingsdialog.ui +++ b/src/gui/qt/settingsdialog.ui @@ -256,13 +256,20 @@ Network / Internet Game - + Switch keyboard focus to bet-input-field if it's your turn + + + + Show country flag in the corner of avatar + + + @@ -422,12 +429,6 @@ p, li { white-space: pre-wrap; } true - - false - - - true - Description @@ -558,9 +559,6 @@ p, li { white-space: pre-wrap; } true - - true - Description diff --git a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp index f95cbb62..6fa001c1 100644 --- a/src/gui/qt/settingsdialog/settingsdialogimpl.cpp +++ b/src/gui/qt/settingsdialog/settingsdialogimpl.cpp @@ -249,6 +249,7 @@ void settingsDialogImpl::prepareDialog() checkBox_showFadeOutCardsAnimation->setChecked(myConfig->readConfigInt("ShowFadeOutCardsAnimation")); checkBox_showFlipCardsAnimation->setChecked(myConfig->readConfigInt("ShowFlipCardsAnimation")); checkBox_showBlindButtons->setChecked(myConfig->readConfigInt("ShowBlindButtons")); + checkBox_showCountryFlagInAvatar->setChecked(myConfig->readConfigInt("ShowCountryFlagInAvatar")); checkBox_antiPeekMode->setChecked(myConfig->readConfigInt("AntiPeekMode")); checkBox_alternateFKeysUserActionMode->setChecked(myConfig->readConfigInt("AlternateFKeysUserActionMode")); checkBox_enableBetInputFocusSwitch->setChecked(myConfig->readConfigInt("EnableBetInputFocusSwitch")); @@ -616,6 +617,7 @@ void settingsDialogImpl::isAccepted() { myConfig->writeConfigInt("ShowBlindButtons", checkBox_showBlindButtons->isChecked()); myConfig->writeConfigInt("ShowCardsChanceMonitor", checkBox_cardsChanceMonitor->isChecked()); myConfig->writeConfigInt("AntiPeekMode", checkBox_antiPeekMode->isChecked()); + myConfig->writeConfigInt("ShowCountryFlagInAvatar", checkBox_showCountryFlagInAvatar->isChecked()); myConfig->writeConfigInt("AlternateFKeysUserActionMode", checkBox_alternateFKeysUserActionMode->isChecked()); myConfig->writeConfigInt("DontTranslateInternationalPokerStringsFromStyle", checkBox_dontTranslatePokerStrings->isChecked()); myConfig->writeConfigInt("DisableSplashScreenOnStartup", checkBox_disableSplashscreen->isChecked());