some more connect dialog work
This commit is contained in:
parent
7619ed2591
commit
da9af48062
7 changed files with 130 additions and 31 deletions
|
@ -117,6 +117,10 @@ CClient::CClient ( const quint16 iPortNumber ) :
|
||||||
SIGNAL ( CLMessReadyForSending ( CHostAddress, CVector<uint8_t> ) ),
|
SIGNAL ( CLMessReadyForSending ( CHostAddress, CVector<uint8_t> ) ),
|
||||||
this, SLOT ( OnSendCLProtMessage ( CHostAddress, CVector<uint8_t> ) ) );
|
this, SLOT ( OnSendCLProtMessage ( CHostAddress, CVector<uint8_t> ) ) );
|
||||||
|
|
||||||
|
QObject::connect ( &ConnLessProtocol,
|
||||||
|
SIGNAL ( CLServerListReceived ( CHostAddress, CVector<CServerInfo> ) ),
|
||||||
|
SIGNAL ( CLServerListReceived ( CHostAddress, CVector<CServerInfo> ) ) );
|
||||||
|
|
||||||
QObject::connect ( &ConnLessProtocol, SIGNAL ( CLPingReceived ( CHostAddress, int ) ),
|
QObject::connect ( &ConnLessProtocol, SIGNAL ( CLPingReceived ( CHostAddress, int ) ),
|
||||||
this, SLOT ( OnCLPingReceived ( CHostAddress, int ) ) );
|
this, SLOT ( OnCLPingReceived ( CHostAddress, int ) ) );
|
||||||
|
|
||||||
|
|
15
src/client.h
15
src/client.h
|
@ -205,14 +205,17 @@ public:
|
||||||
|
|
||||||
void SetRemoteName() { Channel.SetRemoteName ( strName ); }
|
void SetRemoteName() { Channel.SetRemoteName ( strName ); }
|
||||||
|
|
||||||
void SendTextMess ( const QString& strChatText )
|
void CreateChatTextMes ( const QString& strChatText )
|
||||||
{ Channel.CreateChatTextMes ( strChatText ); }
|
{ Channel.CreateChatTextMes ( strChatText ); }
|
||||||
|
|
||||||
void SendPingMess()
|
void CreatePingMes()
|
||||||
{ Channel.CreatePingMes ( PreparePingMessage() ); };
|
{ Channel.CreatePingMes ( PreparePingMessage() ); }
|
||||||
|
|
||||||
void SendCLPingMess ( const CHostAddress& InetAddr )
|
void CreateCLPingMes ( const CHostAddress& InetAddr )
|
||||||
{ ConnLessProtocol.CreateCLPingMes ( InetAddr, PreparePingMessage() ); };
|
{ ConnLessProtocol.CreateCLPingMes ( InetAddr, PreparePingMessage() ); }
|
||||||
|
|
||||||
|
void CreateCLReqServerListMes ( const CHostAddress& InetAddr )
|
||||||
|
{ ConnLessProtocol.CreateCLReqServerListMes ( InetAddr ); }
|
||||||
|
|
||||||
int EstimatedOverallDelay ( const int iPingTimeMs );
|
int EstimatedOverallDelay ( const int iPingTimeMs );
|
||||||
|
|
||||||
|
@ -312,6 +315,8 @@ signals:
|
||||||
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
||||||
void ChatTextReceived ( QString strChatText );
|
void ChatTextReceived ( QString strChatText );
|
||||||
void PingTimeReceived ( int iPingTime );
|
void PingTimeReceived ( int iPingTime );
|
||||||
|
void CLServerListReceived ( CHostAddress InetAddr,
|
||||||
|
CVector<CServerInfo> vecServerInfo );
|
||||||
void CLPingTimeReceived ( CHostAddress InetAddr, int iPingTime );
|
void CLPingTimeReceived ( CHostAddress InetAddr, int iPingTime );
|
||||||
void Disconnected();
|
void Disconnected();
|
||||||
void Stopped();
|
void Stopped();
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
|
|
||||||
|
|
||||||
/* Implementation *************************************************************/
|
/* Implementation *************************************************************/
|
||||||
CConnectDlg::CConnectDlg ( CClient* pNCliP, QWidget* parent,
|
CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
|
||||||
Qt::WindowFlags f )
|
: QDialog ( parent, f ),
|
||||||
: QDialog ( parent, f ), pClient ( pNCliP )
|
bServerListReceived ( false )
|
||||||
{
|
{
|
||||||
setupUi ( this );
|
setupUi ( this );
|
||||||
|
|
||||||
|
@ -53,26 +53,69 @@ pListViewItem = new QTreeWidgetItem ( ListViewServers );
|
||||||
// timers
|
// timers
|
||||||
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
|
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
|
||||||
this, SLOT ( OnTimerPing() ) );
|
this, SLOT ( OnTimerPing() ) );
|
||||||
|
|
||||||
|
QObject::connect ( &TimerReRequestServList, SIGNAL ( timeout() ),
|
||||||
|
this, SLOT ( OnTimerReRequestServList() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConnectDlg::showEvent ( QShowEvent* )
|
void CConnectDlg::showEvent ( QShowEvent* )
|
||||||
{
|
{
|
||||||
|
// reset flag (on opening the connect dialg, we always want to request a new
|
||||||
|
// updated server list per definition)
|
||||||
|
bServerListReceived = false;
|
||||||
|
|
||||||
// TODO get the IP address of the Master Server when the connect dialog is
|
// TEST
|
||||||
// opened -> this seems to be the correct time to do it, use the
|
QString strNAddr = "llcon.dyndns.org:22122";
|
||||||
// "CClient::SetServerAddr" functionality (extract it to another place...)
|
|
||||||
|
|
||||||
|
|
||||||
// only activate ping timer if window is actually shown
|
// get the IP address of the central server (using the ParseNetworAddress
|
||||||
TimerPing.start ( PING_UPDATE_TIME_MS );
|
// function) when the connect dialog is opened, this seems to be the correct
|
||||||
|
// time to do it
|
||||||
|
if ( LlconNetwUtil().ParseNetworkAddress ( strNAddr,
|
||||||
|
CentralServerAddress ) )
|
||||||
|
{
|
||||||
|
// send the request for the server list
|
||||||
|
emit ReqServerListQuery ( CentralServerAddress );
|
||||||
|
|
||||||
|
// start timer, if this message did not get any respond to retransmit
|
||||||
|
// the server list request message
|
||||||
|
TimerReRequestServList.start ( SERV_LIST_REQ_UPDATE_TIME_MS );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// only activate ping timer if window is actually shown
|
||||||
|
//TimerPing.start ( PING_UPDATE_TIME_MS );
|
||||||
|
|
||||||
// UpdateDisplay();
|
// UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConnectDlg::hideEvent ( QHideEvent* )
|
void CConnectDlg::hideEvent ( QHideEvent* )
|
||||||
{
|
{
|
||||||
// if window is closed, stop timer for ping
|
// if window is closed, stop timers
|
||||||
TimerPing.stop();
|
TimerPing.stop();
|
||||||
|
TimerReRequestServList.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConnectDlg::OnTimerReRequestServList()
|
||||||
|
{
|
||||||
|
// if the server list is not yet received, retransmit the request for the
|
||||||
|
// server list
|
||||||
|
if ( !bServerListReceived )
|
||||||
|
{
|
||||||
|
emit ReqServerListQuery ( CentralServerAddress );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CConnectDlg::SetServerList ( const CVector<CServerInfo>& vecServerInfo )
|
||||||
|
{
|
||||||
|
// set flag
|
||||||
|
bServerListReceived = true;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConnectDlg::OnTimerPing()
|
void CConnectDlg::OnTimerPing()
|
||||||
|
@ -81,7 +124,7 @@ void CConnectDlg::OnTimerPing()
|
||||||
|
|
||||||
// TEST
|
// TEST
|
||||||
//QHostAddress test ( "127.0.0.1" );
|
//QHostAddress test ( "127.0.0.1" );
|
||||||
//pClient->SendCLPingMess ( CHostAddress ( test, 22124 ) );
|
//emit CreateCLPingMes ( CHostAddress ( test, 22124 ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
#include <qwhatsthis.h>
|
#include <qwhatsthis.h>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
|
#include <qmutex.h>
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -40,24 +41,31 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Definitions ****************************************************************/
|
||||||
|
// defines the time interval at which the request server list message is re-
|
||||||
|
// transmitted until it is received
|
||||||
|
#define SERV_LIST_REQ_UPDATE_TIME_MS 2000 // ms
|
||||||
|
|
||||||
|
|
||||||
/* Classes ********************************************************************/
|
/* Classes ********************************************************************/
|
||||||
class CConnectDlg : public QDialog, private Ui_CConnectDlgBase
|
class CConnectDlg : public QDialog, private Ui_CConnectDlgBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CConnectDlg ( CClient* pNCliP, QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
CConnectDlg ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
||||||
|
|
||||||
void AddPingTime ( QString strChatText );
|
void SetServerList ( const CVector<CServerInfo>& vecServerInfo );
|
||||||
void SetPingTimeResult ( CHostAddress& InetAddr, const int iPingTime );
|
void SetPingTimeResult ( CHostAddress& InetAddr, const int iPingTime );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent ( QShowEvent* );
|
virtual void showEvent ( QShowEvent* );
|
||||||
virtual void hideEvent ( QHideEvent* );
|
virtual void hideEvent ( QHideEvent* );
|
||||||
|
|
||||||
CClient* pClient;
|
QTimer TimerPing;
|
||||||
QTimer TimerPing;
|
QTimer TimerReRequestServList;
|
||||||
|
CHostAddress CentralServerAddress;
|
||||||
|
bool bServerListReceived;
|
||||||
|
|
||||||
// TEST
|
// TEST
|
||||||
QTreeWidgetItem* pListViewItem;
|
QTreeWidgetItem* pListViewItem;
|
||||||
|
@ -65,4 +73,8 @@ QTreeWidgetItem* pListViewItem;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void OnTimerPing();
|
void OnTimerPing();
|
||||||
|
void OnTimerReRequestServList();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void ReqServerListQuery ( CHostAddress InetAddr );
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,7 +46,7 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
|
||||||
, Qt::WindowMinMaxButtonsHint
|
, Qt::WindowMinMaxButtonsHint
|
||||||
#endif
|
#endif
|
||||||
),
|
),
|
||||||
ConnectDlg ( pNCliP, parent
|
ConnectDlg ( parent
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// this somehow only works reliable on Windows
|
// this somehow only works reliable on Windows
|
||||||
, Qt::WindowMinMaxButtonsHint
|
, Qt::WindowMinMaxButtonsHint
|
||||||
|
@ -421,6 +421,10 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
|
||||||
QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ),
|
QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ),
|
||||||
this, SLOT ( OnPingTimeResult ( int ) ) );
|
this, SLOT ( OnPingTimeResult ( int ) ) );
|
||||||
|
|
||||||
|
QObject::connect ( pClient,
|
||||||
|
SIGNAL ( CLServerListReceived ( CHostAddress, CVector<CServerInfo> ) ),
|
||||||
|
this, SLOT ( OnCLServerListReceived ( CHostAddress, CVector<CServerInfo> ) ) );
|
||||||
|
|
||||||
QObject::connect ( pClient, SIGNAL ( CLPingTimeReceived ( CHostAddress, int ) ),
|
QObject::connect ( pClient, SIGNAL ( CLPingTimeReceived ( CHostAddress, int ) ),
|
||||||
this, SLOT ( OnCLPingTimeResult ( CHostAddress, int ) ) );
|
this, SLOT ( OnCLPingTimeResult ( CHostAddress, int ) ) );
|
||||||
|
|
||||||
|
@ -439,6 +443,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
|
||||||
QObject::connect ( &ChatDlg, SIGNAL ( NewLocalInputText ( QString ) ),
|
QObject::connect ( &ChatDlg, SIGNAL ( NewLocalInputText ( QString ) ),
|
||||||
this, SLOT ( OnNewLocalInputText ( QString ) ) );
|
this, SLOT ( OnNewLocalInputText ( QString ) ) );
|
||||||
|
|
||||||
|
QObject::connect ( &ConnectDlg, SIGNAL ( NewLocalInputText ( CHostAddress ) ),
|
||||||
|
this, SLOT ( OnReqServerListQuery ( CHostAddress ) ) );
|
||||||
|
|
||||||
|
|
||||||
// Timers ------------------------------------------------------------------
|
// Timers ------------------------------------------------------------------
|
||||||
// start timer for status bar
|
// start timer for status bar
|
||||||
|
@ -716,7 +723,7 @@ void CLlconClientDlg::OnTimerSigMet()
|
||||||
void CLlconClientDlg::OnTimerPing()
|
void CLlconClientDlg::OnTimerPing()
|
||||||
{
|
{
|
||||||
// send ping message to server
|
// send ping message to server
|
||||||
pClient->SendPingMess();
|
pClient->CreatePingMes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLlconClientDlg::OnPingTimeResult ( int iPingTime )
|
void CLlconClientDlg::OnPingTimeResult ( int iPingTime )
|
||||||
|
|
|
@ -107,28 +107,54 @@ protected:
|
||||||
public slots:
|
public slots:
|
||||||
void OnConnectDisconBut();
|
void OnConnectDisconBut();
|
||||||
void OnTimerSigMet();
|
void OnTimerSigMet();
|
||||||
void OnTimerStatus() { UpdateDisplay(); }
|
|
||||||
|
void OnTimerStatus()
|
||||||
|
{ UpdateDisplay(); }
|
||||||
|
|
||||||
void OnTimerPing();
|
void OnTimerPing();
|
||||||
void OnPingTimeResult ( int iPingTime );
|
void OnPingTimeResult ( int iPingTime );
|
||||||
void OnCLPingTimeResult ( CHostAddress InetAddr, int iPingTime );
|
void OnCLPingTimeResult ( CHostAddress InetAddr, int iPingTime );
|
||||||
void OnOpenGeneralSettings();
|
void OnOpenGeneralSettings();
|
||||||
void OnOpenChatDialog() { ShowChatWindow(); }
|
|
||||||
|
void OnOpenChatDialog()
|
||||||
|
{ ShowChatWindow(); }
|
||||||
|
|
||||||
void OnSliderAudInFader ( int value );
|
void OnSliderAudInFader ( int value );
|
||||||
void OnSliderAudReverb ( int value ) { pClient->SetReverbLevel ( value ); }
|
|
||||||
void OnRevSelL() { pClient->SetReverbOnLeftChan ( true ); }
|
void OnSliderAudReverb ( int value )
|
||||||
void OnRevSelR() { pClient->SetReverbOnLeftChan ( false ); }
|
{ pClient->SetReverbLevel ( value ); }
|
||||||
|
|
||||||
|
void OnRevSelL()
|
||||||
|
{ pClient->SetReverbOnLeftChan ( true ); }
|
||||||
|
|
||||||
|
void OnRevSelR()
|
||||||
|
{ pClient->SetReverbOnLeftChan ( false ); }
|
||||||
|
|
||||||
void OnConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
void OnConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
|
||||||
void OnChangeChanGain ( int iId, double dGain )
|
|
||||||
{ pClient->SetRemoteChanGain ( iId, dGain ); }
|
|
||||||
void OnFaderTagTextChanged ( const QString& strNewName );
|
void OnFaderTagTextChanged ( const QString& strNewName );
|
||||||
void OnChatTextReceived ( QString strChatText );
|
void OnChatTextReceived ( QString strChatText );
|
||||||
|
|
||||||
|
void OnChangeChanGain ( int iId, double dGain )
|
||||||
|
{ pClient->SetRemoteChanGain ( iId, dGain ); }
|
||||||
|
|
||||||
void OnNewLocalInputText ( QString strChatText )
|
void OnNewLocalInputText ( QString strChatText )
|
||||||
{ pClient->SendTextMess ( strChatText ); }
|
{ pClient->CreateChatTextMes ( strChatText ); }
|
||||||
|
|
||||||
|
void OnReqServerListQuery ( CHostAddress InetAddr )
|
||||||
|
{ pClient->CreateCLReqServerListMes ( InetAddr ); }
|
||||||
|
|
||||||
|
void OnCLServerListReceived ( CHostAddress InetAddr,
|
||||||
|
CVector<CServerInfo> vecServerInfo )
|
||||||
|
{ ConnectDlg.SetServerList ( vecServerInfo ); }
|
||||||
|
|
||||||
void OnLineEditServerAddrTextChanged ( const QString );
|
void OnLineEditServerAddrTextChanged ( const QString );
|
||||||
void OnLineEditServerAddrActivated ( int index );
|
void OnLineEditServerAddrActivated ( int index );
|
||||||
void OnDisconnected();
|
void OnDisconnected();
|
||||||
void OnStopped();
|
void OnStopped();
|
||||||
void OnGUIDesignChanged() { SetGUIDesign ( pClient->GetGUIDesign() ); }
|
|
||||||
|
void OnGUIDesignChanged()
|
||||||
|
{ SetGUIDesign ( pClient->GetGUIDesign() ); }
|
||||||
|
|
||||||
void OnStereoCheckBoxChanged() { UpdateRevSelection(); }
|
void OnStereoCheckBoxChanged() { UpdateRevSelection(); }
|
||||||
void OnNumClientsChanged ( int iNewNumClients );
|
void OnNumClientsChanged ( int iNewNumClients );
|
||||||
};
|
};
|
||||||
|
|
|
@ -240,6 +240,8 @@ void CServerListManager::QueryServerList ( const CHostAddress& InetAddr )
|
||||||
/* Slave server functionality *************************************************/
|
/* Slave server functionality *************************************************/
|
||||||
void CServerListManager::OnTimerRegistering()
|
void CServerListManager::OnTimerRegistering()
|
||||||
{
|
{
|
||||||
|
// we need the lock since the user might change the server properties at
|
||||||
|
// any time
|
||||||
QMutexLocker locker ( &Mutex );
|
QMutexLocker locker ( &Mutex );
|
||||||
|
|
||||||
if ( !bIsCentralServer && bEnabled )
|
if ( !bIsCentralServer && bEnabled )
|
||||||
|
|
Loading…
Add table
Reference in a new issue