- Timestamp:
- Mar 10, 2010 12:11:51 AM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r27236 r27237 340 340 { 341 341 m_storedConsoleSize = QSize(iWidth, iHeight); 342 }343 344 void UIMachineView::calculateDesktopGeometry()345 {346 /* This method should not get called until we have initially set up the m_desktopGeometryType: */347 Assert((m_desktopGeometryType != DesktopGeo_Invalid));348 /* If we are not doing automatic geometry calculation then there is nothing to do: */349 if (DesktopGeo_Automatic == m_desktopGeometryType)350 {351 /* Available geometry of the desktop. If the desktop is a single352 * screen, this will exclude space taken up by desktop taskbars353 * and things, but this is unfortunately not true for the more354 * complex case of a desktop spanning multiple screens: */355 QRect desktop = availableGeometry();356 /* The area taken up by the machine window on the desktop,357 * including window frame, title and menu bar and whatnot: */358 QRect frame = machineWindowWrapper()->machineWindow()->frameGeometry();359 /* The area taken up by the machine view, so excluding all decorations: */360 QRect window = geometry();361 /* To work out how big we can make the console window while still362 * fitting on the desktop, we calculate desktop - frame + window.363 * This works because the difference between frame and window364 * (or at least its width and height) is a constant. */365 m_desktopGeometry = QSize(desktop.width() - frame.width() + window.width(),366 desktop.height() - frame.height() + window.height());367 }368 342 } 369 343 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r27236 r27237 112 112 const QPixmap& pauseShot() const { return m_pauseShot; } 113 113 QSize storedConsoleSize() const { return m_storedConsoleSize; } 114 virtual QSize desktopGeometry() const; 114 DesktopGeo desktopGeometryType() const { return m_desktopGeometryType; } 115 QSize desktopGeometry() const; 115 116 116 117 /* Protected setters: */ … … 120 121 121 122 /* Protected helpers: */ 122 void calculateDesktopGeometry();123 123 void updateMouseCursorShape(); 124 124 #ifdef Q_WS_WIN32 … … 126 126 #endif 127 127 virtual QRect availableGeometry() = 0; 128 virtual void calculateDesktopGeometry() = 0; 128 129 virtual void maybeRestrictMinimumSize() = 0; 129 130 virtual void updateSliders() = 0; … … 153 154 bool event(QEvent *pEvent); 154 155 bool eventFilter(QObject *pWatched, QEvent *pEvent); 156 157 /* Protected variables: */ 158 QSize m_desktopGeometry; 155 159 156 160 protected slots: … … 222 226 223 227 DesktopGeo m_desktopGeometryType; 224 QSize m_desktopGeometry;225 228 QSize m_storedConsoleSize; 226 229 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp
r27236 r27237 267 267 } 268 268 269 void UIMachineViewFullscreen::calculateDesktopGeometry() 270 { 271 /* This method should not get called until we have initially set up the desktop geometry type: */ 272 Assert((desktopGeometryType() != DesktopGeo_Invalid)); 273 /* If we are not doing automatic geometry calculation then there is nothing to do: */ 274 if (desktopGeometryType() == DesktopGeo_Automatic) 275 { 276 m_desktopGeometry = QSize(availableGeometry().width(), availableGeometry().height()); 277 } 278 } 279 269 280 void UIMachineViewFullscreen::maybeRestrictMinimumSize() 270 281 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h
r27236 r27237 79 79 void normalizeGeometry(bool /* fAdjustPosition */) {} 80 80 QRect availableGeometry(); 81 void calculateDesktopGeometry(); 81 82 void maybeRestrictMinimumSize(); 82 83 void updateSliders() {} -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp
r27236 r27237 322 322 } 323 323 324 void UIMachineViewNormal::calculateDesktopGeometry() 325 { 326 /* This method should not get called until we have initially set up the desktop geometry type: */ 327 Assert((desktopGeometryType() != DesktopGeo_Invalid)); 328 /* If we are not doing automatic geometry calculation then there is nothing to do: */ 329 if (desktopGeometryType() == DesktopGeo_Automatic) 330 { 331 /* The area taken up by the machine window on the desktop, 332 * including window frame, title, menu bar and status bar: */ 333 QRect windowGeo = machineWindowWrapper()->machineWindow()->frameGeometry(); 334 /* The area taken up by the machine central widget, so excluding all decorations: */ 335 QRect centralWidgetGeo = static_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->centralWidget()->geometry(); 336 /* To work out how big we can make the console window while still fitting on the desktop, 337 * we calculate availableGeometry() - (windowGeo - centralWidgetGeo). 338 * This works because the difference between machine window and machine central widget 339 * (or at least its width and height) is a constant. */ 340 m_desktopGeometry = QSize(availableGeometry().width() - (windowGeo.width() - centralWidgetGeo.width()), 341 availableGeometry().height() - (windowGeo.height() - centralWidgetGeo.height())); 342 } 343 } 344 324 345 void UIMachineViewNormal::maybeRestrictMinimumSize() 325 346 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h
r27236 r27237 77 77 void normalizeGeometry(bool fAdjustPosition); 78 78 QRect availableGeometry(); 79 void calculateDesktopGeometry(); 79 80 void maybeRestrictMinimumSize(); 80 81 void updateSliders(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
r27236 r27237 274 274 } 275 275 276 void UIMachineViewSeamless::calculateDesktopGeometry() 277 { 278 /* This method should not get called until we have initially set up the desktop geometry type: */ 279 Assert((desktopGeometryType() != DesktopGeo_Invalid)); 280 /* If we are not doing automatic geometry calculation then there is nothing to do: */ 281 if (desktopGeometryType() == DesktopGeo_Automatic) 282 { 283 m_desktopGeometry = QSize(availableGeometry().width(), availableGeometry().height()); 284 } 285 } 286 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h
r27236 r27237 76 76 void normalizeGeometry(bool /* fAdjustPosition */) {} 77 77 QRect availableGeometry(); 78 void calculateDesktopGeometry(); 78 79 void maybeRestrictMinimumSize() {} 79 80 void updateSliders() {}
Note:
See TracChangeset
for help on using the changeset viewer.