added a tool tip of the complete musician profile on the fader tag label

This commit is contained in:
Volker Fischer 2015-01-30 20:53:43 +00:00
parent 4cb037c492
commit a62ca5d064
2 changed files with 99 additions and 28 deletions

View file

@ -176,13 +176,20 @@ void CChannelFader::Reset()
pcbSolo->setChecked ( false ); pcbSolo->setChecked ( false );
// clear instrument picture, country flag, tool tips and label text // clear instrument picture, country flag, tool tips and label text
plblLabel->setText ( "" );
plblLabel->setToolTip ( "" );
plblInstrument->setVisible ( false ); plblInstrument->setVisible ( false );
plblInstrument->setToolTip ( "" ); plblInstrument->setToolTip ( "" );
plblCountryFlag->setVisible ( false ); plblCountryFlag->setVisible ( false );
plblCountryFlag->setToolTip ( "" ); plblCountryFlag->setToolTip ( "" );
plblLabel->setText ( "" );
strReceivedName = ""; strReceivedName = "";
// set a defined tool tip time out
const int iToolTipDurMs = 30000;
plblLabel->setToolTipDuration ( iToolTipDurMs );
plblInstrument->setToolTipDuration ( iToolTipDurMs );
plblCountryFlag->setToolTipDuration ( iToolTipDurMs );
bOtherChannelIsSolo = false; bOtherChannelIsSolo = false;
} }
@ -272,51 +279,54 @@ void CChannelFader::SetText ( const CChannelInfo& ChanInfo )
plblLabel->setText ( strModText ); plblLabel->setText ( strModText );
} }
void CChannelFader::SetInstrumentPicture ( const int iInstrument ) void CChannelFader::SetChannelInfos ( const CChannelInfo& cChanInfo )
{ {
// init properties for the tool tip
int iTTInstrument = CInstPictures::GetNotUsedInstrument();
QLocale::Country eTTCountry = QLocale::AnyCountry;
// Instrument picture ------------------------------------------------------
// get the resource reference string for this instrument // get the resource reference string for this instrument
const QString strCurResourceRef = const QString strCurResourceRef =
CInstPictures::GetResourceReference ( iInstrument ); CInstPictures::GetResourceReference ( cChanInfo.iInstrument );
// first check if instrument picture is used or not and if it is valid // first check if instrument picture is used or not and if it is valid
if ( CInstPictures::IsNotUsedInstrument ( iInstrument ) || if ( CInstPictures::IsNotUsedInstrument ( cChanInfo.iInstrument ) ||
strCurResourceRef.isEmpty() ) strCurResourceRef.isEmpty() )
{ {
// disable instrument picture and tool tip // disable instrument picture
plblInstrument->setVisible ( false ); plblInstrument->setVisible ( false );
plblInstrument->setToolTip ( "" );
} }
else else
{ {
// set correct picture and tool tip text // set correct picture
plblInstrument->setPixmap ( QPixmap ( strCurResourceRef ) ); plblInstrument->setPixmap ( QPixmap ( strCurResourceRef ) );
plblInstrument->setToolTip ( CInstPictures::GetName ( iInstrument ) ); iTTInstrument = cChanInfo.iInstrument;
// enable instrument picture // enable instrument picture
plblInstrument->setVisible ( true ); plblInstrument->setVisible ( true );
} }
}
void CChannelFader::SetCountryFlag ( const QLocale::Country eCountry )
{ // Country flag icon -------------------------------------------------------
if ( eCountry != QLocale::AnyCountry ) if ( cChanInfo.eCountry != QLocale::AnyCountry )
{ {
// try to load the country flag icon // try to load the country flag icon
QPixmap CountryFlagPixmap ( QPixmap CountryFlagPixmap (
CCountyFlagIcons::GetResourceReference ( eCountry ) ); CCountyFlagIcons::GetResourceReference ( cChanInfo.eCountry ) );
// first check if resource reference was valid // first check if resource reference was valid
if ( CountryFlagPixmap.isNull() ) if ( CountryFlagPixmap.isNull() )
{ {
// disable country flag and tool tip // disable country flag
plblCountryFlag->setVisible ( false ); plblCountryFlag->setVisible ( false );
plblCountryFlag->setToolTip ( "" );
} }
else else
{ {
// set correct picture and tool tip text // set correct picture
plblCountryFlag->setPixmap ( CountryFlagPixmap ); plblCountryFlag->setPixmap ( CountryFlagPixmap );
plblCountryFlag->setToolTip ( QLocale::countryToString ( eCountry ) ); eTTCountry = cChanInfo.eCountry;
// enable country flag // enable country flag
plblCountryFlag->setVisible ( true ); plblCountryFlag->setVisible ( true );
@ -324,10 +334,78 @@ void CChannelFader::SetCountryFlag ( const QLocale::Country eCountry )
} }
else else
{ {
// disable country flag and tool tip // disable country flag
plblCountryFlag->setVisible ( false ); plblCountryFlag->setVisible ( false );
plblCountryFlag->setToolTip ( "" );
} }
// Tool tip ----------------------------------------------------------------
// complete musician profile in the tool tip
QString strToolTip = "";
// alias/name
if ( !strReceivedName.isEmpty() )
{
strToolTip += "<h4>Alias/Name</h4>" + strReceivedName;
}
// instrument
if ( !CInstPictures::IsNotUsedInstrument ( iTTInstrument ) )
{
strToolTip += "<h4>Instrument</h4>" +
CInstPictures::GetName ( iTTInstrument );
}
// location
if ( ( eTTCountry != QLocale::AnyCountry ) ||
( !cChanInfo.strCity.isEmpty() ) )
{
strToolTip += "<h4>Location</h4>";
if ( !cChanInfo.strCity.isEmpty() )
{
strToolTip += cChanInfo.strCity;
if ( eTTCountry != QLocale::AnyCountry )
{
strToolTip += ", ";
}
}
if ( eTTCountry != QLocale::AnyCountry )
{
strToolTip += QLocale::countryToString ( eTTCountry );
}
}
// skill level
if ( cChanInfo.eSkillLevel != SL_NOT_SET )
{
switch ( cChanInfo.eSkillLevel )
{
case SL_BEGINNER:
strToolTip += "<h4>Skill Level</h4>Beginner";
break;
case SL_INTERMEDIATE:
strToolTip += "<h4>Skill Level</h4>Intermediate";
break;
case SL_PROFESSIONAL:
strToolTip += "<h4>Skill Level</h4>Expert";
break;
}
}
// if no information is given, leave the tool tip empty, otherwise add header
if ( !strToolTip.isEmpty() )
{
strToolTip.prepend ( "<h3>Musician Profile</h3>" );
}
plblCountryFlag->setToolTip ( strToolTip );
plblInstrument->setToolTip ( strToolTip );
plblLabel->setToolTip ( strToolTip );
} }
double CChannelFader::CalcFaderGain ( const int value ) double CChannelFader::CalcFaderGain ( const int value )
@ -521,13 +599,7 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -> the "if-condition" can be removed later on... // #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### -> the "if-condition" can be removed later on...
if ( !vecChanInfo[j].bOnlyNameIsUsed ) if ( !vecChanInfo[j].bOnlyNameIsUsed )
{ {
// update instrument picture vecpChanFader[i]->SetChannelInfos ( vecChanInfo[j] );
vecpChanFader[i]->
SetInstrumentPicture ( vecChanInfo[j].iInstrument );
// update country flag
vecpChanFader[i]->
SetCountryFlag ( vecChanInfo[j].eCountry );
} }
bFaderIsUsed = true; bFaderIsUsed = true;

View file

@ -48,8 +48,7 @@ public:
void SetText ( const CChannelInfo& ChanInfo ); void SetText ( const CChannelInfo& ChanInfo );
QString GetReceivedName() { return strReceivedName; } QString GetReceivedName() { return strReceivedName; }
void SetInstrumentPicture ( const int iInstrument ); void SetChannelInfos ( const CChannelInfo& cChanInfo );
void SetCountryFlag ( const QLocale::Country eCountry );
void Show() { pFrame->show(); } void Show() { pFrame->show(); }
void Hide() { pFrame->hide(); } void Hide() { pFrame->hide(); }
bool IsVisible() { return plblLabel->isVisible(); } bool IsVisible() { return plblLabel->isVisible(); }