Changeset 27333 in vbox
- Timestamp:
- Mar 12, 2010 3:17:19 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r27296 r27333 65 65 int keyboardState() const; 66 66 int mouseState() const; 67 virtual QRegion lastVisibleRegion() const { return QRegion(); } 67 68 68 69 /* Public setters: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h
r27237 r27333 79 79 void maybeRestrictMinimumSize() {} 80 80 void updateSliders() {} 81 QRegion lastVisibleRegion() const { return m_lastVisibleRegion; } 81 82 82 83 /* Private variables: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp
r27161 r27333 30 30 /* Local includes */ 31 31 #include "VBoxGlobal.h" 32 #include "VBoxMiniToolBar.h" 32 33 33 34 #ifdef Q_WS_MAC … … 35 36 #endif /* Q_WS_MAC */ 36 37 #include "UISession.h" 38 #include "UIActionsPool.h" 37 39 #include "UIMachineLogic.h" 38 40 #include "UIMachineView.h" … … 43 45 , UIMachineWindow(pMachineLogic, uScreenId) 44 46 , m_pMainMenu(0) 47 , m_pMiniToolBar(0) 45 48 { 46 49 /* "This" is machine window: */ … … 63 66 prepareMenu(); 64 67 65 /* Retranslate seamless window finally: */66 retranslateUi();67 68 68 /* Prepare machine view container: */ 69 69 prepareMachineViewContainer(); … … 72 72 prepareMachineView(); 73 73 74 /* Prepare mini tool-bar: */ 75 prepareMiniToolBar(); 76 77 /* Retranslate fullscreen window finally: */ 78 retranslateUi(); 79 74 80 #ifdef Q_WS_MAC 75 81 /* Load seamless window settings: */ … … 86 92 UIMachineWindowSeamless::~UIMachineWindowSeamless() 87 93 { 88 /* Cleanup normal machine view: */ 94 /* Save window settings: */ 95 saveWindowSettings(); 96 97 /* Cleanup machine view: */ 89 98 cleanupMachineView(); 90 99 … … 103 112 if (m_pMainMenu && !m_pMainMenu->isEmpty()) 104 113 m_pMainMenu->popup(machineWindow()->geometry().center()); 114 } 115 116 void UIMachineWindowSeamless::sltUpdateMiniToolBarMask() 117 { 118 if (m_pMiniToolBar) 119 setMask(machineView()->lastVisibleRegion()); 105 120 } 106 121 … … 191 206 } 192 207 208 void UIMachineWindowSeamless::prepareMiniToolBar() 209 { 210 /* Get current machine: */ 211 CMachine machine = session().GetConsole().GetMachine(); 212 /* Check if mini tool-bar should present: */ 213 bool fIsActive = machine.GetExtraData(VBoxDefs::GUI_ShowMiniToolBar) != "no"; 214 if (fIsActive) 215 { 216 /* Get the mini tool-bar alignment: */ 217 bool fIsAtTop = machine.GetExtraData(VBoxDefs::GUI_MiniToolBarAlignment) == "top"; 218 /* Get the mini tool-bar auto-hide feature availability: */ 219 bool fIsAutoHide = machine.GetExtraData(VBoxDefs::GUI_MiniToolBarAutoHide) != "off"; 220 m_pMiniToolBar = new VBoxMiniToolBar(centralWidget(), 221 fIsAtTop ? VBoxMiniToolBar::AlignTop : VBoxMiniToolBar::AlignBottom, 222 true, fIsAutoHide); 223 m_pMiniToolBar->setSeamlessMode(true); 224 m_pMiniToolBar->updateDisplay(true, true); 225 QList<QMenu*> menus; 226 menus << uisession()->actionsPool()->action(UIActionIndex_Menu_Machine)->menu(); 227 menus << uisession()->actionsPool()->action(UIActionIndex_Menu_Devices)->menu(); 228 *m_pMiniToolBar << menus; 229 connect(m_pMiniToolBar, SIGNAL(exitAction()), 230 uisession()->actionsPool()->action(UIActionIndex_Toggle_Seamless), SLOT(trigger())); 231 connect(m_pMiniToolBar, SIGNAL(closeAction()), 232 uisession()->actionsPool()->action(UIActionIndex_Simple_Close), SLOT(trigger())); 233 connect(m_pMiniToolBar, SIGNAL(geometryUpdated()), this, SLOT(sltUpdateMiniToolBarMask())); 234 } 235 } 236 193 237 void UIMachineWindowSeamless::prepareMachineView() 194 238 { … … 230 274 #endif 231 275 276 void UIMachineWindowSeamless::saveWindowSettings() 277 { 278 /* Get machine: */ 279 CMachine machine = session().GetConsole().GetMachine(); 280 281 /* Save extra-data settings: */ 282 { 283 /* Save mini tool-bar settings: */ 284 if (m_pMiniToolBar) 285 machine.SetExtraData(VBoxDefs::GUI_MiniToolBarAutoHide, m_pMiniToolBar->isAutoHide() ? QString() : "off"); 286 } 287 } 288 232 289 void UIMachineWindowSeamless::cleanupMachineView() 233 290 { … … 244 301 delete m_pMainMenu; 245 302 m_pMainMenu = 0; 303 } 304 305 void UIMachineWindowSeamless::updateAppearanceOf(int iElement) 306 { 307 /* Base class update: */ 308 UIMachineWindow::updateAppearanceOf(iElement); 309 310 /* If mini tool-bar is present: */ 311 if (m_pMiniToolBar) 312 { 313 /* Get machine: */ 314 CMachine machine = session().GetConsole().GetMachine(); 315 /* Get snapshot(s): */ 316 QString strSnapshotName; 317 if (machine.GetSnapshotCount() > 0) 318 { 319 CSnapshot snapshot = machine.GetCurrentSnapshot(); 320 strSnapshotName = " (" + snapshot.GetName() + ")"; 321 } 322 /* Update mini tool-bar text: */ 323 m_pMiniToolBar->setDisplayText(machine.GetName() + strSnapshotName); 324 } 246 325 } 247 326 … … 264 343 #endif 265 344 266 #if 0 // TODO: Add mini-toolbar support! 267 /* Including mini toolbar area */ 268 QRegion toolBarRegion(mMiniToolBar->mask()); 269 toolBarRegion.translate(mMiniToolBar->mapToGlobal (toolBarRegion.boundingRect().topLeft()) - QPoint (1, 0)); 345 /* Including mini tool-bar area */ 346 QRegion toolBarRegion(m_pMiniToolBar->mask()); 347 toolBarRegion.translate(m_pMiniToolBar->mapToGlobal(toolBarRegion.boundingRect().topLeft()) - QPoint(1, 0)); 270 348 region += toolBarRegion; 271 #endif272 349 273 350 #if 0 // TODO: Is it really needed now? -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.h
r27141 r27333 32 32 #endif 33 33 34 /* Local forwards */ 35 class VBoxMiniToolBar; 36 34 37 class UIMachineWindowSeamless : public QIWithRetranslateUI2<QIMainDialog>, public UIMachineWindow 35 38 { … … 49 52 /* Popup main menu: */ 50 53 void sltPopupMainMenu(); 54 55 /* Update mini tool-bar mask: */ 56 void sltUpdateMiniToolBarMask(); 51 57 52 58 /* Close window reimplementation: */ … … 70 76 void prepareSeamless(); 71 77 void prepareMenu(); 78 void prepareMiniToolBar(); 72 79 void prepareMachineView(); 73 80 #ifdef Q_WS_MAC … … 76 83 77 84 /* Cleanup helpers: */ 78 #ifdef Q_WS_MAC 79 //void saveWindowSettings() {} 80 #endif /* Q_WS_MAC */ 85 void saveWindowSettings(); 81 86 void cleanupMachineView(); 87 //void cleanupMiniToolBar() {} 82 88 void cleanupMenu(); 83 89 //void cleanupSeamless() {} 90 91 /* Update routines: */ 92 void updateAppearanceOf(int iElement); 84 93 85 94 /* Other members: */ … … 90 99 /* Private variables: */ 91 100 QMenu *m_pMainMenu; 101 VBoxMiniToolBar *m_pMiniToolBar; 92 102 #ifdef Q_WS_WIN 93 103 QRegion m_prevRegion;
Note:
See TracChangeset
for help on using the changeset viewer.