diff --git a/src/channel.cpp b/src/channel.cpp index 57dc6965..5f43daef 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -551,5 +551,5 @@ int CChannel::GetUploadRateKbps() // CConnectionLessChannel implementation *************************************** CConnectionLessChannel::CConnectionLessChannel() { - + // TODO } diff --git a/src/client.h b/src/client.h index 5a00740f..1e4e8027 100755 --- a/src/client.h +++ b/src/client.h @@ -236,6 +236,7 @@ protected: // only one channel is needed for client application CChannel Channel; + CConnectionLessChannel ConnLessChannel; bool bDoAutoSockBufSize; // audio encoder/decoder diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index a1c09d17..1ced87af 100755 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -51,7 +51,6 @@ /* Definitions ****************************************************************/ // update time for GUI controls #define DISPLAY_UPDATE_TIME 1000 // ms -#define PING_UPDATE_TIME 500 // ms /* Classes ********************************************************************/ diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 3828a617..a047be67 100755 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -26,3 +26,57 @@ /* Implementation *************************************************************/ +CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f ) : + QDialog ( parent, f ) +{ + setupUi ( this ); + + + // add help text to controls ----------------------------------------------- + +// TODO + + + // set up list view for connected clients + ListViewServers->setColumnWidth ( 0, 170 ); + ListViewServers->setColumnWidth ( 1, 130 ); + ListViewServers->setColumnWidth ( 2, 55 ); + ListViewServers->setColumnWidth ( 3, 80 ); + ListViewServers->clear(); + + +//TextLabelPingTime->setText ( "" ); + + + // Connections ------------------------------------------------------------- + // timers + QObject::connect ( &TimerPing, SIGNAL ( timeout() ), + this, SLOT ( OnTimerPing() ) ); +} + +void CConnectDlg::showEvent ( QShowEvent* ) +{ + // only activate ping timer if window is actually shown + TimerPing.start ( PING_UPDATE_TIME ); + +// UpdateDisplay(); +} + +void CConnectDlg::hideEvent ( QHideEvent* ) +{ + // if window is closed, stop timer for ping + TimerPing.stop(); +} + +void CConnectDlg::OnTimerPing() +{ + // send ping message to server +// pClient->SendPingMess(); +} + +void CConnectDlg::OnPingTimeResult ( int iPingTime ) +{ + +// TODO +// TextLabelPingTime->setText ( sErrorText ); +} \ No newline at end of file diff --git a/src/connectdlg.h b/src/connectdlg.h index 650e17ae..96fdd25b 100755 --- a/src/connectdlg.h +++ b/src/connectdlg.h @@ -45,7 +45,16 @@ class CConnectDlg : public QDialog, private Ui_CConnectDlgBase Q_OBJECT public: + CConnectDlg ( QWidget* parent = 0, Qt::WindowFlags f = 0 ); protected: + QTimer TimerPing; + virtual void showEvent ( QShowEvent* ); + virtual void hideEvent ( QHideEvent* ); + + void OnPingTimeResult ( int iPingTime ); + +public slots: + void OnTimerPing(); }; diff --git a/src/connectdlgbase.ui b/src/connectdlgbase.ui index 1b418d17..207849e9 100755 --- a/src/connectdlgbase.ui +++ b/src/connectdlgbase.ui @@ -5,8 +5,8 @@ 0 0 - 458 - 350 + 569 + 355 @@ -29,22 +29,22 @@ - Server IP : Port + Server Name - Name + Country - Ping Time + Clients - Ping Status + Ping Time/ms diff --git a/src/global.h b/src/global.h index 6c502677..135a258e 100755 --- a/src/global.h +++ b/src/global.h @@ -128,6 +128,9 @@ // without any other changes in the code #define USED_NUM_CHANNELS 6 // used number channels for server +// defines the time interval at which the ping time is updated in the GUI +#define PING_UPDATE_TIME 500 // ms + // length of the moving average buffer for response time measurement #define TIME_MOV_AV_RESPONSE 30 // seconds diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index 8afaf09a..aeea67b8 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -45,7 +45,13 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, // this somehow only works reliable on Windows , Qt::WindowMinMaxButtonsHint #endif - ) + ), + ConnectDlg ( parent +#ifdef _WIN32 + // this somehow only works reliable on Windows + , Qt::WindowMinMaxButtonsHint +#endif + ) { setupUi ( this ); @@ -434,12 +440,18 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, // Timers ------------------------------------------------------------------ // start timer for status bar TimerStatus.start ( LED_BAR_UPDATE_TIME ); + + +// TEST +ConnectDlg.show(); + } void CLlconClientDlg::closeEvent ( QCloseEvent* Event ) { - // if settings dialog or chat dialog is open, close it + // if settings/connect dialog or chat dialog is open, close it ClientSettingsDlg.close(); + ConnectDlg.close(); ChatDlg.close(); // if connected, terminate connection diff --git a/src/llconclientdlg.h b/src/llconclientdlg.h index 97753440..ef596a54 100755 --- a/src/llconclientdlg.h +++ b/src/llconclientdlg.h @@ -39,6 +39,7 @@ #include "audiomixerboard.h" #include "clientsettingsdlg.h" #include "chatdlg.h" +#include "connectdlg.h" #ifdef _WIN32 # include "../windows/moc/llconclientdlgbase.h" #else @@ -101,6 +102,7 @@ protected: CClientSettingsDlg ClientSettingsDlg; CChatDlg ChatDlg; + CConnectDlg ConnectDlg; public slots: void OnConnectDisconBut(); diff --git a/src/multicolorled.h b/src/multicolorled.h index b87d076a..4eb7d3e7 100755 --- a/src/multicolorled.h +++ b/src/multicolorled.h @@ -105,8 +105,8 @@ class CMultColLEDListViewItem : public CMultiColorLED Q_OBJECT public: - CMultColLEDListViewItem ( const int iNewCol ) : pListViewItem ( NULL ), - iColumn ( iNewCol ) {} + CMultColLEDListViewItem ( const int iNewCol ) + : pListViewItem ( NULL ), iColumn ( iNewCol ) {} void SetListViewItemPointer ( QTreeWidgetItem* pNewListViewItem ) { @@ -131,8 +131,8 @@ protected: class CServerListViewItem : public QTreeWidgetItem { public: - CServerListViewItem ( QTreeWidget* parent ) : QTreeWidgetItem ( parent ), - LED0 ( 2 ), LED1 ( 3 ) + CServerListViewItem ( QTreeWidget* parent ) + : QTreeWidgetItem ( parent ), LED0 ( 2 ), LED1 ( 3 ) { LED0.SetListViewItemPointer ( this ); LED1.SetListViewItemPointer ( this ); @@ -142,8 +142,13 @@ public: { switch ( iWhichLED ) { - case 0: LED0.SetLight ( iNewStatus ); break; - case 1: LED1.SetLight ( iNewStatus ); break; + case 0: + LED0.SetLight ( iNewStatus ); + break; + + case 1: + LED1.SetLight ( iNewStatus ); + break; } } @@ -151,4 +156,22 @@ protected: CMultColLEDListViewItem LED0, LED1; }; + +class CConnectionServerListViewItem : public QTreeWidgetItem +{ +public: + CConnectionServerListViewItem ( QTreeWidget* parent ) + : QTreeWidgetItem ( parent ), LED ( 4 ) + { + LED.SetListViewItemPointer ( this ); + } + + void Reset() { LED.Reset(); } + void SetUpdateTime ( const int iNUTi ) { LED.SetUpdateTime ( iNUTi ); } + void SetLight ( int iNewStatus ) { LED.SetLight ( iNewStatus ); } + +protected: + CMultColLEDListViewItem LED; +}; + #endif // _MULTCOLORLED_H__FD6B49B5_87DF_48DD_A873_804E1606C2AC__INCLUDED_