optional add country flag to avatar feature (thx to drull)

This commit is contained in:
doitux
2010-10-26 17:31:41 +00:00
parent fbc623a704
commit 74a96a4354
6 changed files with 45 additions and 17 deletions
+2 -1
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 = 88; configRev = 89;
//standard defaults //standard defaults
logOnOffDefault = "1"; 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("Language", CONFIG_TYPE_INT, myQtToolsInterface->getDefaultLanguage()));
/*configList.push_back(ConfigInfo("InternetServerAddressIRCChannelUpdateDone", CONFIG_TYPE_INT, "1"));*/ //HACK /*configList.push_back(ConfigInfo("InternetServerAddressIRCChannelUpdateDone", CONFIG_TYPE_INT, "1"));*/ //HACK
configList.push_back(ConfigInfo("ShowLeftToolBox", CONFIG_TYPE_INT, "1")); 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("ShowRightToolBox", CONFIG_TYPE_INT, "1"));
configList.push_back(ConfigInfo("ShowFadeOutCardsAnimation", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("ShowFadeOutCardsAnimation", CONFIG_TYPE_INT, "1"));
configList.push_back(ConfigInfo("ShowFlipCardsAnimation", CONFIG_TYPE_INT, "1")); configList.push_back(ConfigInfo("ShowFlipCardsAnimation", CONFIG_TYPE_INT, "1"));
+9 -6
View File
@@ -817,17 +817,20 @@ void gameTableImpl::refreshPlayerAvatar() {
QPixmap onePix = QPixmap::fromImage(QImage(myAppDataPath +"gfx/gui/misc/1px.png")); QPixmap onePix = QPixmap::fromImage(QImage(myAppDataPath +"gfx/gui/misc/1px.png"));
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
int seatPlace;
PlayerListConstIterator it_c; 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()) { if((*it_c)->getMyActiveStatus()) {
QFile myAvatarFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str())); QFile myAvatarFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str()));
if((*it_c)->getMyAvatar() == "" || !myAvatarFile.exists()) { 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 { 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 { else {
@@ -835,10 +838,10 @@ void gameTableImpl::refreshPlayerAvatar() {
if((*it_c)->getMyStayOnTableStatus() == TRUE && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER) { if((*it_c)->getMyStayOnTableStatus() == TRUE && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER) {
QFile myAvatarFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str())); QFile myAvatarFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str()));
if((*it_c)->getMyAvatar() == "" || !myAvatarFile.exists()) { 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 { 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 { else {
+23
View File
@@ -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*) { void MyAvatarLabel::paintEvent(QPaintEvent*) {
QPainter painter(this); QPainter painter(this);
+1
View File
@@ -38,6 +38,7 @@ public slots:
void setVoteOnKickContextMenuEnabled(bool); void setVoteOnKickContextMenuEnabled(bool);
void setVoteRunning ( bool theValue ) { voteRunning = theValue; } void setVoteRunning ( bool theValue ) { voteRunning = theValue; }
void setPixmap ( const QPixmap &, const bool = FALSE); void setPixmap ( const QPixmap &, const bool = FALSE);
void setPixmapAndCountry ( const QPixmap &, QString country, int seatPlace, const bool = FALSE);
void paintEvent(QPaintEvent*); void paintEvent(QPaintEvent*);
void putPlayerOnIgnoreList(); void putPlayerOnIgnoreList();
bool playerIsOnIgnoreList(QString playerName); bool playerIsOnIgnoreList(QString playerName);
+8 -10
View File
@@ -256,13 +256,20 @@
<string>Network / Internet Game</string> <string>Network / Internet Game</string>
</property> </property>
<layout class="QGridLayout"> <layout class="QGridLayout">
<item row="0" column="0"> <item row="1" column="0">
<widget class="QCheckBox" name="checkBox_enableBetInputFocusSwitch"> <widget class="QCheckBox" name="checkBox_enableBetInputFocusSwitch">
<property name="text"> <property name="text">
<string>Switch keyboard focus to bet-input-field if it's your turn</string> <string>Switch keyboard focus to bet-input-field if it's your turn</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkBox_showCountryFlagInAvatar">
<property name="text">
<string>Show country flag in the corner of avatar</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@@ -422,12 +429,6 @@ p, li { white-space: pre-wrap; }
<attribute name="headerShowSortIndicator" stdset="0"> <attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool> <bool>true</bool>
</attribute> </attribute>
<attribute name="headerCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<column> <column>
<property name="text"> <property name="text">
<string>Description</string> <string>Description</string>
@@ -558,9 +559,6 @@ p, li { white-space: pre-wrap; }
<attribute name="headerShowSortIndicator" stdset="0"> <attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool> <bool>true</bool>
</attribute> </attribute>
<attribute name="headerShowSortIndicator" stdset="0">
<bool>true</bool>
</attribute>
<column> <column>
<property name="text"> <property name="text">
<string>Description</string> <string>Description</string>
@@ -249,6 +249,7 @@ void settingsDialogImpl::prepareDialog()
checkBox_showFadeOutCardsAnimation->setChecked(myConfig->readConfigInt("ShowFadeOutCardsAnimation")); checkBox_showFadeOutCardsAnimation->setChecked(myConfig->readConfigInt("ShowFadeOutCardsAnimation"));
checkBox_showFlipCardsAnimation->setChecked(myConfig->readConfigInt("ShowFlipCardsAnimation")); checkBox_showFlipCardsAnimation->setChecked(myConfig->readConfigInt("ShowFlipCardsAnimation"));
checkBox_showBlindButtons->setChecked(myConfig->readConfigInt("ShowBlindButtons")); checkBox_showBlindButtons->setChecked(myConfig->readConfigInt("ShowBlindButtons"));
checkBox_showCountryFlagInAvatar->setChecked(myConfig->readConfigInt("ShowCountryFlagInAvatar"));
checkBox_antiPeekMode->setChecked(myConfig->readConfigInt("AntiPeekMode")); checkBox_antiPeekMode->setChecked(myConfig->readConfigInt("AntiPeekMode"));
checkBox_alternateFKeysUserActionMode->setChecked(myConfig->readConfigInt("AlternateFKeysUserActionMode")); checkBox_alternateFKeysUserActionMode->setChecked(myConfig->readConfigInt("AlternateFKeysUserActionMode"));
checkBox_enableBetInputFocusSwitch->setChecked(myConfig->readConfigInt("EnableBetInputFocusSwitch")); checkBox_enableBetInputFocusSwitch->setChecked(myConfig->readConfigInt("EnableBetInputFocusSwitch"));
@@ -616,6 +617,7 @@ void settingsDialogImpl::isAccepted() {
myConfig->writeConfigInt("ShowBlindButtons", checkBox_showBlindButtons->isChecked()); myConfig->writeConfigInt("ShowBlindButtons", checkBox_showBlindButtons->isChecked());
myConfig->writeConfigInt("ShowCardsChanceMonitor", checkBox_cardsChanceMonitor->isChecked()); myConfig->writeConfigInt("ShowCardsChanceMonitor", checkBox_cardsChanceMonitor->isChecked());
myConfig->writeConfigInt("AntiPeekMode", checkBox_antiPeekMode->isChecked()); myConfig->writeConfigInt("AntiPeekMode", checkBox_antiPeekMode->isChecked());
myConfig->writeConfigInt("ShowCountryFlagInAvatar", checkBox_showCountryFlagInAvatar->isChecked());
myConfig->writeConfigInt("AlternateFKeysUserActionMode", checkBox_alternateFKeysUserActionMode->isChecked()); myConfig->writeConfigInt("AlternateFKeysUserActionMode", checkBox_alternateFKeysUserActionMode->isChecked());
myConfig->writeConfigInt("DontTranslateInternationalPokerStringsFromStyle", checkBox_dontTranslatePokerStrings->isChecked()); myConfig->writeConfigInt("DontTranslateInternationalPokerStringsFromStyle", checkBox_dontTranslatePokerStrings->isChecked());
myConfig->writeConfigInt("DisableSplashScreenOnStartup", checkBox_disableSplashscreen->isChecked()); myConfig->writeConfigInt("DisableSplashScreenOnStartup", checkBox_disableSplashscreen->isChecked());