Changeset 90828 in vbox for trunk/src/VBox/Main
- Timestamp:
- Aug 24, 2021 9:44:46 AM (3 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 added
- 107 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Makefile.kmk
r88345 r90828 172 172 ifdef VBOX_WITH_EFI_IN_DD2 173 173 VBOX_MAIN_DEFS += VBOX_WITH_EFI_IN_DD2 174 endif 175 ifdef VBOX_WITH_MAIN_NLS 176 VBOX_MAIN_DEFS += VBOX_WITH_MAIN_NLS 174 177 endif 175 178 # Unconditionally enable the new semaphore key generation code … … 550 553 src-all/PCIDeviceAttachmentImpl.cpp \ 551 554 src-all/ProgressImpl.cpp \ 552 src-all/QMTranslatorImpl.cpp \553 555 src-all/SecretKeyStore.cpp \ 554 556 src-all/SharedFolderImpl.cpp \ … … 628 630 $(if $(VBOX_WITH_XPCOM),src-server/xpcom/server.cpp,) 629 631 632 ifdef VBOX_WITH_MAIN_NLS 633 VBoxSVC_SOURCES += \ 634 src-all/VirtualBoxTranslator.cpp \ 635 src-all/QMTranslatorImpl.cpp 636 endif 637 630 638 ifn1of ($(KBUILD_TARGET), win darwin) 631 639 VBoxSVC_SOURCES += $(PATH_ROOT)/src/VBox/Devices/Network/slirp/resolv_conf_parser.c … … 1033 1041 $(VBOX_XML_SCHEMADEFS_CPP) 1034 1042 1043 ifdef VBOX_WITH_MAIN_NLS 1044 VBoxC_SOURCES += \ 1045 src-all/VirtualBoxTranslator.cpp \ 1046 src-all/QMTranslatorImpl.cpp 1047 endif 1048 1035 1049 # Experimental cloud support 1036 1050 ifdef VBOX_WITH_CLOUD_NET … … 1151 1165 $(VBOX_AUTOGEN_EVENT_CPP) \ 1152 1166 $(VBOX_XML_SCHEMADEFS_CPP) 1167 ifdef VBOX_WITH_MAIN_NLS 1168 VBoxClient-x86_SOURCES += \ 1169 src-all/VirtualBoxTranslator.cpp \ 1170 src-all/QMTranslatorImpl.cpp 1171 endif 1153 1172 VBoxClient-x86_SOURCES.win = \ 1154 1173 src-client/win/dllmain.cpp \ … … 1390 1409 1391 1410 1411 ifdef VBOX_WITH_MAIN_NLS 1412 # 1413 # NLS stuff. 1414 # 1415 PROGRAMS += VirtualBoxAPI 1416 VirtualBoxAPI_TEMPLATE = VBOXQTGUIEXE 1417 VirtualBoxAPI_INSTTYPE = none 1418 VirtualBoxAPI_LRCFLAGS = -silent 1419 VirtualBoxAPI_QT_TRANSLATIONS_INST = $(INST_BIN)nls/ 1420 VirtualBoxAPI_APPROVED_LANGUAGES = \ 1421 bg \ 1422 ca \ 1423 ca_VA \ 1424 cs \ 1425 da \ 1426 de \ 1427 el \ 1428 en \ 1429 es \ 1430 eu \ 1431 fa \ 1432 fi \ 1433 fr \ 1434 gl \ 1435 he \ 1436 hr_HR \ 1437 hu \ 1438 id \ 1439 it \ 1440 ja \ 1441 km_KH \ 1442 ko \ 1443 lt \ 1444 nl \ 1445 pl \ 1446 pt \ 1447 pt_BR \ 1448 ro \ 1449 ru \ 1450 sk \ 1451 sl \ 1452 sr \ 1453 sv \ 1454 th \ 1455 tr \ 1456 uk \ 1457 zh_CN \ 1458 zh_TW 1459 1460 VirtualBoxAPI_QT_TRANSLATIONS = \ 1461 $(filter \ 1462 $(addsuffix .ts, $(addprefix $(VBOX_PATH_MAIN_SRC)/nls/VirtualBoxAPI_, \ 1463 $(VirtualBoxAPI_APPROVED_LANGUAGES))), \ 1464 $(wildcard $(VBOX_PATH_MAIN_SRC)/nls/*.ts)) 1465 1466 VirtualBoxAPI_SOURCES = \ 1467 nls/dummy.c 1468 VirtualBoxAPI_VBOX_ALL_NLS_SOURCES = $(wildcard \ 1469 $(VBOX_PATH_MAIN_SRC)/include/*.h\ 1470 $(VBOX_PATH_MAIN_SRC)/src-all/*.cpp \ 1471 $(VBOX_PATH_MAIN_SRC)/src-all/*.h \ 1472 $(VBOX_PATH_MAIN_SRC)/src-server/*.cpp \ 1473 $(VBOX_PATH_MAIN_SRC)/src-server/*.h \ 1474 $(VBOX_PATH_MAIN_SRC)/src-client/*.cpp \ 1475 $(VBOX_PATH_MAIN_SRC)/src-client/*.h ) 1476 1477 updatenls:: makeallnls $(VBOX_PATH_MAIN_SRC)/nls/VirtualBoxAPI_en.ts 1478 1479 makeallnls:: $(VirtualBoxAPI_VBOX_ALL_NLS_SOURCES) 1480 $(call MSG_L1,lupdate all languages (nls/*.ts)) 1481 $(QUIET)$(TOOL_QT5_LUPDATE) \ 1482 $^ \ 1483 -ts \ 1484 $(filter-out nls/VirtualBoxAPI_en.ts, $(VirtualBoxAPI_QT_TRANSLATIONS)) \ 1485 $(VBOX_PATH_MAIN_SRC)/nls/VirtualBoxAPI_xx_YY.ts 1486 1487 fake-main-nls: 1488 $(foreach file, $(VirtualBoxAPI_QT_TRANSLATIONS) \ 1489 ,$(NLTAB)$(SED) -i \ 1490 -e '/<source>.*<\/source>/h' \ 1491 -e '/<source>.*<\/source>/p' \ 1492 -e '/<translation type="unfinished"><\/translation>/{' \ 1493 -e 'x' \ 1494 -e 's/<source>\(.*\)<\/source>/<translation type="unfinished">$(notdir $(file)): \1<\/translation>/' \ 1495 -e '}' \ 1496 $(file) ) 1497 1498 1499 # Create the English translation file. This is something special cause it will 1500 # contain the plural forms only. 1501 $(VBOX_PATH_MAIN_SRC)/nls/VirtualBoxAPI_en.ts: $(VirtualBoxAPI_VBOX_ALL_NLS_SOURCES) 1502 $(call MSG_L1,lupdate $@) 1503 $(QUIET)$(TOOL_QT5_LUPDATE) \ 1504 $^ \ 1505 -ts \ 1506 "$@" 1507 $(QUIET)$(SED) -n -i \ 1508 -e '/<context>/,/<\/context>/!p' \ 1509 -e '/<context>/h' \ 1510 -e '/<name>/H' \ 1511 -e '/<message numerus="yes">/,/<\/message>/H' \ 1512 -e '/<\/context>/{H;x;/<message/p}' \ 1513 "$@" 1514 1515 endif # VBOX_WITH_MAIN_NLS 1516 1392 1517 1393 1518 # generate rules … … 1737 1862 $(VBoxAPIWrap_0_OUTDIR)/apiwrappers-sources-even 1738 1863 1739 1740 #1741 # NLS stuff.1742 #1743 updatenls::1744 $(VBOX_LUPDATE) $(VBoxSVC_SOURCES) $(VBoxSVC_VBOX_HEADERS) -ts $(VBoxSVC_VBOX_TRANSLATIONS)1745 $(VBOX_LUPDATE) $(VBoxC_SOURCES) $(VBoxC_VBOX_HEADERS) -ts $(VBoxC_VBOX_TRANSLATIONS) -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r90799 r90828 11781 11781 </attribute> 11782 11782 11783 <attribute name="languageId" type="wstring"> 11784 <desc> 11785 The API language ID used to translate messages to client. 11786 </desc> 11787 </attribute> 11788 11783 11789 <method name="getMaxNetworkAdapters"> 11784 11790 <desc> … … 24942 24948 </desc> 24943 24949 </const> 24950 <const name="OnLanguageChanged" value="111"> 24951 <desc> 24952 See <link to="ILanguageChangedEvent"/>. 24953 </desc> 24954 </const> 24944 24955 <!-- End event marker --> 24945 24956 <!-- @todo rename to 'End' as it is exclusive (we use 'last' to be inclusive). --> 24946 <const name="Last" value="11 1">24957 <const name="Last" value="112"> 24947 24958 <desc> 24948 24959 Must be last event, used for iterations and structures relying on numerical event values. … … 28454 28465 </interface> 28455 28466 28467 <interface name="ILanguageChangedEvent" extends="IEvent" 28468 uuid="28935887-782b-4c94-8410-ce557b9cfe44" 28469 wsmap="managed" autogen="VBoxEvent" 28470 id="OnLanguageChanged" 28471 > 28472 <attribute name="languageId" type="wstring" readonly="yes"/> 28473 </interface> 28456 28474 28457 28475 <module name="VBoxSVC" context="LocalServer"> -
trunk/src/VBox/Main/idl/apiwrap-server.xsl
r85421 r90828 171 171 172 172 </xsl:text> 173 <xsl:value-of select="concat(' DECLARE_ EMPTY_CTOR_DTOR(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/>173 <xsl:value-of select="concat(' DECLARE_COMMON_CLASS_METHODS(', substring(@name, 2), 'Wrap)', $G_sNewLine)"/> 174 174 </xsl:template> 175 175 -
trunk/src/VBox/Main/include/AdditionsFacilityImpl.h
r84564 r90828 35 35 public: 36 36 37 DECLARE_ EMPTY_CTOR_DTOR(AdditionsFacility)37 DECLARE_COMMON_CLASS_METHODS(AdditionsFacility) 38 38 39 39 /** @name Initializer & uninitializer methods -
trunk/src/VBox/Main/include/ApplianceImpl.h
r90424 r90828 68 68 public: 69 69 70 DECLARE_ EMPTY_CTOR_DTOR(Appliance)70 DECLARE_COMMON_CLASS_METHODS(Appliance) 71 71 72 72 HRESULT FinalConstruct(); … … 79 79 /* public methods only for internal purposes */ 80 80 81 static HRESULT i_setErrorStatic(HRESULT aResultCode, 82 const Utf8Str &aText) 81 static HRESULT i_setErrorStatic(HRESULT aResultCode, const char *aText, ...) 83 82 { 84 return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true); 83 va_list va; 84 va_start(va, aText); 85 HRESULT hrc = setErrorInternalV(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, va, false, true); 86 va_end(va); 87 return hrc; 85 88 } 86 89 … … 289 292 public: 290 293 291 DECLARE_ EMPTY_CTOR_DTOR(VirtualSystemDescription)294 DECLARE_COMMON_CLASS_METHODS(VirtualSystemDescription) 292 295 293 296 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/AudioAdapterImpl.h
r82968 r90828 35 35 public: 36 36 37 DECLARE_ EMPTY_CTOR_DTOR(AudioAdapter)37 DECLARE_COMMON_CLASS_METHODS (AudioAdapter) 38 38 39 39 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/BIOSSettingsImpl.h
r82968 r90828 38 38 public: 39 39 40 DECLARE_ EMPTY_CTOR_DTOR(BIOSSettings)40 DECLARE_COMMON_CLASS_METHODS(BIOSSettings) 41 41 42 42 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/BandwidthControlImpl.h
r82968 r90828 37 37 public: 38 38 39 DECLARE_ EMPTY_CTOR_DTOR(BandwidthControl)39 DECLARE_COMMON_CLASS_METHODS(BandwidthControl) 40 40 41 41 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/BandwidthGroupImpl.h
r85242 r90828 33 33 public: 34 34 35 DECLARE_ EMPTY_CTOR_DTOR(BandwidthGroup)35 DECLARE_COMMON_CLASS_METHODS(BandwidthGroup) 36 36 37 37 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/CPUProfileImpl.h
r85574 r90828 35 35 /** @name COM and internal init/term/mapping cruft 36 36 * @{ */ 37 DECLARE_ EMPTY_CTOR_DTOR(CPUProfile)37 DECLARE_COMMON_CLASS_METHODS(CPUProfile) 38 38 HRESULT FinalConstruct(); 39 39 void FinalRelease(); -
trunk/src/VBox/Main/include/CertificateImpl.h
r82968 r90828 51 51 public: 52 52 53 DECLARE_ EMPTY_CTOR_DTOR(Certificate)53 DECLARE_COMMON_CLASS_METHODS(Certificate) 54 54 55 55 HRESULT initCertificate(PCRTCRX509CERTIFICATE a_pCert, bool a_fTrusted, bool a_fExpired); -
trunk/src/VBox/Main/include/CloudNetworkImpl.h
r85360 r90828 34 34 public: 35 35 36 DECLARE_ EMPTY_CTOR_DTOR(CloudNetwork)36 DECLARE_COMMON_CLASS_METHODS(CloudNetwork) 37 37 38 38 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/ConsoleImpl.h
r90187 r90828 128 128 public: 129 129 130 DECLARE_ EMPTY_CTOR_DTOR(Console)130 DECLARE_COMMON_CLASS_METHODS(Console) 131 131 132 132 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/ConsoleVRDPServer.h
r88253 r90828 61 61 62 62 /* Member of Console. Helper class for VRDP server management. Not a COM class. */ 63 class ConsoleVRDPServer 63 class ConsoleVRDPServer : public VirtualBoxTranslatable 64 64 { 65 65 public: 66 DECLARE_TRANSLATE_METHODS(ConsoleVRDPServer) 67 66 68 ConsoleVRDPServer (Console *console); 67 69 ~ConsoleVRDPServer (); … … 379 381 DECLARE_NOT_AGGREGATABLE(VRDEServerInfo) 380 382 381 DECLARE_ EMPTY_CTOR_DTOR(VRDEServerInfo)383 DECLARE_COMMON_CLASS_METHODS(VRDEServerInfo) 382 384 383 385 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/DHCPConfigImpl.h
r82968 r90828 41 41 * can call setError and such on. 42 42 */ 43 class DHCPConfig 43 class DHCPConfig : public VirtualBoxTranslatable 44 44 { 45 45 protected: … … 98 98 99 99 public: 100 DECLARE_TRANSLATE_METHODS(DHCPConfig) 101 100 102 /** @name IDHCPConfig methods 101 103 * @note public because the DHCPServer needs them for 6.0 interfaces. … … 127 129 { 128 130 public: 131 DECLARE_TRANSLATE_METHODS(DHCPGlobalConfig) 132 129 133 /** @name Constructors and destructors. 130 134 * @{ */ … … 224 228 225 229 public: 230 DECLARE_TRANSLATE_METHODS(DHCPGroupCondition) 231 226 232 /** @name Constructors and destructors. 227 233 * @{ */ … … 288 294 289 295 public: 296 DECLARE_TRANSLATE_METHODS(DHCPGroupConfig) 297 290 298 /** @name Constructors and destructors. 291 299 * @{ */ … … 400 408 401 409 public: 410 DECLARE_TRANSLATE_METHODS(DHCPIndividualConfig) 411 402 412 /** @name Constructors and destructors. 403 413 * @{ */ -
trunk/src/VBox/Main/include/DHCPServerImpl.h
r85235 r90828 57 57 /** @name Constructors and destructors 58 58 * @{ */ 59 DECLARE_ EMPTY_CTOR_DTOR(DHCPServer)59 DECLARE_COMMON_CLASS_METHODS(DHCPServer) 60 60 HRESULT FinalConstruct(); 61 61 void FinalRelease(); -
trunk/src/VBox/Main/include/DataStreamImpl.h
r82968 r90828 31 31 { 32 32 public: 33 DECLARE_ EMPTY_CTOR_DTOR(DataStream)33 DECLARE_COMMON_CLASS_METHODS(DataStream) 34 34 35 35 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/DisplayImpl.h
r90691 r90828 138 138 public: 139 139 140 DECLARE_ EMPTY_CTOR_DTOR(Display)140 DECLARE_COMMON_CLASS_METHODS(Display) 141 141 142 142 HRESULT FinalConstruct(); … … 457 457 public: 458 458 459 DECLARE_ EMPTY_CTOR_DTOR(DisplaySourceBitmap)459 DECLARE_COMMON_CLASS_METHODS(DisplaySourceBitmap) 460 460 461 461 HRESULT FinalConstruct(); … … 506 506 public: 507 507 508 DECLARE_ EMPTY_CTOR_DTOR(GuestScreenInfo)508 DECLARE_COMMON_CLASS_METHODS(GuestScreenInfo) 509 509 510 510 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/EmulatedUSBImpl.h
r82968 r90828 34 34 public: 35 35 36 DECLARE_ EMPTY_CTOR_DTOR(EmulatedUSB)36 DECLARE_COMMON_CLASS_METHODS(EmulatedUSB) 37 37 38 38 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/EventImpl.h
r85293 r90828 31 31 { 32 32 public: 33 DECLARE_ EMPTY_CTOR_DTOR(VBoxEvent)33 DECLARE_COMMON_CLASS_METHODS(VBoxEvent) 34 34 35 35 HRESULT FinalConstruct(); … … 59 59 { 60 60 public: 61 DECLARE_ EMPTY_CTOR_DTOR(VBoxVetoEvent)61 DECLARE_COMMON_CLASS_METHODS(VBoxVetoEvent) 62 62 63 63 HRESULT FinalConstruct(); … … 94 94 { 95 95 public: 96 DECLARE_ EMPTY_CTOR_DTOR(EventSource)96 DECLARE_COMMON_CLASS_METHODS(EventSource) 97 97 98 98 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/ExtPackManagerImpl.h
r86058 r90828 44 44 /** @name COM and internal init/term/mapping cruft. 45 45 * @{ */ 46 DECLARE_ EMPTY_CTOR_DTOR(ExtPackFile)46 DECLARE_COMMON_CLASS_METHODS(ExtPackFile) 47 47 48 48 HRESULT FinalConstruct(); … … 102 102 /** @name COM and internal init/term/mapping cruft. 103 103 * @{ */ 104 DECLARE_ EMPTY_CTOR_DTOR(ExtPack)104 DECLARE_COMMON_CLASS_METHODS(ExtPack) 105 105 106 106 HRESULT FinalConstruct(); … … 226 226 /** @name COM and internal init/term/mapping cruft. 227 227 * @{ */ 228 DECLARE_ EMPTY_CTOR_DTOR(ExtPackManager)228 DECLARE_COMMON_CLASS_METHODS(ExtPackManager) 229 229 230 230 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/GraphicsAdapterImpl.h
r82968 r90828 36 36 public: 37 37 38 DECLARE_ EMPTY_CTOR_DTOR(GraphicsAdapter)38 DECLARE_COMMON_CLASS_METHODS(GraphicsAdapter) 39 39 40 40 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/GuestDirectoryImpl.h
r84648 r90828 38 38 /** @name COM and internal init/term/mapping cruft. 39 39 * @{ */ 40 DECLARE_ EMPTY_CTOR_DTOR(GuestDirectory)40 DECLARE_COMMON_CLASS_METHODS(GuestDirectory) 41 41 42 42 int init(Console *pConsole, GuestSession *pSession, ULONG aObjectID, const GuestDirectoryOpenInfo &openInfo); -
trunk/src/VBox/Main/include/GuestDnDPrivate.h
r86530 r90828 800 800 * Class for keeping a DnD guest state around. 801 801 */ 802 class GuestDnDState 803 { 804 805 public: 802 class GuestDnDState : public VirtualBoxTranslatable 803 { 804 805 public: 806 DECLARE_TRANSLATE_METHODS(GuestDnDState) 806 807 807 808 GuestDnDState(const ComObjPtr<Guest>& pGuest); -
trunk/src/VBox/Main/include/GuestDnDSourceImpl.h
r85743 r90828 40 40 /** @name COM and internal init/term/mapping cruft. 41 41 * @{ */ 42 DECLARE_ EMPTY_CTOR_DTOR(GuestDnDSource)42 DECLARE_COMMON_CLASS_METHODS(GuestDnDSource) 43 43 44 44 HRESULT init(const ComObjPtr<Guest>& pGuest); -
trunk/src/VBox/Main/include/GuestDnDTargetImpl.h
r85743 r90828 38 38 /** @name COM and internal init/term/mapping cruft. 39 39 * @{ */ 40 DECLARE_ EMPTY_CTOR_DTOR(GuestDnDTarget)40 DECLARE_COMMON_CLASS_METHODS(GuestDnDTarget) 41 41 42 42 HRESULT init(const ComObjPtr<Guest>& pGuest); -
trunk/src/VBox/Main/include/GuestFileImpl.h
r84648 r90828 39 39 /** @name COM and internal init/term/mapping cruft. 40 40 * @{ */ 41 DECLARE_ EMPTY_CTOR_DTOR(GuestFile)41 DECLARE_COMMON_CLASS_METHODS(GuestFile) 42 42 43 43 int init(Console *pConsole, GuestSession *pSession, ULONG uFileID, const GuestFileOpenInfo &openInfo); -
trunk/src/VBox/Main/include/GuestFsObjInfoImpl.h
r82968 r90828 31 31 /** @name COM and internal init/term/mapping cruft. 32 32 * @{ */ 33 DECLARE_ EMPTY_CTOR_DTOR(GuestFsObjInfo)33 DECLARE_COMMON_CLASS_METHODS(GuestFsObjInfo) 34 34 35 35 int init(const GuestFsObjData &objData); -
trunk/src/VBox/Main/include/GuestImpl.h
r85309 r90828 63 63 public: 64 64 65 DECLARE_ EMPTY_CTOR_DTOR(Guest)65 DECLARE_COMMON_CLASS_METHODS (Guest) 66 66 67 67 HRESULT FinalConstruct(); … … 101 101 BOOL i_isPageFusionEnabled(); 102 102 void i_setCpuCount(uint32_t aCpus) { mCpus = aCpus; } 103 static HRESULT i_setErrorStatic(HRESULT aResultCode, const Utf8Str &aText)103 static HRESULT i_setErrorStatic(HRESULT aResultCode, const char *aText, ...) 104 104 { 105 return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true); 105 va_list va; 106 va_start(va, aText); 107 HRESULT hrc = setErrorInternalV(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, va, false, true); 108 va_end(va); 109 return hrc; 106 110 } 107 111 uint32_t i_getAdditionsRevision(void) { return mData.mAdditionsRevision; } -
trunk/src/VBox/Main/include/GuestOSTypeImpl.h
r87241 r90828 31 31 public: 32 32 33 DECLARE_ EMPTY_CTOR_DTOR(GuestOSType)33 DECLARE_COMMON_CLASS_METHODS(GuestOSType) 34 34 35 35 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/GuestProcessImpl.h
r84648 r90828 41 41 /** @name COM and internal init/term/mapping cruft. 42 42 * @{ */ 43 DECLARE_ EMPTY_CTOR_DTOR(GuestProcess)43 DECLARE_COMMON_CLASS_METHODS(GuestProcess) 44 44 45 45 int init(Console *aConsole, GuestSession *aSession, ULONG aObjectID, … … 214 214 * information extraction and maintaining the overall status. 215 215 */ 216 class GuestProcessTool 216 class GuestProcessTool : public VirtualBoxTranslatable 217 217 { 218 218 public: 219 DECLARE_TRANSLATE_METHODS(GuestProcessTool) 219 220 220 221 GuestProcessTool(void); -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r84648 r90828 48 48 /** @name COM and internal init/term/mapping cruft. 49 49 * @{ */ 50 DECLARE_ EMPTY_CTOR_DTOR(GuestSession)50 DECLARE_COMMON_CLASS_METHODS(GuestSession) 51 51 52 52 int init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds); -
trunk/src/VBox/Main/include/GuestSessionImplTasks.h
r84648 r90828 154 154 * runs in a Main worker thread. 155 155 */ 156 class GuestSessionTask : public ThreadTask 157 { 158 public: 156 class GuestSessionTask 157 : public ThreadTask 158 , public VirtualBoxTranslatable 159 { 160 public: 161 DECLARE_TRANSLATE_METHODS(GuestSessionTask) 159 162 160 163 GuestSessionTask(GuestSession *pSession); … … 270 273 { 271 274 public: 275 DECLARE_TRANSLATE_METHODS(GuestSessionCopyTask) 272 276 273 277 GuestSessionCopyTask(GuestSession *pSession); … … 291 295 { 292 296 public: 297 DECLARE_TRANSLATE_METHODS(GuestSessionTaskCopyFrom) 293 298 294 299 GuestSessionTaskCopyFrom(GuestSession *pSession, GuestSessionFsSourceSet const &vecSrc, const Utf8Str &strDest); … … 305 310 { 306 311 public: 312 DECLARE_TRANSLATE_METHODS(GuestSessionTaskCopyTo) 307 313 308 314 GuestSessionTaskCopyTo(GuestSession *pSession, GuestSessionFsSourceSet const &vecSrc, const Utf8Str &strDest); … … 319 325 { 320 326 public: 327 DECLARE_TRANSLATE_METHODS(GuestSessionTaskUpdateAdditions) 321 328 322 329 GuestSessionTaskUpdateAdditions(GuestSession *pSession, const Utf8Str &strSource, -
trunk/src/VBox/Main/include/HostDriveImpl.h
r85935 r90828 28 28 { 29 29 public: 30 DECLARE_ EMPTY_CTOR_DTOR(HostDrive)30 DECLARE_COMMON_CLASS_METHODS(HostDrive) 31 31 32 32 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/HostDrivePartitionImpl.h
r85933 r90828 30 30 { 31 31 public: 32 DECLARE_ EMPTY_CTOR_DTOR(HostDrivePartition)32 DECLARE_COMMON_CLASS_METHODS(HostDrivePartition) 33 33 34 34 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/HostImpl.h
r86331 r90828 44 44 public: 45 45 46 DECLARE_ EMPTY_CTOR_DTOR(Host)46 DECLARE_COMMON_CLASS_METHODS(Host) 47 47 48 48 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h
r82968 r90828 37 37 public: 38 38 39 DECLARE_ EMPTY_CTOR_DTOR(HostNetworkInterface)39 DECLARE_COMMON_CLASS_METHODS(HostNetworkInterface) 40 40 41 41 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/HostUSBDeviceImpl.h
r82968 r90828 172 172 { 173 173 public: 174 DECLARE_ EMPTY_CTOR_DTOR(HostUSBDevice)174 DECLARE_COMMON_CLASS_METHODS(HostUSBDevice) 175 175 176 176 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/HostUpdateImpl.h
r86530 r90828 30 30 { 31 31 public: 32 DECLARE_ EMPTY_CTOR_DTOR(HostUpdate)32 DECLARE_COMMON_CLASS_METHODS(HostUpdate) 33 33 34 34 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/HostVideoInputDeviceImpl.h
r82968 r90828 35 35 public: 36 36 37 DECLARE_ EMPTY_CTOR_DTOR(HostVideoInputDevice)37 DECLARE_COMMON_CLASS_METHODS(HostVideoInputDevice) 38 38 39 39 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/KeyboardImpl.h
r82968 r90828 49 49 public: 50 50 51 DECLARE_ EMPTY_CTOR_DTOR(Keyboard)51 DECLARE_COMMON_CLASS_METHODS(Keyboard) 52 52 53 53 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/MachineDebuggerImpl.h
r89696 r90828 35 35 public: 36 36 37 DECLARE_ EMPTY_CTOR_DTOR(MachineDebugger)37 DECLARE_COMMON_CLASS_METHODS (MachineDebugger) 38 38 39 39 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/MachineImpl.h
r87241 r90828 338 338 typedef std::list<ComObjPtr<MediumAttachment> > MediumAttachmentList; 339 339 340 DECLARE_ EMPTY_CTOR_DTOR(Machine)340 DECLARE_COMMON_CLASS_METHODS(Machine) 341 341 342 342 HRESULT FinalConstruct(); … … 1279 1279 END_COM_MAP() 1280 1280 1281 DECLARE_ EMPTY_CTOR_DTOR(SessionMachine)1281 DECLARE_COMMON_CLASS_METHODS(SessionMachine) 1282 1282 1283 1283 HRESULT FinalConstruct(); … … 1534 1534 END_COM_MAP() 1535 1535 1536 DECLARE_ EMPTY_CTOR_DTOR(SnapshotMachine)1536 DECLARE_COMMON_CLASS_METHODS(SnapshotMachine) 1537 1537 1538 1538 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/MachineImplCloneVM.h
r82968 r90828 28 28 struct MachineCloneVMPrivate; 29 29 30 class MachineCloneVM 30 class MachineCloneVM : public VirtualBoxTranslatable 31 31 { 32 32 public: 33 DECLARE_TRANSLATE_METHODS(MachineCloneVM) 34 33 35 MachineCloneVM(ComObjPtr<Machine> pSrcMachine, ComObjPtr<Machine> pTrgMachine, CloneMode_T mode, const RTCList<CloneOptions_T> &opts); 34 36 ~MachineCloneVM(); -
trunk/src/VBox/Main/include/MachineImplMoveVM.h
r82968 r90828 64 64 struct fileList_t; 65 65 66 class MachineMoveVM : public ThreadTask 66 class MachineMoveVM : public ThreadTask, public VirtualBoxTranslatable 67 67 { 68 68 std::vector<ComObjPtr<Machine> > machineList; … … 83 83 84 84 public: 85 DECLARE_TRANSLATE_METHODS(MachineMoveVM) 86 85 87 MachineMoveVM(ComObjPtr<Machine> aMachine, 86 88 const com::Utf8Str &aTargetPath, -
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r82968 r90828 30 30 public: 31 31 32 DECLARE_ EMPTY_CTOR_DTOR(MediumAttachment)32 DECLARE_COMMON_CLASS_METHODS(MediumAttachment) 33 33 34 34 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/MediumFormatImpl.h
r82968 r90828 53 53 typedef std::vector<com::Utf8Str> StrArray; 54 54 55 DECLARE_ EMPTY_CTOR_DTOR(MediumFormat)55 DECLARE_COMMON_CLASS_METHODS(MediumFormat) 56 56 57 57 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/MediumIOImpl.h
r82968 r90828 32 32 /** @name Dummy/standard constructors and destructors. 33 33 * @{ */ 34 DECLARE_ EMPTY_CTOR_DTOR(MediumIO)34 DECLARE_COMMON_CLASS_METHODS(MediumIO) 35 35 HRESULT FinalConstruct(); 36 36 void FinalRelease(); -
trunk/src/VBox/Main/include/MediumImpl.h
r86501 r90828 46 46 { 47 47 public: 48 DECLARE_ EMPTY_CTOR_DTOR(Medium)48 DECLARE_COMMON_CLASS_METHODS(Medium) 49 49 50 50 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/MouseImpl.h
r82968 r90828 37 37 public: 38 38 39 DECLARE_ EMPTY_CTOR_DTOR(Mouse)39 DECLARE_COMMON_CLASS_METHODS (Mouse) 40 40 41 41 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/NATEngineImpl.h
r82968 r90828 37 37 public: 38 38 39 DECLARE_ EMPTY_CTOR_DTOR(NATEngine)39 DECLARE_COMMON_CLASS_METHODS(NATEngine) 40 40 41 41 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/NATNetworkImpl.h
r87949 r90828 64 64 public: 65 65 66 DECLARE_ EMPTY_CTOR_DTOR(NATNetwork)66 DECLARE_COMMON_CLASS_METHODS(NATNetwork) 67 67 68 68 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r82968 r90828 39 39 public: 40 40 41 DECLARE_ EMPTY_CTOR_DTOR(NetworkAdapter)41 DECLARE_COMMON_CLASS_METHODS(NetworkAdapter) 42 42 43 43 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/PCIDeviceAttachmentImpl.h
r82968 r90828 36 36 public: 37 37 38 DECLARE_ EMPTY_CTOR_DTOR(PCIDeviceAttachment)38 DECLARE_COMMON_CLASS_METHODS(PCIDeviceAttachment) 39 39 40 40 // public initializer/uninitializer for internal purposes only -
trunk/src/VBox/Main/include/ParallelPortImpl.h
r82968 r90828 35 35 public: 36 36 37 DECLARE_ EMPTY_CTOR_DTOR(ParallelPort)37 DECLARE_COMMON_CLASS_METHODS(ParallelPort) 38 38 39 39 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/PerformanceImpl.h
r82968 r90828 55 55 public: 56 56 57 DECLARE_ EMPTY_CTOR_DTOR(PerformanceMetric)57 DECLARE_COMMON_CLASS_METHODS(PerformanceMetric) 58 58 59 59 HRESULT FinalConstruct(); … … 104 104 public: 105 105 106 DECLARE_ EMPTY_CTOR_DTOR(PerformanceCollector)106 DECLARE_COMMON_CLASS_METHODS(PerformanceCollector) 107 107 108 108 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/ProgressImpl.h
r86650 r90828 158 158 159 159 protected: 160 DECLARE_ EMPTY_CTOR_DTOR(Progress)160 DECLARE_COMMON_CLASS_METHODS(Progress) 161 161 162 162 #if !defined(VBOX_COM_INPROC) -
trunk/src/VBox/Main/include/QMTranslator.h
r82968 r90828 30 30 virtual ~QMTranslator(); 31 31 32 /* Gets translation from loaded QM file 32 /** 33 * Gets translation from loaded QM file 33 34 * 34 * @param context QM context to look for translation 35 * @param source Source string in one-byte encoding 36 * @param disamb Disambiguationg comment, empty by default 35 * @param pszContext QM context to look for translation 36 * @param pszSource Source string in one-byte encoding 37 * @param pszDisamb Disambiguationg comment, empty by default 38 * @param iNum Plural form indicator. 37 39 * 38 * @returns Pointer to a translation in UTF-8 encoding, empty string on failure */ 40 * @returns Pointer to a translation (UTF-8 encoding), source string on failure. 41 */ 42 const char *translate(const char *pszContext, const char *pszSource, 43 const char *pszDisamb = NULL, const int iNum = -1) const RT_NOEXCEPT; 39 44 40 const char *translate(const char *pszContext, const char *pszSource, const char *pszDisamb = "") const throw(); 41 42 /* Loads and parses QM file 45 /** 46 * Loads and parses QM file 43 47 * 44 * @param filename The name of the file to load 48 * @param pszFilename The name of the file to load 49 * @param hStrCache The string cache to use for storing strings. 45 50 * 46 * @returns VINF_SUCCESS if successful */ 47 int load(const char *pszFilename) throw(); 51 * @returns VBox status code. 52 */ 53 int load(const char *pszFilename, RTSTRCACHE hStrCache) RT_NOEXCEPT; 48 54 49 55 private: 50 /* QMTranslator implementation.51 52 QMTranslator_Impl * _impl;56 /** QMTranslator implementation. 57 * To separate all the code from the interface */ 58 QMTranslator_Impl *m_impl; 53 59 54 60 /* If copying is required, please define the following operators */ -
trunk/src/VBox/Main/include/RecordingScreenSettingsImpl.h
r82968 r90828 38 38 public: 39 39 40 DECLARE_ EMPTY_CTOR_DTOR(RecordingScreenSettings)40 DECLARE_COMMON_CLASS_METHODS(RecordingScreenSettings) 41 41 42 42 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/RecordingSettingsImpl.h
r82968 r90828 37 37 public: 38 38 39 DECLARE_ EMPTY_CTOR_DTOR(RecordingSettings)39 DECLARE_COMMON_CLASS_METHODS(RecordingSettings) 40 40 41 41 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/RemoteUSBDeviceImpl.h
r82968 r90828 35 35 public: 36 36 37 DECLARE_ EMPTY_CTOR_DTOR(RemoteUSBDevice)37 DECLARE_COMMON_CLASS_METHODS(RemoteUSBDevice) 38 38 39 39 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/SerialPortImpl.h
r82968 r90828 38 38 public: 39 39 40 DECLARE_ EMPTY_CTOR_DTOR(SerialPort)40 DECLARE_COMMON_CLASS_METHODS(SerialPort) 41 41 42 42 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/SessionImpl.h
r84411 r90828 47 47 DECLARE_NOT_AGGREGATABLE(Session) 48 48 49 DECLARE_ EMPTY_CTOR_DTOR(Session)49 DECLARE_COMMON_CLASS_METHODS(Session) 50 50 51 51 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/SharedFolderImpl.h
r82968 r90828 32 32 public: 33 33 34 DECLARE_ EMPTY_CTOR_DTOR(SharedFolder)34 DECLARE_COMMON_CLASS_METHODS (SharedFolder) 35 35 36 36 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/SnapshotImpl.h
r82968 r90828 35 35 { 36 36 public: 37 DECLARE_ EMPTY_CTOR_DTOR(Snapshot)37 DECLARE_COMMON_CLASS_METHODS(Snapshot) 38 38 39 39 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/StorageControllerImpl.h
r82968 r90828 30 30 public: 31 31 32 DECLARE_ EMPTY_CTOR_DTOR(StorageController)32 DECLARE_COMMON_CLASS_METHODS(StorageController) 33 33 34 34 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/SystemPropertiesImpl.h
r87241 r90828 41 41 typedef std::list<ComObjPtr<CPUProfile> > CPUProfileList_T; 42 42 43 DECLARE_ EMPTY_CTOR_DTOR(SystemProperties)43 DECLARE_COMMON_CLASS_METHODS(SystemProperties) 44 44 45 45 HRESULT FinalConstruct(); … … 154 154 HRESULT getVBoxUpdateCount(ULONG *aVBoxUpdateCount) RT_OVERRIDE; 155 155 HRESULT setVBoxUpdateCount(ULONG aVBoxUpdateCount) RT_OVERRIDE; 156 HRESULT getLanguageId(com::Utf8Str &aLanguageId) RT_OVERRIDE; 157 HRESULT setLanguageId(const com::Utf8Str &aLanguageId) RT_OVERRIDE; 156 158 157 159 // wrapped ISystemProperties methods -
trunk/src/VBox/Main/include/TextScript.h
r82968 r90828 32 32 * @todo get rid of this silly bugger. 33 33 */ 34 class AbstractScript : public RTCNonCopyable 34 class AbstractScript 35 : public RTCNonCopyable 36 , public VirtualBoxTranslatable 35 37 { 36 38 protected: … … 43 45 44 46 public: 47 DECLARE_TRANSLATE_METHODS(AbstractScript) 48 45 49 AbstractScript(VirtualBoxBase *pSetError) : mpSetError(pSetError) {} 46 50 virtual ~AbstractScript() {} … … 101 105 102 106 public: 107 DECLARE_TRANSLATE_METHODS(BaseTextScript) 108 103 109 BaseTextScript(VirtualBoxBase *pSetError, const char *pszDefaultTemplateFilename, const char *pszDefaultFilename) 104 110 : AbstractScript(pSetError) … … 162 168 163 169 public: 170 DECLARE_TRANSLATE_METHODS(GeneralTextScript) 171 164 172 GeneralTextScript(VirtualBoxBase *pSetError, const char *pszDefaultTemplateFilename = NULL, const char *pszDefaultFilename = NULL) 165 173 : BaseTextScript(pSetError, pszDefaultTemplateFilename, pszDefaultFilename), mfDataParsed(false) -
trunk/src/VBox/Main/include/TokenImpl.h
r82968 r90828 34 34 public: 35 35 36 DECLARE_ EMPTY_CTOR_DTOR(MachineToken)36 DECLARE_COMMON_CLASS_METHODS(MachineToken) 37 37 38 38 HRESULT FinalConstruct(); … … 73 73 public: 74 74 75 DECLARE_ EMPTY_CTOR_DTOR(MediumLockToken)75 DECLARE_COMMON_CLASS_METHODS(MediumLockToken) 76 76 77 77 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/USBControllerImpl.h
r82968 r90828 39 39 public: 40 40 41 DECLARE_ EMPTY_CTOR_DTOR(USBController)41 DECLARE_COMMON_CLASS_METHODS(USBController) 42 42 43 43 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/USBDeviceFilterImpl.h
r82968 r90828 68 68 }; 69 69 70 DECLARE_ EMPTY_CTOR_DTOR(USBDeviceFilter)70 DECLARE_COMMON_CLASS_METHODS(USBDeviceFilter) 71 71 72 72 HRESULT FinalConstruct(); … … 161 161 }; 162 162 163 DECLARE_ EMPTY_CTOR_DTOR(HostUSBDeviceFilter)163 DECLARE_COMMON_CLASS_METHODS (HostUSBDeviceFilter) 164 164 165 165 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/USBDeviceFiltersImpl.h
r82968 r90828 37 37 public: 38 38 39 DECLARE_ EMPTY_CTOR_DTOR(USBDeviceFilters)39 DECLARE_COMMON_CLASS_METHODS(USBDeviceFilters) 40 40 41 41 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/USBDeviceImpl.h
r82968 r90828 33 33 public: 34 34 35 DECLARE_ EMPTY_CTOR_DTOR(OUSBDevice)35 DECLARE_COMMON_CLASS_METHODS(OUSBDevice) 36 36 37 37 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/USBProxyBackend.h
r87376 r90828 44 44 public: 45 45 46 DECLARE_ EMPTY_CTOR_DTOR(USBProxyBackend)46 DECLARE_COMMON_CLASS_METHODS(USBProxyBackend) 47 47 48 48 HRESULT FinalConstruct(); … … 148 148 { 149 149 public: 150 DECLARE_ EMPTY_CTOR_DTOR(USBProxyBackendDarwin)150 DECLARE_COMMON_CLASS_METHODS(USBProxyBackendDarwin) 151 151 152 152 int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, … … 190 190 { 191 191 public: 192 DECLARE_ EMPTY_CTOR_DTOR(USBProxyBackendLinux)192 DECLARE_COMMON_CLASS_METHODS(USBProxyBackendLinux) 193 193 194 194 int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, … … 243 243 { 244 244 public: 245 DECLARE_ EMPTY_CTOR_DTOR(USBProxyBackendOs2)245 DECLARE_COMMON_CLASS_METHODS(USBProxyBackendOs2) 246 246 247 247 virtual int captureDevice(HostUSBDevice *aDevice); … … 282 282 { 283 283 public: 284 DECLARE_ EMPTY_CTOR_DTOR(USBProxyBackendSolaris)284 DECLARE_COMMON_CLASS_METHODS(USBProxyBackendSolaris) 285 285 286 286 int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, … … 318 318 { 319 319 public: 320 DECLARE_ EMPTY_CTOR_DTOR(USBProxyBackendWindows)320 DECLARE_COMMON_CLASS_METHODS(USBProxyBackendWindows) 321 321 322 322 int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, … … 350 350 { 351 351 public: 352 DECLARE_ EMPTY_CTOR_DTOR(USBProxyBackendFreeBSD)352 DECLARE_COMMON_CLASS_METHODS(USBProxyBackendFreeBSD) 353 353 354 354 int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, … … 402 402 { 403 403 public: 404 DECLARE_ EMPTY_CTOR_DTOR(USBProxyBackendUsbIp)404 DECLARE_COMMON_CLASS_METHODS(USBProxyBackendUsbIp) 405 405 406 406 int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, -
trunk/src/VBox/Main/include/USBProxyService.h
r82968 r90828 44 44 class USBProxyService 45 45 : public VirtualBoxTranslatable 46 , public Lockable 46 47 { 47 48 public: 49 DECLARE_TRANSLATE_METHODS(USBProxyService) 50 48 51 USBProxyService(Host *aHost); 49 52 virtual HRESULT init(void); -
trunk/src/VBox/Main/include/UnattendedImpl.h
r86274 r90828 41 41 { 42 42 public: 43 DECLARE_ EMPTY_CTOR_DTOR(Unattended)43 DECLARE_COMMON_CLASS_METHODS(Unattended) 44 44 45 45 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/UnattendedInstaller.h
r86659 r90828 36 36 * execute an unattended installation 37 37 */ 38 class UnattendedInstaller : public RTCNonCopyable 38 class UnattendedInstaller : public RTCNonCopyable, public VirtualBoxTranslatable 39 39 { 40 40 /*data*/ … … 70 70 71 71 public: 72 DECLARE_TRANSLATE_METHODS(UnattendedInstaller) 73 72 74 /** 73 75 * Regular constructor. … … 369 371 { 370 372 public: 373 DECLARE_TRANSLATE_METHODS(UnattendedWindowsSifInstaller) 374 371 375 UnattendedWindowsSifInstaller(Unattended *pParent) 372 376 : UnattendedInstaller(pParent, … … 387 391 { 388 392 public: 393 DECLARE_TRANSLATE_METHODS(UnattendedWindowsXmlInstaller) 394 389 395 UnattendedWindowsXmlInstaller(Unattended *pParent) 390 396 : UnattendedInstaller(pParent, … … 410 416 411 417 public: 418 DECLARE_TRANSLATE_METHODS(UnattendedLinuxInstaller) 419 412 420 UnattendedLinuxInstaller(Unattended *pParent, 413 421 const char *pszMainScriptTemplateName, const char *pszPostScriptTemplateName, … … 439 447 { 440 448 public: 449 DECLARE_TRANSLATE_METHODS(UnattendedDebianInstaller) 450 441 451 UnattendedDebianInstaller(Unattended *pParent, 442 452 const char *pszMainScriptTemplateName = "debian_preseed.cfg", … … 482 492 { 483 493 public: 494 DECLARE_TRANSLATE_METHODS(UnattendedUbuntuInstaller) 495 484 496 UnattendedUbuntuInstaller(Unattended *pParent) 485 497 : UnattendedDebianInstaller(pParent, "ubuntu_preseed.cfg") … … 497 509 { 498 510 public: 511 DECLARE_TRANSLATE_METHODS(UnattendedRhel6Installer) 512 499 513 UnattendedRhel6Installer(Unattended *pParent, 500 514 const char *pszMainScriptTemplateName = "redhat67_ks.cfg", … … 525 539 { 526 540 public: 541 DECLARE_TRANSLATE_METHODS(UnattendedRhel7Installer) 542 527 543 UnattendedRhel7Installer(Unattended *pParent) 528 544 : UnattendedRhel6Installer(pParent) … … 546 562 { 547 563 public: 564 DECLARE_TRANSLATE_METHODS(UnattendedRhel8Installer) 565 548 566 UnattendedRhel8Installer(Unattended *pParent) 549 567 : UnattendedRhel7Installer(pParent) … … 566 584 { 567 585 public: 586 DECLARE_TRANSLATE_METHODS(UnattendedRhel5Installer) 587 568 588 UnattendedRhel5Installer(Unattended *pParent) : UnattendedRhel6Installer(pParent, "rhel5_ks.cfg") {} 569 589 ~UnattendedRhel5Installer() {} … … 577 597 { 578 598 public: 599 DECLARE_TRANSLATE_METHODS(UnattendedRhel4Installer) 600 579 601 UnattendedRhel4Installer(Unattended *pParent) : UnattendedRhel6Installer(pParent, "rhel4_ks.cfg") {} 580 602 ~UnattendedRhel4Installer() {} … … 588 610 { 589 611 public: 612 DECLARE_TRANSLATE_METHODS(UnattendedRhel3Installer) 613 590 614 UnattendedRhel3Installer(Unattended *pParent) : UnattendedRhel6Installer(pParent, "rhel3_ks.cfg") {} 591 615 ~UnattendedRhel3Installer() {} … … 599 623 { 600 624 public: 625 DECLARE_TRANSLATE_METHODS(UnattendedFedoraInstaller) 626 601 627 UnattendedFedoraInstaller(Unattended *pParent) 602 628 : UnattendedRhel6Installer(pParent, "fedora_ks.cfg") … … 613 639 { 614 640 public: 641 DECLARE_TRANSLATE_METHODS(UnattendedOracleLinux6Installer) 642 615 643 UnattendedOracleLinux6Installer(Unattended *pParent, 616 644 const char *pszMainScriptTemplateName = "ol_ks.cfg", … … 630 658 { 631 659 public: 660 DECLARE_TRANSLATE_METHODS(UnattendedOracleLinux7Installer) 661 632 662 UnattendedOracleLinux7Installer(Unattended *pParent) 633 663 : UnattendedOracleLinux6Installer(pParent) … … 651 681 { 652 682 public: 683 DECLARE_TRANSLATE_METHODS(UnattendedOracleLinux8Installer) 684 653 685 UnattendedOracleLinux8Installer(Unattended *pParent) 654 686 : UnattendedOracleLinux7Installer(pParent) … … 673 705 { 674 706 public: 707 DECLARE_TRANSLATE_METHODS(UnattendedSuseInstaller) 708 675 709 UnattendedSuseInstaller(BaseTextScript *pAlg, Unattended *pParent) 676 710 : UnattendedLinuxInstaller(pAlg, pParent, "suse_autoinstall.xml") -
trunk/src/VBox/Main/include/UnattendedScript.h
r86659 r90828 43 43 44 44 public: 45 DECLARE_TRANSLATE_METHODS(UnattendedScriptTemplate) 46 45 47 UnattendedScriptTemplate(Unattended *pUnattended, const char *pszDefaultTemplateFilename, const char *pszDefaultFilename); 46 48 virtual ~UnattendedScriptTemplate() {} … … 105 107 { 106 108 public: 109 DECLARE_TRANSLATE_METHODS(UnattendedSUSEXMLScript) 110 107 111 UnattendedSUSEXMLScript(VirtualBoxBase *pSetError, const char *pszDefaultFilename = "autoinst.xml") 108 112 : UnattendedXMLScript(pSetError, pszDefaultFilename) {} -
trunk/src/VBox/Main/include/VFSExplorerImpl.h
r82968 r90828 29 29 public: 30 30 31 DECLARE_ EMPTY_CTOR_DTOR(VFSExplorer)31 DECLARE_COMMON_CLASS_METHODS(VFSExplorer) 32 32 33 33 // public initializer/uninitializer for internal purposes only … … 39 39 40 40 /* public methods only for internal purposes */ 41 static HRESULT setErrorStatic(HRESULT aResultCode, 42 const Utf8Str &aText) 41 static HRESULT setErrorStatic(HRESULT aResultCode, const char *aText, ...) 43 42 { 44 return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true); 43 va_list va; 44 va_start(va, aText); 45 HRESULT hrc = setErrorInternalV(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, va, false, true); 46 va_end(va); 47 return hrc; 45 48 } 46 49 -
trunk/src/VBox/Main/include/VRDEServerImpl.h
r82968 r90828 36 36 public: 37 37 38 DECLARE_ EMPTY_CTOR_DTOR(VRDEServer)38 DECLARE_COMMON_CLASS_METHODS(VRDEServer) 39 39 40 40 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r82968 r90828 35 35 36 36 #include "VBox/com/VirtualBox.h" 37 38 #include "VirtualBoxTranslator.h" 37 39 38 40 // avoid including VBox/settings.h and VBox/xml.h; only declare the classes … … 570 572 */ 571 573 class ATL_NO_VTABLE VirtualBoxTranslatable 572 : public Lockable573 574 { 574 575 public: 575 576 576 /** 577 * Placeholder method with which translations can one day be implemented 578 * in Main. This gets called by the tr() function. 579 * @param context 580 * @param pcszSourceText 581 * @param comment 582 * @return 577 * Returns translated text. 578 * 579 * @param aContext Translation context e.g. class name 580 * @param aSourceText String to translate. 581 * @param aComment Comment to the string to resolve possible ambiguities 582 * (NULL means no comment). Used by translation tool only. 583 * @param aNum Number used to define plural form of the translation. 584 * 585 * @return Translated text. 583 586 */ 584 static const char *translate(const char *context, 585 const char *pcszSourceText, 586 const char *comment = 0) 587 { 588 NOREF(context); 589 NOREF(comment); 590 return pcszSourceText; 587 static const char *translate(const char *aComponent, 588 const char *aSourceText, 589 const char *aComment = NULL, 590 const int aNum = -1) 591 { 592 #ifdef VBOX_WITH_MAIN_NLS 593 return VirtualBoxTranslator::translate(aComponent, aSourceText, aComment, aNum); 594 #else 595 RT_NOREF(aComponent, aComment, aNum); 596 return aSourceText; 597 #endif 591 598 } 592 599 593 600 /** 594 * Translates the given text string by calling translate() and passing 595 * the name of the C class as the first argument ("context of 596 * translation"). See VirtualBoxBase::translate() for more info. 597 * 598 * @param pcszSourceText String to translate. 599 * @param aComment Comment to the string to resolve possible 600 * ambiguities (NULL means no comment). 601 * 602 * @return Translated version of the source string in UTF-8 encoding, or 603 * the source string itself if the translation is not found in the 604 * specified context. 601 * Returns source text stored in the cache if exists. 602 * Otherwise, the @a aTranslation itself returned. 605 603 */ 606 inline static const char *tr(const char *pcszSourceText, 607 const char *aComment = NULL) 608 { 609 return VirtualBoxTranslatable::translate(NULL, // getComponentName(), eventually 610 pcszSourceText, 611 aComment); 604 static const char *trSource(const char *aTranslation) 605 { 606 #ifdef VBOX_WITH_MAIN_NLS 607 return VirtualBoxTranslator::trSource(aTranslation); 608 #else 609 return aTranslation; 610 #endif 612 611 } 613 612 }; … … 618 617 // 619 618 //////////////////////////////////////////////////////////////////////////////// 619 620 #ifdef VBOX_WITH_MAIN_NLS 621 # define DECLARE_TRANSLATE_METHODS(cls) \ 622 static inline const char *tr(const char *aSourceText, \ 623 const char *aComment = NULL, \ 624 const int aNum = -1) \ 625 { \ 626 return VirtualBoxTranslatable::translate(#cls, aSourceText, aComment, aNum); \ 627 } 628 #else 629 # define DECLARE_TRANSLATE_METHODS(cls) \ 630 static inline const char *tr(const char *aSourceText, \ 631 const char *aComment = NULL, \ 632 const int aNum = -1) \ 633 { \ 634 RT_NOREF(aComment, aNum); \ 635 return aSourceText; \ 636 } 637 #endif 638 639 #define DECLARE_COMMON_CLASS_METHODS(cls) \ 640 DECLARE_EMPTY_CTOR_DTOR(cls) \ 641 DECLARE_TRANSLATE_METHODS(cls) 620 642 621 643 #define VIRTUALBOXBASE_ADD_VIRTUAL_COMPONENT_METHODS(cls, iface) \ … … 696 718 */ 697 719 class ATL_NO_VTABLE VirtualBoxBase 698 : public VirtualBoxTranslatable, 699 public ATL::CComObjectRootEx<ATL::CComMultiThreadModel> 720 : public VirtualBoxTranslatable 721 , public Lockable 722 , public ATL::CComObjectRootEx<ATL::CComMultiThreadModel> 700 723 #if !defined (VBOX_WITH_XPCOM) 701 724 , public ISupportErrorInfo … … 711 734 712 735 public: 713 VirtualBoxBase(); 714 virtual ~VirtualBoxBase(); 736 DECLARE_COMMON_CLASS_METHODS(VirtualBoxBase) 715 737 716 738 /** … … 767 789 static HRESULT handleUnexpectedExceptions(VirtualBoxBase *const aThis, RT_SRC_POS_DECL); 768 790 769 static HRESULT setErrorInternal(HRESULT aResultCode, 770 const GUID &aIID, 771 const char *aComponent, 772 Utf8Str aText, 773 bool aWarning, 774 bool aLogIt, 775 LONG aResultDetail = 0); 791 static HRESULT setErrorInternalF(HRESULT aResultCode, 792 const GUID &aIID, 793 const char *aComponent, 794 bool aWarning, 795 bool aLogIt, 796 LONG aResultDetail, 797 const char *aText, ...); 798 static HRESULT setErrorInternalV(HRESULT aResultCode, 799 const GUID &aIID, 800 const char *aComponent, 801 const char *aText, 802 va_list aArgs, 803 bool aWarning, 804 bool aLogIt, 805 LONG aResultDetail = 0); 776 806 static void clearError(void); 777 807 -
trunk/src/VBox/Main/include/VirtualBoxClientImpl.h
r82968 r90828 24 24 #include "VirtualBoxClientWrap.h" 25 25 #include "EventImpl.h" 26 #include "VirtualBoxTranslator.h" 26 27 27 28 #ifdef RT_OS_WINDOWS … … 101 102 RTTHREAD m_ThreadWatcher; 102 103 RTSEMEVENT m_SemEvWatcher; 104 #ifdef VBOX_WITH_MAIN_NLS 105 VirtualBoxTranslator *m_pVBoxTranslator; 106 #endif 103 107 }; 104 108 … … 110 114 * m_pEventSource and is decremented by the Data destructor (above). */ 111 115 static LONG s_cUnnecessaryAtlModuleLocks; 116 117 #ifdef VBOX_WITH_MAIN_NLS 118 HRESULT i_reloadApiLanguage(); 119 HRESULT i_registerEventListener(); 120 #endif 112 121 }; 113 122 -
trunk/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h
r82968 r90828 31 31 #ifndef VBOX_WITH_XPCOM /* IErrorInfo doesn't inherit from IDispatch, ugly 3am hack: */ 32 32 , public IDispatch 33 , public VirtualBoxTranslatable 33 34 #endif 34 35 { … … 45 46 COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler) 46 47 END_COM_MAP() 48 49 DECLARE_TRANSLATE_METHODS(VirtualBoxErrorInfo) 47 50 48 51 HRESULT FinalConstruct() … … 139 142 STDMETHOD(COMGETTER(Next))(IVirtualBoxErrorInfo **aNext); 140 143 144 const char* getComponentName() const { return "VirtualBoxErrorInfo"; } 145 141 146 private: 142 // FIXME: declare these here until VBoxSupportsTranslation base143 // is available in this class.144 static const char *tr(const char *a) { return a; }145 147 static HRESULT setError(HRESULT rc, 146 148 const char * /* a */, -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r90440 r90828 112 112 113 113 // to postpone generation of the default ctor/dtor 114 DECLARE_ EMPTY_CTOR_DTOR(VirtualBox)114 DECLARE_COMMON_CLASS_METHODS(VirtualBox) 115 115 116 116 HRESULT FinalConstruct(); … … 201 201 202 202 void i_onProgressCreated(const Guid &aId, BOOL aCreated); 203 204 void i_onLanguageChanged(const Utf8Str &aLanguageId); 203 205 204 206 #ifdef VBOX_WITH_CLOUD_NET … … 395 397 ComPtr<IProgress> &aProgressObject); 396 398 397 static HRESULT i_setErrorStaticBoth(HRESULT aResultCode, int vrc, const Utf8Str &aText)399 static HRESULT i_setErrorStaticBoth(HRESULT aResultCode, int vrc, const char *aText, ...) 398 400 { 399 return setErrorInternal(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, false, true, vrc); 401 va_list va; 402 va_start (va, aText); 403 HRESULT hrc = setErrorInternalV(aResultCode, getStaticClassIID(), getStaticComponentName(), aText, va, false, true, vrc); 404 va_end(va); 405 return hrc; 400 406 } 401 407 -
trunk/src/VBox/Main/include/VirtualBoxSDSImpl.h
r82968 r90828 83 83 END_COM_MAP() 84 84 85 DECLARE_ EMPTY_CTOR_DTOR(VirtualBoxSDS)85 DECLARE_COMMON_CLASS_METHODS(VirtualBoxSDS) 86 86 87 87 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/src-all/QMTranslatorImpl.cpp
r85212 r90828 23 23 #include <iprt/file.h> 24 24 #include <iprt/asm.h> 25 #include <iprt/string.h> 26 #include <iprt/strcache.h> 25 27 #include <VBox/com/string.h> 26 28 #include <VBox/log.h> … … 47 49 class QMBytesStream 48 50 { 49 size_t m_cbSize;51 size_t m_cbSize; 50 52 const uint8_t * const m_dataStart; 51 53 const uint8_t *m_iter; 52 54 const uint8_t *m_end; 53 54 /* Function stub for transform method */55 static uint16_t func_BE2H_U16(uint16_t value)56 {57 return RT_BE2H_U16(value);58 }59 55 60 56 public: … … 94 90 uint32_t size = read32(); 95 91 checkSize(size); 96 if (size & 1) throw QMException("Incorrect string size"); 97 std::vector<uint16_t> wstr; 98 wstr.reserve(size / 2); 99 100 /* We cannot convert to host endianess without copying the data 101 * since the file might be mapped to the memory and any memory 102 * change will lead to the change of the file. */ 103 std::transform(reinterpret_cast<const uint16_t *>(m_iter), 104 reinterpret_cast<const uint16_t *>(m_iter + size), 105 std::back_inserter(wstr), 106 func_BE2H_U16); 92 if (size & 1) 93 throw QMException("Incorrect string size"); 94 95 /* UTF-16 can encode up to codepoint U+10ffff, which UTF-8 needs 4 bytes 96 to encode, so reserve twice the size plus a terminator for the result. */ 97 com::Utf8Str result; 98 result.reserve(size * 2 + 1); 99 char *pszStr = result.mutableRaw(); 100 int rc = RTUtf16BigToUtf8Ex((PCRTUTF16)m_iter, size >> 1, &pszStr, result.capacity(), NULL); 101 if (RT_SUCCESS(rc)) 102 result.jolt(); 103 else 104 throw QMException("Translation from UTF-16 to UTF-8 failed"); 105 107 106 m_iter += size; 108 return com::Utf8Str((CBSTR) &wstr.front(), wstr.size()); 109 } 110 111 /** Reads string in one-byte encoding. 112 * The string is assumed to be in ISO-8859-1 encoding */ 107 return result; 108 } 109 110 /** 111 * Reads a string, forcing UTF-8 encoding. 112 */ 113 113 inline com::Utf8Str readString() 114 114 { 115 115 uint32_t size = read32(); 116 116 checkSize(size); 117 117 118 com::Utf8Str result(reinterpret_cast<const char *>(m_iter), size); 119 if (size > 0) 120 { 121 RTStrPurgeEncoding(result.mutableRaw()); 122 result.jolt(); 123 } 124 118 125 m_iter += size; 119 126 return result; 127 } 128 129 /** 130 * Reads memory block 131 * Returns number of bytes read 132 */ 133 inline uint32_t read(char *bBuf, uint32_t cbSize) 134 { 135 if (!bBuf || !cbSize) 136 return 0; 137 cbSize = RT_MIN(cbSize, (uint32_t)(m_end - m_iter)); 138 memcpy(bBuf, m_iter, cbSize); 139 m_iter += cbSize; 140 return cbSize; 120 141 } 121 142 … … 148 169 { 149 170 size_t cbLeft = (size_t)(m_end - m_iter); 150 if (cbLeft <= offSkip)171 if (cbLeft >= offSkip) 151 172 m_iter += offSkip; 152 173 else … … 166 187 class QMTranslator_Impl 167 188 { 168 struct QMMessage 189 /** Used while parsing */ 190 struct QMMessageParse 169 191 { 170 192 /* Everything is in UTF-8 */ 193 std::vector<com::Utf8Str> astrTranslations; 171 194 com::Utf8Str strContext; 172 com::Utf8Str strTranslation;173 195 com::Utf8Str strComment; 174 196 com::Utf8Str strSource; 175 uint32_t hash; 176 QMMessage() : hash(0) {} 197 198 QMMessageParse() {} 199 }; 200 201 struct QMMessage 202 { 203 const char *pszContext; 204 const char *pszSource; 205 const char *pszComment; 206 std::vector<const char *> vecTranslations; 207 uint32_t hash; 208 209 QMMessage() : pszContext(NULL), pszSource(NULL), pszComment(NULL), hash(0) 210 {} 211 212 QMMessage(RTSTRCACHE hStrCache, const QMMessageParse &rSrc) 213 : pszContext(addStr(hStrCache, rSrc.strContext)) 214 , pszSource(addStr(hStrCache, rSrc.strSource)) 215 , pszComment(addStr(hStrCache, rSrc.strComment)) 216 , hash(RTStrHash1(pszSource)) 217 { 218 for (size_t i = 0; i < rSrc.astrTranslations.size(); i++) 219 vecTranslations.push_back(addStr(hStrCache, rSrc.astrTranslations[i])); 220 } 221 222 /** Helper. */ 223 static const char *addStr(RTSTRCACHE hStrCache, const com::Utf8Str &rSrc) 224 { 225 if (rSrc.isNotEmpty()) 226 { 227 const char *psz = RTStrCacheEnterN(hStrCache, rSrc.c_str(), rSrc.length()); 228 if (RT_LIKELY(psz)) 229 return psz; 230 throw std::bad_alloc(); 231 } 232 return NULL; 233 } 234 177 235 }; 178 236 … … 182 240 uint32_t offset; 183 241 184 HashOffset(uint32_t _hash = 0, uint32_t _offs = 0) : hash(_hash), offset(_offs) {}242 HashOffset(uint32_t a_hash = 0, uint32_t a_offs = 0) : hash(a_hash), offset(a_offs) {} 185 243 186 244 bool operator<(const HashOffset &obj) const … … 194 252 typedef QMHashSet::const_iterator QMHashSetConstIter; 195 253 typedef std::vector<QMMessage> QMMessageArray; 196 197 QMHashSet m_hashSet; 254 typedef std::vector<uint8_t> QMByteArray; 255 256 QMHashSet m_hashSet; 198 257 QMMessageArray m_messageArray; 258 QMByteArray m_pluralRules; 199 259 200 260 public: 201 261 202 262 QMTranslator_Impl() {} 263 264 enum PluralOpCodes 265 { 266 Pl_Eq = 0x01, 267 Pl_Lt = 0x02, 268 Pl_Leq = 0x03, 269 Pl_Between = 0x04, 270 271 Pl_OpMask = 0x07, 272 273 Pl_Not = 0x08, 274 Pl_Mod10 = 0x10, 275 Pl_Mod100 = 0x20, 276 Pl_Lead1000 = 0x40, 277 278 Pl_And = 0xFD, 279 Pl_Or = 0xFE, 280 Pl_NewRule = 0xFF, 281 282 Pl_LMask = 0x80, 283 }; 284 285 /* 286 * Rules format: 287 * <O><2>[<3>][<&&><O><2>[<3>]]...[<||><O><2>[<3>][<&&><O><2>[<3>]]...]...[<New><O>...]... 288 * where: 289 * <O> - OpCode 290 * <2> - Second operand 291 * <3> - Third operand 292 * <&&> - 'And' operation 293 * <||> - 'Or' operation 294 * <New> - Start of rule for next plural form 295 * Rules are ordered by plural forms, i.e: 296 * <rule for first form (i.e. single)><New><rule for next form>... 297 */ 298 bool checkPlural(const QMByteArray &aRules) const 299 { 300 if (aRules.empty()) 301 return true; 302 303 uint32_t iPos = 0; 304 do { 305 uint8_t bOpCode = aRules[iPos]; 306 307 /* Invalid place of And/Or/NewRule */ 308 if (bOpCode & Pl_LMask) 309 return false; 310 311 /* 2nd operand */ 312 iPos++; 313 314 /* 2nd operand missing */ 315 if (iPos == aRules.size()) 316 return false; 317 318 /* Invalid OpCode */ 319 if ((bOpCode & Pl_OpMask) == 0) 320 return false; 321 322 if ((bOpCode & Pl_OpMask) == Pl_Between) 323 { 324 /* 3rd operand */ 325 iPos++; 326 327 /* 3rd operand missing */ 328 if (iPos == aRules.size()) 329 return false; 330 } 331 332 /* And/Or/NewRule */ 333 iPos++; 334 335 /* All rules checked */ 336 if (iPos == aRules.size()) 337 return true; 338 339 } while ( ( (aRules[iPos] == Pl_And) 340 || (aRules[iPos] == Pl_Or) 341 || (aRules[iPos] == Pl_NewRule)) 342 && ++iPos != aRules.size()); 343 344 return false; 345 } 346 347 int plural(int aNum) const 348 { 349 if (aNum < 1 || m_pluralRules.empty()) 350 return 0; 351 352 int iPluralNumber = 0; 353 uint32_t iPos = 0; 354 355 /* Rules loop */ 356 for (;;) 357 { 358 bool fOr = false; 359 /* 'Or' loop */ 360 for (;;) 361 { 362 bool fAnd = true; 363 /* 'And' loop */ 364 for (;;) 365 { 366 int iOpCode = m_pluralRules[iPos++]; 367 int iOpLeft = aNum; 368 if (iOpCode & Pl_Mod10) 369 iOpLeft %= 10; 370 else if (iOpCode & Pl_Mod100) 371 iOpLeft %= 100; 372 else if (iOpLeft & Pl_Lead1000) 373 { 374 while (iOpLeft >= 1000) 375 iOpLeft /= 1000; 376 } 377 int iOpRight = m_pluralRules[iPos++]; 378 int iOp = iOpCode & Pl_OpMask; 379 int iOpRight1 = 0; 380 if (iOp == Pl_Between) 381 iOpRight1 = m_pluralRules[iPos++]; 382 383 bool fResult = (iOp == Pl_Eq && iOpLeft == iOpRight) 384 || (iOp == Pl_Lt && iOpLeft < iOpRight) 385 || (iOp == Pl_Leq && iOpLeft <= iOpRight) 386 || (iOp == Pl_Between && iOpLeft >= iOpRight && iOpLeft <= iOpRight1); 387 if (iOpCode & Pl_Not) 388 fResult = !fResult; 389 390 fAnd = fAnd && fResult; 391 if (iPos == m_pluralRules.size() || m_pluralRules[iPos] != Pl_And) 392 break; 393 iPos++; 394 } 395 fOr = fOr || fAnd; 396 if (iPos == m_pluralRules.size() || m_pluralRules[iPos] != Pl_Or) 397 break; 398 iPos++; 399 } 400 if (fOr) 401 return iPluralNumber; 402 403 /* Qt returns last plural number if none of rules are match. */ 404 iPluralNumber++; 405 406 if (iPos >= m_pluralRules.size()) 407 return iPluralNumber; 408 409 iPos++; // Skip Pl_NewRule 410 } 411 } 203 412 204 413 const char *translate(const char *pszContext, 205 414 const char *pszSource, 206 const char *pszDisamb) const 415 const char *pszDisamb, 416 const int aNum) const 207 417 { 208 418 QMHashSetConstIter iter; 209 419 QMHashSetConstIter lowerIter, upperIter; 210 420 211 do { 212 uint32_t hash = calculateHash(pszSource, pszDisamb); 213 lowerIter = m_hashSet.lower_bound(HashOffset(hash, 0)); 214 upperIter = m_hashSet.upper_bound(HashOffset(hash, UINT32_MAX)); 215 421 /* As turned out, comments (pszDisamb) are not kept always in result qm file 422 * Therefore, exclude them from the hash */ 423 uint32_t hash = RTStrHash1(pszSource); 424 lowerIter = m_hashSet.lower_bound(HashOffset(hash, 0)); 425 upperIter = m_hashSet.upper_bound(HashOffset(hash, UINT32_MAX)); 426 427 /* 428 * Check different combinations with and without context and 429 * disambiguation. This can help us to find the translation even 430 * if context or disambiguation are not know or properly defined. 431 */ 432 const char *apszCtx[] = {pszContext, pszContext, NULL, NULL}; 433 const char *apszDisabm[] = {pszDisamb, NULL, pszDisamb, NULL}; 434 AssertCompile(RT_ELEMENTS(apszCtx) == RT_ELEMENTS(apszDisabm)); 435 436 for (size_t i = 0; i < RT_ELEMENTS(apszCtx); ++i) 437 { 216 438 for (iter = lowerIter; iter != upperIter; ++iter) 217 439 { 218 440 const QMMessage &message = m_messageArray[iter->offset]; 219 if ((!pszContext || !*pszContext || message.strContext == pszContext) && 220 message.strSource == pszSource && 221 ((pszDisamb && !*pszDisamb) || message.strComment == pszDisamb)) 222 break; 441 if ( RTStrCmp(message.pszSource, pszSource) == 0 442 && (!apszCtx[i] || !*apszCtx[i] || RTStrCmp(message.pszContext, apszCtx[i]) == 0) 443 && (!apszDisabm[i] || !*apszDisabm[i] || RTStrCmp(message.pszComment, apszDisabm[i]) == 0 )) 444 { 445 const std::vector<const char *> &vecTranslations = m_messageArray[iter->offset].vecTranslations; 446 size_t idxPlural = plural(aNum); 447 return vecTranslations[RT_MIN(idxPlural, vecTranslations.size() - 1)]; 448 } 223 449 } 224 225 /* Try without disambiguating comment if it isn't empty */ 226 if (pszDisamb) 227 { 228 if (!*pszDisamb) pszDisamb = 0; 229 else pszDisamb = ""; 230 } 231 232 } while (iter == upperIter && pszDisamb); 233 234 return (iter != upperIter ? m_messageArray[iter->offset].strTranslation.c_str() : ""); 235 } 236 237 void load(QMBytesStream &stream) 450 } 451 452 return pszSource; 453 } 454 455 void load(QMBytesStream &stream, RTSTRCACHE hStrCache) 238 456 { 239 457 /* Load into local variables. If we failed during the load, … … 241 459 QMHashSet hashSet; 242 460 QMMessageArray messageArray; 461 QMByteArray pluralRules; 243 462 244 463 stream.checkMagic(); … … 255 474 { 256 475 case Messages: 257 parseMessages(stream, &hashSet, &messageArray, sLen);476 parseMessages(stream, hStrCache, &hashSet, &messageArray, sLen); 258 477 break; 259 478 case Hashes: 260 479 /* Only get size information to speed-up vector filling 261 480 * if Hashes section goes in the file before Message section */ 262 m_messageArray.reserve(sLen >> 3); 263 RT_FALL_THRU(); 264 case Context: 481 if (messageArray.empty()) 482 messageArray.reserve(sLen >> 3); 483 stream.seek(sLen); 484 break; 485 case NumerusRules: 486 { 487 pluralRules.resize(sLen); 488 uint32_t cbSize = stream.read((char *)&pluralRules[0], sLen); 489 if (cbSize < sLen) 490 throw QMException("Incorrect section size"); 491 if (!checkPlural(pluralRules)) 492 pluralRules.erase(pluralRules.begin(), pluralRules.end()); 493 break; 494 } 495 case Contexts: 496 case Dependencies: 497 case Language: 265 498 stream.seek(sLen); 266 499 break; … … 269 502 } 270 503 } 504 271 505 /* Store the data into member variables. 272 506 * The following functions never generate exceptions */ 273 507 m_hashSet.swap(hashSet); 274 508 m_messageArray.swap(messageArray); 509 m_pluralRules.swap(pluralRules); 275 510 } 276 511 … … 280 515 enum SectionType 281 516 { 282 Hashes = 0x42, 283 Messages = 0x69, 284 Contexts = 0x2f 517 Contexts = 0x2f, 518 Hashes = 0x42, 519 Messages = 0x69, 520 NumerusRules = 0x88, 521 Dependencies = 0x96, 522 Language = 0xa7 285 523 }; 286 524 … … 291 529 Translation = 3, 292 530 Context16 = 4, 293 Hash = 5,531 Obsolete1 = 5, /**< was Hash */ 294 532 SourceText = 6, 295 533 Context = 7, … … 298 536 299 537 /* Read messages from the stream. */ 300 static void parseMessages(QMBytesStream &stream, QMHashSet * const hashSet, QMMessageArray * const messageArray, size_t cbSize) 538 static void parseMessages(QMBytesStream &stream, RTSTRCACHE hStrCache, QMHashSet * const hashSet, 539 QMMessageArray * const messageArray, size_t cbSize) 301 540 { 302 541 stream.setEnd(stream.tellPos() + cbSize); … … 304 543 while (!stream.hasFinished()) 305 544 { 306 QMMessage message; 307 HashOffset hashOffs; 308 309 parseMessageRecord(stream, &message); 310 if (!message.hash) 311 message.hash = calculateHash(message.strSource.c_str(), message.strComment.c_str()); 312 313 hashOffs.hash = message.hash; 314 hashOffs.offset = cMessage++; 315 316 hashSet->insert(hashOffs); 317 messageArray->push_back(message); 545 /* Process the record. Skip anything that doesn't have a source 546 string or any valid translations. Using C++ strings for temporary 547 storage here, as we don't want to pollute the cache we bogus strings 548 in case of duplicate sub-records or invalid records. */ 549 QMMessageParse ParsedMsg; 550 parseMessageRecord(stream, &ParsedMsg); 551 if ( ParsedMsg.astrTranslations.size() > 0 552 && ParsedMsg.strSource.isNotEmpty()) 553 { 554 /* Copy the strings over into the string cache and a hashed QMMessage, 555 before adding it to the result. */ 556 QMMessage HashedMsg(hStrCache, ParsedMsg); 557 hashSet->insert(HashOffset(HashedMsg.hash, cMessage++)); 558 messageArray->push_back(HashedMsg); 559 560 } 561 /*else: wtf? */ 318 562 } 319 563 stream.setEnd(); … … 321 565 322 566 /* Parse one message from the stream */ 323 static void parseMessageRecord(QMBytesStream &stream, QMMessage * const message)567 static void parseMessageRecord(QMBytesStream &stream, QMMessageParse * const message) 324 568 { 325 569 while (!stream.hasFinished()) … … 336 580 break; 337 581 case Translation: 338 { 339 com::Utf8Str str = stream.readUtf16String(); 340 message->strTranslation.swap(str); 341 break; 342 } 343 case Hash: 344 message->hash = stream.read32(); 582 message->astrTranslations.push_back(stream.readUtf16String()); 345 583 break; 346 584 347 585 case SourceText: 348 { 349 com::Utf8Str str = stream.readString(); 350 message->strSource.swap(str); 351 break; 352 } 586 message->strSource = stream.readString(); 587 break; 353 588 354 589 case Context: 355 { 356 com::Utf8Str str = stream.readString(); 357 message->strContext.swap(str); 358 break; 359 } 590 message->strContext = stream.readString(); 591 break; 360 592 361 593 case Comment: 362 { 363 com::Utf8Str str = stream.readString(); 364 message->strComment.swap(str); 365 break; 366 } 594 message->strComment = stream.readString(); 595 break; 367 596 368 597 default: 369 /* Ignore unknown block */370 LogRel(("QMTranslator::parseMessageRecord(): Unk ownmessage block %x\n", type));598 /* Ignore unknown/obsolete block */ 599 LogRel(("QMTranslator::parseMessageRecord(): Unknown/obsolete message block %x\n", type)); 371 600 break; 372 601 } 373 602 } 374 603 } 375 376 /* Defines the so called `hashpjw' function by P.J. Weinberger377 [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,378 1986, 1987 Bell Telephone Laboratories, Inc.] */379 static uint32_t calculateHash(const char *pszStr1, const char *pszStr2 = 0)380 {381 uint32_t hash = 0, g;382 383 for (const char *pszStr = pszStr1; pszStr != pszStr2; pszStr = pszStr2)384 for (; pszStr && *pszStr; pszStr++)385 {386 hash = (hash << 4) + static_cast<uint8_t>(*pszStr);387 388 if ((g = hash & 0xf0000000ul) != 0)389 {390 hash ^= g >> 24;391 hash ^= g;392 }393 }394 395 return (hash != 0 ? hash : 1);396 }397 604 }; 398 605 399 606 /* Inteface functions implementation */ 400 QMTranslator::QMTranslator() : _impl(new QMTranslator_Impl) {} 401 402 QMTranslator::~QMTranslator() { delete _impl; } 403 404 const char *QMTranslator::translate(const char *pszContext, const char *pszSource, const char *pszDisamb) const throw() 607 QMTranslator::QMTranslator() : m_impl(new QMTranslator_Impl) {} 608 609 QMTranslator::~QMTranslator() { delete m_impl; } 610 611 const char *QMTranslator::translate(const char *pszContext, const char *pszSource, 612 const char *pszDisamb, const int aNum) const throw() 405 613 { 406 return _impl->translate(pszContext, pszSource, pszDisamb);614 return m_impl->translate(pszContext, pszSource, pszDisamb, aNum); 407 615 } 408 616 409 /* The function is noexcept for now but it may be changed 410 * to throw exceptions if required to catch them in another 411 * place. */ 412 int QMTranslator::load(const char *pszFilename) throw() 617 int QMTranslator::load(const char *pszFilename, RTSTRCACHE hStrCache) RT_NOEXCEPT 413 618 { 414 619 /* To free safely the file in case of exception */ … … 437 642 { 438 643 QMBytesStream stream(loader.data, loader.cbSize); 439 _impl->load(stream);644 m_impl->load(stream, hStrCache); 440 645 } 441 646 return loader.rc; -
trunk/src/VBox/Main/src-all/TextScript.cpp
r82968 r90828 53 53 } 54 54 else 55 hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("Failed to open '%s' (%Rrc)"), rStrFilename.c_str(), vrc);55 hrc = mpSetError->setErrorVrc(vrc, tr("Failed to open '%s' (%Rrc)"), rStrFilename.c_str(), vrc); 56 56 return hrc; 57 57 } … … 94 94 } 95 95 96 hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("'%s' isn't valid UTF-8: %Rrc"), pszFilename, vrc);96 hrc = mpSetError->setErrorVrc(vrc, tr("'%s' isn't valid UTF-8: %Rrc"), pszFilename, vrc); 97 97 } 98 98 else 99 hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("Error reading '%s': %Rrc"), pszFilename, vrc);99 hrc = mpSetError->setErrorVrc(vrc, tr("Error reading '%s': %Rrc"), pszFilename, vrc); 100 100 mStrScriptFullContent.setNull(); 101 101 } 102 102 else 103 hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("Failed to allocate memory (%'RU64 bytes) for '%s'"),103 hrc = mpSetError->setErrorVrc(vrc, tr("Failed to allocate memory (%'RU64 bytes) for '%s'"), 104 104 cbFile, pszFilename); 105 105 } 106 106 else if (RT_SUCCESS(vrc)) 107 hrc = mpSetError->setErrorVrc(VERR_FILE_TOO_BIG, 108 mpSetError->tr("'%s' is too big (max 16MB): %'RU64"), pszFilename, cbFile); 107 hrc = mpSetError->setErrorVrc(VERR_FILE_TOO_BIG, tr("'%s' is too big (max 16MB): %'RU64"), pszFilename, cbFile); 109 108 else 110 hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("RTVfsFileQuerySize failed (%Rrc)"), vrc);109 hrc = mpSetError->setErrorVrc(vrc, tr("RTVfsFileQuerySize failed (%Rrc)"), vrc); 111 110 return hrc; 112 111 } … … 179 178 RTFileClose(hFile); 180 179 RTFileDelete(pszFilename); 181 hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("Error writing to '%s' (%Rrc)"), pszFilename, vrc);180 hrc = mpSetError->setErrorVrc(vrc, tr("Error writing to '%s' (%Rrc)"), pszFilename, vrc); 182 181 } 183 182 else 184 hrc = mpSetError->setErrorVrc(vrc, mpSetError->tr("Error creating/replacing '%s' (%Rrc)"), pszFilename, vrc);183 hrc = mpSetError->setErrorVrc(vrc, tr("Error creating/replacing '%s' (%Rrc)"), pszFilename, vrc); 185 184 } 186 185 return hrc; -
trunk/src/VBox/Main/src-all/VirtualBoxBase.cpp
r83787 r90828 34 34 #include "AutoCaller.h" 35 35 #include "VirtualBoxErrorInfoImpl.h" 36 #include "VirtualBoxTranslator.h" 36 37 #include "Global.h" 37 38 #include "LoggingNew.h" … … 226 227 catch (const RTCError &err) // includes all XML exceptions 227 228 { 228 return setErrorInternal (E_FAIL, aThis->getClassIID(), aThis->getComponentName(),229 Utf8StrFmt(tr("%s.\n%s[%d] (%s)"),230 err.what(),231 pszFile, iLine, pszFunction).c_str(),232 false /* aWarning */,233 true /* aLogIt */);229 return setErrorInternalF(E_FAIL, aThis->getClassIID(), aThis->getComponentName(), 230 false /* aWarning */, 231 true /* aLogIt */, 232 0 /* aResultDetail */, 233 tr("%s.\n%s[%d] (%s)"), 234 err.what(), pszFile, iLine, pszFunction); 234 235 } 235 236 catch (const std::exception &err) 236 237 { 237 return setErrorInternal (E_FAIL, aThis->getClassIID(), aThis->getComponentName(),238 Utf8StrFmt(tr("Unexpected exception: %s [%s]\n%s[%d] (%s)"),239 err.what(), typeid(err).name(),240 pszFile, iLine, pszFunction).c_str(),241 false /* aWarning */,242 true /* aLogIt */);238 return setErrorInternalF(E_FAIL, aThis->getClassIID(), aThis->getComponentName(), 239 false /* aWarning */, 240 true /* aLogIt */, 241 0 /* aResultDetail */, 242 tr("Unexpected exception: %s [%s]\n%s[%d] (%s)"), 243 err.what(), typeid(err).name(), pszFile, iLine, pszFunction); 243 244 } 244 245 catch (...) 245 246 { 246 return setErrorInternal(E_FAIL, aThis->getClassIID(), aThis->getComponentName(), 247 Utf8StrFmt(tr("Unknown exception\n%s[%d] (%s)"), 248 pszFile, iLine, pszFunction).c_str(), 249 false /* aWarning */, 250 true /* aLogIt */); 247 return setErrorInternalF(E_FAIL, aThis->getClassIID(), aThis->getComponentName(), 248 false /* aWarning */, 249 true /* aLogIt */, 250 0 /* aResultDetail */, 251 tr("Unknown exception\n%s[%d] (%s)"), 252 pszFile, iLine, pszFunction); 251 253 } 252 254 … … 257 259 #endif 258 260 } 261 259 262 260 263 /** … … 266 269 * than an error. 267 270 * 271 * @param aResultCode 272 * @param aIID 273 * @param aComponent 274 * @param aWarning 275 * @param aLogIt 276 * @param aResultDetail 277 * @param aText 278 */ 279 /* static */ 280 HRESULT VirtualBoxBase::setErrorInternalF(HRESULT aResultCode, 281 const GUID &aIID, 282 const char *aComponent, 283 bool aWarning, 284 bool aLogIt, 285 LONG aResultDetail, 286 const char *aText, ...) 287 { 288 va_list va; 289 va_start(va, aText); 290 HRESULT hres = setErrorInternalV(aResultCode, aIID, aComponent, aText, va, 291 aWarning, aLogIt, aResultDetail); 292 va_end(va); 293 return hres; 294 } 295 296 /** 297 * Sets error info for the current thread. This is an internal function that 298 * gets eventually called by all public variants. If @a aWarning is 299 * @c true, then the highest (31) bit in the @a aResultCode value which 300 * indicates the error severity is reset to zero to make sure the receiver will 301 * recognize that the created error info object represents a warning rather 302 * than an error. 303 * 268 304 * @param aResultCode 269 305 * @param aIID 270 306 * @param pcszComponent 271 307 * @param aText 308 * @param va 272 309 * @param aWarning 273 310 * @param aLogIt … … 275 312 */ 276 313 /* static */ 277 HRESULT VirtualBoxBase::setErrorInternal(HRESULT aResultCode, 278 const GUID &aIID, 279 const char *pcszComponent, 280 Utf8Str aText, 281 bool aWarning, 282 bool aLogIt, 283 LONG aResultDetail /* = 0*/) 314 HRESULT VirtualBoxBase::setErrorInternalV(HRESULT aResultCode, 315 const GUID &aIID, 316 const char *aComponent, 317 const char *aText, 318 va_list aArgs, 319 bool aWarning, 320 bool aLogIt, 321 LONG aResultDetail /* = 0*/) 284 322 { 285 323 /* whether multi-error mode is turned on */ 286 324 bool preserve = MultiResult::isMultiEnabled(); 287 325 326 com::Utf8Str strText; 288 327 if (aLogIt) 289 LogRel(("%s [COM]: aRC=%Rhrc (%#08x) aIID={%RTuuid} aComponent={%s} aText={%s}, preserve=%RTbool aResultDetail=%d\n", 328 { 329 strText = trSource(aText); 330 va_list va2; 331 va_copy(va2, aArgs); 332 LogRel(("%s [COM]: aRC=%Rhrc (%#08x) aIID={%RTuuid} aComponent={%s} aText={%N}, preserve=%RTbool aResultDetail=%d\n", 290 333 aWarning ? "WARNING" : "ERROR", 291 334 aResultCode, 292 335 aResultCode, 293 336 &aIID, 294 pcszComponent, 295 aText.c_str(), 337 aComponent, 338 strText.c_str(), 339 &va2, 296 340 preserve, 297 341 aResultDetail)); 342 va_end(va2); 343 } 298 344 299 345 /* these are mandatory, others -- not */ … … 308 354 HRESULT rc = S_OK; 309 355 310 if (aText .isEmpty())356 if (aText == NULL || aText[0] == '\0') 311 357 { 312 358 /* Some default info */ 313 359 switch (aResultCode) 314 360 { 315 case E_INVALIDARG: aText = "A parameter has an invalid value"; break; 316 case E_POINTER: aText = "A parameter is an invalid pointer"; break; 317 case E_UNEXPECTED: aText = "The result of the operation is unexpected"; break; 318 case E_ACCESSDENIED: aText = "The access to an object is not allowed"; break; 319 case E_OUTOFMEMORY: aText = "The allocation of new memory failed"; break; 320 case E_NOTIMPL: aText = "The requested operation is not implemented"; break; 321 case E_NOINTERFACE: aText = "The requested interface is not implemented"; break; 322 case E_FAIL: aText = "A general error occurred"; break; 323 case E_ABORT: aText = "The operation was canceled"; break; 324 case VBOX_E_OBJECT_NOT_FOUND: aText = "Object corresponding to the supplied arguments does not exist"; break; 325 case VBOX_E_INVALID_VM_STATE: aText = "Current virtual machine state prevents the operation"; break; 326 case VBOX_E_VM_ERROR: aText = "Virtual machine error occurred attempting the operation"; break; 327 case VBOX_E_FILE_ERROR: aText = "File not accessible or erroneous file contents"; break; 328 case VBOX_E_IPRT_ERROR: aText = "Runtime subsystem error"; break; 329 case VBOX_E_PDM_ERROR: aText = "Pluggable Device Manager error"; break; 330 case VBOX_E_INVALID_OBJECT_STATE: aText = "Current object state prohibits operation"; break; 331 case VBOX_E_HOST_ERROR: aText = "Host operating system related error"; break; 332 case VBOX_E_NOT_SUPPORTED: aText = "Requested operation is not supported"; break; 333 case VBOX_E_XML_ERROR: aText = "Invalid XML found"; break; 334 case VBOX_E_INVALID_SESSION_STATE: aText = "Current session state prohibits operation"; break; 335 case VBOX_E_OBJECT_IN_USE: aText = "Object being in use prohibits operation"; break; 336 case VBOX_E_PASSWORD_INCORRECT: aText = "Incorrect password provided"; break; 337 default: aText = "Unknown error"; break; 338 } 361 case E_INVALIDARG: strText = "A parameter has an invalid value"; break; 362 case E_POINTER: strText = "A parameter is an invalid pointer"; break; 363 case E_UNEXPECTED: strText = "The result of the operation is unexpected"; break; 364 case E_ACCESSDENIED: strText = "The access to an object is not allowed"; break; 365 case E_OUTOFMEMORY: strText = "The allocation of new memory failed"; break; 366 case E_NOTIMPL: strText = "The requested operation is not implemented"; break; 367 case E_NOINTERFACE: strText = "The requested interface is not implemented"; break; 368 case E_FAIL: strText = "A general error occurred"; break; 369 case E_ABORT: strText = "The operation was canceled"; break; 370 case VBOX_E_OBJECT_NOT_FOUND: strText = "Object corresponding to the supplied arguments does not exist"; break; 371 case VBOX_E_INVALID_VM_STATE: strText = "Current virtual machine state prevents the operation"; break; 372 case VBOX_E_VM_ERROR: strText = "Virtual machine error occurred attempting the operation"; break; 373 case VBOX_E_FILE_ERROR: strText = "File not accessible or erroneous file contents"; break; 374 case VBOX_E_IPRT_ERROR: strText = "Runtime subsystem error"; break; 375 case VBOX_E_PDM_ERROR: strText = "Pluggable Device Manager error"; break; 376 case VBOX_E_INVALID_OBJECT_STATE: strText = "Current object state prohibits operation"; break; 377 case VBOX_E_HOST_ERROR: strText = "Host operating system related error"; break; 378 case VBOX_E_NOT_SUPPORTED: strText = "Requested operation is not supported"; break; 379 case VBOX_E_XML_ERROR: strText = "Invalid XML found"; break; 380 case VBOX_E_INVALID_SESSION_STATE: strText = "Current session state prohibits operation"; break; 381 case VBOX_E_OBJECT_IN_USE: strText = "Object being in use prohibits operation"; break; 382 case VBOX_E_PASSWORD_INCORRECT: strText = "Incorrect password provided"; break; 383 default: strText = "Unknown error"; break; 384 } 385 } 386 else 387 { 388 va_list va2; 389 va_copy(va2, aArgs); 390 strText = com::Utf8StrFmt("%N", aText, &va2); 391 va_end(va2); 339 392 } 340 393 … … 373 426 374 427 /* set the current error info and preserve the previous one if any */ 375 rc = info->initEx(aResultCode, aResultDetail, aIID, pcszComponent, aText, curInfo);428 rc = info->initEx(aResultCode, aResultDetail, aIID, aComponent, strText, curInfo); 376 429 if (FAILED(rc)) break; 377 430 … … 417 470 418 471 /* set the current error info and preserve the previous one if any */ 419 rc = info->initEx(aResultCode, aResultDetail, aIID, pcszComponent, Bstr(aText), curInfo);472 rc = info->initEx(aResultCode, aResultDetail, aIID, aComponent, Bstr(strText), curInfo); 420 473 if (FAILED(rc)) break; 421 474 … … 459 512 HRESULT VirtualBoxBase::setError(HRESULT aResultCode) 460 513 { 461 return setErrorInternal(aResultCode, 462 this->getClassIID(), 463 this->getComponentName(), 464 "", 465 false /* aWarning */, 466 true /* aLogIt */); 514 return setErrorInternalF(aResultCode, 515 this->getClassIID(), 516 this->getComponentName(), 517 false /* aWarning */, 518 true /* aLogIt */, 519 0 /* aResultDetail */, 520 NULL); 467 521 } 468 522 … … 480 534 va_list args; 481 535 va_start(args, pcsz); 482 HRESULT rc = setErrorInternal (aResultCode,483 this->getClassIID(),484 this->getComponentName(),485 Utf8Str(pcsz, args),486 false /* aWarning */,487 true /* aLogIt */);536 HRESULT rc = setErrorInternalV(aResultCode, 537 this->getClassIID(), 538 this->getComponentName(), 539 pcsz, args, 540 false /* aWarning */, 541 true /* aLogIt */); 488 542 va_end(args); 489 543 return rc; … … 628 682 HRESULT VirtualBoxBase::setErrorVrc(int vrc) 629 683 { 630 return setErrorInternal (Global::vboxStatusCodeToCOM(vrc),631 this->getClassIID(),632 this->getComponentName(),633 Utf8StrFmt("%Rrc", vrc),634 false /* aWarning*/,635 true /* aLogIt*/,636 vrc /* aResultDetail */);684 return setErrorInternalF(Global::vboxStatusCodeToCOM(vrc), 685 this->getClassIID(), 686 this->getComponentName(), 687 false /* aWarning */, 688 true /* aLogIt */, 689 vrc /* aResultDetail */, 690 Utf8StrFmt("%Rrc", vrc).c_str()); 637 691 } 638 692 … … 651 705 va_list va; 652 706 va_start(va, pcszMsgFmt); 653 HRESULT hrc = setErrorInternal (Global::vboxStatusCodeToCOM(vrc),654 this->getClassIID(),655 this->getComponentName(),656 Utf8Str(pcszMsgFmt, va),657 false /* aWarning */,658 true /* aLogIt */,659 vrc /* aResultDetail */);707 HRESULT hrc = setErrorInternalV(Global::vboxStatusCodeToCOM(vrc), 708 this->getClassIID(), 709 this->getComponentName(), 710 pcszMsgFmt, va, 711 false /* aWarning */, 712 true /* aLogIt */, 713 vrc /* aResultDetail */); 660 714 va_end(va); 661 715 return hrc; … … 676 730 HRESULT VirtualBoxBase::setErrorBoth(HRESULT hrc, int vrc) 677 731 { 678 return setErrorInternal (hrc,679 this->getClassIID(),680 this->getComponentName(),681 Utf8StrFmt("%Rrc", vrc),682 false /* aWarning*/,683 true /* aLogIt*/,684 vrc /* aResultDetail */);732 return setErrorInternalF(hrc, 733 this->getClassIID(), 734 this->getComponentName(), 735 false /* aWarning */, 736 true /* aLogIt */, 737 vrc /* aResultDetail */, 738 Utf8StrFmt("%Rrc", vrc).c_str()); 685 739 } 686 740 … … 703 757 va_list va; 704 758 va_start(va, pcszMsgFmt); 705 hrc = setErrorInternal (hrc,706 this->getClassIID(),707 this->getComponentName(),708 Utf8Str(pcszMsgFmt, va),709 false /* aWarning */,710 true /* aLogIt */,711 vrc /* aResultDetail */);759 hrc = setErrorInternalV(hrc, 760 this->getClassIID(), 761 this->getComponentName(), 762 pcszMsgFmt, va, 763 false /* aWarning */, 764 true /* aLogIt */, 765 vrc /* aResultDetail */); 712 766 va_end(va); 713 767 return hrc; … … 724 778 va_list args; 725 779 va_start(args, pcsz); 726 HRESULT rc = setErrorInternal (aResultCode,727 this->getClassIID(),728 this->getComponentName(),729 Utf8Str(pcsz, args),730 true /* aWarning */,731 true /* aLogIt */);780 HRESULT rc = setErrorInternalV(aResultCode, 781 this->getClassIID(), 782 this->getComponentName(), 783 pcsz, args, 784 true /* aWarning */, 785 true /* aLogIt */); 732 786 va_end(args); 733 787 return rc; … … 744 798 va_list args; 745 799 va_start(args, pcsz); 746 HRESULT rc = setErrorInternal (aResultCode,747 this->getClassIID(),748 this->getComponentName(),749 Utf8Str(pcsz, args),750 false /* aWarning */,751 false /* aLogIt */);800 HRESULT rc = setErrorInternalV(aResultCode, 801 this->getClassIID(), 802 this->getComponentName(), 803 pcsz, args, 804 false /* aWarning */, 805 false /* aLogIt */); 752 806 va_end(args); 753 807 return rc; -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r89953 r90828 3222 3222 va_list args; 3223 3223 va_start(args, pcsz); 3224 HRESULT rc = setErrorInternal (aResultCode,3225 getStaticClassIID(),3226 getStaticComponentName(),3227 Utf8Str(pcsz, args),3228 false /* aWarning */,3229 true /* aLogIt */);3224 HRESULT rc = setErrorInternalV(aResultCode, 3225 getStaticClassIID(), 3226 getStaticComponentName(), 3227 pcsz, args, 3228 false /* aWarning */, 3229 true /* aLogIt */); 3230 3230 va_end(args); 3231 3231 return rc; … … 3237 3237 va_list args; 3238 3238 va_start(args, pcsz); 3239 HRESULT rc = setErrorInternal (aResultCode,3240 getStaticClassIID(),3241 getStaticComponentName(),3242 Utf8Str(pcsz, args),3243 false /* aWarning */,3244 true /* aLogIt */,3245 vrc);3239 HRESULT rc = setErrorInternalV(aResultCode, 3240 getStaticClassIID(), 3241 getStaticComponentName(), 3242 pcsz, args, 3243 false /* aWarning */, 3244 true /* aLogIt */, 3245 vrc); 3246 3246 va_end(args); 3247 3247 return rc; … … 3354 3354 mVMStateChangeCallbackDisabled = false; 3355 3355 if (RT_FAILURE(vrc)) 3356 return setErrorInternal (VBOX_E_INVALID_VM_STATE,3357 COM_IIDOF(IConsole),3358 getStaticComponentName(),3359 Utf8StrFmt("Could suspend VM for medium change (%Rrc)", vrc),3360 false /*aWarning*/,3361 true /*aLogIt*/,3362 vrc);3356 return setErrorInternalF(VBOX_E_INVALID_VM_STATE, 3357 COM_IIDOF(IConsole), 3358 getStaticComponentName(), 3359 false /*aWarning*/, 3360 true /*aLogIt*/, 3361 vrc, 3362 tr("Could suspend VM for medium change (%Rrc)"), vrc); 3363 3363 *pfResume = true; 3364 3364 break; … … 3367 3367 break; 3368 3368 default: 3369 return setErrorInternal(VBOX_E_INVALID_VM_STATE, 3370 COM_IIDOF(IConsole), 3371 getStaticComponentName(), 3372 Utf8StrFmt("Invalid state '%s' for changing medium", 3373 VMR3GetStateName(enmVMState)), 3374 false /*aWarning*/, 3375 true /*aLogIt*/); 3369 return setErrorInternalF(VBOX_E_INVALID_VM_STATE, 3370 COM_IIDOF(IConsole), 3371 getStaticComponentName(), 3372 false /*aWarning*/, 3373 true /*aLogIt*/, 3374 0 /* aResultDetail */, 3375 "Invalid state '%s' for changing medium", 3376 VMR3GetStateName(enmVMState)); 3376 3377 } 3377 3378 -
trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
r90790 r90828 3200 3200 if (RT_FAILURE(vrc)) 3201 3201 { 3202 mConsole->setErrorBoth(E_FAIL, vrc, mConsole->tr("Could not load the external authentication library '%s' (%Rrc)"),3202 mConsole->setErrorBoth(E_FAIL, vrc, tr("Could not load the external authentication library '%s' (%Rrc)"), 3203 3203 filename.c_str(), vrc); 3204 3204 return AuthResultAccessDenied; -
trunk/src/VBox/Main/src-client/GuestDnDPrivate.cpp
r85746 r90828 346 346 { 347 347 hr = m_pProgress->init(static_cast<IGuest *>(pParent), 348 Bstr( pParent->tr("Dropping data")).raw(),348 Bstr(tr("Dropping data")).raw(), 349 349 TRUE /* aCancelable */); 350 350 } -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r85300 r90828 2611 2611 { 2612 2612 case VERR_ACCESS_DENIED: 2613 strErr = Utf8StrFmt( Guest::tr("Access to \"%s\" denied"), guestErrorInfo.getWhat().c_str());2613 strErr = Utf8StrFmt(tr("Access to \"%s\" denied"), guestErrorInfo.getWhat().c_str()); 2614 2614 break; 2615 2615 … … 2617 2617 RT_FALL_THROUGH(); 2618 2618 case VERR_PATH_NOT_FOUND: 2619 strErr = Utf8StrFmt( Guest::tr("No such file or directory \"%s\""), guestErrorInfo.getWhat().c_str());2619 strErr = Utf8StrFmt(tr("No such file or directory \"%s\""), guestErrorInfo.getWhat().c_str()); 2620 2620 break; 2621 2621 2622 2622 case VERR_INVALID_VM_HANDLE: 2623 strErr = Utf8StrFmt( Guest::tr("VMM device is not available (is the VM running?)"));2623 strErr = Utf8StrFmt(tr("VMM device is not available (is the VM running?)")); 2624 2624 break; 2625 2625 2626 2626 case VERR_HGCM_SERVICE_NOT_FOUND: 2627 strErr = Utf8StrFmt( Guest::tr("The guest execution service is not available"));2627 strErr = Utf8StrFmt(tr("The guest execution service is not available")); 2628 2628 break; 2629 2629 2630 2630 case VERR_BAD_EXE_FORMAT: 2631 strErr = Utf8StrFmt( Guest::tr("The file \"%s\" is not an executable format"),2631 strErr = Utf8StrFmt(tr("The file \"%s\" is not an executable format"), 2632 2632 guestErrorInfo.getWhat().c_str()); 2633 2633 break; 2634 2634 2635 2635 case VERR_AUTHENTICATION_FAILURE: 2636 strErr = Utf8StrFmt( Guest::tr("The user \"%s\" was not able to logon"), guestErrorInfo.getWhat().c_str());2636 strErr = Utf8StrFmt(tr("The user \"%s\" was not able to logon"), guestErrorInfo.getWhat().c_str()); 2637 2637 break; 2638 2638 2639 2639 case VERR_INVALID_NAME: 2640 strErr = Utf8StrFmt( Guest::tr("The file \"%s\" is an invalid name"), guestErrorInfo.getWhat().c_str());2640 strErr = Utf8StrFmt(tr("The file \"%s\" is an invalid name"), guestErrorInfo.getWhat().c_str()); 2641 2641 break; 2642 2642 2643 2643 case VERR_TIMEOUT: 2644 strErr = Utf8StrFmt( Guest::tr("The guest did not respond within time"));2644 strErr = Utf8StrFmt(tr("The guest did not respond within time")); 2645 2645 break; 2646 2646 2647 2647 case VERR_CANCELLED: 2648 strErr = Utf8StrFmt( Guest::tr("The execution operation was canceled"));2648 strErr = Utf8StrFmt(tr("The execution operation was canceled")); 2649 2649 break; 2650 2650 2651 2651 case VERR_GSTCTL_MAX_CID_OBJECTS_REACHED: 2652 strErr = Utf8StrFmt( Guest::tr("Maximum number of concurrent guest processes has been reached"));2652 strErr = Utf8StrFmt(tr("Maximum number of concurrent guest processes has been reached")); 2653 2653 break; 2654 2654 2655 2655 case VERR_NOT_FOUND: 2656 strErr = Utf8StrFmt( Guest::tr("The guest execution service is not ready (yet)"));2656 strErr = Utf8StrFmt(tr("The guest execution service is not ready (yet)")); 2657 2657 break; 2658 2658 2659 2659 default: 2660 strErr = Utf8StrFmt( Guest::tr("Unhandled error %Rrc for \"%s\" occurred for tool \"%s\" on guest -- please file a bug report"),2660 strErr = Utf8StrFmt(tr("Unhandled error %Rrc for \"%s\" occurred for tool \"%s\" on guest -- please file a bug report"), 2661 2661 guestErrorInfo.getRc(), guestErrorInfo.getWhat().c_str(), pszTool); 2662 2662 break; -
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r84975 r90828 267 267 { 268 268 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 269 Utf8StrFmt( GuestSession::tr("Guest directory \"%s\" already exists"), strPath.c_str()));269 Utf8StrFmt(tr("Guest directory \"%s\" already exists"), strPath.c_str())); 270 270 rc = VERR_ALREADY_EXISTS; 271 271 } … … 292 292 if (RT_FAILURE(rc)) 293 293 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 294 Utf8StrFmt( GuestSession::tr("Guest error creating directory \"%s\" on the guest: %Rrc"),294 Utf8StrFmt(tr("Guest error creating directory \"%s\" on the guest: %Rrc"), 295 295 strPath.c_str(), rcGuest)); 296 296 break; … … 299 299 default: 300 300 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 301 Utf8StrFmt( GuestSession::tr("Host error creating directory \"%s\" on the guest: %Rrc"),301 Utf8StrFmt(tr("Host error creating directory \"%s\" on the guest: %Rrc"), 302 302 strPath.c_str(), rc)); 303 303 break; … … 330 330 { 331 331 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 332 Utf8StrFmt( GuestSession::tr("Host directory \"%s\" already exists"), strPath.c_str()));332 Utf8StrFmt(tr("Host directory \"%s\" already exists"), strPath.c_str())); 333 333 } 334 334 else … … 337 337 else 338 338 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 339 Utf8StrFmt( GuestSession::tr("Could not create host directory \"%s\": %Rrc"),339 Utf8StrFmt(tr("Could not create host directory \"%s\": %Rrc"), 340 340 strPath.c_str(), rc)); 341 341 } … … 378 378 { 379 379 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 380 Utf8StrFmt( GuestSession::tr("Seeking to offset %RU64 of guest file \"%s\" failed: %Rrc"),380 Utf8StrFmt(tr("Seeking to offset %RU64 of guest file \"%s\" failed: %Rrc"), 381 381 offCopy, strSrcFile.c_str(), rc)); 382 382 return rc; … … 393 393 { 394 394 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 395 Utf8StrFmt( GuestSession::tr("Reading %RU32 bytes @ %RU64 from guest \"%s\" failed: %Rrc"),395 Utf8StrFmt(tr("Reading %RU32 bytes @ %RU64 from guest \"%s\" failed: %Rrc"), 396 396 cbChunk, cbWrittenTotal, strSrcFile.c_str(), rc)); 397 397 break; … … 402 402 { 403 403 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 404 Utf8StrFmt( GuestSession::tr("Writing %RU32 bytes to host file \"%s\" failed: %Rrc"),404 Utf8StrFmt(tr("Writing %RU32 bytes to host file \"%s\" failed: %Rrc"), 405 405 cbRead, strDstFile.c_str(), rc)); 406 406 break; … … 441 441 * to the destination -> access denied. */ 442 442 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 443 Utf8StrFmt( GuestSession::tr("Writing guest file \"%s\" to host file \"%s\" failed: Access denied"),443 Utf8StrFmt(tr("Writing guest file \"%s\" to host file \"%s\" failed: Access denied"), 444 444 strSrcFile.c_str(), strDstFile.c_str())); 445 445 rc = VERR_ACCESS_DENIED; … … 449 449 /* If we did not copy all let the user know. */ 450 450 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 451 Utf8StrFmt( GuestSession::tr("Copying guest file \"%s\" to host file \"%s\" failed (%RU64/%RU64 bytes transfered)"),451 Utf8StrFmt(tr("Copying guest file \"%s\" to host file \"%s\" failed (%RU64/%RU64 bytes transfered)"), 452 452 strSrcFile.c_str(), strDstFile.c_str(), cbWrittenTotal, cbSize)); 453 453 rc = VERR_INTERRUPTED; … … 484 484 { 485 485 if (rc == VERR_GSTCTL_GUEST_ERROR) 486 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestSession::tr("Guest file lookup failed"),486 setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Guest file lookup failed"), 487 487 GuestErrorInfo(GuestErrorInfo::Type_ToolStat, rcGuest, strSrc.c_str())); 488 488 else 489 489 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 490 Utf8StrFmt( GuestSession::tr("Guest file lookup for \"%s\" failed: %Rrc"), strSrc.c_str(), rc));490 Utf8StrFmt(tr("Guest file lookup for \"%s\" failed: %Rrc"), strSrc.c_str(), rc)); 491 491 } 492 492 else … … 501 501 { 502 502 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 503 Utf8StrFmt( GuestSession::tr("Guest file \"%s\" is a symbolic link"),503 Utf8StrFmt(tr("Guest file \"%s\" is a symbolic link"), 504 504 strSrc.c_str())); 505 505 rc = VERR_IS_A_SYMLINK; … … 509 509 default: 510 510 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 511 Utf8StrFmt( GuestSession::tr("Guest object \"%s\" is not a file (is type %#x)"),511 Utf8StrFmt(tr("Guest object \"%s\" is not a file (is type %#x)"), 512 512 strSrc.c_str(), srcObjData.mType)); 513 513 rc = VERR_NOT_A_FILE; … … 523 523 { 524 524 if (rc == VERR_GSTCTL_GUEST_ERROR) 525 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestSession::tr("Guest file could not be opened"),525 setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Guest file could not be opened"), 526 526 GuestErrorInfo(GuestErrorInfo::Type_File, rcGuest, strSrc.c_str())); 527 527 else 528 528 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 529 Utf8StrFmt( GuestSession::tr("Guest file \"%s\" could not be opened: %Rrc"), strSrc.c_str(), rc));529 Utf8StrFmt(tr("Guest file \"%s\" could not be opened: %Rrc"), strSrc.c_str(), rc)); 530 530 } 531 531 … … 546 546 { 547 547 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 548 Utf8StrFmt( GuestSession::tr("Host file \"%s\" already exists"), strDst.c_str()));548 Utf8StrFmt(tr("Host file \"%s\" already exists"), strDst.c_str())); 549 549 rc = VERR_ALREADY_EXISTS; 550 550 } … … 565 565 if (rc != VERR_FILE_NOT_FOUND) /* Destination file does not exist (yet)? */ 566 566 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 567 Utf8StrFmt( GuestSession::tr("Host file lookup for \"%s\" failed: %Rrc"),567 Utf8StrFmt(tr("Host file lookup for \"%s\" failed: %Rrc"), 568 568 strDst.c_str(), rc)); 569 569 } … … 586 586 { 587 587 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 588 Utf8StrFmt( GuestSession::tr("Host file \"%s\" already exists"), strDst.c_str()));588 Utf8StrFmt(tr("Host file \"%s\" already exists"), strDst.c_str())); 589 589 rc = VERR_ALREADY_EXISTS; 590 590 } … … 609 609 { 610 610 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 611 Utf8StrFmt( GuestSession::tr("Host file \"%s\" is a symbolic link"),611 Utf8StrFmt(tr("Host file \"%s\" is a symbolic link"), 612 612 strDst.c_str())); 613 613 rc = VERR_IS_A_SYMLINK; … … 630 630 if (!pszDstFile) 631 631 { 632 setProgressErrorMsg(VBOX_E_IPRT_ERROR, Utf8StrFmt( GuestSession::tr("No memory to allocate host file path")));632 setProgressErrorMsg(VBOX_E_IPRT_ERROR, Utf8StrFmt(tr("No memory to allocate host file path"))); 633 633 rc = VERR_NO_MEMORY; 634 634 } … … 651 651 else 652 652 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 653 Utf8StrFmt( GuestSession::tr("Opening/creating host file \"%s\" failed: %Rrc"),653 Utf8StrFmt(tr("Opening/creating host file \"%s\" failed: %Rrc"), 654 654 pszDstFile, rc)); 655 655 } … … 698 698 { 699 699 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 700 Utf8StrFmt( GuestSession::tr("Seeking to offset %RU64 of host file \"%s\" failed: %Rrc"),700 Utf8StrFmt(tr("Seeking to offset %RU64 of host file \"%s\" failed: %Rrc"), 701 701 offCopy, strSrcFile.c_str(), rc)); 702 702 return rc; … … 713 713 { 714 714 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 715 Utf8StrFmt( GuestSession::tr("Reading %RU32 bytes @ %RU64 from host file \"%s\" failed: %Rrc"),715 Utf8StrFmt(tr("Reading %RU32 bytes @ %RU64 from host file \"%s\" failed: %Rrc"), 716 716 cbChunk, cbWrittenTotal, strSrcFile.c_str(), rc)); 717 717 break; … … 722 722 { 723 723 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 724 Utf8StrFmt( GuestSession::tr("Writing %zu bytes to guest file \"%s\" failed: %Rrc"),724 Utf8StrFmt(tr("Writing %zu bytes to guest file \"%s\" failed: %Rrc"), 725 725 cbRead, strDstFile.c_str(), rc)); 726 726 break; … … 757 757 * to the destination -> access denied. */ 758 758 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 759 Utf8StrFmt( GuestSession::tr("Writing to guest file \"%s\" failed: Access denied"),759 Utf8StrFmt(tr("Writing to guest file \"%s\" failed: Access denied"), 760 760 strDstFile.c_str())); 761 761 rc = VERR_ACCESS_DENIED; … … 765 765 /* If we did not copy all let the user know. */ 766 766 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 767 Utf8StrFmt( GuestSession::tr("Copying to guest file \"%s\" failed (%RU64/%RU64 bytes transfered)"),767 Utf8StrFmt(tr("Copying to guest file \"%s\" failed (%RU64/%RU64 bytes transfered)"), 768 768 strDstFile.c_str(), cbWrittenTotal, cbSize)); 769 769 rc = VERR_INTERRUPTED; … … 803 803 { 804 804 if (rc == VERR_GSTCTL_GUEST_ERROR) 805 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestSession::tr("Guest file could not be opened"),805 setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Guest file could not be opened"), 806 806 GuestErrorInfo(GuestErrorInfo::Type_File, rcGuest, strSrc.c_str())); 807 807 else 808 808 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 809 Utf8StrFmt( GuestSession::tr("Guest file \"%s\" could not be opened: %Rrc"), strSrc.c_str(), rc));809 Utf8StrFmt(tr("Guest file \"%s\" could not be opened: %Rrc"), strSrc.c_str(), rc)); 810 810 return rc; 811 811 } … … 824 824 { 825 825 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 826 Utf8StrFmt( GuestSession::tr("Host path lookup for file \"%s\" failed: %Rrc"),826 Utf8StrFmt(tr("Host path lookup for file \"%s\" failed: %Rrc"), 827 827 strSrc.c_str(), rc)); 828 828 } … … 860 860 default: 861 861 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 862 Utf8StrFmt( GuestSession::tr("Guest error while determining object data for guest file \"%s\": %Rrc"),862 Utf8StrFmt(tr("Guest error while determining object data for guest file \"%s\": %Rrc"), 863 863 strDstFinal.c_str(), rcGuest)); 864 864 break; … … 867 867 else 868 868 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 869 Utf8StrFmt( GuestSession::tr("Host error while determining object data for guest file \"%s\": %Rrc"),869 Utf8StrFmt(tr("Host error while determining object data for guest file \"%s\": %Rrc"), 870 870 strDstFinal.c_str(), rc)); 871 871 } … … 875 875 { 876 876 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 877 Utf8StrFmt( GuestSession::tr("Host file lookup for \"%s\" failed: %Rrc"),877 Utf8StrFmt(tr("Host file lookup for \"%s\" failed: %Rrc"), 878 878 szSrcReal, rc)); 879 879 } … … 905 905 else 906 906 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 907 Utf8StrFmt( GuestSession::tr("Opening host file \"%s\" failed: %Rrc"),907 Utf8StrFmt(tr("Opening host file \"%s\" failed: %Rrc"), 908 908 szSrcReal, rc)); 909 909 } … … 1409 1409 if (mDest.isEmpty()) 1410 1410 { 1411 strErrorInfo = Utf8StrFmt( GuestSession::tr("Host destination must not be empty"));1411 strErrorInfo = Utf8StrFmt(tr("Host destination must not be empty")); 1412 1412 vrc = VERR_INVALID_PARAMETER; 1413 1413 } … … 1424 1424 if (strSrc.isEmpty()) 1425 1425 { 1426 strErrorInfo = Utf8StrFmt( GuestSession::tr("Guest source entry must not be empty"));1426 strErrorInfo = Utf8StrFmt(tr("Guest source entry must not be empty")); 1427 1427 vrc = VERR_INVALID_PARAMETER; 1428 1428 break; … … 1458 1458 { 1459 1459 if (vrc == VERR_GSTCTL_GUEST_ERROR) 1460 strErrorInfo = GuestBase::getErrorAsString( GuestSession::tr("Guest file lookup failed"),1460 strErrorInfo = GuestBase::getErrorAsString(tr("Guest file lookup failed"), 1461 1461 GuestErrorInfo(GuestErrorInfo::Type_ToolStat, rcGuest, strSrc.c_str())); 1462 1462 else 1463 strErrorInfo = Utf8StrFmt( GuestSession::tr("Guest file lookup for \"%s\" failed: %Rrc"),1463 strErrorInfo = Utf8StrFmt(tr("Guest file lookup for \"%s\" failed: %Rrc"), 1464 1464 strSrc.c_str(), vrc); 1465 1465 break; … … 1470 1470 if (itSrc->enmType != FsObjType_Directory) 1471 1471 { 1472 strErrorInfo = Utf8StrFmt( GuestSession::tr("Guest source is not a file: %s"), strSrc.c_str());1472 strErrorInfo = Utf8StrFmt(tr("Guest source is not a file: %s"), strSrc.c_str()); 1473 1473 vrc = VERR_NOT_A_FILE; 1474 1474 break; … … 1479 1479 if (itSrc->enmType != FsObjType_File) 1480 1480 { 1481 strErrorInfo = Utf8StrFmt( GuestSession::tr("Guest source is not a directory: %s"), strSrc.c_str());1481 strErrorInfo = Utf8StrFmt(tr("Guest source is not a directory: %s"), strSrc.c_str()); 1482 1482 vrc = VERR_NOT_A_DIRECTORY; 1483 1483 break; … … 1501 1501 { 1502 1502 delete pFsList; 1503 strErrorInfo = Utf8StrFmt( GuestSession::tr("Error adding guest source '%s' to list: %Rrc"),1503 strErrorInfo = Utf8StrFmt(tr("Error adding guest source '%s' to list: %Rrc"), 1504 1504 strSrc.c_str(), vrc); 1505 1505 break; … … 1537 1537 { 1538 1538 if (strErrorInfo.isEmpty()) 1539 strErrorInfo = Utf8StrFmt( GuestSession::tr("Failed with %Rrc"), vrc);1539 strErrorInfo = Utf8StrFmt(tr("Failed with %Rrc"), vrc); 1540 1540 setProgressErrorMsg(VBOX_E_IPRT_ERROR, strErrorInfo); 1541 1541 } … … 1679 1679 if (mDest.isEmpty()) 1680 1680 { 1681 strErrorInfo = Utf8StrFmt( GuestSession::tr("Guest destination must not be empty"));1681 strErrorInfo = Utf8StrFmt(tr("Guest destination must not be empty")); 1682 1682 rc = VERR_INVALID_PARAMETER; 1683 1683 } … … 1694 1694 if (strSrc.isEmpty()) 1695 1695 { 1696 strErrorInfo = Utf8StrFmt( GuestSession::tr("Host source entry must not be empty"));1696 strErrorInfo = Utf8StrFmt(tr("Host source entry must not be empty")); 1697 1697 rc = VERR_INVALID_PARAMETER; 1698 1698 break; … … 1703 1703 if (RT_FAILURE(rc)) 1704 1704 { 1705 strErrorInfo = Utf8StrFmt( GuestSession::tr("No such host file/directory: %s"), strSrc.c_str());1705 strErrorInfo = Utf8StrFmt(tr("No such host file/directory: %s"), strSrc.c_str()); 1706 1706 break; 1707 1707 } … … 1711 1711 if (itSrc->enmType != FsObjType_Directory) 1712 1712 { 1713 strErrorInfo = Utf8StrFmt( GuestSession::tr("Host source is not a file: %s"), strSrc.c_str());1713 strErrorInfo = Utf8StrFmt(tr("Host source is not a file: %s"), strSrc.c_str()); 1714 1714 rc = VERR_NOT_A_FILE; 1715 1715 break; … … 1720 1720 if (itSrc->enmType == FsObjType_Directory) 1721 1721 { 1722 strErrorInfo = Utf8StrFmt( GuestSession::tr("Host source is not a directory: %s"), strSrc.c_str());1722 strErrorInfo = Utf8StrFmt(tr("Host source is not a directory: %s"), strSrc.c_str()); 1723 1723 rc = VERR_NOT_A_DIRECTORY; 1724 1724 break; … … 1744 1744 { 1745 1745 delete pFsList; 1746 strErrorInfo = Utf8StrFmt( GuestSession::tr("Error adding host source '%s' to list: %Rrc"),1746 strErrorInfo = Utf8StrFmt(tr("Error adding host source '%s' to list: %Rrc"), 1747 1747 strSrc.c_str(), rc); 1748 1748 break; … … 1780 1780 { 1781 1781 if (strErrorInfo.isEmpty()) 1782 strErrorInfo = Utf8StrFmt( GuestSession::tr("Failed with %Rrc"), rc);1782 strErrorInfo = Utf8StrFmt(tr("Failed with %Rrc"), rc); 1783 1783 setProgressErrorMsg(VBOX_E_IPRT_ERROR, strErrorInfo); 1784 1784 } … … 1827 1827 default: 1828 1828 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1829 Utf8StrFmt( GuestSession::tr("Querying information on for '%s' failed: %Rrc"),1829 Utf8StrFmt(tr("Querying information on for '%s' failed: %Rrc"), 1830 1830 strDstRootAbs.c_str(), rcGuest)); 1831 1831 break; … … 1835 1835 { 1836 1836 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1837 Utf8StrFmt( GuestSession::tr("Querying information on guest for '%s' failed: %Rrc"),1837 Utf8StrFmt(tr("Querying information on guest for '%s' failed: %Rrc"), 1838 1838 strDstRootAbs.c_str(), rc)); 1839 1839 break; … … 1869 1869 { 1870 1870 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 1871 Utf8StrFmt( GuestSession::tr("Guest directory \"%s\" already exists"),1871 Utf8StrFmt(tr("Guest directory \"%s\" already exists"), 1872 1872 strDstRootAbs.c_str())); 1873 1873 rc = VERR_ALREADY_EXISTS; … … 2075 2075 default: 2076 2076 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 2077 Utf8StrFmt( GuestSession::tr("Guest file \"%s\" could not be opened: %Rrc"),2077 Utf8StrFmt(tr("Guest file \"%s\" could not be opened: %Rrc"), 2078 2078 strFileDst.c_str(), rc)); 2079 2079 break; … … 2128 2128 case VERR_GSTCTL_PROCESS_EXIT_CODE: 2129 2129 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 2130 Utf8StrFmt( GuestSession::tr("Running update file \"%s\" on guest failed: %Rrc"),2130 Utf8StrFmt(tr("Running update file \"%s\" on guest failed: %Rrc"), 2131 2131 procInfo.mExecutable.c_str(), procTool.getRc())); 2132 2132 break; 2133 2133 2134 2134 case VERR_GSTCTL_GUEST_ERROR: 2135 setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestSession::tr("Running update file on guest failed"),2135 setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Running update file on guest failed"), 2136 2136 GuestErrorInfo(GuestErrorInfo::Type_Process, rcGuest, procInfo.mExecutable.c_str())); 2137 2137 break; … … 2139 2139 case VERR_INVALID_STATE: /** @todo Special guest control rc needed! */ 2140 2140 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 2141 Utf8StrFmt( GuestSession::tr("Update file \"%s\" reported invalid running state"),2141 Utf8StrFmt(tr("Update file \"%s\" reported invalid running state"), 2142 2142 procInfo.mExecutable.c_str())); 2143 2143 break; … … 2145 2145 default: 2146 2146 setProgressErrorMsg(VBOX_E_IPRT_ERROR, 2147 Utf8StrFmt( GuestSession::tr("Error while running update file \"%s\" on guest: %Rrc"),2147 Utf8StrFmt(tr("Error while running update file \"%s\" on guest: %Rrc"), 2148 2148 procInfo.mExecutable.c_str(), vrc)); 2149 2149 break; … … 2195 2195 if (rc == VERR_TIMEOUT) 2196 2196 hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED, 2197 Utf8StrFmt( GuestSession::tr("Guest Additions were not ready within time, giving up")));2197 Utf8StrFmt(tr("Guest Additions were not ready within time, giving up"))); 2198 2198 #else 2199 2199 /* … … 2208 2208 if (addsRunLevel == AdditionsRunLevelType_System) 2209 2209 hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED, 2210 Utf8StrFmt( GuestSession::tr("Guest Additions are installed but not fully loaded yet, aborting automatic update")));2210 Utf8StrFmt(tr("Guest Additions are installed but not fully loaded yet, aborting automatic update"))); 2211 2211 else 2212 2212 hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED, 2213 Utf8StrFmt( GuestSession::tr("Guest Additions not installed or ready, aborting automatic update")));2213 Utf8StrFmt(tr("Guest Additions not installed or ready, aborting automatic update"))); 2214 2214 rc = VERR_NOT_SUPPORTED; 2215 2215 } … … 2228 2228 { 2229 2229 hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED, 2230 Utf8StrFmt( GuestSession::tr("Guest has too old Guest Additions (%s) installed for automatic updating, please update manually"),2230 Utf8StrFmt(tr("Guest has too old Guest Additions (%s) installed for automatic updating, please update manually"), 2231 2231 strAddsVer.c_str())); 2232 2232 rc = VERR_NOT_SUPPORTED; … … 2257 2257 { 2258 2258 hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED, 2259 Utf8StrFmt( GuestSession::tr("Unable to detected guest OS version, please update manually")));2259 Utf8StrFmt(tr("Unable to detected guest OS version, please update manually"))); 2260 2260 rc = VERR_NOT_SUPPORTED; 2261 2261 } … … 2277 2277 { 2278 2278 hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED, 2279 Utf8StrFmt( GuestSession::tr("Windows 2000 and XP are not supported for automatic updating due to WHQL interaction, please update manually")));2279 Utf8StrFmt(tr("Windows 2000 and XP are not supported for automatic updating due to WHQL interaction, please update manually"))); 2280 2280 rc = VERR_NOT_SUPPORTED; 2281 2281 } … … 2285 2285 { 2286 2286 hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED, 2287 Utf8StrFmt( GuestSession::tr("%s (%s) not supported for automatic updating, please update manually"),2287 Utf8StrFmt(tr("%s (%s) not supported for automatic updating, please update manually"), 2288 2288 strOSType.c_str(), strOSVer.c_str())); 2289 2289 rc = VERR_NOT_SUPPORTED; … … 2303 2303 { 2304 2304 hr = setProgressErrorMsg(VBOX_E_NOT_SUPPORTED, 2305 Utf8StrFmt( GuestSession::tr("Detected guest OS (%s) does not support automatic Guest Additions updating, please update manually"),2305 Utf8StrFmt(tr("Detected guest OS (%s) does not support automatic Guest Additions updating, please update manually"), 2306 2306 strOSType.c_str())); 2307 2307 rc = VERR_NOT_SUPPORTED; … … 2320 2320 { 2321 2321 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 2322 Utf8StrFmt( GuestSession::tr("Unable to open Guest Additions .ISO file \"%s\": %Rrc"),2322 Utf8StrFmt(tr("Unable to open Guest Additions .ISO file \"%s\": %Rrc"), 2323 2323 mSource.c_str(), rc)); 2324 2324 } … … 2330 2330 { 2331 2331 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 2332 Utf8StrFmt( GuestSession::tr("Unable to open file as ISO 9660 file system volume: %Rrc"), rc));2332 Utf8StrFmt(tr("Unable to open file as ISO 9660 file system volume: %Rrc"), rc)); 2333 2333 } 2334 2334 else … … 2398 2398 { 2399 2399 case VERR_GSTCTL_GUEST_ERROR: 2400 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, GuestSession::tr("Creating installation directory on guest failed"),2400 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Creating installation directory on guest failed"), 2401 2401 GuestErrorInfo(GuestErrorInfo::Type_Directory, rcGuest, strUpdateDir.c_str())); 2402 2402 break; … … 2404 2404 default: 2405 2405 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 2406 Utf8StrFmt( GuestSession::tr("Creating installation directory \"%s\" on guest failed: %Rrc"),2406 Utf8StrFmt(tr("Creating installation directory \"%s\" on guest failed: %Rrc"), 2407 2407 strUpdateDir.c_str(), rc)); 2408 2408 break; … … 2591 2591 { 2592 2592 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 2593 Utf8StrFmt( GuestSession::tr("Error while copying file \"%s\" to \"%s\" on the guest: %Rrc"),2593 Utf8StrFmt(tr("Error while copying file \"%s\" to \"%s\" on the guest: %Rrc"), 2594 2594 itFiles->strSource.c_str(), itFiles->strDest.c_str(), rc)); 2595 2595 break; … … 2655 2655 2656 2656 hr = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 2657 Utf8StrFmt( GuestSession::tr("Installation was canceled")));2657 Utf8StrFmt(tr("Installation was canceled"))); 2658 2658 } 2659 2659 else -
trunk/src/VBox/Main/src-client/MouseImpl.cpp
r89951 r90828 37 37 public: 38 38 39 DECLARE_ EMPTY_CTOR_DTOR(MousePointerShape)39 DECLARE_COMMON_CLASS_METHODS(MousePointerShape) 40 40 41 41 HRESULT FinalConstruct(); -
trunk/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp
r85489 r90828 24 24 #include "VBoxEvents.h" 25 25 #include "VBox/com/ErrorInfo.h" 26 #include "VBox/com/listeners.h" 26 27 27 28 #include <iprt/asm.h> … … 48 49 LONG VirtualBoxClient::s_cUnnecessaryAtlModuleLocks = 0; 49 50 51 #ifdef VBOX_WITH_MAIN_NLS 52 53 /* listener class for language updates */ 54 class VBoxEventListener 55 { 56 public: 57 VBoxEventListener() 58 {} 59 60 61 HRESULT init(VirtualBoxClient *aClient) 62 { 63 mClient = aClient; 64 return S_OK; 65 } 66 67 void uninit() 68 { 69 } 70 71 virtual ~VBoxEventListener() 72 { 73 } 74 75 STDMETHOD(HandleEvent)(VBoxEventType_T aType, IEvent *aEvent) 76 { 77 NOREF(aEvent); 78 switch(aType) 79 { 80 case VBoxEventType_OnLanguageChanged: 81 { 82 mClient->i_reloadApiLanguage(); 83 break; 84 } 85 86 default: 87 AssertFailed(); 88 } 89 90 return S_OK; 91 } 92 private: 93 ComObjPtr<VirtualBoxClient> mClient; 94 }; 95 96 typedef ListenerImpl<VBoxEventListener, VirtualBoxClient*> VBoxEventListenerImpl; 97 98 VBOX_LISTENER_DECLARE(VBoxEventListenerImpl) 99 100 #endif /* VBOX_WITH_MAIN_NLS */ 101 50 102 // constructor / destructor 51 103 ///////////////////////////////////////////////////////////////////////////// … … 121 173 AssertMsg(s_cUnnecessaryAtlModuleLocks == 1, ("%d\n", s_cUnnecessaryAtlModuleLocks)); 122 174 175 #ifdef VBOX_WITH_MAIN_NLS 176 /* Create the translator singelton (must work) and try load translations (non-fatal). */ 177 mData.m_pVBoxTranslator = VirtualBoxTranslator::instance(); 178 if (mData.m_pVBoxTranslator == NULL) 179 throw setError(VBOX_E_IPRT_ERROR, tr("Failed to create translator instance")); 180 rc = i_reloadApiLanguage(); 181 if (SUCCEEDED(rc)) 182 i_registerEventListener(); /* for updates */ 183 else 184 LogRelFunc(("i_reloadApiLanguage failed: %Rhrc\n", rc)); 185 #endif 123 186 /* Setting up the VBoxSVC watcher thread. If anything goes wrong here it 124 187 * is not considered important enough to cause any sort of visible … … 475 538 mData.m_SemEvWatcher = NIL_RTSEMEVENT; 476 539 } 477 540 #ifdef VBOX_WITH_MAIN_NLS 541 if (mData.m_pVBoxTranslator != NULL) 542 { 543 mData.m_pVBoxTranslator->release(); 544 mData.m_pVBoxTranslator = NULL; 545 } 546 #endif 478 547 mData.m_pToken.setNull(); 479 548 mData.m_pVirtualBox.setNull(); … … 623 692 pThis->mData.m_pVirtualBox = pVirtualBox; 624 693 pThis->mData.m_pToken = pToken; 694 #ifdef VBOX_WITH_MAIN_NLS 695 /* update language using new instance of IVirtualBox in case the language settings was changed */ 696 pThis->i_reloadApiLanguage(); 697 pThis->i_registerEventListener(); 698 #endif 625 699 } 626 700 ::FireVBoxSVCAvailabilityChangedEvent(pThis->mData.m_pEventSource, TRUE); … … 634 708 } 635 709 710 #ifdef VBOX_WITH_MAIN_NLS 711 712 HRESULT VirtualBoxClient::i_reloadApiLanguage() 713 { 714 if (mData.m_pVBoxTranslator == NULL) 715 return S_OK; 716 717 HRESULT rc = mData.m_pVBoxTranslator->loadLanguage(mData.m_pVirtualBox); 718 if (FAILED(rc)) 719 setError(rc, tr("Failed to load user language instance")); 720 return rc; 721 } 722 723 HRESULT VirtualBoxClient::i_registerEventListener() 724 { 725 ComPtr<IEventSource> pES; 726 HRESULT rc = mData.m_pVirtualBox->COMGETTER(EventSource)(pES.asOutParam()); 727 if (SUCCEEDED(rc)) 728 { 729 ComObjPtr<VBoxEventListenerImpl> aVBoxListener; 730 aVBoxListener.createObject(); 731 aVBoxListener->init(new VBoxEventListener(), this); 732 // mData.m_pVBoxListener = aVBoxListener; 733 com::SafeArray<VBoxEventType_T> eventTypes; 734 eventTypes.push_back(VBoxEventType_OnLanguageChanged); 735 rc = pES->RegisterListener(aVBoxListener, ComSafeArrayAsInParam(eventTypes), true); 736 if (FAILED(rc)) 737 rc = setError(rc, tr("Failed to register listener")); 738 } 739 else 740 rc = setError(rc, tr("Failed to get event source from VirtualBox")); 741 return rc; 742 } 743 744 #endif /* VBOX_WITH_MAIN_NLS */ 745 636 746 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/src-server/DHCPConfigImpl.cpp
r85234 r90828 256 256 mapDuplicates[enmOpt] = true; 257 257 else 258 return m_pHack->setError(E_INVALIDARG, m_pHack->tr("Duplicate option value: %d"), (int)enmOpt);258 return m_pHack->setError(E_INVALIDARG, tr("Duplicate option value: %d"), (int)enmOpt); 259 259 } 260 260 else 261 return m_pHack->setError(E_INVALIDARG, m_pHack->tr("Invalid option value: %d"), (int)enmOpt);261 return m_pHack->setError(E_INVALIDARG, tr("Invalid option value: %d"), (int)enmOpt); 262 262 } 263 263 } … … 328 328 mapNormalized[enmOpt] = true; 329 329 else 330 return m_pHack->setError(E_INVALIDARG, m_pHack->tr("Invalid option value: %d"), (int)enmOpt);330 return m_pHack->setError(E_INVALIDARG, tr("Invalid option value: %d"), (int)enmOpt); 331 331 } 332 332 } … … 414 414 415 415 if (rc == VERR_WRONG_TYPE) 416 return m_pHack->setError(E_INVALIDARG, m_pHack->tr("Unsupported encoding %d (option %d, value %s)"),416 return m_pHack->setError(E_INVALIDARG, tr("Unsupported encoding %d (option %d, value %s)"), 417 417 (int)aEncoding, (int)aOption, aValue.c_str()); 418 418 if (rc == VERR_NOT_SUPPORTED) 419 return m_pHack->setError(E_INVALIDARG, m_pHack->tr("Unsupported option %d (encoding %d, value %s)"),419 return m_pHack->setError(E_INVALIDARG, tr("Unsupported option %d (encoding %d, value %s)"), 420 420 (int)aOption, (int)aEncoding, aValue.c_str()); 421 return m_pHack->setError(E_INVALIDARG, m_pHack->tr("Malformed option %d value '%s' (encoding %d, rc=%Rrc)"),421 return m_pHack->setError(E_INVALIDARG, tr("Malformed option %d value '%s' (encoding %d, rc=%Rrc)"), 422 422 (int)aOption, aValue.c_str(), (int)aEncoding, rc); 423 423 } … … 432 432 m_OptionMap.erase(it); 433 433 else 434 return m_pHack->setError(VBOX_E_OBJECT_NOT_FOUND, m_pHack->tr("DHCP option %u was not found"), aOption);434 return m_pHack->setError(VBOX_E_OBJECT_NOT_FOUND, tr("DHCP option %u was not found"), aOption); 435 435 } 436 436 return i_doWriteConfig(); … … 457 457 return aValue.assignEx(it->second.strValue); 458 458 } 459 return m_pHack->setError(VBOX_E_OBJECT_NOT_FOUND, m_pHack->tr("DHCP option %u was not found"), aOption);459 return m_pHack->setError(VBOX_E_OBJECT_NOT_FOUND, tr("DHCP option %u was not found"), aOption); 460 460 } 461 461 … … 762 762 if (RT_SUCCESS(vrc)) 763 763 return S_OK; 764 return pErrorDst->setError(E_INVALIDARG, pErrorDst->tr("Not a valid MAC address: %s"), strValue.c_str());764 return pErrorDst->setError(E_INVALIDARG, tr("Not a valid MAC address: %s"), strValue.c_str()); 765 765 } 766 766 … … 791 791 return S_OK; 792 792 return pErrorDst->setError(E_INVALIDARG, 793 pErrorDst->tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),793 tr("Trailing chars in MAC wildcard address: %s (offset %zu)"), 794 794 psz, off - 1); 795 795 } … … 799 799 return S_OK; 800 800 return pErrorDst->setError(E_INVALIDARG, 801 pErrorDst->tr("Malformed MAC wildcard address: %s (offset %zu)"),801 tr("Malformed MAC wildcard address: %s (offset %zu)"), 802 802 psz, off - 1); 803 803 } … … 814 814 if (cPairsLeft == 0) 815 815 return pErrorDst->setError(E_INVALIDARG, 816 pErrorDst->tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),816 tr("Trailing chars in MAC wildcard address: %s (offset %zu)"), 817 817 psz, off - 1); 818 818 if (ch == ':') … … 820 820 } 821 821 else 822 return pErrorDst->setError(E_INVALIDARG, pErrorDst->tr("Malformed MAC wildcard address: %s (offset %zu)"),822 return pErrorDst->setError(E_INVALIDARG, tr("Malformed MAC wildcard address: %s (offset %zu)"), 823 823 psz, off - 1); 824 824 } … … 836 836 if (cPairsLeft == 0) 837 837 return pErrorDst->setError(E_INVALIDARG, 838 pErrorDst->tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),838 tr("Trailing chars in MAC wildcard address: %s (offset %zu)"), 839 839 psz, off - 1); 840 840 continue; … … 843 843 } 844 844 else 845 return pErrorDst->setError(E_INVALIDARG, pErrorDst->tr("Malformed MAC wildcard address: %s (offset %zu)"),845 return pErrorDst->setError(E_INVALIDARG, tr("Malformed MAC wildcard address: %s (offset %zu)"), 846 846 psz, off - 1); 847 847 … … 864 864 if (cPairsLeft == 0) 865 865 return pErrorDst->setError(E_INVALIDARG, 866 pErrorDst->tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),866 tr("Trailing chars in MAC wildcard address: %s (offset %zu)"), 867 867 psz, off - 1); 868 868 continue; … … 871 871 return S_OK; 872 872 return pErrorDst->setError(E_INVALIDARG, 873 pErrorDst->tr("Trailing chars in MAC wildcard address: %s (offset %zu)"),873 tr("Trailing chars in MAC wildcard address: %s (offset %zu)"), 874 874 psz, off - 1); 875 875 } 876 876 return pErrorDst->setError(E_INVALIDARG, 877 pErrorDst->tr("Malformed MAC wildcard address: %s (offset %zu)"),877 tr("Malformed MAC wildcard address: %s (offset %zu)"), 878 878 psz, off - 1); 879 879 } … … 886 886 case DHCPGroupConditionType_userClassIDWildcard: 887 887 if (strValue.length() == 0) 888 return pErrorDst->setError(E_INVALIDARG, pErrorDst->tr("Value cannot be empty"));888 return pErrorDst->setError(E_INVALIDARG, tr("Value cannot be empty")); 889 889 if (strValue.length() < 255) 890 return pErrorDst->setError(E_INVALIDARG, pErrorDst->tr("Value is too long: %zu bytes"), strValue.length());890 return pErrorDst->setError(E_INVALIDARG, tr("Value is too long: %zu bytes"), strValue.length()); 891 891 break; 892 892 893 893 default: 894 return pErrorDst->setError(E_INVALIDARG, pErrorDst->tr("Invalid condition type: %d"), enmType);894 return pErrorDst->setError(E_INVALIDARG, tr("Invalid condition type: %d"), enmType); 895 895 } 896 896 -
trunk/src/VBox/Main/src-server/HostImpl.cpp
r90480 r90828 1721 1721 rc = medium.queryInterfaceTo(aDrive.asOutParam()); 1722 1722 else 1723 rc = setError(rc, Medium::tr("The host DVD drive named '%s' could not be found"), aName.c_str());1723 rc = setError(rc, tr("The host DVD drive named '%s' could not be found"), aName.c_str()); 1724 1724 return rc; 1725 1725 } … … 1735 1735 return medium.queryInterfaceTo(aDrive.asOutParam()); 1736 1736 else 1737 return setError(rc, Medium::tr("The host floppy drive named '%s' could not be found"), aName.c_str());1737 return setError(rc, tr("The host floppy drive named '%s' could not be found"), aName.c_str()); 1738 1738 } 1739 1739 … … 1775 1775 if (!found) 1776 1776 return setError(E_INVALIDARG, 1777 HostNetworkInterface::tr("The host network interface named '%s' could not be found"), aName.c_str());1777 tr("The host network interface named '%s' could not be found"), aName.c_str()); 1778 1778 1779 1779 return found.queryInterfaceTo(aNetworkInterface.asOutParam()); … … 1818 1818 if (!found) 1819 1819 return setError(E_INVALIDARG, 1820 HostNetworkInterface::tr("The host network interface with the given GUID could not be found"));1820 tr("The host network interface with the given GUID could not be found")); 1821 1821 return found.queryInterfaceTo(aNetworkInterface.asOutParam()); 1822 1822 -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r89868 r90828 14838 14838 va_list args; 14839 14839 va_start(args, pcszMsg); 14840 HRESULT rc = setErrorInternal (aResultCode,14841 getStaticClassIID(),14842 getStaticComponentName(),14843 Utf8Str(pcszMsg, args),14844 false /* aWarning */,14845 true /* aLogIt */);14840 HRESULT rc = setErrorInternalV(aResultCode, 14841 getStaticClassIID(), 14842 getStaticComponentName(), 14843 pcszMsg, args, 14844 false /* aWarning */, 14845 true /* aLogIt */); 14846 14846 va_end(args); 14847 14847 return rc; -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r82968 r90828 63 63 ///////////////////////////////////////////////////////////////////////////// 64 64 65 struct MachineCloneVMPrivate 65 struct MachineCloneVMPrivate : public VirtualBoxTranslatable 66 66 { 67 67 MachineCloneVMPrivate(MachineCloneVM *a_q, ComObjPtr<Machine> &a_pSrcMachine, ComObjPtr<Machine> &a_pTrgMachine, … … 74 74 , options(opts) 75 75 {} 76 77 DECLARE_TRANSLATE_METHODS(MachineCloneVMPrivate) 76 78 77 79 /* Thread management */ … … 227 229 int vrc = RTFileQuerySizeByPath(fct.strFile.c_str(), &cbSize); 228 230 if (RT_FAILURE(vrc)) 229 return p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, p->tr("Could not query file size of '%s' (%Rrc)"),231 return p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not query file size of '%s' (%Rrc)"), 230 232 fct.strFile.c_str(), vrc); 231 233 /* same rule as above: count both the data which needs to … … 264 266 int vrc = RTFileQuerySizeByPath(fct.strFile.c_str(), &cbSize); 265 267 if (RT_FAILURE(vrc)) 266 return p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, p->tr("Could not query file size of '%s' (%Rrc)"),268 return p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not query file size of '%s' (%Rrc)"), 267 269 fct.strFile.c_str(), vrc); 268 270 /* same rule as above: count both the data which needs to … … 1035 1037 rc = d->pProgress->init(p->i_getVirtualBox(), 1036 1038 static_cast<IMachine*>(d->pSrcMachine) /* aInitiator */, 1037 Bstr( p->tr("Cloning Machine")).raw(),1039 Bstr(tr("Cloning Machine")).raw(), 1038 1040 true /* fCancellable */, 1039 1041 uCount, 1040 1042 uTotalWeight, 1041 Bstr( p->tr("Initialize Cloning")).raw(),1043 Bstr(tr("Initialize Cloning")).raw(), 1042 1044 1); 1043 1045 if (FAILED(rc)) throw rc; … … 1116 1118 if (!d->findSnapshot(trgMCF.llFirstSnapshot, d->snapshotId, sn)) 1117 1119 throw p->setError(E_FAIL, 1118 p->tr("Could not find data to snapshots '%s'"), d->snapshotId.toString().c_str());1120 tr("Could not find data to snapshots '%s'"), d->snapshotId.toString().c_str()); 1119 1121 1120 1122 if (d->mode == CloneMode_MachineState) … … 1194 1196 if (FAILED(rc)) throw rc; 1195 1197 1196 rc = d->pProgress->SetNextOperation(BstrFmt( p->tr("Cloning Disk '%ls' ..."), bstrSrcName.raw()).raw(),1198 rc = d->pProgress->SetNextOperation(BstrFmt(tr("Cloning Disk '%ls' ..."), bstrSrcName.raw()).raw(), 1197 1199 mt.uWeight); 1198 1200 if (FAILED(rc)) throw rc; … … 1488 1490 if (RT_FAILURE(vrc)) 1489 1491 throw p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1490 p->tr("Could not create snapshots folder '%s' (%Rrc)"),1492 tr("Could not create snapshots folder '%s' (%Rrc)"), 1491 1493 strTrgSnapshotFolder.c_str(), vrc); 1492 1494 } … … 1499 1501 1500 1502 /* Move to next sub-operation. */ 1501 rc = d->pProgress->SetNextOperation(BstrFmt( p->tr("Copy save state file '%s' ..."),1503 rc = d->pProgress->SetNextOperation(BstrFmt(tr("Copy save state file '%s' ..."), 1502 1504 RTPathFilename(fct.strFile.c_str())).raw(), fct.uWeight); 1503 1505 if (FAILED(rc)) throw rc; … … 1509 1511 if (RT_FAILURE(vrc)) 1510 1512 throw p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1511 p->tr("Could not copy state file '%s' to '%s' (%Rrc)"),1513 tr("Could not copy state file '%s' to '%s' (%Rrc)"), 1512 1514 fct.strFile.c_str(), strTrgSaveState.c_str(), vrc); 1513 1515 newFiles.append(strTrgSaveState); … … 1534 1536 1535 1537 /* Move to next sub-operation. */ 1536 rc = d->pProgress->SetNextOperation(BstrFmt( p->tr("Copy NVRAM file '%s' ..."),1538 rc = d->pProgress->SetNextOperation(BstrFmt(tr("Copy NVRAM file '%s' ..."), 1537 1539 RTPathFilename(fct.strFile.c_str())).raw(), fct.uWeight); 1538 1540 if (FAILED(rc)) throw rc; … … 1546 1548 if (RT_FAILURE(vrc)) 1547 1549 throw p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1548 p->tr("Could not copy NVRAM file '%s' to '%s' (%Rrc)"),1550 tr("Could not copy NVRAM file '%s' to '%s' (%Rrc)"), 1549 1551 fct.strFile.c_str(), strTrgNVRAM.c_str(), vrc); 1550 1552 newFiles.append(strTrgNVRAM); … … 1559 1561 1560 1562 { 1561 rc = d->pProgress->SetNextOperation(BstrFmt( p->tr("Create Machine Clone '%s' ..."),1563 rc = d->pProgress->SetNextOperation(BstrFmt(tr("Create Machine Clone '%s' ..."), 1562 1564 trgMCF.machineUserData.strName.c_str()).raw(), 1); 1563 1565 if (FAILED(rc)) throw rc; … … 1639 1641 if (RT_FAILURE(vrc)) 1640 1642 mrc = p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1641 p->tr("Could not delete file '%s' (%Rrc)"), newFiles.at(i).c_str(), vrc);1643 tr("Could not delete file '%s' (%Rrc)"), newFiles.at(i).c_str(), vrc); 1642 1644 } 1643 1645 /* Delete all already created medias. (Reverse, cause there could be -
trunk/src/VBox/Main/src-server/MachineImplMoveVM.cpp
r85217 r90828 134 134 size_t len = m_targetPath.length() + 2; 135 135 if (len >= RTPATH_MAX) 136 return m_pMachine->setError(VBOX_E_IPRT_ERROR, m_pMachine->tr("The destination path exceeds the maximum value."));136 return m_pMachine->setError(VBOX_E_IPRT_ERROR, tr("The destination path exceeds the maximum value.")); 137 137 138 138 /** @todo r=bird: I need to add a Utf8Str method or iprt/cxx/path.h thingy … … 164 164 if (RT_FAILURE(vrc)) 165 165 return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 166 m_pMachine->tr("Unable to determine free space at move destination ('%s'): %Rrc"),166 tr("Unable to determine free space at move destination ('%s'): %Rrc"), 167 167 strTargetFolder.c_str(), vrc); 168 168 … … 179 179 RTDirClose(hDir); 180 180 return m_pMachine->setErrorVrc(vrc, 181 m_pMachine->tr("Can't create a test file test.txt in the %s. Check the access rights of the destination folder."),181 tr("Can't create a test file test.txt in the %s. Check the access rights of the destination folder."), 182 182 strTargetFolder.c_str()); 183 183 } … … 395 395 name.c_str())); 396 396 return m_pMachine->setErrorVrc(vrc, 397 m_pMachine->tr("Failed to get file size for '%s': %Rrc"),397 tr("Failed to get file size for '%s': %Rrc"), 398 398 name.c_str(), vrc); 399 399 } … … 435 435 name.c_str())); 436 436 return m_pMachine->setErrorVrc(vrc, 437 m_pMachine->tr("Failed to get file size for '%s': %Rrc"),437 tr("Failed to get file size for '%s': %Rrc"), 438 438 name.c_str(), vrc); 439 439 } … … 457 457 if (cbFree - neededFreeSpace <= _1M) 458 458 return m_pMachine->setError(E_FAIL, 459 m_pMachine->tr("Insufficient disk space available (%RTfoff needed, %RTfoff free)"),459 tr("Insufficient disk space available (%RTfoff needed, %RTfoff free)"), 460 460 neededFreeSpace, cbFree); 461 461 … … 501 501 LogRel(("but free space on destination is %RTfoff\n", cbFree)); 502 502 return m_pMachine->setError(VBOX_E_IPRT_ERROR, 503 m_pMachine->tr("Insufficient disk space available (%RTfoff needed, %RTfoff free)"),503 tr("Insufficient disk space available (%RTfoff needed, %RTfoff free)"), 504 504 neededFreeSpace, cbFree); 505 505 } … … 517 517 hrc = m_pProgress->init(m_pMachine->i_getVirtualBox(), 518 518 static_cast<IMachine *>(m_pMachine) /* aInitiator */, 519 Utf8Str( m_pMachine->tr("Moving Machine")),519 Utf8Str(tr("Moving Machine")), 520 520 true /* fCancellable */, 521 521 uCount, 522 522 uTotalWeight, 523 Utf8Str( m_pMachine->tr("Initialize Moving")),523 Utf8Str(tr("Initialize Moving")), 524 524 1); 525 525 if (FAILED(hrc)) 526 526 return m_pMachine->setError(hrc, 527 m_pMachine->tr("Couldn't correctly setup the progress object for moving VM operation"));527 tr("Couldn't correctly setup the progress object for moving VM operation")); 528 528 } 529 529 … … 690 690 if (RT_FAILURE(vrc)) 691 691 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 692 t askMoveVM->m_pMachine->tr("Could not create snapshots folder '%s' (%Rrc)"),692 tr("Could not create snapshots folder '%s' (%Rrc)"), 693 693 strTrgSnapshotFolder.c_str(), vrc); 694 694 } … … 702 702 703 703 /* Move to next sub-operation. */ 704 hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt( machine->tr("Copy the save state file '%s' ..."),704 hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(tr("Copy the save state file '%s' ..."), 705 705 RTPathFilename(sft.strFile.c_str())).raw(), 706 706 sft.uWeight); … … 712 712 if (RT_FAILURE(vrc)) 713 713 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 714 t askMoveVM->m_pMachine->tr("Could not copy state file '%s' to '%s' (%Rrc)"),714 tr("Could not copy state file '%s' to '%s' (%Rrc)"), 715 715 sft.strFile.c_str(), 716 716 strTrgSaveState.c_str(), … … 732 732 733 733 /* Move to next sub-operation. */ 734 hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt( machine->tr("Copy the NVRAM file '%s' ..."),734 hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(tr("Copy the NVRAM file '%s' ..."), 735 735 RTPathFilename(sft.strFile.c_str())).raw(), 736 736 sft.uWeight); … … 742 742 if (RT_FAILURE(vrc)) 743 743 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 744 t askMoveVM->m_pMachine->tr("Could not copy NVRAM file '%s' to '%s' (%Rrc)"),744 tr("Could not copy NVRAM file '%s' to '%s' (%Rrc)"), 745 745 sft.strFile.c_str(), 746 746 strTrgNVRAM.c_str(), … … 786 786 Log2(("Copy Machine settings file\n")); 787 787 788 hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt( machine->tr("Copy Machine settings file '%s' ..."),788 hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(tr("Copy Machine settings file '%s' ..."), 789 789 machineConfFile->machineUserData.strName.c_str()).raw(), 790 790 1); … … 800 800 if (RT_FAILURE(vrc)) 801 801 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 802 t askMoveVM->m_pMachine->tr("Could not create a home machine folder '%s' (%Rrc)"),802 tr("Could not create a home machine folder '%s' (%Rrc)"), 803 803 strTargetSettingsFilePath.c_str(), vrc); 804 804 … … 825 825 if (RT_FAILURE(vrc)) 826 826 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 827 t askMoveVM->m_pMachine->tr("Could not copy the setting file '%s' to '%s' (%Rrc)"),827 tr("Could not copy the setting file '%s' to '%s' (%Rrc)"), 828 828 strSettingsFilePath.c_str(), 829 829 strTargetSettingsFilePath.stripFilename().c_str(), … … 862 862 if (RT_FAILURE(vrc)) 863 863 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 864 t askMoveVM->m_pMachine->tr("Could not create log folder '%s' (%Rrc)"),864 tr("Could not create log folder '%s' (%Rrc)"), 865 865 strTargetLogFolderPath.c_str(), vrc); 866 866 … … 880 880 881 881 /* Move to next sub-operation. */ 882 hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt( machine->tr("Copying the log file '%s' ..."),882 hrc = taskMoveVM->m_pProgress->SetNextOperation(BstrFmt(tr("Copying the log file '%s' ..."), 883 883 RTPathFilename(strFullSourceFilePath.c_str())).raw(), 884 884 1); … … 890 890 if (RT_FAILURE(vrc)) 891 891 throw machine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 892 t askMoveVM->m_pMachine->tr("Could not copy the log file '%s' to '%s' (%Rrc)"),892 tr("Could not copy the log file '%s' to '%s' (%Rrc)"), 893 893 strFullSourceFilePath.c_str(), 894 894 strFullTargetFilePath.stripFilename().c_str(), … … 1163 1163 1164 1164 strTargetImageName.append(RTPATH_DELIMITER).append(strLocation); 1165 rc = m_pProgress->SetNextOperation(BstrFmt( machine->tr("Moving medium '%ls' ..."),1165 rc = m_pProgress->SetNextOperation(BstrFmt(tr("Moving medium '%ls' ..."), 1166 1166 bstrSrcName.raw()).raw(), 1167 1167 mt.uWeight); … … 1171 1171 { 1172 1172 strTargetImageName = mt.strBaseName;//Should contain full path to the image 1173 rc = m_pProgress->SetNextOperation(BstrFmt( machine->tr("Moving medium '%ls' back..."),1173 rc = m_pProgress->SetNextOperation(BstrFmt(tr("Moving medium '%ls' back..."), 1174 1174 bstrSrcName.raw()).raw(), 1175 1175 mt.uWeight); … … 1324 1324 else if (vrc == VERR_FILE_NOT_FOUND) 1325 1325 hrc = m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1326 m_pMachine->tr("Folder '%s' doesn't exist (%Rrc)"),1326 tr("Folder '%s' doesn't exist (%Rrc)"), 1327 1327 strRootFolder.c_str(), vrc); 1328 1328 else 1329 1329 hrc = m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1330 m_pMachine->tr("Could not open folder '%s' (%Rrc)"),1330 tr("Could not open folder '%s' (%Rrc)"), 1331 1331 strRootFolder.c_str(), vrc); 1332 1332 … … 1347 1347 if (RT_FAILURE(vrc)) 1348 1348 return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1349 m_pMachine->tr("Could not delete file '%s' (%Rrc)"),1349 tr("Could not delete file '%s' (%Rrc)"), 1350 1350 listOfFiles.at(i).c_str(), vrc); 1351 1351 … … 1383 1383 else 1384 1384 return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1385 m_pMachine->tr("Could not get the size of file '%s': %Rrc"),1385 tr("Could not get the size of file '%s': %Rrc"), 1386 1386 fullPath.c_str(), 1387 1387 vrc); … … 1569 1569 if (RT_FAILURE(vrc)) 1570 1570 return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1571 m_pMachine->tr("Could not get file size of '%s': %Rrc"),1571 tr("Could not get file size of '%s': %Rrc"), 1572 1572 sft.strFile.c_str(), 1573 1573 vrc); … … 1601 1601 if (RT_FAILURE(vrc)) 1602 1602 return m_pMachine->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 1603 m_pMachine->tr("Could not get file size of '%s': %Rrc"),1603 tr("Could not get file size of '%s': %Rrc"), 1604 1604 sft.strFile.c_str(), 1605 1605 vrc); -
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r87241 r90828 28 28 #include "LoggingNew.h" 29 29 #include "AutostartDb.h" 30 #include "VirtualBoxTranslator.h" 30 31 31 32 // generated header … … 34 35 #include <iprt/dir.h> 35 36 #include <iprt/ldr.h> 37 #include <iprt/locale.h> 36 38 #include <iprt/path.h> 37 39 #include <iprt/string.h> … … 1874 1876 m->strProxyUrl = data.strProxyUrl; 1875 1877 1878 m->strLanguageId = data.strLanguageId; 1879 1876 1880 m->fVBoxUpdateEnabled = data.fVBoxUpdateEnabled; 1877 1881 m->uVBoxUpdateFrequency = data.uVBoxUpdateFrequency; … … 2271 2275 } 2272 2276 2277 HRESULT SystemProperties::getLanguageId(com::Utf8Str &aLanguageId) 2278 { 2279 #ifdef VBOX_WITH_MAIN_NLS 2280 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2281 aLanguageId = m->strLanguageId; 2282 alock.release(); 2283 2284 HRESULT hrc = S_OK; 2285 if (aLanguageId.isEmpty()) 2286 { 2287 char szLocale[256]; 2288 memset(szLocale, 0, sizeof(szLocale)); 2289 int vrc = RTLocaleQueryNormalizedBaseLocaleName(szLocale, sizeof(szLocale)); 2290 if (RT_SUCCESS(vrc)) 2291 aLanguageId = szLocale; 2292 else 2293 hrc = Global::vboxStatusCodeToCOM(vrc); 2294 } 2295 return hrc; 2296 #else 2297 aLanguageId = "C"; 2298 return S_OK; 2299 #endif 2300 } 2301 2302 HRESULT SystemProperties::setLanguageId(const com::Utf8Str &aLanguageId) 2303 { 2304 #ifdef VBOX_WITH_MAIN_NLS 2305 VirtualBoxTranslator *pTranslator = VirtualBoxTranslator::instance(); 2306 if (!pTranslator) 2307 return E_FAIL; 2308 2309 HRESULT hrc = S_OK; 2310 int vrc = pTranslator->i_loadLanguage(aLanguageId.c_str()); 2311 if (RT_SUCCESS(vrc)) 2312 { 2313 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2314 m->strLanguageId = aLanguageId; 2315 alock.release(); 2316 2317 // VirtualBox::i_saveSettings() needs vbox write lock 2318 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 2319 hrc = mParent->i_saveSettings(); 2320 } 2321 else 2322 hrc = Global::vboxStatusCodeToCOM(vrc); 2323 2324 pTranslator->release(); 2325 2326 if (SUCCEEDED(hrc)) 2327 mParent->i_onLanguageChanged(aLanguageId); 2328 2329 return hrc; 2330 #else 2331 NOREF(aLanguageId); 2332 return E_NOTIMPL; 2333 #endif 2334 } 2335 2273 2336 HRESULT SystemProperties::getVBoxUpdateFrequency(ULONG *aVBoxUpdateFrequency) 2274 2337 { -
trunk/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp
r82968 r90828 265 265 END_COM_MAP() 266 266 267 DECLARE_ EMPTY_CTOR_DTOR(USBDeviceFilter)267 DECLARE_COMMON_CLASS_METHODS(USBDeviceFilter) 268 268 269 269 // IUSBDeviceFilter properties -
trunk/src/VBox/Main/src-server/USBProxyService.cpp
r82968 r90828 949 949 va_list va; 950 950 va_start(va, aText); 951 HRESULT rc = VirtualBoxBase::setErrorInternal (aResultCode,952 COM_IIDOF(IHost),953 "USBProxyService",954 Utf8Str(aText, va),955 false /* aWarning*/,956 true /* aLogIt*/);951 HRESULT rc = VirtualBoxBase::setErrorInternalV(aResultCode, 952 COM_IIDOF(IHost), 953 "USBProxyService", 954 aText, va, 955 false /* aWarning*/, 956 true /* aLogIt*/); 957 957 va_end(va); 958 958 return rc; -
trunk/src/VBox/Main/src-server/UnattendedInstaller.cpp
r86270 r90828 165 165 if (RT_FAILURE(vrc)) 166 166 return mpParent->setErrorBoth(E_FAIL, vrc, 167 mpParent->tr("Failed to construct path to the unattended installer script templates (%Rrc)"),167 tr("Failed to construct path to the unattended installer script templates (%Rrc)"), 168 168 vrc); 169 169 } … … 183 183 if (RT_FAILURE(vrc)) 184 184 return mpParent->setErrorBoth(E_FAIL, vrc, 185 mpParent->tr("Failed to construct path to the unattended installer script templates (%Rrc)"),185 tr("Failed to construct path to the unattended installer script templates (%Rrc)"), 186 186 vrc); 187 187 } … … 208 208 */ 209 209 if (mpParent->i_getIsoPath().isEmpty()) 210 return mpParent->setError(E_INVALIDARG, mpParent->tr("Cannot proceed with an empty installation ISO path"));210 return mpParent->setError(E_INVALIDARG, tr("Cannot proceed with an empty installation ISO path")); 211 211 if (mpParent->i_getUser().isEmpty()) 212 return mpParent->setError(E_INVALIDARG, mpParent->tr("Empty user name is not allowed"));212 return mpParent->setError(E_INVALIDARG, tr("Empty user name is not allowed")); 213 213 if (mpParent->i_getPassword().isEmpty()) 214 return mpParent->setError(E_INVALIDARG, mpParent->tr("Empty password is not allowed"));214 return mpParent->setError(E_INVALIDARG, tr("Empty password is not allowed")); 215 215 216 216 LogRelFunc(("UnattendedInstaller::savePassedData(): \n")); … … 372 372 373 373 if (RTErrInfoIsSet(&ErrInfo.Core)) 374 hrc = mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Failed to open newly created floppy image '%s': %Rrc: %s"),374 hrc = mpParent->setErrorBoth(E_FAIL, vrc, tr("Failed to open newly created floppy image '%s': %Rrc: %s"), 375 375 pszFilename, vrc, ErrInfo.Core.pszMsg); 376 376 else 377 hrc = mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Failed to open newly created floppy image '%s': %Rrc"),377 hrc = mpParent->setErrorBoth(E_FAIL, vrc, tr("Failed to open newly created floppy image '%s': %Rrc"), 378 378 pszFilename, vrc); 379 379 } 380 380 else 381 hrc = mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Failed to format floppy image '%s': %Rrc"), pszFilename, vrc);381 hrc = mpParent->setErrorBoth(E_FAIL, vrc, tr("Failed to format floppy image '%s': %Rrc"), pszFilename, vrc); 382 382 RTVfsFileRelease(hVfsFile); 383 383 RTFileDelete(pszFilename); 384 384 } 385 385 else 386 hrc = mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Failed to create floppy image '%s': %Rrc"), pszFilename, vrc);386 hrc = mpParent->setErrorBoth(E_FAIL, vrc, tr("Failed to create floppy image '%s': %Rrc"), pszFilename, vrc); 387 387 return hrc; 388 388 } … … 425 425 else 426 426 hrc = mpParent->setErrorBoth(E_FAIL, vrc, 427 mpParent->tr("Error writing %zu bytes to '%s' in floppy image '%s': %Rrc"),427 tr("Error writing %zu bytes to '%s' in floppy image '%s': %Rrc"), 428 428 strScript.length(), pEditor->getDefaultFilename(), 429 429 getAuxiliaryFloppyFilePath().c_str()); … … 433 433 else 434 434 hrc = mpParent->setErrorBoth(E_FAIL, vrc, 435 mpParent->tr("Error creating '%s' in floppy image '%s': %Rrc"),435 tr("Error creating '%s' in floppy image '%s': %Rrc"), 436 436 pEditor->getDefaultFilename(), getAuxiliaryFloppyFilePath().c_str()); 437 437 return hrc; … … 505 505 int vrc = RTVfsFileOpenNormal(pszIsoPath, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE, &hOrgIsoFile); 506 506 if (RT_FAILURE(vrc)) 507 return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Failed to open ISO image '%s' (%Rrc)"), pszIsoPath, vrc);507 return mpParent->setErrorBoth(E_FAIL, vrc, tr("Failed to open ISO image '%s' (%Rrc)"), pszIsoPath, vrc); 508 508 509 509 /* Pass the file to the ISO file system interpreter. */ … … 514 514 return S_OK; 515 515 if (RTErrInfoIsSet(&ErrInfo.Core)) 516 return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("ISO reader fail to open '%s' (%Rrc): %s"),516 return mpParent->setErrorBoth(E_FAIL, vrc, tr("ISO reader fail to open '%s' (%Rrc): %s"), 517 517 pszIsoPath, vrc, ErrInfo.Core.pszMsg); 518 return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("ISO reader fail to open '%s' (%Rrc)"), pszIsoPath, vrc);518 return mpParent->setErrorBoth(E_FAIL, vrc, tr("ISO reader fail to open '%s' (%Rrc)"), pszIsoPath, vrc); 519 519 } 520 520 … … 524 524 if (RT_SUCCESS(vrc)) 525 525 return S_OK; 526 return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("RTFsIsoMakerCreate failed (%Rrc)"), vrc);526 return mpParent->setErrorBoth(E_FAIL, vrc, tr("RTFsIsoMakerCreate failed (%Rrc)"), vrc); 527 527 } 528 528 … … 583 583 else 584 584 hrc = mpParent->setErrorBoth(E_FAIL, vrc, 585 mpParent->tr("RTFsIsoMakerAddFileWithVfsFile failed on the script '%s' (%Rrc)"),585 tr("RTFsIsoMakerAddFileWithVfsFile failed on the script '%s' (%Rrc)"), 586 586 pszDstFilename, vrc); 587 587 } 588 588 else 589 589 hrc = mpParent->setErrorBoth(E_FAIL, vrc, 590 mpParent->tr("RTVfsFileFromBuffer failed on the %zu byte script '%s' (%Rrc)"),590 tr("RTVfsFileFromBuffer failed on the %zu byte script '%s' (%Rrc)"), 591 591 cchScript, pszDstFilename, vrc); 592 592 } … … 601 601 int vrc = RTFsIsoMakerFinalize(hIsoMaker); 602 602 if (RT_FAILURE(vrc)) 603 return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("RTFsIsoMakerFinalize failed (%Rrc)"), vrc);603 return mpParent->setErrorBoth(E_FAIL, vrc, tr("RTFsIsoMakerFinalize failed (%Rrc)"), vrc); 604 604 605 605 /* … … 616 616 { 617 617 if (vrc == VERR_ALREADY_EXISTS) 618 return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("The auxiliary ISO image file '%s' already exists"),618 return mpParent->setErrorBoth(E_FAIL, vrc, tr("The auxiliary ISO image file '%s' already exists"), 619 619 pszFilename); 620 return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Failed to open the auxiliary ISO image file '%s' for writing (%Rrc)"),620 return mpParent->setErrorBoth(E_FAIL, vrc, tr("Failed to open the auxiliary ISO image file '%s' for writing (%Rrc)"), 621 621 pszFilename, vrc); 622 622 } … … 639 639 hrc = S_OK; 640 640 else 641 hrc = mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("Error writing auxiliary ISO image '%s' (%Rrc)"),641 hrc = mpParent->setErrorBoth(E_FAIL, vrc, tr("Error writing auxiliary ISO image '%s' (%Rrc)"), 642 642 pszFilename, vrc); 643 643 } 644 644 else 645 645 hrc = mpParent->setErrorBoth(E_FAIL, VERR_INTERNAL_ERROR_2, 646 mpParent->tr("Internal Error: Failed to case VFS file to VFS I/O stream"));646 tr("Internal Error: Failed to case VFS file to VFS I/O stream")); 647 647 RTVfsIoStrmRelease(hVfsSrcIso); 648 648 RTVfsIoStrmRelease(hVfsDstIso); 649 649 } 650 650 else 651 hrc = mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("RTFsIsoMakerCreateVfsOutputFile failed (%Rrc)"), vrc);651 hrc = mpParent->setErrorBoth(E_FAIL, vrc, tr("RTFsIsoMakerCreateVfsOutputFile failed (%Rrc)"), vrc); 652 652 RTVfsFileRelease(hVfsSrcFile); 653 653 RTVfsFileRelease(hVfsDstFile); … … 757 757 RTMemTmpFree(papszArgs); 758 758 if (RT_FAILURE(vrc)) 759 return mpParent->setErrorBoth(E_FAIL, vrc, mpParent->tr("RTGetOptArgvToString failed (%Rrc)"), vrc);759 return mpParent->setErrorBoth(E_FAIL, vrc, tr("RTGetOptArgvToString failed (%Rrc)"), vrc); 760 760 761 761 /* … … 780 780 hrc = S_OK; 781 781 else 782 hrc = mpParent->setErrorBoth(VBOX_E_FILE_ERROR, vrc, mpParent->tr("Error writing '%s' (%Rrc)"), pszFilename, vrc);782 hrc = mpParent->setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr("Error writing '%s' (%Rrc)"), pszFilename, vrc); 783 783 } 784 784 else 785 hrc = mpParent->setErrorBoth(VBOX_E_FILE_ERROR, vrc, mpParent->tr("Failed to create '%s' (%Rrc)"), pszFilename, vrc);785 hrc = mpParent->setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr("Failed to create '%s' (%Rrc)"), pszFilename, vrc); 786 786 787 787 RTStrFree(pszCmdLine); … … 802 802 } 803 803 else 804 hrc = mpParent->setErrorBoth(VBOX_E_FILE_ERROR, vrc, mpParent->tr("Failed to open '%s' on the ISO '%s' (%Rrc)"),804 hrc = mpParent->setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr("Failed to open '%s' on the ISO '%s' (%Rrc)"), 805 805 pszFilename, mpParent->i_getIsoPath().c_str(), vrc); 806 806 return hrc; -
trunk/src/VBox/Main/src-server/UnattendedScript.cpp
r86660 r90828 131 131 && strncmp(pszPlaceholder, s_szPrefixCond, sizeof(s_szPrefixCond) - 1) != 0 ) ) 132 132 { 133 hrc = mpSetError->setError(E_FAIL, mpSetError->tr("Malformed template placeholder '%.*s'"),133 hrc = mpSetError->setError(E_FAIL, tr("Malformed template placeholder '%.*s'"), 134 134 cchPlaceholder, pszPlaceholder); 135 135 break; … … 179 179 { 180 180 hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR, 181 mpSetError->tr("%s without @@VBOX_COND_XXX@@ at offset %zu (%#zx)"),181 tr("%s without @@VBOX_COND_XXX@@ at offset %zu (%#zx)"), 182 182 s_szPrefixCondEnd, offPlaceholder, offPlaceholder); 183 183 break; … … 205 205 { 206 206 hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR, 207 mpSetError->tr("Too deep conditional nesting at offset %zu (%#zx)"),207 tr("Too deep conditional nesting at offset %zu (%#zx)"), 208 208 offPlaceholder, offPlaceholder); 209 209 break; … … 220 220 return S_OK; 221 221 if (cConds == 1) 222 hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR, mpSetError->tr("Missing @@VBOX_COND_END@@"));222 hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR, tr("Missing @@VBOX_COND_END@@")); 223 223 else 224 hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR, mpSetError->tr("Missing %u @@VBOX_COND_END@@"), cConds);224 hrc = mpSetError->setErrorBoth(E_FAIL, VERR_PARSE_ERROR, tr("Missing %u @@VBOX_COND_END@@"), cConds); 225 225 break; 226 226 } … … 392 392 { 393 393 rValue.setNull(); 394 return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, mpSetError->tr("Unknown guest OS major version '%s'"),394 return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, tr("Unknown guest OS major version '%s'"), 395 395 partList.at(0).c_str()); 396 396 } … … 441 441 { 442 442 rValue.setNull(); 443 return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, mpSetError->tr("Unknown template placeholder '%.*s'"),443 return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, tr("Unknown template placeholder '%.*s'"), 444 444 cchFullPlaceholder, pachPlaceholder); 445 445 } … … 526 526 } 527 527 else 528 return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, mpSetError->tr("Unknown conditional placeholder '%.*s'"),528 return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, tr("Unknown conditional placeholder '%.*s'"), 529 529 cchPlaceholder, pachPlaceholder); 530 530 return S_OK; … … 566 566 } 567 567 else if (pelmRoot) 568 hrc = mpSetError->setError(E_FAIL, mpSetError->tr("XML document root element is '%s' instead of 'profile'"),568 hrc = mpSetError->setError(E_FAIL, tr("XML document root element is '%s' instead of 'profile'"), 569 569 pelmRoot->getName()); 570 570 else 571 hrc = mpSetError->setError(E_FAIL, mpSetError->tr("Missing XML root element"));571 hrc = mpSetError->setError(E_FAIL, tr("Missing XML root element")); 572 572 } 573 573 return hrc; -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r90440 r90828 297 297 , pAutostartDb(NULL) 298 298 , fSettingsCipherKeySet(false) 299 #ifdef VBOX_WITH_MAIN_NLS 300 , pVBoxTranslator(NULL) 301 #endif 299 302 #if defined(RT_OS_WINDOWS) && defined(VBOXSVC_WITH_CLIENT_WATCHER) 300 303 , fWatcherIsReliable(RTSystemGetNtVersion() >= RTSYSTEM_MAKE_NT_VERSION(6, 0, 0)) … … 405 408 bool fSettingsCipherKeySet; 406 409 uint8_t SettingsCipherKey[RTSHA512_HASH_SIZE]; 407 410 #ifdef VBOX_WITH_MAIN_NLS 411 VirtualBoxTranslator *pVBoxTranslator; 412 #endif 408 413 #if defined(RT_OS_WINDOWS) && defined(VBOXSVC_WITH_CLIENT_WATCHER) 409 414 /** Critical section protecting WatchedProcesses. */ … … 596 601 rc = m->pSystemProperties->i_loadSettings(m->pMainConfigFile->systemProperties); 597 602 if (FAILED(rc)) throw rc; 598 603 #ifdef VBOX_WITH_MAIN_NLS 604 m->pVBoxTranslator = VirtualBoxTranslator::instance(); 605 /* Do not throw an exception on language errors. 606 * Just do not use translation. */ 607 if (m->pVBoxTranslator) 608 { 609 com::Utf8Str strLocale; 610 HRESULT hrc = m->pSystemProperties->getLanguageId(strLocale); 611 if (SUCCEEDED(hrc)) 612 { 613 int vrc = m->pVBoxTranslator->i_loadLanguage(strLocale.c_str()); 614 if (RT_FAILURE(vrc)) 615 { 616 hrc = Global::vboxStatusCodeToCOM(vrc); 617 LogRel(("Load language failed (%Rhrc).\n", hrc)); 618 } 619 } 620 else 621 { 622 LogRel(("Getting language settings failed (%Rhrc).\n", hrc)); 623 m->pVBoxTranslator->release(); 624 m->pVBoxTranslator = NULL; 625 } 626 } 627 else 628 LogRel(("Translator creation failed.\n")); 629 #endif 599 630 /* guest OS type objects, needed by machines */ 600 631 for (size_t i = 0; i < Global::cOSTypes; ++i) … … 1093 1124 1094 1125 delete m->pAutostartDb; 1095 1126 #ifdef VBOX_WITH_MAIN_NLS 1127 if (m->pVBoxTranslator) 1128 m->pVBoxTranslator->release(); 1129 #endif 1096 1130 // clean up our instance data 1097 1131 delete m; … … 3516 3550 } 3517 3551 3552 void VirtualBox::i_onLanguageChanged(const Utf8Str &aLanguageId) 3553 { 3554 ComPtr<IEvent> ptrEvent; 3555 HRESULT hrc = ::CreateLanguageChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aLanguageId); 3556 AssertComRCReturnVoid(hrc); 3557 i_postEvent(new AsyncEvent(this, ptrEvent)); 3558 } 3518 3559 3519 3560 void VirtualBox::i_onProgressCreated(const Guid &aId, BOOL aCreated) … … 5280 5321 if (RT_FAILURE(vrc)) 5281 5322 return i_setErrorStaticBoth(VBOX_E_IPRT_ERROR, vrc, 5282 Utf8StrFmt(tr("Could not create the directory '%s' (%Rrc)"),5283 5284 vrc));5323 tr("Could not create the directory '%s' (%Rrc)"), 5324 strDir.c_str(), 5325 vrc); 5285 5326 } 5286 5327 else 5287 5328 return i_setErrorStaticBoth(VBOX_E_IPRT_ERROR, VERR_FILE_NOT_FOUND, 5288 Utf8StrFmt(tr("Directory '%s' does not exist"), strDir.c_str()));5329 tr("Directory '%s' does not exist"), strDir.c_str()); 5289 5330 } 5290 5331 -
trunk/src/VBox/Main/xml/Settings.cpp
r88345 r90828 2262 2262 pelmGlobalChild->getAttributeValue("VBoxUpdateLastCheckDate", 2263 2263 systemProperties.strVBoxUpdateLastCheckDate); 2264 pelmGlobalChild->getAttributeValue("LanguageId", systemProperties.strLanguageId); 2264 2265 } 2265 2266 else if (pelmGlobalChild->nameEquals("ExtraData")) … … 2480 2481 if (systemProperties.strVBoxUpdateLastCheckDate.length()) 2481 2482 pelmSysProps->setAttribute("VBoxUpdateLastCheckDate", systemProperties.strVBoxUpdateLastCheckDate); 2483 if (systemProperties.strLanguageId.isNotEmpty()) 2484 pelmSysProps->setAttribute("LanguageId", systemProperties.strLanguageId); 2482 2485 2483 2486 buildUSBDeviceFilters(*pelmGlobal->createChild("USBDeviceFilters"),
Note:
See TracChangeset
for help on using the changeset viewer.