Merge pull request #2 from corrados/master

update
This commit is contained in:
ignotus 2020-07-08 22:50:32 +02:00 committed by GitHub
commit 1df53d8bf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 264 additions and 92 deletions

View file

@ -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

View file

@ -129,7 +129,7 @@ CChannelFader::CChannelFader ( QWidget* pNW )
// reset current fader
strGroupBaseText = "Grp"; // this will most probably overwritten by SetGUIDesign()
iInstrPicFixedWidth = INVALID_INDEX; // 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
{

View file

@ -119,7 +119,7 @@ protected:
double dPreviousFaderLevel;
int iGroupID;
QString strGroupBaseText;
int iInstrPicFixedWidth;
int iInstrPicMaxWidth;
public slots:
void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value, false ); }

View file

@ -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<uint8_t> vecData ( 1 ); // 1 byte of data
int iPos = 0; // init position pointer
PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( bRCL ), 1 );
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( 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<uint8_t> vecData ( iEntrLen );
// port number (2 bytes)
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( LInetAddr.iPort ), 2 );
// country (2 bytes)
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( ServerInfo.eCountry ), 2 );
// maximum number of connected clients (1 byte)
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( ServerInfo.iMaxNumClients ), 1 );
// "is permanent" flag (1 byte)
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( 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<uint32_t> ( COSUtil::GetOperatingSystem() ), 1 );
// version
PutStringUTF8OnStream ( vecData, iPos, strUTF8Version );
CreateAndImmSendConLessMessage ( PROTMESSID_CLM_REGISTER_SERVER_EX,
vecData,
InetAddr );
}
bool CProtocol::EvaluateCLRegisterServerExMes ( const CHostAddress& InetAddr,
const CVector<uint8_t>& 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<quint16> ( GetValFromStream ( vecData, iPos, 2 ) );
// country (2 bytes)
RecServerInfo.eCountry = static_cast<QLocale::Country> ( GetValFromStream ( vecData, iPos, 2 ) );
// maximum number of connected clients (1 byte)
RecServerInfo.iMaxNumClients = static_cast<int> ( GetValFromStream ( vecData, iPos, 1 ) );
// "is permanent" flag (1 byte)
RecServerInfo.bPermanentOnline = static_cast<bool> ( 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<COSUtil::EOpSystemType> ( 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,

View file

@ -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<CServerInfo> vecServerInfo );
@ -250,6 +254,8 @@ protected:
bool EvaluateCLServerFullMes();
bool EvaluateCLRegisterServerMes ( const CHostAddress& InetAddr,
const CVector<uint8_t>& vecData );
bool EvaluateCLRegisterServerExMes ( const CHostAddress& InetAddr,
const CVector<uint8_t>& vecData );
bool EvaluateCLUnregisterServerMes ( const CHostAddress& InetAddr );
bool EvaluateCLServerListMes ( const CHostAddress& InetAddr,
const CVector<uint8_t>& 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<CServerInfo> vecServerInfo );

View file

@ -3220,17 +3220,17 @@
<context>
<name>QCoreApplication</name>
<message>
<location filename="../../util.cpp" line="1578"/>
<location filename="../../util.cpp" line="1585"/>
<source>, Version </source>
<translation>, Version </translation>
</message>
<message>
<location filename="../../util.cpp" line="1591"/>
<location filename="../../util.cpp" line="1598"/>
<source>Internet Jam Session Software</source>
<translation>Internet Jam Session Software</translation>
</message>
<message>
<location filename="../../util.cpp" line="1595"/>
<location filename="../../util.cpp" line="1602"/>
<source>Released under the GNU General Public License (GPL)</source>
<translation>Unter der GNU General Public License (GPL)</translation>
</message>

View file

@ -3240,17 +3240,17 @@
<context>
<name>QCoreApplication</name>
<message>
<location filename="../../util.cpp" line="1578"/>
<location filename="../../util.cpp" line="1585"/>
<source>, Version </source>
<translation>, Versión </translation>
</message>
<message>
<location filename="../../util.cpp" line="1591"/>
<location filename="../../util.cpp" line="1598"/>
<source>Internet Jam Session Software</source>
<translation>Internet Jam Session Software</translation>
</message>
<message>
<location filename="../../util.cpp" line="1595"/>
<location filename="../../util.cpp" line="1602"/>
<source>Released under the GNU General Public License (GPL)</source>
<translation>Publicado bajo la GNU General Public License (GPL)</translation>
</message>

View file

@ -3232,17 +3232,17 @@
<context>
<name>QCoreApplication</name>
<message>
<location filename="../../util.cpp" line="1578"/>
<location filename="../../util.cpp" line="1585"/>
<source>, Version </source>
<translation>, version </translation>
</message>
<message>
<location filename="../../util.cpp" line="1591"/>
<location filename="../../util.cpp" line="1598"/>
<source>Internet Jam Session Software</source>
<translation>Logiciel de bœuf sur Internet</translation>
</message>
<message>
<location filename="../../util.cpp" line="1595"/>
<location filename="../../util.cpp" line="1602"/>
<source>Released under the GNU General Public License (GPL)</source>
<translation>Publié sous la licence publique générale GNU (GPL)</translation>
</message>

View file

@ -3180,17 +3180,17 @@
<context>
<name>QCoreApplication</name>
<message>
<location filename="../../util.cpp" line="1578"/>
<location filename="../../util.cpp" line="1585"/>
<source>, Version </source>
<translation>Versione, Versione </translation>
</message>
<message>
<location filename="../../util.cpp" line="1591"/>
<location filename="../../util.cpp" line="1598"/>
<source>Internet Jam Session Software</source>
<translation>Programma per Jam Session su Internet</translation>
</message>
<message>
<location filename="../../util.cpp" line="1595"/>
<location filename="../../util.cpp" line="1602"/>
<source>Released under the GNU General Public License (GPL)</source>
<translation>Rilasciato sotto licensa GNU General Public License (GPL)</translation>
</message>

View file

@ -3180,17 +3180,17 @@
<context>
<name>QCoreApplication</name>
<message>
<location filename="../../util.cpp" line="1578"/>
<location filename="../../util.cpp" line="1585"/>
<source>, Version </source>
<translation>, Versie </translation>
</message>
<message>
<location filename="../../util.cpp" line="1591"/>
<location filename="../../util.cpp" line="1598"/>
<source>Internet Jam Session Software</source>
<translation>Internet Jamsessie Software</translation>
</message>
<message>
<location filename="../../util.cpp" line="1595"/>
<location filename="../../util.cpp" line="1602"/>
<source>Released under the GNU General Public License (GPL)</source>
<translation>Gereleased onder de GNU General Public License (GPL)</translation>
</message>

View file

@ -2823,17 +2823,17 @@ nie jestem pewna</translatorcomment>
<context>
<name>QCoreApplication</name>
<message>
<location filename="../../util.cpp" line="1578"/>
<location filename="../../util.cpp" line="1585"/>
<source>, Version </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../util.cpp" line="1591"/>
<location filename="../../util.cpp" line="1598"/>
<source>Internet Jam Session Software</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../util.cpp" line="1595"/>
<location filename="../../util.cpp" line="1602"/>
<source>Released under the GNU General Public License (GPL)</source>
<translation type="unfinished"></translation>
</message>

View file

@ -3218,17 +3218,17 @@
<context>
<name>QCoreApplication</name>
<message>
<location filename="../../util.cpp" line="1578"/>
<location filename="../../util.cpp" line="1585"/>
<source>, Version </source>
<translation>, Versão </translation>
</message>
<message>
<location filename="../../util.cpp" line="1591"/>
<location filename="../../util.cpp" line="1598"/>
<source>Internet Jam Session Software</source>
<translation>Programa de Jam Sessions pela Internet</translation>
</message>
<message>
<location filename="../../util.cpp" line="1595"/>
<location filename="../../util.cpp" line="1602"/>
<source>Released under the GNU General Public License (GPL)</source>
<translation>Lançado sob a Licença Pública Geral GNU (GPL)</translation>
</message>

View file

@ -3216,17 +3216,17 @@
<context>
<name>QCoreApplication</name>
<message>
<location filename="../../util.cpp" line="1578"/>
<location filename="../../util.cpp" line="1585"/>
<source>, Version </source>
<translation>, Versão </translation>
</message>
<message>
<location filename="../../util.cpp" line="1591"/>
<location filename="../../util.cpp" line="1598"/>
<source>Internet Jam Session Software</source>
<translation>Programa de Jam Sessions pela Internet</translation>
</message>
<message>
<location filename="../../util.cpp" line="1595"/>
<location filename="../../util.cpp" line="1602"/>
<source>Released under the GNU General Public License (GPL)</source>
<translation>Lançado sob a Licença Pública Geral GNU (GPL)</translation>
</message>

View file

@ -2792,17 +2792,17 @@
<context>
<name>QCoreApplication</name>
<message>
<location filename="../../util.cpp" line="1578"/>
<location filename="../../util.cpp" line="1585"/>
<source>, Version </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../util.cpp" line="1591"/>
<location filename="../../util.cpp" line="1598"/>
<source>Internet Jam Session Software</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../util.cpp" line="1595"/>
<location filename="../../util.cpp" line="1602"/>
<source>Released under the GNU General Public License (GPL)</source>
<translation type="unfinished"></translation>
</message>

View file

@ -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 );

View file

@ -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 )
{

View file

@ -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 );

View file

@ -236,51 +236,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lblNameVersion">
<property name="text">
<string>TextLabelNameVersion</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>

View file

@ -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 )

View file

@ -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 );