Changeset 57178 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 4, 2015 3:57:24 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h
r55401 r57178 70 70 void asyncChangeVisualState(UIVisualStateType visualStateType); 71 71 72 /** Close Runtime UI. */ 73 void closeRuntimeUI() { destroy(); } 74 72 75 private slots: 73 76 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r57128 r57178 408 408 /* Manually close Runtime UI: */ 409 409 if (fSuccess) 410 uisession()->closeRuntimeUI();410 closeRuntimeUI(); 411 411 } 412 412 … … 438 438 /* Manually close Runtime UI: */ 439 439 if (fSuccess) 440 uisession()->closeRuntimeUI(); 440 closeRuntimeUI(); 441 } 442 443 void UIMachineLogic::closeRuntimeUI() 444 { 445 /* First, we have to hide any opened modal/popup widgets. 446 * They then should unlock their event-loops asynchronously. 447 * If all such loops are unlocked, we can close Runtime UI: */ 448 QWidget *pWidget = QApplication::activeModalWidget() ? 449 QApplication::activeModalWidget() : 450 QApplication::activePopupWidget() ? 451 QApplication::activePopupWidget() : 0; 452 if (pWidget) 453 { 454 /* First we should try to close this widget: */ 455 pWidget->close(); 456 /* If widget rejected the 'close-event' we can 457 * still hide it and hope it will behave correctly 458 * and unlock his event-loop if any: */ 459 if (!pWidget->isHidden()) 460 pWidget->hide(); 461 /* Asynchronously restart this slot: */ 462 QMetaObject::invokeMethod(this, "sltCloseRuntimeUI", Qt::QueuedConnection); 463 return; 464 } 465 466 /* Asynchronously ask UISession to close Runtime UI: */ 467 QMetaObject::invokeMethod(uisession(), "sltCloseRuntimeUI", Qt::QueuedConnection); 441 468 } 442 469 … … 592 619 } 593 620 594 uisession()->closeRuntimeUI();621 closeRuntimeUI(); 595 622 return; 596 623 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r57128 r57178 140 140 #endif /* Q_WS_MAC */ 141 141 142 /* API: Close actions:*/142 /** Save VM state, then close Runtime UI. */ 143 143 void saveState(); 144 /** Call for guest shutdown to close Runtime UI. */ 144 145 void shutdown(); 146 /** Power off VM, then close Runtime UI. */ 145 147 void powerOff(bool fDiscardingState); 148 /** Close Runtime UI. */ 149 void closeRuntimeUI(); 146 150 147 151 /* API: 3D overlay visibility stuff: */ … … 317 321 void sltShowGlobalPreferences(); 318 322 323 /** Close Runtime UI. */ 324 void sltCloseRuntimeUI() { closeRuntimeUI(); } 325 319 326 private: 320 327 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r57129 r57178 415 415 { 416 416 /* Just close Runtime UI: */ 417 uisession()->closeRuntimeUI();417 machineLogic()->closeRuntimeUI(); 418 418 break; 419 419 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r57080 r57178 456 456 } 457 457 458 void UISession::closeRuntimeUI()459 {460 /* Start corresponding slot asynchronously: */461 emit sigCloseRuntimeUI();462 }463 464 458 UIMachineLogic* UISession::machineLogic() const 465 459 { … … 618 612 void UISession::sltCloseRuntimeUI() 619 613 { 620 /* First, we have to hide any opened modal/popup widgets. 621 * They then should unlock their event-loops synchronously. 622 * If all such loops are unlocked, we can close Runtime UI: */ 623 if (QWidget *pWidget = QApplication::activeModalWidget() ? 624 QApplication::activeModalWidget() : 625 QApplication::activePopupWidget() ? 626 QApplication::activePopupWidget() : 0) 627 { 628 /* First we should try to close this widget: */ 629 pWidget->close(); 630 /* If widget rejected the 'close-event' we can 631 * still hide it and hope it will behave correctly 632 * and unlock his event-loop if any: */ 633 if (!pWidget->isHidden()) 634 pWidget->hide(); 635 /* Restart this slot: */ 636 emit sigCloseRuntimeUI(); 637 return; 638 } 639 640 /* Finally close the Runtime UI: */ 641 UIMachine::destroy(); 614 /* Ask UIMachine to close Runtime UI: */ 615 uimachine()->closeRuntimeUI(); 642 616 } 643 617 … … 1174 1148 { 1175 1149 connect(this, SIGNAL(sigInitialized()), this, SLOT(sltMarkInitialized())); 1176 connect(this, SIGNAL(sigCloseRuntimeUI()), this, SLOT(sltCloseRuntimeUI()));1177 1150 1178 1151 #ifdef Q_WS_MAC -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h
r55724 r57178 98 98 bool powerOff(bool fIncludingDiscard, bool &fServerCrashed); 99 99 bool restoreCurrentSnapshot(); 100 void closeRuntimeUI();101 100 102 101 /** Returns the session instance. */ … … 243 242 244 243 signals: 245 246 /* Notifier: Close Runtime UI stuff: */247 void sigCloseRuntimeUI();248 244 249 245 /** Notifies about frame-buffer resize. */ … … 300 296 void sltMarkInitialized() { m_fInitialized = true; } 301 297 302 /* Handler: Close Runtime UI stuff:*/298 /** Close Runtime UI. */ 303 299 void sltCloseRuntimeUI(); 304 300
Note:
See TracChangeset
for help on using the changeset viewer.