show the server name in the title of the audio mixer board

This commit is contained in:
Volker Fischer 2011-05-04 20:08:06 +00:00
parent 1b94baa9e2
commit 59c9d9e364
6 changed files with 147 additions and 105 deletions

View file

@ -281,8 +281,8 @@ double CChannelFader::CalcFaderGain ( const int value )
CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) : CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) :
QGroupBox ( parent ) QGroupBox ( parent )
{ {
// set title text and title properties // set title text (default: no server given)
setTitle ( "Server" ); SetServerName ( "" );
// add hboxlayout // add hboxlayout
pMainLayout = new QHBoxLayout ( this ); 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 ) ) ); 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 ) void CAudioMixerBoard::SetGUIDesign ( const EGUIDesign eNewDesign )
{ {
// apply GUI design to child GUI controls // apply GUI design to child GUI controls

View file

@ -101,6 +101,7 @@ public:
void HideAll(); void HideAll();
void ApplyNewConClientList ( CVector<CChannelShortInfo>& vecChanInfo ); void ApplyNewConClientList ( CVector<CChannelShortInfo>& vecChanInfo );
void SetServerName ( const QString& strNewServerName );
void SetGUIDesign ( const EGUIDesign eNewDesign ); void SetGUIDesign ( const EGUIDesign eNewDesign );
protected: protected:

View file

@ -30,6 +30,7 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
: QDialog ( parent, f ), : QDialog ( parent, f ),
strCentralServerAddress ( "" ), strCentralServerAddress ( "" ),
strSelectedAddress ( "" ), strSelectedAddress ( "" ),
strSelectedServerName ( "" ),
bServerListReceived ( false ), bServerListReceived ( false ),
bStateOK ( false ), bStateOK ( false ),
bServerListItemWasChosen ( false ) bServerListItemWasChosen ( false )
@ -119,8 +120,9 @@ void CConnectDlg::showEvent ( QShowEvent* )
bStateOK = false; bStateOK = false;
bServerListItemWasChosen = false; bServerListItemWasChosen = false;
// clear current address // clear current address and name
strSelectedAddress = ""; strSelectedAddress = "";
strSelectedServerName = "";
// clear server list view // clear server list view
ListViewServers->clear(); ListViewServers->clear();
@ -154,6 +156,9 @@ void CConnectDlg::hideEvent ( QHideEvent* )
strSelectedAddress = strSelectedAddress =
CurSelListItemList[0]->data ( 0, Qt::UserRole ).toString(); 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 // set flag that a server list item was chosen to connect
bServerListItemWasChosen = true; bServerListItemWasChosen = true;
} }

View file

@ -1,99 +1,101 @@
/******************************************************************************\ /******************************************************************************\
* Copyright (c) 2004-2011 * Copyright (c) 2004-2011
* *
* Author(s): * Author(s):
* Volker Fischer * Volker Fischer
* *
****************************************************************************** ******************************************************************************
* *
* This program is free software; you can redistribute it and/or modify it under * 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 * 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 * Foundation; either version 2 of the License, or (at your option) any later
* version. * version.
* *
* This program is distributed in the hope that it will be useful, but WITHOUT * 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 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. * details.
* *
* You should have received a copy of the GNU General Public License along with * 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., * this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
\******************************************************************************/ \******************************************************************************/
#include <qlabel.h> #include <qlabel.h>
#include <qlineedit.h> #include <qlineedit.h>
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qwhatsthis.h> #include <qwhatsthis.h>
#include <qtimer.h> #include <qtimer.h>
#include <qmutex.h> #include <qmutex.h>
#include <qlocale.h> #include <qlocale.h>
#include "global.h" #include "global.h"
#include "client.h" #include "client.h"
#ifdef _WIN32 #ifdef _WIN32
# include "../windows/moc/connectdlgbase.h" # include "../windows/moc/connectdlgbase.h"
#else #else
# ifdef _IS_QMAKE_CONFIG # ifdef _IS_QMAKE_CONFIG
# include "ui_connectdlgbase.h" # include "ui_connectdlgbase.h"
# else # else
# include "moc/connectdlgbase.h" # include "moc/connectdlgbase.h"
# endif # endif
#endif #endif
/* Definitions ****************************************************************/ /* Definitions ****************************************************************/
// defines the time interval at which the request server list message is re- // defines the time interval at which the request server list message is re-
// transmitted until it is received // transmitted until it is received
#define SERV_LIST_REQ_UPDATE_TIME_MS 2000 // ms #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 ( QWidget* parent = 0, Qt::WindowFlags f = 0 ); CConnectDlg ( QWidget* parent = 0, Qt::WindowFlags f = 0 );
void Init ( const QString strNewCentralServerAddr, void Init ( const QString strNewCentralServerAddr,
const CVector<QString>& vstrIPAddresses ); const CVector<QString>& vstrIPAddresses );
void SetServerList ( const CHostAddress& InetAddr, void SetServerList ( const CHostAddress& InetAddr,
const CVector<CServerInfo>& vecServerInfo ); const CVector<CServerInfo>& vecServerInfo );
void SetPingTimeAndNumClientsResult ( CHostAddress& InetAddr, void SetPingTimeAndNumClientsResult ( CHostAddress& InetAddr,
const int iPingTime, const int iPingTime,
const int iPingTimeLEDColor, const int iPingTimeLEDColor,
const int iNumClients ); const int iNumClients );
bool GetStateOK() const { return bStateOK; } bool GetStateOK() const { return bStateOK; }
bool GetServerListItemWasChosen() const { return bServerListItemWasChosen; } bool GetServerListItemWasChosen() const { return bServerListItemWasChosen; }
QString GetSelectedAddress() const { return strSelectedAddress; } QString GetSelectedAddress() const { return strSelectedAddress; }
QString GetSelectedServerName() const { return strSelectedServerName; }
protected:
virtual void showEvent ( QShowEvent* ); protected:
virtual void hideEvent ( QHideEvent* ); virtual void showEvent ( QShowEvent* );
virtual void hideEvent ( QHideEvent* );
QTimer TimerPing;
QTimer TimerReRequestServList; QTimer TimerPing;
QString strCentralServerAddress; QTimer TimerReRequestServList;
CHostAddress CentralServerAddress; QString strCentralServerAddress;
CVector<QString> vstrIPAddresses; CHostAddress CentralServerAddress;
QString strSelectedAddress; CVector<QString> vstrIPAddresses;
bool bServerListReceived; QString strSelectedAddress;
bool bStateOK; QString strSelectedServerName;
bool bServerListItemWasChosen; bool bServerListReceived;
bool bStateOK;
public slots: bool bServerListItemWasChosen;
void OnServerListItemSelectionChanged();
void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int ); public slots:
void OnLineEditServerAddrEditTextChanged ( const QString& ); void OnServerListItemSelectionChanged();
void OnConnectButtonClicked(); void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int );
void OnTimerPing(); void OnLineEditServerAddrEditTextChanged ( const QString& );
void OnTimerReRequestServList(); void OnConnectButtonClicked();
void OnTimerPing();
signals: void OnTimerReRequestServList();
void ReqServerListQuery ( CHostAddress InetAddr );
void CreateCLPingMes ( CHostAddress InetAddr ); signals:
}; void ReqServerListQuery ( CHostAddress InetAddr );
void CreateCLPingMes ( CHostAddress InetAddr );
};

View file

@ -799,8 +799,25 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart )
if ( bStartOk ) if ( bStartOk )
{ {
// change connect button text to "disconnect"
PushButtonConnect->setText ( CON_BUT_DISCONNECTTEXT ); 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 // start timer for level meter bar and ping time measurement
TimerSigMet.start ( LEVELMETER_UPDATE_TIME_MS ); TimerSigMet.start ( LEVELMETER_UPDATE_TIME_MS );
TimerPing.start ( PING_UPDATE_TIME_MS ); TimerPing.start ( PING_UPDATE_TIME_MS );
@ -825,8 +842,12 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart )
pClient->Stop(); pClient->Stop();
} }
// change connect button text to "connect"
PushButtonConnect->setText ( CON_BUT_CONNECTTEXT ); 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 // stop timer for level meter bars and reset them
TimerSigMet.stop(); TimerSigMet.stop();
MultiColorLEDBarInputLevelL->setValue ( 0 ); MultiColorLEDBarInputLevelL->setValue ( 0 );

View file

@ -407,7 +407,7 @@
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType" > <property name="sizeType" >
<enum>QSizePolicy::Expanding</enum> <enum>QSizePolicy::Minimum</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" >
<size> <size>
@ -445,7 +445,7 @@
<item> <item>
<widget class="QLineEdit" name="LineEditFaderTag" > <widget class="QLineEdit" name="LineEditFaderTag" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" > <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -470,7 +470,7 @@
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType" > <property name="sizeType" >
<enum>QSizePolicy::Expanding</enum> <enum>QSizePolicy::Minimum</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" >
<size> <size>