show "trying to connect" in the mixer board title if no fader information is yet received

This commit is contained in:
Volker Fischer 2020-04-12 18:56:58 +02:00
parent 0c59a805fe
commit eca43c849a
2 changed files with 27 additions and 4 deletions

View file

@ -520,7 +520,8 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) :
vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ), vecStoredFaderIsSolo ( MAX_NUM_STORED_FADER_SETTINGS, false ),
vecStoredFaderIsMute ( MAX_NUM_STORED_FADER_SETTINGS, false ), vecStoredFaderIsMute ( MAX_NUM_STORED_FADER_SETTINGS, false ),
iNewClientFaderLevel ( 100 ), iNewClientFaderLevel ( 100 ),
bNoFaderVisible ( true ) bNoFaderVisible ( true ),
strServerName ( "" )
{ {
// add group box and hboxlayout // add group box and hboxlayout
pGroupBox = new QGroupBox(); // will be added to the scroll area which is then the parent pGroupBox = new QGroupBox(); // will be added to the scroll area which is then the parent
@ -658,14 +659,28 @@ CAudioMixerBoard::CAudioMixerBoard ( QWidget* parent, Qt::WindowFlags ) :
void CAudioMixerBoard::SetServerName ( const QString& strNewServerName ) void CAudioMixerBoard::SetServerName ( const QString& strNewServerName )
{ {
// set title text of the group box // store the current server name
if ( strNewServerName.isEmpty() ) strServerName = strNewServerName;
if ( strServerName.isEmpty() )
{ {
// no connection or connection was reset: show default title
pGroupBox->setTitle ( "Server" ); pGroupBox->setTitle ( "Server" );
} }
else else
{ {
pGroupBox->setTitle ( strNewServerName ); // Do not set the server name directly but first show a label which indicates
// that we are trying to connect the server. First if a connected client
// list was received, the connection was successful and the title is updated
// with the correct server name. Make sure to choose a "try to connect" title
// which is most striking (we use filled blocks and upper case letters).
QByteArray baBlock;
baBlock.append ( 0xE2 );
baBlock.append ( 0x96 );
baBlock.append ( 0x88 );
QString sBlocks = QString().fromUtf8 ( baBlock ).repeated ( 5 );
pGroupBox->setTitle ( sBlocks + " T R Y I N G T O C O N N E C T " + sBlocks );
} }
} }
@ -715,6 +730,13 @@ void CAudioMixerBoard::HideAll()
void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInfo ) void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInfo )
{ {
// we want to set the server name only if the very first faders appear
// in the audio mixer board to show a "try to connect" before
if ( pGroupBox->title().compare ( strServerName ) )
{
pGroupBox->setTitle ( strServerName );
}
// get number of connected clients // get number of connected clients
const int iNumConnectedClients = vecChanInfo.Size(); const int iNumConnectedClients = vecChanInfo.Size();

View file

@ -144,6 +144,7 @@ protected:
QHBoxLayout* pMainLayout; QHBoxLayout* pMainLayout;
bool bDisplayChannelLevels; bool bDisplayChannelLevels;
bool bNoFaderVisible; bool bNoFaderVisible;
QString strServerName;
public slots: public slots:
// CODE TAG: MAX_NUM_CHANNELS_TAG // CODE TAG: MAX_NUM_CHANNELS_TAG