Changeset 91390 in vbox
- Timestamp:
- Sep 27, 2021 11:45:15 AM (3 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
-
include/VirtualBoxClientImpl.h (modified) (1 diff)
-
include/VirtualBoxTranslator.h (modified) (7 diffs)
-
src-all/ExtPackManagerImpl.cpp (modified) (1 diff)
-
src-all/VirtualBoxTranslator.cpp (modified) (7 diffs)
-
src-server/VirtualBoxImpl.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/VirtualBoxClientImpl.h
r91373 r91390 106 106 #ifdef VBOX_WITH_MAIN_NLS 107 107 VirtualBoxTranslator *m_pVBoxTranslator; 108 TRCOMPONENTm_pTrComponent;108 PTRCOMPONENT m_pTrComponent; 109 109 #endif 110 110 }; -
trunk/src/VBox/Main/include/VirtualBoxTranslator.h
r91373 r91390 27 27 #include <VBox/com/AutoLock.h> 28 28 29 typedef void *TRCOMPONENT;30 31 29 class QMTranslator; 32 30 … … 35 33 { 36 34 public: 37 38 35 virtual ~VirtualBoxTranslator(); 39 36 … … 46 43 HRESULT loadLanguage(ComPtr<IVirtualBox> aVirtualBox); 47 44 45 /** Pointer to a translator component. */ 46 typedef struct TranslatorComponent *PTRCOMPONENT; 47 48 48 /** 49 * Adds path containing translation files into list of known paths. 50 * Path should include translation file prefix. 49 * Registers the translation for a component. 51 50 * 52 51 * @returns VBox status code 53 * @param aTranslationPath Path to translation files including file prefix 54 * @param aDefault Use as default translation component, i.e. 55 * Use this path for translation if component 56 * is NULL 57 * @param aComponent Where is the pointer to component returned 52 * @param aTranslationPath Path to the translation files, this includes the 53 * base filename prefix. 54 * @param aDefault Use this as the default translation component, i.e. 55 * when translate() is called with NULL for @a 56 * aComponent. 57 * @param aComponent Pointer to where is the component handle should be 58 * returned on success. The return value must be used 59 * for all subsequent calls to translate(). 58 60 */ 59 61 static int registerTranslation(const char *aTranslationPath, 60 62 bool aDefault, 61 TRCOMPONENT *aComponent);63 PTRCOMPONENT *aComponent); 62 64 63 65 /** 64 * Removes the path from list of known paths. 65 * Does not remove already loaded translation from string cache. 66 * Removes translations for a component. 67 * 68 * @returns VBox status code 69 * @param aComponent The component. NULL is quietly (VWRN_NOT_FOUND) 70 * ignored . 66 71 */ 67 static int unregisterTranslation( TRCOMPONENT aComponent);72 static int unregisterTranslation(PTRCOMPONENT aComponent); 68 73 69 74 /** … … 74 79 * valid only during lifetime of the translator instance. 75 80 */ 76 static const char *translate( TRCOMPONENT aComponent,81 static const char *translate(PTRCOMPONENT aComponent, 77 82 const char *aContext, 78 83 const char *aSourceText, … … 97 102 uint32_t m_cInstanceRefs; 98 103 104 /** Translator component. */ 99 105 struct TranslatorComponent 100 106 { 101 107 QMTranslator *pTranslator; 102 /* Path to translation files. It includes file prefix, i.e 103 * /path/to/folder/file_prefix */ 108 /** Path to translation files. It includes file prefix, i.e '/path/to/folder/file_prefix'. */ 104 109 com::Utf8Str strPath; 105 110 … … 128 133 int i_registerTranslation(const char *aTranslationPath, 129 134 bool aDefault, 130 TRCOMPONENT *aComponent);135 PTRCOMPONENT *aComponent); 131 136 132 int i_unregisterTranslation( TRCOMPONENT aComponent);137 int i_unregisterTranslation(PTRCOMPONENT aComponent); 133 138 134 const char *i_translate( TRCOMPONENT aComponent,139 const char *i_translate(PTRCOMPONENT aComponent, 135 140 const char *aContext, 136 141 const char *aSourceText, … … 139 144 }; 140 145 146 /** Pointer to a translator component. */ 147 typedef VirtualBoxTranslator::PTRCOMPONENT PTRCOMPONENT; 148 141 149 #endif /* !MAIN_INCLUDED_VirtualBoxTranslator_h */ 142 150 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
r91388 r91390 150 150 #endif 151 151 #ifdef VBOX_WITH_MAIN_NLS 152 TRCOMPONENTpTrComponent;152 PTRCOMPONENT pTrComponent; 153 153 #endif 154 154 -
trunk/src/VBox/Main/src-all/VirtualBoxTranslator.cpp
r91373 r91390 330 330 int VirtualBoxTranslator::registerTranslation(const char *aTranslationPath, 331 331 bool aDefault, 332 TRCOMPONENT *aComponent)332 PTRCOMPONENT *aComponent) 333 333 { 334 334 VirtualBoxTranslator *pCurrInstance = VirtualBoxTranslator::tryInstance(); … … 345 345 int VirtualBoxTranslator::i_registerTranslation(const char *aTranslationPath, 346 346 bool aDefault, 347 TRCOMPONENT *aComponent)347 PTRCOMPONENT *aComponent) 348 348 { 349 349 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 358 358 if (aDefault) 359 359 m_pDefaultComponent = pComponent; 360 *aComponent = ( TRCOMPONENT)pComponent;360 *aComponent = (PTRCOMPONENT)pComponent; 361 361 return VINF_SUCCESS; 362 362 } … … 376 376 if (aDefault) 377 377 m_pDefaultComponent = pComponent; 378 *aComponent = ( TRCOMPONENT)pComponent;378 *aComponent = (PTRCOMPONENT)pComponent; 379 379 /* ignore the error during loading because path 380 380 * could contain no translation for current language */ … … 384 384 385 385 386 int VirtualBoxTranslator::unregisterTranslation(TRCOMPONENT aComponent) 387 { 388 VirtualBoxTranslator *pCurrInstance = VirtualBoxTranslator::tryInstance(); 389 int rc = VERR_GENERAL_FAILURE; 390 if (pCurrInstance != NULL) 391 { 392 rc = pCurrInstance->i_unregisterTranslation(aComponent); 393 pCurrInstance->release(); 394 } 386 int VirtualBoxTranslator::unregisterTranslation(PTRCOMPONENT aComponent) 387 { 388 int rc; 389 if (aComponent != NULL) 390 { 391 VirtualBoxTranslator *pCurrInstance = VirtualBoxTranslator::tryInstance(); 392 if (pCurrInstance != NULL) 393 { 394 rc = pCurrInstance->i_unregisterTranslation(aComponent); 395 pCurrInstance->release(); 396 } 397 else 398 rc = VERR_GENERAL_FAILURE; 399 } 400 else 401 rc = VWRN_NOT_FOUND; 395 402 return rc; 396 403 } 397 404 398 405 399 int VirtualBoxTranslator::i_unregisterTranslation( TRCOMPONENT aComponent)406 int VirtualBoxTranslator::i_unregisterTranslation(PTRCOMPONENT aComponent) 400 407 { 401 408 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 422 429 423 430 424 const char *VirtualBoxTranslator::translate( TRCOMPONENT aComponent,431 const char *VirtualBoxTranslator::translate(PTRCOMPONENT aComponent, 425 432 const char *aContext, 426 433 const char *aSourceText, … … 466 473 467 474 468 const char *VirtualBoxTranslator::i_translate( TRCOMPONENT aComponent,475 const char *VirtualBoxTranslator::i_translate(PTRCOMPONENT aComponent, 469 476 const char *aContext, 470 477 const char *aSourceText, -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r91314 r91390 411 411 #ifdef VBOX_WITH_MAIN_NLS 412 412 VirtualBoxTranslator *pVBoxTranslator; 413 TRCOMPONENTpTrComponent;413 PTRCOMPONENT pTrComponent; 414 414 #endif 415 415 #if defined(RT_OS_WINDOWS) && defined(VBOXSVC_WITH_CLIENT_WATCHER)
Note:
See TracChangeset
for help on using the changeset viewer.

