VirtualBox

Changeset 71615 in vbox for trunk/src


Ignore:
Timestamp:
Apr 2, 2018 1:18:40 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9049: Detach UIActionPoolRuntime dependencies from Runtime UI sources.

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

Legend:

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

    r71109 r71615  
    2323# include "UIActionPoolRuntime.h"
    2424# include "UIDesktopWidgetWatchdog.h"
    25 # include "UIMultiScreenLayout.h"
    2625# include "UIExtraDataManager.h"
    2726# include "UIShortcutPool.h"
    28 # include "UIFrameBuffer.h"
    2927# include "UIConverter.h"
    3028# include "UIIconPool.h"
    31 # include "UISession.h"
    3229# include "VBoxGlobal.h"
    3330
     
    20472044UIActionPoolRuntime::UIActionPoolRuntime(bool fTemporary /* = false */)
    20482045    : UIActionPool(UIActionPoolType_Runtime, fTemporary)
    2049     , m_pSession(0)
    2050     , m_pMultiScreenLayout(0)
    2051 {
    2052 }
    2053 
    2054 void UIActionPoolRuntime::setSession(UISession *pSession)
    2055 {
    2056     m_pSession = pSession;
     2046    , m_cHostScreens(0)
     2047    , m_cGuestScreens(0)
     2048    , m_fGuestSupportsGraphics(false)
     2049{
     2050}
     2051
     2052void UIActionPoolRuntime::setHostScreenCount(int cCount)
     2053{
     2054    m_cHostScreens = cCount;
    20572055    m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
    20582056}
    20592057
    2060 void UIActionPoolRuntime::setMultiScreenLayout(UIMultiScreenLayout *pMultiScreenLayout)
    2061 {
    2062     /* Do not allow NULL pointers: */
    2063     AssertPtrReturnVoid(pMultiScreenLayout);
    2064 
    2065     /* Assign new multi-screen layout: */
    2066     m_pMultiScreenLayout = pMultiScreenLayout;
    2067 
    2068     /* Connect new stuff: */
    2069     connect(this, SIGNAL(sigNotifyAboutTriggeringViewScreenRemap(int, int)),
    2070             m_pMultiScreenLayout, SLOT(sltHandleScreenLayoutChange(int, int)));
    2071     connect(m_pMultiScreenLayout, SIGNAL(sigScreenLayoutUpdate()),
    2072             this, SLOT(sltHandleScreenLayoutUpdate()));
    2073 
    2074     /* Invalidate View menu: */
    2075     m_invalidations << UIActionIndexRT_M_View;
    2076 }
    2077 
    2078 void UIActionPoolRuntime::unsetMultiScreenLayout(UIMultiScreenLayout *pMultiScreenLayout)
    2079 {
    2080     /* Do not allow NULL pointers: */
    2081     AssertPtrReturnVoid(pMultiScreenLayout);
    2082 
    2083     /* Disconnect old stuff: */
    2084     disconnect(this, SIGNAL(sigNotifyAboutTriggeringViewScreenRemap(int, int)),
    2085                pMultiScreenLayout, SLOT(sltHandleScreenLayoutChange(int, int)));
    2086     disconnect(pMultiScreenLayout, SIGNAL(sigScreenLayoutUpdate()),
    2087                this, SLOT(sltHandleScreenLayoutUpdate()));
    2088 
    2089     /* Unset old multi-screen layout: */
    2090     if (m_pMultiScreenLayout == pMultiScreenLayout)
    2091         m_pMultiScreenLayout = 0;
    2092 
    2093     /* Invalidate View menu: */
    2094     m_invalidations << UIActionIndexRT_M_View;
     2058void UIActionPoolRuntime::setGuestScreenCount(int cCount)
     2059{
     2060    m_cGuestScreens = cCount;
     2061    m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
     2062}
     2063
     2064void UIActionPoolRuntime::setGuestScreenSize(int iGuestScreen, const QSize &size)
     2065{
     2066    m_mapGuestScreenSize[iGuestScreen] = size;
     2067    m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
     2068}
     2069
     2070void UIActionPoolRuntime::setGuestScreenVisible(int iGuestScreen, bool fVisible)
     2071{
     2072    m_mapGuestScreenIsVisible[iGuestScreen] = fVisible;
     2073    m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
     2074}
     2075
     2076void UIActionPoolRuntime::setGuestSupportsGraphics(bool fSupports)
     2077{
     2078    m_fGuestSupportsGraphics = fSupports;
     2079    m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
     2080}
     2081
     2082void UIActionPoolRuntime::setHostScreenForGuestScreenMap(const QMap<int, int> &map)
     2083{
     2084    m_mapHostScreenForGuestScreen = map;
     2085    m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
    20952086}
    20962087
     
    22392230    const int iHostScreenIndex = pAction->property("Host Screen Index").toInt();
    22402231    emit sigNotifyAboutTriggeringViewScreenRemap(iGuestScreenIndex, iHostScreenIndex);
    2241 }
    2242 
    2243 void UIActionPoolRuntime::sltHandleScreenLayoutUpdate()
    2244 {
    2245     /* Invalidate View menu: */
    2246     m_invalidations << UIActionIndexRT_M_View;
    22472232}
    22482233
     
    26532638    const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
    26542639    const bool fAllowToShowActionMultiscreen = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Multiscreen);
    2655     if (fAllowToShowActionResize && uisession())
    2656     {
    2657         for (int iGuestScreenIndex = 0; iGuestScreenIndex < uisession()->frameBuffers().size(); ++iGuestScreenIndex)
     2640    if (fAllowToShowActionResize)
     2641    {
     2642        for (int iGuestScreenIndex = 0; iGuestScreenIndex < m_cGuestScreens; ++iGuestScreenIndex)
    26582643        {
    26592644            /* Add 'Virtual Screen %1' menu: */
     
    26652650        }
    26662651    }
    2667     else if (fAllowToShowActionMultiscreen && multiScreenLayout())
     2652    else if (fAllowToShowActionMultiscreen)
    26682653    {
    26692654        /* Only for multi-screen host case: */
    2670         if (uisession()->hostScreens().size() > 1)
     2655        if (m_cHostScreens > 1)
    26712656        {
    2672             for (int iGuestScreenIndex = 0; iGuestScreenIndex < uisession()->frameBuffers().size(); ++iGuestScreenIndex)
     2657            for (int iGuestScreenIndex = 0; iGuestScreenIndex < m_cGuestScreens; ++iGuestScreenIndex)
    26732658            {
    26742659                /* Add 'Virtual Screen %1' menu: */
     
    27152700    /* Do we have to show resize menu? */
    27162701    const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize);
    2717     if (fAllowToShowActionResize && uisession())
    2718     {
    2719         for (int iGuestScreenIndex = 0; iGuestScreenIndex < uisession()->frameBuffers().size(); ++iGuestScreenIndex)
     2702    if (fAllowToShowActionResize)
     2703    {
     2704        for (int iGuestScreenIndex = 0; iGuestScreenIndex < m_cGuestScreens; ++iGuestScreenIndex)
    27202705        {
    27212706            /* Add 'Virtual Screen %1' menu: */
     
    28822867void UIActionPoolRuntime::updateMenuViewScreen(QMenu *pMenu)
    28832868{
    2884     /* Make sure UI session defined: */
    2885     AssertPtrReturnVoid(uisession());
    2886 
    28872869    /* Clear contents: */
    28882870    pMenu->clear();
     
    29052887    /* Get corresponding screen index and frame-buffer size: */
    29062888    const int iGuestScreenIndex = pMenu->property("Guest Screen Index").toInt();
    2907     const UIFrameBuffer* pFrameBuffer = uisession()->frameBuffer(iGuestScreenIndex);
    2908     const QSize screenSize = QSize(pFrameBuffer->width(), pFrameBuffer->height());
    2909     const bool fScreenEnabled = uisession()->isScreenVisible(iGuestScreenIndex);
     2889    const QSize screenSize = m_mapGuestScreenSize.value(iGuestScreenIndex);
     2890    const bool fScreenEnabled = m_mapGuestScreenIsVisible.value(iGuestScreenIndex);
    29102891
    29112892    /* For non-primary screens: */
     
    29182899        {
    29192900            /* Configure 'toggle' action: */
    2920             pToggleAction->setEnabled(uisession()->isGuestSupportsGraphics());
     2901            pToggleAction->setEnabled(m_fGuestSupportsGraphics);
    29212902            pToggleAction->setProperty("Guest Screen Index", iGuestScreenIndex);
    29222903            pToggleAction->setCheckable(true);
     
    29422923            {
    29432924                /* Configure exclusive 'resize' action: */
    2944                 pAction->setEnabled(uisession()->isGuestSupportsGraphics() && fScreenEnabled);
     2925                pAction->setEnabled(m_fGuestSupportsGraphics && fScreenEnabled);
    29452926                pAction->setProperty("Guest Screen Index", iGuestScreenIndex);
    29462927                pAction->setProperty("Requested Size", size);
     
    29612942void UIActionPoolRuntime::updateMenuViewMultiscreen(QMenu *pMenu)
    29622943{
    2963     /* Make sure UI session defined: */
    2964     AssertPtrReturnVoid(multiScreenLayout());
    2965 
    29662944    /* Clear contents: */
    29672945    pMenu->clear();
     
    29762954        /* Configure exclusive action-group: */
    29772955        pActionGroup->setExclusive(true);
    2978         for (int iHostScreenIndex = 0; iHostScreenIndex < uisession()->hostScreens().size(); ++iHostScreenIndex)
     2956        for (int iHostScreenIndex = 0; iHostScreenIndex < m_cHostScreens; ++iHostScreenIndex)
    29792957        {
    2980             QAction *pAction = pActionGroup->addAction(UIMultiScreenLayout::tr("Use Host Screen %1")
     2958            QAction *pAction = pActionGroup->addAction(QApplication::translate("UIMultiScreenLayout",
     2959                                                                               "Use Host Screen %1")
    29812960                                                                               .arg(iHostScreenIndex + 1));
    29822961            AssertPtrReturnVoid(pAction);
     
    29852964                pAction->setProperty("Guest Screen Index", iGuestScreenIndex);
    29862965                pAction->setProperty("Host Screen Index", iHostScreenIndex);
    2987                 if (multiScreenLayout()->hasHostScreenForGuestScreen(iGuestScreenIndex) &&
    2988                     multiScreenLayout()->hostScreenForGuestScreen(iGuestScreenIndex) == iHostScreenIndex)
     2966                if (m_mapHostScreenForGuestScreen.contains(iGuestScreenIndex) &&
     2967                    m_mapHostScreenForGuestScreen.value(iGuestScreenIndex) == iHostScreenIndex)
    29892968                    pAction->setChecked(true);
    29902969            }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h

    r71027 r71615  
    2828
    2929/* Forward declarations: */
    30 class UISession;
    31 class UIMultiScreenLayout;
     30class QSize;
     31
    3232
    3333/** Runtime action-pool index enum.
     
    152152public:
    153153
    154     /** Defines UI session object reference.
    155       * @note For menus which uses it to build contents. */
    156     void setSession(UISession *pSession);
    157     /** Returns UI session object reference. */
    158     UISession* uisession() const { return m_pSession; }
    159 
    160     /** Defines UI multi-screen layout object reference.
    161       * @note For menus which uses it to build contents. */
    162     void setMultiScreenLayout(UIMultiScreenLayout *pMultiScreenLayout);
    163     /** Undefines UI multi-screen layout object reference.
    164       * @note For menus which uses it to build contents. */
    165     void unsetMultiScreenLayout(UIMultiScreenLayout *pMultiScreenLayout);
    166     /** Returns UI multi-screen layout object reference. */
    167     UIMultiScreenLayout* multiScreenLayout() const { return m_pMultiScreenLayout; }
     154    /** Defines host-screen @a cCount. */
     155    void setHostScreenCount(int cCount);
     156    /** Defines guest-screen @a cCount. */
     157    void setGuestScreenCount(int cCount);
     158
     159    /** Defines @a iGuestScreen @a size. */
     160    void setGuestScreenSize(int iGuestScreen, const QSize &size);
     161    /** Defines whether @a iGuestScreen is @a fVisible. */
     162    void setGuestScreenVisible(int iGuestScreen, bool fVisible);
     163
     164    /** Defines whether guest supports graphics. */
     165    void setGuestSupportsGraphics(bool fSupports);
     166
     167    /** Defines host-to-guest mapping scheme. */
     168    void setHostScreenForGuestScreenMap(const QMap<int, int> &map);
    168169
    169170    /** Returns whether the action with passed @a type is allowed in the 'Machine' menu. */
     
    213214    /** Handles 'View' : 'Virtual Screen #' menu : 'Remap' @a pAction trigger. */
    214215    void sltHandleActionTriggerViewScreenRemap(QAction *pAction);
    215 
    216     /** Handles screen-layout update. */
    217     void sltHandleScreenLayoutUpdate();
    218216
    219217protected:
     
    288286private:
    289287
    290     /** Holds the UI session object reference. */
    291     UISession *m_pSession;
    292     /** Holds the UI multi-screen layout object reference. */
    293     UIMultiScreenLayout *m_pMultiScreenLayout;
     288    /** Holds the host-screen count. */
     289    int m_cHostScreens;
     290    /** Holds the guest-screen count. */
     291    int m_cGuestScreens;
     292
     293    /** Holds the map of guest-screen sizes. */
     294    QMap<int, QSize> m_mapGuestScreenSize;
     295    /** Holds the map of guest-screen visibility states. */
     296    QMap<int, bool>  m_mapGuestScreenIsVisible;
     297
     298    /** Holds whether guest supports graphics. */
     299    bool m_fGuestSupportsGraphics;
     300
     301    /** Holds the host-to-guest mapping scheme. */
     302    QMap<int, int>  m_mapHostScreenForGuestScreen;
    294303
    295304    /** Holds the list of Runtime UI main menus. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp

    r71074 r71615  
    2525# include <QTransform>
    2626/* GUI includes: */
     27# include "UIActionPool.h"
     28# include "UIActionPoolRuntime.h"
    2729# include "UIFrameBuffer.h"
    2830# include "UISession.h"
     
    12611263
    12621264    unlock();
     1265
     1266    /* Make sure action-pool knows frame-buffer size: */
     1267    m_pMachineView->uisession()->actionPool()->toRuntime()->setGuestScreenSize(m_pMachineView->screenId(),
     1268                                                                               QSize(m_iWidth, m_iHeight));
    12631269}
    12641270
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp

    r69500 r71615  
    5454    calculateHostMonitorCount();
    5555    calculateGuestScreenCount();
     56
     57    /* Prpeare connections: */
     58    prepareConnections();
    5659}
    5760
     
    170173    }
    171174
    172     /* Notifies about layout update: */
    173     emit sigScreenLayoutUpdate();
     175    /* Make sure action-pool knows whether multi-screen layout has host-screen for guest-screen: */
     176    m_pMachineLogic->actionPool()->toRuntime()->setHostScreenForGuestScreenMap(m_screenMap);
    174177
    175178    LogRelFlow(("UIMultiScreenLayout::update: Finished!\n"));
     
    249252    m_screenMap = tmpMap;
    250253
     254    /* Make sure action-pool knows whether multi-screen layout has host-screen for guest-screen: */
     255    m_pMachineLogic->actionPool()->toRuntime()->setHostScreenForGuestScreenMap(m_screenMap);
     256
    251257    /* Save guest-to-host mapping: */
    252258    saveScreenMapping();
     
    271277        else
    272278            m_disabledGuestScreens << iGuestScreen;
     279}
     280
     281void UIMultiScreenLayout::prepareConnections()
     282{
     283    /* Connect action-pool: */
     284    connect(m_pMachineLogic->actionPool()->toRuntime(), &UIActionPoolRuntime::sigNotifyAboutTriggeringViewScreenRemap,
     285            this, &UIMultiScreenLayout::sltHandleScreenLayoutChange);
    273286}
    274287
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h

    r69500 r71615  
    3535signals:
    3636
    37     /** Notifies about layout update. */
    38     void sigScreenLayoutUpdate();
    3937    /** Notifies about layout change. */
    4038    void sigScreenLayoutChange();
     
    6664    void calculateHostMonitorCount();
    6765    void calculateGuestScreenCount();
     66    void prepareConnections();
    6867
    6968    /* Other helpers: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r71374 r71615  
    896896        m_fIsGuestSupportsGraphics = fIsGuestSupportsGraphics;
    897897        m_fIsGuestSupportsSeamless = fIsGuestSupportsSeamless;
     898
     899        /* Make sure action-pool knows whether GA supports graphics: */
     900        actionPool()->toRuntime()->setGuestSupportsGraphics(m_fIsGuestSupportsGraphics);
    898901
    899902        /* Notify listeners about GA state really changed: */
     
    10621065    AssertPtrReturnVoid(actionPool());
    10631066    {
    1064         /* Configure action-pool: */
    1065         actionPool()->toRuntime()->setSession(this);
    1066 
    10671067        /* Update action restrictions: */
    10681068        updateActionRestrictions();
     
    12301230    }
    12311231
    1232     /* Prepare initial screen visibility status of host-desires.
    1233      * This is mostly dummy initialization as host-desires should get updated later in multi-screen layout.
    1234      * By default making host-desires same as facts. */
     1232    /* Prepare initial screen visibility status of host-desires (same as facts): */
    12351233    m_monitorVisibilityVectorHostDesires.resize(machine().GetMonitorCount());
    12361234    for (int iScreenIndex = 0; iScreenIndex < m_monitorVisibilityVector.size(); ++iScreenIndex)
    12371235        m_monitorVisibilityVectorHostDesires[iScreenIndex] = m_monitorVisibilityVector[iScreenIndex];
     1236
     1237    /* Make sure action-pool knows guest-screen visibility status: */
     1238    for (int iScreenIndex = 0; iScreenIndex < m_monitorVisibilityVector.size(); ++iScreenIndex)
     1239        actionPool()->toRuntime()->setGuestScreenVisible(iScreenIndex, m_monitorVisibilityVector.at(iScreenIndex));
    12381240}
    12391241
     
    12421244    /* Each framebuffer will be really prepared on first UIMachineView creation: */
    12431245    m_frameBufferVector.resize(machine().GetMonitorCount());
     1246
     1247    /* Make sure action-pool knows guest-screen count: */
     1248    actionPool()->toRuntime()->setGuestScreenCount(m_frameBufferVector.size());
    12441249}
    12451250
     
    13681373    }
    13691374    m_frameBufferVector.clear();
     1375
     1376    /* Make sure action-pool knows guest-screen count: */
     1377    actionPool()->toRuntime()->setGuestScreenCount(m_frameBufferVector.size());
    13701378}
    13711379
     
    20702078    /* Remember 'desired' visibility status: */
    20712079    gEDataManager->setLastGuestScreenVisibilityStatus(uScreenId, fIsMonitorVisible, vboxGlobal().managedVMUuid());
     2080
     2081    /* Make sure action-pool knows guest-screen visibility status: */
     2082    actionPool()->toRuntime()->setGuestScreenVisible(uScreenId, fIsMonitorVisible);
    20722083}
    20732084
     
    21352146void UISession::updateHostScreenData()
    21362147{
     2148    /* Rebuild host-screen data vector: */
    21372149    m_hostScreens.clear();
    21382150    for (int iScreenIndex = 0; iScreenIndex < gpDesktop->screenCount(); ++iScreenIndex)
    21392151        m_hostScreens << gpDesktop->screenGeometry(iScreenIndex);
     2152
     2153    /* Make sure action-pool knows host-screen count: */
     2154    actionPool()->toRuntime()->setHostScreenCount(m_hostScreens.size());
    21402155}
    21412156
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r69500 r71615  
    5555    /* Create multiscreen layout: */
    5656    m_pScreenLayout = new UIMultiScreenLayout(this);
    57     actionPool()->toRuntime()->setMultiScreenLayout(m_pScreenLayout);
    5857}
    5958
     
    6160{
    6261    /* Delete multiscreen layout: */
    63     actionPool()->toRuntime()->unsetMultiScreenLayout(m_pScreenLayout);
    6462    delete m_pScreenLayout;
    6563}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r69500 r71615  
    5252    /* Create multiscreen layout: */
    5353    m_pScreenLayout = new UIMultiScreenLayout(this);
    54     actionPool()->toRuntime()->setMultiScreenLayout(m_pScreenLayout);
    5554}
    5655
     
    5857{
    5958    /* Delete multiscreen layout: */
    60     actionPool()->toRuntime()->unsetMultiScreenLayout(m_pScreenLayout);
    6159    delete m_pScreenLayout;
    6260}
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