VirtualBox

Changeset 98602 in vbox


Ignore:
Timestamp:
Feb 16, 2023 1:40:24 PM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Cleanup for arguments of machine debugger wrappers.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r98569 r98602  
    690690    UIIndicatorFeatures(UIMachine *pMachine)
    691691        : UISessionStateStatusBarIndicator(IndicatorType_Features, pMachine)
    692         , m_iCPULoadPercentage(0)
     692        , m_uEffectiveCPULoad(0)
    693693    {
    694694        /* Assign state-icons: */
     
    731731        painter.setBrush(gradient);
    732732        /* Use 20% of the icon width to draw the indicator bar: */
    733         painter.drawRect(QRect(QPoint(0.8 * width(), (100 - m_iCPULoadPercentage) / 100.f * height()),
     733        painter.drawRect(QRect(QPoint(0.8 * width(), (100 - m_uEffectiveCPULoad) / 100.f * height()),
    734734                               QPoint(width(),  height())));
    735735        /* Draw an empty rect. around the CPU load bar: */
     
    760760    void sltHandleTimeout()
    761761    {
    762         m_iCPULoadPercentage = m_pMachine->cpuLoadPercentage();
     762        m_pMachine->acquireEffectiveCPULoad(m_uEffectiveCPULoad);
    763763        update();
    764764    }
     
    782782    QTimer *m_pTimerAutoUpdate;
    783783
    784     /** Holds the current CPU load percentage. */
    785     int  m_iCPULoadPercentage;
     784    /** Holds the effective CPU load. */
     785    ulong  m_uEffectiveCPULoad;
    786786};
    787787
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp

    r98601 r98602  
    605605}
    606606
    607 void UIMachine::setLogEnabled(bool fEnabled)
    608 {
    609     uisession()->setLogEnabled(fEnabled);
    610 }
    611 
    612 bool UIMachine::isLogEnabled()
    613 {
    614     return uisession()->isLogEnabled();
    615 }
    616 
    617 int UIMachine::cpuLoadPercentage()
    618 {
    619     return uisession()->cpuLoadPercentage();
     607bool UIMachine::setLogEnabled(bool fEnabled)
     608{
     609    return uisession()->setLogEnabled(fEnabled);
     610}
     611
     612bool UIMachine::acquireWhetherLogEnabled(bool &fEnabled)
     613{
     614    return uisession()->acquireWhetherLogEnabled(fEnabled);
     615}
     616
     617bool UIMachine::acquireEffectiveCPULoad(ulong &uLoad)
     618{
     619    return uisession()->acquireEffectiveCPULoad(uLoad);
    620620}
    621621
     
    19661966void UIMachine::updateVirtualizationState()
    19671967{
    1968     m_enmVMExecutionEngine = uisession()->executionEngineType();
    1969     m_fIsHWVirtExNestedPagingEnabled = uisession()->isHwVirtExNestedPagingEnabled();
    1970     m_fIsHWVirtExUXEnabled = uisession()->isHwVirtExUXEnabled();
     1968    uisession()->acquireExecutionEngineType(m_enmVMExecutionEngine);
     1969    uisession()->acquireWhetherHwVirtExNestedPagingEnabled(m_fIsHWVirtExNestedPagingEnabled);
     1970    uisession()->acquireWhetherHwVirtExUXEnabled(m_fIsHWVirtExUXEnabled);
    19711971    m_enmParavirtProvider = uisession()->machine().GetEffectiveParavirtProvider();
    19721972}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98601 r98602  
    453453     ** @{ */
    454454        /** Defines whether log is @a fEnabled. */
    455         void setLogEnabled(bool fEnabled);
    456         /** Returns whether log is enabled. */
    457         bool isLogEnabled();
    458 
    459         /** Returns CPU load percentage. */
    460         int cpuLoadPercentage();
     455        bool setLogEnabled(bool fEnabled);
     456        /** Acquires whether log is @a fEnabled. */
     457        bool acquireWhetherLogEnabled(bool &fEnabled);
     458
     459        /** Acquires effective CPU @a uLoad. */
     460        bool acquireEffectiveCPULoad(ulong &uLoad);
    461461    /** @} */
    462462
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r98601 r98602  
    30053005void UIMachineLogic::updateMenuDebug(QMenu*)
    30063006{
    3007     const bool fEnabled = uimachine()->isLogEnabled();
     3007    bool fEnabled = false;
     3008    uimachine()->acquireWhetherLogEnabled(fEnabled);
    30083009    actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->blockSignals(true);
    30093010    actionPool()->action(UIActionIndexRT_M_Debug_T_Logging)->setChecked(fEnabled);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98601 r98602  
    640640}
    641641
    642 void UISession::setLogEnabled(bool fEnabled)
     642bool UISession::setLogEnabled(bool fEnabled)
    643643{
    644644    CMachineDebugger comDebugger = debugger();
    645645    comDebugger.SetLogEnabled(fEnabled ? TRUE : FALSE);
    646     if (!comDebugger.isOk())
     646    const bool fSuccess = comDebugger.isOk();
     647    if (!fSuccess)
    647648        UINotificationMessage::cannotChangeMachineDebuggerParameter(comDebugger);
    648 }
    649 
    650 bool UISession::isLogEnabled()
     649    return fSuccess;
     650}
     651
     652bool UISession::acquireWhetherLogEnabled(bool &fEnabled)
    651653{
    652654    CMachineDebugger comDebugger = debugger();
    653     const BOOL fEnabled = comDebugger.GetLogEnabled();
    654     if (!comDebugger.isOk())
     655    const BOOL fLogEnabled = comDebugger.GetLogEnabled();
     656    const bool fSuccess = comDebugger.isOk();
     657    if (!fSuccess)
    655658        UINotificationMessage::cannotAcquireMachineDebuggerParameter(comDebugger);
    656     return fEnabled == TRUE;
    657 }
    658 
    659 KVMExecutionEngine UISession::executionEngineType()
     659    else
     660        fEnabled = fLogEnabled == TRUE;
     661    return fSuccess;
     662}
     663
     664bool UISession::acquireExecutionEngineType(KVMExecutionEngine &enmType)
    660665{
    661666    CMachineDebugger comDebugger = debugger();
    662     const KVMExecutionEngine enmEngine = comDebugger.GetExecutionEngine();
    663     if (!comDebugger.isOk())
     667    const KVMExecutionEngine enmEngineType = comDebugger.GetExecutionEngine();
     668    const bool fSuccess = comDebugger.isOk();
     669    if (!fSuccess)
    664670        UINotificationMessage::cannotAcquireMachineDebuggerParameter(comDebugger);
    665     return enmEngine;
    666 }
    667 
    668 bool UISession::isHwVirtExNestedPagingEnabled()
     671    else
     672        enmType = enmEngineType;
     673    return fSuccess;
     674}
     675
     676bool UISession::acquireWhetherHwVirtExNestedPagingEnabled(bool &fEnabled)
    669677{
    670678    CMachineDebugger comDebugger = debugger();
    671     const BOOL fEnabled = comDebugger.GetHWVirtExNestedPagingEnabled();
    672     if (!comDebugger.isOk())
     679    const BOOL fFeatureEnabled = comDebugger.GetHWVirtExNestedPagingEnabled();
     680    const bool fSuccess = comDebugger.isOk();
     681    if (!fSuccess)
    673682        UINotificationMessage::cannotAcquireMachineDebuggerParameter(comDebugger);
    674     return fEnabled == TRUE;
    675 }
    676 
    677 bool UISession::isHwVirtExUXEnabled()
     683    else
     684        fEnabled = fFeatureEnabled == TRUE;
     685    return fSuccess;
     686}
     687
     688bool UISession::acquireWhetherHwVirtExUXEnabled(bool &fEnabled)
    678689{
    679690    CMachineDebugger comDebugger = debugger();
    680     const BOOL fEnabled = comDebugger.GetHWVirtExUXEnabled();
    681     if (!comDebugger.isOk())
     691    const BOOL fFeatureEnabled = comDebugger.GetHWVirtExUXEnabled();
     692    const bool fSuccess = comDebugger.isOk();
     693    if (!fSuccess)
    682694        UINotificationMessage::cannotAcquireMachineDebuggerParameter(comDebugger);
    683     return fEnabled == TRUE;
    684 }
    685 
    686 int UISession::cpuLoadPercentage()
     695    else
     696        fEnabled = fFeatureEnabled == TRUE;
     697    return fSuccess;
     698}
     699
     700bool UISession::acquireEffectiveCPULoad(ulong &uLoad)
    687701{
    688702    CMachineDebugger comDebugger = debugger();
     
    691705    ULONG uPctOther;
    692706    comDebugger.GetCPULoad(0x7fffffff, uPctExecuting, uPctHalted, uPctOther);
    693     if (!comDebugger.isOk())
     707    const bool fSuccess = comDebugger.isOk();
     708    if (!fSuccess)
    694709        UINotificationMessage::cannotAcquireMachineDebuggerParameter(comDebugger);
    695     return uPctExecuting + uPctOther;
     710    else
     711        uLoad = uPctExecuting + uPctOther;
     712    return fSuccess;
    696713}
    697714
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98601 r98602  
    355355     ** @{ */
    356356        /** Defines whether log is @a fEnabled. */
    357         void setLogEnabled(bool fEnabled);
    358         /** Returns whether log is enabled. */
    359         bool isLogEnabled();
    360 
    361         /** Returns VM's execution engine type. */
    362         KVMExecutionEngine executionEngineType();
    363         /** Returns whether nested paging hardware virtualization extension is enabled. */
    364         bool isHwVirtExNestedPagingEnabled();
    365         /** Returns whether UX hardware virtualization extension is enabled. */
    366         bool isHwVirtExUXEnabled();
    367 
    368         /** Returns CPU load percentage. */
    369         int cpuLoadPercentage();
     357        bool setLogEnabled(bool fEnabled);
     358        /** Acquires whether log is @a fEnabled. */
     359        bool acquireWhetherLogEnabled(bool &fEnabled);
     360
     361        /** Acquires VM's execution engine @a enmType. */
     362        bool acquireExecutionEngineType(KVMExecutionEngine &enmType);
     363        /** Acquires whether nested paging hardware virtualization extension is @a fEnabled. */
     364        bool acquireWhetherHwVirtExNestedPagingEnabled(bool &fEnabled);
     365        /** Acquires whether UX hardware virtualization extension is @a fEnabled. */
     366        bool acquireWhetherHwVirtExUXEnabled(bool &fEnabled);
     367
     368        /** Acquires effective CPU @a uLoad. */
     369        bool acquireEffectiveCPULoad(ulong &uLoad);
    370370    /** @} */
    371371
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