diff options
Diffstat (limited to 'src/VBox/Frontends')
6 files changed, 100 insertions, 24 deletions
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp index 524c1be2..05bed8bf 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp @@ -1169,14 +1169,14 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> pVirtualBox, Bstr strCipher; Bstr strPasswordId; HRESULT hrc2 = machine->GetEncryptionSettings(strCipher.asOutParam(), strPasswordId.asOutParam()); + + SHOW_UTF8_STRING( "encryption", Info::tr("Encryption:"), + SUCCEEDED(hrc2) ? "enabled" : "disabled"); if (SUCCEEDED(hrc2)) { - RTPrintf("Encryption: enabled\n"); - RTPrintf("Cipher: %ls\n", strCipher.raw()); - RTPrintf("Password ID: %ls\n", strPasswordId.raw()); + SHOW_BSTR_STRING( "enc_cipher", Info::tr("Cipher:"), strCipher); + SHOW_BSTR_STRING( "enc_password_id", Info::tr("Password ID:"), strPasswordId); } - else - RTPrintf("Encryption: disabled\n"); } SHOW_STRINGARRAY_PROP( machine, Groups, "groups", Info::tr("Groups:")); Bstr osTypeId; @@ -1372,7 +1372,7 @@ HRESULT showVMInfo(ComPtr<IVirtualBox> pVirtualBox, Bstr bstrNVRAMFile; CHECK_ERROR2I_RET(nvramStore, COMGETTER(NonVolatileStorageFile)(bstrNVRAMFile.asOutParam()), hrcCheck); if (bstrNVRAMFile.isNotEmpty()) - SHOW_BSTR_STRING("BIOS NVRAM File", Info::tr("BIOS NVRAM File:"), bstrNVRAMFile); + SHOW_BSTR_STRING("NvramFile", Info::tr("BIOS NVRAM File:"), bstrNVRAMFile); SHOW_BOOLEAN_PROP_EX(machine, RTCUseUTC, "rtcuseutc", Info::tr("RTC:"), "UTC", Info::tr("local time")); SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_Enabled, &f), "hwvirtex", Info::tr("Hardware Virtualization:")); SHOW_BOOLEAN_METHOD(machine, GetHWVirtExProperty(HWVirtExPropertyType_NestedPaging, &f),"nestedpaging", Info::tr("Nested Paging:")); diff --git a/src/VBox/Frontends/VBoxShell/vboxshell.py b/src/VBox/Frontends/VBoxShell/vboxshell.py index bd0222c7..f1083dd1 100755 --- a/src/VBox/Frontends/VBoxShell/vboxshell.py +++ b/src/VBox/Frontends/VBoxShell/vboxshell.py @@ -1,7 +1,28 @@ -#!/usr/bin/env python +#!/bin/sh # -*- coding: utf-8 -*- # $Id: vboxshell.py $ +# The following checks for the right (i.e. most recent) Python binary available +# and re-starts the script using that binary (like a shell wrapper). +# +# Using a shebang like "#!/bin/env python" on newer Fedora/Debian distros is banned [1] +# and also won't work on other newer distros (Ubuntu >= 23.10), as those only ship +# python3 without a python->python3 symlink anymore. +# +# Note: As Python 2 is EOL, we consider this last (and hope for the best). +# +# [1] https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/2PD5RNJRKPN2DVTNGJSBHR5RUSVZSDZI/ +''':' +for python_bin in python3 python python2 +do + type "$python_bin" > /dev/null 2>&1 && exec "$python_bin" "$0" "$@" +done +echo >&2 "ERROR: Python not found! Please install this first in order to run this program." +exit 1 +':''' + +from __future__ import print_function + """ VirtualBox Python Shell. @@ -19,8 +40,6 @@ Finally, shell allows arbitrary custom extensions, just create P.S. Our apologies for the code quality. """ -from __future__ import print_function - __copyright__ = \ """ Copyright (C) 2009-2023 Oracle and/or its affiliates. @@ -43,7 +62,7 @@ along with this program; if not, see <https://www.gnu.org/licenses>. SPDX-License-Identifier: GPL-3.0-only """ -__version__ = "$Revision: 155244 $" +__version__ = "$Revision: 162975 $" import gc diff --git a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_es.ts b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_es.ts index 8b92199e..1e3150da 100644 --- a/src/VBox/Frontends/VirtualBox/nls/VirtualBox_es.ts +++ b/src/VBox/Frontends/VirtualBox/nls/VirtualBox_es.ts @@ -4843,7 +4843,7 @@ <message> <source>Dynamically allocated storage</source> <comment>MediumVariant</comment> - <translation>Almacenamiento resevado dinámicamente</translation> + <translation>Almacenamiento reservado dinámicamente</translation> </message> <message> <source>New dynamically allocated storage</source> @@ -4853,7 +4853,7 @@ <message> <source>Dynamically allocated differencing storage</source> <comment>MediumVariant</comment> - <translation>Almacenamiento diferenciado resevado dinámicamente</translation> + <translation>Almacenamiento diferenciado reservado dinámicamente</translation> </message> <message> <source>Fixed size storage</source> @@ -4878,7 +4878,7 @@ <message> <source>Dynamically allocated compressed storage</source> <comment>MediumVariant</comment> - <translation>Almacenamiento comprimido resevado dinámicamente</translation> + <translation>Almacenamiento comprimido reservado dinámicamente</translation> </message> <message> <source>Dynamically allocated differencing compressed storage</source> @@ -31727,7 +31727,7 @@ Versión %1</translation> </message> <message> <source>Dynamically allocated storage</source> - <translation type="obsolete">Almacenamiento resevado dinámicamente</translation> + <translation type="obsolete">Almacenamiento reservado dinámicamente</translation> </message> <message> <source>Fixed size storage</source> @@ -31833,12 +31833,12 @@ Versión %1</translation> <message> <source>Dynamically allocated storage</source> <comment>MediumVariant</comment> - <translation type="vanished">Almacenamiento resevado dinámicamente</translation> + <translation type="vanished">Almacenamiento reservado dinámicamente</translation> </message> <message> <source>Dynamically allocated differencing storage</source> <comment>MediumVariant</comment> - <translation type="vanished">Almacenamiento diferenciado resevado dinámicamente</translation> + <translation type="vanished">Almacenamiento diferenciado reservado dinámicamente</translation> </message> <message> <source>Fixed size storage</source> @@ -31863,7 +31863,7 @@ Versión %1</translation> <message> <source>Dynamically allocated compressed storage</source> <comment>MediumVariant</comment> - <translation type="vanished">Almacenamiento comprimido resevado dinámicamente</translation> + <translation type="vanished">Almacenamiento comprimido reservado dinámicamente</translation> </message> <message> <source>Dynamically allocated differencing compressed storage</source> diff --git a/src/VBox/Frontends/VirtualBox/src/main.cpp b/src/VBox/Frontends/VirtualBox/src/main.cpp index 02b1de55..dd6c6b64 100644 --- a/src/VBox/Frontends/VirtualBox/src/main.cpp +++ b/src/VBox/Frontends/VirtualBox/src/main.cpp @@ -423,8 +423,13 @@ extern "C" DECLEXPORT(int) TrustedMain(int argc, char **argv, char ** /*envp*/) #endif /* VBOX_WITH_HARDENING */ #ifdef VBOX_WS_MAC + /* Prevent AppNap for Runtime UI only: */ + bool fPreventAppNap = false; +# ifdef VBOX_RUNTIME_UI + fPreventAppNap = true; +# endif /* Instantiate own NSApplication before QApplication do it for us: */ - UICocoaApplication::instance(); + UICocoaApplication::create(fPreventAppNap); # ifdef VBOX_RUNTIME_UI /* If we're a helper app inside Resources in the main application bundle, diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h index 5d17cb0d..5df6a407 100644 --- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h +++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.h @@ -67,12 +67,18 @@ class SHARED_LIBRARY_STUFF UICocoaApplication { public: + /** Creates singleton instance. + * @param fPreventAppNap Brings whether we should prevent AppNap. */ + static void create(bool fPreventAppNap); /** Returns singleton instance. */ static UICocoaApplication *instance(); /** Destructs cocoa application. */ virtual ~UICocoaApplication(); + /** Returns whether we should prevent AppNap. */ + bool isPreventAppNap() const { return m_fPreventAppNap; } + /** Returns whether application is currently active. */ bool isActive() const; @@ -111,12 +117,16 @@ public: private: - /** Constructs cocoa application. */ - UICocoaApplication(); + /** Constructs cocoa application. + * @param fPreventAppNap Brings whether we should prevent AppNap. */ + UICocoaApplication(bool fPreventAppNap); /** Holds the singleton access instance. */ static UICocoaApplication *s_pInstance; + /** Holds whether we should prevent AppNap. */ + const bool m_fPreventAppNap; + /** Holds the private NSApplication instance. */ NativeUICocoaApplicationPrivateRef m_pNative; /** Holds the private NSAutoreleasePool instance. */ diff --git a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm index 42196b26..c73f5c1e 100644 --- a/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm +++ b/src/VBox/Frontends/VirtualBox/src/platform/darwin/UICocoaApplication.mm @@ -76,12 +76,17 @@ uint32_t m_fMask; /** Array of callbacks. */ NSMutableArray *m_pCallbacks; + /** AppNap preventing activity. */ + id <NSObject> m_activity; } - (id)init; - (void)sendEvent :(NSEvent *)theEvent; - (void)setCallback :(uint32_t)fMask :(PFNVBOXCACALLBACK)pfnCallback :(void *)pvUser; - (void)unsetCallback :(uint32_t)fMask :(PFNVBOXCACALLBACK)pfnCallback :(void *)pvUser; +- (void)finishLaunching; +- (void)terminate :(nullable id)sender; + - (void)registerToNotificationOfWorkspace :(NSString *)pstrNotificationName; - (void)unregisterFromNotificationOfWorkspace :(NSString *)pstrNotificationName; @@ -180,6 +185,38 @@ m_fMask = fNewMask; } +/** Standard handler called right after NSApp finished launching. */ +- (void)finishLaunching +{ + /* Call to base-class: */ + [super finishLaunching]; + + if (UICocoaApplication::instance()->isPreventAppNap()) + { + //printf("Start activity preventing AppNap!\n"); + NSActivityOptions options = NSActivityUserInitiatedAllowingIdleSystemSleep; + NSString *pstrReason = @"VirtualBox napping is prohibited!"; + m_activity = [[NSProcessInfo processInfo] beginActivityWithOptions:options + reason:pstrReason]; + [m_activity retain]; + } +} + +/** Standard handler called right before NSApp starting termination. */ +- (void)terminate :(nullable id)sender +{ + if (UICocoaApplication::instance()->isPreventAppNap()) + { + //printf("Finish activity preventing AppNap!\n"); + [[NSProcessInfo processInfo] endActivity:m_activity]; + [m_activity release]; + m_activity = Nil; + } + + /* Call to base-class: */ + [super terminate: sender]; +} + /** Registers to cocoa notification @a pstrNotificationName. */ - (void) registerToNotificationOfWorkspace :(NSString *)pstrNotificationName { @@ -294,18 +331,23 @@ *********************************************************************************************************************************/ /* static */ -UICocoaApplication* UICocoaApplication::s_pInstance = 0; +UICocoaApplication *UICocoaApplication::s_pInstance = 0; /* static */ -UICocoaApplication* UICocoaApplication::instance() +void UICocoaApplication::create(bool fPreventAppNap) { if (!s_pInstance) - s_pInstance = new UICocoaApplication; + s_pInstance = new UICocoaApplication(fPreventAppNap); +} +/* static */ +UICocoaApplication *UICocoaApplication::instance() +{ return s_pInstance; } -UICocoaApplication::UICocoaApplication() +UICocoaApplication::UICocoaApplication(bool fPreventAppNap) + : m_fPreventAppNap(fPreventAppNap) { /* Make sure our private NSApplication object is created: */ m_pNative = (UICocoaApplicationPrivate*)[UICocoaApplicationPrivate sharedApplication]; |