From e037a90bcfa6b7a249869da18a0bff8668f27dd8 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 11 Feb 2013 15:53:52 +0000 Subject: [PATCH] Added Support for instrument picture on fader tag --- src/audiomixerboard.cpp | 72 +++++++---- src/llconclientdlg.cpp | 83 +++++++++++-- src/llconclientdlg.h | 6 +- src/llconclientdlgbase.ui | 45 ++++--- src/testbench.h | 14 +-- src/util.cpp | 73 +++++++++++ src/util.h | 250 +++++++++++++++++++++++++++----------- 7 files changed, 414 insertions(+), 129 deletions(-) diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index 58ea5f93..822e95d7 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -68,7 +68,7 @@ CChannelFader::CChannelFader ( QWidget* pNW, // set margins of the layouts to zero to get maximum space for the controls pMainGrid->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 pLabelGrid->addWidget ( pInstrument ); @@ -82,23 +82,6 @@ CChannelFader::CChannelFader ( QWidget* pNW, // add fader frame to audio mixer board layout 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(); @@ -161,17 +144,17 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign ) "QSlider::handle { image: url(:/png/fader/res/faderhandle.png); }" ); // mute button - pcbMute->setText ( "MUTE" ); + pcbMute->setText ( tr ( "MUTE" ) ); // solo button - pcbSolo->setText ( "SOLO" ); + pcbSolo->setText ( tr ( "SOLO" ) ); break; default: // reset style sheet and set original paramters pFader->setStyleSheet ( "" ); - pcbMute->setText ( "Mute" ); - pcbSolo->setText ( "Solo" ); + pcbMute->setText ( tr ( "Mute" ) ); + pcbSolo->setText ( tr ( "Solo" ) ); break; } } @@ -185,7 +168,8 @@ void CChannelFader::Reset() pcbMute->setChecked ( false ); pcbSolo->setChecked ( false ); - // clear label + // clear instrument picture and label text + pInstrument->setVisible ( false ); pLabel->setText ( "" ); bOtherChannelIsSolo = false; @@ -286,6 +270,29 @@ void CChannelFader::SetText ( const QString sText ) 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 ) { // convert actual slider range in gain values @@ -382,7 +389,7 @@ void CAudioMixerBoard::HideAll() emit NumClientsChanged ( 0 ); // -> no clients connected } -void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInfo ) +void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInfo ) { // get number of connected clients const int iNumConnectedClients = vecChanInfo.Size(); @@ -415,7 +422,20 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecCh } // 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; } @@ -460,7 +480,7 @@ void CAudioMixerBoard::OnChSoloStateChanged ( const int iChannelIdx, vecpChanFader[iChannelIdx]->SetOtherSoloState ( false ); } -QString CAudioMixerBoard::GenFaderText ( CChannelShortInfo& ChanInfo ) +QString CAudioMixerBoard::GenFaderText ( CChannelInfo& ChanInfo ) { // if text is empty, show IP address instead if ( ChanInfo.strName.isEmpty() ) diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index de2d9028..b10cfd29 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -95,7 +95,8 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, // fader tag QString strFaderTag = tr ( "Your Alias/Instrument: Set your name " "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 " "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 " @@ -109,8 +110,10 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, lblServerTag->setToolTip ( strFaderTagTT ); edtFaderTag->setWhatsThis ( strFaderTag ); edtFaderTag->setToolTip ( strFaderTagTT ); - edtFaderTag->setAccessibleName ( tr ( "Fader tag edit box" ) ); + butInstPicture->setWhatsThis ( strFaderTag ); + butInstPicture->setToolTip ( strFaderTagTT ); + butInstPicture->setAccessibleName ( tr ( "Instrument picture button" ) ); // local audio input fader QString strAudFader = tr ( "Local Audio Input Fader: With the " @@ -226,8 +229,10 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, // reset mixer board MainMixerBoard->HideAll(); - // init fader tag line edit - edtFaderTag->setText ( pClient->strName ); + // init fader tag line edit and instrument picture + edtFaderTag->setText ( pClient->ChannelInfo.strName ); + butInstPicture->setIcon ( QIcon ( + CInstPictures::GetResourceReference ( pClient->ChannelInfo.iInstrument ) ) ); // init status label OnTimerStatus(); @@ -321,11 +326,33 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, 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 ------------------------------------------------------------- // push buttons QObject::connect ( butConnect, SIGNAL ( clicked() ), this, SLOT ( OnConnectDisconBut() ) ); + QObject::connect ( butInstPicture, SIGNAL ( clicked() ), + this, SLOT ( OnInstPictureBut() ) ); + // check boxes QObject::connect ( chbSettings, SIGNAL ( stateChanged ( int ) ), this, SLOT ( OnSettingsStateChanged ( int ) ) ); @@ -361,10 +388,18 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QObject::connect ( edtFaderTag, SIGNAL ( textChanged ( const QString& ) ), this, SLOT ( OnFaderTagTextChanged ( const QString& ) ) ); + // menus + QObject::connect ( pInstrPictPopupMenu, SIGNAL ( triggered ( QAction* ) ), + this, SLOT ( OnInstPicturesMenuTriggered ( QAction* ) ) ); + // other QObject::connect ( pClient, - SIGNAL ( ConClientListMesReceived ( CVector ) ), - this, SLOT ( OnConClientListMesReceived ( CVector ) ) ); + SIGNAL ( ConClientListNameMesReceived ( CVector ) ), + this, SLOT ( OnConClientListMesReceived ( CVector ) ) ); + + QObject::connect ( pClient, + SIGNAL ( ConClientListMesReceived ( CVector ) ), + this, SLOT ( OnConClientListMesReceived ( CVector ) ) ); QObject::connect ( pClient, SIGNAL ( Disconnected() ), @@ -429,7 +464,7 @@ void CLlconClientDlg::closeEvent ( QCloseEvent* Event ) } // store fader tag - pClient->strName = edtFaderTag->text(); + pClient->ChannelInfo.strName = edtFaderTag->text(); // default implementation of this event handler routine Event->accept(); @@ -504,6 +539,30 @@ void CLlconClientDlg::OnConnectDisconBut() 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 ) { // init flag (will maybe overwritten later in this function) @@ -535,9 +594,9 @@ void CLlconClientDlg::OnDisconnected() UpdateDisplay(); } -void CLlconClientDlg::OnConClientListMesReceived ( CVector vecChanInfo ) +void CLlconClientDlg::OnConClientListMesReceived ( CVector vecChanInfo ) { - // update mixer board + // update mixer board with the additional client infos MainMixerBoard->ApplyNewConClientList ( vecChanInfo ); } @@ -625,10 +684,10 @@ void CLlconClientDlg::OnFaderTagTextChanged ( const QString& strNewName ) if ( strNewName.length() <= MAX_LEN_FADER_TAG ) { // refresh internal name parameter - pClient->strName = strNewName; + pClient->ChannelInfo.strName = strNewName; - // update name at server - pClient->SetRemoteName(); + // update channel info at the server + pClient->SetRemoteInfo(); } else { diff --git a/src/llconclientdlg.h b/src/llconclientdlg.h index 77ebb4cc..b3dca05d 100755 --- a/src/llconclientdlg.h +++ b/src/llconclientdlg.h @@ -100,6 +100,7 @@ protected: QMenu* pViewMenu; QMenuBar* pMenu; + QMenu* pInstrPictPopupMenu; CClientSettingsDlg ClientSettingsDlg; CChatDlg ChatDlg; @@ -109,6 +110,7 @@ public slots: void OnAboutToQuit() { pSettings->Save(); } void OnConnectDisconBut(); + void OnInstPictureBut(); void OnTimerSigMet(); void OnTimerStatus() { UpdateDisplay(); } @@ -122,6 +124,8 @@ public slots: void OnOpenGeneralSettings() { ShowGeneralSettings(); } void OnOpenChatDialog() { ShowChatWindow(); } + void OnInstPicturesMenuTriggered ( QAction* SelAction ); + void OnSettingsStateChanged ( int value ); void OnChatStateChanged ( int value ); @@ -136,7 +140,7 @@ public slots: void OnReverbSelRClicked() { pClient->SetReverbOnLeftChan ( false ); } - void OnConClientListMesReceived ( CVector vecChanInfo ); + void OnConClientListMesReceived ( CVector vecChanInfo ); void OnFaderTagTextChanged ( const QString& strNewName ); void OnChatTextReceived ( QString strChatText ); diff --git a/src/llconclientdlgbase.ui b/src/llconclientdlgbase.ui index 990582bd..00ade5f2 100755 --- a/src/llconclientdlgbase.ui +++ b/src/llconclientdlgbase.ui @@ -442,12 +442,6 @@ - - - 0 - 0 - - Your Alias/Instrument @@ -457,14 +451,37 @@ - - - - 0 - 0 - - - + + + + + + 0 + 0 + + + + + 40 + 0 + + + + + + + + + 0 + 0 + + + + :/png/instr/res/instrnone.png + + + + diff --git a/src/testbench.h b/src/testbench.h index 9bb6606f..b7b33b8b 100755 --- a/src/testbench.h +++ b/src/testbench.h @@ -94,11 +94,11 @@ protected: public slots: void OnTimer() { - CVector vecChanInfo ( 1 ); - CNetworkTransportProps NetTrProps; - CServerCoreInfo ServerInfo; - CVector vecServerInfo ( 1 ); - CHostAddress CurHostAddress ( QHostAddress ( sAddress ), iPort ); + CVector vecChanInfo ( 1 ); + CNetworkTransportProps NetTrProps; + CServerCoreInfo ServerInfo; + CVector vecServerInfo ( 1 ); + CHostAddress CurHostAddress ( QHostAddress ( sAddress ), iPort ); // generate random protocol message switch ( GenRandomIntInRange ( 0, 21 ) ) @@ -121,7 +121,7 @@ public slots: vecChanInfo[0].iIpAddr = GenRandomIntInRange ( 0, 100000 ); vecChanInfo[0].strName = GenRandomString(); - Protocol.CreateConClientListMes ( vecChanInfo ); + Protocol.CreateConClientListNameMes ( vecChanInfo ); break; case 4: @@ -133,7 +133,7 @@ public slots: break; case 6: - Protocol.CreateReqChanNameMes(); + Protocol.CreateReqChanInfoMes(); break; case 7: diff --git a/src/util.cpp b/src/util.cpp index db3c5908..41ff7681 100755 --- a/src/util.cpp +++ b/src/util.cpp @@ -419,6 +419,7 @@ CLlconHelpMenu::CLlconHelpMenu ( QWidget* parent ) : QMenu ( "&?", parent ) /******************************************************************************\ * Other Classes * \******************************************************************************/ +// Network utility functions --------------------------------------------------- bool LlconNetwUtil::ParseNetworkAddress ( QString strAddress, CHostAddress& HostAddress ) { @@ -467,6 +468,78 @@ bool LlconNetwUtil::ParseNetworkAddress ( QString strAddress, } +// Instrument picture data base ------------------------------------------------ +CVector& CInstPictures::GetTable() +{ + // make sure we generate the table only once + static bool TableIsInitialized = false; + + static CVector 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 * \******************************************************************************/ diff --git a/src/util.h b/src/util.h index f5af5755..710e43e0 100755 --- a/src/util.h +++ b/src/util.h @@ -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 --------------------------------------------------- class CStereoSignalLevelMeter { @@ -433,7 +473,7 @@ public: } // compare operator - bool operator== ( const CHostAddress& CompAddr ) // compare operator + bool operator== ( const CHostAddress& CompAddr ) { return ( ( CompAddr.InetAddr == InetAddr ) && ( CompAddr.iPort == iPort ) ); @@ -467,52 +507,99 @@ public: }; -// Short info of a channel ----------------------------------------------------- -class CChannelShortInfo +// Instrument picture data base ------------------------------------------------ +// this is a pure static class +class CInstPictures { public: - CChannelShortInfo() : - iChanID ( 0 ), - iIpAddr ( 0 ), - strName ( "" ) {} + enum EInstCategory + { + IC_OTHER_INSTRUMENT, + IC_WIND_INSTRUMENT, + IC_STRING_INSTRUMENT, + IC_PLUCKING_INSTRUMENT, + IC_PERCUSSION_INSTRUMENT, + IC_KEYBOARD_INSTRUMENT + }; - CChannelShortInfo ( const int iNID, - const quint32 nIP, - const QString nN ) : - iChanID ( iNID ), - iIpAddr ( nIP ), - strName ( nN ) {} + // per definition: the very first instrument is the "not used" instrument + static int GetNotUsedInstrument() { return 0; } + static bool IsNotUsedInstrument ( const int iInstrument ) { return iInstrument == 0; } - int iChanID; - quint32 iIpAddr; - QString strName; + static int GetNumAvailableInst() { return GetTable().Size(); } + static QString GetResourceReference ( const int iInstrument ); + 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& GetTable(); }; -// Additional info of a channel ------------------------------------------------ -class CChannelAdditionalInfo +// Info of a channel ----------------------------------------------------------- +class CChannelCoreInfo { public: - CChannelAdditionalInfo() : - iChanID ( 0 ), - eCountry ( QLocale::AnyCountry ), - strCity ( "" ), - iInstrument ( 0 ), - iSkillLevel ( 0 ) {} + CChannelCoreInfo() : + strName ( "" ), + eCountry ( QLocale::AnyCountry ), + strCity ( "" ), + iInstrument ( CInstPictures::GetNotUsedInstrument() ), + eSkillLevel ( SL_NOT_SET ) {} - CChannelAdditionalInfo ( const int iNID, - const QLocale::Country& NeCountry, - const QString& NsCity, - const int NiInstrument, - const int NiSkillLevel ) : - iChanID ( iNID ), + CChannelCoreInfo ( const QString NsName, + const QLocale::Country& NeCountry, + const QString& NsCity, + const int NiInstrument, + const ESkillLevel NeSkillLevel ) : + strName ( NsName ), eCountry ( NeCountry ), strCity ( NsCity ), iInstrument ( NiInstrument ), - iSkillLevel ( NiSkillLevel ) {} + eSkillLevel ( NeSkillLevel ) {} - // ID of the channel - int iChanID; + CChannelCoreInfo ( const CChannelCoreInfo& NCorInf ) : + 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 QLocale::Country eCountry; @@ -524,7 +611,65 @@ public: int iInstrument; // 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: CServerInfo() : - CServerCoreInfo ( 0, - "", - "", - QLocale::AnyCountry, - "", - 0, - false ), HostAddr ( CHostAddress() ) {} + HostAddr ( CHostAddress() ) {} CServerInfo ( const CHostAddress& NHAddr, @@ -609,38 +748,11 @@ public: NiMaxNumClients, NbPermOnline ), HostAddr ( NHAddr ) {} -public: // internet address of the server 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 ------------------------------------------------ class CNetworkTransportProps {