- Timestamp:
- Aug 25, 2021 1:49:13 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r88633 r90883 78 78 UIVisualStateType requestedVisualState() const; 79 79 80 /** Close Runtime UI. */ 80 public slots: 81 82 /** Closes Runtime UI. */ 81 83 void closeRuntimeUI(); 82 84 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r90878 r90883 399 399 /* Manually close Runtime UI: */ 400 400 if (fSuccess) 401 closeRuntimeUI();401 uisession()->closeRuntimeUI(); 402 402 } 403 403 … … 455 455 /* Manually close Runtime UI: */ 456 456 if (fSuccess) 457 closeRuntimeUI(); 458 } 459 460 void UIMachineLogic::closeRuntimeUI() 461 { 462 /* First, we have to hide any opened modal/popup widgets. 463 * They then should unlock their event-loops asynchronously. 464 * If all such loops are unlocked, we can close Runtime UI: */ 465 QWidget *pWidget = QApplication::activeModalWidget() ? 466 QApplication::activeModalWidget() : 467 QApplication::activePopupWidget() ? 468 QApplication::activePopupWidget() : 0; 469 if (pWidget) 470 { 471 /* First we should try to close this widget: */ 472 pWidget->close(); 473 /* If widget rejected the 'close-event' we can 474 * still hide it and hope it will behave correctly 475 * and unlock his event-loop if any: */ 476 if (!pWidget->isHidden()) 477 pWidget->hide(); 478 /* Asynchronously restart this slot: */ 479 QMetaObject::invokeMethod(this, "sltCloseRuntimeUI", Qt::QueuedConnection); 480 return; 481 } 482 483 /* Asynchronously ask UISession to close Runtime UI: */ 484 LogRel(("GUI: Passing request to close Runtime UI from machine-logic to UI session.\n")); 485 QMetaObject::invokeMethod(uisession(), "sltCloseRuntimeUI", Qt::QueuedConnection); 457 uisession()->closeRuntimeUI(); 486 458 } 487 459 … … 643 615 644 616 LogRel(("GUI: Request to close Runtime UI because VM is powered off already.\n")); 645 closeRuntimeUI();617 uisession()->closeRuntimeUI(); 646 618 return; 647 619 } … … 1947 1919 /* Close Runtime UI if state was saved: */ 1948 1920 if (fSuccess) 1949 closeRuntimeUI();1921 uisession()->closeRuntimeUI(); 1950 1922 } 1951 1923 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r90878 r90883 151 151 /** Power off VM, then close Runtime UI. */ 152 152 void powerOff(bool fDiscardingState); 153 /** Close Runtime UI. */154 void closeRuntimeUI();155 153 156 154 /* API: 3D overlay visibility stuff: */ … … 356 354 void sltShowGlobalPreferences(); 357 355 358 /** Close Runtime UI. */359 void sltCloseRuntimeUI() { closeRuntimeUI(); }360 361 356 /** Handles request for visual state change. */ 362 357 void sltHandleVisualStateChange(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r90878 r90883 455 455 } 456 456 457 void UISession::closeRuntimeUI() 458 { 459 /* First, we have to hide any opened modal/popup widgets. 460 * They then should unlock their event-loops asynchronously. 461 * If all such loops are unlocked, we can close Runtime UI. */ 462 QWidget *pWidget = QApplication::activeModalWidget() 463 ? QApplication::activeModalWidget() 464 : QApplication::activePopupWidget() 465 ? QApplication::activePopupWidget() 466 : 0; 467 if (pWidget) 468 { 469 /* First we should try to close this widget: */ 470 pWidget->close(); 471 /* If widget rejected the 'close-event' we can 472 * still hide it and hope it will behave correctly 473 * and unlock his event-loop if any: */ 474 if (!pWidget->isHidden()) 475 pWidget->hide(); 476 /* Asynchronously restart this slot: */ 477 QMetaObject::invokeMethod(this, "closeRuntimeUI", Qt::QueuedConnection); 478 return; 479 } 480 481 /* Asynchronously ask UIMachine to close Runtime UI: */ 482 LogRel(("GUI: Passing request to close Runtime UI from UI session to UI machine.\n")); 483 QMetaObject::invokeMethod(uimachine(), "closeRuntimeUI", Qt::QueuedConnection); 484 } 485 457 486 void UISession::sltDetachCOM() 458 487 { … … 462 491 cleanupNotificationCenter(); 463 492 cleanupSession(); 464 }465 466 void UISession::sltCloseRuntimeUI()467 {468 /* Ask UIMachine to close Runtime UI: */469 uimachine()->closeRuntimeUI();470 493 } 471 494 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r90878 r90883 345 345 void setMouseState(int iMouseState) { m_iMouseState = iMouseState; emit sigMouseStateChange(m_iMouseState); } 346 346 347 /** Closes Runtime UI. */ 348 void closeRuntimeUI(); 349 347 350 private slots: 348 351 349 352 /** Detaches COM. */ 350 353 void sltDetachCOM(); 351 /** Close Runtime UI. */352 void sltCloseRuntimeUI();353 354 354 355 #ifdef RT_OS_DARWIN
Note:
See TracChangeset
for help on using the changeset viewer.