VirtualBox

Ignore:
Timestamp:
Feb 9, 2023 11:24:06 AM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Rework CMachineDebugger wrapper usage the way it's fully encapsulated inside UISession.

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

Legend:

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

    r98503 r98516  
    6262#include "CHostOnlyNetwork.h"
    6363#include "CKeyboard.h"
     64#include "CMachineDebugger.h"
    6465#include "CMediumAttachment.h"
    6566#include "CMouse.h"
     
    670671
    671672/* static */
     673void UINotificationMessage::cannotAcquireMachineDebuggerParameter(const CMachineDebugger &comMachineDebugger)
     674{
     675    createMessage(
     676        QApplication::translate("UIMessageCenter", "Debugger failure ..."),
     677        QApplication::translate("UIMessageCenter", "Failed to acquire machine debugger parameter.") +
     678        UIErrorString::formatErrorInfo(comMachineDebugger));
     679}
     680
     681/* static */
    672682void UINotificationMessage::cannotAcquireConsoleParameter(const CConsole &comConsole)
    673683{
     
    834844                                                   .arg(CMachine(comMachine).GetName()) +
    835845        UIErrorString::formatErrorInfo(comMachine));
     846}
     847
     848/* static */
     849void UINotificationMessage::cannotChangeMachineDebuggerParameter(const CMachineDebugger &comMachineDebugger)
     850{
     851    createMessage(
     852        QApplication::translate("UIMessageCenter", "Debugger failure ..."),
     853        QApplication::translate("UIMessageCenter", "Failed to change the parameter of machine debugger.") +
     854        UIErrorString::formatErrorInfo(comMachineDebugger));
    836855}
    837856
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r98503 r98516  
    7373class CEmulatedUSB;
    7474class CKeyboard;
     75class CMachineDebugger;
    7576class CMouse;
    7677class CNetworkAdapter;
     
    295296          * @param  comMachine  Brings the object parameter get acquired from. */
    296297        static void cannotAcquireMachineParameter(const CMachine &comMachine);
     298        /** Notifies about inability to acquire IMachineDebugger parameter.
     299          * @param  comMachineDebugger  Brings the object parameter get acquired from. */
     300        static void cannotAcquireMachineDebuggerParameter(const CMachineDebugger &comMachineDebugger);
    297301        /** Notifies about inability to acquire IConsole parameter.
    298302          * @param  comConsole  Brings the object parameter get acquired from. */
     
    353357          * @param  comMachine  Brings the object parameter being changed for. */
    354358        static void cannotChangeMachineParameter(const CMachine &comMachine);
     359        /** Notifies about inability to change IMachineDebugger parameter.
     360          * @param  comMachineDebugger  Brings the object parameter being changed for. */
     361        static void cannotChangeMachineDebuggerParameter(const CMachineDebugger &comMachineDebugger);
    355362        /** Notifies about inability to change IGraphicsAdapter parameter.
    356363          * @param  comAdapter  Brings the object parameter being changed for. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r98491 r98516  
    742742    void sltHandleTimeout()
    743743    {
    744         m_pMachine->acquireCpuLoadPercentage(m_iCPULoadPercentage);
     744        m_iCPULoadPercentage = m_pMachine->cpuLoadPercentage();
    745745        update();
    746746    }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r98503 r98516  
    534534}
    535535
    536 void UIMachine::acquireCpuLoadPercentage(int &iPercentage)
    537 {
    538     uisession()->acquireCpuLoadPercentage(iPercentage);
    539 }
    540 
    541536void UIMachine::acquireFeaturesStatusInfo(QString &strInfo, KVMExecutionEngine &enmEngine)
    542537{
     
    546541                                           isHWVirtExUXEnabled(),
    547542                                           paravirtProvider());
     543}
     544
     545void UIMachine::setLogEnabled(bool fEnabled)
     546{
     547    uisession()->setLogEnabled(fEnabled);
     548}
     549
     550bool UIMachine::isLogEnabled()
     551{
     552    return uisession()->isLogEnabled();
     553}
     554
     555int UIMachine::cpuLoadPercentage()
     556{
     557    return uisession()->cpuLoadPercentage();
    548558}
    549559
     
    18901900void UIMachine::updateVirtualizationState()
    18911901{
    1892     m_enmVMExecutionEngine = uisession()->debugger().GetExecutionEngine();
    1893     m_fIsHWVirtExNestedPagingEnabled = uisession()->debugger().GetHWVirtExNestedPagingEnabled();
    1894     m_fIsHWVirtExUXEnabled = uisession()->debugger().GetHWVirtExUXEnabled();
     1902    m_enmVMExecutionEngine = uisession()->executionEngineType();
     1903    m_fIsHWVirtExNestedPagingEnabled = uisession()->isHwVirtExNestedPagingEnabled();
     1904    m_fIsHWVirtExUXEnabled = uisession()->isHwVirtExUXEnabled();
    18951905    m_enmParavirtProvider = uisession()->machine().GetEffectiveParavirtProvider();
    18961906}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98503 r98516  
    419419        /** Acquires status info for Recording indicator. */
    420420        void acquireRecordingStatusInfo(QString &strInfo, bool &fRecordingEnabled, bool &fMachinePaused);
    421         /** Acquires CPU load @a iPercentage. */
    422         void acquireCpuLoadPercentage(int &iPercentage);
    423421        /** Acquires status info for Features indicator. */
    424422        void acquireFeaturesStatusInfo(QString &strInfo, KVMExecutionEngine &enmEngine);
     423    /** @} */
     424
     425    /** @name Debugger stuff.
     426     ** @{ */
     427        /** Defines whether log is @a fEnabled. */
     428        void setLogEnabled(bool fEnabled);
     429        /** Returns whether log is enabled. */
     430        bool isLogEnabled();
     431
     432        /** Returns CPU load percentage. */
     433        int cpuLoadPercentage();
    425434    /** @} */
    426435
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r98503 r98516  
    307307{
    308308    return uisession()->guest();
    309 }
    310 
    311 CMachineDebugger& UIMachineLogic::debugger() const
    312 {
    313     return uisession()->debugger();
    314309}
    315310
     
    24842479void UIMachineLogic::sltLoggingToggled(bool fState)
    24852480{
    2486     NOREF(fState);
    2487     if (!debugger().isNull() && debugger().isOk())
    2488         debugger().SetLogEnabled(fState);
     2481    uimachine()->setLogEnabled(fState);
    24892482}
    24902483
     
    30002993void UIMachineLogic::updateMenuDebug(QMenu*)
    30012994{
    3002     /* The "Logging" item. */
    3003     bool fEnabled = false;
    3004     bool fChecked = false;
    3005     if (!debugger().isNull() && debugger().isOk())
    3006     {
    3007         fEnabled = true;
    3008         fChecked = debugger().GetLogEnabled() != FALSE;
    3009     }
    3010     if (fEnabled != actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->isEnabled())
    3011         actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->setEnabled(fEnabled);
    3012     if (fChecked != actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->isChecked())
    3013         actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->setChecked(fChecked);
     2995    const bool fEnabled = uimachine()->isLogEnabled();
     2996    actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->blockSignals(true);
     2997    actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->setChecked(fEnabled);
     2998    actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->blockSignals(false);
    30142999}
    30153000#endif /* VBOX_WITH_DEBUGGER_GUI */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r98503 r98516  
    6060class CGuest;
    6161class CMouse;
    62 class CMachineDebugger;
    6362class CSnapshot;
    6463class CUSBDevice;
     
    128127    /** Returns the console's guest reference. */
    129128    CGuest& guest() const;
    130     /** Returns the console's debugger reference. */
    131     CMachineDebugger& debugger() const;
    132129
    133130    /** Returns the machine name. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r98503 r98516  
    14551455{
    14561456    return uisession()->display();
    1457 }
    1458 
    1459 CGuest& UIMachineView::guest() const
    1460 {
    1461     return uisession()->guest();
    14621457}
    14631458
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r98378 r98516  
    282282    /** Returns the console's display reference. */
    283283    CDisplay& display() const;
    284     /** Returns the console's guest reference. */
    285     CGuest& guest() const;
    286284
    287285    /* Protected getters: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98503 r98516  
    463463}
    464464
    465 void UISession::acquireCpuLoadPercentage(int &iPercentage)
     465void UISession::acquireFeaturesStatusInfo(QString &strInfo, KVMExecutionEngine &enmEngine,
     466                                          bool fNestedPagingEnabled, bool fUxEnabled,
     467                                          KParavirtProvider enmProvider)
     468{
     469    CMachine comMachine = machine();
     470    UIDetailsGenerator::acquireFeaturesStatusInfo(comMachine, strInfo,
     471                                                  enmEngine,
     472                                                  fNestedPagingEnabled, fUxEnabled,
     473                                                  enmProvider);
     474}
     475
     476void UISession::setLogEnabled(bool fEnabled)
     477{
     478    CMachineDebugger comDebugger = debugger();
     479    comDebugger.SetLogEnabled(fEnabled ? TRUE : FALSE);
     480    if (!comDebugger.isOk())
     481        UINotificationMessage::cannotChangeMachineDebuggerParameter(comDebugger);
     482}
     483
     484bool UISession::isLogEnabled()
     485{
     486    CMachineDebugger comDebugger = debugger();
     487    const BOOL fEnabled = comDebugger.GetLogEnabled();
     488    if (!comDebugger.isOk())
     489        UINotificationMessage::cannotAcquireMachineDebuggerParameter(comDebugger);
     490    return fEnabled == TRUE;
     491}
     492
     493KVMExecutionEngine UISession::executionEngineType()
     494{
     495    CMachineDebugger comDebugger = debugger();
     496    const KVMExecutionEngine enmEngine = comDebugger.GetExecutionEngine();
     497    if (!comDebugger.isOk())
     498        UINotificationMessage::cannotAcquireMachineDebuggerParameter(comDebugger);
     499    return enmEngine;
     500}
     501
     502bool UISession::isHwVirtExNestedPagingEnabled()
     503{
     504    CMachineDebugger comDebugger = debugger();
     505    const BOOL fEnabled = comDebugger.GetHWVirtExNestedPagingEnabled();
     506    if (!comDebugger.isOk())
     507        UINotificationMessage::cannotAcquireMachineDebuggerParameter(comDebugger);
     508    return fEnabled == TRUE;
     509}
     510
     511bool UISession::isHwVirtExUXEnabled()
     512{
     513    CMachineDebugger comDebugger = debugger();
     514    const BOOL fEnabled = comDebugger.GetHWVirtExUXEnabled();
     515    if (!comDebugger.isOk())
     516        UINotificationMessage::cannotAcquireMachineDebuggerParameter(comDebugger);
     517    return fEnabled == TRUE;
     518}
     519
     520int UISession::cpuLoadPercentage()
    466521{
    467522    CMachineDebugger comDebugger = debugger();
     
    470525    ULONG uPctOther;
    471526    comDebugger.GetCPULoad(0x7fffffff, uPctExecuting, uPctHalted, uPctOther);
    472     iPercentage = uPctExecuting + uPctOther;
    473 }
    474 
    475 void UISession::acquireFeaturesStatusInfo(QString &strInfo, KVMExecutionEngine &enmEngine,
    476                                           bool fNestedPagingEnabled, bool fUxEnabled,
    477                                           KParavirtProvider enmProvider)
    478 {
    479     CMachine comMachine = machine();
    480     UIDetailsGenerator::acquireFeaturesStatusInfo(comMachine, strInfo,
    481                                                   enmEngine,
    482                                                   fNestedPagingEnabled, fUxEnabled,
    483                                                   enmProvider);
     527    if (!comDebugger.isOk())
     528        UINotificationMessage::cannotAcquireMachineDebuggerParameter(comDebugger);
     529    return uPctExecuting + uPctOther;
    484530}
    485531
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98503 r98516  
    319319        /** Acquires status info for Recording indicator. */
    320320        void acquireRecordingStatusInfo(QString &strInfo, bool &fRecordingEnabled, bool &fMachinePaused);
    321         /** Acquires CPU load @a iPercentage. */
    322         void acquireCpuLoadPercentage(int &iPercentage);
    323321        /** Acquires status info for Features indicator. */
    324322        void acquireFeaturesStatusInfo(QString &strInfo, KVMExecutionEngine &enmEngine,
    325323                                       bool fNestedPagingEnabled, bool fUxEnabled,
    326324                                       KParavirtProvider enmProvider);
     325    /** @} */
     326
     327    /** @name Debugger stuff.
     328     ** @{ */
     329        /** Defines whether log is @a fEnabled. */
     330        void setLogEnabled(bool fEnabled);
     331        /** Returns whether log is enabled. */
     332        bool isLogEnabled();
     333
     334        /** Returns VM's execution engine type. */
     335        KVMExecutionEngine executionEngineType();
     336        /** Returns whether nested paging hardware virtualization extension is enabled. */
     337        bool isHwVirtExNestedPagingEnabled();
     338        /** Returns whether UX hardware virtualization extension is enabled. */
     339        bool isHwVirtExUXEnabled();
     340
     341        /** Returns CPU load percentage. */
     342        int cpuLoadPercentage();
    327343    /** @} */
    328344
Note: See TracChangeset for help on using the changeset viewer.

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