support for a country flag icon on the fader tag
This commit is contained in:
parent
1d21bb84b1
commit
5c909dc176
8 changed files with 169 additions and 10 deletions
|
@ -1,7 +1,8 @@
|
||||||
3.3.6
|
3.3.6
|
||||||
|
|
||||||
- a licence agreement dialog can be requested by the server
|
- support for a country flag icon on the fader tag
|
||||||
|
|
||||||
|
- a licence agreement dialog can be requested by the server
|
||||||
|
|
||||||
|
|
||||||
3.3.5 (2014-07-30)
|
3.3.5 (2014-07-30)
|
||||||
|
@ -11,6 +12,7 @@
|
||||||
|
|
||||||
- added a Linux jamulus.desktop file
|
- added a Linux jamulus.desktop file
|
||||||
|
|
||||||
|
|
||||||
3.3.4 (2014-02-25)
|
3.3.4 (2014-02-25)
|
||||||
|
|
||||||
- true stereo reverberation effect (previously it was a mono reverberation
|
- true stereo reverberation effect (previously it was a mono reverberation
|
||||||
|
@ -28,6 +30,7 @@
|
||||||
|
|
||||||
- bug fix: the fader level could not be changed if the fader was on solo
|
- bug fix: the fader level could not be changed if the fader was on solo
|
||||||
|
|
||||||
|
|
||||||
3.3.3 (2013-12-30)
|
3.3.3 (2013-12-30)
|
||||||
|
|
||||||
- support for storing/recovering the window positions
|
- support for storing/recovering the window positions
|
||||||
|
|
|
@ -298,12 +298,9 @@ void CChannelFader::SetCountryFlag ( const QLocale::Country eCountry )
|
||||||
{
|
{
|
||||||
if ( eCountry != QLocale::AnyCountry )
|
if ( eCountry != QLocale::AnyCountry )
|
||||||
{
|
{
|
||||||
// get the resource reference string for this country flag
|
|
||||||
const QString strCurResourceRef = ":/png/flags/res/flags/" +
|
|
||||||
QLocale ( QLocale::AnyLanguage, eCountry ).bcp47Name() + ".png";
|
|
||||||
|
|
||||||
// try to load the country flag icon
|
// try to load the country flag icon
|
||||||
QPixmap CountryFlagPixmap ( strCurResourceRef );
|
QPixmap CountryFlagPixmap (
|
||||||
|
CCountyFlagIcons::GetResourceReference ( eCountry ) );
|
||||||
|
|
||||||
// first check if resource reference was valid
|
// first check if resource reference was valid
|
||||||
if ( CountryFlagPixmap.isNull() )
|
if ( CountryFlagPixmap.isNull() )
|
||||||
|
@ -322,6 +319,12 @@ void CChannelFader::SetCountryFlag ( const QLocale::Country eCountry )
|
||||||
plblCountryFlag->setVisible ( true );
|
plblCountryFlag->setVisible ( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// disable country flag and tool tip
|
||||||
|
plblCountryFlag->setVisible ( false );
|
||||||
|
plblCountryFlag->setToolTip ( "" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double CChannelFader::CalcFaderGain ( const int value )
|
double CChannelFader::CalcFaderGain ( const int value )
|
||||||
|
|
|
@ -96,17 +96,17 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||||
"and disconnecting the " ) + APP_NAME + tr ( " software." ) );
|
"and disconnecting the " ) + APP_NAME + tr ( " software." ) );
|
||||||
|
|
||||||
// fader tag
|
// fader tag
|
||||||
QString strFaderTag = tr ( "<b>Your Alias/Instrument:</b> Set your name "
|
QString strFaderTag = tr ( "<b>Your Alias/Instrument/Country:</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 set an instrument picture of "
|
"know who you are. Additionally you may set an instrument picture of "
|
||||||
"the instrument you play. "
|
"the instrument you play and a flag of the country you are living. "
|
||||||
"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 "
|
||||||
"you. If the fader tag is empty, the IP address is shown instead." );
|
"you. If the fader tag is empty, the IP address is shown instead." );
|
||||||
|
|
||||||
QString strFaderTagTT = tr ( "Set your name and/or instrument and/or "
|
QString strFaderTagTT = tr ( "Set your name and/or instrument and/or "
|
||||||
"pseoudonym here so that the other musicians can identify you." ) +
|
"country here so that the other musicians can identify you." ) +
|
||||||
TOOLTIP_COM_END_TEXT;
|
TOOLTIP_COM_END_TEXT;
|
||||||
|
|
||||||
lblServerTag->setWhatsThis ( strFaderTag );
|
lblServerTag->setWhatsThis ( strFaderTag );
|
||||||
|
@ -117,6 +117,9 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||||
butInstPicture->setWhatsThis ( strFaderTag );
|
butInstPicture->setWhatsThis ( strFaderTag );
|
||||||
butInstPicture->setToolTip ( strFaderTagTT );
|
butInstPicture->setToolTip ( strFaderTagTT );
|
||||||
butInstPicture->setAccessibleName ( tr ( "Instrument picture button" ) );
|
butInstPicture->setAccessibleName ( tr ( "Instrument picture button" ) );
|
||||||
|
butCountryFlag->setWhatsThis ( strFaderTag );
|
||||||
|
butCountryFlag->setToolTip ( strFaderTagTT );
|
||||||
|
butCountryFlag->setAccessibleName ( tr ( "Country flag 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 "
|
||||||
|
@ -212,11 +215,15 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||||
MainMixerBoard->vecStoredFaderLevels = pClient->vecStoredFaderLevels;
|
MainMixerBoard->vecStoredFaderLevels = pClient->vecStoredFaderLevels;
|
||||||
MainMixerBoard->vecStoredFaderIsSolo = pClient->vecStoredFaderIsSolo;
|
MainMixerBoard->vecStoredFaderIsSolo = pClient->vecStoredFaderIsSolo;
|
||||||
|
|
||||||
// init fader tag line edit and instrument picture
|
// init fader tag line edit, instrument picture and country flag
|
||||||
edtFaderTag->setText ( pClient->ChannelInfo.strName );
|
edtFaderTag->setText ( pClient->ChannelInfo.strName );
|
||||||
|
|
||||||
butInstPicture->setIcon ( QIcon (
|
butInstPicture->setIcon ( QIcon (
|
||||||
CInstPictures::GetResourceReference ( pClient->ChannelInfo.iInstrument ) ) );
|
CInstPictures::GetResourceReference ( pClient->ChannelInfo.iInstrument ) ) );
|
||||||
|
|
||||||
|
butCountryFlag->setIcon ( QIcon (
|
||||||
|
CCountyFlagIcons::GetResourceReference ( pClient->ChannelInfo.eCountry ) ) );
|
||||||
|
|
||||||
// init status label
|
// init status label
|
||||||
OnTimerStatus();
|
OnTimerStatus();
|
||||||
|
|
||||||
|
@ -333,6 +340,51 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Country flag icons popup menu -------------------------------------------
|
||||||
|
pCountryFlagPopupMenu = new QMenu ( this );
|
||||||
|
|
||||||
|
// add an entry for all known country flags
|
||||||
|
for ( int iCurCntry = static_cast<int> ( QLocale::AnyCountry );
|
||||||
|
iCurCntry < static_cast<int> ( QLocale::LastCountry ); iCurCntry++ )
|
||||||
|
{
|
||||||
|
// the "Default" country gets a special icon
|
||||||
|
QIcon CurFlagIcon;
|
||||||
|
QString sCurCountryName;
|
||||||
|
|
||||||
|
if ( static_cast<QLocale::Country> ( iCurCntry ) == QLocale::AnyCountry )
|
||||||
|
{
|
||||||
|
// default icon and name for no flag selected
|
||||||
|
CurFlagIcon.addFile ( ":/png/flags/res/flags/flagnone.png" );
|
||||||
|
sCurCountryName = "None";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// get current country enum
|
||||||
|
QLocale::Country eCountry =
|
||||||
|
static_cast<QLocale::Country> ( iCurCntry );
|
||||||
|
|
||||||
|
// get resource file name
|
||||||
|
CurFlagIcon.addFile ( CCountyFlagIcons::GetResourceReference ( eCountry ) );
|
||||||
|
|
||||||
|
// get the country name
|
||||||
|
sCurCountryName = QLocale::countryToString ( eCountry );
|
||||||
|
}
|
||||||
|
|
||||||
|
// only add the entry if a flag is available
|
||||||
|
if ( !CurFlagIcon.isNull() )
|
||||||
|
{
|
||||||
|
// create a menu action with text and image
|
||||||
|
QAction* pCurAction =
|
||||||
|
new QAction ( CurFlagIcon, sCurCountryName, this );
|
||||||
|
|
||||||
|
// add data to identify the action data when it is triggered
|
||||||
|
pCurAction->setData ( iCurCntry );
|
||||||
|
|
||||||
|
pCountryFlagPopupMenu->addAction ( pCurAction );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Window positions --------------------------------------------------------
|
// Window positions --------------------------------------------------------
|
||||||
// main window
|
// main window
|
||||||
if ( !pClient->vecWindowPosMain.isEmpty() && !pClient->vecWindowPosMain.isNull() )
|
if ( !pClient->vecWindowPosMain.isEmpty() && !pClient->vecWindowPosMain.isNull() )
|
||||||
|
@ -382,6 +434,9 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||||
QObject::connect ( butInstPicture, SIGNAL ( clicked() ),
|
QObject::connect ( butInstPicture, SIGNAL ( clicked() ),
|
||||||
this, SLOT ( OnInstPictureBut() ) );
|
this, SLOT ( OnInstPictureBut() ) );
|
||||||
|
|
||||||
|
QObject::connect ( butCountryFlag, SIGNAL ( clicked() ),
|
||||||
|
this, SLOT ( OnCountryFlagBut() ) );
|
||||||
|
|
||||||
// check boxes
|
// check boxes
|
||||||
QObject::connect ( chbSettings, SIGNAL ( stateChanged ( int ) ),
|
QObject::connect ( chbSettings, SIGNAL ( stateChanged ( int ) ),
|
||||||
this, SLOT ( OnSettingsStateChanged ( int ) ) );
|
this, SLOT ( OnSettingsStateChanged ( int ) ) );
|
||||||
|
@ -424,6 +479,9 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||||
QObject::connect ( pInstrPictPopupMenu, SIGNAL ( triggered ( QAction* ) ),
|
QObject::connect ( pInstrPictPopupMenu, SIGNAL ( triggered ( QAction* ) ),
|
||||||
this, SLOT ( OnInstPicturesMenuTriggered ( QAction* ) ) );
|
this, SLOT ( OnInstPicturesMenuTriggered ( QAction* ) ) );
|
||||||
|
|
||||||
|
QObject::connect ( pCountryFlagPopupMenu, SIGNAL ( triggered ( QAction* ) ),
|
||||||
|
this, SLOT ( OnCountryFlagMenuTriggered ( QAction* ) ) );
|
||||||
|
|
||||||
// other
|
// other
|
||||||
QObject::connect ( pClient,
|
QObject::connect ( pClient,
|
||||||
SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ),
|
SIGNAL ( ConClientListNameMesReceived ( CVector<CChannelInfo> ) ),
|
||||||
|
@ -685,6 +743,14 @@ void CClientDlg::OnInstPictureBut()
|
||||||
pInstrPictPopupMenu->exec ( this->mapToGlobal ( butInstPicture->pos() ) );
|
pInstrPictPopupMenu->exec ( this->mapToGlobal ( butInstPicture->pos() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CClientDlg::OnCountryFlagBut()
|
||||||
|
{
|
||||||
|
// open a menu which shows all available country flags which
|
||||||
|
// always appears at the same position relative to the country
|
||||||
|
// flags button
|
||||||
|
pCountryFlagPopupMenu->exec ( this->mapToGlobal ( butCountryFlag->pos() ) );
|
||||||
|
}
|
||||||
|
|
||||||
void CClientDlg::OnInstPicturesMenuTriggered ( QAction* SelAction )
|
void CClientDlg::OnInstPicturesMenuTriggered ( QAction* SelAction )
|
||||||
{
|
{
|
||||||
// get selected instrument
|
// get selected instrument
|
||||||
|
@ -701,6 +767,23 @@ void CClientDlg::OnInstPicturesMenuTriggered ( QAction* SelAction )
|
||||||
CInstPictures::GetResourceReference ( iSelInstrument ) ) );
|
CInstPictures::GetResourceReference ( iSelInstrument ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CClientDlg::OnCountryFlagMenuTriggered ( QAction* SelAction )
|
||||||
|
{
|
||||||
|
// get selected country
|
||||||
|
const QLocale::Country eSelCountry =
|
||||||
|
static_cast<QLocale::Country> ( SelAction->data().toInt() );
|
||||||
|
|
||||||
|
// set the new value in the data base
|
||||||
|
pClient->ChannelInfo.eCountry = eSelCountry;
|
||||||
|
|
||||||
|
// update channel info at the server
|
||||||
|
pClient->SetRemoteInfo();
|
||||||
|
|
||||||
|
// update icon on the instrument selection button
|
||||||
|
butCountryFlag->setIcon ( QIcon (
|
||||||
|
CCountyFlagIcons::GetResourceReference ( eSelCountry ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
void CClientDlg::OnChatTextReceived ( QString strChatText )
|
void CClientDlg::OnChatTextReceived ( QString strChatText )
|
||||||
{
|
{
|
||||||
ChatDlg.AddChatText ( strChatText );
|
ChatDlg.AddChatText ( strChatText );
|
||||||
|
|
|
@ -105,6 +105,7 @@ protected:
|
||||||
QMenu* pViewMenu;
|
QMenu* pViewMenu;
|
||||||
QMenuBar* pMenu;
|
QMenuBar* pMenu;
|
||||||
QMenu* pInstrPictPopupMenu;
|
QMenu* pInstrPictPopupMenu;
|
||||||
|
QMenu* pCountryFlagPopupMenu;
|
||||||
|
|
||||||
CClientSettingsDlg ClientSettingsDlg;
|
CClientSettingsDlg ClientSettingsDlg;
|
||||||
CChatDlg ChatDlg;
|
CChatDlg ChatDlg;
|
||||||
|
@ -116,6 +117,7 @@ public slots:
|
||||||
|
|
||||||
void OnConnectDisconBut();
|
void OnConnectDisconBut();
|
||||||
void OnInstPictureBut();
|
void OnInstPictureBut();
|
||||||
|
void OnCountryFlagBut();
|
||||||
void OnTimerSigMet();
|
void OnTimerSigMet();
|
||||||
void OnTimerBuffersLED();
|
void OnTimerBuffersLED();
|
||||||
|
|
||||||
|
@ -140,6 +142,7 @@ public slots:
|
||||||
void OnOpenAnalyzerConsole() { ShowAnalyzerConsole(); }
|
void OnOpenAnalyzerConsole() { ShowAnalyzerConsole(); }
|
||||||
|
|
||||||
void OnInstPicturesMenuTriggered ( QAction* SelAction );
|
void OnInstPicturesMenuTriggered ( QAction* SelAction );
|
||||||
|
void OnCountryFlagMenuTriggered ( QAction* SelAction );
|
||||||
|
|
||||||
void OnSettingsStateChanged ( int value );
|
void OnSettingsStateChanged ( int value );
|
||||||
void OnChatStateChanged ( int value );
|
void OnChatStateChanged ( int value );
|
||||||
|
|
BIN
src/res/flags/flagnone.png
Normal file
BIN
src/res/flags/flagnone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 418 B |
|
@ -107,6 +107,18 @@ void CSettings::Load()
|
||||||
pClient->ChannelInfo.iInstrument = iValue;
|
pClient->ChannelInfo.iInstrument = iValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// country
|
||||||
|
if ( GetNumericIniSet ( IniXMLDocument, "client", "country",
|
||||||
|
0, static_cast<int> ( QLocale::LastCountry ), iValue ) )
|
||||||
|
{
|
||||||
|
pClient->ChannelInfo.eCountry = static_cast<QLocale::Country> ( iValue );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// if no country is given, use the one from the operating system
|
||||||
|
pClient->ChannelInfo.eCountry = QLocale::system().country();
|
||||||
|
}
|
||||||
|
|
||||||
// audio fader
|
// audio fader
|
||||||
if ( GetNumericIniSet ( IniXMLDocument, "client", "audfad",
|
if ( GetNumericIniSet ( IniXMLDocument, "client", "audfad",
|
||||||
AUD_FADER_IN_MIN, AUD_FADER_IN_MAX, iValue ) )
|
AUD_FADER_IN_MIN, AUD_FADER_IN_MAX, iValue ) )
|
||||||
|
@ -371,6 +383,10 @@ void CSettings::Save()
|
||||||
SetNumericIniSet ( IniXMLDocument, "client", "instrument",
|
SetNumericIniSet ( IniXMLDocument, "client", "instrument",
|
||||||
pClient->ChannelInfo.iInstrument );
|
pClient->ChannelInfo.iInstrument );
|
||||||
|
|
||||||
|
// country
|
||||||
|
SetNumericIniSet ( IniXMLDocument, "client", "country",
|
||||||
|
static_cast<int> ( pClient->ChannelInfo.eCountry ) );
|
||||||
|
|
||||||
// audio fader
|
// audio fader
|
||||||
SetNumericIniSet ( IniXMLDocument, "client", "audfad",
|
SetNumericIniSet ( IniXMLDocument, "client", "audfad",
|
||||||
pClient->GetAudioInFader() );
|
pClient->GetAudioInFader() );
|
||||||
|
|
42
src/util.cpp
42
src/util.cpp
|
@ -670,6 +670,48 @@ QString CInstPictures::GetName ( const int iInstrument )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Country flag icon data base -------------------------------------------------
|
||||||
|
QString CCountyFlagIcons::GetResourceReference ( const QLocale::Country eCountry )
|
||||||
|
{
|
||||||
|
QString strReturn = "";
|
||||||
|
|
||||||
|
// special flag for none
|
||||||
|
if ( eCountry == QLocale::AnyCountry )
|
||||||
|
{
|
||||||
|
strReturn = ":/png/flags/res/flags/flagnone.png";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// There is no direct query of the country code in Qt, therefore we use a
|
||||||
|
// workaround: Get the matching locales properties and split the name of
|
||||||
|
// that since the second part is the country code
|
||||||
|
QList<QLocale> vCurLocaleList = QLocale::matchingLocales ( QLocale::AnyLanguage,
|
||||||
|
QLocale::AnyScript,
|
||||||
|
eCountry );
|
||||||
|
|
||||||
|
// check if the matching locales query was successful
|
||||||
|
if ( vCurLocaleList.size() > 0 )
|
||||||
|
{
|
||||||
|
QStringList vstrLocParts = vCurLocaleList.at ( 0 ).name().split("_");
|
||||||
|
|
||||||
|
// the second split contains the name we need
|
||||||
|
if ( vstrLocParts.size() > 1 )
|
||||||
|
{
|
||||||
|
strReturn =
|
||||||
|
":/png/flags/res/flags/" + vstrLocParts.at ( 1 ).toLower() + ".png";
|
||||||
|
|
||||||
|
// check if file actually exists, if not then invalidate reference
|
||||||
|
if ( !QFile::exists ( strReturn ) )
|
||||||
|
{
|
||||||
|
strReturn = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return strReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************\
|
/******************************************************************************\
|
||||||
* Global Functions Implementation *
|
* Global Functions Implementation *
|
||||||
|
|
|
@ -662,6 +662,15 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Country flag icon data base -------------------------------------------------
|
||||||
|
// this is a pure static class
|
||||||
|
class CCountyFlagIcons
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static QString GetResourceReference ( const QLocale::Country eCountry );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Info of a channel -----------------------------------------------------------
|
// Info of a channel -----------------------------------------------------------
|
||||||
class CChannelCoreInfo
|
class CChannelCoreInfo
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue