new gui-feedback for autofold-modus

This commit is contained in:
doitux
2011-12-18 20:13:00 +00:00
parent 99616b4eed
commit cd00a67d1f
2 changed files with 109 additions and 50 deletions
+105 -50
View File
@@ -895,34 +895,37 @@ void gameTableImpl::refreshPlayerName()
PlayerListConstIterator it_c; PlayerListConstIterator it_c;
PlayerList seatsList = currentGame->getSeatsList(); PlayerList seatsList = currentGame->getSeatsList();
for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) { for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
if((*it_c)->getMyActiveStatus()) {
bool guest = myStartWindow->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest; //collect needed infos
bool computerPlayer = false; bool guest = myStartWindow->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest;
if((*it_c)->getMyType() == PLAYER_TYPE_COMPUTER) { bool computerPlayer = false;
computerPlayer = true; if((*it_c)->getMyType() == PLAYER_TYPE_COMPUTER) {
} computerPlayer = true;
}
QString nick = QString::fromUtf8((*it_c)->getMyName().c_str());
playerNameLabelArray[(*it_c)->getMyID()]->setText(QString::fromUtf8((*it_c)->getMyName().c_str()), FALSE, guest, computerPlayer ); //check SeatStates and refresh
switch(getCurrentSeatState((*it_c))) {
} else { case SEAT_ACTIVE: {
if((myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK)) { playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, FALSE, guest, computerPlayer );
if((*it_c)->getMyStayOnTableStatus() == TRUE && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER) { }
break;
bool guest = myStartWindow->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest; case SEAT_AUTOFOLD: {
bool computerPlayer = false; playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, TRUE, guest, computerPlayer );
if((*it_c)->getMyType() == PLAYER_TYPE_COMPUTER) { }
computerPlayer = true; break;
} case SEAT_STAYONTABLE: {
playerNameLabelArray[(*it_c)->getMyID()]->setText(QString::fromUtf8((*it_c)->getMyName().c_str()), TRUE, guest, computerPlayer); playerNameLabelArray[(*it_c)->getMyID()]->setText(nick, TRUE, guest, computerPlayer );
}
break;
} else { case SEAT_CLEAR: {
playerNameLabelArray[(*it_c)->getMyID()]->setText(""); playerNameLabelArray[(*it_c)->getMyID()]->setText("");
} }
} else { break;
playerNameLabelArray[(*it_c)->getMyID()]->setText(""); default: {
} playerNameLabelArray[(*it_c)->getMyID()]->setText("");
}
} }
} }
} }
@@ -943,32 +946,42 @@ void gameTableImpl::refreshPlayerAvatar()
PlayerList seatsList = currentGame->getSeatsList(); PlayerList seatsList = currentGame->getSeatsList();
for (it_c=seatsList->begin(), seatPlace=0; it_c!=seatsList->end(); ++it_c, seatPlace++) { for (it_c=seatsList->begin(), seatPlace=0; it_c!=seatsList->end(); ++it_c, seatPlace++) {
//get CountryString
QString countryString(QString(myStartWindow->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).countryCode.c_str()).toLower()); QString countryString(QString(myStartWindow->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).countryCode.c_str()).toLower());
countryString = QString(":/cflags/cflags/%1.png").arg(countryString); countryString = QString(":/cflags/cflags/%1.png").arg(countryString);
if((*it_c)->getMyActiveStatus()) { //get AvatarPic
QFile myAvatarFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str()));
QPixmap avatarPic;
if((*it_c)->getMyAvatar() == "" || !myAvatarFile.exists()) {
avatarPic = QPixmap::fromImage(QImage(myGameTableStyle->getDefaultAvatar()));
}
else {
avatarPic = QPixmap::fromImage(QImage(QString::fromUtf8((*it_c)->getMyAvatar().c_str())));
}
QFile myAvatarFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str())); //check SeatStates and refresh
if((*it_c)->getMyAvatar() == "" || !myAvatarFile.exists()) { switch(getCurrentSeatState((*it_c))) {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(QPixmap::fromImage(QImage(myGameTableStyle->getDefaultAvatar())),countryString,seatPlace);
} else { case SEAT_ACTIVE: {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(QPixmap::fromImage(QImage(QString::fromUtf8((*it_c)->getMyAvatar().c_str()))),countryString,seatPlace); playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace);
} }
} else { break;
if((myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK)) { case SEAT_AUTOFOLD: {
if((*it_c)->getMyStayOnTableStatus() == TRUE && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER) { playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace, TRUE);
QFile myAvatarFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str())); }
if((*it_c)->getMyAvatar() == "" || !myAvatarFile.exists()) { break;
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(QPixmap::fromImage(QImage(myGameTableStyle->getDefaultAvatar())), countryString, seatPlace, TRUE); case SEAT_STAYONTABLE: {
} else { playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace, TRUE);
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(QPixmap::fromImage(QImage(QString::fromUtf8((*it_c)->getMyAvatar().c_str()))),countryString,seatPlace, TRUE); }
} break;
} else { case SEAT_CLEAR: {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(onePix); playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
} }
} else { break;
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(onePix); default: {
} playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
}
} }
} }
} }
@@ -1062,13 +1075,34 @@ void gameTableImpl::refreshCash()
PlayerListConstIterator it_c; PlayerListConstIterator it_c;
PlayerList seatsList = currentGame->getSeatsList(); PlayerList seatsList = currentGame->getSeatsList();
for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) { for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) {
if((*it_c)->getMyActiveStatus()) {
QGraphicsOpacityEffect opacity;
opacity.setOpacity(0.8);
//check SeatStates and refresh
switch(getCurrentSeatState((*it_c))) {
case SEAT_ACTIVE: {
cashLabelArray[(*it_c)->getMyID()]->setText("$"+QString("%L1").arg((*it_c)->getMyCash())); cashLabelArray[(*it_c)->getMyID()]->setText("$"+QString("%L1").arg((*it_c)->getMyCash()));
}
} else { break;
case SEAT_AUTOFOLD: {
cashLabelArray[(*it_c)->getMyID()]->setText("$"+QString("%L1").arg((*it_c)->getMyCash()));
cashLabelArray[(*it_c)->getMyID()]->setGraphicsEffect(&opacity);
}
break;
case SEAT_STAYONTABLE: {
cashLabelArray[(*it_c)->getMyID()]->setText(""); cashLabelArray[(*it_c)->getMyID()]->setText("");
} }
break;
case SEAT_CLEAR: {
cashLabelArray[(*it_c)->getMyID()]->setText("");
}
break;
default: {
cashLabelArray[(*it_c)->getMyID()]->setText("");
}
}
} }
} }
@@ -3794,3 +3828,24 @@ void gameTableImpl::hide()
textBrowser_Log->clear(); textBrowser_Log->clear();
QWidget::hide(); QWidget::hide();
} }
SeatState gameTableImpl::getCurrentSeatState(boost::shared_ptr<PlayerInterface> player) {
if(player->getMyActiveStatus()) {
if(player->isSessionActive()) {
return SEAT_ACTIVE;
}
else {
return SEAT_AUTOFOLD;
}
}
else {
if(player->getMyStayOnTableStatus() && (myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK)) {
return SEAT_STAYONTABLE;
}
else {
return SEAT_CLEAR;
}
}
return SEAT_UNDEFINED;
}
+4
View File
@@ -49,6 +49,8 @@ class CardDeckStyleReader;
class SDLPlayer; class SDLPlayer;
enum SeatState { SEAT_UNDEFINED, SEAT_ACTIVE, SEAT_AUTOFOLD, SEAT_STAYONTABLE, SEAT_CLEAR };
class gameTableImpl: public QMainWindow, public Ui::gameTable class gameTableImpl: public QMainWindow, public Ui::gameTable
{ {
Q_OBJECT Q_OBJECT
@@ -159,6 +161,8 @@ public slots:
void refreshActionButtonFKeyIndicator(bool =0); void refreshActionButtonFKeyIndicator(bool =0);
void setPlayerAvatar(int myID, QString myAvatar); void setPlayerAvatar(int myID, QString myAvatar);
SeatState getCurrentSeatState(boost::shared_ptr<PlayerInterface> );
void guiUpdateDone(); void guiUpdateDone();
void waitForGuiUpdateDone(); void waitForGuiUpdateDone();