some more work on connection dialog
This commit is contained in:
parent
82e2f301ee
commit
e2f028eae7
10 changed files with 119 additions and 16 deletions
|
@ -551,5 +551,5 @@ int CChannel::GetUploadRateKbps()
|
|||
// CConnectionLessChannel implementation ***************************************
|
||||
CConnectionLessChannel::CConnectionLessChannel()
|
||||
{
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
|
|
@ -236,6 +236,7 @@ protected:
|
|||
|
||||
// only one channel is needed for client application
|
||||
CChannel Channel;
|
||||
CConnectionLessChannel ConnLessChannel;
|
||||
bool bDoAutoSockBufSize;
|
||||
|
||||
// audio encoder/decoder
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
/* Definitions ****************************************************************/
|
||||
// update time for GUI controls
|
||||
#define DISPLAY_UPDATE_TIME 1000 // ms
|
||||
#define PING_UPDATE_TIME 500 // ms
|
||||
|
||||
|
||||
/* Classes ********************************************************************/
|
||||
|
|
|
@ -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 );
|
||||
}
|
|
@ -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();
|
||||
};
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>458</width>
|
||||
<height>350</height>
|
||||
<width>569</width>
|
||||
<height>355</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
|
@ -29,22 +29,22 @@
|
|||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Server IP : Port</string>
|
||||
<string>Server Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Name</string>
|
||||
<string>Country</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Ping Time</string>
|
||||
<string>Clients</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Ping Status</string>
|
||||
<string>Ping Time/ms</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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_
|
||||
|
|
Loading…
Reference in a new issue