Added Support for instrument picture on fader tag
This commit is contained in:
parent
cc3547676b
commit
e037a90bcf
7 changed files with 414 additions and 129 deletions
|
@ -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<CChannelShortInfo>& vecChanInfo )
|
||||
void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInfo )
|
||||
{
|
||||
// get number of connected clients
|
||||
const int iNumConnectedClients = vecChanInfo.Size();
|
||||
|
@ -415,7 +422,20 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelShortInfo>& 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() )
|
||||
|
|
|
@ -95,7 +95,8 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
|
|||
// fader tag
|
||||
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 "
|
||||
"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 ( "<b>Local Audio Input Fader:</b> 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<CChannelShortInfo> ) ),
|
||||
this, SLOT ( OnConClientListMesReceived ( CVector<CChannelShortInfo> ) ) );
|
||||
SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ),
|
||||
this, SLOT ( OnConClientListMesReceived ( CVector<CChannelInfo> ) ) );
|
||||
|
||||
QObject::connect ( pClient,
|
||||
SIGNAL ( ConClientListMesReceived ( CVector<CChannelInfo> ) ),
|
||||
this, SLOT ( OnConClientListMesReceived ( CVector<CChannelInfo> ) ) );
|
||||
|
||||
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<CChannelShortInfo> vecChanInfo )
|
||||
void CLlconClientDlg::OnConClientListMesReceived ( CVector<CChannelInfo> 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
|
||||
{
|
||||
|
|
|
@ -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<CChannelShortInfo> vecChanInfo );
|
||||
void OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
|
||||
void OnFaderTagTextChanged ( const QString& strNewName );
|
||||
void OnChatTextReceived ( QString strChatText );
|
||||
|
||||
|
|
|
@ -442,12 +442,6 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblServerTag" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Your Alias/Instrument</string>
|
||||
</property>
|
||||
|
@ -456,16 +450,39 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLineEdit" name="edtFaderTag" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Ignored" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</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>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
|
|
|
@ -94,7 +94,7 @@ protected:
|
|||
public slots:
|
||||
void OnTimer()
|
||||
{
|
||||
CVector<CChannelShortInfo> vecChanInfo ( 1 );
|
||||
CVector<CChannelInfo> vecChanInfo ( 1 );
|
||||
CNetworkTransportProps NetTrProps;
|
||||
CServerCoreInfo ServerInfo;
|
||||
CVector<CServerInfo> vecServerInfo ( 1 );
|
||||
|
@ -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:
|
||||
|
|
73
src/util.cpp
73
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::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 *
|
||||
\******************************************************************************/
|
||||
|
|
238
src/util.h
238
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; }
|
||||
|
||||
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 ) {}
|
||||
|
||||
int iChanID;
|
||||
quint32 iIpAddr;
|
||||
QString strName;
|
||||
QString strResourceReference;
|
||||
EInstCategory eInstCategory;
|
||||
};
|
||||
|
||||
static bool IsInstIndexInRange ( const int iIdx );
|
||||
|
||||
static CVector<CInstPictProps>& GetTable();
|
||||
};
|
||||
|
||||
|
||||
// Additional info of a channel ------------------------------------------------
|
||||
class CChannelAdditionalInfo
|
||||
// Info of a channel -----------------------------------------------------------
|
||||
class CChannelCoreInfo
|
||||
{
|
||||
public:
|
||||
CChannelAdditionalInfo() :
|
||||
iChanID ( 0 ),
|
||||
CChannelCoreInfo() :
|
||||
strName ( "" ),
|
||||
eCountry ( QLocale::AnyCountry ),
|
||||
strCity ( "" ),
|
||||
iInstrument ( 0 ),
|
||||
iSkillLevel ( 0 ) {}
|
||||
iInstrument ( CInstPictures::GetNotUsedInstrument() ),
|
||||
eSkillLevel ( SL_NOT_SET ) {}
|
||||
|
||||
CChannelAdditionalInfo ( const int iNID,
|
||||
CChannelCoreInfo ( const QString NsName,
|
||||
const QLocale::Country& NeCountry,
|
||||
const QString& NsCity,
|
||||
const int NiInstrument,
|
||||
const int NiSkillLevel ) :
|
||||
iChanID ( iNID ),
|
||||
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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue