Changeset 27335 in vbox
- Timestamp:
- Mar 12, 2010 4:20:29 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 added
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r27215 r27335 377 377 src/runtime/UIMachineLogic.h \ 378 378 src/runtime/UIMachineView.h \ 379 src/runtime/UIMultiScreenLayout.h \ 379 380 src/runtime/normal/UIMachineLogicNormal.h \ 380 381 src/runtime/normal/UIMachineWindowNormal.h \ … … 503 504 src/runtime/UIIndicatorsPool.cpp \ 504 505 src/runtime/UIFrameBuffer.cpp \ 505 src/runtime/UIFrameBufferDirectDraw.cpp \506 506 src/runtime/UIFrameBufferQGL.cpp \ 507 507 src/runtime/UIFrameBufferQImage.cpp \ 508 src/runtime/UIFrameBufferQuartz2D.cpp \509 508 src/runtime/UIFrameBufferSDL.cpp \ 510 509 src/runtime/UIMachine.cpp \ … … 513 512 src/runtime/UIMachineView.cpp \ 514 513 src/runtime/UIMachineMenuBar.cpp \ 514 src/runtime/UIMultiScreenLayout.cpp \ 515 515 src/runtime/normal/UIMachineLogicNormal.cpp \ 516 516 src/runtime/normal/UIMachineWindowNormal.cpp \ … … 522 522 src/runtime/seamless/UIMachineWindowSeamless.cpp \ 523 523 src/runtime/seamless/UIMachineViewSeamless.cpp 524 VirtualBox_SOURCES.win += \ 525 src/runtime/UIFrameBufferDirectDraw.cpp 524 526 VirtualBox_SOURCES.darwin += \ 527 src/runtime/UIFrameBufferQuartz2D.cpp \ 525 528 src/darwin/UIAbstractDockIconPreview.cpp \ 526 529 src/darwin/UICocoaDockIconPreview.mm -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.cpp
r27296 r27335 31 31 const char* VBoxDefs::GUI_Fullscreen = "GUI/Fullscreen"; 32 32 const char* VBoxDefs::GUI_Seamless = "GUI/Seamless"; 33 const char* VBoxDefs::GUI_VirtualScreenToHostScreen = "GUI/VirtualScreenToHostScreen"; 33 34 const char* VBoxDefs::GUI_AutoresizeGuest = "GUI/AutoresizeGuest"; 34 35 const char* VBoxDefs::GUI_FirstRun = "GUI/FirstRun"; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxDefs.h
r27296 r27335 149 149 static const char* GUI_Fullscreen; 150 150 static const char* GUI_Seamless; 151 static const char* GUI_VirtualScreenToHostScreen; 151 152 static const char* GUI_AutoresizeGuest; 152 153 static const char* GUI_FirstRun; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.cpp
r27143 r27335 508 508 setText(VBoxGlobal::insertKeyToActionText(UIActionsPool::tr("&Close..." ), "Q")); 509 509 setStatusTip(UIActionsPool::tr("Close the virtual machine")); 510 } 511 }; 512 513 class MenuViewAction : public UIMenuAction 514 { 515 Q_OBJECT; 516 517 public: 518 519 MenuViewAction(QObject *pParent) 520 : UIMenuAction(pParent) 521 { 522 retranslateUi(); 523 } 524 525 protected: 526 527 void retranslateUi() 528 { 529 menu()->setTitle(UIActionsPool::tr("&View")); 510 530 } 511 531 }; … … 1120 1140 delete m_actionsPool[UIActionIndex_Menu_Machine]; 1121 1141 m_actionsPool[UIActionIndex_Menu_Machine] = new MenuMachineAction(this); 1142 if (m_actionsPool[UIActionIndex_Menu_View]) 1143 delete m_actionsPool[UIActionIndex_Menu_View]; 1144 m_actionsPool[UIActionIndex_Menu_View] = new MenuViewAction(this); 1122 1145 if (m_actionsPool[UIActionIndex_Menu_MouseIntegration]) 1123 1146 delete m_actionsPool[UIActionIndex_Menu_MouseIntegration]; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionsPool.h
r27132 r27335 77 77 UIActionIndex_Simple_Close, 78 78 79 /* "View" menu actions: */ 80 UIActionIndex_Menu_View, 81 79 82 /* "Devices" menu actions: */ 80 83 UIActionIndex_Menu_Devices, -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineDefs.h
r26751 r27335 68 68 }; 69 69 70 /* Main menu enum: */ 71 enum UIMainMenuType 72 { 73 UIMainMenuType_Machine = RT_BIT(0), 74 UIMainMenuType_Devices = RT_BIT(1), 75 UIMainMenuType_View = RT_BIT(2), 76 UIMainMenuType_Debug = RT_BIT(3), 77 UIMainMenuType_Help = RT_BIT(4), 78 UIMainMenuType_All = 0xFF 79 }; 80 70 81 #endif // __UIMachineDefs_h__ 71 82 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r27311 r27335 67 67 /* Main getters/setters: */ 68 68 UISession* uisession() const { return m_pSession; } 69 CSession& session(); 69 70 UIActionsPool* actionsPool() const { return m_pActionsPool; } 70 71 UIVisualStateType visualStateType() const { return m_visualStateType; } … … 93 94 bool isMachineWindowsCreated() const { return m_fIsWindowsCreated; } 94 95 void setMachineWindowsCreated(bool fIsWindowsCreated) { m_fIsWindowsCreated = fIsWindowsCreated; } 95 96 /* Protected wrappers: */97 CSession& session();98 96 99 97 /* Protected members: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
r27141 r27335 39 39 } 40 40 41 QMenu* UIMachineMenuBar::createMenu(UIActionsPool *pActionsPool )41 QMenu* UIMachineMenuBar::createMenu(UIActionsPool *pActionsPool, UIMainMenuType fOptions /* = UIMainMenuType_All */) 42 42 { 43 43 /* Create empty menu: */ … … 45 45 46 46 /* Fill menu with prepared items: */ 47 foreach (QMenu *pSubMenu, prepareSubMenus(pActionsPool ))47 foreach (QMenu *pSubMenu, prepareSubMenus(pActionsPool, fOptions)) 48 48 pMenu->addMenu(pSubMenu); 49 49 … … 52 52 } 53 53 54 QMenuBar* UIMachineMenuBar::createMenuBar(UIActionsPool *pActionsPool )54 QMenuBar* UIMachineMenuBar::createMenuBar(UIActionsPool *pActionsPool, UIMainMenuType fOptions /* = UIMainMenuType_All */) 55 55 { 56 56 /* Create empty menubar: */ … … 58 58 59 59 /* Fill menubar with prepared items: */ 60 foreach (QMenu *pSubMenu, prepareSubMenus(pActionsPool ))60 foreach (QMenu *pSubMenu, prepareSubMenus(pActionsPool, fOptions)) 61 61 pMenuBar->addMenu(pSubMenu); 62 62 … … 65 65 } 66 66 67 QList<QMenu*> UIMachineMenuBar::prepareSubMenus(UIActionsPool *pActionsPool )67 QList<QMenu*> UIMachineMenuBar::prepareSubMenus(UIActionsPool *pActionsPool, UIMainMenuType fOptions /* = UIMainMenuType_All */) 68 68 { 69 69 /* Create empty submenu list: */ … … 71 71 72 72 /* Machine submenu: */ 73 QMenu *pMenuMachine = pActionsPool->action(UIActionIndex_Menu_Machine)->menu(); 74 prepareMenuMachine(pMenuMachine, pActionsPool); 75 preparedSubMenus << pMenuMachine; 73 if (fOptions & UIMainMenuType_Machine) 74 { 75 QMenu *pMenuMachine = pActionsPool->action(UIActionIndex_Menu_Machine)->menu(); 76 prepareMenuMachine(pMenuMachine, pActionsPool); 77 preparedSubMenus << pMenuMachine; 78 } 79 80 /* View submenu: */ 81 if (fOptions & UIMainMenuType_View) 82 { 83 QMenu *pMenuView = pActionsPool->action(UIActionIndex_Menu_View)->menu(); 84 preparedSubMenus << pMenuView; 85 } 76 86 77 87 /* Devices submenu: */ 78 QMenu *pMenuDevices = pActionsPool->action(UIActionIndex_Menu_Devices)->menu(); 79 prepareMenuDevices(pMenuDevices, pActionsPool); 80 preparedSubMenus << pMenuDevices; 88 if (fOptions & UIMainMenuType_Devices) 89 { 90 QMenu *pMenuDevices = pActionsPool->action(UIActionIndex_Menu_Devices)->menu(); 91 prepareMenuDevices(pMenuDevices, pActionsPool); 92 preparedSubMenus << pMenuDevices; 93 } 81 94 82 95 #ifdef VBOX_WITH_DEBUGGER_GUI 83 96 /* Debug submenu: */ 84 if (vboxGlobal().isDebuggerEnabled()) 97 if ( fOptions & UIMainMenuType_Debug 98 && vboxGlobal().isDebuggerEnabled()) 85 99 { 86 100 QMenu *pMenuDebug = pActionsPool->action(UIActionIndex_Menu_Debug)->menu(); … … 91 105 92 106 /* Help submenu: */ 93 QMenu *pMenuHelp = pActionsPool->action(UIActionIndex_Menu_Help)->menu(); 94 prepareMenuHelp(pMenuHelp, pActionsPool); 95 preparedSubMenus << pMenuHelp; 107 if (fOptions & UIMainMenuType_Help) 108 { 109 QMenu *pMenuHelp = pActionsPool->action(UIActionIndex_Menu_Help)->menu(); 110 prepareMenuHelp(pMenuHelp, pActionsPool); 111 preparedSubMenus << pMenuHelp; 112 } 96 113 97 114 /* Return a list of prepared submenus: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.h
r27141 r27335 24 24 #define __UIMachineMenuBar_h__ 25 25 26 /* Local includes */ 27 #include "UIMachineDefs.h" 28 26 29 /* Global includes */ 27 30 #include <QList> … … 37 40 { 38 41 public: 39 40 42 UIMachineMenuBar(); 41 43 42 QMenu* createMenu(UIActionsPool *pActionsPool );43 QMenuBar* createMenuBar(UIActionsPool *pActionsPool );44 QMenu* createMenu(UIActionsPool *pActionsPool, UIMainMenuType fOptions = UIMainMenuType_All); 45 QMenuBar* createMenuBar(UIActionsPool *pActionsPool, UIMainMenuType fOptions = UIMainMenuType_All); 44 46 45 47 protected: 46 48 47 QList<QMenu*> prepareSubMenus(UIActionsPool *pActionsPool );49 QList<QMenu*> prepareSubMenus(UIActionsPool *pActionsPool, UIMainMenuType fOptions = UIMainMenuType_All); 48 50 void prepareMenuMachine(QMenu *pMenu, UIActionsPool *pActionsPool); 49 51 void prepareMenuDevices(QMenu *pMenu, UIActionsPool *pActionsPool); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r27296 r27335 443 443 } 444 444 #endif 445 446 void UIMachineView::updateSliders() 447 { 448 QSize p = viewport()->size(); 449 QSize m = maximumViewportSize(); 450 451 QSize v = QSize(frameBuffer()->width(), frameBuffer()->height()); 452 /* No scroll bars needed: */ 453 if (m.expandedTo(v) == m) 454 p = m; 455 456 horizontalScrollBar()->setRange(0, v.width() - p.width()); 457 verticalScrollBar()->setRange(0, v.height() - p.height()); 458 horizontalScrollBar()->setPageStep(p.width()); 459 verticalScrollBar()->setPageStep(p.height()); 460 } 445 461 446 462 void UIMachineView::prepareFrameBuffer() -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r27333 r27335 131 131 virtual void calculateDesktopGeometry() = 0; 132 132 virtual void maybeRestrictMinimumSize() = 0; 133 virtual void updateSliders() = 0;133 virtual void updateSliders(); 134 134 135 135 #ifdef Q_WS_MAC … … 328 328 }; 329 329 330 #endif // !___UIMachineView Normal_h___331 330 #endif // !___UIMachineView_h___ 331 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
r27044 r27335 57 57 CSession& session() const; 58 58 59 virtual void reshow() {} 60 59 61 protected: 60 62 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r27310 r27335 680 680 } 681 681 682 QMenu* UISession::newMenu( )682 QMenu* UISession::newMenu(UIMainMenuType fOptions /* = UIMainMenuType_ALL */) 683 683 { 684 684 /* Create new menu: */ 685 QMenu *pMenu = m_pMenuPool->createMenu(actionsPool() );685 QMenu *pMenu = m_pMenuPool->createMenu(actionsPool(), fOptions); 686 686 687 687 /* Re-init menu pool for the case menu were recreated: */ … … 692 692 } 693 693 694 QMenuBar* UISession::newMenuBar( )694 QMenuBar* UISession::newMenuBar(UIMainMenuType fOptions /* = UIMainMenuType_ALL */) 695 695 { 696 696 /* Create new menubar: */ 697 QMenuBar *pMenuBar = m_pMenuPool->createMenuBar(actionsPool() );697 QMenuBar *pMenuBar = m_pMenuPool->createMenuBar(actionsPool(), fOptions); 698 698 699 699 /* Re-init menu pool for the case menu were recreated: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r27310 r27335 30 30 /* Local includes */ 31 31 #include "COMDefs.h" 32 #include "UIMachineDefs.h" 32 33 33 34 /* Global forwards */ … … 84 85 UIActionsPool* actionsPool() const; 85 86 QWidget* mainMachineWindow() const; 86 QMenu* newMenu( );87 QMenuBar* newMenuBar( );87 QMenu* newMenu(UIMainMenuType fOptions = UIMainMenuType_All); 88 QMenuBar* newMenuBar(UIMainMenuType fOptions = UIMainMenuType_All); 88 89 QCursor cursor() const { return m_cursor; } 89 90 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r27311 r27335 30 30 #include "VBoxProblemReporter.h" 31 31 32 #include "UISession.h"33 32 #include "UIActionsPool.h" 34 33 #include "UIMachineLogicFullscreen.h" 35 34 #include "UIMachineWindow.h" 36 37 #include "VBoxUtils.h" 38 39 #ifdef Q_WS_MAC 40 # ifdef QT_MAC_USE_COCOA 41 # include <Carbon/Carbon.h> 42 # endif /* QT_MAC_USE_COCOA */ 35 #include "UIMachineWindowFullscreen.h" 36 #include "UIMultiScreenLayout.h" 37 #include "UISession.h" 38 39 40 #ifdef Q_WS_MAC 41 # include "VBoxUtils.h" 42 # include <Carbon/Carbon.h> 43 43 #endif /* Q_WS_MAC */ 44 44 … … 46 46 : UIMachineLogic(pParent, pSession, pActionsPool, UIVisualStateType_Fullscreen) 47 47 { 48 m_pScreenLayout = new UIMultiScreenLayout(this); 48 49 } 49 50 … … 55 56 /* Cleanup action related stuff */ 56 57 cleanupActionGroups(); 58 59 delete m_pScreenLayout; 57 60 } 58 61 … … 67 70 const CConsole &console = uisession()->session().GetConsole(); 68 71 69 #if (QT_VERSION >= 0x040600) 70 int cHostScreens = QApplication::desktop()->screenCount(); 71 #else /* (QT_VERSION >= 0x040600) */ 72 int cHostScreens = QApplication::desktop()->numScreens(); 73 #endif /* !(QT_VERSION >= 0x040600) */ 74 75 int cGuestScreens = machine.GetMonitorCount(); 72 int cHostScreens = m_pScreenLayout->hostScreenCount(); 73 int cGuestScreens = m_pScreenLayout->guestScreenCount(); 76 74 /* Check that there are enough physical screens are connected: */ 77 75 if (cHostScreens < cGuestScreens) … … 167 165 } 168 166 167 int UIMachineLogicFullscreen::hostScreenForGuestScreen(int screenId) const 168 { 169 return m_pScreenLayout->hostScreenForGuestScreen(screenId); 170 } 171 169 172 #ifdef Q_WS_MAC 170 173 void UIMachineLogicFullscreen::prepareCommonConnections() … … 183 186 /* Adjust-window action isn't allowed in fullscreen: */ 184 187 actionsPool()->action(UIActionIndex_Simple_AdjustWindow)->setVisible(false); 188 189 /* Add the view menu: */ 190 QMenu *pMenu = actionsPool()->action(UIActionIndex_Menu_View)->menu(); 191 m_pScreenLayout->initialize(pMenu); 185 192 } 186 193 … … 198 205 #endif /* Q_WS_MAC */ 199 206 200 #if 0 // TODO: Add seamless multi-monitor support! 201 /* Get monitors count: */202 ulong uMonitorCount = session().GetMachine().GetMonitorCount(); 207 /* Update the multi screen layout */ 208 m_pScreenLayout->update(); 209 203 210 /* Create machine window(s): */ 204 for ( ulong uScreenId = 0; uScreenId < uMonitorCount; ++ uScreenId)205 addMachineWindow(UIMachineWindow::create(this, visualStateType(), uScreenId));211 for (int screenId = 0; screenId < m_pScreenLayout->guestScreenCount(); ++screenId) 212 addMachineWindow(UIMachineWindow::create(this, visualStateType(), screenId)); 206 213 /* Order machine window(s): */ 207 for ( ulong uScreenId = uMonitorCount; uScreenId > 0; -- uScreenId)208 machineWindows() [uScreenId - 1]->machineWindow()->raise();209 #else 210 /* Create primary machine window: */211 addMachineWindow(UIMachineWindow::create(this, visualStateType(), 0 /* primary only */));212 #endif 214 for (int screenId = m_pScreenLayout->guestScreenCount() - 1; screenId >= 0; --screenId) 215 machineWindows().at(screenId)->machineWindow()->raise(); 216 217 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 218 connect(m_pScreenLayout, SIGNAL(screenLayoutChanged()), 219 static_cast<UIMachineWindowFullscreen*>(pMachineWindow), SLOT(sltPlaceOnScreen())); 213 220 214 221 /* Remember what machine window(s) created: */ … … 222 229 return; 223 230 224 #if 0 // TODO: Add seamless multi-monitor support!225 231 /* Cleanup normal machine window: */ 226 232 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 227 233 UIMachineWindow::destroy(pMachineWindow); 228 #else229 /* Create machine window(s): */230 UIMachineWindow::destroy(machineWindows()[0] /* primary only */);231 #endif232 234 233 235 #ifdef Q_WS_MAC … … 272 274 } 273 275 #endif /* Q_WS_MAC */ 276 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
r27310 r27335 29 29 /* Local forwards */ 30 30 class UIActionsPool; 31 class UIMultiScreenLayout; 31 32 class VBoxChangePresentationModeEvent; 32 33 … … 45 46 bool checkAvailability(); 46 47 void initialize(); 48 49 int hostScreenForGuestScreen(int screenId) const; 47 50 48 51 private slots: … … 72 75 #endif /* Q_WS_MAC */ 73 76 77 UIMultiScreenLayout *m_pScreenLayout; 78 74 79 /* Friend classes: */ 75 80 friend class UIMachineLogic; 81 friend class UIMachineWindowFullscreen; 76 82 }; 77 83 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h
r27237 r27335 81 81 void calculateDesktopGeometry(); 82 82 void maybeRestrictMinimumSize(); 83 void updateSliders() {}84 83 85 84 /* Private members: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r27332 r27335 32 32 #include "VBoxMiniToolBar.h" 33 33 34 #include "UISession.h"35 34 #include "UIActionsPool.h" 36 35 #include "UIMachineLogic.h" 36 #include "UIMachineLogicFullscreen.h" 37 37 #include "UIMachineView.h" 38 38 #include "UIMachineWindowFullscreen.h" 39 #include "UISession.h" 39 40 40 41 UIMachineWindowFullscreen::UIMachineWindowFullscreen(UIMachineLogic *pMachineLogic, ulong uScreenId) … … 75 76 updateAppearanceOf(UIVisualElement_AllStuff); 76 77 78 /* Make sure the window is placed on the right screen before we are going 79 * into fullscreen. */ 80 sltPlaceOnScreen(); 81 77 82 /* Show window: */ 78 83 showFullScreen(); … … 80 85 #ifdef Q_WS_MAC 81 86 /* Make sure it is really on the right place (especially on the Mac) */ 82 move(0, 0); 87 QRect r = QApplication::desktop()->screenGeometry(static_cast<UIMachineLogicFullscreen*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId)); 88 move(r.topLeft()); 83 89 #endif /* Q_WS_MAC */ 84 90 } … … 95 101 cleanupMenu(); 96 102 } 103 104 void UIMachineWindowFullscreen::sltPlaceOnScreen() 105 { 106 QRect r = QApplication::desktop()->screenGeometry(static_cast<UIMachineLogicFullscreen*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId)); 107 move(r.topLeft()); 108 resize(r.size()); 109 } 110 97 111 98 112 void UIMachineWindowFullscreen::sltMachineStateChanged() … … 155 169 void UIMachineWindowFullscreen::prepareMenu() 156 170 { 157 #ifdef Q_WS_MAC 158 setMenuBar(uisession()->newMenuBar()); 159 #endif /* Q_WS_MAC */ 160 m_pMainMenu = uisession()->newMenu(); 171 UIMainMenuType fMenus = UIMainMenuType_All; 172 /* Remove the view menu in the case there is one screen only. */ 173 if (session().GetMachine().GetMonitorCount() == 1) 174 fMenus = UIMainMenuType(fMenus ^ UIMainMenuType_View); 175 #ifdef Q_WS_MAC 176 setMenuBar(uisession()->newMenuBar(fMenus)); 177 #endif /* Q_WS_MAC */ 178 m_pMainMenu = uisession()->newMenu(fMenus); 161 179 } 162 180 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
r27332 r27335 38 38 { 39 39 Q_OBJECT; 40 41 public slots: 42 43 void sltPlaceOnScreen(); 40 44 41 45 protected: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h
r27310 r27335 46 46 private slots: 47 47 48 /* Windowed mode fun tionality: */48 /* Windowed mode functionality: */ 49 49 void sltPrepareNetworkAdaptersMenu(); 50 50 void sltPrepareSharedFoldersMenu(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp
r27296 r27335 358 358 } 359 359 360 void UIMachineViewNormal::updateSliders()361 {362 QSize p = viewport()->size();363 QSize m = maximumViewportSize();364 365 QSize v = QSize(frameBuffer()->width(), frameBuffer()->height());366 /* No scroll bars needed: */367 if (m.expandedTo(v) == m)368 p = m;369 370 horizontalScrollBar()->setRange(0, v.width() - p.width());371 verticalScrollBar()->setRange(0, v.height() - p.height());372 horizontalScrollBar()->setPageStep(p.width());373 verticalScrollBar()->setPageStep(p.height());374 }375 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h
r27237 r27335 79 79 void calculateDesktopGeometry(); 80 80 void maybeRestrictMinimumSize(); 81 void updateSliders();82 81 83 82 /* Private members: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r27174 r27335 349 349 void UIMachineWindowNormal::prepareMenu() 350 350 { 351 setMenuBar(uisession()->newMenuBar()); 351 /* No view menu in normal mode */ 352 setMenuBar(uisession()->newMenuBar(UIMainMenuType(UIMainMenuType_All ^ UIMainMenuType_View))); 352 353 } 353 354 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
r27311 r27335 30 30 #include "VBoxProblemReporter.h" 31 31 32 #include "UISession.h"33 32 #include "UIActionsPool.h" 34 33 #include "UIMachineLogicSeamless.h" 35 34 #include "UIMachineWindow.h" 36 37 #include "VBoxUtils.h" 35 #include "UIMachineWindowSeamless.h" 36 #include "UIMultiScreenLayout.h" 37 #include "UISession.h" 38 39 #ifdef Q_WS_MAC 40 # include "VBoxUtils.h" 41 #endif /* Q_WS_MAC */ 38 42 39 43 UIMachineLogicSeamless::UIMachineLogicSeamless(QObject *pParent, UISession *pSession, UIActionsPool *pActionsPool) 40 44 : UIMachineLogic(pParent, pSession, pActionsPool, UIVisualStateType_Seamless) 41 45 { 46 m_pScreenLayout = new UIMultiScreenLayout(this); 42 47 } 43 48 … … 49 54 /* Cleanup actions groups: */ 50 55 cleanupActionGroups(); 56 57 delete m_pScreenLayout; 51 58 } 52 59 … … 61 68 const CConsole &console = uisession()->session().GetConsole(); 62 69 63 #if (QT_VERSION >= 0x040600) 64 int cHostScreens = QApplication::desktop()->screenCount(); 65 #else /* (QT_VERSION >= 0x040600) */ 66 int cHostScreens = QApplication::desktop()->numScreens(); 67 #endif /* !(QT_VERSION >= 0x040600) */ 68 69 int cGuestScreens = machine.GetMonitorCount(); 70 int cHostScreens = m_pScreenLayout->hostScreenCount(); 71 int cGuestScreens = m_pScreenLayout->guestScreenCount(); 70 72 /* Check that there are enough physical screens are connected: */ 71 73 if (cHostScreens < cGuestScreens) … … 155 157 } 156 158 159 int UIMachineLogicSeamless::hostScreenForGuestScreen(int screenId) const 160 { 161 return m_pScreenLayout->hostScreenForGuestScreen(screenId); 162 } 163 157 164 void UIMachineLogicSeamless::prepareActionGroups() 158 165 { … … 168 175 /* Disable mouse-integration isn't allowed in seamless: */ 169 176 actionsPool()->action(UIActionIndex_Toggle_MouseIntegration)->setVisible(false); 177 178 /* Add the view menu: */ 179 QMenu *pMenu = actionsPool()->action(UIActionIndex_Menu_View)->menu(); 180 m_pScreenLayout->initialize(pMenu); 181 pMenu->setVisible(true); 170 182 } 171 183 … … 182 194 #endif /* Q_WS_MAC */ 183 195 184 #if 0 // TODO: Add seamless multi-monitor support! 185 /* Get monitors count: */186 ulong uMonitorCount = session().GetMachine().GetMonitorCount(); 196 /* Update the multi screen layout */ 197 m_pScreenLayout->update(); 198 187 199 /* Create machine window(s): */ 188 for ( ulong uScreenId = 0; uScreenId < uMonitorCount; ++ uScreenId)189 addMachineWindow(UIMachineWindow::create(this, visualStateType(), uScreenId));200 for (int screenId = 0; screenId < m_pScreenLayout->guestScreenCount(); ++screenId) 201 addMachineWindow(UIMachineWindow::create(this, visualStateType(), screenId)); 190 202 /* Order machine window(s): */ 191 for ( ulong uScreenId = uMonitorCount; uScreenId > 0; -- uScreenId)192 machineWindows() [uScreenId - 1]->machineWindow()->raise();193 #else 194 /* Create primary machine window: */195 addMachineWindow(UIMachineWindow::create(this, visualStateType(), 0 /* primary only */));196 #endif 203 for (int screenId = m_pScreenLayout->guestScreenCount() - 1; screenId >= 0; --screenId) 204 machineWindows().at(screenId)->machineWindow()->raise(); 205 206 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 207 connect(m_pScreenLayout, SIGNAL(screenLayoutChanged()), 208 static_cast<UIMachineWindowSeamless*>(pMachineWindow), SLOT(sltPlaceOnScreen())); 197 209 198 210 /* Remember what machine window(s) created: */ … … 206 218 return; 207 219 208 #if 0 // TODO: Add seamless multi-monitor support!209 220 /* Cleanup normal machine window: */ 210 221 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 211 222 UIMachineWindow::destroy(pMachineWindow); 212 #else213 /* Create machine window(s): */214 UIMachineWindow::destroy(machineWindows()[0] /* primary only */);215 #endif216 223 } 217 224 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.h
r27028 r27335 29 29 /* Local forwards */ 30 30 class UIActionsPool; 31 class UIMultiScreenLayout; 31 32 32 33 class UIMachineLogicSeamless : public UIMachineLogic … … 45 46 void initialize(); 46 47 48 int hostScreenForGuestScreen(int screenId) const; 49 47 50 private: 48 51 … … 55 58 void cleanupActionGroups(); 56 59 60 UIMultiScreenLayout *m_pScreenLayout; 61 57 62 /* Friend classes: */ 58 63 friend class UIMachineLogic; 64 friend class UIMachineWindowSeamless; 59 65 }; 60 66 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
r27296 r27335 36 36 #include "UISession.h" 37 37 #include "UIMachineWindow.h" 38 #include "UIMachineLogic.h" 38 39 #include "UIFrameBuffer.h" 39 40 #include "UIMachineViewSeamless.h" … … 275 276 QRect UIMachineViewSeamless::availableGeometry() 276 277 { 278 // return machineWindowWrapper()->machineLogic()->availableGeometry(screenId()); 279 277 280 return QApplication::desktop()->availableGeometry(this); 278 281 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h
r27333 r27335 78 78 void calculateDesktopGeometry(); 79 79 void maybeRestrictMinimumSize() {} 80 void updateSliders() {}81 80 QRegion lastVisibleRegion() const { return m_lastVisibleRegion; } 82 81 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
r27333 r27335 32 32 #include "VBoxMiniToolBar.h" 33 33 34 #ifdef Q_WS_MAC35 # include "VBoxUtils.h"36 #endif /* Q_WS_MAC */37 #include "UISession.h"38 34 #include "UIActionsPool.h" 39 35 #include "UIMachineLogic.h" 36 #include "UIMachineLogicSeamless.h" 40 37 #include "UIMachineView.h" 41 38 #include "UIMachineWindowSeamless.h" 39 #include "UIMachineWindowSeamless.h" 40 #include "UISession.h" 41 42 #ifdef Q_WS_MAC 43 # include "VBoxUtils.h" 44 #endif /* Q_WS_MAC */ 42 45 43 46 UIMachineWindowSeamless::UIMachineWindowSeamless(UIMachineLogic *pMachineLogic, ulong uScreenId) … … 100 103 /* Cleanup menu: */ 101 104 cleanupMenu(); 105 } 106 107 void UIMachineWindowSeamless::sltPlaceOnScreen() 108 { 109 QRect r = QApplication::desktop()->availableGeometry(static_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId)); 110 move(r.topLeft()); 111 resize(r.size()); 102 112 } 103 113 … … 186 196 { 187 197 #ifdef Q_WS_WIN 188 m_prevRegion = QApplication::desktop()->availableGeometry( );198 m_prevRegion = QApplication::desktop()->availableGeometry(static_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId)); 189 199 #endif 190 200 … … 200 210 void UIMachineWindowSeamless::prepareMenu() 201 211 { 202 #ifdef Q_WS_MAC 203 setMenuBar(uisession()->newMenuBar()); 204 #endif /* Q_WS_MAC */ 205 m_pMainMenu = uisession()->newMenu(); 212 UIMainMenuType fMenus = UIMainMenuType_All; 213 /* Remove the view menu in the case there is one screen only. */ 214 if (session().GetMachine().GetMonitorCount() == 1) 215 fMenus = UIMainMenuType(fMenus ^ UIMainMenuType_View); 216 #ifdef Q_WS_MAC 217 setMenuBar(uisession()->newMenuBar(fMenus)); 218 #endif /* Q_WS_MAC */ 219 m_pMainMenu = uisession()->newMenu(fMenus); 206 220 } 207 221 … … 328 342 { 329 343 /* Show manually maximized window: */ 330 QRect geometry = QApplication::desktop()->availableGeometry(); 331 move(geometry.topLeft()); 332 resize(geometry.size()); 344 sltPlaceOnScreen(); 333 345 show(); 346 347 #ifdef Q_WS_MAC 348 /* Make sure it is really on the right place (especially on the Mac) */ 349 QRect r = QApplication::desktop()->availableGeometry(static_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId)); 350 move(r.topLeft()); 351 #endif /* Q_WS_MAC */ 334 352 } 335 353 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h
r27333 r27335 38 38 { 39 39 Q_OBJECT; 40 41 public slots: 42 43 void sltPlaceOnScreen(); 40 44 41 45 protected:
Note:
See TracChangeset
for help on using the changeset viewer.