diff --git a/ChangeLog b/ChangeLog index f12a6da4..8aea6349 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,12 +23,11 @@ -TODO add new register message which contains version and, e.g., max number of clients - -TODO Inconsistency between Input meter and Audio mixer meter #423 - TODO improve settings management -> move settings class in client/server classes, move actual settings variables -TODO store recorder settings (#313) +TODO improve interaction between use of inifile and command line parameters (edited) #120 +TODO Save and restore mixer state (fader / mute / solo...) #377 +(Add a save action for client and server with a keyboard shortcut #347) -> should be closed + diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index 379c87eb..0092ca4b 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -128,8 +128,8 @@ CChannelFader::CChannelFader ( QWidget* pNW ) pMainGrid->addWidget ( pLabelInstBox ); // reset current fader - strGroupBaseText = "Grp"; // this will most probably overwritten by SetGUIDesign() - iInstrPicFixedWidth = INVALID_INDEX; // this will most probably overwritten by SetGUIDesign() + strGroupBaseText = "Grp"; // this will most probably overwritten by SetGUIDesign() + iInstrPicMaxWidth = INVALID_INDEX; // this will most probably overwritten by SetGUIDesign() Reset(); // add help text to controls @@ -228,7 +228,7 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign ) pcbSolo->setText ( tr ( "SOLO" ) ); strGroupBaseText = tr ( "GRP" ); plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_LED ); - iInstrPicFixedWidth = INVALID_INDEX; // no instrument picture scaling + iInstrPicMaxWidth = INVALID_INDEX; // no instrument picture scaling break; case GD_SLIMFADER: @@ -243,7 +243,7 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign ) pcbSolo->setText ( tr ( "S" ) ); strGroupBaseText = tr ( "G" ); plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_SLIM_BAR ); - iInstrPicFixedWidth = 18; // scale instrument picture to avoid enlarging the width by the picture + iInstrPicMaxWidth = 18; // scale instrument picture to avoid enlarging the width by the picture break; default: @@ -259,7 +259,7 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign ) pcbSolo->setText ( tr ( "Solo" ) ); strGroupBaseText = tr ( "Grp" ); plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_BAR ); - iInstrPicFixedWidth = INVALID_INDEX; // no instrument picture scaling + iInstrPicMaxWidth = INVALID_INDEX; // no instrument picture scaling break; } @@ -503,7 +503,7 @@ void CChannelFader::SetGroupID ( const int iNGroupID ) void CChannelFader::UpdateGroupIDDependencies() { // update the group checkbox according the current group ID setting - pcbGroup->blockSignals ( true ); // make sure no signals as fired + pcbGroup->blockSignals ( true ); // make sure no signals are fired if ( iGroupID == INVALID_INDEX ) { pcbGroup->setCheckState ( Qt::Unchecked ); @@ -524,6 +524,21 @@ void CChannelFader::UpdateGroupIDDependencies() pcbGroup->setText ( strGroupBaseText ); } + // if the group is disable for this fader, reset the previous fader level + if ( iGroupID == INVALID_INDEX ) + { + // for the special case that the fader is all the way down, use a small + // value instead + if ( GetFaderLevel() > 0 ) + { + dPreviousFaderLevel = GetFaderLevel(); + } + else + { + dPreviousFaderLevel = 1; // small value + } + } + // the fader tag border color is set according to the selected group SetupFaderTag ( cReceivedChanInfo.eSkillLevel ); } @@ -616,10 +631,10 @@ void CChannelFader::SetChannelInfos ( const CChannelInfo& cChanInfo ) // set correct picture QPixmap pixInstr ( strCurResourceRef ); - if ( ( iInstrPicFixedWidth != INVALID_INDEX ) && ( pixInstr.width() > iInstrPicFixedWidth ) ) + if ( ( iInstrPicMaxWidth != INVALID_INDEX ) && ( pixInstr.width() > iInstrPicMaxWidth ) ) { // scale instrument picture on request (scale to the width with correct aspect ratio) - plblInstrument->setPixmap ( pixInstr.scaledToWidth ( iInstrPicFixedWidth, Qt::SmoothTransformation ) ); + plblInstrument->setPixmap ( pixInstr.scaledToWidth ( iInstrPicMaxWidth, Qt::SmoothTransformation ) ); } else { diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index 95fd4d61..3ed2c6be 100755 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -119,7 +119,7 @@ protected: double dPreviousFaderLevel; int iGroupID; QString strGroupBaseText; - int iInstrPicFixedWidth; + int iInstrPicMaxWidth; public slots: void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value, false ); } diff --git a/src/protocol.cpp b/src/protocol.cpp index 37a5355d..e54a4272 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -289,6 +289,14 @@ CONNECTION LESS MESSAGES necessary, that value will contain the server internal address. +- PROTMESSID_CLM_REGISTER_SERVER_EX: Register a server, providing extended server + information + + +--------------------------------+-------------------------------+ + | PROTMESSID_CLM_REGISTER_SERVER | PROTMESSID_CLM_VERSION_AND_OS | + +--------------------------------+-------------------------------+ + + - PROTMESSID_CLM_UNREGISTER_SERVER: Unregister a server note: does not have any data -> n = 0 @@ -738,6 +746,10 @@ if ( rand() < ( RAND_MAX / 2 ) ) return false; bRet = EvaluateCLRegisterServerMes ( InetAddr, vecbyMesBodyData ); break; + case PROTMESSID_CLM_REGISTER_SERVER_EX: + bRet = EvaluateCLRegisterServerExMes ( InetAddr, vecbyMesBodyData ); + break; + case PROTMESSID_CLM_UNREGISTER_SERVER: bRet = EvaluateCLUnregisterServerMes ( InetAddr ); break; @@ -1466,8 +1478,8 @@ void CProtocol::CreateReqChannelLevelListMes ( const bool bRCL ) { CVector vecData ( 1 ); // 1 byte of data int iPos = 0; // init position pointer - PutValOnStream ( vecData, iPos, - static_cast ( bRCL ), 1 ); + + PutValOnStream ( vecData, iPos, static_cast ( bRCL ), 1 ); CreateAndSendMessage ( PROTMESSID_REQ_CHANNEL_LEVEL_LIST, vecData ); } @@ -1820,6 +1832,162 @@ bool CProtocol::EvaluateCLRegisterServerMes ( const CHostAddress& InetAddr, return false; // no error } +void CProtocol::CreateCLRegisterServerExMes ( const CHostAddress& InetAddr, + const CHostAddress& LInetAddr, + const CServerCoreInfo& ServerInfo ) +{ + int iPos = 0; // init position pointer + + // convert server info strings to utf-8 + const QByteArray strUTF8LInetAddr = LInetAddr.InetAddr.toString().toUtf8(); + const QByteArray strUTF8Name = ServerInfo.strName.toUtf8(); + const QByteArray strUTF8City = ServerInfo.strCity.toUtf8(); + const QByteArray strUTF8Version = QString ( VERSION ).toUtf8(); + + // size of current message body + const int iEntrLen = + 2 /* server internal port number */ + + 2 /* country */ + + 1 /* maximum number of connected clients */ + + 1 /* is permanent flag */ + + 2 /* name utf-8 string size */ + strUTF8Name.size() + + 2 /* server internal address utf-8 string size */ + strUTF8LInetAddr.size() + + 2 /* city utf-8 string size */ + strUTF8City.size() + + 1 /* operating system */ + + 2 /* version utf-8 string size */ + strUTF8Version.size(); + + // build data vector + CVector vecData ( iEntrLen ); + + // port number (2 bytes) + PutValOnStream ( vecData, iPos, static_cast ( LInetAddr.iPort ), 2 ); + + // country (2 bytes) + PutValOnStream ( vecData, iPos, static_cast ( ServerInfo.eCountry ), 2 ); + + // maximum number of connected clients (1 byte) + PutValOnStream ( vecData, iPos, static_cast ( ServerInfo.iMaxNumClients ), 1 ); + + // "is permanent" flag (1 byte) + PutValOnStream ( vecData, iPos, static_cast ( ServerInfo.bPermanentOnline ), 1 ); + + // name + PutStringUTF8OnStream ( vecData, iPos, strUTF8Name ); + + // server internal address (formerly unused topic) + PutStringUTF8OnStream ( vecData, iPos, strUTF8LInetAddr ); + + // city + PutStringUTF8OnStream ( vecData, iPos, strUTF8City ); + + // operating system (1 byte) + PutValOnStream ( vecData, iPos, + static_cast ( COSUtil::GetOperatingSystem() ), 1 ); + + // version + PutStringUTF8OnStream ( vecData, iPos, strUTF8Version ); + + CreateAndImmSendConLessMessage ( PROTMESSID_CLM_REGISTER_SERVER_EX, + vecData, + InetAddr ); +} + +bool CProtocol::EvaluateCLRegisterServerExMes ( const CHostAddress& InetAddr, + const CVector& vecData ) +{ + int iPos = 0; // init position pointer + const int iDataLen = vecData.Size(); + QString sLocHost; // temp string for server internal address + CHostAddress LInetAddr; + CServerCoreInfo RecServerInfo; + + // check size (the first 6 bytes) + if ( iDataLen < 6 ) + { + return true; // return error code + } + + // port number (2 bytes) + LInetAddr.iPort = static_cast ( GetValFromStream ( vecData, iPos, 2 ) ); + + // country (2 bytes) + RecServerInfo.eCountry = static_cast ( GetValFromStream ( vecData, iPos, 2 ) ); + + // maximum number of connected clients (1 byte) + RecServerInfo.iMaxNumClients = static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); + + // "is permanent" flag (1 byte) + RecServerInfo.bPermanentOnline = static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); + + // server name + if ( GetStringFromStream ( vecData, + iPos, + MAX_LEN_SERVER_NAME, + RecServerInfo.strName ) ) + { + return true; // return error code + } + + // server internal address + if ( GetStringFromStream ( vecData, + iPos, + MAX_LEN_IP_ADDRESS, + sLocHost ) ) + { + return true; // return error code + } + + if ( sLocHost.isEmpty() ) + { + // old server, empty "topic", register as local host + LInetAddr.InetAddr.setAddress ( QHostAddress::LocalHost ); + } + else if ( !LInetAddr.InetAddr.setAddress ( sLocHost ) ) + { + return true; // return error code + } + + // server city + if ( GetStringFromStream ( vecData, + iPos, + MAX_LEN_SERVER_CITY, + RecServerInfo.strCity ) ) + { + return true; // return error code + } + + // check size (the next 1 byte) + if ( iDataLen < iPos + 1 ) + { + return true; // return error code + } + + // operating system (1 byte) + const COSUtil::EOpSystemType eOSType = + static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); + + // version text + QString strVersion; + if ( GetStringFromStream ( vecData, + iPos, + MAX_LEN_VERSION_TEXT, + strVersion ) ) + { + return true; // return error code + } + + // check size: all data is read, the position must now be at the end + if ( iPos != iDataLen ) + { + return true; // return error code + } + + // invoke message action + emit CLRegisterServerExReceived ( InetAddr, LInetAddr, RecServerInfo, eOSType, strVersion ); + + return false; // no error +} + void CProtocol::CreateCLUnregisterServerMes ( const CHostAddress& InetAddr ) { CreateAndImmSendConLessMessage ( PROTMESSID_CLM_UNREGISTER_SERVER, diff --git a/src/protocol.h b/src/protocol.h index 2c4a0760..f9ea11aa 100755 --- a/src/protocol.h +++ b/src/protocol.h @@ -79,6 +79,7 @@ #define PROTMESSID_CLM_REQ_CONN_CLIENTS_LIST 1014 // request the connected clients list #define PROTMESSID_CLM_CHANNEL_LEVEL_LIST 1015 // channel level list #define PROTMESSID_CLM_REGISTER_SERVER_RESP 1016 // status of server registration request +#define PROTMESSID_CLM_REGISTER_SERVER_EX 1017 // register server with extended information // lengths of message as defined in protocol.cpp file #define MESS_HEADER_LENGTH_BYTE 7 // TAG (2), ID (2), cnt (1), length (2) @@ -125,6 +126,9 @@ public: void CreateCLRegisterServerMes ( const CHostAddress& InetAddr, const CHostAddress& LInetAddr, const CServerCoreInfo& ServerInfo ); + void CreateCLRegisterServerExMes ( const CHostAddress& InetAddr, + const CHostAddress& LInetAddr, + const CServerCoreInfo& ServerInfo ); void CreateCLUnregisterServerMes ( const CHostAddress& InetAddr ); void CreateCLServerListMes ( const CHostAddress& InetAddr, const CVector vecServerInfo ); @@ -250,6 +254,8 @@ protected: bool EvaluateCLServerFullMes(); bool EvaluateCLRegisterServerMes ( const CHostAddress& InetAddr, const CVector& vecData ); + bool EvaluateCLRegisterServerExMes ( const CHostAddress& InetAddr, + const CVector& vecData ); bool EvaluateCLUnregisterServerMes ( const CHostAddress& InetAddr ); bool EvaluateCLServerListMes ( const CHostAddress& InetAddr, const CVector& vecData ); @@ -315,6 +321,11 @@ signals: void CLRegisterServerReceived ( CHostAddress InetAddr, CHostAddress LInetAddr, CServerCoreInfo ServerInfo ); + void CLRegisterServerExReceived ( CHostAddress InetAddr, + CHostAddress LInetAddr, + CServerCoreInfo ServerInfo, + COSUtil::EOpSystemType eOSType, + QString strVersion ); void CLUnregisterServerReceived ( CHostAddress InetAddr ); void CLServerListReceived ( CHostAddress InetAddr, CVector vecServerInfo ); diff --git a/src/res/translation/translation_de_DE.qm b/src/res/translation/translation_de_DE.qm index ece9d794..4a23706c 100644 Binary files a/src/res/translation/translation_de_DE.qm and b/src/res/translation/translation_de_DE.qm differ diff --git a/src/res/translation/translation_de_DE.ts b/src/res/translation/translation_de_DE.ts index 42c9a5f6..bac96ff9 100644 --- a/src/res/translation/translation_de_DE.ts +++ b/src/res/translation/translation_de_DE.ts @@ -3220,17 +3220,17 @@ QCoreApplication - + , Version , Version - + Internet Jam Session Software Internet Jam Session Software - + Released under the GNU General Public License (GPL) Unter der GNU General Public License (GPL) diff --git a/src/res/translation/translation_es_ES.qm b/src/res/translation/translation_es_ES.qm index 22b9bdf0..a8eebce7 100644 Binary files a/src/res/translation/translation_es_ES.qm and b/src/res/translation/translation_es_ES.qm differ diff --git a/src/res/translation/translation_es_ES.ts b/src/res/translation/translation_es_ES.ts index df9a9977..50699f98 100644 --- a/src/res/translation/translation_es_ES.ts +++ b/src/res/translation/translation_es_ES.ts @@ -3240,17 +3240,17 @@ QCoreApplication - + , Version , Versión - + Internet Jam Session Software Internet Jam Session Software - + Released under the GNU General Public License (GPL) Publicado bajo la GNU General Public License (GPL) diff --git a/src/res/translation/translation_fr_FR.ts b/src/res/translation/translation_fr_FR.ts index a15c8831..052542ef 100644 --- a/src/res/translation/translation_fr_FR.ts +++ b/src/res/translation/translation_fr_FR.ts @@ -3232,17 +3232,17 @@ QCoreApplication - + , Version , version - + Internet Jam Session Software Logiciel de bœuf sur Internet - + Released under the GNU General Public License (GPL) Publié sous la licence publique générale GNU (GPL) diff --git a/src/res/translation/translation_it_IT.ts b/src/res/translation/translation_it_IT.ts index d9c55016..1f8f6cf6 100644 --- a/src/res/translation/translation_it_IT.ts +++ b/src/res/translation/translation_it_IT.ts @@ -3180,17 +3180,17 @@ QCoreApplication - + , Version Versione, Versione - + Internet Jam Session Software Programma per Jam Session su Internet - + Released under the GNU General Public License (GPL) Rilasciato sotto licensa GNU General Public License (GPL) diff --git a/src/res/translation/translation_nl_NL.ts b/src/res/translation/translation_nl_NL.ts index 67a78624..dbf39e47 100644 --- a/src/res/translation/translation_nl_NL.ts +++ b/src/res/translation/translation_nl_NL.ts @@ -3180,17 +3180,17 @@ QCoreApplication - + , Version , Versie - + Internet Jam Session Software Internet Jamsessie Software - + Released under the GNU General Public License (GPL) Gereleased onder de GNU General Public License (GPL) diff --git a/src/res/translation/translation_pl_PL.ts b/src/res/translation/translation_pl_PL.ts index 9b337657..1cbd7c50 100644 --- a/src/res/translation/translation_pl_PL.ts +++ b/src/res/translation/translation_pl_PL.ts @@ -2823,17 +2823,17 @@ nie jestem pewna QCoreApplication - + , Version - + Internet Jam Session Software - + Released under the GNU General Public License (GPL) diff --git a/src/res/translation/translation_pt_BR.ts b/src/res/translation/translation_pt_BR.ts index 86cc972f..2e820f15 100644 --- a/src/res/translation/translation_pt_BR.ts +++ b/src/res/translation/translation_pt_BR.ts @@ -3218,17 +3218,17 @@ QCoreApplication - + , Version , Versão - + Internet Jam Session Software Programa de Jam Sessions pela Internet - + Released under the GNU General Public License (GPL) Lançado sob a Licença Pública Geral GNU (GPL) diff --git a/src/res/translation/translation_pt_PT.ts b/src/res/translation/translation_pt_PT.ts index 41529c17..1fb8ccf3 100644 --- a/src/res/translation/translation_pt_PT.ts +++ b/src/res/translation/translation_pt_PT.ts @@ -3216,17 +3216,17 @@ QCoreApplication - + , Version , Versão - + Internet Jam Session Software Programa de Jam Sessions pela Internet - + Released under the GNU General Public License (GPL) Lançado sob a Licença Pública Geral GNU (GPL) diff --git a/src/res/translation/translation_sv_SE.ts b/src/res/translation/translation_sv_SE.ts index d991efb5..029d9bc8 100644 --- a/src/res/translation/translation_sv_SE.ts +++ b/src/res/translation/translation_sv_SE.ts @@ -2792,17 +2792,17 @@ QCoreApplication - + , Version - + Internet Jam Session Software - + Released under the GNU General Public License (GPL) diff --git a/src/server.cpp b/src/server.cpp index 56739a83..499c57cc 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -449,6 +449,9 @@ CServer::CServer ( const int iNewMaxNumChan, QObject::connect ( &ConnLessProtocol, &CProtocol::CLRegisterServerReceived, this, &CServer::OnCLRegisterServerReceived ); + QObject::connect ( &ConnLessProtocol, &CProtocol::CLRegisterServerExReceived, + this, &CServer::OnCLRegisterServerExReceived ); + QObject::connect ( &ConnLessProtocol, &CProtocol::CLUnregisterServerReceived, this, &CServer::OnCLUnregisterServerReceived ); diff --git a/src/server.h b/src/server.h index 8def4f9f..08766acb 100755 --- a/src/server.h +++ b/src/server.h @@ -462,6 +462,15 @@ public slots: ServerListManager.CentralServerRegisterServer ( InetAddr, LInetAddr, ServerInfo ); } + void OnCLRegisterServerExReceived ( CHostAddress InetAddr, + CHostAddress LInetAddr, + CServerCoreInfo ServerInfo, + COSUtil::EOpSystemType eOSType, + QString strVersion ) + { + ServerListManager.CentralServerRegisterServerEx ( InetAddr, LInetAddr, ServerInfo, eOSType, strVersion ); + } + void OnCLRegisterServerResp ( CHostAddress /* unused */, ESvrRegResult eResult ) { diff --git a/src/serverdlg.cpp b/src/serverdlg.cpp index 788655c0..7936c333 100755 --- a/src/serverdlg.cpp +++ b/src/serverdlg.cpp @@ -218,10 +218,6 @@ CServerDlg::CServerDlg ( CServer* pNServP, showMinimized(); } - // set text for version and application name - lblNameVersion->setText ( QString ( APP_NAME ) + - tr ( " server " ) + QString ( VERSION ) ); - // set up list view for connected clients lvwClients->setColumnWidth ( 0, 170 ); lvwClients->setColumnWidth ( 1, 200 ); diff --git a/src/serverdlgbase.ui b/src/serverdlgbase.ui index 1754716d..6f3789f3 100755 --- a/src/serverdlgbase.ui +++ b/src/serverdlgbase.ui @@ -236,51 +236,6 @@ - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - TextLabelNameVersion - - - false - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 78074d87..e215835c 100755 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -340,6 +340,16 @@ void CServerListManager::OnTimerPollList() } } +void CServerListManager::CentralServerRegisterServerEx ( const CHostAddress& InetAddr, + const CHostAddress& LInetAddr, + const CServerCoreInfo& ServerInfo, + const COSUtil::EOpSystemType , + const QString& ) +{ +// TODO right now we do not make use of the additional operating system and version number informations +CentralServerRegisterServer ( InetAddr, LInetAddr, ServerInfo ); +} + void CServerListManager::CentralServerRegisterServer ( const CHostAddress& InetAddr, const CHostAddress& LInetAddr, const CServerCoreInfo& ServerInfo ) diff --git a/src/serverlist.h b/src/serverlist.h index f26003bf..e2f0ff85 100755 --- a/src/serverlist.h +++ b/src/serverlist.h @@ -147,6 +147,12 @@ public: const CHostAddress& LInetAddr, const CServerCoreInfo& ServerInfo ); + void CentralServerRegisterServerEx ( const CHostAddress& InetAddr, + const CHostAddress& LInetAddr, + const CServerCoreInfo& ServerInfo, + const COSUtil::EOpSystemType , + const QString& ); + void CentralServerUnregisterServer ( const CHostAddress& InetAddr ); void CentralServerQueryServerList ( const CHostAddress& InetAddr );