- Timestamp:
- Mar 7, 2010 4:30:12 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp
r26919 r27141 39 39 } 40 40 41 QMenuBar* UIMachineMenuBar::createMenuBar(UISession *pSession) 42 { 43 QMenuBar *pMenuBar = new QMenuBar(0); 44 45 UIActionsPool *pActionsPool = pSession->actionsPool(); 41 QMenu* UIMachineMenuBar::createMenu(UIActionsPool *pActionsPool) 42 { 43 /* Create empty menu: */ 44 QMenu *pMenu = new QMenu; 45 46 /* Fill menu with prepared items: */ 47 foreach (QMenu *pSubMenu, prepareSubMenus(pActionsPool)) 48 pMenu->addMenu(pSubMenu); 49 50 /* Return filled menu: */ 51 return pMenu; 52 } 53 54 QMenuBar* UIMachineMenuBar::createMenuBar(UIActionsPool *pActionsPool) 55 { 56 /* Create empty menubar: */ 57 QMenuBar *pMenuBar = new QMenuBar; 58 59 /* Fill menubar with prepared items: */ 60 foreach (QMenu *pSubMenu, prepareSubMenus(pActionsPool)) 61 pMenuBar->addMenu(pSubMenu); 62 63 /* Return filled menubar: */ 64 return pMenuBar; 65 } 66 67 QList<QMenu*> UIMachineMenuBar::prepareSubMenus(UIActionsPool *pActionsPool) 68 { 69 /* Create empty submenu list: */ 70 QList<QMenu*> preparedSubMenus; 46 71 47 72 /* Machine submenu: */ 48 73 QMenu *pMenuMachine = pActionsPool->action(UIActionIndex_Menu_Machine)->menu(); 49 74 prepareMenuMachine(pMenuMachine, pActionsPool); 50 p MenuBar->addMenu(pMenuMachine);75 preparedSubMenus << pMenuMachine; 51 76 52 77 /* Devices submenu: */ 53 78 QMenu *pMenuDevices = pActionsPool->action(UIActionIndex_Menu_Devices)->menu(); 54 79 prepareMenuDevices(pMenuDevices, pActionsPool); 55 p MenuBar->addMenu(pMenuDevices);80 preparedSubMenus << pMenuDevices; 56 81 57 82 #ifdef VBOX_WITH_DEBUGGER_GUI 83 /* Debug submenu: */ 58 84 if (vboxGlobal().isDebuggerEnabled()) 59 85 { 60 86 QMenu *pMenuDebug = pActionsPool->action(UIActionIndex_Menu_Debug)->menu(); 61 87 prepareMenuDebug(pMenuDebug, pActionsPool); 62 p MenuBar->addMenu(pMenuDebug);88 preparedSubMenus << pMenuDebug; 63 89 } 64 90 #endif … … 67 93 QMenu *pMenuHelp = pActionsPool->action(UIActionIndex_Menu_Help)->menu(); 68 94 prepareMenuHelp(pMenuHelp, pActionsPool); 69 pMenuBar->addMenu(pMenuHelp); 70 71 /* Because this connections are done to VBoxGlobal, they are needed once 72 * only. Otherwise we will get the slots called more than once. */ 95 preparedSubMenus << pMenuHelp; 96 97 /* Return a list of prepared submenus: */ 98 return preparedSubMenus; 99 } 100 101 void UIMachineMenuBar::prepareMenuMachine(QMenu *pMenu, UIActionsPool *pActionsPool) 102 { 103 /* Do not prepare if ready: */ 104 if (!pMenu->isEmpty()) 105 return; 106 107 /* Machine submenu: */ 108 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Fullscreen)); 109 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Seamless)); 110 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_GuestAutoresize)); 111 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_AdjustWindow)); 112 pMenu->addSeparator(); 113 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_MouseIntegration)); 114 pMenu->addSeparator(); 115 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TypeCAD)); 116 #ifdef Q_WS_X11 117 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TypeCABS)); 118 #endif 119 pMenu->addSeparator(); 120 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TakeSnapshot)); 121 pMenu->addSeparator(); 122 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_InformationDialog)); 123 pMenu->addSeparator(); 124 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Pause)); 125 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Reset)); 126 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Shutdown)); 127 #ifndef Q_WS_MAC 128 pMenu->addSeparator(); 129 #else /* Q_WS_MAC */ 130 if (m_fIsFirstTime) 131 #endif /* !Q_WS_MAC */ 132 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Close)); 133 } 134 135 void UIMachineMenuBar::prepareMenuDevices(QMenu *pMenu, UIActionsPool *pActionsPool) 136 { 137 /* Do not prepare if ready: */ 138 if (!pMenu->isEmpty()) 139 return; 140 141 /* Devices submenu: */ 142 pMenu->addMenu(pActionsPool->action(UIActionIndex_Menu_OpticalDevices)->menu()); 143 pMenu->addMenu(pActionsPool->action(UIActionIndex_Menu_FloppyDevices)->menu()); 144 pMenu->addMenu(pActionsPool->action(UIActionIndex_Menu_USBDevices)->menu()); 145 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_NetworkAdaptersDialog)); 146 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_SharedFoldersDialog)); 147 pMenu->addSeparator(); 148 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_VRDP)); 149 pMenu->addSeparator(); 150 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_InstallGuestTools)); 151 } 152 153 #ifdef VBOX_WITH_DEBUGGER_GUI 154 void UIMachineMenuBar::prepareMenuDebug(QMenu *pMenu, UIActionsPool *pActionsPool) 155 { 156 /* Do not prepare if ready: */ 157 if (!pMenu->isEmpty()) 158 return; 159 160 /* Debug submenu: */ 161 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Statistics)); 162 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_CommandLine)); 163 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Logging)); 164 } 165 #endif /* VBOX_WITH_DEBUGGER_GUI */ 166 167 void UIMachineMenuBar::prepareMenuHelp(QMenu *pMenu, UIActionsPool *pActionsPool) 168 { 169 /* Do not prepare if ready: */ 170 if (!pMenu->isEmpty()) 171 return; 172 173 /* Help submenu: */ 174 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Help)); 175 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Web)); 176 pMenu->addSeparator(); 177 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_ResetWarnings)); 178 pMenu->addSeparator(); 179 180 #ifdef VBOX_WITH_REGISTRATION 181 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Register)); 182 #endif 183 184 #ifdef Q_WS_MAC 185 if (m_fIsFirstTime) 186 #endif /* Q_WS_MAC */ 187 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Update)); 188 189 #ifndef Q_WS_MAC 190 pMenu->addSeparator(); 191 #else /* Q_WS_MAC */ 192 if (m_fIsFirstTime) 193 #endif /* !Q_WS_MAC */ 194 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_About)); 195 196 /* Because this connections are done to VBoxGlobal, they are needed once only. 197 * Otherwise we will get the slots called more than once. */ 73 198 if (m_fIsFirstTime) 74 199 { … … 93 218 m_fIsFirstTime = false; 94 219 } 95 96 return pMenuBar; 97 } 98 99 void UIMachineMenuBar::prepareMenuMachine(QMenu *pMenu, UIActionsPool *pActionsPool) 100 { 101 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Fullscreen)); 102 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Seamless)); 103 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_GuestAutoresize)); 104 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_AdjustWindow)); 105 pMenu->addSeparator(); 106 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_MouseIntegration)); 107 pMenu->addSeparator(); 108 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TypeCAD)); 109 #ifdef Q_WS_X11 110 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TypeCABS)); 111 #endif 112 pMenu->addSeparator(); 113 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_TakeSnapshot)); 114 pMenu->addSeparator(); 115 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_InformationDialog)); 116 pMenu->addSeparator(); 117 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Pause)); 118 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Reset)); 119 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Shutdown)); 120 #ifndef Q_WS_MAC 121 pMenu->addSeparator(); 122 #else /* Q_WS_MAC */ 123 if (m_fIsFirstTime) 124 #endif /* !Q_WS_MAC */ 125 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Close)); 126 } 127 128 void UIMachineMenuBar::prepareMenuDevices(QMenu *pMenu, UIActionsPool *pActionsPool) 129 { 130 /* Devices submenu */ 131 pMenu->addMenu(pActionsPool->action(UIActionIndex_Menu_OpticalDevices)->menu()); 132 pMenu->addMenu(pActionsPool->action(UIActionIndex_Menu_FloppyDevices)->menu()); 133 pMenu->addMenu(pActionsPool->action(UIActionIndex_Menu_USBDevices)->menu()); 134 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_NetworkAdaptersDialog)); 135 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_SharedFoldersDialog)); 136 pMenu->addSeparator(); 137 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_VRDP)); 138 pMenu->addSeparator(); 139 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_InstallGuestTools)); 140 } 141 142 #ifdef VBOX_WITH_DEBUGGER_GUI 143 void UIMachineMenuBar::prepareMenuDebug(QMenu *pMenu, UIActionsPool *pActionsPool) 144 { 145 /* Debug submenu */ 146 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Statistics)); 147 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_CommandLine)); 148 pMenu->addAction(pActionsPool->action(UIActionIndex_Toggle_Logging)); 149 } 150 #endif /* VBOX_WITH_DEBUGGER_GUI */ 151 152 void UIMachineMenuBar::prepareMenuHelp(QMenu *pMenu, UIActionsPool *pActionsPool) 153 { 154 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Help)); 155 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Web)); 156 pMenu->addSeparator(); 157 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_ResetWarnings)); 158 pMenu->addSeparator(); 159 160 #ifdef VBOX_WITH_REGISTRATION 161 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Register)); 162 #endif 163 164 #ifdef Q_WS_MAC 165 if (m_fIsFirstTime) 166 #endif /* Q_WS_MAC */ 167 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_Update)); 168 169 #ifndef Q_WS_MAC 170 pMenu->addSeparator(); 171 #else /* Q_WS_MAC */ 172 if (m_fIsFirstTime) 173 #endif /* !Q_WS_MAC */ 174 pMenu->addAction(pActionsPool->action(UIActionIndex_Simple_About)); 175 } 176 220 } 221 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.h
r26919 r27141 24 24 #define __UIMachineMenuBar_h__ 25 25 26 class UISession; 26 /* Global includes */ 27 #include <QList> 28 29 /* Global forwards */ 30 class QMenu; 31 class QMenuBar; 32 33 /* Local forwards */ 27 34 class UIActionsPool; 28 class QMenuBar;29 class QMenu;30 35 31 36 class UIMachineMenuBar 32 37 { 33 38 public: 39 34 40 UIMachineMenuBar(); 35 41 36 QMenuBar* createMenuBar(UISession *pSession); 42 QMenu* createMenu(UIActionsPool *pActionsPool); 43 QMenuBar* createMenuBar(UIActionsPool *pActionsPool); 37 44 38 45 protected: 39 46 47 QList<QMenu*> prepareSubMenus(UIActionsPool *pActionsPool); 40 48 void prepareMenuMachine(QMenu *pMenu, UIActionsPool *pActionsPool); 41 49 void prepareMenuDevices(QMenu *pMenu, UIActionsPool *pActionsPool); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r27124 r27141 529 529 , m_callback(CConsoleCallback(new UIConsoleCallback(this))) 530 530 /* Common variables: */ 531 , m_pMenu Bar(0)531 , m_pMenuPool(0) 532 532 , m_machineState(KMachineState_Null) 533 533 #if defined(Q_WS_WIN) … … 560 560 session().GetConsole().RegisterCallback(m_callback); 561 561 562 /* Prepare main menu: */ 563 prepareMenuPool(); 564 562 565 /* Load uisession settings: */ 563 566 loadSessionSettings(); … … 568 571 /* Save uisession settings: */ 569 572 saveSessionSettings(); 573 574 /* Cleanup main menu: */ 575 cleanupMenuPool(); 570 576 571 577 /* Unregister console callback: */ … … 584 590 } 585 591 592 QMenu* UISession::newMenu() 593 { 594 /* Create new menu: */ 595 QMenu *pMenu = m_pMenuPool->createMenu(actionsPool()); 596 597 /* Re-init menu pool for the case manu were recreated: */ 598 reinitMenuPool(); 599 600 /* Return newly created menu: */ 601 return pMenu; 602 } 603 586 604 QMenuBar* UISession::newMenuBar() 587 605 { 588 /* */ 589 QMenuBar *pMenuBar = m_pMenuBar->createMenuBar(this); 590 591 /* Get uisession machine: */ 592 CMachine machine = session().GetConsole().GetMachine(); 593 594 /* Availability settings: */ 595 { 596 /* USB Stuff: */ 597 CUSBController usbController = machine.GetUSBController(); 598 if ( usbController.isNull() 599 || !usbController.GetProxyAvailable()) 600 { 601 /* Hide USB menu if controller is NULL or no USB proxy available: */ 602 uimachine()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->setVisible(false); 603 } 604 else 605 { 606 /* Enable/Disable USB menu depending on USB controller: */ 607 uimachine()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->setEnabled(usbController.GetEnabled()); 608 } 609 } 610 611 /* Prepare some initial settings: */ 612 { 613 /* Initialize CD/FD menus: */ 614 int iDevicesCountCD = 0; 615 int iDevicesCountFD = 0; 616 const CMediumAttachmentVector &attachments = machine.GetMediumAttachments(); 617 foreach (const CMediumAttachment &attachment, attachments) 618 { 619 if (attachment.GetType() == KDeviceType_DVD) 620 ++ iDevicesCountCD; 621 if (attachment.GetType() == KDeviceType_Floppy) 622 ++ iDevicesCountFD; 623 } 624 QAction *pOpticalDevicesMenu = uimachine()->actionsPool()->action(UIActionIndex_Menu_OpticalDevices); 625 QAction *pFloppyDevicesMenu = uimachine()->actionsPool()->action(UIActionIndex_Menu_FloppyDevices); 626 pOpticalDevicesMenu->setData(iDevicesCountCD); 627 pOpticalDevicesMenu->setVisible(iDevicesCountCD); 628 pFloppyDevicesMenu->setData(iDevicesCountFD); 629 pFloppyDevicesMenu->setVisible(iDevicesCountFD); 630 } 631 606 /* Create new menubar: */ 607 QMenuBar *pMenuBar = m_pMenuPool->createMenuBar(actionsPool()); 608 609 /* Re-init menu pool for the case manu were recreated: */ 610 reinitMenuPool(); 611 612 /* Return newly created menubar: */ 632 613 return pMenuBar; 633 614 } … … 916 897 } 917 898 899 void UISession::prepareMenuPool() 900 { 901 m_pMenuPool = new UIMachineMenuBar; 902 } 903 918 904 void UISession::loadSessionSettings() 919 905 { 920 m_pMenuBar = new UIMachineMenuBar; 921 922 /* Get uisession machine: */ 906 /* Get uisession machine: */ 923 907 CMachine machine = session().GetConsole().GetMachine(); 924 908 … … 984 968 //machine.SetExtraData(VBoxDefs::GUI_MiniToolBarAutoHide, mMiniToolBar->isAutoHide() ? "on" : "off"); 985 969 } 986 987 delete m_pMenuBar; 988 m_pMenuBar = 0; 970 } 971 972 void UISession::cleanupMenuPool() 973 { 974 delete m_pMenuPool; 975 m_pMenuPool = 0; 989 976 } 990 977 … … 1229 1216 } 1230 1217 1218 void UISession::reinitMenuPool() 1219 { 1220 /* Get uisession machine: */ 1221 CMachine machine = session().GetConsole().GetMachine(); 1222 1223 /* Availability settings: */ 1224 { 1225 /* USB Stuff: */ 1226 CUSBController usbController = machine.GetUSBController(); 1227 if ( usbController.isNull() 1228 || !usbController.GetProxyAvailable()) 1229 { 1230 /* Hide USB menu if controller is NULL or no USB proxy available: */ 1231 uimachine()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->setVisible(false); 1232 } 1233 else 1234 { 1235 /* Enable/Disable USB menu depending on USB controller: */ 1236 uimachine()->actionsPool()->action(UIActionIndex_Menu_USBDevices)->setEnabled(usbController.GetEnabled()); 1237 } 1238 } 1239 1240 /* Prepare some initial settings: */ 1241 { 1242 /* Initialize CD/FD menus: */ 1243 int iDevicesCountCD = 0; 1244 int iDevicesCountFD = 0; 1245 const CMediumAttachmentVector &attachments = machine.GetMediumAttachments(); 1246 foreach (const CMediumAttachment &attachment, attachments) 1247 { 1248 if (attachment.GetType() == KDeviceType_DVD) 1249 ++ iDevicesCountCD; 1250 if (attachment.GetType() == KDeviceType_Floppy) 1251 ++ iDevicesCountFD; 1252 } 1253 QAction *pOpticalDevicesMenu = uimachine()->actionsPool()->action(UIActionIndex_Menu_OpticalDevices); 1254 QAction *pFloppyDevicesMenu = uimachine()->actionsPool()->action(UIActionIndex_Menu_FloppyDevices); 1255 pOpticalDevicesMenu->setData(iDevicesCountCD); 1256 pOpticalDevicesMenu->setVisible(iDevicesCountCD); 1257 pFloppyDevicesMenu->setData(iDevicesCountFD); 1258 pFloppyDevicesMenu->setVisible(iDevicesCountFD); 1259 } 1260 } 1261 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r27124 r27141 32 32 33 33 /* Global forwards */ 34 class QMenu; 34 35 class QMenuBar; 35 36 … … 79 80 KMachineState machineState() const { return m_machineState; } 80 81 UIActionsPool* actionsPool() const; 82 QMenu* newMenu(); 81 83 QMenuBar* newMenuBar(); 84 QCursor cursor() const { return m_cursor; } 82 85 QSize guestSizeHint(ulong uScreenId) const; 83 86 … … 95 98 bool isIgnoreRuntimeMediumsChanging() const { return m_fIsIgnoreRutimeMediumsChanging; } 96 99 bool isGuestResizeIgnored() const { return m_fIsGuestResizeIgnored; } 97 QCursor cursor() const { return m_cursor; }98 100 99 101 /* Guest additions state getters: */ … … 171 173 172 174 /* Prepare helpers: */ 175 void prepareMenuPool(); 173 176 void loadSessionSettings(); 174 177 175 178 /* Cleanup helpers: */ 176 179 void saveSessionSettings(); 180 void cleanupMenuPool(); 177 181 178 182 /* Common helpers: */ 179 183 WId winId() const; 180 184 void setPointerShape(const uchar *pShapeData, bool fHasAlpha, uint uXHot, uint uYHot, uint uWidth, uint uHeight); 185 void reinitMenuPool(); 181 186 182 187 /* Private variables: */ … … 185 190 const CConsoleCallback m_callback; 186 191 187 UIMachineMenuBar *m_pMenu Bar;192 UIMachineMenuBar *m_pMenuPool; 188 193 189 194 /* Common variables: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp
r27124 r27141 235 235 { 236 236 if (pKeyEvent->key() == Qt::Key_Home) 237 { 238 #if 0 // TODO: Activate Main Menu! 239 // should we create it first? 240 #endif 241 } 237 QTimer::singleShot(0, machineWindowWrapper()->machineWindow(), SLOT(sltPopupMainMenu())); 242 238 else 243 239 pEvent->ignore(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r27130 r27141 31 31 #include "VBoxGlobal.h" 32 32 33 #ifdef Q_WS_MAC34 33 #include "UISession.h" 35 #endif /* Q_WS_MAC */36 34 #include "UIMachineLogic.h" 37 35 #include "UIMachineView.h" … … 41 39 : QIWithRetranslateUI2<QIMainDialog>(0, Qt::FramelessWindowHint) 42 40 , UIMachineWindow(pMachineLogic, uScreenId) 41 , m_pMainMenu(0) 43 42 { 44 43 /* "This" is machine window: */ 45 44 m_pMachineWindow = this; 46 45 47 /* Set the main window in VBoxGlobal */46 /* Set the main window in VBoxGlobal: */ 48 47 if (uScreenId == 0) 49 48 vboxGlobal().setMainWindow(this); 50 49 51 /* Prepare window icon: */50 /* Prepare fullscreen window icon: */ 52 51 prepareWindowIcon(); 53 52 … … 55 54 prepareConsoleConnections(); 56 55 57 #ifdef Q_WS_MAC 58 /* Prepare menu: */ 56 /* Prepare fullscreen menu: */ 59 57 prepareMenu(); 60 #endif /* Q_WS_MAC */ 61 62 /* Retranslate normal window finally: */ 58 59 /* Retranslate fullscreen window finally: */ 63 60 retranslateUi(); 64 61 … … 66 63 prepareMachineViewContainer(); 67 64 68 /* Prepare normalmachine view: */65 /* Prepare fullscreen machine view: */ 69 66 prepareMachineView(); 70 67 … … 85 82 /* Cleanup normal machine view: */ 86 83 cleanupMachineView(); 84 85 /* Cleanup menu: */ 86 cleanupMenu(); 87 87 } 88 88 … … 90 90 { 91 91 UIMachineWindow::sltMachineStateChanged(); 92 } 93 94 void UIMachineWindowFullscreen::sltPopupMainMenu() 95 { 96 /* Popup main menu if present: */ 97 if (m_pMainMenu && !m_pMainMenu->isEmpty()) 98 m_pMainMenu->popup(machineWindow()->geometry().center()); 92 99 } 93 100 … … 137 144 } 138 145 139 #ifdef Q_WS_MAC140 146 void UIMachineWindowFullscreen::prepareMenu() 141 147 { 148 #ifdef Q_WS_MAC 142 149 setMenuBar(uisession()->newMenuBar()); 143 } 144 #endif /* Q_WS_MAC */ 150 #else /* To NaN: Please uncomment below for mac too and test! */ 151 m_pMainMenu = uisession()->newMenu(); 152 #endif /* Q_WS_MAC */ 153 } 145 154 146 155 void UIMachineWindowFullscreen::prepareMachineView() … … 186 195 } 187 196 197 void UIMachineWindowFullscreen::cleanupMenu() 198 { 199 #ifdef Q_WS_MAC 200 // Sync with UIMachineWindowFullscreen::prepareMenu()! 201 #else /* To NaN: Please uncomment below for mac too and test! */ 202 delete m_pMainMenu; 203 m_pMainMenu = 0; 204 #endif /* Q_WS_MAC */ 205 } 206 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
r27064 r27141 47 47 void sltMachineStateChanged(); 48 48 49 /* Popup main menu: */ 50 void sltPopupMainMenu(); 51 49 52 /* Close window reimplementation: */ 50 53 void sltTryClose(); … … 62 65 63 66 /* Prepare helpers: */ 64 #ifdef Q_WS_MAC65 67 void prepareMenu(); 66 #endif /* Q_WS_MAC */67 68 void prepareMachineView(); 68 69 … … 70 71 //void saveWindowSettings() {} 71 72 void cleanupMachineView(); 72 #ifdef Q_WS_MAC 73 //void cleanupMenu() {} 74 #endif /* Q_WS_MAC */ 73 void cleanupMenu(); 74 75 /* Private variables: */ 76 QMenu *m_pMainMenu; 75 77 76 78 /* Factory support: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
r27124 r27141 242 242 { 243 243 if (pKeyEvent->key() == Qt::Key_Home) 244 { 245 #if 0 // TODO: Activate Main Menu! 246 // should we create it first? 247 #endif 248 } 244 QTimer::singleShot(0, machineWindowWrapper()->machineWindow(), SLOT(sltPopupMainMenu())); 249 245 else 250 246 pEvent->ignore(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
r27130 r27141 32 32 33 33 #ifdef Q_WS_MAC 34 # include "UISession.h"35 34 # include "VBoxUtils.h" 36 35 #endif /* Q_WS_MAC */ 36 #include "UISession.h" 37 37 #include "UIMachineLogic.h" 38 38 #include "UIMachineView.h" … … 42 42 : QIWithRetranslateUI2<QIMainDialog>(0, Qt::FramelessWindowHint) 43 43 , UIMachineWindow(pMachineLogic, uScreenId) 44 , m_pMainMenu(0) 44 45 { 45 46 /* "This" is machine window: */ 46 47 m_pMachineWindow = this; 47 48 48 /* Set the main window in VBoxGlobal */49 /* Set the main window in VBoxGlobal: */ 49 50 if (uScreenId == 0) 50 51 vboxGlobal().setMainWindow(this); 51 52 52 /* Prepare window icon: */53 /* Prepare seamless window icon: */ 53 54 prepareWindowIcon(); 54 55 … … 59 60 prepareSeamless(); 60 61 61 #ifdef Q_WS_MAC 62 /* Prepare menu: */ 62 /* Prepare seamless menu: */ 63 63 prepareMenu(); 64 #endif /* Q_WS_MAC */65 64 66 65 /* Retranslate seamless window finally: */ 67 66 retranslateUi(); 68 67 69 /* Prepare normalmachine view container: */68 /* Prepare machine view container: */ 70 69 prepareMachineViewContainer(); 71 70 72 /* Prepare normalmachine view: */71 /* Prepare seamless machine view: */ 73 72 prepareMachineView(); 74 73 75 74 #ifdef Q_WS_MAC 76 /* Load normalwindow settings: */75 /* Load seamless window settings: */ 77 76 loadWindowSettings(); 78 77 #endif /* Q_WS_MAC */ … … 89 88 /* Cleanup normal machine view: */ 90 89 cleanupMachineView(); 90 91 /* Cleanup menu: */ 92 cleanupMenu(); 91 93 } 92 94 … … 94 96 { 95 97 UIMachineWindow::sltMachineStateChanged(); 98 } 99 100 void UIMachineWindowSeamless::sltPopupMainMenu() 101 { 102 /* Popup main menu if present: */ 103 if (m_pMainMenu && !m_pMainMenu->isEmpty()) 104 m_pMainMenu->popup(machineWindow()->geometry().center()); 96 105 } 97 106 … … 174 183 } 175 184 176 #ifdef Q_WS_MAC177 185 void UIMachineWindowSeamless::prepareMenu() 178 186 { 187 #ifdef Q_WS_MAC 179 188 setMenuBar(uisession()->newMenuBar()); 180 } 181 #endif /* Q_WS_MAC */ 189 #else /* To NaN: Please uncomment below for mac too and test! */ 190 m_pMainMenu = uisession()->newMenu(); 191 #endif /* Q_WS_MAC */ 192 } 182 193 183 194 void UIMachineWindowSeamless::prepareMachineView() … … 228 239 UIMachineView::destroy(m_pMachineView); 229 240 m_pMachineView = 0; 241 } 242 243 void UIMachineWindowSeamless::cleanupMenu() 244 { 245 #ifdef Q_WS_MAC 246 // Sync with UIMachineWindowSeamless::prepareMenu()! 247 #else /* To NaN: Please uncomment below for mac too and test! */ 248 delete m_pMainMenu; 249 m_pMainMenu = 0; 250 #endif /* Q_WS_MAC */ 230 251 } 231 252 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h
r27089 r27141 47 47 void sltMachineStateChanged(); 48 48 49 /* Popup main menu: */ 50 void sltPopupMainMenu(); 51 49 52 /* Close window reimplementation: */ 50 53 void sltTryClose(); … … 66 69 /* Prepare helpers: */ 67 70 void prepareSeamless(); 68 #ifdef Q_WS_MAC69 71 void prepareMenu(); 70 #endif /* Q_WS_MAC */71 72 void prepareMachineView(); 72 73 #ifdef Q_WS_MAC … … 79 80 #endif /* Q_WS_MAC */ 80 81 void cleanupMachineView(); 81 #ifdef Q_WS_MAC 82 //void cleanupMenu() {} 83 #endif /* Q_WS_MAC */ 82 void cleanupMenu(); 84 83 //void cleanupSeamless() {} 85 84 … … 90 89 91 90 /* Private variables: */ 91 QMenu *m_pMainMenu; 92 92 #ifdef Q_WS_WIN 93 93 QRegion m_prevRegion;
Note:
See TracChangeset
for help on using the changeset viewer.