Added Support for instrument picture on fader tag

This commit is contained in:
Volker Fischer 2013-02-11 15:53:52 +00:00
parent cc3547676b
commit e037a90bcf
7 changed files with 414 additions and 129 deletions

View file

@ -68,7 +68,7 @@ CChannelFader::CChannelFader ( QWidget* pNW,
// set margins of the layouts to zero to get maximum space for the controls // set margins of the layouts to zero to get maximum space for the controls
pMainGrid->setContentsMargins ( 0, 0, 0, 0 ); pMainGrid->setContentsMargins ( 0, 0, 0, 0 );
pLabelGrid->setContentsMargins ( 0, 0, 0, 0 ); pLabelGrid->setContentsMargins ( 0, 0, 0, 0 );
pLabelGrid->setSpacing ( 1 ); // only minimal space between picture and text pLabelGrid->setSpacing ( 2 ); // only minimal space between picture and text
// add user controls to the grids // add user controls to the grids
pLabelGrid->addWidget ( pInstrument ); pLabelGrid->addWidget ( pInstrument );
@ -82,23 +82,6 @@ CChannelFader::CChannelFader ( QWidget* pNW,
// add fader frame to audio mixer board layout // add fader frame to audio mixer board layout
pParentLayout->addWidget( pFrame ); pParentLayout->addWidget( pFrame );
// TEST
const bool bInstPictUsed = false;
if ( bInstPictUsed )
{
pInstrument->setPixmap ( QPixmap ( ":/png/main/res/llconfronticon.png" ) );
pInstrument->setVisible ( true );
}
else
{
pInstrument->setVisible ( false );
}
// reset current fader // reset current fader
Reset(); Reset();
@ -161,17 +144,17 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign )
"QSlider::handle { image: url(:/png/fader/res/faderhandle.png); }" ); "QSlider::handle { image: url(:/png/fader/res/faderhandle.png); }" );
// mute button // mute button
pcbMute->setText ( "MUTE" ); pcbMute->setText ( tr ( "MUTE" ) );
// solo button // solo button
pcbSolo->setText ( "SOLO" ); pcbSolo->setText ( tr ( "SOLO" ) );
break; break;
default: default:
// reset style sheet and set original paramters // reset style sheet and set original paramters
pFader->setStyleSheet ( "" ); pFader->setStyleSheet ( "" );
pcbMute->setText ( "Mute" ); pcbMute->setText ( tr ( "Mute" ) );
pcbSolo->setText ( "Solo" ); pcbSolo->setText ( tr ( "Solo" ) );
break; break;
} }
} }
@ -185,7 +168,8 @@ void CChannelFader::Reset()
pcbMute->setChecked ( false ); pcbMute->setChecked ( false );
pcbSolo->setChecked ( false ); pcbSolo->setChecked ( false );
// clear label // clear instrument picture and label text
pInstrument->setVisible ( false );
pLabel->setText ( "" ); pLabel->setText ( "" );
bOtherChannelIsSolo = false; bOtherChannelIsSolo = false;
@ -286,6 +270,29 @@ void CChannelFader::SetText ( const QString sText )
pLabel->setText ( sModText ); pLabel->setText ( sModText );
} }
void CChannelFader::SetInstrumentPicture ( const int iInstrument )
{
// get the resource reference string for this instrument
const QString strCurResourceRef =
CInstPictures::GetResourceReference ( iInstrument );
// first check if instrument picture is used or not and if it is valid
if ( CInstPictures::IsNotUsedInstrument ( iInstrument ) &&
( !strCurResourceRef.isEmpty() ) )
{
// disable instrument picture
pInstrument->setVisible ( false );
}
else
{
// set correct picture
pInstrument->setPixmap ( QPixmap ( strCurResourceRef ) );
// enable instrument picture
pInstrument->setVisible ( true );
}
}
double CChannelFader::CalcFaderGain ( const int value ) double CChannelFader::CalcFaderGain ( const int value )
{ {
// convert actual slider range in gain values // convert actual slider range in gain values
@ -382,7 +389,7 @@ void CAudioMixerBoard::HideAll()
emit NumClientsChanged ( 0 ); // -> no clients connected emit NumClientsChanged ( 0 ); // -> no clients connected
} }
void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelShortInfo>& vecChanInfo ) void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInfo )
{ {
// get number of connected clients // get number of connected clients
const int iNumConnectedClients = vecChanInfo.Size(); const int iNumConnectedClients = vecChanInfo.Size();
@ -415,7 +422,20 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelShortInfo>& vecCh
} }
// update text // update text
vecpChanFader[i]->SetText ( GenFaderText ( vecChanInfo[j] ) ); vecpChanFader[i]->
SetText ( GenFaderText ( vecChanInfo[j] ) );
// update other channel infos (only available for new protocol
// which is not compatible with old versions -> this way we make
// sure that the protocol which transferrs only the name does
// change the other client infos
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -> the "if-condition" can be removed later on...
if ( !vecChanInfo[j].bOnlyNameIsUsed )
{
// update instrument picture
vecpChanFader[i]->
SetInstrumentPicture ( vecChanInfo[j].iInstrument );
}
bFaderIsUsed = true; bFaderIsUsed = true;
} }
@ -460,7 +480,7 @@ void CAudioMixerBoard::OnChSoloStateChanged ( const int iChannelIdx,
vecpChanFader[iChannelIdx]->SetOtherSoloState ( false ); vecpChanFader[iChannelIdx]->SetOtherSoloState ( false );
} }
QString CAudioMixerBoard::GenFaderText ( CChannelShortInfo& ChanInfo ) QString CAudioMixerBoard::GenFaderText ( CChannelInfo& ChanInfo )
{ {
// if text is empty, show IP address instead // if text is empty, show IP address instead
if ( ChanInfo.strName.isEmpty() ) if ( ChanInfo.strName.isEmpty() )

View file

@ -95,7 +95,8 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
// fader tag // fader tag
QString strFaderTag = tr ( "<b>Your Alias/Instrument:</b> Set your name " QString strFaderTag = tr ( "<b>Your Alias/Instrument:</b> Set your name "
"or an alias here so that the other musicians you want to play with " "or an alias here so that the other musicians you want to play with "
"know who you are. Additionally you may enter the instrument you play. " "know who you are. Additionally you may set an instrument picture of "
"the instrument you play. "
"What you set here will appear at your fader on the mixer board when " "What you set here will appear at your fader on the mixer board when "
"you are connected to a " ) + APP_NAME + tr ( " server. This tag will " "you are connected to a " ) + APP_NAME + tr ( " server. This tag will "
"also show up at each client which is connected to the same server as " "also show up at each client which is connected to the same server as "
@ -109,8 +110,10 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
lblServerTag->setToolTip ( strFaderTagTT ); lblServerTag->setToolTip ( strFaderTagTT );
edtFaderTag->setWhatsThis ( strFaderTag ); edtFaderTag->setWhatsThis ( strFaderTag );
edtFaderTag->setToolTip ( strFaderTagTT ); edtFaderTag->setToolTip ( strFaderTagTT );
edtFaderTag->setAccessibleName ( tr ( "Fader tag edit box" ) ); edtFaderTag->setAccessibleName ( tr ( "Fader tag edit box" ) );
butInstPicture->setWhatsThis ( strFaderTag );
butInstPicture->setToolTip ( strFaderTagTT );
butInstPicture->setAccessibleName ( tr ( "Instrument picture button" ) );
// local audio input fader // local audio input fader
QString strAudFader = tr ( "<b>Local Audio Input Fader:</b> With the " QString strAudFader = tr ( "<b>Local Audio Input Fader:</b> With the "
@ -226,8 +229,10 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
// reset mixer board // reset mixer board
MainMixerBoard->HideAll(); MainMixerBoard->HideAll();
// init fader tag line edit // init fader tag line edit and instrument picture
edtFaderTag->setText ( pClient->strName ); edtFaderTag->setText ( pClient->ChannelInfo.strName );
butInstPicture->setIcon ( QIcon (
CInstPictures::GetResourceReference ( pClient->ChannelInfo.iInstrument ) ) );
// init status label // init status label
OnTimerStatus(); OnTimerStatus();
@ -321,11 +326,33 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
layout()->setMenuBar ( pMenu ); layout()->setMenuBar ( pMenu );
// Instrument pictures popup menu ------------------------------------------
pInstrPictPopupMenu = new QMenu ( this );
// add an entry for all known instruments
for ( int iCurInst = 0; iCurInst < CInstPictures::GetNumAvailableInst(); iCurInst++ )
{
// create a menu action with text and image
QAction* pCurAction = new QAction (
QIcon ( CInstPictures::GetResourceReference ( iCurInst ) ),
CInstPictures::GetName ( iCurInst ),
this );
// add data to identify the action data when it is triggered
pCurAction->setData ( iCurInst );
pInstrPictPopupMenu->addAction ( pCurAction );
}
// Connections ------------------------------------------------------------- // Connections -------------------------------------------------------------
// push buttons // push buttons
QObject::connect ( butConnect, SIGNAL ( clicked() ), QObject::connect ( butConnect, SIGNAL ( clicked() ),
this, SLOT ( OnConnectDisconBut() ) ); this, SLOT ( OnConnectDisconBut() ) );
QObject::connect ( butInstPicture, SIGNAL ( clicked() ),
this, SLOT ( OnInstPictureBut() ) );
// check boxes // check boxes
QObject::connect ( chbSettings, SIGNAL ( stateChanged ( int ) ), QObject::connect ( chbSettings, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnSettingsStateChanged ( int ) ) ); this, SLOT ( OnSettingsStateChanged ( int ) ) );
@ -361,10 +388,18 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
QObject::connect ( edtFaderTag, SIGNAL ( textChanged ( const QString& ) ), QObject::connect ( edtFaderTag, SIGNAL ( textChanged ( const QString& ) ),
this, SLOT ( OnFaderTagTextChanged ( const QString& ) ) ); this, SLOT ( OnFaderTagTextChanged ( const QString& ) ) );
// menus
QObject::connect ( pInstrPictPopupMenu, SIGNAL ( triggered ( QAction* ) ),
this, SLOT ( OnInstPicturesMenuTriggered ( QAction* ) ) );
// other // other
QObject::connect ( pClient, QObject::connect ( pClient,
SIGNAL ( ConClientListMesReceived ( CVector<CChannelShortInfo> ) ), SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ),
this, SLOT ( OnConClientListMesReceived ( CVector<CChannelShortInfo> ) ) ); this, SLOT ( OnConClientListMesReceived ( CVector<CChannelInfo> ) ) );
QObject::connect ( pClient,
SIGNAL ( ConClientListMesReceived ( CVector<CChannelInfo> ) ),
this, SLOT ( OnConClientListMesReceived ( CVector<CChannelInfo> ) ) );
QObject::connect ( pClient, QObject::connect ( pClient,
SIGNAL ( Disconnected() ), SIGNAL ( Disconnected() ),
@ -429,7 +464,7 @@ void CLlconClientDlg::closeEvent ( QCloseEvent* Event )
} }
// store fader tag // store fader tag
pClient->strName = edtFaderTag->text(); pClient->ChannelInfo.strName = edtFaderTag->text();
// default implementation of this event handler routine // default implementation of this event handler routine
Event->accept(); Event->accept();
@ -504,6 +539,30 @@ void CLlconClientDlg::OnConnectDisconBut()
ConnectDisconnect ( !pClient->IsRunning() ); ConnectDisconnect ( !pClient->IsRunning() );
} }
void CLlconClientDlg::OnInstPictureBut()
{
// open a menu which shows all available instrument pictures which
// always appears at the same position relative to the instrument
// picture button
pInstrPictPopupMenu->exec ( this->mapToGlobal ( butInstPicture->pos() ) );
}
void CLlconClientDlg::OnInstPicturesMenuTriggered ( QAction* SelAction )
{
// get selected instrument
const int iSelInstrument = SelAction->data().toInt();
// set the new value in the data base
pClient->ChannelInfo.iInstrument = iSelInstrument;
// update channel info at the server
pClient->SetRemoteInfo();
// update icon on the instrument selection button
butInstPicture->setIcon ( QIcon (
CInstPictures::GetResourceReference ( iSelInstrument ) ) );
}
void CLlconClientDlg::OnChatTextReceived ( QString strChatText ) void CLlconClientDlg::OnChatTextReceived ( QString strChatText )
{ {
// init flag (will maybe overwritten later in this function) // init flag (will maybe overwritten later in this function)
@ -535,9 +594,9 @@ void CLlconClientDlg::OnDisconnected()
UpdateDisplay(); UpdateDisplay();
} }
void CLlconClientDlg::OnConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo ) void CLlconClientDlg::OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo )
{ {
// update mixer board // update mixer board with the additional client infos
MainMixerBoard->ApplyNewConClientList ( vecChanInfo ); MainMixerBoard->ApplyNewConClientList ( vecChanInfo );
} }
@ -625,10 +684,10 @@ void CLlconClientDlg::OnFaderTagTextChanged ( const QString& strNewName )
if ( strNewName.length() <= MAX_LEN_FADER_TAG ) if ( strNewName.length() <= MAX_LEN_FADER_TAG )
{ {
// refresh internal name parameter // refresh internal name parameter
pClient->strName = strNewName; pClient->ChannelInfo.strName = strNewName;
// update name at server // update channel info at the server
pClient->SetRemoteName(); pClient->SetRemoteInfo();
} }
else else
{ {

View file

@ -100,6 +100,7 @@ protected:
QMenu* pViewMenu; QMenu* pViewMenu;
QMenuBar* pMenu; QMenuBar* pMenu;
QMenu* pInstrPictPopupMenu;
CClientSettingsDlg ClientSettingsDlg; CClientSettingsDlg ClientSettingsDlg;
CChatDlg ChatDlg; CChatDlg ChatDlg;
@ -109,6 +110,7 @@ public slots:
void OnAboutToQuit() { pSettings->Save(); } void OnAboutToQuit() { pSettings->Save(); }
void OnConnectDisconBut(); void OnConnectDisconBut();
void OnInstPictureBut();
void OnTimerSigMet(); void OnTimerSigMet();
void OnTimerStatus() { UpdateDisplay(); } void OnTimerStatus() { UpdateDisplay(); }
@ -122,6 +124,8 @@ public slots:
void OnOpenGeneralSettings() { ShowGeneralSettings(); } void OnOpenGeneralSettings() { ShowGeneralSettings(); }
void OnOpenChatDialog() { ShowChatWindow(); } void OnOpenChatDialog() { ShowChatWindow(); }
void OnInstPicturesMenuTriggered ( QAction* SelAction );
void OnSettingsStateChanged ( int value ); void OnSettingsStateChanged ( int value );
void OnChatStateChanged ( int value ); void OnChatStateChanged ( int value );
@ -136,7 +140,7 @@ public slots:
void OnReverbSelRClicked() void OnReverbSelRClicked()
{ pClient->SetReverbOnLeftChan ( false ); } { pClient->SetReverbOnLeftChan ( false ); }
void OnConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo ); void OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
void OnFaderTagTextChanged ( const QString& strNewName ); void OnFaderTagTextChanged ( const QString& strNewName );
void OnChatTextReceived ( QString strChatText ); void OnChatTextReceived ( QString strChatText );

View file

@ -442,12 +442,6 @@
</item> </item>
<item> <item>
<widget class="QLabel" name="lblServerTag" > <widget class="QLabel" name="lblServerTag" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" > <property name="text" >
<string>Your Alias/Instrument</string> <string>Your Alias/Instrument</string>
</property> </property>
@ -457,14 +451,37 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="edtFaderTag" > <layout class="QHBoxLayout" >
<property name="sizePolicy" > <item>
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" > <widget class="QLineEdit" name="edtFaderTag" >
<horstretch>0</horstretch> <property name="sizePolicy" >
<verstretch>0</verstretch> <sizepolicy vsizetype="Fixed" hsizetype="Ignored" >
</sizepolicy> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
</widget> </sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>40</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="butInstPicture" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="icon" >
<iconset resource="resources.qrc" >:/png/instr/res/instrnone.png</iconset>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >

View file

@ -94,11 +94,11 @@ protected:
public slots: public slots:
void OnTimer() void OnTimer()
{ {
CVector<CChannelShortInfo> vecChanInfo ( 1 ); CVector<CChannelInfo> vecChanInfo ( 1 );
CNetworkTransportProps NetTrProps; CNetworkTransportProps NetTrProps;
CServerCoreInfo ServerInfo; CServerCoreInfo ServerInfo;
CVector<CServerInfo> vecServerInfo ( 1 ); CVector<CServerInfo> vecServerInfo ( 1 );
CHostAddress CurHostAddress ( QHostAddress ( sAddress ), iPort ); CHostAddress CurHostAddress ( QHostAddress ( sAddress ), iPort );
// generate random protocol message // generate random protocol message
switch ( GenRandomIntInRange ( 0, 21 ) ) switch ( GenRandomIntInRange ( 0, 21 ) )
@ -121,7 +121,7 @@ public slots:
vecChanInfo[0].iIpAddr = GenRandomIntInRange ( 0, 100000 ); vecChanInfo[0].iIpAddr = GenRandomIntInRange ( 0, 100000 );
vecChanInfo[0].strName = GenRandomString(); vecChanInfo[0].strName = GenRandomString();
Protocol.CreateConClientListMes ( vecChanInfo ); Protocol.CreateConClientListNameMes ( vecChanInfo );
break; break;
case 4: case 4:
@ -133,7 +133,7 @@ public slots:
break; break;
case 6: case 6:
Protocol.CreateReqChanNameMes(); Protocol.CreateReqChanInfoMes();
break; break;
case 7: case 7:

View file

@ -419,6 +419,7 @@ CLlconHelpMenu::CLlconHelpMenu ( QWidget* parent ) : QMenu ( "&?", parent )
/******************************************************************************\ /******************************************************************************\
* Other Classes * * Other Classes *
\******************************************************************************/ \******************************************************************************/
// Network utility functions ---------------------------------------------------
bool LlconNetwUtil::ParseNetworkAddress ( QString strAddress, bool LlconNetwUtil::ParseNetworkAddress ( QString strAddress,
CHostAddress& HostAddress ) CHostAddress& HostAddress )
{ {
@ -467,6 +468,78 @@ bool LlconNetwUtil::ParseNetworkAddress ( QString strAddress,
} }
// Instrument picture data base ------------------------------------------------
CVector<CInstPictures::CInstPictProps>& CInstPictures::GetTable()
{
// make sure we generate the table only once
static bool TableIsInitialized = false;
static CVector<CInstPictProps> vecDataBase;
if ( !TableIsInitialized )
{
// instrument picture data base initialization
// NOTE: Do not change the order of any instrument in the future!
// NOTE: The very first entry is the "not used" element per definition.
vecDataBase.Add ( CInstPictProps ( "None", ":/png/instr/res/instrnone.png", IC_OTHER_INSTRUMENT ) ); // special first element
vecDataBase.Add ( CInstPictProps ( "Drum Set", ":/png/instr/res/instrdrumset.png", IC_PERCUSSION_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Electric Guitar", ":/png/instr/res/instreguitar.png", IC_PLUCKING_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Acoutic Guitar", ":/png/instr/res/instraguitar.png", IC_PLUCKING_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Bass Guitar", ":/png/instr/res/instrbassguitar.png", IC_PLUCKING_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Keyboard", ":/png/instr/res/instrkeyboard.png", IC_KEYBOARD_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Microphone", ":/png/instr/res/instrmicrophone.png", IC_OTHER_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Accordeon", ":/png/instr/res/instraccordeon.png", IC_KEYBOARD_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Trumpet", ":/png/instr/res/instrtrumpet.png", IC_WIND_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Trombone", ":/png/instr/res/instrtrombone.png", IC_WIND_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Saxophone", ":/png/instr/res/instrsaxophone.png", IC_WIND_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Clarinet", ":/png/instr/res/instrclarinet.png", IC_WIND_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Flute", ":/png/instr/res/instrflute.png", IC_WIND_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Violin", ":/png/instr/res/instrviolin.png", IC_STRING_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( "Cello", ":/png/instr/res/instrcello.png", IC_STRING_INSTRUMENT ) );
// now the table is initialized
TableIsInitialized = true;
}
return vecDataBase;
}
bool CInstPictures::IsInstIndexInRange ( const int iIdx )
{
// check if index is in valid range
return ( iIdx >= 0 ) && ( iIdx < GetTable().Size() );
}
QString CInstPictures::GetResourceReference ( const int iInstrument )
{
// range check
if ( IsInstIndexInRange ( iInstrument ) )
{
// return the string of the resource reference for accessing the picture
return GetTable()[iInstrument].strResourceReference;
}
else
{
return "";
}
}
QString CInstPictures::GetName ( const int iInstrument )
{
// range check
if ( IsInstIndexInRange ( iInstrument ) )
{
// return the name of the instrument
return GetTable()[iInstrument].strName;
}
else
{
return "";
}
}
/******************************************************************************\ /******************************************************************************\
* Global Functions Implementation * * Global Functions Implementation *
\******************************************************************************/ \******************************************************************************/

View file

@ -378,8 +378,48 @@ public slots:
/******************************************************************************\ /******************************************************************************\
* Other Classes * * Other Classes/Enums *
\******************************************************************************/ \******************************************************************************/
// Audio compression type enum -------------------------------------------------
enum EAudComprType
{
// used for protocol -> enum values must be fixed!
CT_NONE = 0,
CT_CELT = 1
};
// Get data status enum --------------------------------------------------------
enum EGetDataStat
{
GS_BUFFER_OK,
GS_BUFFER_UNDERRUN,
GS_CHAN_NOW_DISCONNECTED,
GS_CHAN_NOT_CONNECTED
};
// GUI design enum -------------------------------------------------------------
enum EGUIDesign
{
// used for settings -> enum values must be fixed!
GD_STANDARD = 0,
GD_ORIGINAL = 1
};
// Skill level enum ------------------------------------------------------------
enum ESkillLevel
{
// used for protocol -> enum values must be fixed!
SL_NOT_SET = 0,
SL_BEGINNER = 1,
SL_INTERMEDIATE = 2,
SL_PROFESSIONAL = 3
};
// Stereo signal level meter --------------------------------------------------- // Stereo signal level meter ---------------------------------------------------
class CStereoSignalLevelMeter class CStereoSignalLevelMeter
{ {
@ -433,7 +473,7 @@ public:
} }
// compare operator // compare operator
bool operator== ( const CHostAddress& CompAddr ) // compare operator bool operator== ( const CHostAddress& CompAddr )
{ {
return ( ( CompAddr.InetAddr == InetAddr ) && return ( ( CompAddr.InetAddr == InetAddr ) &&
( CompAddr.iPort == iPort ) ); ( CompAddr.iPort == iPort ) );
@ -467,52 +507,99 @@ public:
}; };
// Short info of a channel ----------------------------------------------------- // Instrument picture data base ------------------------------------------------
class CChannelShortInfo // this is a pure static class
class CInstPictures
{ {
public: public:
CChannelShortInfo() : enum EInstCategory
iChanID ( 0 ), {
iIpAddr ( 0 ), IC_OTHER_INSTRUMENT,
strName ( "" ) {} IC_WIND_INSTRUMENT,
IC_STRING_INSTRUMENT,
IC_PLUCKING_INSTRUMENT,
IC_PERCUSSION_INSTRUMENT,
IC_KEYBOARD_INSTRUMENT
};
CChannelShortInfo ( const int iNID, // per definition: the very first instrument is the "not used" instrument
const quint32 nIP, static int GetNotUsedInstrument() { return 0; }
const QString nN ) : static bool IsNotUsedInstrument ( const int iInstrument ) { return iInstrument == 0; }
iChanID ( iNID ),
iIpAddr ( nIP ),
strName ( nN ) {}
int iChanID; static int GetNumAvailableInst() { return GetTable().Size(); }
quint32 iIpAddr; static QString GetResourceReference ( const int iInstrument );
QString strName; static QString GetName ( const int iInstrument );
// TODO make use of instrument category (not yet implemented)
protected:
class CInstPictProps
{
public:
CInstPictProps() :
strName ( "" ),
strResourceReference ( "" ),
eInstCategory ( IC_OTHER_INSTRUMENT ) {}
CInstPictProps ( const QString NsName,
const QString NsResRef,
const EInstCategory NeInstCat ) :
strName ( NsName ),
strResourceReference ( NsResRef ),
eInstCategory ( NeInstCat ) {}
QString strName;
QString strResourceReference;
EInstCategory eInstCategory;
};
static bool IsInstIndexInRange ( const int iIdx );
static CVector<CInstPictProps>& GetTable();
}; };
// Additional info of a channel ------------------------------------------------ // Info of a channel -----------------------------------------------------------
class CChannelAdditionalInfo class CChannelCoreInfo
{ {
public: public:
CChannelAdditionalInfo() : CChannelCoreInfo() :
iChanID ( 0 ), strName ( "" ),
eCountry ( QLocale::AnyCountry ), eCountry ( QLocale::AnyCountry ),
strCity ( "" ), strCity ( "" ),
iInstrument ( 0 ), iInstrument ( CInstPictures::GetNotUsedInstrument() ),
iSkillLevel ( 0 ) {} eSkillLevel ( SL_NOT_SET ) {}
CChannelAdditionalInfo ( const int iNID, CChannelCoreInfo ( const QString NsName,
const QLocale::Country& NeCountry, const QLocale::Country& NeCountry,
const QString& NsCity, const QString& NsCity,
const int NiInstrument, const int NiInstrument,
const int NiSkillLevel ) : const ESkillLevel NeSkillLevel ) :
iChanID ( iNID ), strName ( NsName ),
eCountry ( NeCountry ), eCountry ( NeCountry ),
strCity ( NsCity ), strCity ( NsCity ),
iInstrument ( NiInstrument ), iInstrument ( NiInstrument ),
iSkillLevel ( NiSkillLevel ) {} eSkillLevel ( NeSkillLevel ) {}
// ID of the channel CChannelCoreInfo ( const CChannelCoreInfo& NCorInf ) :
int iChanID; strName ( NCorInf.strName ),
eCountry ( NCorInf.eCountry ),
strCity ( NCorInf.strCity ),
iInstrument ( NCorInf.iInstrument ),
eSkillLevel ( NCorInf.eSkillLevel ) {}
// compare operator
bool operator!= ( const CChannelCoreInfo& CompChanInfo )
{
return ( ( CompChanInfo.strName != strName ) ||
( CompChanInfo.eCountry != eCountry ) ||
( CompChanInfo.strCity != strCity ) ||
( CompChanInfo.iInstrument != iInstrument ) ||
( CompChanInfo.eSkillLevel != eSkillLevel ) );
}
// fader tag text (channel name)
QString strName;
// country in which the client is located // country in which the client is located
QLocale::Country eCountry; QLocale::Country eCountry;
@ -524,7 +611,65 @@ public:
int iInstrument; int iInstrument;
// skill level of the musician // skill level of the musician
int iSkillLevel; ESkillLevel eSkillLevel;
};
class CChannelInfo : public CChannelCoreInfo
{
public:
CChannelInfo() :
iChanID ( 0 ),
iIpAddr ( 0 ),
bOnlyNameIsUsed ( false ) {}
CChannelInfo ( const int NiID,
const quint32 NiIP,
const CChannelCoreInfo& NCorInf ) :
CChannelCoreInfo ( NCorInf ),
iChanID ( NiID ),
iIpAddr ( NiIP ),
bOnlyNameIsUsed ( false ) {}
CChannelInfo ( const int NiID,
const quint32 NiIP,
const QString NsName,
const QLocale::Country& NeCountry,
const QString& NsCity,
const int NiInstrument,
const ESkillLevel NeSkillLevel ) :
CChannelCoreInfo ( NsName,
NeCountry,
NsCity,
NiInstrument,
NeSkillLevel ),
iChanID ( NiID ),
iIpAddr ( NiIP ),
bOnlyNameIsUsed ( false ) {}
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
CChannelInfo ( const int NiID,
const quint32 NiIP,
const QString NsName ) :
CChannelCoreInfo ( NsName,
QLocale::AnyCountry,
"",
CInstPictures::GetNotUsedInstrument(),
SL_NOT_SET ),
iChanID ( NiID ),
iIpAddr ( NiIP ),
bOnlyNameIsUsed ( true ) {}
// in old versions, the name was the only client info -> to be removed
// when compatiblility to old versions is removed
bool bOnlyNameIsUsed;
// ID of the channel
int iChanID;
// IP address of the channel
quint32 iIpAddr;
}; };
@ -584,13 +729,7 @@ class CServerInfo : public CServerCoreInfo
{ {
public: public:
CServerInfo() : CServerInfo() :
CServerCoreInfo ( 0, HostAddr ( CHostAddress() ) {}
"",
"",
QLocale::AnyCountry,
"",
0,
false ), HostAddr ( CHostAddress() ) {}
CServerInfo ( CServerInfo (
const CHostAddress& NHAddr, const CHostAddress& NHAddr,
@ -609,38 +748,11 @@ public:
NiMaxNumClients, NiMaxNumClients,
NbPermOnline ), HostAddr ( NHAddr ) {} NbPermOnline ), HostAddr ( NHAddr ) {}
public:
// internet address of the server // internet address of the server
CHostAddress HostAddr; CHostAddress HostAddr;
}; };
// Audio compression type enum -------------------------------------------------
enum EAudComprType
{
CT_NONE = 0,
CT_CELT = 1
};
// Get data status enum --------------------------------------------------------
enum EGetDataStat
{
GS_BUFFER_OK,
GS_BUFFER_UNDERRUN,
GS_CHAN_NOW_DISCONNECTED,
GS_CHAN_NOT_CONNECTED
};
// GUI design enum -------------------------------------------------------------
enum EGUIDesign
{
GD_STANDARD = 0,
GD_ORIGINAL = 1
};
// Network transport properties ------------------------------------------------ // Network transport properties ------------------------------------------------
class CNetworkTransportProps class CNetworkTransportProps
{ {