bug fix: instrument names in the profile dialog are no longer translated (worked in v3.5.8)

This commit is contained in:
Volker Fischer 2020-07-12 12:31:46 +02:00
parent 9c3f65da19
commit 57a7027e64
3 changed files with 6 additions and 4 deletions

View file

@ -606,6 +606,7 @@ int main ( int argc, char** argv )
if ( bUseGUI && bUseTranslation ) if ( bUseGUI && bUseTranslation )
{ {
CLocale::LoadTranslation ( Settings.strLanguage, pApp ); CLocale::LoadTranslation ( Settings.strLanguage, pApp );
CInstPictures::UpdateTableOnLanguageChange();
} }
#ifndef HEADLESS #ifndef HEADLESS

View file

@ -1058,18 +1058,19 @@ QString NetworkUtil::GetCentralServerAddress ( const ECSAddType eCentralServerAd
// Instrument picture data base ------------------------------------------------ // Instrument picture data base ------------------------------------------------
CVector<CInstPictures::CInstPictProps>& CInstPictures::GetTable() CVector<CInstPictures::CInstPictProps>& CInstPictures::GetTable ( const bool bReGenerateTable )
{ {
// make sure we generate the table only once // make sure we generate the table only once
static bool TableIsInitialized = false; static bool TableIsInitialized = false;
static CVector<CInstPictProps> vecDataBase; static CVector<CInstPictProps> vecDataBase;
if ( !TableIsInitialized ) if ( !TableIsInitialized || bReGenerateTable )
{ {
// instrument picture data base initialization // instrument picture data base initialization
// NOTE: Do not change the order of any instrument in the future! // NOTE: Do not change the order of any instrument in the future!
// NOTE: The very first entry is the "not used" element per definition. // NOTE: The very first entry is the "not used" element per definition.
vecDataBase.Init ( 0 ); // first clear all existing data since we create the list be adding entries
vecDataBase.Add ( CInstPictProps ( QCoreApplication::translate ( "CMusProfDlg", "None" ), ":/png/instr/res/instruments/none.png", IC_OTHER_INSTRUMENT ) ); // special first element vecDataBase.Add ( CInstPictProps ( QCoreApplication::translate ( "CMusProfDlg", "None" ), ":/png/instr/res/instruments/none.png", IC_OTHER_INSTRUMENT ) ); // special first element
vecDataBase.Add ( CInstPictProps ( QCoreApplication::translate ( "CMusProfDlg", "Drum Set" ), ":/png/instr/res/instruments/drumset.png", IC_PERCUSSION_INSTRUMENT ) ); vecDataBase.Add ( CInstPictProps ( QCoreApplication::translate ( "CMusProfDlg", "Drum Set" ), ":/png/instr/res/instruments/drumset.png", IC_PERCUSSION_INSTRUMENT ) );
vecDataBase.Add ( CInstPictProps ( QCoreApplication::translate ( "CMusProfDlg", "Djembe" ), ":/png/instr/res/instruments/djembe.png", IC_PERCUSSION_INSTRUMENT ) ); vecDataBase.Add ( CInstPictProps ( QCoreApplication::translate ( "CMusProfDlg", "Djembe" ), ":/png/instr/res/instruments/djembe.png", IC_PERCUSSION_INSTRUMENT ) );

View file

@ -859,6 +859,7 @@ public:
static QString GetResourceReference ( const int iInstrument ); static QString GetResourceReference ( const int iInstrument );
static QString GetName ( const int iInstrument ); static QString GetName ( const int iInstrument );
static EInstCategory GetCategory ( const int iInstrument ); static EInstCategory GetCategory ( const int iInstrument );
static void UpdateTableOnLanguageChange() { GetTable ( true ); }
// TODO make use of instrument category (not yet implemented) // TODO make use of instrument category (not yet implemented)
@ -884,8 +885,7 @@ protected:
}; };
static bool IsInstIndexInRange ( const int iIdx ); static bool IsInstIndexInRange ( const int iIdx );
static CVector<CInstPictProps>& GetTable ( const bool bReGenerateTable = false );
static CVector<CInstPictProps>& GetTable();
}; };