Changeset 39023 in vbox for trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
- Timestamp:
- Oct 18, 2011 9:01:00 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
r39021 r39023 154 154 void UIMachineViewScale::sltDesktopResized() 155 155 { 156 /* Recalculate the maximum guest size if necessary. */ 157 calculateMaxGuestSize(); 156 158 157 } 159 158 … … 185 184 /* Report to the VM thread that we finished resizing: */ 186 185 session().GetConsole().GetDisplay().ResizeCompleted(screenId()); 187 188 /* We also recalculate the maximum guest size if necessary. In189 * fact we only need this on the first resize, but it is done190 * every time to keep the code simpler. */191 calculateMaxGuestSize();192 186 193 187 /* Emit a signal about guest was resized: */ … … 368 362 } 369 363 370 void UIMachineViewScale::calculateMaxGuestSize() 371 { 372 /* This method should not get called until we have initially set up the 373 * maximum guest size policy. */ 374 Assert((maxGuestSizePolicy() != MaxGuestSizePolicy_Invalid)); 375 /* If we are not doing automatic adjustment then there is nothing to do. */ 376 if (maxGuestSizePolicy() == MaxGuestSizePolicy_Automatic) 377 { 378 /* The area taken up by the machine window on the desktop, 379 * including window frame, title, menu bar and status bar: */ 380 QRect windowGeo = machineWindowWrapper()->machineWindow()->frameGeometry(); 381 /* The area taken up by the machine central widget, so excluding all decorations: */ 382 QRect centralWidgetGeo = static_cast<QMainWindow*>(machineWindowWrapper()->machineWindow())->centralWidget()->geometry(); 383 /* To work out how big we can make the console window while still fitting on the desktop, 384 * we calculate workingArea() - (windowGeo - centralWidgetGeo). 385 * This works because the difference between machine window and machine central widget 386 * (or at least its width and height) is a constant. */ 387 m_fixedMaxGuestSize = QSize( workingArea().width() 388 - (windowGeo.width() 389 - centralWidgetGeo.width()), 390 workingArea().height() 391 - (windowGeo.height() 392 - centralWidgetGeo.height())); 393 } 364 QSize UIMachineViewScale::calculateMaxGuestSize() const 365 { 366 /* The area taken up by the machine window on the desktop, 367 * including window frame, title, menu bar and status bar: */ 368 QRect windowGeo = machineWindowWrapper()->machineWindow()->frameGeometry(); 369 /* The area taken up by the machine central widget, so excluding all decorations: */ 370 QRect centralWidgetGeo = static_cast<QMainWindow*>(machineWindowWrapper()->machineWindow())->centralWidget()->geometry(); 371 /* To work out how big we can make the console window while still fitting on the desktop, 372 * we calculate workingArea() - (windowGeo - centralWidgetGeo). 373 * This works because the difference between machine window and machine central widget 374 * (or at least its width and height) is a constant. */ 375 return QSize( workingArea().width() 376 - (windowGeo.width() - centralWidgetGeo.width()), 377 workingArea().height() 378 - (windowGeo.height() - centralWidgetGeo.height())); 394 379 } 395 380
Note:
See TracChangeset
for help on using the changeset viewer.