VirtualBox

Changeset 98786 in vbox


Ignore:
Timestamp:
Feb 28, 2023 3:53:25 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156097
Message:

FE/Qt: bugref:10322. Removing direct API usage from UIRuntimeInfoWidget. Not comlete.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r98784 r98786  
    7878#include "CUpdateAgent.h"
    7979#include "CVRDEServer.h"
     80#include "CVRDEServerInfo.h"
    8081
    8182/* Other VBox stuff: */
     
    745746
    746747/* static */
     748void UINotificationMessage::cannotAcquireVRDEServerInfoParameter(const CVRDEServerInfo &comVRDEServerInfo)
     749{
     750    createMessage(
     751        QApplication::translate("UIMessageCenter", "VRDE Server Info failure ..."),
     752        QApplication::translate("UIMessageCenter", "Failed to acquire VRDE server parameter.") +
     753        UIErrorString::formatErrorInfo(comVRDEServerInfo));
     754}
     755
     756/* static */
    747757void UINotificationMessage::cannotAcquireSnapshotParameter(const CSnapshot &comSnapshot)
    748758{
     
    906916        QApplication::translate("UIMessageCenter", "Failed to acquire cloud machine parameter.") +
    907917        UIErrorString::formatErrorInfo(comCloudMachine),
     918        QString(), QString(), pParent);
     919}
     920
     921/* static */
     922void UINotificationMessage::cannotAcquireGuestParameter(const CGuest &comGuest, UINotificationCenter *pParent /* = 0 */)
     923{
     924    createMessage(
     925        QApplication::translate("UIMessageCenter", "Guest failure ..."),
     926        QApplication::translate("UIMessageCenter", "Failed to acquire guest parameter.") +
     927        UIErrorString::formatErrorInfo(comGuest),
    908928        QString(), QString(), pParent);
    909929}
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r98784 r98786  
    8181class CVirtualBoxErrorInfo;
    8282class CVRDEServer;
     83class CVRDEServerInfo;
    8384class CUnattended;
     85
    8486
    8587/** UINotificationObject extension for message functionality. */
     
    355357          * @param  comServer  Brings the object parameter get acquired from. */
    356358        static void cannotAcquireVRDEServerParameter(const CVRDEServer &comServer);
     359        /** Notifies about inability to acquire IVRDEServerInfo parameter.
     360          * @param  comVRDEServerInfo  Brings the object parameter get acquired from. */
     361        static void cannotAcquireVRDEServerInfoParameter(const CVRDEServerInfo &comVRDEServerInfo);
    357362        /** Notifies about inability to acquire IVirtualSystemDescription parameter.
    358363          * @param  comVsd  Brings the object parameter get acquired from. */
     
    379384        static void cannotAcquireCloudMachineParameter(const CCloudMachine &comCloudMachine,
    380385                                                       UINotificationCenter *pParent = 0);
     386        /** Notifies about inability to acquire IGuest parameter.
     387          * @param  comGuest  Brings the object parameter get acquired from. */
     388        static void cannotAcquireGuestParameter(const CGuest &comGuest,
     389                                                UINotificationCenter *pParent = 0);
    381390
    382391        /** Notifies about inability to change IMedium parameter.
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r98784 r98786  
    672672}
    673673
     674bool UIMachine::acquireGuestAdditionsVersion(QString &strGAVersion)
     675{
     676    return uisession()->acquireGuestAdditionsVersion(strGAVersion);
     677}
     678bool UIMachine::acquireGuestAdditionsRevision(ULONG &uRevision)
     679{
     680    return uisession()->acquireGuestAdditionsRevision(uRevision);
     681}
     682
    674683bool UIMachine::putScancode(LONG iCode)
    675684{
     
    790799{
    791800    return uisession()->setNetworkCableConnected(uSlot, fConnected);
     801}
     802
     803bool UIMachine::acquireVRDEServerPort(LONG &uPort)
     804{
     805    return uisession()->acquireVRDEServerPort(uPort);
    792806}
    793807
     
    923937{
    924938    return uisession()->acquireEffectiveCPULoad(uLoad);
     939}
     940
     941bool UIMachine::acquireUptime(LONG64 &uLoad)
     942{
     943    return uisession()->acquireUptime(uLoad);
    925944}
    926945
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98784 r98786  
    398398        /** Returns whether guest additions supports seamless. */
    399399        bool isGuestSupportsSeamless() const;
     400        /** Acquires the guest addition's version. */
     401        bool acquireGuestAdditionsVersion(QString &strGAVersion);
     402        /** Acquires the guest addition's revision. */
     403        bool acquireGuestAdditionsRevision(ULONG &uRevision);
    400404    /** @} */
    401405
     
    541545        /** Set whether network adapter cable is connected. */
    542546        bool setNetworkCableConnected(ulong uSlot, bool fConnected);
     547        /** Acquires VRDE server port. */
     548        bool acquireVRDEServerPort(LONG &uPort);
    543549    /** @} */
    544550
     
    596602        /** Acquires effective CPU @a uLoad. */
    597603        bool acquireEffectiveCPULoad(ulong &uLoad);
     604        /** Acquires uptime @a uUpTime as milliseconds. */
     605        bool acquireUptime(LONG64 &uUpTime);
    598606
    599607#ifdef VBOX_WITH_DEBUGGER_GUI
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98784 r98786  
    7979#include "CUSBDeviceFilters.h"
    8080#include "CVRDEServer.h"
     81#include "CVRDEServerInfo.h"
    8182#ifdef VBOX_WITH_NETFLT
    8283# include "CNetworkAdapter.h"
     
    889890}
    890891
     892bool UISession::acquireVRDEServerPort(LONG &uPort)
     893{
     894    CConsole comConsole = console();
     895    CVRDEServerInfo comVRDEServerInfo = comConsole.GetVRDEServerInfo();
     896    bool fSuccess = comConsole.isOk();
     897
     898    if (!fSuccess)
     899        UINotificationMessage::cannotAcquireConsoleParameter(comConsole);
     900    LONG uVRDEPort = comVRDEServerInfo.GetPort();
     901    fSuccess = comVRDEServerInfo.isOk();
     902
     903    if (!fSuccess)
     904        UINotificationMessage::cannotAcquireVRDEServerInfoParameter(comVRDEServerInfo);
     905    uPort = uVRDEPort;
     906    return fSuccess;
     907}
     908
    891909bool UISession::guestAdditionsUpgradable()
    892910{
     
    910928
    911929    return true;
     930}
     931
     932bool UISession::acquireGuestAdditionsVersion(QString &strGAVersion)
     933{
     934    CGuest &comGuest = guest();
     935    QString strVersion = comGuest.GetAdditionsVersion();
     936    const bool fSuccess = comGuest.isOk();
     937    if (!fSuccess)
     938        UINotificationMessage::cannotAcquireGuestParameter(comGuest);
     939    else
     940        strGAVersion = strVersion;
     941    return fSuccess;
     942}
     943
     944bool UISession::acquireGuestAdditionsRevision(ULONG &uRevision)
     945{
     946    CGuest &comGuest = guest();
     947    ULONG uRev = comGuest.GetAdditionsRevision();
     948    const bool fSuccess = comGuest.isOk();
     949    if (!fSuccess)
     950        UINotificationMessage::cannotAcquireGuestParameter(comGuest);
     951    else
     952        uRevision = uRev;
     953    return fSuccess;
    912954}
    913955
     
    16691711    else
    16701712        uLoad = uPctExecuting + uPctOther;
     1713    return fSuccess;
     1714}
     1715
     1716bool UISession::acquireUptime(LONG64 &uUpTime)
     1717{
     1718    CMachineDebugger comDebugger = debugger();
     1719    LONG64 uTime = comDebugger.GetUptime();
     1720    const bool fSuccess = comDebugger.isOk();
     1721    if (!fSuccess)
     1722        UINotificationMessage::cannotAcquireMachineDebuggerParameter(comDebugger);
     1723    else
     1724        uUpTime = uTime;
    16711725    return fSuccess;
    16721726}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98784 r98786  
    358358        /** Set whether network adapter cable is connected. */
    359359        bool setNetworkCableConnected(ulong uSlot, bool fConnected);
     360        /** Acquires VRDE server port. */
     361        bool acquireVRDEServerPort(LONG &uPort);
    360362    /** @} */
    361363
     
    372374        /** Returns whether GA can be upgraded. */
    373375        bool guestAdditionsUpgradable();
     376        /** Acquires the guest addition's version. */
     377        bool acquireGuestAdditionsVersion(QString &strGAVersion);
     378        /** Acquires the guest addition's revision. */
     379        bool acquireGuestAdditionsRevision(ULONG &uRevision);
    374380    /** @} */
    375381
     
    511517        /** Acquires effective CPU @a uLoad. */
    512518        bool acquireEffectiveCPULoad(ulong &uLoad);
     519        /** Acquires uptime @a uUpTime. */
     520        bool acquireUptime(LONG64 &uUpTime);
    513521
    514522#ifdef VBOX_WITH_DEBUGGER_GUI
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.cpp

    r98385 r98786  
    4646#include "CDisplay.h"
    4747#include "CGraphicsAdapter.h"
    48 #include "CGuest.h"
    4948#include "CMachineDebugger.h"
    5049#include "CVRDEServerInfo.h"
     
    252251QString UIRuntimeInfoWidget::screenResolution(int iScreenID)
    253252{
     253    AssertPtrReturn(gpMachine, QString());
    254254    /* Determine resolution: */
    255     ULONG uWidth = 0;
    256     ULONG uHeight = 0;
    257     ULONG uBpp = 0;
    258     LONG xOrigin = 0;
    259     LONG yOrigin = 0;
     255    ulong uWidth = 0;
     256    ulong uHeight = 0;
     257    ulong uBpp = 0;
     258    long xOrigin = 0;
     259    long yOrigin = 0;
    260260    KGuestMonitorStatus monitorStatus = KGuestMonitorStatus_Enabled;
    261     m_console.GetDisplay().GetScreenResolution(iScreenID, uWidth, uHeight, uBpp, xOrigin, yOrigin, monitorStatus);
     261    gpMachine->acquireGuestScreenParameters(iScreenID, uWidth, uHeight, uBpp, xOrigin, yOrigin, monitorStatus);
    262262    QString strResolution = QString("%1x%2").arg(uWidth).arg(uHeight);
    263263    if (uBpp)
     
    312312void UIRuntimeInfoWidget::updateUpTime()
    313313{
    314     CMachineDebugger debugger = m_console.GetDebugger();
    315     uint32_t uUpSecs = (debugger.GetUptime() / 5000) * 5;
     314    AssertPtrReturnVoid(gpMachine);
     315    LONG64 uUptime;
     316    if (!gpMachine->acquireUptime(uUptime))
     317        return;
     318    uint64_t uUpSecs = (uUptime / 5000) * 5;
    316319    char szUptime[32];
    317     uint32_t uUpDays = uUpSecs / (60 * 60 * 24);
     320    uint64_t uUpDays = uUpSecs / (60 * 60 * 24);
    318321    uUpSecs -= uUpDays * 60 * 60 * 24;
    319     uint32_t uUpHours = uUpSecs / (60 * 60);
     322    uint64_t uUpHours = uUpSecs / (60 * 60);
    320323    uUpSecs -= uUpHours * 60 * 60;
    321     uint32_t uUpMins  = uUpSecs / 60;
     324    uint64_t uUpMins  = uUpSecs / 60;
    322325    uUpSecs -= uUpMins * 60;
    323326    RTStrPrintf(szUptime, sizeof(szUptime), "%dd %02d:%02d:%02d",
     
    344347void UIRuntimeInfoWidget::updateOSTypeRow()
    345348{
    346    QString strOSType = m_console.GetGuest().GetOSTypeId();
     349    AssertPtrReturnVoid(gpMachine);
     350    QString strOSType = gpMachine->osTypeId();
    347351    if (strOSType.isEmpty())
    348352        strOSType = m_strOSNotDetected;
     
    354358void UIRuntimeInfoWidget::updateVirtualizationInfo()
    355359{
    356 
    357     /* Determine virtualization attributes: */
    358     CMachineDebugger debugger = m_console.GetDebugger();
     360    AssertPtrReturnVoid(gpMachine);
     361    KVMExecutionEngine enmExecutionEngineType = gpMachine->vmExecutionEngine();
    359362
    360363    QString strExecutionEngine;
    361     switch (debugger.GetExecutionEngine())
     364    switch (enmExecutionEngineType)
    362365    {
    363366        case KVMExecutionEngine_HwVirt:
     
    377380            break;
    378381    }
    379     QString strNestedPaging = debugger.GetHWVirtExNestedPagingEnabled() ?
     382    QString strNestedPaging = gpMachine->isHWVirtExNestedPagingEnabled() ?
    380383        m_strNestedPagingActive : m_strNestedPagingInactive;
    381     QString strUnrestrictedExecution = debugger.GetHWVirtExUXEnabled() ?
     384    QString strUnrestrictedExecution = gpMachine->isHWVirtExUXEnabled() ?
    382385        m_strUnrestrictedExecutionActive : m_strUnrestrictedExecutionInactive;
    383386    QString strParavirtProvider = gpConverter->toString(m_machine.GetEffectiveParavirtProvider());
     
    391394void UIRuntimeInfoWidget::updateGAsVersion()
    392395{
    393     CGuest guest = m_console.GetGuest();
    394     QString strGAVersion = guest.GetAdditionsVersion();
     396    AssertPtrReturnVoid(gpMachine);
     397    QString strGAVersion;
     398    gpMachine->acquireGuestAdditionsVersion(strGAVersion);
    395399    if (strGAVersion.isEmpty())
    396400        strGAVersion = m_strGANotDetected;
    397401    else
    398402    {
    399         ULONG uRevision = guest.GetAdditionsRevision();
     403        ULONG uRevision = 0;
     404        gpMachine->acquireGuestAdditionsRevision(uRevision);
    400405        if (uRevision != 0)
    401406            strGAVersion += QString(" r%1").arg(uRevision);
     
    406411void UIRuntimeInfoWidget::updateVRDE()
    407412{
    408     int iVRDEPort = m_console.GetVRDEServerInfo().GetPort();
     413    AssertPtrReturnVoid(gpMachine);
     414    LONG iVRDEPort = 0;
     415    gpMachine->acquireVRDEServerPort(iVRDEPort);
    409416    QString strVRDEInfo = (iVRDEPort == 0 || iVRDEPort == -1) ?
    410417        m_strVRDEPortNotAvailable : QString("%1").arg(iVRDEPort);
     
    507514    , m_pCopyWholeTableAction(0)
    508515{
    509     if (!m_console.isNull())
    510         m_comGuest = m_console.GetGuest();
    511516    connect(pMachine, &UIMachine::sigAdditionsStateChange, this, &UIInformationRuntime::sltGuestAdditionsStateChange);
    512517    connect(pMachine, &UIMachine::sigGuestMonitorChange, this, &UIInformationRuntime::sltGuestMonitorChange);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/UIInformationRuntime.h

    r98385 r98786  
    3838#include "COMEnums.h"
    3939#include "CConsole.h"
    40 #include "CGuest.h"
    4140#include "CMachine.h"
    4241
     
    8685    CMachine m_machine;
    8786    CConsole m_console;
    88     CGuest m_comGuest;
    8987
    9088    /** Holds the instance of layout we create. */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette