diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index 817c8a81..41bae16d 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -281,8 +281,8 @@ double CChannelFader::CalcFaderGain ( const int value ) CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) : QGroupBox ( parent ) { - // set title text and title properties - setTitle ( "Server" ); + // set title text (default: no server given) + SetServerName ( "" ); // add hboxlayout pMainLayout = new QHBoxLayout ( this ); @@ -329,6 +329,19 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) : QObject::connect ( vecpChanFader[11], SIGNAL ( soloStateChanged ( int ) ), this, SLOT ( OnChSoloStateChangedCh11 ( int ) ) ); } +void CAudioMixerBoard::SetServerName ( const QString& strNewServerName ) +{ + // set title text of the group box + if ( strNewServerName.isEmpty() ) + { + setTitle ( "Server" ); + } + else + { + setTitle ( "Server: " + strNewServerName ); + } +} + void CAudioMixerBoard::SetGUIDesign ( const EGUIDesign eNewDesign ) { // apply GUI design to child GUI controls diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index 9f8af74b..f81e9436 100755 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -101,6 +101,7 @@ public: void HideAll(); void ApplyNewConClientList ( CVector& vecChanInfo ); + void SetServerName ( const QString& strNewServerName ); void SetGUIDesign ( const EGUIDesign eNewDesign ); protected: diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index cec328b3..6447d6a9 100755 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -30,6 +30,7 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f ) : QDialog ( parent, f ), strCentralServerAddress ( "" ), strSelectedAddress ( "" ), + strSelectedServerName ( "" ), bServerListReceived ( false ), bStateOK ( false ), bServerListItemWasChosen ( false ) @@ -119,8 +120,9 @@ void CConnectDlg::showEvent ( QShowEvent* ) bStateOK = false; bServerListItemWasChosen = false; - // clear current address - strSelectedAddress = ""; + // clear current address and name + strSelectedAddress = ""; + strSelectedServerName = ""; // clear server list view ListViewServers->clear(); @@ -154,6 +156,9 @@ void CConnectDlg::hideEvent ( QHideEvent* ) strSelectedAddress = CurSelListItemList[0]->data ( 0, Qt::UserRole ).toString(); + // store selected server name + strSelectedServerName = CurSelListItemList[0]->text ( 0 ); + // set flag that a server list item was chosen to connect bServerListItemWasChosen = true; } diff --git a/src/connectdlg.h b/src/connectdlg.h index 5bcff3d6..87f4ce89 100755 --- a/src/connectdlg.h +++ b/src/connectdlg.h @@ -1,99 +1,101 @@ -/******************************************************************************\ - * Copyright (c) 2004-2011 - * - * Author(s): - * Volker Fischer - * - ****************************************************************************** - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * -\******************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include "global.h" -#include "client.h" -#ifdef _WIN32 -# include "../windows/moc/connectdlgbase.h" -#else -# ifdef _IS_QMAKE_CONFIG -# include "ui_connectdlgbase.h" -# else -# include "moc/connectdlgbase.h" -# 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 ********************************************************************/ -class CConnectDlg : public QDialog, private Ui_CConnectDlgBase -{ - Q_OBJECT - -public: - CConnectDlg ( QWidget* parent = 0, Qt::WindowFlags f = 0 ); - +/******************************************************************************\ + * Copyright (c) 2004-2011 + * + * Author(s): + * Volker Fischer + * + ****************************************************************************** + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * +\******************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include "global.h" +#include "client.h" +#ifdef _WIN32 +# include "../windows/moc/connectdlgbase.h" +#else +# ifdef _IS_QMAKE_CONFIG +# include "ui_connectdlgbase.h" +# else +# include "moc/connectdlgbase.h" +# 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 ********************************************************************/ +class CConnectDlg : public QDialog, private Ui_CConnectDlgBase +{ + Q_OBJECT + +public: + CConnectDlg ( QWidget* parent = 0, Qt::WindowFlags f = 0 ); + void Init ( const QString strNewCentralServerAddr, - const CVector& vstrIPAddresses ); - - void SetServerList ( const CHostAddress& InetAddr, - const CVector& vecServerInfo ); - - void SetPingTimeAndNumClientsResult ( CHostAddress& InetAddr, - const int iPingTime, - const int iPingTimeLEDColor, - const int iNumClients ); - - bool GetStateOK() const { return bStateOK; } - bool GetServerListItemWasChosen() const { return bServerListItemWasChosen; } - QString GetSelectedAddress() const { return strSelectedAddress; } - -protected: - virtual void showEvent ( QShowEvent* ); - virtual void hideEvent ( QHideEvent* ); - - QTimer TimerPing; - QTimer TimerReRequestServList; - QString strCentralServerAddress; - CHostAddress CentralServerAddress; - CVector vstrIPAddresses; - QString strSelectedAddress; - bool bServerListReceived; - bool bStateOK; - bool bServerListItemWasChosen; - -public slots: - void OnServerListItemSelectionChanged(); - void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int ); - void OnLineEditServerAddrEditTextChanged ( const QString& ); - void OnConnectButtonClicked(); - void OnTimerPing(); - void OnTimerReRequestServList(); - -signals: - void ReqServerListQuery ( CHostAddress InetAddr ); - void CreateCLPingMes ( CHostAddress InetAddr ); -}; + const CVector& vstrIPAddresses ); + + void SetServerList ( const CHostAddress& InetAddr, + const CVector& vecServerInfo ); + + void SetPingTimeAndNumClientsResult ( CHostAddress& InetAddr, + const int iPingTime, + const int iPingTimeLEDColor, + const int iNumClients ); + + bool GetStateOK() const { return bStateOK; } + bool GetServerListItemWasChosen() const { return bServerListItemWasChosen; } + QString GetSelectedAddress() const { return strSelectedAddress; } + QString GetSelectedServerName() const { return strSelectedServerName; } + +protected: + virtual void showEvent ( QShowEvent* ); + virtual void hideEvent ( QHideEvent* ); + + QTimer TimerPing; + QTimer TimerReRequestServList; + QString strCentralServerAddress; + CHostAddress CentralServerAddress; + CVector vstrIPAddresses; + QString strSelectedAddress; + QString strSelectedServerName; + bool bServerListReceived; + bool bStateOK; + bool bServerListItemWasChosen; + +public slots: + void OnServerListItemSelectionChanged(); + void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int ); + void OnLineEditServerAddrEditTextChanged ( const QString& ); + void OnConnectButtonClicked(); + void OnTimerPing(); + void OnTimerReRequestServList(); + +signals: + void ReqServerListQuery ( CHostAddress InetAddr ); + void CreateCLPingMes ( CHostAddress InetAddr ); +}; diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index 733f50b8..0f65b843 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -799,8 +799,25 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart ) if ( bStartOk ) { + // change connect button text to "disconnect" PushButtonConnect->setText ( CON_BUT_DISCONNECTTEXT ); + // set server name in audio mixer group box title + if ( ConnectDlg.GetServerListItemWasChosen() ) + { + // in case a server in the server list was chosen, + // display the server name of the server list + MainMixerBoard->SetServerName ( + ConnectDlg.GetSelectedServerName() ); + } + else + { + // an item of the server address combo box was chosen, + // just show the address string as it was entered by the + // user + MainMixerBoard->SetServerName ( strSelectedAddress ); + } + // start timer for level meter bar and ping time measurement TimerSigMet.start ( LEVELMETER_UPDATE_TIME_MS ); TimerPing.start ( PING_UPDATE_TIME_MS ); @@ -825,8 +842,12 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart ) pClient->Stop(); } + // change connect button text to "connect" PushButtonConnect->setText ( CON_BUT_CONNECTTEXT ); + // reset server name in audio mixer group box title + MainMixerBoard->SetServerName ( "" ); + // stop timer for level meter bars and reset them TimerSigMet.stop(); MultiColorLEDBarInputLevelL->setValue ( 0 ); diff --git a/src/llconclientdlgbase.ui b/src/llconclientdlgbase.ui index 59cb398f..f70b2f48 100755 --- a/src/llconclientdlgbase.ui +++ b/src/llconclientdlgbase.ui @@ -407,7 +407,7 @@ Qt::Horizontal - QSizePolicy::Expanding + QSizePolicy::Minimum @@ -445,7 +445,7 @@ - + 0 0 @@ -470,7 +470,7 @@ Qt::Horizontal - QSizePolicy::Expanding + QSizePolicy::Minimum