gui part for #239 server ping state display
This commit is contained in:
@@ -64,7 +64,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
|
||||
myConfigState = OK;
|
||||
|
||||
// !!!! Revisionsnummer der Configdefaults !!!!!
|
||||
configRev = 103;
|
||||
configRev = 104;
|
||||
|
||||
//standard defaults
|
||||
logOnOffDefault = "1";
|
||||
@@ -150,9 +150,9 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
|
||||
configList.push_back(ConfigInfo("AppDataDir", CONFIG_TYPE_STRING, myQtToolsInterface->getDataPathStdString(myArgv0)));
|
||||
#endif
|
||||
configList.push_back(ConfigInfo("Language", CONFIG_TYPE_INT, myQtToolsInterface->getDefaultLanguage()));
|
||||
/*configList.push_back(ConfigInfo("InternetServerAddressIRCChannelUpdateDone", CONFIG_TYPE_INT, "1"));*/ //HACK
|
||||
configList.push_back(ConfigInfo("ShowLeftToolBox", CONFIG_TYPE_INT, "1"));
|
||||
configList.push_back(ConfigInfo("ShowCountryFlagInAvatar", CONFIG_TYPE_INT, "1"));
|
||||
configList.push_back(ConfigInfo("ShowPingStateInAvatar", 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("ShowFlipCardsAnimation", CONFIG_TYPE_INT, "1"));
|
||||
|
||||
@@ -681,7 +681,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||
connect(this, SIGNAL(signalNetClientPlayerLeft(unsigned)), this, SLOT(netClientPlayerLeft(unsigned)));
|
||||
connect(this, SIGNAL(signalNetClientSpectatorLeft(unsigned)), this, SLOT(netClientSpectatorLeft(unsigned)));
|
||||
connect(this, SIGNAL(signalNetClientSpectatorJoined(unsigned)), this, SLOT(netClientSpectatorJoined(unsigned)));
|
||||
|
||||
connect(this, SIGNAL(signalNetClientPingUpdate(unsigned, unsigned, unsigned)), this, SLOT(pingUpdate(unsigned, unsigned, unsigned)));
|
||||
|
||||
#ifdef GUI_800x480
|
||||
connect( tabsButton, SIGNAL( clicked() ), this, SLOT( tabsButtonClicked() ) );
|
||||
@@ -4496,3 +4496,8 @@ void gameTableImpl::refreshSpectatorsDisplay()
|
||||
}
|
||||
}
|
||||
|
||||
void gameTableImpl::pingUpdate(unsigned minPing, unsigned avgPing, unsigned maxPing)
|
||||
{
|
||||
label_Avatar0->refreshPing(minPing, avgPing, maxPing);
|
||||
}
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@ signals:
|
||||
void signalNetClientPlayerLeft(unsigned playerId);
|
||||
void signalNetClientSpectatorLeft(unsigned playerId);
|
||||
void signalNetClientSpectatorJoined(unsigned playerId);
|
||||
void signalNetClientPingUpdate(unsigned minPing, unsigned avgPing, unsigned maxPing);
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -375,6 +376,7 @@ public slots:
|
||||
void tabsButtonClose();
|
||||
#endif
|
||||
void refreshSpectatorsDisplay();
|
||||
void pingUpdate(unsigned, unsigned, unsigned);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
using namespace std;
|
||||
|
||||
MyAvatarLabel::MyAvatarLabel(QGroupBox* parent)
|
||||
: QLabel(parent), voteRunning(false), transparent(false), myUniqueId(0)
|
||||
: QLabel(parent), voteRunning(false), transparent(false), myUniqueId(0), myPingState(0), myAvgPing(0), myMinPing(0), myMaxPing(0)
|
||||
{
|
||||
|
||||
myContextMenu = new QMenu;
|
||||
@@ -398,10 +398,54 @@ void MyAvatarLabel::paintEvent(QPaintEvent*)
|
||||
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;
|
||||
}
|
||||
|
||||
if(myW->getMyConfig()->readConfigInt("ShowPingStateInAvatar")) {
|
||||
//paint ping state color for network clients
|
||||
if(mySession->isNetworkClientRunning() && myId == 0) {
|
||||
QColor pingColor;
|
||||
if(myAvgPing > 0 && myAvgPing <= 1000) {
|
||||
pingColor.setNamedColor("green");
|
||||
}
|
||||
else if(myAvgPing > 1000 && myAvgPing <= 2000 ) {
|
||||
pingColor.setNamedColor("yellow");
|
||||
}
|
||||
else if(myAvgPing > 2000) {
|
||||
pingColor.setNamedColor("red");
|
||||
}
|
||||
else {
|
||||
pingColor.setNamedColor("white");
|
||||
}
|
||||
QColor pen = pingColor.darker(200);
|
||||
// pen.setAlpha(130);
|
||||
painter.setPen(pen);
|
||||
QColor brush = pingColor;
|
||||
// brush.setAlpha(130);
|
||||
painter.setBrush(brush);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.drawEllipse(1, 1, 10, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MyAvatarLabel::refreshPing(unsigned minPing, unsigned avgPing, unsigned maxPing)
|
||||
{
|
||||
myMinPing = minPing;
|
||||
myAvgPing = avgPing;
|
||||
myMaxPing = maxPing;
|
||||
this->update();
|
||||
|
||||
if(myW->getMyConfig()->readConfigInt("ShowPingStateInAvatar")) {
|
||||
QString toolTip = "<b>"+tr("Server response times")+"</b>";
|
||||
toolTip.append("<br>"+tr("Average: ")+QString("%1").arg(myAvgPing)+tr("ms"));
|
||||
toolTip.append("<br>"+tr("Minimum: ")+QString("%1").arg(myMinPing)+tr("ms"));
|
||||
toolTip.append("<br>"+tr("Maximum: ")+QString("%1").arg(myMaxPing)+tr("ms"));
|
||||
this->setToolTip(toolTip);
|
||||
}
|
||||
else {
|
||||
this->setToolTip("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,8 @@ public slots:
|
||||
void setPlayerRating(QString);
|
||||
void refreshTooltips();
|
||||
void refreshStars();
|
||||
void refreshPing(unsigned, unsigned, unsigned);
|
||||
|
||||
private:
|
||||
|
||||
gameTableImpl *myW;
|
||||
@@ -103,6 +105,10 @@ private:
|
||||
bool transparent;
|
||||
int myId;
|
||||
int myUniqueId;
|
||||
unsigned myPingState;
|
||||
unsigned myAvgPing;
|
||||
unsigned myMinPing;
|
||||
unsigned myMaxPing;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -291,42 +291,14 @@
|
||||
<string>Network / Internet Game</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_24">
|
||||
<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>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_enableBetInputFocusSwitch">
|
||||
<property name="text">
|
||||
<string>Switch keyboard focus to bet-input-field if it's your turn</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_enableAccidentallyCallBlocker">
|
||||
<property name="text">
|
||||
<string>Activate the "accidentally call after big raise" blocker</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_dontHideAvatarsOfIgnored">
|
||||
<property name="text">
|
||||
<string>Do not hide avatars of players which are on the ignore list</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_disableChatEmoticons">
|
||||
<property name="text">
|
||||
<string>Disable emoticons in the chat</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -339,6 +311,41 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_disableChatEmoticons">
|
||||
<property name="text">
|
||||
<string>Disable emoticons in the chat</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_enableBetInputFocusSwitch">
|
||||
<property name="text">
|
||||
<string>Switch keyboard focus to bet-input-field if it's your turn</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_enableAccidentallyCallBlocker">
|
||||
<property name="text">
|
||||
<string>Activate the "accidentally call after big raise" blocker</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_showPingStateInAvatar">
|
||||
<property name="text">
|
||||
<string>Show multicolor network state display in the avatar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -343,7 +343,7 @@ void GuiWrapper::SignalNetClientStatsUpdate(const ServerStats &stats)
|
||||
}
|
||||
void GuiWrapper::SignalNetClientPingUpdate(unsigned minPing, unsigned avgPing, unsigned maxPing)
|
||||
{
|
||||
// TODO
|
||||
myW->signalNetClientPingUpdate(minPing, avgPing, maxPing);
|
||||
}
|
||||
void GuiWrapper::SignalNetClientShowTimeoutDialog(NetTimeoutReason reason, unsigned remainingSec)
|
||||
{
|
||||
@@ -533,3 +533,4 @@ void GuiWrapper::SignalRejectedGameInvitation(unsigned gameId, unsigned playerId
|
||||
{
|
||||
myStartWindow->signalRejectedGameInvitation(gameId, playerIdWho, reason);
|
||||
}
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@
|
||||
<string>Network / Internet Game</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<spacer name="verticalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -309,41 +309,48 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkBox_UseLobbyChat">
|
||||
<property name="text">
|
||||
<string>Show lobby chat</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkBox_enableBetInputFocusSwitch">
|
||||
<property name="text">
|
||||
<string>Switch keyboard focus to bet-input-field if it's your turn</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkBox_enableAccidentallyCallBlocker">
|
||||
<property name="text">
|
||||
<string>Activate the "accidentally call after big raise" blocker</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="checkBox_dontHideAvatarsOfIgnored">
|
||||
<property name="text">
|
||||
<string>Do not hide avatars of players which are on the ignore list</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_disableChatEmoticons">
|
||||
<property name="text">
|
||||
<string>Disable emoticons in the chat</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="checkBox_showPingStateInAvatar">
|
||||
<property name="text">
|
||||
<string>Show multicolor network state display in the corner of the avatar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
@@ -287,6 +287,7 @@ void settingsDialogImpl::prepareDialog()
|
||||
checkBox_showFlipCardsAnimation->setChecked(myConfig->readConfigInt("ShowFlipCardsAnimation"));
|
||||
checkBox_showBlindButtons->setChecked(myConfig->readConfigInt("ShowBlindButtons"));
|
||||
checkBox_showCountryFlagInAvatar->setChecked(myConfig->readConfigInt("ShowCountryFlagInAvatar"));
|
||||
checkBox_showPingStateInAvatar->setChecked(myConfig->readConfigInt("ShowPingStateInAvatar"));
|
||||
checkBox_antiPeekMode->setChecked(myConfig->readConfigInt("AntiPeekMode"));
|
||||
checkBox_enableBetInputFocusSwitch->setChecked(myConfig->readConfigInt("EnableBetInputFocusSwitch"));
|
||||
checkBox_cardsChanceMonitor->setChecked(myConfig->readConfigInt("ShowCardsChanceMonitor"));
|
||||
@@ -738,6 +739,7 @@ void settingsDialogImpl::isAccepted()
|
||||
myConfig->writeConfigInt("ShowCardsChanceMonitor", checkBox_cardsChanceMonitor->isChecked());
|
||||
myConfig->writeConfigInt("AntiPeekMode", checkBox_antiPeekMode->isChecked());
|
||||
myConfig->writeConfigInt("ShowCountryFlagInAvatar", checkBox_showCountryFlagInAvatar->isChecked());
|
||||
myConfig->writeConfigInt("ShowPingStateInAvatar", checkBox_showPingStateInAvatar->isChecked());
|
||||
myConfig->writeConfigInt("DontTranslateInternationalPokerStringsFromStyle", checkBox_dontTranslatePokerStrings->isChecked());
|
||||
myConfig->writeConfigInt("DisableSplashScreenOnStartup", checkBox_disableSplashscreen->isChecked());
|
||||
myConfig->writeConfigInt("EnableBetInputFocusSwitch", checkBox_enableBetInputFocusSwitch->isChecked());
|
||||
|
||||
Reference in New Issue
Block a user