adds avatars vor connected-players-list in lobby

This commit is contained in:
doitux
2007-11-01 12:21:34 +00:00
parent 392b0b8f23
commit 47eee5474c
3 changed files with 37 additions and 2 deletions
+14 -2
View File
@@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>875</width>
<height>610</height>
<height>618</height>
</rect>
</property>
<property name="windowTitle" >
@@ -120,9 +120,21 @@
<property name="minimumSize" >
<size>
<width>221</width>
<height>0</height>
<height>221</height>
</size>
</property>
<property name="midLineWidth" >
<number>1</number>
</property>
<property name="iconSize" >
<size>
<width>25</width>
<height>25</height>
</size>
</property>
<property name="indentation" >
<number>15</number>
</property>
<column>
<property name="text" >
<string>Connected Players</string>
@@ -36,6 +36,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(QWidget *parent, ConfigFile *c)
waitStartGameMsgBoxTimer->setSingleShot(TRUE);
treeWidget_GameList->setGameListBackgroundImage(myAppDataPath +"gfx/gui/misc/background_gamelist.png");
// treeWidget_connectedPlayers->setSpacing(1);
connect( pushButton_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) );
@@ -459,6 +460,7 @@ void gameLobbyDialogImpl::addConnectedPlayer(unsigned playerId, QString playerNa
}
checkPlayerQuantity();
refreshConnectedPlayerAvatars();
}
void gameLobbyDialogImpl::updatePlayer(unsigned playerId, QString newPlayerName) {
@@ -472,6 +474,7 @@ void gameLobbyDialogImpl::updatePlayer(unsigned playerId, QString newPlayerName)
}
++it;
}
refreshConnectedPlayerAvatars();
}
void gameLobbyDialogImpl::removePlayer(unsigned playerId, QString) {
@@ -506,6 +509,24 @@ void gameLobbyDialogImpl::newGameAdmin(unsigned playerId, QString)
}
}
void gameLobbyDialogImpl::refreshConnectedPlayerAvatars() {
QTreeWidgetItemIterator it(treeWidget_connectedPlayers);
while (*it) {
std::string myAvatarFileName;
PlayerInfo playerInfo(mySession->getClientPlayerInfo((*it)->data(0, Qt::UserRole).toInt()));
mySession->getAvatarFile(playerInfo.avatar, myAvatarFileName);
QString myAvatarString(QString::fromUtf8(myAvatarFileName.c_str()));
if(QFile::QFile(myAvatarString).exists()) {
(*it)->setIcon(0, QIcon(myAvatarString));
}
++it;
}
}
void gameLobbyDialogImpl::joinedGameDialogUpdate() {
groupBox_GameInfo->setEnabled(true);
groupBox_GameInfo->setTitle(currentGameName);
@@ -79,6 +79,8 @@ public slots:
void removePlayer(unsigned, QString);
void newGameAdmin(unsigned, QString);
void refreshConnectedPlayerAvatars();
void playerSelected(QTreeWidgetItem*, QTreeWidgetItem*);
void refresh(int actionID);
void removedFromGame(int reason);