refresh the server list if Central Server type is changed
This commit is contained in:
parent
c59173d076
commit
a98e98f2a9
6 changed files with 60 additions and 32 deletions
|
@ -347,6 +347,16 @@ int CClient::EvaluatePingMessage ( const int iMs )
|
|||
return PreciseTime.elapsed() - iMs;
|
||||
}
|
||||
|
||||
void CClient::SetCentralServerAddressType ( const ECSAddType eNCSAT )
|
||||
{
|
||||
if ( eCentralServerAddressType != eNCSAT )
|
||||
{
|
||||
// update type and emit message to update the server list, too
|
||||
eCentralServerAddressType = eNCSAT;
|
||||
emit CentralServerAddressTypeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void CClient::SetDoAutoSockBufSize ( const bool bValue )
|
||||
{
|
||||
// first, set new value in the channel object
|
||||
|
|
12
src/client.h
12
src/client.h
|
@ -126,7 +126,7 @@ public:
|
|||
bool IsConnected() { return Channel.IsConnected(); }
|
||||
|
||||
EGUIDesign GetGUIDesign() const { return eGUIDesign; }
|
||||
void SetGUIDesign ( const EGUIDesign eNGD ) { eGUIDesign = eNGD; }
|
||||
void SetGUIDesign ( const EGUIDesign eNGD ) { eGUIDesign = eNGD; }
|
||||
|
||||
bool GetDisplayChannelLevels() const { return bDisplayChannelLevels; }
|
||||
void SetDisplayChannelLevels ( const bool bNDCL );
|
||||
|
@ -140,13 +140,13 @@ public:
|
|||
void SetServerListCentralServerAddress ( const QString& sNCentServAddr ) { strCentralServerAddress = sNCentServAddr; }
|
||||
QString GetServerListCentralServerAddress() { return strCentralServerAddress; }
|
||||
|
||||
void SetCentralServerAddressType ( const ECSAddType eNCSAT ) { eCentralServerAddressType = eNCSAT; }
|
||||
void SetCentralServerAddressType ( const ECSAddType eNCSAT );
|
||||
ECSAddType GetCentralServerAddressType() { return eCentralServerAddressType; }
|
||||
|
||||
int GetAudioInFader() const { return iAudioInFader; }
|
||||
int GetAudioInFader() const { return iAudioInFader; }
|
||||
void SetAudioInFader ( const int iNV ) { iAudioInFader = iNV; }
|
||||
|
||||
int GetReverbLevel() const { return iReverbLevel; }
|
||||
int GetReverbLevel() const { return iReverbLevel; }
|
||||
void SetReverbLevel ( const int iNL ) { iReverbLevel = iNL; }
|
||||
|
||||
bool IsReverbOnLeftChan() const { return bReverbOnLeftChan; }
|
||||
|
@ -206,8 +206,7 @@ public:
|
|||
int GetSndCrdRightOutputChannel() { return Sound.GetRightOutputChannel(); }
|
||||
|
||||
void SetSndCrdPrefFrameSizeFactor ( const int iNewFactor );
|
||||
int GetSndCrdPrefFrameSizeFactor()
|
||||
{ return iSndCrdPrefFrameSizeFactor; }
|
||||
int GetSndCrdPrefFrameSizeFactor() { return iSndCrdPrefFrameSizeFactor; }
|
||||
|
||||
int GetSndCrdActualMonoBlSize()
|
||||
{
|
||||
|
@ -429,4 +428,5 @@ signals:
|
|||
|
||||
void Disconnected();
|
||||
void ControllerInFaderLevel ( int iChannelIdx, int iValue );
|
||||
void CentralServerAddressTypeChanged();
|
||||
};
|
||||
|
|
|
@ -454,6 +454,10 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
|||
SIGNAL ( Disconnected() ),
|
||||
this, SLOT ( OnDisconnected() ) );
|
||||
|
||||
QObject::connect ( pClient,
|
||||
SIGNAL ( CentralServerAddressTypeChanged() ),
|
||||
this, SLOT ( OnCentralServerAddressTypeChanged() ) );
|
||||
|
||||
QObject::connect ( pClient,
|
||||
SIGNAL ( ChatTextReceived ( QString ) ),
|
||||
this, SLOT ( OnChatTextReceived ( QString ) ) );
|
||||
|
@ -725,6 +729,18 @@ void CClientDlg::OnDisconnected()
|
|||
UpdateDisplay();
|
||||
}
|
||||
|
||||
void CClientDlg::OnCentralServerAddressTypeChanged()
|
||||
{
|
||||
// if the server list is shown and the server type was changed, update the list
|
||||
if ( ConnectDlg.isVisible() )
|
||||
{
|
||||
ConnectDlg.SetCentralServerAddress ( NetworkUtil::GetCentralServerAddress ( pClient->GetCentralServerAddressType(),
|
||||
pClient->GetServerListCentralServerAddress() ) );
|
||||
|
||||
ConnectDlg.RequestServerList();
|
||||
}
|
||||
}
|
||||
|
||||
void CClientDlg::OnChatTextReceived ( QString strChatText )
|
||||
{
|
||||
ChatDlg.AddChatText ( strChatText );
|
||||
|
@ -814,13 +830,10 @@ void CClientDlg::SetMyWindowTitle ( const int iNumClients )
|
|||
|
||||
void CClientDlg::ShowConnectionSetupDialog()
|
||||
{
|
||||
// get the central server address string
|
||||
const QString strCurCentServAddr =
|
||||
NetworkUtil::GetCentralServerAddress ( pClient->GetCentralServerAddressType(),
|
||||
pClient->GetServerListCentralServerAddress() );
|
||||
|
||||
// init the connect dialog
|
||||
ConnectDlg.Init ( strCurCentServAddr, pClient->vstrIPAddress );
|
||||
ConnectDlg.Init ( pClient->vstrIPAddress );
|
||||
ConnectDlg.SetCentralServerAddress ( NetworkUtil::GetCentralServerAddress ( pClient->GetCentralServerAddressType(),
|
||||
pClient->GetServerListCentralServerAddress() ) );
|
||||
|
||||
// show connect dialog
|
||||
ConnectDlg.show();
|
||||
|
|
|
@ -198,6 +198,7 @@ public slots:
|
|||
|
||||
void OnConnectDlgAccepted();
|
||||
void OnDisconnected();
|
||||
void OnCentralServerAddressTypeChanged();
|
||||
|
||||
void OnGUIDesignChanged()
|
||||
{ SetGUIDesign ( pClient->GetGUIDesign() ); }
|
||||
|
|
|
@ -154,12 +154,8 @@ CConnectDlg::CConnectDlg ( const bool bNewShowCompleteRegList,
|
|||
this, SLOT ( OnTimerReRequestServList() ) );
|
||||
}
|
||||
|
||||
void CConnectDlg::Init ( const QString strNewCentralServerAddr,
|
||||
const CVector<QString>& vstrIPAddresses )
|
||||
void CConnectDlg::Init ( const CVector<QString>& vstrIPAddresses )
|
||||
{
|
||||
// take central server address string
|
||||
strCentralServerAddress = strNewCentralServerAddr;
|
||||
|
||||
// load stored IP addresses in combo box
|
||||
cbxServerAddr->clear();
|
||||
cbxServerAddr->clearEditText();
|
||||
|
@ -175,8 +171,14 @@ void CConnectDlg::Init ( const QString strNewCentralServerAddr,
|
|||
|
||||
void CConnectDlg::showEvent ( QShowEvent* )
|
||||
{
|
||||
// reset flags (on opening the connect dialg, we always want to request a
|
||||
// new updated server list per definition)
|
||||
// on opening the connect dialg, we always want to request a
|
||||
// new updated server list per definition
|
||||
RequestServerList();
|
||||
}
|
||||
|
||||
void CConnectDlg::RequestServerList()
|
||||
{
|
||||
// reset flags
|
||||
bServerListReceived = false;
|
||||
bServerListItemWasChosen = false;
|
||||
|
||||
|
@ -215,6 +217,8 @@ void CConnectDlg::OnTimerReRequestServList()
|
|||
// server list
|
||||
if ( !bServerListReceived )
|
||||
{
|
||||
// note that this is a connection less message which may get lost
|
||||
// and therefore it makes sense to re-transmit it
|
||||
emit ReqServerListQuery ( CentralServerAddress );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,8 +51,8 @@ public:
|
|||
QWidget* parent = nullptr,
|
||||
Qt::WindowFlags f = nullptr );
|
||||
|
||||
void Init ( const QString strNewCentralServerAddr,
|
||||
const CVector<QString>& vstrIPAddresses );
|
||||
void Init ( const CVector<QString>& vstrIPAddresses );
|
||||
void SetCentralServerAddress ( const QString strNewCentralServerAddr ) { strCentralServerAddress = strNewCentralServerAddr; }
|
||||
|
||||
void SetServerList ( const CHostAddress& InetAddr,
|
||||
const CVector<CServerInfo>& vecServerInfo );
|
||||
|
@ -71,9 +71,10 @@ public:
|
|||
QString strVersion );
|
||||
#endif
|
||||
|
||||
bool GetServerListItemWasChosen() const { return bServerListItemWasChosen; }
|
||||
bool GetServerListItemWasChosen() const { return bServerListItemWasChosen; }
|
||||
QString GetSelectedAddress() const { return strSelectedAddress; }
|
||||
QString GetSelectedServerName() const { return strSelectedServerName; }
|
||||
void RequestServerList();
|
||||
|
||||
protected:
|
||||
virtual void showEvent ( QShowEvent* );
|
||||
|
@ -83,16 +84,15 @@ protected:
|
|||
QTreeWidgetItem* GetParentListViewItem ( QTreeWidgetItem* pItem );
|
||||
void DeleteAllListViewItemChilds ( QTreeWidgetItem* pItem );
|
||||
|
||||
QTimer TimerPing;
|
||||
QTimer TimerReRequestServList;
|
||||
QString strCentralServerAddress;
|
||||
CHostAddress CentralServerAddress;
|
||||
CVector<QString> vstrIPAddresses;
|
||||
QString strSelectedAddress;
|
||||
QString strSelectedServerName;
|
||||
bool bShowCompleteRegList;
|
||||
bool bServerListReceived;
|
||||
bool bServerListItemWasChosen;
|
||||
QTimer TimerPing;
|
||||
QTimer TimerReRequestServList;
|
||||
QString strCentralServerAddress;
|
||||
CHostAddress CentralServerAddress;
|
||||
QString strSelectedAddress;
|
||||
QString strSelectedServerName;
|
||||
bool bShowCompleteRegList;
|
||||
bool bServerListReceived;
|
||||
bool bServerListItemWasChosen;
|
||||
|
||||
public slots:
|
||||
void OnServerListItemSelectionChanged();
|
||||
|
|
Loading…
Reference in a new issue