some more work on connection dialog

This commit is contained in:
Volker Fischer 2011-03-29 07:21:00 +00:00
parent 82e2f301ee
commit e2f028eae7
10 changed files with 119 additions and 16 deletions

View file

@ -551,5 +551,5 @@ int CChannel::GetUploadRateKbps()
// CConnectionLessChannel implementation *************************************** // CConnectionLessChannel implementation ***************************************
CConnectionLessChannel::CConnectionLessChannel() CConnectionLessChannel::CConnectionLessChannel()
{ {
// TODO
} }

View file

@ -236,6 +236,7 @@ protected:
// only one channel is needed for client application // only one channel is needed for client application
CChannel Channel; CChannel Channel;
CConnectionLessChannel ConnLessChannel;
bool bDoAutoSockBufSize; bool bDoAutoSockBufSize;
// audio encoder/decoder // audio encoder/decoder

View file

@ -51,7 +51,6 @@
/* Definitions ****************************************************************/ /* Definitions ****************************************************************/
// update time for GUI controls // update time for GUI controls
#define DISPLAY_UPDATE_TIME 1000 // ms #define DISPLAY_UPDATE_TIME 1000 // ms
#define PING_UPDATE_TIME 500 // ms
/* Classes ********************************************************************/ /* Classes ********************************************************************/

View file

@ -26,3 +26,57 @@
/* Implementation *************************************************************/ /* 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 );
}

View file

@ -45,7 +45,16 @@ class CConnectDlg : public QDialog, private Ui_CConnectDlgBase
Q_OBJECT Q_OBJECT
public: public:
CConnectDlg ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
protected: protected:
QTimer TimerPing;
virtual void showEvent ( QShowEvent* );
virtual void hideEvent ( QHideEvent* );
void OnPingTimeResult ( int iPingTime );
public slots:
void OnTimerPing();
}; };

View file

@ -5,8 +5,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>458</width> <width>569</width>
<height>350</height> <height>355</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
@ -29,22 +29,22 @@
</property> </property>
<column> <column>
<property name="text" > <property name="text" >
<string>Server IP : Port</string> <string>Server Name</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text" > <property name="text" >
<string>Name</string> <string>Country</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text" > <property name="text" >
<string>Ping Time</string> <string>Clients</string>
</property> </property>
</column> </column>
<column> <column>
<property name="text" > <property name="text" >
<string>Ping Status</string> <string>Ping Time/ms</string>
</property> </property>
</column> </column>
</widget> </widget>

View file

@ -128,6 +128,9 @@
// without any other changes in the code // without any other changes in the code
#define USED_NUM_CHANNELS 6 // used number channels for server #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 // length of the moving average buffer for response time measurement
#define TIME_MOV_AV_RESPONSE 30 // seconds #define TIME_MOV_AV_RESPONSE 30 // seconds

View file

@ -45,7 +45,13 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
// this somehow only works reliable on Windows // this somehow only works reliable on Windows
, Qt::WindowMinMaxButtonsHint , Qt::WindowMinMaxButtonsHint
#endif #endif
) ),
ConnectDlg ( parent
#ifdef _WIN32
// this somehow only works reliable on Windows
, Qt::WindowMinMaxButtonsHint
#endif
)
{ {
setupUi ( this ); setupUi ( this );
@ -434,12 +440,18 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
// Timers ------------------------------------------------------------------ // Timers ------------------------------------------------------------------
// start timer for status bar // start timer for status bar
TimerStatus.start ( LED_BAR_UPDATE_TIME ); TimerStatus.start ( LED_BAR_UPDATE_TIME );
// TEST
ConnectDlg.show();
} }
void CLlconClientDlg::closeEvent ( QCloseEvent* Event ) 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(); ClientSettingsDlg.close();
ConnectDlg.close();
ChatDlg.close(); ChatDlg.close();
// if connected, terminate connection // if connected, terminate connection

View file

@ -39,6 +39,7 @@
#include "audiomixerboard.h" #include "audiomixerboard.h"
#include "clientsettingsdlg.h" #include "clientsettingsdlg.h"
#include "chatdlg.h" #include "chatdlg.h"
#include "connectdlg.h"
#ifdef _WIN32 #ifdef _WIN32
# include "../windows/moc/llconclientdlgbase.h" # include "../windows/moc/llconclientdlgbase.h"
#else #else
@ -101,6 +102,7 @@ protected:
CClientSettingsDlg ClientSettingsDlg; CClientSettingsDlg ClientSettingsDlg;
CChatDlg ChatDlg; CChatDlg ChatDlg;
CConnectDlg ConnectDlg;
public slots: public slots:
void OnConnectDisconBut(); void OnConnectDisconBut();

View file

@ -105,8 +105,8 @@ class CMultColLEDListViewItem : public CMultiColorLED
Q_OBJECT Q_OBJECT
public: public:
CMultColLEDListViewItem ( const int iNewCol ) : pListViewItem ( NULL ), CMultColLEDListViewItem ( const int iNewCol )
iColumn ( iNewCol ) {} : pListViewItem ( NULL ), iColumn ( iNewCol ) {}
void SetListViewItemPointer ( QTreeWidgetItem* pNewListViewItem ) void SetListViewItemPointer ( QTreeWidgetItem* pNewListViewItem )
{ {
@ -131,8 +131,8 @@ protected:
class CServerListViewItem : public QTreeWidgetItem class CServerListViewItem : public QTreeWidgetItem
{ {
public: public:
CServerListViewItem ( QTreeWidget* parent ) : QTreeWidgetItem ( parent ), CServerListViewItem ( QTreeWidget* parent )
LED0 ( 2 ), LED1 ( 3 ) : QTreeWidgetItem ( parent ), LED0 ( 2 ), LED1 ( 3 )
{ {
LED0.SetListViewItemPointer ( this ); LED0.SetListViewItemPointer ( this );
LED1.SetListViewItemPointer ( this ); LED1.SetListViewItemPointer ( this );
@ -142,8 +142,13 @@ public:
{ {
switch ( iWhichLED ) switch ( iWhichLED )
{ {
case 0: LED0.SetLight ( iNewStatus ); break; case 0:
case 1: LED1.SetLight ( iNewStatus ); break; LED0.SetLight ( iNewStatus );
break;
case 1:
LED1.SetLight ( iNewStatus );
break;
} }
} }
@ -151,4 +156,22 @@ protected:
CMultColLEDListViewItem LED0, LED1; 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_ #endif // _MULTCOLORLED_H__FD6B49B5_87DF_48DD_A873_804E1606C2AC__INCLUDED_