- Timestamp:
- Apr 2, 2018 1:18:40 PM (7 years ago)
- 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 23 23 # include "UIActionPoolRuntime.h" 24 24 # include "UIDesktopWidgetWatchdog.h" 25 # include "UIMultiScreenLayout.h"26 25 # include "UIExtraDataManager.h" 27 26 # include "UIShortcutPool.h" 28 # include "UIFrameBuffer.h"29 27 # include "UIConverter.h" 30 28 # include "UIIconPool.h" 31 # include "UISession.h"32 29 # include "VBoxGlobal.h" 33 30 … … 2047 2044 UIActionPoolRuntime::UIActionPoolRuntime(bool fTemporary /* = false */) 2048 2045 : 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 2052 void UIActionPoolRuntime::setHostScreenCount(int cCount) 2053 { 2054 m_cHostScreens = cCount; 2057 2055 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup; 2058 2056 } 2059 2057 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; 2058 void UIActionPoolRuntime::setGuestScreenCount(int cCount) 2059 { 2060 m_cGuestScreens = cCount; 2061 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup; 2062 } 2063 2064 void UIActionPoolRuntime::setGuestScreenSize(int iGuestScreen, const QSize &size) 2065 { 2066 m_mapGuestScreenSize[iGuestScreen] = size; 2067 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup; 2068 } 2069 2070 void UIActionPoolRuntime::setGuestScreenVisible(int iGuestScreen, bool fVisible) 2071 { 2072 m_mapGuestScreenIsVisible[iGuestScreen] = fVisible; 2073 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup; 2074 } 2075 2076 void UIActionPoolRuntime::setGuestSupportsGraphics(bool fSupports) 2077 { 2078 m_fGuestSupportsGraphics = fSupports; 2079 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup; 2080 } 2081 2082 void UIActionPoolRuntime::setHostScreenForGuestScreenMap(const QMap<int, int> &map) 2083 { 2084 m_mapHostScreenForGuestScreen = map; 2085 m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup; 2095 2086 } 2096 2087 … … 2239 2230 const int iHostScreenIndex = pAction->property("Host Screen Index").toInt(); 2240 2231 emit sigNotifyAboutTriggeringViewScreenRemap(iGuestScreenIndex, iHostScreenIndex); 2241 }2242 2243 void UIActionPoolRuntime::sltHandleScreenLayoutUpdate()2244 {2245 /* Invalidate View menu: */2246 m_invalidations << UIActionIndexRT_M_View;2247 2232 } 2248 2233 … … 2653 2638 const bool fAllowToShowActionResize = isAllowedInMenuView(UIExtraDataMetaDefs::RuntimeMenuViewActionType_Resize); 2654 2639 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) 2658 2643 { 2659 2644 /* Add 'Virtual Screen %1' menu: */ … … 2665 2650 } 2666 2651 } 2667 else if (fAllowToShowActionMultiscreen && multiScreenLayout())2652 else if (fAllowToShowActionMultiscreen) 2668 2653 { 2669 2654 /* Only for multi-screen host case: */ 2670 if ( uisession()->hostScreens().size()> 1)2655 if (m_cHostScreens > 1) 2671 2656 { 2672 for (int iGuestScreenIndex = 0; iGuestScreenIndex < uisession()->frameBuffers().size(); ++iGuestScreenIndex)2657 for (int iGuestScreenIndex = 0; iGuestScreenIndex < m_cGuestScreens; ++iGuestScreenIndex) 2673 2658 { 2674 2659 /* Add 'Virtual Screen %1' menu: */ … … 2715 2700 /* Do we have to show resize menu? */ 2716 2701 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) 2720 2705 { 2721 2706 /* Add 'Virtual Screen %1' menu: */ … … 2882 2867 void UIActionPoolRuntime::updateMenuViewScreen(QMenu *pMenu) 2883 2868 { 2884 /* Make sure UI session defined: */2885 AssertPtrReturnVoid(uisession());2886 2887 2869 /* Clear contents: */ 2888 2870 pMenu->clear(); … … 2905 2887 /* Get corresponding screen index and frame-buffer size: */ 2906 2888 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); 2910 2891 2911 2892 /* For non-primary screens: */ … … 2918 2899 { 2919 2900 /* Configure 'toggle' action: */ 2920 pToggleAction->setEnabled( uisession()->isGuestSupportsGraphics());2901 pToggleAction->setEnabled(m_fGuestSupportsGraphics); 2921 2902 pToggleAction->setProperty("Guest Screen Index", iGuestScreenIndex); 2922 2903 pToggleAction->setCheckable(true); … … 2942 2923 { 2943 2924 /* Configure exclusive 'resize' action: */ 2944 pAction->setEnabled( uisession()->isGuestSupportsGraphics()&& fScreenEnabled);2925 pAction->setEnabled(m_fGuestSupportsGraphics && fScreenEnabled); 2945 2926 pAction->setProperty("Guest Screen Index", iGuestScreenIndex); 2946 2927 pAction->setProperty("Requested Size", size); … … 2961 2942 void UIActionPoolRuntime::updateMenuViewMultiscreen(QMenu *pMenu) 2962 2943 { 2963 /* Make sure UI session defined: */2964 AssertPtrReturnVoid(multiScreenLayout());2965 2966 2944 /* Clear contents: */ 2967 2945 pMenu->clear(); … … 2976 2954 /* Configure exclusive action-group: */ 2977 2955 pActionGroup->setExclusive(true); 2978 for (int iHostScreenIndex = 0; iHostScreenIndex < uisession()->hostScreens().size(); ++iHostScreenIndex)2956 for (int iHostScreenIndex = 0; iHostScreenIndex < m_cHostScreens; ++iHostScreenIndex) 2979 2957 { 2980 QAction *pAction = pActionGroup->addAction(UIMultiScreenLayout::tr("Use Host Screen %1") 2958 QAction *pAction = pActionGroup->addAction(QApplication::translate("UIMultiScreenLayout", 2959 "Use Host Screen %1") 2981 2960 .arg(iHostScreenIndex + 1)); 2982 2961 AssertPtrReturnVoid(pAction); … … 2985 2964 pAction->setProperty("Guest Screen Index", iGuestScreenIndex); 2986 2965 pAction->setProperty("Host Screen Index", iHostScreenIndex); 2987 if (m ultiScreenLayout()->hasHostScreenForGuestScreen(iGuestScreenIndex) &&2988 m ultiScreenLayout()->hostScreenForGuestScreen(iGuestScreenIndex) == iHostScreenIndex)2966 if (m_mapHostScreenForGuestScreen.contains(iGuestScreenIndex) && 2967 m_mapHostScreenForGuestScreen.value(iGuestScreenIndex) == iHostScreenIndex) 2989 2968 pAction->setChecked(true); 2990 2969 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h
r71027 r71615 28 28 29 29 /* Forward declarations: */ 30 class UISession;31 class UIMultiScreenLayout; 30 class QSize; 31 32 32 33 33 /** Runtime action-pool index enum. … … 152 152 public: 153 153 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); 168 169 169 170 /** Returns whether the action with passed @a type is allowed in the 'Machine' menu. */ … … 213 214 /** Handles 'View' : 'Virtual Screen #' menu : 'Remap' @a pAction trigger. */ 214 215 void sltHandleActionTriggerViewScreenRemap(QAction *pAction); 215 216 /** Handles screen-layout update. */217 void sltHandleScreenLayoutUpdate();218 216 219 217 protected: … … 288 286 private: 289 287 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; 294 303 295 304 /** Holds the list of Runtime UI main menus. */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r71074 r71615 25 25 # include <QTransform> 26 26 /* GUI includes: */ 27 # include "UIActionPool.h" 28 # include "UIActionPoolRuntime.h" 27 29 # include "UIFrameBuffer.h" 28 30 # include "UISession.h" … … 1261 1263 1262 1264 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)); 1263 1269 } 1264 1270 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.cpp
r69500 r71615 54 54 calculateHostMonitorCount(); 55 55 calculateGuestScreenCount(); 56 57 /* Prpeare connections: */ 58 prepareConnections(); 56 59 } 57 60 … … 170 173 } 171 174 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); 174 177 175 178 LogRelFlow(("UIMultiScreenLayout::update: Finished!\n")); … … 249 252 m_screenMap = tmpMap; 250 253 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 251 257 /* Save guest-to-host mapping: */ 252 258 saveScreenMapping(); … … 271 277 else 272 278 m_disabledGuestScreens << iGuestScreen; 279 } 280 281 void UIMultiScreenLayout::prepareConnections() 282 { 283 /* Connect action-pool: */ 284 connect(m_pMachineLogic->actionPool()->toRuntime(), &UIActionPoolRuntime::sigNotifyAboutTriggeringViewScreenRemap, 285 this, &UIMultiScreenLayout::sltHandleScreenLayoutChange); 273 286 } 274 287 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMultiScreenLayout.h
r69500 r71615 35 35 signals: 36 36 37 /** Notifies about layout update. */38 void sigScreenLayoutUpdate();39 37 /** Notifies about layout change. */ 40 38 void sigScreenLayoutChange(); … … 66 64 void calculateHostMonitorCount(); 67 65 void calculateGuestScreenCount(); 66 void prepareConnections(); 68 67 69 68 /* Other helpers: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r71374 r71615 896 896 m_fIsGuestSupportsGraphics = fIsGuestSupportsGraphics; 897 897 m_fIsGuestSupportsSeamless = fIsGuestSupportsSeamless; 898 899 /* Make sure action-pool knows whether GA supports graphics: */ 900 actionPool()->toRuntime()->setGuestSupportsGraphics(m_fIsGuestSupportsGraphics); 898 901 899 902 /* Notify listeners about GA state really changed: */ … … 1062 1065 AssertPtrReturnVoid(actionPool()); 1063 1066 { 1064 /* Configure action-pool: */1065 actionPool()->toRuntime()->setSession(this);1066 1067 1067 /* Update action restrictions: */ 1068 1068 updateActionRestrictions(); … … 1230 1230 } 1231 1231 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): */ 1235 1233 m_monitorVisibilityVectorHostDesires.resize(machine().GetMonitorCount()); 1236 1234 for (int iScreenIndex = 0; iScreenIndex < m_monitorVisibilityVector.size(); ++iScreenIndex) 1237 1235 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)); 1238 1240 } 1239 1241 … … 1242 1244 /* Each framebuffer will be really prepared on first UIMachineView creation: */ 1243 1245 m_frameBufferVector.resize(machine().GetMonitorCount()); 1246 1247 /* Make sure action-pool knows guest-screen count: */ 1248 actionPool()->toRuntime()->setGuestScreenCount(m_frameBufferVector.size()); 1244 1249 } 1245 1250 … … 1368 1373 } 1369 1374 m_frameBufferVector.clear(); 1375 1376 /* Make sure action-pool knows guest-screen count: */ 1377 actionPool()->toRuntime()->setGuestScreenCount(m_frameBufferVector.size()); 1370 1378 } 1371 1379 … … 2070 2078 /* Remember 'desired' visibility status: */ 2071 2079 gEDataManager->setLastGuestScreenVisibilityStatus(uScreenId, fIsMonitorVisible, vboxGlobal().managedVMUuid()); 2080 2081 /* Make sure action-pool knows guest-screen visibility status: */ 2082 actionPool()->toRuntime()->setGuestScreenVisible(uScreenId, fIsMonitorVisible); 2072 2083 } 2073 2084 … … 2135 2146 void UISession::updateHostScreenData() 2136 2147 { 2148 /* Rebuild host-screen data vector: */ 2137 2149 m_hostScreens.clear(); 2138 2150 for (int iScreenIndex = 0; iScreenIndex < gpDesktop->screenCount(); ++iScreenIndex) 2139 2151 m_hostScreens << gpDesktop->screenGeometry(iScreenIndex); 2152 2153 /* Make sure action-pool knows host-screen count: */ 2154 actionPool()->toRuntime()->setHostScreenCount(m_hostScreens.size()); 2140 2155 } 2141 2156 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r69500 r71615 55 55 /* Create multiscreen layout: */ 56 56 m_pScreenLayout = new UIMultiScreenLayout(this); 57 actionPool()->toRuntime()->setMultiScreenLayout(m_pScreenLayout);58 57 } 59 58 … … 61 60 { 62 61 /* Delete multiscreen layout: */ 63 actionPool()->toRuntime()->unsetMultiScreenLayout(m_pScreenLayout);64 62 delete m_pScreenLayout; 65 63 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
r69500 r71615 52 52 /* Create multiscreen layout: */ 53 53 m_pScreenLayout = new UIMultiScreenLayout(this); 54 actionPool()->toRuntime()->setMultiScreenLayout(m_pScreenLayout);55 54 } 56 55 … … 58 57 { 59 58 /* Delete multiscreen layout: */ 60 actionPool()->toRuntime()->unsetMultiScreenLayout(m_pScreenLayout);61 59 delete m_pScreenLayout; 62 60 }
Note:
See TracChangeset
for help on using the changeset viewer.