Changeset 91391 in vbox for trunk/src/VBox
- Timestamp:
- Sep 27, 2021 11:50:27 AM (3 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/VirtualBoxTranslator.h
r91390 r91391 43 43 HRESULT loadLanguage(ComPtr<IVirtualBox> aVirtualBox); 44 44 45 private: 46 /** Translator component. */ 47 struct TranslatorComponent 48 { 49 QMTranslator *pTranslator; 50 /** Path to translation files. It includes file prefix, i.e '/path/to/folder/file_prefix'. */ 51 com::Utf8Str strPath; 52 53 TranslatorComponent() : pTranslator(NULL) {} 54 }; 55 public: 45 56 /** Pointer to a translator component. */ 46 typedef structTranslatorComponent *PTRCOMPONENT;57 typedef TranslatorComponent *PTRCOMPONENT; 47 58 48 59 /** … … 102 113 uint32_t m_cInstanceRefs; 103 114 104 /** Translator component. */105 struct TranslatorComponent106 {107 QMTranslator *pTranslator;108 /** Path to translation files. It includes file prefix, i.e '/path/to/folder/file_prefix'. */109 com::Utf8Str strPath;110 111 TranslatorComponent() : pTranslator(NULL) {}112 };113 115 typedef std::list<TranslatorComponent> TranslatorList; 114 116 TranslatorList m_lTranslators; -
trunk/src/VBox/Main/src-all/VirtualBoxTranslator.cpp
r91390 r91391 408 408 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 409 409 410 TranslatorComponent *pComponent = (TranslatorComponent *)aComponent; 411 412 if (pComponent == m_pDefaultComponent) 410 if (aComponent == m_pDefaultComponent) 413 411 m_pDefaultComponent = NULL; 414 412 … … 417 415 ++it) 418 416 { 419 if (&(*it) == pComponent)420 { 421 delete pComponent->pTranslator;417 if (&(*it) == aComponent) 418 { 419 delete aComponent->pTranslator; 422 420 m_lTranslators.erase(it); 423 421 return VINF_SUCCESS; … … 481 479 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 482 480 483 TranslatorComponent *pComponent = (TranslatorComponent *)aComponent; 484 if (pComponent == NULL) 485 pComponent = m_pDefaultComponent; 486 487 if ( pComponent == NULL 488 || pComponent->pTranslator == NULL) 481 if (aComponent == NULL) 482 aComponent = m_pDefaultComponent; 483 484 if ( aComponent == NULL 485 || aComponent->pTranslator == NULL) 489 486 return aSourceText; 490 487 491 const char *pszTranslation = pComponent->pTranslator->translate(aContext, aSourceText, aComment, aNum);488 const char *pszTranslation = aComponent->pTranslator->translate(aContext, aSourceText, aComment, aNum); 492 489 493 490 LastTranslation *pEntry = getTlsEntry(); … … 495 492 { 496 493 pEntry->first = pszTranslation; 497 pEntry->second = m_hStrCache != NIL_RTSTRCACHE ?498 RTStrCacheEnter(m_hStrCache, aSourceText) :499 494 /** @todo r=bird: This is not technically threadsafe. Move this down to the 495 * above translator call. */ 496 pEntry->second = m_hStrCache != NIL_RTSTRCACHE ? RTStrCacheEnter(m_hStrCache, aSourceText) : aSourceText; 500 497 } 501 498
Note:
See TracChangeset
for help on using the changeset viewer.