diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp
index 742ca75d..b2bda28c 100755
--- a/src/clientsettingsdlg.cpp
+++ b/src/clientsettingsdlg.cpp
@@ -1,5 +1,5 @@
/******************************************************************************\
- * Copyright (c) 2004-2006
+ * Copyright (c) 2004-2008
*
* Author(s):
* Volker Fischer
@@ -34,6 +34,11 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
// init timing jitter text label
TextLabelStdDevTimer->setText ( "" );
+ // ping time controls
+ CLEDPingTime->SetUpdateTime ( 2 * PING_UPDATE_TIME );
+ CLEDPingTime->Reset();
+ TextLabelPingTime->setText ( "" );
+
// init slider controls ---
// sound buffer in
#ifdef _WIN32
@@ -93,6 +98,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
QObject::connect ( &TimerStatus, SIGNAL ( timeout() ),
this, SLOT ( OnTimerStatus() ) );
+ QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
+ this, SLOT ( OnTimerPing() ) );
+
// sliders
QObject::connect ( SliderSndBufIn, SIGNAL ( valueChanged ( int ) ),
this, SLOT ( OnSliderSndBufInChange ( int ) ) );
@@ -121,6 +129,18 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
TimerStatus.start ( DISPLAY_UPDATE_TIME );
}
+void CClientSettingsDlg::showEvent ( QShowEvent* showEvent )
+{
+ // only activate ping timer if window is actually shown
+ TimerPing.start ( PING_UPDATE_TIME );
+}
+
+void CClientSettingsDlg::hideEvent ( QHideEvent* hideEvent )
+{
+ // if window is closed, stop timer for ping
+ TimerPing.stop();
+}
+
void CClientSettingsDlg::OnSliderSndBufInChange ( int value )
{
pClient->GetSndInterface()->SetInNumBuf ( value );
@@ -166,25 +186,35 @@ void CClientSettingsDlg::OnOpenChatOnNewMessageStateChanged ( int value )
UpdateDisplay();
}
+void CClientSettingsDlg::OnTimerPing()
+{
+ // send ping message to server
+ pClient->SendPingMess();
+}
+
void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
{
-
-// TEST
-//TextLabelStdDevTimer->setText ( QString().setNum ( iPingTime ) + " ms" );
-
-
-
+ // color definition: < 20 ms green, < 50 ms yellow, otherwise red
+ if ( iPingTime < 20 )
+ {
+ CLEDPingTime->SetLight ( MUL_COL_LED_GREEN );
+ }
+ else
+ {
+ if ( iPingTime < 50 )
+ {
+ CLEDPingTime->SetLight ( MUL_COL_LED_YELLOW );
+ }
+ else
+ {
+ CLEDPingTime->SetLight ( MUL_COL_LED_RED );
+ }
+ }
+ TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" );
}
void CClientSettingsDlg::UpdateDisplay()
{
-
-
-// TEST
-//pClient->SendPingMess();
-
-
-
// response time
TextLabelStdDevTimer->setText ( QString().
setNum ( pClient->GetTimingStdDev(), 'f', 2 ) + " ms" );
diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h
index 3ed0c32a..0b11f3c7 100755
--- a/src/clientsettingsdlg.h
+++ b/src/clientsettingsdlg.h
@@ -46,6 +46,7 @@
/* Definitions ****************************************************************/
// update time for GUI controls
#define DISPLAY_UPDATE_TIME 1000 // ms
+#define PING_UPDATE_TIME 500 // ms
/* Classes ********************************************************************/
@@ -62,10 +63,15 @@ public:
protected:
CClient* pClient;
QTimer TimerStatus;
+ QTimer TimerPing;
void UpdateDisplay();
+ virtual void showEvent ( QShowEvent* showEvent );
+ virtual void hideEvent ( QHideEvent* hideEvent );
+
public slots:
void OnTimerStatus() { UpdateDisplay(); }
+ void OnTimerPing();
void OnSliderSndBufInChange ( int value );
void OnSliderSndBufOutChange ( int value );
void OnSliderNetBuf ( int value );
diff --git a/src/clientsettingsdlgbase.ui b/src/clientsettingsdlgbase.ui
index ce06f290..e2d4d694 100755
--- a/src/clientsettingsdlgbase.ui
+++ b/src/clientsettingsdlgbase.ui
@@ -6,7 +6,7 @@
0
0
425
- 271
+ 257
@@ -750,12 +750,58 @@
- 20
- 71
+ 98
+ 51
+ -
+
+
-
+
+
+ Ping Time:
+
+
+ false
+
+
+
+ -
+
+
+ val
+
+
+ false
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 13
+ 13
+
+
+
+
+ 13
+ 13
+
+
+
+
+
+
-