Changeset 88651 in vbox
- Timestamp:
- Apr 22, 2021 12:12:33 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp
r86051 r88651 18 18 /* Qt includes: */ 19 19 #include <QMenuBar> 20 #include <QTimer >20 #include <QTimerEvent> 21 21 #include <QContextMenuEvent> 22 22 #include <QResizeEvent> 23 23 #include <QScrollBar> 24 #ifdef VBOX_WS_X11 25 # include <QTimer> 26 #endif 24 27 25 28 /* GUI includes: */ … … 56 59 : UIMachineWindow(pMachineLogic, uScreenId) 57 60 , m_pIndicatorsPool(0) 61 , m_iGeometrySaveTimerId(-1) 58 62 { 59 63 } … … 377 381 { 378 382 /* Restore window geometry: */ 379 m_ normalGeometry = geo;380 UICommon::setTopLevelGeometry(this, m_ normalGeometry);383 m_geometry = geo; 384 UICommon::setTopLevelGeometry(this, m_geometry); 381 385 382 386 /* If previous machine-state was NOT SAVED => normalize window to the optimal-size: */ … … 396 400 397 401 /* Move it to the screen-center: */ 398 m_ normalGeometry = geometry();399 m_ normalGeometry.moveCenter(gpDesktop->availableGeometry(this).center());400 UICommon::setTopLevelGeometry(this, m_ normalGeometry);402 m_geometry = geometry(); 403 m_geometry.moveCenter(gpDesktop->availableGeometry(this).center()); 404 UICommon::setTopLevelGeometry(this, m_geometry); 401 405 } 402 406 … … 409 413 } 410 414 #endif /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */ 411 }412 413 void UIMachineWindowNormal::saveSettings()414 {415 /* Save window geometry: */416 {417 gEDataManager->setMachineWindowGeometry(machineLogic()->visualStateType(),418 m_uScreenId, m_normalGeometry,419 isMaximizedChecked(), uiCommon().managedVMUuid());420 }421 422 /* Call to base-class: */423 UIMachineWindow::saveSettings();424 415 } 425 416 … … 472 463 if (!isMaximizedChecked()) 473 464 { 474 m_ normalGeometry.setSize(pResizeEvent->size());465 m_geometry.setSize(pResizeEvent->size()); 475 466 #ifdef VBOX_WITH_DEBUGGER_GUI 476 467 /* Update debugger window position: */ … … 478 469 #endif /* VBOX_WITH_DEBUGGER_GUI */ 479 470 } 471 472 /* Restart geometry save timer: */ 473 if (m_iGeometrySaveTimerId != -1) 474 killTimer(m_iGeometrySaveTimerId); 475 m_iGeometrySaveTimerId = startTimer(300); 476 477 /* Let listeners know about geometry changes: */ 480 478 emit sigGeometryChange(geometry()); 481 479 break; … … 491 489 if (!isMaximizedChecked()) 492 490 { 493 m_ normalGeometry.moveTo(geometry().x(), geometry().y());491 m_geometry.moveTo(geometry().x(), geometry().y()); 494 492 #ifdef VBOX_WITH_DEBUGGER_GUI 495 493 /* Update debugger window position: */ … … 497 495 #endif /* VBOX_WITH_DEBUGGER_GUI */ 498 496 } 497 498 /* Restart geometry save timer: */ 499 if (m_iGeometrySaveTimerId != -1) 500 killTimer(m_iGeometrySaveTimerId); 501 m_iGeometrySaveTimerId = startTimer(300); 502 503 /* Let listeners know about geometry changes: */ 499 504 emit sigGeometryChange(geometry()); 500 505 break; 501 506 } 502 507 case QEvent::WindowActivate: 508 { 509 /* Let listeners know about geometry changes: */ 503 510 emit sigGeometryChange(geometry()); 504 511 break; 512 } 513 /* Handle timer event started above: */ 514 case QEvent::Timer: 515 { 516 QTimerEvent *pTimerEvent = static_cast<QTimerEvent*>(pEvent); 517 if (pTimerEvent->timerId() == m_iGeometrySaveTimerId) 518 { 519 killTimer(m_iGeometrySaveTimerId); 520 m_iGeometrySaveTimerId = -1; 521 LogRel2(("GUI: UIMachineWindowNormal: Saving geometry as: Origin=%dx%d, Size=%dx%d\n", 522 m_geometry.x(), m_geometry.y(), m_geometry.width(), m_geometry.height())); 523 gEDataManager->setMachineWindowGeometry(machineLogic()->visualStateType(), 524 m_uScreenId, m_geometry, 525 isMaximizedChecked(), uiCommon().managedVMUuid()); 526 } 527 break; 528 } 505 529 default: 506 530 break; … … 532 556 { 533 557 /* Restore the geometry cached by the window: */ 534 resize(m_ normalGeometry.size());535 move(m_ normalGeometry.topLeft());558 resize(m_geometry.size()); 559 move(m_geometry.topLeft()); 536 560 537 561 /* Adjust machine-view accordingly: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h
r86061 r88651 103 103 void loadSettings(); 104 104 105 /** Save settings routine. */106 void saveSettings();107 105 /** Cleanup visual-state routine. */ 108 106 void cleanupVisualState(); … … 139 137 140 138 /** Holds the current window geometry. */ 141 QRect m_normalGeometry; 139 QRect m_geometry; 140 /** Holds the geometry save timer ID. */ 141 int m_iGeometrySaveTimerId; 142 142 143 143 /** Factory support. */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.cpp
r86054 r88651 18 18 /* Qt includes: */ 19 19 #include <QMenu> 20 #include <QTimer >20 #include <QTimerEvent> 21 21 #include <QSpacerItem> 22 22 #include <QResizeEvent> 23 #ifdef VBOX_WS_X11 24 # include <QTimer> 25 #endif 23 26 24 27 /* GUI includes: */ … … 39 42 UIMachineWindowScale::UIMachineWindowScale(UIMachineLogic *pMachineLogic, ulong uScreenId) 40 43 : UIMachineWindow(pMachineLogic, uScreenId) 44 , m_iGeometrySaveTimerId(-1) 41 45 { 42 46 } … … 95 99 { 96 100 /* Restore window geometry: */ 97 m_ normalGeometry = geo;98 UICommon::setTopLevelGeometry(this, m_ normalGeometry);101 m_geometry = geo; 102 UICommon::setTopLevelGeometry(this, m_geometry); 99 103 100 104 /* Maximize (if necessary): */ … … 113 117 resize(640, 480); 114 118 /* Move newly created window to the screen-center: */ 115 m_ normalGeometry = geometry();116 m_ normalGeometry.moveCenter(availableGeo.center());117 UICommon::setTopLevelGeometry(this, m_ normalGeometry);119 m_geometry = geometry(); 120 m_geometry.moveCenter(availableGeo.center()); 121 UICommon::setTopLevelGeometry(this, m_geometry); 118 122 } 119 123 … … 127 131 } 128 132 129 void UIMachineWindowScale::saveSettings()130 {131 /* Save window geometry: */132 {133 gEDataManager->setMachineWindowGeometry(machineLogic()->visualStateType(),134 m_uScreenId, m_normalGeometry,135 isMaximizedChecked(), uiCommon().managedVMUuid());136 }137 138 /* Call to base-class: */139 UIMachineWindow::saveSettings();140 }141 142 133 #ifdef VBOX_WS_MAC 143 134 void UIMachineWindowScale::cleanupVisualState() … … 169 160 { 170 161 /* Restore the geometry cached by the window: */ 171 resize(m_ normalGeometry.size());172 move(m_ normalGeometry.topLeft());162 resize(m_geometry.size()); 163 move(m_geometry.topLeft()); 173 164 174 165 /* Adjust machine-view accordingly: */ … … 215 206 if (!isMaximizedChecked()) 216 207 { 217 m_ normalGeometry.setSize(pResizeEvent->size());208 m_geometry.setSize(pResizeEvent->size()); 218 209 #ifdef VBOX_WITH_DEBUGGER_GUI 219 210 /* Update debugger window position: */ … … 221 212 #endif /* VBOX_WITH_DEBUGGER_GUI */ 222 213 } 214 215 /* Restart geometry save timer: */ 216 if (m_iGeometrySaveTimerId != -1) 217 killTimer(m_iGeometrySaveTimerId); 218 m_iGeometrySaveTimerId = startTimer(300); 223 219 break; 224 220 } … … 233 229 if (!isMaximizedChecked()) 234 230 { 235 m_ normalGeometry.moveTo(geometry().x(), geometry().y());231 m_geometry.moveTo(geometry().x(), geometry().y()); 236 232 #ifdef VBOX_WITH_DEBUGGER_GUI 237 233 /* Update debugger window position: */ 238 234 updateDbgWindows(); 239 235 #endif /* VBOX_WITH_DEBUGGER_GUI */ 236 } 237 238 /* Restart geometry save timer: */ 239 if (m_iGeometrySaveTimerId != -1) 240 killTimer(m_iGeometrySaveTimerId); 241 m_iGeometrySaveTimerId = startTimer(300); 242 break; 243 } 244 /* Handle timer event started above: */ 245 case QEvent::Timer: 246 { 247 QTimerEvent *pTimerEvent = static_cast<QTimerEvent*>(pEvent); 248 if (pTimerEvent->timerId() == m_iGeometrySaveTimerId) 249 { 250 killTimer(m_iGeometrySaveTimerId); 251 m_iGeometrySaveTimerId = -1; 252 LogRel2(("GUI: UIMachineWindowScale: Saving geometry as: Origin=%dx%d, Size=%dx%d\n", 253 m_geometry.x(), m_geometry.y(), m_geometry.width(), m_geometry.height())); 254 gEDataManager->setMachineWindowGeometry(machineLogic()->visualStateType(), 255 m_uScreenId, m_geometry, 256 isMaximizedChecked(), uiCommon().managedVMUuid()); 240 257 } 241 258 break; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineWindowScale.h
r86061 r88651 47 47 void loadSettings(); 48 48 49 /** Save settings routine. */50 void saveSettings();51 49 #ifdef VBOX_WS_MAC 52 50 /** Cleanup visual-state routine. */ … … 72 70 73 71 /** Holds the current window geometry. */ 74 QRect m_normalGeometry; 72 QRect m_geometry; 73 /** Holds the geometry save timer ID. */ 74 int m_iGeometrySaveTimerId; 75 75 76 76 /** Factory support. */
Note:
See TracChangeset
for help on using the changeset viewer.