Changeset 91312 in vbox
- Timestamp:
- Sep 20, 2021 11:06:57 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Config.kmk
r91215 r91312 276 276 # src/VBox/Additions/WINNT/Installer/ISO/ReadmeDrivers.txt 277 277 # src/VBox/Main/nls/*.ts 278 # src/VBox/ExtPacks/Puel/nls/*.ts 278 279 # */*.inf, */*.rc 279 280 … … 670 671 # Whether to enable error message translation in Main. 671 672 #VBOX_WITH_MAIN_NLS = 1 673 # Whether to enable error message translation in Extension VM Pack. 674 #VBOX_WITH_PUEL_NLS = 1 672 675 # Set this to prefix all C symbols in XPCOM, to avoid dynamic linking problems 673 676 # caused by our XPCOM library polluting the symbol namespace for system libs. … … 1244 1247 1245 1248 # 1246 # Disable NLS support for only SDK builds 1247 # 1249 # VBOX_WITH_NLS controls all NLS (except the GUI at the moment). 1250 # We disable NLS for SDK-only builds. 1251 # 1252 if defined(VBOX_WITH_MAIN_NLS) || defined(VBOX_WITH_PUEL_NLS) 1253 VBOX_WITH_NLS := 1 1254 endif 1248 1255 ifdef VBOX_ONLY_SDK 1249 VBOX_WITH_MAIN_NLS = 1250 endif 1251 1256 override VBOX_WITH_NLS := 1257 endif 1258 ifndef VBOX_WITH_NLS # (We test again to account for 'override VBOX_WITH_NLS :=') 1259 VBOX_WITH_MAIN_NLS := 1260 VBOX_WITH_PUEL_NLS := 1261 endif 1252 1262 1253 1263 # … … 6985 6995 # Qt 6986 6996 # 6987 ifdef VBOX_WITH_QTGUI 6997 6998 if defined(VBOX_WITH_QTGUI) || defined(VBOX_WITH_NLS) 6988 6999 6989 7000 # Guess VBOX_WITH_ORACLE_QT … … 7083 7094 TOOL_QT5_MOCFLAGS.darwin += --include qconfig.h --include qglobal.h 7084 7095 7085 # 7086 # Template for building Qt GUI executables. 7087 # 7088 TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable 7089 TEMPLATE_VBOXQTGUIEXE_USES = qt5 7090 TEMPLATE_VBOXQTGUIEXE_QTTOOL = QT5 7091 TEMPLATE_VBOXQTGUIEXE_MOCTOOL = QT5 7092 TEMPLATE_VBOXQTGUIEXE_UICTOOL = QT5 7093 TEMPLATE_VBOXQTGUIEXE_RCCTOOL = QT5 7094 TEMPLATE_VBOXQTGUIEXE_LRCTOOL = QT5 7095 TEMPLATE_VBOXQTGUIEXE_SDKS = QT5 7096 TEMPLATE_VBOXQTGUIEXE_QT_INFIX = $(VBOX_QT_INFIX) 7097 TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT QT_SHARED HAVE_CONFIG_H $(ARCH_BITS_DEFS) 7098 TEMPLATE_VBOXQTGUIEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS) 7099 7100 ifeq ($(KBUILD_TARGET),win) 7101 # Note! No use of VBOX_VCC_CRT_TYPE here yet as it requires a /MDd build of Qt as well. 7102 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL) 7103 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" 7104 TEMPLATE_VBOXQTGUIEXE_SDKS = WINSDK10-UCRT 7105 endif 7106 TEMPLATE_VBOXQTGUIEXE_DEFS += \ 7107 _WIN32_WINNT=0x0500 UNICODE _UNICODE \ 7108 QT_DLL _CRT_SECURE_NO_DEPRECATE \ 7109 $(QMAKE_PRL_DEFINES) 7110 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = -nologo -Zm200 -MD -Zi -EHsc -Zc:wchar_t- 7111 # -wd4481: nonstandard extension used: override specifier 'override' 7112 # -wd4625: 'QRubberBand' : copy constructor could not be generated because a base class copy constructor is inaccessible 7113 # -wd4626: 'QRubberBand' : assignment operator could not be generated because a base class assignment operator is inaccessible 7114 # -wd4640: qmetatype.h(2210): warning C4640: 'f' : construction of local static object is not thread-safe [too bad] 7115 # -wd4350: behavior change: 'int QStringList::indexOf(const QRegExp &,int) const' called instead of 'int QStringList::indexOf(QRegExp &,int) const' 7116 # -wd4121: UIActionPool.h(393) : warning C4121: 'UIActionPool::PointerToFunction' : alignment of a member was sensitive to packing 7117 # -wd4718: qmap.h(222) : warning C4718: 'QMapNode<enum DetailsElementType,bool>::destroySubTree' : recursive call has no side effects, deleting 7118 # -wd5204: pplwin.h(78): warning C5204: 'Concurrency::details::_DefaultPPLTaskScheduler': class has virtual functions 7119 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += $(VBOX_VCC_WARN_ALL) -wd4481 -wd4625 -wd4626 -wd4640 -wd4350 -wd4371 -wd4121 -wd4718 -wd5204 $(VBOX_VCC_WERR) 7120 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" 7121 # -wd4619: qvectro.h(305 : warning C4619: #pragma warning : there is no warning number '4345' 7122 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += -wd4619 7123 endif 7124 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" 7125 # -wd4774: string(530): warning C4774: '_scprintf' : format string expected in argument 1 is not a string literal 7126 # -wd4456: UICommon.cpp(1471): warning C4456: declaration of '_container_' hides previous local declaration [nested foreach] 7127 # -wd4458: UISettingsDialogSpecific.cpp(416): warning C4458: declaration of 'data' hides class member 7128 # qwidget.h(730): note: see declaration of 'QWidget::data' 7129 # -wd4946: qmap.h(213): warning C4946: reinterpret_cast used between related classes: 'QMapNodeBase' and 'QMapNode<Key,T>' 7130 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += -wd4774 -wd4456 -wd4458 -wd4946 7131 endif 7132 ifdef VBOX_WITH_MSC_ANALYZE_THIS 7133 TEMPLATE_VBOXR0DRV_CXXFLAGS += /analyze 7134 endif 7135 7136 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu 7137 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu 7138 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE) 7139 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS) 7140 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.debug = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug) 7141 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.dbgopt = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.dbgopt) 7142 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = -Ignore:4197 \ 7143 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug /Opt:Ref /Opt:Icf \ 7144 /Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \ 7145 /STUB:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com 7146 if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_HARDENING) 7147 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -IntegrityCheck 7148 endif 7149 7150 TEMPLATE_VBOXQTGUIEXE_SDKS += $(VBOX_WINPSDK) 7151 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" 7152 TEMPLATE_VBOXQTGUIEXE_LIBS = \ 7153 $(VBOX_LIBS_QT) \ 7154 $(LIB_RUNTIME) \ 7155 $(VBOX_LIB_VMM_LAZY) \ 7156 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/vcruntime.lib \ 7157 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \ 7158 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \ 7159 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \ 7160 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib 7161 else 7162 TEMPLATE_VBOXQTGUIEXE_LIBS = \ 7163 $(VBOX_LIBS_QT) \ 7164 $(LIB_RUNTIME) \ 7165 $(VBOX_LIB_VMM_LAZY) \ 7166 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \ 7167 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \ 7168 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \ 7169 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib 7170 endif 7171 TEMPLATE_VBOXQTGUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS) 7172 7173 else # the gcc guys: 7174 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL) 7175 if $(VBOX_GCC_VERSION_CC) < 30400 7176 TEMPLATE_VBOXQTGUIEXE_DEFS += RT_WITHOUT_PRAGMA_ONCE 7177 endif 7178 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT 7179 TEMPLATE_VBOXQTGUIEXE_DEFS.solaris = _REENTRANT 7180 7181 ## @todo Use VBOX_GCC_PEDANTIC_CXX? 7182 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \ 7096 ifdef VBOX_WITH_QTGUI 7097 # 7098 # Template for building Qt GUI executables. 7099 # 7100 TEMPLATE_VBOXQTGUIEXE = VBox Qt GUI Executable 7101 TEMPLATE_VBOXQTGUIEXE_USES = qt5 7102 TEMPLATE_VBOXQTGUIEXE_QTTOOL = QT5 7103 TEMPLATE_VBOXQTGUIEXE_MOCTOOL = QT5 7104 TEMPLATE_VBOXQTGUIEXE_UICTOOL = QT5 7105 TEMPLATE_VBOXQTGUIEXE_RCCTOOL = QT5 7106 TEMPLATE_VBOXQTGUIEXE_LRCTOOL = QT5 7107 TEMPLATE_VBOXQTGUIEXE_SDKS = QT5 7108 TEMPLATE_VBOXQTGUIEXE_QT_INFIX = $(VBOX_QT_INFIX) 7109 TEMPLATE_VBOXQTGUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT QT_SHARED HAVE_CONFIG_H $(ARCH_BITS_DEFS) 7110 TEMPLATE_VBOXQTGUIEXE_RCDEFS = $(TEMPLATE_VBOXR3EXE_RCDEFS) 7111 7112 ifeq ($(KBUILD_TARGET),win) 7113 # Note! No use of VBOX_VCC_CRT_TYPE here yet as it requires a /MDd build of Qt as well. 7114 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_VCC_TOOL) 7115 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" 7116 TEMPLATE_VBOXQTGUIEXE_SDKS = WINSDK10-UCRT 7117 endif 7118 TEMPLATE_VBOXQTGUIEXE_DEFS += \ 7119 _WIN32_WINNT=0x0500 UNICODE _UNICODE \ 7120 QT_DLL _CRT_SECURE_NO_DEPRECATE \ 7121 $(QMAKE_PRL_DEFINES) 7122 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = -nologo -Zm200 -MD -Zi -EHsc -Zc:wchar_t- 7123 # -wd4481: nonstandard extension used: override specifier 'override' 7124 # -wd4625: 'QRubberBand' : copy constructor could not be generated because a base class copy constructor is inaccessible 7125 # -wd4626: 'QRubberBand' : assignment operator could not be generated because a base class assignment operator is inaccessible 7126 # -wd4640: qmetatype.h(2210): warning C4640: 'f' : construction of local static object is not thread-safe [too bad] 7127 # -wd4350: behavior change: 'int QStringList::indexOf(const QRegExp &,int) const' called instead of 'int QStringList::indexOf(QRegExp &,int) const' 7128 # -wd4121: UIActionPool.h(393) : warning C4121: 'UIActionPool::PointerToFunction' : alignment of a member was sensitive to packing 7129 # -wd4718: qmap.h(222) : warning C4718: 'QMapNode<enum DetailsElementType,bool>::destroySubTree' : recursive call has no side effects, deleting 7130 # -wd5204: pplwin.h(78): warning C5204: 'Concurrency::details::_DefaultPPLTaskScheduler': class has virtual functions 7131 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += $(VBOX_VCC_WARN_ALL) -wd4481 -wd4625 -wd4626 -wd4640 -wd4350 -wd4371 -wd4121 -wd4718 -wd5204 $(VBOX_VCC_WERR) 7132 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120" 7133 # -wd4619: qvectro.h(305 : warning C4619: #pragma warning : there is no warning number '4345' 7134 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += -wd4619 7135 endif 7136 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" 7137 # -wd4774: string(530): warning C4774: '_scprintf' : format string expected in argument 1 is not a string literal 7138 # -wd4456: UICommon.cpp(1471): warning C4456: declaration of '_container_' hides previous local declaration [nested foreach] 7139 # -wd4458: UISettingsDialogSpecific.cpp(416): warning C4458: declaration of 'data' hides class member 7140 # qwidget.h(730): note: see declaration of 'QWidget::data' 7141 # -wd4946: qmap.h(213): warning C4946: reinterpret_cast used between related classes: 'QMapNodeBase' and 'QMapNode<Key,T>' 7142 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += -wd4774 -wd4456 -wd4458 -wd4946 7143 endif 7144 ifdef VBOX_WITH_MSC_ANALYZE_THIS 7145 TEMPLATE_VBOXR0DRV_CXXFLAGS += /analyze 7146 endif 7147 7148 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu 7149 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug = -RTCsu 7150 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.dbgopt = $(NO_SUCH_VARIABLE) 7151 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS) 7152 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.debug = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug) 7153 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.dbgopt = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.dbgopt) 7154 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = -Ignore:4197 \ 7155 /NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug /Opt:Ref /Opt:Icf \ 7156 /Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \ 7157 /STUB:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com 7158 if defined(VBOX_SIGNING_MODE) && defined(VBOX_WITH_HARDENING) 7159 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -IntegrityCheck 7160 endif 7161 7162 TEMPLATE_VBOXQTGUIEXE_SDKS += $(VBOX_WINPSDK) 7163 if "$(VBOX_VCC_TOOL_STEM)" >= "VCC140" 7164 TEMPLATE_VBOXQTGUIEXE_LIBS = \ 7165 $(VBOX_LIBS_QT) \ 7166 $(LIB_RUNTIME) \ 7167 $(VBOX_LIB_VMM_LAZY) \ 7168 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/vcruntime.lib \ 7169 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \ 7170 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \ 7171 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \ 7172 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib 7173 else 7174 TEMPLATE_VBOXQTGUIEXE_LIBS = \ 7175 $(VBOX_LIBS_QT) \ 7176 $(LIB_RUNTIME) \ 7177 $(VBOX_LIB_VMM_LAZY) \ 7178 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \ 7179 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \ 7180 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \ 7181 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib 7182 endif 7183 TEMPLATE_VBOXQTGUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS) 7184 7185 else # the gcc guys: 7186 TEMPLATE_VBOXQTGUIEXE_TOOL = $(VBOX_GCC_TOOL) 7187 if $(VBOX_GCC_VERSION_CC) < 30400 7188 TEMPLATE_VBOXQTGUIEXE_DEFS += RT_WITHOUT_PRAGMA_ONCE 7189 endif 7190 TEMPLATE_VBOXQTGUIEXE_DEFS.linux = _REENTRANT 7191 TEMPLATE_VBOXQTGUIEXE_DEFS.solaris = _REENTRANT 7192 7193 ## @todo Use VBOX_GCC_PEDANTIC_CXX? 7194 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = \ 7183 7195 -g $(VBOX_GCC_pipe) $(filter-out -Wno-unused $(VBOX_GCC_Wno-unused-parameter),$(VBOX_GCC_WARN)) -frtti -fno-exceptions \ 7184 7196 -Wno-long-long -fshort-wchar -fno-strict-aliasing \ 7185 7197 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_Wno-multistatement-macros) $(VBOX_GCC_Wno-ignored-qualifiers) \ 7186 7198 $(VBOX_GCC_Wno-return-type-c-linkage) $(VBOX_GCC_std) $(VBOX_GCC_IPRT_FMT_CHECK) $(VBOX_GCC_SANITIZER_FLAGS) 7187 ifdef VBOX_WITH_NO_GCC_WARNING_POLICY7188 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += $(VBOX_GCC_WERR)7189 endif7190 ifn1of ($(USERNAME),dsen serkan) # Bunch of stuff deprecated after 5.6.*. These guys knows how to deal with it. :)7191 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += $(VBOX_GCC_Wno-deprecated-declarations)7192 endif7193 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.x86 = -m327194 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.amd64 = -m647195 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread7196 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)7197 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.x86 = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.x86)7198 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.amd64 = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.amd64)7199 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.linux = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux)7200 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.debug = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug)7201 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.dbgopt = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.dbgopt)7202 TEMPLATE_VBOXQTGUIEXE_OBJCFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_C) -fno-exceptions $(VBOX_GCC_IPRT_FMT_CHECK)7203 TEMPLATE_VBOXQTGUIEXE_OBJCFLAGS.x86 = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.x86)7204 TEMPLATE_VBOXQTGUIEXE_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.amd64)7205 TEMPLATE_VBOXQTGUIEXE_OBJCXXFLAGS = \7199 ifdef VBOX_WITH_NO_GCC_WARNING_POLICY 7200 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += $(VBOX_GCC_WERR) 7201 endif 7202 ifn1of ($(USERNAME),dsen serkan) # Bunch of stuff deprecated after 5.6.*. These guys knows how to deal with it. :) 7203 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += $(VBOX_GCC_Wno-deprecated-declarations) 7204 endif 7205 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.x86 = -m32 7206 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.amd64 = -m64 7207 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -pthread 7208 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS) 7209 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.x86 = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.x86) 7210 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.amd64 = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.amd64) 7211 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.linux = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux) 7212 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.debug = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.debug) 7213 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.dbgopt = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.dbgopt) 7214 TEMPLATE_VBOXQTGUIEXE_OBJCFLAGS = -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_C) -fno-exceptions $(VBOX_GCC_IPRT_FMT_CHECK) 7215 TEMPLATE_VBOXQTGUIEXE_OBJCFLAGS.x86 = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.x86) 7216 TEMPLATE_VBOXQTGUIEXE_OBJCFLAGS.amd64 = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.amd64) 7217 TEMPLATE_VBOXQTGUIEXE_OBJCXXFLAGS = \ 7206 7218 -g $(VBOX_GCC_pipe) $(VBOX_GCC_PEDANTIC_CXX) \ 7207 7219 -frtti -fno-exceptions $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden) $(VBOX_GCC_IPRT_FMT_CHECK) 7208 ifdef VBOX_WITH_NO_GCC_WARNING_POLICY7209 TEMPLATE_VBOXQTGUIEXE_OBJCXXFLAGS += $(VBOX_GCC_WERR)7210 endif7211 TEMPLATE_VBOXQTGUIEXE_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.x86)7212 TEMPLATE_VBOXQTGUIEXE_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.amd64)7213 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = $(VBOX_GCC_SANITIZER_FLAGS) $(VBOX_GCC_SANITIZER_LDFLAGS)7214 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.x86 = -m327215 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.amd64 = -m647216 TEMPLATE_VBOXQTGUIEXE_LIBS = \7220 ifdef VBOX_WITH_NO_GCC_WARNING_POLICY 7221 TEMPLATE_VBOXQTGUIEXE_OBJCXXFLAGS += $(VBOX_GCC_WERR) 7222 endif 7223 TEMPLATE_VBOXQTGUIEXE_OBJCXXFLAGS.x86 = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.x86) 7224 TEMPLATE_VBOXQTGUIEXE_OBJCXXFLAGS.amd64 = $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.amd64) 7225 TEMPLATE_VBOXQTGUIEXE_LDFLAGS = $(VBOX_GCC_SANITIZER_FLAGS) $(VBOX_GCC_SANITIZER_LDFLAGS) 7226 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.x86 = -m32 7227 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.amd64 = -m64 7228 TEMPLATE_VBOXQTGUIEXE_LIBS = \ 7217 7229 $(VBOX_LIBS_QT) \ 7218 7230 $(LIB_RUNTIME) \ … … 7220 7232 $(VBOX_LIB_VMM_LAZY) 7221 7233 7222 ifeq ($(KBUILD_TARGET),linux) 7223 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed) 7234 ifeq ($(KBUILD_TARGET),linux) 7235 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -Wl,-z,noexecstack,-z,relro $(VBOX_LD_as_needed) 7236 TEMPLATE_VBOXQTGUIEXE_LIBS += \ 7237 $(VBOX_XCURSOR_LIBS) \ 7238 Xext \ 7239 X11 7240 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \ 7241 $(VBOX_LIBPATH_X11) 7242 else ifeq ($(KBUILD_TARGET),darwin) 7243 TEMPLATE_VBOXQTGUIEXE_SDKS.darwin += $(VBOX_DARWIN_DEF_SDK_SDKS) 7244 TEMPLATE_VBOXQTGUIEXE_DEFS.darwin += $(VBOX_DARWIN_DEF_SDK_DEFS) 7245 TEMPLATE_VBOXQTGUIEXE_CFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CFLAGS) 7246 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) 7247 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.darwin += $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.darwin) 7248 TEMPLATE_VBOXQTGUIEXE_OBJCFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS) 7249 TEMPLATE_VBOXQTGUIEXE_OBJCXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS) $(VBOX_GCC_std) 7250 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -bind_at_load -Wl,-headerpad_max_install_names 7251 TEMPLATE_VBOXQTGUIEXE_LIBS += 7252 TEMPLATE_VBOXQTGUIEXE_LIBPATH += 7253 else 7254 TEMPLATE_VBOXQTGUIEXE_INCS += \ 7255 $(VBOX_XCURSOR_INCS) 7256 TEMPLATE_VBOXQTGUIEXE_LIBS += \ 7257 $(VBOX_XCURSOR_LIBS) \ 7258 Xext \ 7259 X11 \ 7260 m \ 7261 $(LIB_PTHREAD) 7262 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \ 7263 $(VBOX_LIBPATH_X11) 7264 ifeq ($(KBUILD_TARGET),freebsd) 7265 TEMPLATE_VBOXQTGUIEXE_INCS += \ 7266 /usr/include \ 7267 /usr/X11R6/include \ 7268 /usr/local/include 7269 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \ 7270 /usr/lib \ 7271 /usr/X11R6/lib \ 7272 /usr/local/lib 7273 endif 7274 ifeq ($(KBUILD_TARGET),solaris) 7275 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.solaris = -Wl,-z,ignore # Same as VBOX_LD_as_needed. 7276 TEMPLATE_VBOXQTGUIEXE_LIBS += \ 7277 rt socket nsl 7278 endif 7279 endif 7280 # Assume the Qt shared objects are in the same directory as the executable, on Solaris too. 7281 ifdef VBOX_WITH_RUNPATH 7282 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)' 7283 else ifdef VBOX_WITH_RELATIVE_RUNPATH 7284 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)' 7285 endif 7286 7287 endif 7288 7289 # Add COM/XPCOM stuff 7290 TEMPLATE_VBOXQTGUIEXE_LIBS += \ 7291 $(PATH_STAGE_LIB)/VBoxCOM$(if-expr defined(VBOX_WITH_DEBUG_VCC_CRT) && $(KBUILD_TARGET) == win,-GUI,)$(VBOX_SUFF_LIB) 7292 ifdef VBOX_WITH_XPCOM 7293 ## @todo may be worth creating the VBOX_XPCOM SDK def, or just a SDK_VBOXXPCOM. 7294 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM 7295 ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP 7296 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP 7297 endif 7298 TEMPLATE_VBOXQTGUIEXE_INCS += \ 7299 $(VBOX_XPCOM_INCS) 7224 7300 TEMPLATE_VBOXQTGUIEXE_LIBS += \ 7225 $(VBOX_XCURSOR_LIBS) \ 7226 Xext \ 7227 X11 7228 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \ 7229 $(VBOX_LIBPATH_X11) 7230 else ifeq ($(KBUILD_TARGET),darwin) 7231 TEMPLATE_VBOXQTGUIEXE_SDKS.darwin += $(VBOX_DARWIN_DEF_SDK_SDKS) 7232 TEMPLATE_VBOXQTGUIEXE_DEFS.darwin += $(VBOX_DARWIN_DEF_SDK_DEFS) 7233 TEMPLATE_VBOXQTGUIEXE_CFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CFLAGS) 7234 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_CXXFLAGS) 7235 TEMPLATE_VBOXQTGUIEXE_PCHFLAGS.darwin += $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.darwin) 7236 TEMPLATE_VBOXQTGUIEXE_OBJCFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCFLAGS) 7237 TEMPLATE_VBOXQTGUIEXE_OBJCXXFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_OBJCXXFLAGS) $(VBOX_GCC_std) 7238 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.darwin += $(VBOX_DARWIN_DEF_SDK_LDFLAGS) -bind_at_load -Wl,-headerpad_max_install_names 7239 TEMPLATE_VBOXQTGUIEXE_LIBS += 7240 TEMPLATE_VBOXQTGUIEXE_LIBPATH += 7241 else 7301 $(LIB_XPCOM) 7302 TEMPLATE_VBOXQTGUIEXE_INTERMEDIATES += \ 7303 $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h 7304 else # COM 7242 7305 TEMPLATE_VBOXQTGUIEXE_INCS += \ 7243 $(VBOX_XCURSOR_INCS)7244 TEMPLATE_VBOXQTGUIEXE_LIBS += \7245 $(VBOX_XCURSOR_LIBS) \7246 Xext \7247 X11 \7248 m \7249 $(LIB_PTHREAD)7250 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \7251 $(VBOX_LIBPATH_X11)7252 ifeq ($(KBUILD_TARGET),freebsd)7253 TEMPLATE_VBOXQTGUIEXE_INCS += \7254 /usr/include \7255 /usr/X11R6/include \7256 /usr/local/include7257 TEMPLATE_VBOXQTGUIEXE_LIBPATH += \7258 /usr/lib \7259 /usr/X11R6/lib \7260 /usr/local/lib7261 endif7262 ifeq ($(KBUILD_TARGET),solaris)7263 TEMPLATE_VBOXQTGUIEXE_LDFLAGS.solaris = -Wl,-z,ignore # Same as VBOX_LD_as_needed.7264 TEMPLATE_VBOXQTGUIEXE_LIBS += \7265 rt socket nsl7266 endif7267 endif7268 # Assume the Qt shared objects are in the same directory as the executable, on Solaris too.7269 ifdef VBOX_WITH_RUNPATH7270 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RUNPATH)'7271 else ifdef VBOX_WITH_RELATIVE_RUNPATH7272 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$(VBOX_WITH_RELATIVE_RUNPATH)'7273 endif7274 7275 endif7276 7277 # Add COM/XPCOM stuff7278 TEMPLATE_VBOXQTGUIEXE_LIBS += \7279 $(PATH_STAGE_LIB)/VBoxCOM$(if-expr defined(VBOX_WITH_DEBUG_VCC_CRT) && $(KBUILD_TARGET) == win,-GUI,)$(VBOX_SUFF_LIB)7280 ifdef VBOX_WITH_XPCOM7281 ## @todo may be worth creating the VBOX_XPCOM SDK def, or just a SDK_VBOXXPCOM.7282 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM7283 ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP7284 TEMPLATE_VBOXQTGUIEXE_DEFS += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP7285 endif7286 TEMPLATE_VBOXQTGUIEXE_INCS += \7287 $(VBOX_XPCOM_INCS)7288 TEMPLATE_VBOXQTGUIEXE_LIBS += \7289 $(LIB_XPCOM)7290 TEMPLATE_VBOXQTGUIEXE_INTERMEDIATES += \7291 $(VBOX_PATH_SDK)/bindings/xpcom/include/VirtualBox_XPCOM.h7292 else # COM7293 TEMPLATE_VBOXQTGUIEXE_INCS += \7294 7306 $(VBOX_PATH_SDK)/bindings/mscom/include 7295 TEMPLATE_VBOXQTGUIEXE_INTERMEDIATES += \7307 TEMPLATE_VBOXQTGUIEXE_INTERMEDIATES += \ 7296 7308 $(VBOX_PATH_SDK)/bindings/mscom/include/VirtualBox.h 7297 endif # COM7298 7299 ifn1of ($(KBUILD_TARGET), darwin os2 win)7300 TEMPLATE_VBOXQTGUIEXE_DEFS += PIC7301 TEMPLATE_VBOXQTGUIEXE_CFLAGS += -fPIC7302 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += -fPIC7303 # Needed for GCC 9. Even system's Qt 5.12.4 (on Ubuntu 19.10) did not have this fixed yet.7304 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -Wno-deprecated-copy $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS)7305 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -fPIC7306 endif # not darwin, os2 or win7307 7308 ifeq ($(KBUILD_TARGET),darwin)7309 TEMPLATE_VBOXQTGUIEXE_POST_CMDS = $(QUIET)install_name_tool $(foreach qtmod, $(VBOX_QT_MOD_NAMES), \7309 endif # COM 7310 7311 ifn1of ($(KBUILD_TARGET), darwin os2 win) 7312 TEMPLATE_VBOXQTGUIEXE_DEFS += PIC 7313 TEMPLATE_VBOXQTGUIEXE_CFLAGS += -fPIC 7314 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS += -fPIC 7315 # Needed for GCC 9. Even system's Qt 5.12.4 (on Ubuntu 19.10) did not have this fixed yet. 7316 TEMPLATE_VBOXQTGUIEXE_CXXFLAGS.linux = -Wno-deprecated-copy $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS) 7317 TEMPLATE_VBOXQTGUIEXE_LDFLAGS += -fPIC 7318 endif # not darwin, os2 or win 7319 7320 ifeq ($(KBUILD_TARGET),darwin) 7321 TEMPLATE_VBOXQTGUIEXE_POST_CMDS = $(QUIET)install_name_tool $(foreach qtmod, $(VBOX_QT_MOD_NAMES), \ 7310 7322 $(foreach prefix, @executable_path/../Frameworks/ $(VBOX_PATH_QT)/Frameworks/ $(PATH_SDK_QT5)/, \ 7311 7323 -change "$(prefix)$(qtmod).framework/Versions/5/$(qtmod)" \ 7312 7324 "$(if $(VBOX_WITH_HARDENING),/Applications/VirtualBox.app/Contents/Frameworks,@rpath)/$(qtmod).framework/Versions/5/$(qtmod)" ) ) "$(out)" 7313 endif7314 7315 #7316 # Template for building Qt GUI components.7317 #7318 TEMPLATE_VBOXQTGUI = VBox Qt GUI Components7319 TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE7320 TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBOXQTGUIEXE_LIBS))7321 ifeq ($(KBUILD_TARGET),darwin)7322 TEMPLATE_VBOXQTGUI_LDFLAGS.darwin += $(filter-out -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS.darwin)) \7325 endif 7326 7327 # 7328 # Template for building Qt GUI components. 7329 # 7330 TEMPLATE_VBOXQTGUI = VBox Qt GUI Components 7331 TEMPLATE_VBOXQTGUI_EXTENDS = VBOXQTGUIEXE 7332 TEMPLATE_VBOXQTGUI_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBOXQTGUIEXE_LIBS)) 7333 ifeq ($(KBUILD_TARGET),darwin) 7334 TEMPLATE_VBOXQTGUI_LDFLAGS.darwin += $(filter-out -bind_at_load,$(TEMPLATE_VBOXQTGUIEXE_LDFLAGS.darwin)) \ 7323 7335 -current_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \ 7324 7336 -compatibility_version $(VBOX_VERSION_MAJOR).$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) 7325 endif 7326 ifn1of ($(KBUILD_TARGET), darwin os2 win) 7327 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS) 7328 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS) 7329 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS) 7330 TEMPLATE_VBOXQTGUI_PCHFLAGS = $(TEMPLATE_VBOXQTGUI_CXXFLAGS) 7331 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS) 7332 endif 7333 7334 endif # VBOX_WITH_QTGUI 7335 7337 endif 7338 ifn1of ($(KBUILD_TARGET), darwin os2 win) 7339 TEMPLATE_VBOXQTGUI_DEFS = PIC $(TEMPLATE_VBOXQTGUIEXE_DEFS) 7340 TEMPLATE_VBOXQTGUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CFLAGS) 7341 TEMPLATE_VBOXQTGUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_CXXFLAGS) 7342 TEMPLATE_VBOXQTGUI_PCHFLAGS = $(TEMPLATE_VBOXQTGUI_CXXFLAGS) 7343 TEMPLATE_VBOXQTGUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQTGUIEXE_LDFLAGS) 7344 endif 7345 endif # VBOX_WITH_QTGUI 7346 7347 ifdef VBOX_WITH_NLS 7348 # 7349 # Template for translation compilation. 7350 # Made as simple program without installing itself. 7351 # To archive it, the dummy code without runtime is used, 7352 # i.e. only compiler and system standard libs are linked. 7353 # 7354 TEMPLATE_VBoxNLS = VBox NLS template for installing translation files 7355 TEMPLATE_VBoxNLS_EXTENDS = VBoxR3Static 7356 TEMPLATE_VBoxNLS_USES = qt5 7357 TEMPLATE_VBoxNLS_QTTOOL = QT5 7358 TEMPLATE_VBoxNLS_QT_INFIX = $(VBOX_QT_INFIX) 7359 TEMPLATE_VBoxNLS_INSTTYPE = none 7360 TEMPLATE_VBoxNLS_LRCFLAGS += -silent 7361 TEMPLATE_VBoxNLS_QT_TRANSLATIONS_INST = $(INST_BIN)nls/ 7362 TEMPLATE_VBoxNLS_SOURCES = \ 7363 $(PATH_ROOT)/src/VBox/Main/nls/dummy.c 7364 TEMPLATE_VBoxNLS_LIBS =\ 7365 $(filter-out \ 7366 $(VBOX_LIB_RUNTIME_STATIC) \ 7367 $(PATH_STAGE_LIB)/VBox-libxml2-static$(VBOX_SUFF_LIB), \ 7368 $(TEMPLATE_VBoxR3Static_LIBS)) 7369 7370 endif # !VBOX_WITH_NLS 7371 7372 endif # VBOX_WITH_QTGUI || VBOX_WITH_NLS 7336 7373 7337 7374 # -
trunk/include/VBox/ExtPack/ExtPack.h
r86060 r91312 327 327 VBOXEXTPACK_IF_CS(IVetoEvent) **ppEventOut)); 328 328 329 /** 330 * Translate the string using registered translation files. 331 * 332 * Translation files are excluded from translation engine. Although 333 * the already loaded translation remains in the translation cache the new 334 * translation will not be loaded after returning from the function if the 335 * user changes the language. 336 * 337 * @returns Translated string on success the pszSourceText otherwise. 338 * @param pHlp Pointer to this helper structure. 339 * @param aComponent Translation context e.g. class name 340 * @param pszSourceText String to translate 341 * @param pszComment Comment to the string to resolve possible ambiguities 342 * (NULL means no comment). 343 * @param iNum Number used to define plural form of the translation 344 */ 345 DECLR3CALLBACKMEMBER(const char *, pfnTranslate,(PCVBOXEXTPACKHLP pHlp, 346 const char *pszComponent, 347 const char *pszSourceText, 348 const char *pszComment, 349 const int iNum)); 350 329 351 DECLR3CALLBACKMEMBER(int, pfnReserved1,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */ 330 352 DECLR3CALLBACKMEMBER(int, pfnReserved2,(PCVBOXEXTPACKHLP pHlp)); /**< Reserved for minor structure revisions. */ … … 338 360 } VBOXEXTPACKHLP; 339 361 /** Current version of the VBOXEXTPACKHLP structure. */ 340 #define VBOXEXTPACKHLP_VERSION RT_MAKE_U32( 4, 0)362 #define VBOXEXTPACKHLP_VERSION RT_MAKE_U32(5, 0) 341 363 342 364 … … 357 379 /** The VirtualBox version this extension pack was built against. */ 358 380 uint32_t uVBoxVersion; 381 /** Translation files base name. */ 382 const char *pszNlsBaseName; 359 383 360 384 /** … … 439 463 } VBOXEXTPACKREG; 440 464 /** Current version of the VBOXEXTPACKREG structure. */ 441 #define VBOXEXTPACKREG_VERSION RT_MAKE_U32( 2, 0)465 #define VBOXEXTPACKREG_VERSION RT_MAKE_U32(3, 0) 442 466 443 467 … … 482 506 /** The VirtualBox version this extension pack was built against. */ 483 507 uint32_t uVBoxVersion; 508 /** Translation files base name. */ 509 const char *pszNlsBaseName; 484 510 485 511 /** … … 552 578 } VBOXEXTPACKVMREG; 553 579 /** Current version of the VBOXEXTPACKVMREG structure. */ 554 #define VBOXEXTPACKVMREG_VERSION RT_MAKE_U32( 2, 0)580 #define VBOXEXTPACKVMREG_VERSION RT_MAKE_U32(3, 0) 555 581 556 582 -
trunk/src/VBox/ExtPacks/BusMouseSample/VBoxBusMouseMain.cpp
r82968 r91312 84 84 VBOXEXTPACKREG_VERSION, 85 85 /* .uVBoxFullVersion = */ VBOX_FULL_VERSION, 86 /* .pszNlsBaseName = */ NULL, 86 87 /* .pfnInstalled = */ NULL, 87 88 /* .pfnUninstall = */ NULL, -
trunk/src/VBox/ExtPacks/BusMouseSample/VBoxBusMouseMainVM.cpp
r82968 r91312 128 128 VBOXEXTPACKVMREG_VERSION, 129 129 /* .uVBoxFullVersion = */ VBOX_FULL_VERSION, 130 /* .pszNlsBaseName = */ NULL, 130 131 /* .pfnConsoleReady = */ NULL, 131 132 /* .pfnUnload = */ NULL, -
trunk/src/VBox/ExtPacks/Skeleton/VBoxSkeletonMain.cpp
r82968 r91312 84 84 VBOXEXTPACKREG_VERSION, 85 85 /* .uVBoxFullVersion = */ VBOX_FULL_VERSION, 86 /* .pszNlsBaseName = */ NULL, 86 87 /* .pfnInstalled = */ NULL, 87 88 /* .pfnUninstall = */ NULL, -
trunk/src/VBox/ExtPacks/Skeleton/VBoxSkeletonMainVM.cpp
r82968 r91312 84 84 VBOXEXTPACKVMREG_VERSION, 85 85 /* .uVBoxFullVersion = */ VBOX_FULL_VERSION, 86 /* .pszNlsBaseName = */ NULL, 86 87 /* .pfnConsoleReady = */ NULL, 87 88 /* .pfnUnload = */ NULL, -
trunk/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceMain.cpp
r82968 r91312 84 84 VBOXEXTPACKREG_VERSION, 85 85 /* .uVBoxFullVersion = */ VBOX_FULL_VERSION, 86 /* .pszNlsBaseName = */ NULL, 86 87 /* .pfnInstalled = */ NULL, 87 88 /* .pfnUninstall = */ NULL, -
trunk/src/VBox/ExtPacks/VNC/VBoxVNCMain.cpp
r82968 r91312 71 71 VBOXEXTPACKREG_VERSION, 72 72 /* .uVBoxFullVersion = */ VBOX_FULL_VERSION, 73 /* .pszNlsBaseName = */ NULL, 73 74 /* .pfnInstalled = */ NULL, 74 75 /* .pfnUninstall = */ NULL, -
trunk/src/VBox/Main/Makefile.kmk
r91213 r91312 1321 1321 endif 1322 1322 1323 # define qt5 tools for translation even if VBOX_ONLY_EXTPACKS is enabled 1324 ifdef VBOX_WITH_NLS 1325 USES += qt5 1326 endif 1327 1328 1323 1329 endif # !VBOX_ONLY_SDK 1324 1330 … … 1416 1422 # NLS stuff. 1417 1423 # 1424 1425 # 1426 # Include the language lists. 1427 # 1428 include $(PATH_SUB_CURRENT)/nls/ApprovedLanguages.kmk 1429 1418 1430 PROGRAMS += VirtualBoxAPI 1419 VirtualBoxAPI_TEMPLATE = VBOXQTGUIEXE 1420 VirtualBoxAPI_INSTTYPE = none 1421 VirtualBoxAPI_LRCFLAGS = -silent 1431 VirtualBoxAPI_TEMPLATE = VBoxNLS 1422 1432 VirtualBoxAPI_QT_TRANSLATIONS_INST = $(INST_BIN)nls/ 1423 VirtualBoxAPI_APPROVED_LANGUAGES = \1424 bg \1425 ca \1426 ca_VA \1427 cs \1428 da \1429 de \1430 el \1431 en \1432 es \1433 eu \1434 fa \1435 fi \1436 fr \1437 gl \1438 he \1439 hr_HR \1440 hu \1441 id \1442 it \1443 ja \1444 km_KH \1445 ko \1446 lt \1447 nl \1448 pl \1449 pt \1450 pt_BR \1451 ro \1452 ru \1453 sk \1454 sl \1455 sr \1456 sv \1457 th \1458 tr \1459 uk \1460 zh_CN \1461 zh_TW1462 1463 1433 VirtualBoxAPI_QT_TRANSLATIONS = \ 1464 1434 $(filter \ 1465 1435 $(addsuffix .ts, $(addprefix $(VBOX_PATH_MAIN_SRC)/nls/VirtualBoxAPI_, \ 1466 $(V irtualBoxAPI_APPROVED_LANGUAGES))), \1436 $(VBOX_APPROVED_MAIN_LANGUAGES))), \ 1467 1437 $(wildcard $(VBOX_PATH_MAIN_SRC)/nls/*.ts)) 1468 1438 1469 VirtualBoxAPI_SOURCES = \1470 nls/dummy.c1471 1439 VirtualBoxAPI_VBOX_ALL_NLS_SOURCES = $(wildcard \ 1472 1440 $(VBOX_PATH_MAIN_SRC)/include/*.h\ … … 1488 1456 $(VBOX_PATH_MAIN_SRC)/nls/VirtualBoxAPI_xx_YY.ts 1489 1457 1490 fake-main-nls:1491 $(foreach file, $(VirtualBoxAPI_QT_TRANSLATIONS) \1492 ,$(NLTAB)$(SED) -i \1493 -e '/<source>.*<\/source>/h' \1494 -e '/<source>.*<\/source>/p' \1495 -e '/<translation type="unfinished"><\/translation>/{' \1496 -e 'x' \1497 -e 's/<source>\(.*\)<\/source>/<translation type="unfinished">$(notdir $(file)): \1<\/translation>/' \1498 -e '}' \1499 $(file) )1458 #fake-main-nls: 1459 # $(foreach file, $(VirtualBoxAPI_QT_TRANSLATIONS) \ 1460 # ,$(NLTAB)$(SED) -i \ 1461 # -e '/<source>.*<\/source>/h' \ 1462 # -e '/<source>.*<\/source>/p' \ 1463 # -e '/<translation type="unfinished"><\/translation>/{' \ 1464 # -e 'x' \ 1465 # -e 's/<source>\(.*\)<\/source>/<translation type="unfinished">$(notdir $(file)): \1<\/translation>/' \ 1466 # -e '}' \ 1467 # $(file) ) 1500 1468 1501 1469 -
trunk/src/VBox/Main/include/ConsoleImpl.h
r90828 r91312 102 102 do { \ 103 103 if (!!(drv)) {} \ 104 else return setError(E_ACCESSDENIED, tr("The console is not powered up (%Rfn)"), __FUNCTION__); \104 else return setError(E_ACCESSDENIED, Console::tr("The console is not powered up (%Rfn)"), __FUNCTION__); \ 105 105 } while (0) 106 106 -
trunk/src/VBox/Main/include/ConsoleVRDPServer.h
r90828 r91312 61 61 62 62 /* Member of Console. Helper class for VRDP server management. Not a COM class. */ 63 class ConsoleVRDPServer : public VirtualBoxTranslatable63 class ConsoleVRDPServer 64 64 { 65 65 public: -
trunk/src/VBox/Main/include/DHCPConfigImpl.h
r90828 r91312 41 41 * can call setError and such on. 42 42 */ 43 class DHCPConfig : public VirtualBoxTranslatable43 class DHCPConfig 44 44 { 45 45 protected: -
trunk/src/VBox/Main/include/ExtPackManagerImpl.h
r90828 r91312 182 182 /* VBoxEventType_T */ uint32_t aType, 183 183 VBOXEXTPACK_IF_CS(IVetoEvent) **ppEventOut); 184 static DECLCALLBACK(int) i_hlpReservedN(PCVBOXEXTPACKHLP pHlp); 184 static DECLCALLBACK(const char *) i_hlpTranslate(PCVBOXEXTPACKHLP pHlp, 185 const char *pszComponent, 186 const char *pszSourceText, 187 const char *pszComment = NULL, 188 const int iNum = -1); 189 static DECLCALLBACK(int) i_hlpReservedN(PCVBOXEXTPACKHLP pHlp); 185 190 /** @} */ 186 191 -
trunk/src/VBox/Main/include/GuestDnDPrivate.h
r90828 r91312 800 800 * Class for keeping a DnD guest state around. 801 801 */ 802 class GuestDnDState : public VirtualBoxTranslatable802 class GuestDnDState 803 803 { 804 804 -
trunk/src/VBox/Main/include/GuestProcessImpl.h
r90828 r91312 214 214 * information extraction and maintaining the overall status. 215 215 */ 216 class GuestProcessTool : public VirtualBoxTranslatable216 class GuestProcessTool 217 217 { 218 218 public: -
trunk/src/VBox/Main/include/GuestSessionImplTasks.h
r90828 r91312 156 156 class GuestSessionTask 157 157 : public ThreadTask 158 , public VirtualBoxTranslatable159 158 { 160 159 public: -
trunk/src/VBox/Main/include/MachineImplCloneVM.h
r90828 r91312 28 28 struct MachineCloneVMPrivate; 29 29 30 class MachineCloneVM : public VirtualBoxTranslatable30 class MachineCloneVM 31 31 { 32 32 public: -
trunk/src/VBox/Main/include/MachineImplMoveVM.h
r90828 r91312 64 64 struct fileList_t; 65 65 66 class MachineMoveVM : public ThreadTask , public VirtualBoxTranslatable66 class MachineMoveVM : public ThreadTask 67 67 { 68 68 std::vector<ComObjPtr<Machine> > machineList; -
trunk/src/VBox/Main/include/TextScript.h
r90828 r91312 34 34 class AbstractScript 35 35 : public RTCNonCopyable 36 , public VirtualBoxTranslatable37 36 { 38 37 protected: -
trunk/src/VBox/Main/include/USBProxyService.h
r90828 r91312 43 43 */ 44 44 class USBProxyService 45 : public VirtualBoxTranslatable 46 , public Lockable 45 : public Lockable 47 46 { 48 47 public: -
trunk/src/VBox/Main/include/UnattendedInstaller.h
r90828 r91312 36 36 * execute an unattended installation 37 37 */ 38 class UnattendedInstaller : public RTCNonCopyable , public VirtualBoxTranslatable38 class UnattendedInstaller : public RTCNonCopyable 39 39 { 40 40 /*data*/ -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r90841 r91312 364 364 { /* likely */ }\ 365 365 else \ 366 return setError(E_INVALIDARG, tr("Argument %s is NULL"), #arg); \366 return setError(E_INVALIDARG, VirtualBoxBase::tr("Argument %s is NULL"), #arg); \ 367 367 } while (0) 368 368 … … 377 377 { /* likely */ }\ 378 378 else \ 379 return setError(E_INVALIDARG, tr("Argument %s is an invalid pointer"), #arg); \ 379 return setError(E_INVALIDARG, \ 380 VirtualBoxBase::tr("Argument %s is an invalid pointer"), #arg); \ 380 381 } while (0) 381 382 … … 391 392 else \ 392 393 return setError(E_POINTER, \ 393 tr("Argument %s points to invalid memory location (%p)"), \394 VirtualBoxBase::tr("Argument %s points to invalid memory location (%p)"), \ 394 395 #arg, (void *)(arg)); \ 395 396 } while (0) … … 405 406 { /* likely */ }\ 406 407 else \ 407 return setError(E_INVALIDARG, tr("Argument %s is NULL"), #arg); \ 408 return setError(E_INVALIDARG, \ 409 VirtualBoxBase::tr("Argument %s is NULL"), #arg); \ 408 410 } while (0) 409 411 … … 419 421 { /* likely */ }\ 420 422 else \ 421 return setError(E_INVALIDARG, tr("Argument %s is an invalid pointer"), #a_bstrIn); \ 423 return setError(E_INVALIDARG, \ 424 VirtualBoxBase::tr("Argument %s is an invalid pointer"), #a_bstrIn); \ 422 425 } while (0) 423 426 /** … … 432 435 { /* likely */ }\ 433 436 else \ 434 return setError(E_INVALIDARG, tr("Argument %s is empty or an invalid pointer"), #a_bstrIn); \ 437 return setError(E_INVALIDARG, \ 438 VirtualBoxBase::tr("Argument %s is empty or an invalid pointer"), \ 439 #a_bstrIn); \ 435 440 } while (0) 436 441 … … 450 455 else \ 451 456 return setError(E_INVALIDARG, \ 452 tr("GUID argument %s is not valid (\"%ls\")"), #a_Arg, Bstr(a_Arg).raw()); \ 457 VirtualBoxBase::tr("GUID argument %s is not valid (\"%ls\")"), \ 458 #a_Arg, Bstr(a_Arg).raw()); \ 453 459 } while (0) 454 460 … … 465 471 else \ 466 472 return setError(E_INVALIDARG, \ 467 tr("Argument %s is invalid (must be %s)"), #arg, #expr); \ 473 VirtualBoxBase::tr("Argument %s is invalid (must be %s)"), \ 474 #arg, #expr); \ 468 475 } while (0) 469 476 … … 482 489 { /* likely */ }\ 483 490 else \ 484 return setError(E_INVALIDARG, tr("Argument %s %s"), \491 return setError(E_INVALIDARG, VirtualBoxBase::tr("Argument %s %s"), \ 485 492 #arg, Utf8StrFmt msg .c_str()); \ 486 493 } while (0) … … 497 504 else \ 498 505 return setError(E_POINTER, \ 499 tr("Output argument %s points to invalid memory location (%p)"), \500 #arg, (void *)(arg)); \506 VirtualBoxBase::tr("Output argument %s points to invalid memory location (%p)"), \ 507 #arg, (void *)(arg)); \ 501 508 } while (0) 502 509 … … 512 519 else \ 513 520 return setError(E_POINTER, \ 514 tr("Output argument %s points to invalid memory location (%p)"), \521 VirtualBoxBase::tr("Output argument %s points to invalid memory location (%p)"), \ 515 522 #arg, (void*)(arg)); \ 516 523 } while (0) … … 521 528 #define ReturnComNotImplemented() \ 522 529 do { \ 523 return setError(E_NOTIMPL, tr("Method %s is not implemented"), __FUNCTION__); \530 return setError(E_NOTIMPL, VirtualBoxBase::tr("Method %s is not implemented"), __FUNCTION__); \ 524 531 } while (0) 525 532 … … 562 569 #endif 563 570 564 /**565 * Parent class of VirtualBoxBase which enables translation support (which566 * Main doesn't have yet, but this provides the tr() function which will one567 * day provide translations).568 *569 * This class sits in between Lockable and VirtualBoxBase only for the one570 * reason that the USBProxyService wants translation support but is not571 * implemented as a COM object, which VirtualBoxBase implies.572 */573 class ATL_NO_VTABLE VirtualBoxTranslatable574 {575 public:576 /**577 * Returns translated text.578 *579 * @param aComponent Translation context e.g. class name580 * @param aSourceText String to translate.581 * @param aComment Comment to the string to resolve possible ambiguities582 * (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.586 */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_NLS593 return VirtualBoxTranslator::translate(aComponent, aSourceText, aComment, aNum);594 #else595 RT_NOREF(aComponent, aComment, aNum);596 return aSourceText;597 #endif598 }599 600 /**601 * Returns source text stored in the cache if exists.602 * Otherwise, the @a aTranslation itself returned.603 */604 static const char *trSource(const char *aTranslation)605 {606 #ifdef VBOX_WITH_MAIN_NLS607 return VirtualBoxTranslator::trSource(aTranslation);608 #else609 return aTranslation;610 #endif611 }612 };613 614 571 //////////////////////////////////////////////////////////////////////////////// 615 572 // … … 624 581 const int aNum = -1) \ 625 582 { \ 626 return VirtualBoxTranslat able::translate(#cls, aSourceText, aComment, aNum); \583 return VirtualBoxTranslator::translate(NULL, #cls, aSourceText, aComment, aNum); \ 627 584 } 628 585 #else … … 718 675 */ 719 676 class ATL_NO_VTABLE VirtualBoxBase 720 : public VirtualBoxTranslatable 721 , public Lockable 677 : public Lockable 722 678 , public ATL::CComObjectRootEx<ATL::CComMultiThreadModel> 723 679 #if !defined (VBOX_WITH_XPCOM) … … 873 829 * Dummy macro that is used to shut down Qt's lupdate tool warnings in some 874 830 * situations. This macro needs to be present inside (better at the very 875 * beginning) of the declaration of the class that inherits from876 * VirtualBoxTranslatable, to makelupdate happy.831 * beginning) of the declaration of the class that uses translation, to make 832 * lupdate happy. 877 833 */ 878 834 #define Q_OBJECT -
trunk/src/VBox/Main/include/VirtualBoxClientImpl.h
r90879 r91312 106 106 #ifdef VBOX_WITH_MAIN_NLS 107 107 VirtualBoxTranslator *m_pVBoxTranslator; 108 TRCOMPONENT m_pTrComponent; 108 109 #endif 109 110 }; -
trunk/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h
r90828 r91312 31 31 #ifndef VBOX_WITH_XPCOM /* IErrorInfo doesn't inherit from IDispatch, ugly 3am hack: */ 32 32 , public IDispatch 33 , public VirtualBoxTranslatable34 33 #endif 35 34 { -
trunk/src/VBox/Main/include/VirtualBoxTranslator.h
r90881 r91312 27 27 #include <VBox/com/AutoLock.h> 28 28 29 typedef void *TRCOMPONENT; 29 30 30 31 class QMTranslator; … … 46 47 47 48 /** 49 * Adds path containing translation files into list of known paths. 50 * Path should include translation file prefix. 51 * 52 * @returns VBox status code 53 * @param aTranslationPath Path to translation files including file prefix 54 * @param aDefault Use as default translation component, i.e. 55 * Use this path for translation if component 56 * is NULL 57 * @param aComponent Where is the pointer to component returned 58 */ 59 static int registerTranslation(const char *aTranslationPath, 60 bool aDefault, 61 TRCOMPONENT *aComponent); 62 63 /** 64 * Removes the path from list of known paths. 65 * Does not remove already loaded translation from string cache. 66 */ 67 static int unregisterTranslation(TRCOMPONENT aComponent); 68 69 /** 48 70 * Translates @a aSourceText to user language. 71 * Uses component marked as default if @a aTranslationComponent is NULL 49 72 * 50 * @returns Translated string or @a aSourceText. 51 * valid only during lifetime of the t his translator instance.73 * @returns Translated string or @a aSourceText. The returned string is 74 * valid only during lifetime of the translator instance. 52 75 */ 53 static const char *translate(const char *aContext, 76 static const char *translate(TRCOMPONENT aComponent, 77 const char *aContext, 54 78 const char *aSourceText, 55 79 const char *aComment = NULL, … … 64 88 /* Convenience function used by VirtualBox::init */ 65 89 int i_loadLanguage(const char *pszLang); 66 int i_setLanguageFile(const char *aFileName);67 com::Utf8Str i_languageFile();68 69 90 70 91 static int32_t initCritSect(); … … 76 97 uint32_t m_cInstanceRefs; 77 98 78 com::Utf8Str m_strLangFileName; 79 QMTranslator *m_pTranslator; 99 struct TranslatorComponent 100 { 101 QMTranslator *pTranslator; 102 /* Path to translation files. It includes file prefix, i.e 103 * /path/to/folder/file_prefix */ 104 com::Utf8Str strPath; 105 106 TranslatorComponent() : pTranslator(NULL) {} 107 }; 108 typedef std::list<TranslatorComponent> TranslatorList; 109 TranslatorList m_lTranslators; 110 TranslatorComponent *m_pDefaultComponent; 111 112 /* keep the language code for registration */ 113 com::Utf8Str m_strLanguage; 114 80 115 /** String cache that all translation strings are stored in. 81 116 * This is a add-only cache, which allows translate() to return C-strings w/o … … 87 122 VirtualBoxTranslator(); 88 123 89 const char *i_translate(const char *aContext, 124 int i_loadLanguageForComponent(TranslatorComponent *aComponent, const char *aLang); 125 126 int i_setLanguageFile(TranslatorComponent *aComponent, const char *aFileName); 127 128 int i_registerTranslation(const char *aTranslationPath, 129 bool aDefault, 130 TRCOMPONENT *aComponent); 131 132 int i_unregisterTranslation(TRCOMPONENT aComponent); 133 134 const char *i_translate(TRCOMPONENT aComponent, 135 const char *aContext, 90 136 const char *aSourceText, 91 137 const char *aComment = NULL, 92 138 const int aNum = -1); 93 94 139 }; 95 140 -
trunk/src/VBox/Main/include/Wrapper.h
r82968 r91312 40 40 else \ 41 41 throw setError(E_POINTER, \ 42 tr("Output argument %s points to invalid memory location (%p)"), \ 42 /* Had to define VirtualBoxBase as context switcher for translation. \ 43 * Otherwise, lupdate complains about unknown context and doesn't \ 44 * include the string into translation file */ \ 45 VirtualBoxBase::tr("Output argument %s points to invalid memory location (%p)"), \ 43 46 #arg, (void *)(arg)); \ 44 47 } while (0) -
trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp
r90790 r91312 31 31 #include <iprt/file.h> 32 32 #include <iprt/ldr.h> 33 #include <iprt/locale.h> 33 34 #include <iprt/manifest.h> 34 35 #include <iprt/param.h> … … 148 149 VirtualBox *pVirtualBox; 149 150 #endif 151 #ifdef VBOX_WITH_MAIN_NLS 152 TRCOMPONENT pTrComponent; 153 #endif 150 154 151 155 RTMEMEF_NEW_AND_DELETE_OPERATORS(); … … 194 198 ~ExtPackInstallTask() { } 195 199 200 DECLARE_TRANSLATE_METHODS(ExtPackInstallTask) 201 196 202 void handler() 197 203 { … … 211 217 if (SUCCEEDED(hrc)) 212 218 { 213 Bstr bstrDescription( "Installing extension pack");219 Bstr bstrDescription(tr("Installing extension pack")); 214 220 hrc = ptrProgress->init(ptrExtPackFile->m->pVirtualBox, 215 221 static_cast<IExtPackFile *>(ptrExtPackFile), … … 242 248 explicit ExtPackUninstallTask() : ThreadTask("ExtPackUninst") { } 243 249 ~ExtPackUninstallTask() { } 250 DECLARE_TRANSLATE_METHODS(ExtPackUninstallTask) 244 251 245 252 void handler() … … 260 267 if (SUCCEEDED(hrc)) 261 268 { 262 Bstr bstrDescription( "Uninstalling extension pack");269 Bstr bstrDescription(tr("Uninstalling extension pack")); 263 270 hrc = ptrProgress->init(ptrExtPackMgr->m->pVirtualBox, 264 271 static_cast<IExtPackManager *>(ptrExtPackMgr), … … 365 372 szError, sizeof(szError), &m->hOurManifest, &hXmlFile, &m->strDigest); 366 373 if (RT_FAILURE(vrc)) 367 return initFailed( tr("%s"), szError);374 return initFailed("%s", szError); 368 375 369 376 /* … … 758 765 /* pfnCreateEvent = */ ExtPack::i_hlpCreateEvent, 759 766 /* pfnCreateVetoEvent = */ ExtPack::i_hlpCreateVetoEvent, 767 /* pfnTranslate = */ ExtPack::i_hlpTranslate, 760 768 /* pfnReserved1 = */ ExtPack::i_hlpReservedN, 761 769 /* pfnReserved2 = */ ExtPack::i_hlpReservedN, … … 793 801 RT_NOREF(a_pVirtualBox); 794 802 #endif 795 803 #ifdef VBOX_WITH_MAIN_NLS 804 m->pTrComponent = NULL; 805 #endif 796 806 /* 797 807 * Make sure the SUPR3Hardened API works (ignoring errors for now). … … 806 816 i_probeAndLoad(); 807 817 818 #ifdef VBOX_WITH_MAIN_NLS 819 /* register language files if exist */ 820 if (m->pReg->pszNlsBaseName != NULL) 821 { 822 char szPath[RTPATH_MAX]; 823 ssize_t cchOkay = RTStrPrintf2(szPath, sizeof(szPath), "%s%s%s", a_pszDir, 824 RTPATH_SLASH_STR "nls" RTPATH_SLASH_STR, 825 m->pReg->pszNlsBaseName); 826 if (cchOkay > 0) 827 { 828 rc = VirtualBoxTranslator::registerTranslation(szPath, false, &m->pTrComponent); 829 if (RT_FAILURE(rc)) 830 m->pTrComponent = NULL; 831 } 832 } 833 #endif 834 808 835 autoInitSpan.setSucceeded(); 809 836 return S_OK; … … 841 868 VBoxExtPackFreeDesc(&m->Desc); 842 869 870 #ifdef VBOX_WITH_MAIN_NLS 871 if (m->pTrComponent != NULL) 872 VirtualBoxTranslator::unregisterTranslation(m->pTrComponent); 873 #endif 843 874 delete m; 844 875 m = NULL; … … 1975 2006 1976 2007 return pEvent.queryInterfaceTo(ppEventOut); 2008 } 2009 2010 2011 /*static*/ DECLCALLBACK(const char *) 2012 ExtPack::i_hlpTranslate(PCVBOXEXTPACKHLP pHlp, 2013 const char *pszComponent, 2014 const char *pszSourceText, 2015 const char *pszComment /* = NULL */, 2016 const int iNum /* = -1 */) 2017 { 2018 /* 2019 * Validate the input and get our bearings. 2020 */ 2021 AssertPtrReturn(pHlp, pszSourceText); 2022 AssertReturn(pHlp->u32Version == VBOXEXTPACKHLP_VERSION, pszSourceText); 2023 ExtPack::Data *m = RT_FROM_CPP_MEMBER(pHlp, Data, Hlp); 2024 AssertPtrReturn(m, pszSourceText); 2025 2026 #ifdef VBOX_WITH_MAIN_NLS 2027 return VirtualBoxTranslator::translate(m->pTrComponent, pszComponent, 2028 pszSourceText, pszComment, iNum); 2029 #else 2030 NOREF(pszComponent); 2031 NOREF(pszComment); 2032 NOREF(iNum); 2033 return pszSourceText; 2034 #endif 1977 2035 } 1978 2036 -
trunk/src/VBox/Main/src-all/VirtualBoxBase.cpp
r90841 r91312 310 310 if (aLogIt) 311 311 { 312 strText = trSource(aText); 312 #ifdef VBOX_WITH_MAIN_NLS 313 strText = VirtualBoxTranslator::trSource(aText); 314 #else 315 strText = aText; 316 #endif 313 317 va_list va2; 314 318 va_copy(va2, aArgs); -
trunk/src/VBox/Main/src-all/VirtualBoxTranslator.cpp
r90881 r91312 67 67 : util::RWLockHandle(VBoxLockingClass::LOCKCLASS_TRANSLATOR) 68 68 , m_cInstanceRefs(0) 69 , m_pTranslator(NULL) 69 , m_pDefaultComponent(NULL) 70 , m_strLanguage("C") 70 71 , m_hStrCache(NIL_RTSTRCACHE) 71 72 { … … 92 93 g_idxTls = NIL_RTTLS; 93 94 } 94 if (m_pTranslator) 95 { 96 delete m_pTranslator; 97 m_pTranslator = NULL; 95 96 m_pDefaultComponent = NULL; 97 98 for (TranslatorList::iterator it = m_lTranslators.begin(); 99 it != m_lTranslators.end(); 100 ++it) 101 { 102 if (it->pTranslator != NULL) 103 delete it->pTranslator; 104 it->pTranslator = NULL; 98 105 } 99 106 if (m_hStrCache != NIL_RTSTRCACHE) … … 164 171 /** 165 172 * Release translator reference previous obtained via instance() or 166 * i_instance().173 * tryinstance(). 167 174 */ 168 175 void VirtualBoxTranslator::release() … … 234 241 if (RT_SUCCESS(rc)) 235 242 { 236 if (strcmp(pszLang, "C") != 0) 237 { 238 /* Construct the base filename for the translations: */ 239 char szNlsPath[RTPATH_MAX]; 240 rc = RTPathAppPrivateNoArch(szNlsPath, sizeof(szNlsPath)); 241 if (RT_SUCCESS(rc)) 242 rc = RTPathAppend(szNlsPath, sizeof(szNlsPath), "nls" RTPATH_SLASH_STR "VirtualBoxAPI_"); 243 if (RT_SUCCESS(rc)) 243 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 244 245 m_strLanguage = pszLang; 246 247 for (TranslatorList::iterator it = m_lTranslators.begin(); 248 it != m_lTranslators.end(); 249 ++it) 250 { 251 /* ignore errors from particular translator allowing the use of others */ 252 i_loadLanguageForComponent(&(*it), pszLang); 253 } 254 } 255 return rc; 256 } 257 258 259 int VirtualBoxTranslator::i_loadLanguageForComponent(TranslatorComponent *aComponent, const char *aLang) 260 { 261 AssertReturn(aComponent, VERR_INVALID_PARAMETER); 262 int rc; 263 if (strcmp(aLang, "C") != 0) 264 { 265 /* Construct the base filename for the translations: */ 266 char szNlsPath[RTPATH_MAX]; 267 /* Try load language file on form 'VirtualBoxAPI_ll_CC.qm' if it exists 268 where 'll_CC' could for example be 'en_US' or 'de_CH': */ 269 ssize_t cchOkay = RTStrPrintf2(szNlsPath, sizeof(szNlsPath), "%s_%s.qm", 270 aComponent->strPath.c_str(), aLang); 271 if (cchOkay > 0) 272 rc = i_setLanguageFile(aComponent, szNlsPath); 273 else 274 rc = VERR_FILENAME_TOO_LONG; 275 if (RT_FAILURE(rc)) 276 { 277 /* No luck, drop the country part, i.e. 'VirtualBoxAPI_de.qm' or 'VirtualBoxAPI_en.qm': */ 278 const char *pszDash = strchr(aLang, '_'); 279 if (pszDash && pszDash != aLang) 244 280 { 245 size_t const cchNlsBase = strlen(szNlsPath); 246 247 /* Try load language file on form 'VirtualBoxAPI_ll_CC.qm' if it exists 248 where 'll_CC' could for example be 'en_US' or 'de_CH': */ 249 ssize_t cchOkay = RTStrPrintf2(&szNlsPath[cchNlsBase], sizeof(szNlsPath) - cchNlsBase, "%s.qm", pszLang); 281 cchOkay = RTStrPrintf2(szNlsPath, sizeof(szNlsPath), "%s_%.*s.qm", 282 aComponent->strPath.c_str(), pszDash - aLang, aLang); 250 283 if (cchOkay > 0) 251 rc = i_setLanguageFile(szNlsPath); 252 else 253 rc = VERR_FILENAME_TOO_LONG; 254 if (RT_FAILURE(rc)) 255 { 256 /* No luck, drop the country part, i.e. 'VirtualBoxAPI_de.qm' or 'VirtualBoxAPI_en.qm': */ 257 const char *pszDash = strchr(pszLang, '_'); 258 if (pszDash && pszDash != pszLang) 259 { 260 cchOkay = RTStrPrintf2(&szNlsPath[cchNlsBase], sizeof(szNlsPath) - cchNlsBase, "%.*s.qm", 261 pszDash - pszLang, pszLang); 262 if (cchOkay > 0) 263 rc = i_setLanguageFile(szNlsPath); 264 } 265 } 284 rc = i_setLanguageFile(aComponent, szNlsPath); 266 285 } 267 286 } 268 else269 {270 /* No translator needed for 'C': */271 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);272 delete m_pTranslator;273 m_pTranslator = NULL;274 }287 } 288 else 289 { 290 /* No translator needed for 'C' */ 291 delete aComponent->pTranslator; 292 aComponent->pTranslator = NULL; 293 rc = VINF_SUCCESS; 275 294 } 276 295 return rc; … … 278 297 279 298 280 int VirtualBoxTranslator::i_setLanguageFile(const char *aFileName) 281 { 299 int VirtualBoxTranslator::i_setLanguageFile(TranslatorComponent *aComponent, const char *aFileName) 300 { 301 AssertReturn(aComponent, VERR_INVALID_PARAMETER); 302 282 303 int rc = m_rcCache; 283 304 if (m_hStrCache != NIL_RTSTRCACHE) … … 291 312 if (RT_SUCCESS(rc)) 292 313 { 293 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 294 295 if (m_pTranslator) 296 delete m_pTranslator; 297 m_pTranslator = pNewTranslator; 298 m_strLangFileName = aFileName; 314 if (aComponent->pTranslator) 315 delete aComponent->pTranslator; 316 aComponent->pTranslator = pNewTranslator; 299 317 } 300 318 else … … 310 328 311 329 312 com::Utf8Str VirtualBoxTranslator::i_languageFile() 313 { 314 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 315 return m_strLangFileName; 316 } 317 318 319 const char *VirtualBoxTranslator::translate(const char *aContext, 330 int VirtualBoxTranslator::registerTranslation(const char *aTranslationPath, 331 bool aDefault, 332 TRCOMPONENT *aComponent) 333 { 334 VirtualBoxTranslator *pCurrInstance = VirtualBoxTranslator::tryInstance(); 335 int rc = VERR_GENERAL_FAILURE; 336 if (pCurrInstance != NULL) 337 { 338 rc = pCurrInstance->i_registerTranslation(aTranslationPath, aDefault, aComponent); 339 pCurrInstance->release(); 340 } 341 return rc; 342 } 343 344 345 int VirtualBoxTranslator::i_registerTranslation(const char *aTranslationPath, 346 bool aDefault, 347 TRCOMPONENT *aComponent) 348 { 349 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 350 TranslatorComponent *pComponent; 351 for (TranslatorList::iterator it = m_lTranslators.begin(); 352 it != m_lTranslators.end(); 353 ++it) 354 { 355 if (it->strPath == aTranslationPath) 356 { 357 pComponent = &(*it); 358 if (aDefault) 359 m_pDefaultComponent = pComponent; 360 *aComponent = (TRCOMPONENT)pComponent; 361 return VINF_SUCCESS; 362 } 363 } 364 365 try 366 { 367 m_lTranslators.push_back(TranslatorComponent()); 368 pComponent = &m_lTranslators.back(); 369 } 370 catch(std::bad_alloc &) 371 { 372 return VERR_NO_MEMORY; 373 } 374 375 pComponent->strPath = aTranslationPath; 376 if (aDefault) 377 m_pDefaultComponent = pComponent; 378 *aComponent = (TRCOMPONENT)pComponent; 379 /* ignore the error during loading because path 380 * could contain no translation for current language */ 381 i_loadLanguageForComponent(pComponent, m_strLanguage.c_str()); 382 return VINF_SUCCESS; 383 } 384 385 386 int VirtualBoxTranslator::unregisterTranslation(TRCOMPONENT aComponent) 387 { 388 VirtualBoxTranslator *pCurrInstance = VirtualBoxTranslator::tryInstance(); 389 int rc = VERR_GENERAL_FAILURE; 390 if (pCurrInstance != NULL) 391 { 392 rc = pCurrInstance->i_unregisterTranslation(aComponent); 393 pCurrInstance->release(); 394 } 395 return rc; 396 } 397 398 399 int VirtualBoxTranslator::i_unregisterTranslation(TRCOMPONENT aComponent) 400 { 401 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 402 403 TranslatorComponent *pComponent = (TranslatorComponent *)aComponent; 404 405 if (pComponent == m_pDefaultComponent) 406 m_pDefaultComponent = NULL; 407 408 for (TranslatorList::iterator it = m_lTranslators.begin(); 409 it != m_lTranslators.end(); 410 ++it) 411 { 412 if (&(*it) == pComponent) 413 { 414 delete pComponent->pTranslator; 415 m_lTranslators.erase(it); 416 return VINF_SUCCESS; 417 } 418 } 419 420 return VERR_NOT_FOUND; 421 } 422 423 424 const char *VirtualBoxTranslator::translate(TRCOMPONENT aComponent, 425 const char *aContext, 320 426 const char *aSourceText, 321 427 const char *aComment, … … 326 432 if (pCurrInstance != NULL) 327 433 { 328 pszTranslation = pCurrInstance->i_translate(aContext, aSourceText, aComment, aNum); 434 pszTranslation = pCurrInstance->i_translate(aComponent, aContext, 435 aSourceText, aComment, aNum); 329 436 pCurrInstance->release(); 330 437 } … … 359 466 360 467 361 const char *VirtualBoxTranslator::i_translate(const char *aContext, 468 const char *VirtualBoxTranslator::i_translate(TRCOMPONENT aComponent, 469 const char *aContext, 362 470 const char *aSourceText, 363 471 const char *aComment, … … 365 473 { 366 474 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 367 if (!m_pTranslator) 475 476 TranslatorComponent *pComponent = (TranslatorComponent *)aComponent; 477 if (pComponent == NULL) 478 pComponent = m_pDefaultComponent; 479 480 if ( pComponent == NULL 481 || pComponent->pTranslator == NULL) 368 482 return aSourceText; 369 const char *pszTranslation = m_pTranslator->translate(aContext, aSourceText, aComment, aNum); 370 alock.release();483 484 const char *pszTranslation = pComponent->pTranslator->translate(aContext, aSourceText, aComment, aNum); 371 485 372 486 LastTranslation *pEntry = getTlsEntry(); … … 374 488 { 375 489 pEntry->first = pszTranslation; 376 pEntry->second = aSourceText; 490 pEntry->second = m_hStrCache != NIL_RTSTRCACHE ? 491 RTStrCacheEnter(m_hStrCache, aSourceText) : 492 aSourceText; 377 493 } 378 494 -
trunk/src/VBox/Main/src-client/SessionImpl.cpp
r82968 r91312 38 38 do { \ 39 39 if (mState != SessionState_Locked) \ 40 return setError(E_UNEXPECTED, tr("The session is not locked (session state: %s)"), \40 return setError(E_UNEXPECTED, Session::tr("The session is not locked (session state: %s)"), \ 41 41 Global::stringifySessionState(mState)); \ 42 42 } while (0) -
trunk/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp
r90884 r91312 29 29 #include <iprt/thread.h> 30 30 #include <iprt/critsect.h> 31 #include <iprt/path.h> 31 32 #include <iprt/semaphore.h> 32 33 #include <iprt/cpp/utils.h> … … 189 190 AssertMsg(s_cUnnecessaryAtlModuleLocks == 1, ("%d\n", s_cUnnecessaryAtlModuleLocks)); 190 191 192 int vrc; 191 193 #ifdef VBOX_WITH_MAIN_NLS 192 194 /* Create the translator singelton (must work) and try load translations (non-fatal). */ … … 194 196 if (mData.m_pVBoxTranslator == NULL) 195 197 throw setError(VBOX_E_IPRT_ERROR, tr("Failed to create translator instance")); 196 rc = i_reloadApiLanguage(); 197 if (SUCCEEDED(rc)) 198 i_registerEventListener(); /* for updates */ 198 199 char szNlsPath[RTPATH_MAX]; 200 rc = RTPathAppPrivateNoArch(szNlsPath, sizeof(szNlsPath)); 201 if (RT_SUCCESS(rc)) 202 rc = RTPathAppend(szNlsPath, sizeof(szNlsPath), "nls" RTPATH_SLASH_STR "VirtualBoxAPI"); 203 204 vrc = mData.m_pVBoxTranslator->registerTranslation(szNlsPath, true, &mData.m_pTrComponent); 205 if (RT_SUCCESS(vrc)) 206 { 207 rc = i_reloadApiLanguage(); 208 if (SUCCEEDED(rc)) 209 i_registerEventListener(); /* for updates */ 210 else 211 LogRelFunc(("i_reloadApiLanguage failed: %Rhrc\n", rc)); 212 } 199 213 else 200 LogRelFunc((" i_reloadApiLanguage failed: %Rhrc\n",rc));214 LogRelFunc(("Register translation failed: %Rrc\n", vrc)); 201 215 #endif 202 216 /* Setting up the VBoxSVC watcher thread. If anything goes wrong here it 203 217 * is not considered important enough to cause any sort of visible 204 218 * failure. The monitoring will not be done, but that's all. */ 205 intvrc = RTSemEventCreate(&mData.m_SemEvWatcher);219 vrc = RTSemEventCreate(&mData.m_SemEvWatcher); 206 220 if (RT_FAILURE(vrc)) 207 221 { … … 563 577 mData.m_pVBoxTranslator->release(); 564 578 mData.m_pVBoxTranslator = NULL; 579 mData.m_pTrComponent = NULL; 565 580 } 566 581 #endif -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r90828 r91312 63 63 ///////////////////////////////////////////////////////////////////////////// 64 64 65 struct MachineCloneVMPrivate : public VirtualBoxTranslatable65 struct MachineCloneVMPrivate 66 66 { 67 67 MachineCloneVMPrivate(MachineCloneVM *a_q, ComObjPtr<Machine> &a_pSrcMachine, ComObjPtr<Machine> &a_pTrgMachine, -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r90828 r91312 299 299 #ifdef VBOX_WITH_MAIN_NLS 300 300 , pVBoxTranslator(NULL) 301 , pTrComponent(NULL) 301 302 #endif 302 303 #if defined(RT_OS_WINDOWS) && defined(VBOXSVC_WITH_CLIENT_WATCHER) … … 410 411 #ifdef VBOX_WITH_MAIN_NLS 411 412 VirtualBoxTranslator *pVBoxTranslator; 413 TRCOMPONENT pTrComponent; 412 414 #endif 413 415 #if defined(RT_OS_WINDOWS) && defined(VBOXSVC_WITH_CLIENT_WATCHER) … … 581 583 unconst(m->pAutostartDb) = new AutostartDb; 582 584 585 /* create the system properties object, someone may need it too */ 586 rc = unconst(m->pSystemProperties).createObject(); 587 if (SUCCEEDED(rc)) 588 rc = m->pSystemProperties->init(this); 589 ComAssertComRCThrowRC(rc); 590 591 rc = m->pSystemProperties->i_loadSettings(m->pMainConfigFile->systemProperties); 592 if (FAILED(rc)) throw rc; 593 #ifdef VBOX_WITH_MAIN_NLS 594 m->pVBoxTranslator = VirtualBoxTranslator::instance(); 595 /* Do not throw an exception on language errors. 596 * Just do not use translation. */ 597 if (m->pVBoxTranslator) 598 { 599 600 char szNlsPath[RTPATH_MAX]; 601 rc = RTPathAppPrivateNoArch(szNlsPath, sizeof(szNlsPath)); 602 if (RT_SUCCESS(rc)) 603 rc = RTPathAppend(szNlsPath, sizeof(szNlsPath), "nls" RTPATH_SLASH_STR "VirtualBoxAPI"); 604 605 int vrc = m->pVBoxTranslator->registerTranslation(szNlsPath, true, &m->pTrComponent); 606 if (RT_SUCCESS(vrc)) 607 { 608 com::Utf8Str strLocale; 609 HRESULT hrc = m->pSystemProperties->getLanguageId(strLocale); 610 if (SUCCEEDED(hrc)) 611 { 612 vrc = m->pVBoxTranslator->i_loadLanguage(strLocale.c_str()); 613 if (RT_FAILURE(vrc)) 614 { 615 hrc = Global::vboxStatusCodeToCOM(vrc); 616 LogRel(("Load language failed (%Rhrc).\n", hrc)); 617 } 618 } 619 else 620 { 621 LogRel(("Getting language settings failed (%Rhrc).\n", hrc)); 622 m->pVBoxTranslator->release(); 623 m->pVBoxTranslator = NULL; 624 m->pTrComponent = NULL; 625 } 626 } 627 else 628 { 629 HRESULT hrc = Global::vboxStatusCodeToCOM(vrc); 630 LogRel(("Register translation failed (%Rhrc).\n", hrc)); 631 m->pVBoxTranslator->release(); 632 m->pVBoxTranslator = NULL; 633 m->pTrComponent = NULL; 634 } 635 } 636 else 637 LogRel(("Translator creation failed.\n")); 638 #endif 639 583 640 #ifdef VBOX_WITH_EXTPACK 584 641 /* … … 591 648 if (FAILED(rc)) 592 649 throw rc; 593 #endif594 595 /* create the system properties object, someone may need it too */596 rc = unconst(m->pSystemProperties).createObject();597 if (SUCCEEDED(rc))598 rc = m->pSystemProperties->init(this);599 ComAssertComRCThrowRC(rc);600 601 rc = m->pSystemProperties->i_loadSettings(m->pMainConfigFile->systemProperties);602 if (FAILED(rc)) throw rc;603 #ifdef VBOX_WITH_MAIN_NLS604 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 else621 {622 LogRel(("Getting language settings failed (%Rhrc).\n", hrc));623 m->pVBoxTranslator->release();624 m->pVBoxTranslator = NULL;625 }626 }627 else628 LogRel(("Translator creation failed.\n"));629 650 #endif 630 651 /* guest OS type objects, needed by machines */ -
trunk/src/VBox/Runtime/VBox/VBoxRTImp.def
r90829 r91312 1301 1301 RTLogWriteStdOut 1302 1302 RTLogWriteUser 1303 RTLocaleQueryNormalizedBaseLocaleName 1303 1304 RTManifestCreate 1304 1305 RTManifestDup … … 2056 2057 RTUniFree 2057 2058 RTUriParse 2059 RTUtf16BigToUtf8ExTag 2058 2060 RTUtf16CalcLatin1Len 2059 2061 RTUtf16CalcLatin1LenEx -
trunk/tools/bin/gen-slickedit-workspace.sh
r90828 r91312 632 632 const int aNum = -1) \ 633 633 { \ 634 return VirtualBoxTranslat able::translate(#cls, aSourceText, aComment, aNum); \634 return VirtualBoxTranslator::translate(#cls, aSourceText, aComment, aNum); \ 635 635 } 636 636 #define DECLARE_COMMON_CLASS_METHODS(cls) \
Note:
See TracChangeset
for help on using the changeset viewer.