Changeset 71375 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 19, 2018 3:29:54 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 121332
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.cpp
r71373 r71375 21 21 22 22 /* GUI includes: */ 23 # include "VBoxGlobal.h"24 # include "UIMachine.h"25 23 # include "UIModalWindowManager.h" 26 24 # ifdef VBOX_GUI_WITH_NETWORK_MANAGER … … 29 27 # endif 30 28 # include "UIProgressDialog.h" 31 # include "UISelectorWindow.h"32 29 33 30 /* Other VBox includes: */ … … 70 67 71 68 UIModalWindowManager::UIModalWindowManager() 69 : m_pMainWindowShown(0) 72 70 { 73 71 /* Assign instance: */ … … 79 77 /* Unassign instance: */ 80 78 s_pInstance = 0; 81 }82 83 QWidget *UIModalWindowManager::mainWindowShown() const84 {85 /* It may happen that this method is called before VBoxGlobal initialization86 * or after initialization had failed (for example, to show some message).87 * Return NULL pointer in such cases: */88 if (!VBoxGlobal::instance() || !vboxGlobal().isValid())89 return 0;90 91 /* For VM console process: */92 if (vboxGlobal().isVMConsoleProcess())93 {94 /* It will be currently active machine-window if visible: */95 if (gpMachine &&96 gpMachine->activeWindow() &&97 gpMachine->activeWindow()->isVisible())98 return gpMachine->activeWindow();99 }100 /* For VM selector process: */101 else102 {103 /* It will be the selector window if visible: */104 if (gpSelectorWindow &&105 gpSelectorWindow->isVisible())106 return gpSelectorWindow;107 }108 109 /* NULL by default: */110 return 0;111 79 } 112 80 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.h
r71373 r71375 52 52 void registerNewParent(QWidget *pWindow, QWidget *pParentWindow = 0); 53 53 54 /** Returns main application window. */ 55 QWidget *mainWindowShown() const; 54 /** Defines the main application @a pWindow shown. */ 55 void setMainWindowShown(QWidget *pWindow) { m_pMainWindowShown = pWindow; } 56 /** Returns the main application window shown. */ 57 QWidget *mainWindowShown() const { return m_pMainWindowShown; } 56 58 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER 57 59 /** Returns network manager or main window shown. */ … … 80 82 QList<QList<QWidget*> > m_windows; 81 83 84 /** Holds the main application window shown. */ 85 QWidget *m_pMainWindowShown; 86 82 87 /** Holds the static singleton instance. */ 83 88 static UIModalWindowManager *s_pInstance; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r71374 r71375 260 260 } 261 261 262 bool UIMachineWindow::event(QEvent *pEvent) 263 { 264 /* Call to base-class: */ 265 const bool fResult = QIWithRetranslateUI2<QMainWindow>::event(pEvent); 266 267 /* Handle particular events: */ 268 switch (pEvent->type()) 269 { 270 case QEvent::WindowActivate: 271 { 272 /* Initiate registration in the modal window manager: */ 273 windowManager().setMainWindowShown(this); 274 break; 275 } 276 default: 277 break; 278 } 279 280 /* Return result: */ 281 return fResult; 282 } 283 262 284 void UIMachineWindow::showEvent(QShowEvent *pEvent) 263 285 { … … 265 287 QMainWindow::showEvent(pEvent); 266 288 289 /* Initiate registration in the modal window manager: */ 290 windowManager().setMainWindowShown(this); 291 267 292 /* Update appearance for indicator-pool: */ 268 293 updateAppearanceOf(UIVisualElement_IndicatorPoolStuff); 294 } 295 296 void UIMachineWindow::hideEvent(QHideEvent *pEvent) 297 { 298 /* Update registration in the modal window manager: */ 299 if (windowManager().mainWindowShown() == this) 300 { 301 if (machineLogic()->activeMachineWindow()) 302 windowManager().setMainWindowShown(machineLogic()->activeMachineWindow()); 303 else 304 windowManager().setMainWindowShown(machineLogic()->mainMachineWindow()); 305 } 306 307 /* Call to base-class: */ 308 QMainWindow::hideEvent(pEvent); 269 309 } 270 310 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h
r71374 r71375 35 35 /* Forward declarations: */ 36 36 class QCloseEvent; 37 class QEvent; 38 class QHideEvent; 37 39 class QGridLayout; 38 40 class QShowEvent; … … 126 128 void retranslateUi(); 127 129 130 /** Handles any Qt @a pEvent. */ 131 virtual bool event(QEvent *pEvent) /* override */; 132 128 133 /** Handles show @a pEvent. */ 129 134 virtual void showEvent(QShowEvent *pEvent) /* override */; 135 /** Handles hide @a pEvent. */ 136 virtual void hideEvent(QHideEvent *pEvent) /* override */; 130 137 131 138 /** Close event handler. */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r70756 r71375 97 97 /* Show selector-window: */ 98 98 m_spInstance->show(); 99 /* Register in the modal window manager: */ 100 windowManager().setMainWindowShown(m_spInstance); 99 101 } 100 102 … … 105 107 AssertPtrReturnVoid(m_spInstance); 106 108 109 /* Unregister in the modal window manager: */ 110 windowManager().setMainWindowShown(0); 107 111 /* Cleanup selector-window: */ 108 112 m_spInstance->cleanup();
Note:
See TracChangeset
for help on using the changeset viewer.