VirtualBox

Ignore:
Timestamp:
Mar 23, 2023 10:44:39 AM (21 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: A bit of cleanup for UIMachine code.

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

Legend:

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

    r99134 r99135  
    459459{
    460460    /* Make sure index feats the bounds: */
    461     AssertReturn(uScreenId < (ulong)m_monitorVisibilityVectorHostDesires.size(), false);
     461    AssertReturn(uScreenId < (ulong)m_guestScreenVisibilityVectorHostDesires.size(), false);
    462462
    463463    /* Return 'actual' (host-desire) visibility status: */
    464     return m_monitorVisibilityVectorHostDesires.value((int)uScreenId);
     464    return m_guestScreenVisibilityVectorHostDesires.value((int)uScreenId);
    465465}
    466466
     
    468468{
    469469    /* Make sure index feats the bounds: */
    470     AssertReturnVoid(uScreenId < (ulong)m_monitorVisibilityVectorHostDesires.size());
     470    AssertReturnVoid(uScreenId < (ulong)m_guestScreenVisibilityVectorHostDesires.size());
    471471
    472472    /* Remember 'actual' (host-desire) visibility status: */
    473     m_monitorVisibilityVectorHostDesires[(int)uScreenId] = fIsMonitorVisible;
     473    m_guestScreenVisibilityVectorHostDesires[(int)uScreenId] = fIsMonitorVisible;
    474474
    475475    /* And remember the request in extra data for guests with VMSVGA: */
     
    481481{
    482482    /* Make sure index feats the bounds: */
    483     AssertReturn(uScreenId < (ulong)m_monitorVisibilityVector.size(), false);
     483    AssertReturn(uScreenId < (ulong)m_guestScreenVisibilityVector.size(), false);
    484484
    485485    /* Return 'actual' visibility status: */
    486     return m_monitorVisibilityVector.value((int)uScreenId);
     486    return m_guestScreenVisibilityVector.value((int)uScreenId);
    487487}
    488488
     
    490490{
    491491    /* Make sure index feats the bounds: */
    492     AssertReturnVoid(uScreenId < (ulong)m_monitorVisibilityVector.size());
     492    AssertReturnVoid(uScreenId < (ulong)m_guestScreenVisibilityVector.size());
    493493
    494494    /* Remember 'actual' visibility status: */
    495     m_monitorVisibilityVector[(int)uScreenId] = fIsMonitorVisible;
     495    m_guestScreenVisibilityVector[(int)uScreenId] = fIsMonitorVisible;
    496496    /* Remember 'desired' visibility status: */
    497497    // See note in UIMachineView::sltHandleNotifyChange() regarding the graphics controller check. */
     
    508508{
    509509    int cCountOfVisibleWindows = 0;
    510     for (int i = 0; i < m_monitorVisibilityVector.size(); ++i)
    511         if (m_monitorVisibilityVector[i])
     510    for (int i = 0; i < m_guestScreenVisibilityVector.size(); ++i)
     511        if (m_guestScreenVisibilityVector[i])
    512512            ++cCountOfVisibleWindows;
    513513    return cCountOfVisibleWindows;
     
    517517{
    518518    QList<int> visibleWindows;
    519     for (int i = 0; i < m_monitorVisibilityVector.size(); ++i)
    520         if (m_monitorVisibilityVector.at(i))
     519    for (int i = 0; i < m_guestScreenVisibilityVector.size(); ++i)
     520        if (m_guestScreenVisibilityVector.at(i))
    521521            visibleWindows.push_back(i);
    522522    return visibleWindows;
     
    11211121
    11221122        /* Remember new visual state: */
    1123         m_visualState = visualState;
     1123        m_enmVisualState = visualState;
    11241124
    11251125        /* Save requested visual state: */
    1126         gEDataManager->setRequestedVisualState(m_visualState, uiCommon().managedVMUuid());
     1126        gEDataManager->setRequestedVisualState(m_enmVisualState, uiCommon().managedVMUuid());
    11271127    }
    11281128    else
     
    11351135    if (!m_pMachineLogic)
    11361136    {
    1137         /* Reset initial visual state  to normal: */
    1138         m_initialVisualState = UIVisualStateType_Normal;
     1137        /* Reset initial visual state to normal: */
     1138        m_enmInitialVisualState = UIVisualStateType_Normal;
    11391139        /* Enter initial visual state again: */
    11401140        enterInitialVisualState();
     
    14111411    , m_fInitialized(false)
    14121412    , m_pSession(0)
    1413     , m_allowedVisualStates(UIVisualStateType_Invalid)
    1414     , m_initialVisualState(UIVisualStateType_Normal)
    1415     , m_visualState(UIVisualStateType_Invalid)
     1413    , m_enmAllowedVisualStates(UIVisualStateType_Invalid)
     1414    , m_enmInitialVisualState(UIVisualStateType_Normal)
     1415    , m_enmVisualState(UIVisualStateType_Invalid)
    14161416    , m_enmRequestedVisualState(UIVisualStateType_Invalid)
    14171417    , m_pMachineLogic(0)
     
    16791679#endif /* !VBOX_WS_MAC */
    16801680
    1681     /* Accquire monitor count: */
     1681    /* Accquire guest-screen count: */
    16821682    ulong cMonitorCount = 0;
    16831683    acquireMonitorCount(cMonitorCount);
    16841684
    16851685    /* Prepare initial screen visibility status: */
    1686     m_monitorVisibilityVector.resize(cMonitorCount);
    1687     m_monitorVisibilityVector.fill(false);
    1688     m_monitorVisibilityVector[0] = true;
     1686    m_guestScreenVisibilityVector.fill(false, cMonitorCount);
     1687    m_guestScreenVisibilityVector[0] = true;
    16891688
    16901689    /* Prepare empty last full-screen size vector: */
    1691     m_monitorLastFullScreenSizeVector.resize(cMonitorCount);
    1692     m_monitorLastFullScreenSizeVector.fill(QSize(-1, -1));
     1690    m_monitorLastFullScreenSizeVector.fill(QSize(-1, -1), cMonitorCount);
    16931691
    16941692    /* If machine is in 'saved' state: */
     
    16961694    {
    16971695        /* Update screen visibility status from saved-state: */
    1698         for (int iScreenIndex = 0; iScreenIndex < m_monitorVisibilityVector.size(); ++iScreenIndex)
     1696        for (int iScreenIndex = 0; iScreenIndex < m_guestScreenVisibilityVector.size(); ++iScreenIndex)
    16991697        {
    17001698            long iDummy = 0;
     
    17021700            bool fEnabled = true;
    17031701            acquireSavedGuestScreenInfo(iScreenIndex, iDummy, iDummy, uDummy, uDummy, fEnabled);
    1704             m_monitorVisibilityVector[iScreenIndex] = fEnabled;
     1702            m_guestScreenVisibilityVector[iScreenIndex] = fEnabled;
    17051703        }
    17061704        /* And make sure at least one of them is visible (primary if others are hidden): */
    17071705        if (countOfVisibleWindows() < 1)
    1708             m_monitorVisibilityVector[0] = true;
     1706            m_guestScreenVisibilityVector[0] = true;
    17091707    }
    17101708    else if (uiCommon().isSeparateProcess())
    17111709    {
    17121710        /* Update screen visibility status from display directly: */
    1713         for (int iScreenIndex = 0; iScreenIndex < m_monitorVisibilityVector.size(); ++iScreenIndex)
     1711        for (int iScreenIndex = 0; iScreenIndex < m_guestScreenVisibilityVector.size(); ++iScreenIndex)
    17141712        {
    1715             KGuestMonitorStatus enmMonitorStatus = KGuestMonitorStatus_Disabled;
    17161713            ulong uDummy = 0;
    17171714            long iDummy = 0;
     1715            KGuestMonitorStatus enmMonitorStatus = KGuestMonitorStatus_Disabled;
    17181716            acquireGuestScreenParameters(iScreenIndex, uDummy, uDummy, uDummy, iDummy, iDummy, enmMonitorStatus);
    1719             m_monitorVisibilityVector[iScreenIndex] = (   enmMonitorStatus == KGuestMonitorStatus_Enabled
    1720                                                        || enmMonitorStatus == KGuestMonitorStatus_Blank);
     1717            m_guestScreenVisibilityVector[iScreenIndex] = (   enmMonitorStatus == KGuestMonitorStatus_Enabled
     1718                                                           || enmMonitorStatus == KGuestMonitorStatus_Blank);
    17211719        }
    17221720        /* And make sure at least one of them is visible (primary if others are hidden): */
    17231721        if (countOfVisibleWindows() < 1)
    1724             m_monitorVisibilityVector[0] = true;
     1722            m_guestScreenVisibilityVector[0] = true;
    17251723    }
    17261724
    17271725    /* Prepare initial screen visibility status of host-desires (same as facts): */
    1728     m_monitorVisibilityVectorHostDesires.resize(cMonitorCount);
    1729     for (int iScreenIndex = 0; iScreenIndex < m_monitorVisibilityVector.size(); ++iScreenIndex)
    1730         m_monitorVisibilityVectorHostDesires[iScreenIndex] = m_monitorVisibilityVector[iScreenIndex];
     1726    m_guestScreenVisibilityVectorHostDesires.resize(cMonitorCount);
     1727    for (int iScreenIndex = 0; iScreenIndex < m_guestScreenVisibilityVector.size(); ++iScreenIndex)
     1728        m_guestScreenVisibilityVectorHostDesires[iScreenIndex] = m_guestScreenVisibilityVector[iScreenIndex];
    17311729
    17321730    /* Make sure action-pool knows guest-screen visibility status: */
    1733     for (int iScreenIndex = 0; iScreenIndex < m_monitorVisibilityVector.size(); ++iScreenIndex)
    1734         actionPool()->toRuntime()->setGuestScreenVisible(iScreenIndex, m_monitorVisibilityVector.at(iScreenIndex));
     1731    for (int iScreenIndex = 0; iScreenIndex < m_guestScreenVisibilityVector.size(); ++iScreenIndex)
     1732        actionPool()->toRuntime()->setGuestScreenVisible(iScreenIndex, m_guestScreenVisibilityVector.at(iScreenIndex));
    17351733}
    17361734
     
    17631761
    17641762    /* Load restricted visual states: */
    1765     UIVisualStateType restrictedVisualStates = gEDataManager->restrictedVisualStates(uiCommon().managedVMUuid());
     1763    UIVisualStateType enmRestrictedVisualStates = gEDataManager->restrictedVisualStates(uiCommon().managedVMUuid());
    17661764    /* Acquire allowed visual states: */
    1767     m_allowedVisualStates = static_cast<UIVisualStateType>(UIVisualStateType_All ^ restrictedVisualStates);
     1765    m_enmAllowedVisualStates = static_cast<UIVisualStateType>(UIVisualStateType_All ^ enmRestrictedVisualStates);
    17681766
    17691767    /* Load requested visual state, it can override initial one: */
     
    17751773        {
    17761774            /* Direct transition allowed to scale/fullscreen modes only: */
    1777             case UIVisualStateType_Scale:      m_initialVisualState = UIVisualStateType_Scale; break;
    1778             case UIVisualStateType_Fullscreen: m_initialVisualState = UIVisualStateType_Fullscreen; break;
    1779             default: break;
     1775            case UIVisualStateType_Scale:
     1776            case UIVisualStateType_Fullscreen:
     1777                m_enmInitialVisualState = m_enmRequestedVisualState;
     1778                break;
     1779            default:
     1780                break;
    17801781        }
    17811782    }
     
    18491850void UIMachine::enterInitialVisualState()
    18501851{
    1851     sltChangeVisualState(m_initialVisualState);
     1852    sltChangeVisualState(m_enmInitialVisualState);
    18521853}
    18531854
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98983 r99135  
    179179
    180180    /** Returns whether requested visual @a state allowed. */
    181     bool isVisualStateAllowed(UIVisualStateType state) const { return m_allowedVisualStates & state; }
     181    bool isVisualStateAllowed(UIVisualStateType state) const { return m_enmAllowedVisualStates & state; }
    182182
    183183    /** Requests async visual-state change. */
     
    942942
    943943    /** Holds allowed visual states. */
    944     UIVisualStateType m_allowedVisualStates;
     944    UIVisualStateType m_enmAllowedVisualStates;
    945945    /** Holds initial visual state. */
    946     UIVisualStateType m_initialVisualState;
     946    UIVisualStateType m_enmInitialVisualState;
    947947    /** Holds current visual state. */
    948     UIVisualStateType m_visualState;
     948    UIVisualStateType m_enmVisualState;
    949949    /** Holds visual state which should be entered when possible. */
    950950    UIVisualStateType m_enmRequestedVisualState;
     
    988988     ** @{ */
    989989        /** Holds the list of desired guest-screen visibility flags. */
    990         QVector<bool>  m_monitorVisibilityVectorHostDesires;
     990        QVector<bool>  m_guestScreenVisibilityVectorHostDesires;
    991991        /** Holds the list of actual guest-screen visibility flags. */
    992         QVector<bool>  m_monitorVisibilityVector;
     992        QVector<bool>  m_guestScreenVisibilityVector;
    993993
    994994        /** Holds the list of guest-screen full-screen sizes. */
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