fix crashes for local game (commited with avatar-ignore feature)
This commit is contained in:
@@ -1074,6 +1074,9 @@ void gameTableImpl::refreshPlayerAvatar()
|
||||
PlayerList seatsList = currentGame->getSeatsList();
|
||||
for (it_c=seatsList->begin(), seatPlace=0; it_c!=seatsList->end(); ++it_c, seatPlace++) {
|
||||
|
||||
//set uniqueID
|
||||
playerAvatarLabelArray[(*it_c)->getMyID()]->setMyUniqueId((*it_c)->getMyUniqueID());
|
||||
|
||||
//get CountryString
|
||||
QString countryString(QString(myStartWindow->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).countryCode.c_str()).toLower());
|
||||
countryString = QString(":/cflags/cflags/%1.png").arg(countryString);
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
using namespace std;
|
||||
|
||||
MyAvatarLabel::MyAvatarLabel(QGroupBox* parent)
|
||||
: QLabel(parent), voteRunning(false), transparent(false)
|
||||
: QLabel(parent), voteRunning(false), transparent(false), myUniqueId(0)
|
||||
{
|
||||
|
||||
myContextMenu = new QMenu;
|
||||
@@ -395,21 +395,14 @@ void MyAvatarLabel::paintEvent(QPaintEvent*)
|
||||
painter.setOpacity(1.0);
|
||||
|
||||
//hide avatar if player is on ignore list
|
||||
boost::shared_ptr<Game> currentGame = myW->myStartWindow->getSession()->getCurrentGame();
|
||||
PlayerListConstIterator it_c;
|
||||
int seatPlace;
|
||||
PlayerList seatsList = currentGame->getSeatsList();
|
||||
for (seatPlace=0,it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c, seatPlace++) {
|
||||
if(seatPlace == myId) {
|
||||
if(!playerIsOnIgnoreList(QString::fromUtf8((*it_c)->getMyName().c_str()))) {
|
||||
painter.drawPixmap(0,0,myPixmap);
|
||||
return;
|
||||
}
|
||||
else if(myW->getMyConfig()->readConfigInt("DontHideAvatarsOfIgnored")) {
|
||||
painter.drawPixmap(0,0,myPixmap);
|
||||
return;
|
||||
}
|
||||
}
|
||||
boost::shared_ptr<Session> mySession = myW->myStartWindow->getSession();
|
||||
if(!playerIsOnIgnoreList(QString::fromUtf8(mySession->getClientPlayerInfo(myUniqueId).playerName.c_str()))) {
|
||||
painter.drawPixmap(0,0,myPixmap);
|
||||
return;
|
||||
}
|
||||
else if(myW->getMyConfig()->readConfigInt("DontHideAvatarsOfIgnored")) {
|
||||
painter.drawPixmap(0,0,myPixmap);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@ public:
|
||||
void setMyId ( int theValue ) {
|
||||
myId = theValue;
|
||||
}
|
||||
void setMyUniqueId ( int theValue ) {
|
||||
myUniqueId = theValue;
|
||||
}
|
||||
void contextMenuEvent ( QContextMenuEvent * event );
|
||||
QString getPlayerTip(QString);
|
||||
int getPlayerRating(QString);
|
||||
@@ -95,10 +98,12 @@ private:
|
||||
QPixmap myPixmap;
|
||||
QString myPath;
|
||||
|
||||
int myId;
|
||||
bool myContextMenuEnabled;
|
||||
bool voteRunning;
|
||||
bool transparent;
|
||||
int myId;
|
||||
int myUniqueId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifndef ANDROID_TEST
|
||||
#include "QtGui/5.1.0/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include "QtGui/5.1.1/QtGui/qpa/qplatformnativeinterface.h"
|
||||
#include <jni.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user