Add the number of spectators next to the spectator icon #206

This commit is contained in:
doitux
2013-11-12 23:23:51 +01:00
parent 7b3ec43bd1
commit 044553fddb
4 changed files with 19 additions and 2 deletions
+11
View File
@@ -449,6 +449,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
pushButton_showMyCards->hide(); pushButton_showMyCards->hide();
spectatorIcon = new QLabel(this); spectatorIcon = new QLabel(this);
spectatorNumberLabel = new QLabel(this);
//style Game Table //style Game Table
refreshGameTableStyle(); refreshGameTableStyle();
@@ -3594,6 +3595,7 @@ void gameTableImpl::networkGameModification()
#endif #endif
blinkingStartButtonAnimationTimer->stop(); blinkingStartButtonAnimationTimer->stop();
spectatorIcon->show(); spectatorIcon->show();
spectatorNumberLabel->show();
refreshSpectatorsDisplay(); refreshSpectatorsDisplay();
} }
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK) { if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK) {
@@ -3603,6 +3605,7 @@ void gameTableImpl::networkGameModification()
pushButton_break->hide(); pushButton_break->hide();
#endif #endif
spectatorIcon->hide(); spectatorIcon->hide();
spectatorNumberLabel->hide();
} }
//Set the playing mode to "manual" //Set the playing mode to "manual"
#ifdef GUI_800x480 #ifdef GUI_800x480
@@ -4272,6 +4275,7 @@ void gameTableImpl::refreshGameTableStyle()
label_handNumber->setText(HandString+":"); label_handNumber->setText(HandString+":");
label_gameNumber->setText(GameString+":"); label_gameNumber->setText(GameString+":");
myGameTableStyle->setSpectatorNumberLabelStyle(spectatorNumberLabel);
} }
void gameTableImpl::saveGameTableGeometry() void gameTableImpl::saveGameTableGeometry()
@@ -4470,6 +4474,10 @@ void gameTableImpl::refreshSpectatorsDisplay()
int iconY = 2; int iconY = 2;
spectatorIcon->move(iconX,iconY); spectatorIcon->move(iconX,iconY);
spectatorIcon->setPixmap(spectatorPix); spectatorIcon->setPixmap(spectatorPix);
int labelX = this->centralWidget()->geometry().width() - spectatorPix.width() - 1;
int labelY = spectatorPix.height()+2;
spectatorNumberLabel->setGeometry(labelX, labelY, 32, 14);
spectatorNumberLabel->setText(QString("%1").arg(info.spectatorsDuringGame.size()));
QString spectatorList = QString("<b>"+tr("Spectators")+":</b><br>"); QString spectatorList = QString("<b>"+tr("Spectators")+":</b><br>");
PlayerIdList::const_iterator i = info.spectatorsDuringGame.begin(); PlayerIdList::const_iterator i = info.spectatorsDuringGame.begin();
@@ -4481,9 +4489,12 @@ void gameTableImpl::refreshSpectatorsDisplay()
} }
spectatorList.remove(spectatorList.size()-4,4); spectatorList.remove(spectatorList.size()-4,4);
spectatorIcon->setToolTip(spectatorList); spectatorIcon->setToolTip(spectatorList);
spectatorNumberLabel->setToolTip(spectatorList);
} else { } else {
spectatorIcon->setToolTip(""); spectatorIcon->setToolTip("");
spectatorIcon->clear(); spectatorIcon->clear();
spectatorNumberLabel->setToolTip("");
spectatorNumberLabel->clear();
} }
} }
+1
View File
@@ -442,6 +442,7 @@ private:
QLabel *playerTipLabelArray[MAX_NUMBER_OF_PLAYERS]; QLabel *playerTipLabelArray[MAX_NUMBER_OF_PLAYERS];
QPixmap flipside; QPixmap flipside;
QLabel *spectatorIcon; QLabel *spectatorIcon;
QLabel *spectatorNumberLabel;
// Dialogs // Dialogs
startWindowImpl *myStartWindow; startWindowImpl *myStartWindow;
@@ -1372,6 +1372,12 @@ void GameTableStyleReader::setCashLabelStyle(QLabel *cl)
cl->setStyleSheet("QLabel { "+ font2String +" font-size: "+cashFontSize+"px; font-weight: bold; color: #"+PlayerCashTextColor+"; }"); cl->setStyleSheet("QLabel { "+ font2String +" font-size: "+cashFontSize+"px; font-weight: bold; color: #"+PlayerCashTextColor+"; }");
} }
void GameTableStyleReader::setSpectatorNumberLabelStyle(QLabel *snl)
{
snl->setStyleSheet("QLabel { "+ font2String +" font-size: 12px; font-weight: bold; color: #"+MenuTextColor+"; }");
snl->setAlignment(Qt::AlignHCenter);
}
void GameTableStyleReader::setSetLabelStyle(QLabel *sl) void GameTableStyleReader::setSetLabelStyle(QLabel *sl)
{ {
sl->setStyleSheet("QLabel { "+ font2String +" font-size: "+setLabelFontSize+"px; font-weight: bold; color: #"+PlayerBetTextColor+"; }"); sl->setStyleSheet("QLabel { "+ font2String +" font-size: "+setLabelFontSize+"px; font-weight: bold; color: #"+PlayerBetTextColor+"; }");
+1 -2
View File
@@ -222,10 +222,9 @@ public:
void setVoteStringsStyle(QLabel*); void setVoteStringsStyle(QLabel*);
void setBetValueInputStyle(QSpinBox*); void setBetValueInputStyle(QSpinBox*);
void setSliderStyle(QSlider*); void setSliderStyle(QSlider*);
void setTabWidgetStyle(QTabWidget*, QTabBar*); void setTabWidgetStyle(QTabWidget*, QTabBar*);
void setWindowsGeometry(gameTableImpl*); void setWindowsGeometry(gameTableImpl*);
void setSpectatorNumberLabelStyle(QLabel*);
//set pics and fonts and colors //set pics and fonts and colors
void setButtonsStyle(MyActionButton*, MyActionButton*, MyActionButton*, MyActionButton*, int); void setButtonsStyle(MyActionButton*, MyActionButton*, MyActionButton*, MyActionButton*, int);