Changeset 46976 in vbox
- Timestamp:
- Jul 4, 2013 10:26:22 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86984
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp
r45939 r46976 41 41 /* Create instance: */ 42 42 new UIPopupCenter; 43 /* Prepare instance: */ 44 m_spInstance->prepare(); 43 45 } 44 46 … … 68 70 } 69 71 72 void UIPopupCenter::prepare() 73 { 74 /* Embedded by default: */ 75 m_type = UIPopupIntegrationType_Embedded; 76 } 77 70 78 void UIPopupCenter::cleanup() 71 79 { … … 76 84 m_stacks.remove(strPopupStackID); 77 85 } 86 } 87 88 void UIPopupCenter::setStackIntegrationType(UIPopupIntegrationType type) 89 { 90 /* Make sure type changed: */ 91 if (m_type == type) 92 return; 93 94 /* Assign new type: */ 95 m_type = type; 78 96 } 79 97 … … 229 247 return; 230 248 231 /* Install stack topassed parent: */249 /* Assign stack with passed parent: */ 232 250 UIPopupStack *pPopupStack = m_stacks[strPopupStackID]; 233 pParent->installEventFilter(pPopupStack); 234 pPopupStack->setParent(pParent); 251 assignPopupStackParent(pPopupStack, pParent); 235 252 pPopupStack->show(); 236 253 } … … 250 267 return; 251 268 252 /* Un install stack frompassed parent: */269 /* Unassign stack with passed parent: */ 253 270 UIPopupStack *pPopupStack = m_stacks[strPopupStackID]; 254 271 pPopupStack->hide(); 272 unassignPopupStackParent(pPopupStack, pParent); 273 } 274 275 void UIPopupCenter::assignPopupStackParent(UIPopupStack *pPopupStack, QWidget *pParent) 276 { 277 /* Make sure parent is not NULL: */ 278 AssertMsg(pParent, ("Invalid parent passed!")); 279 280 /* Assign event-filter: */ 281 pParent->installEventFilter(pPopupStack); 282 283 /* Assign parent depending on *integration* type: */ 284 switch (m_type) 285 { 286 case UIPopupIntegrationType_Embedded: 287 { 288 pPopupStack->setParent(pParent); 289 break; 290 } 291 case UIPopupIntegrationType_Toplevel: 292 { 293 pPopupStack->setParent(pParent, Qt::Window | Qt::FramelessWindowHint); 294 break; 295 } 296 default: break; 297 } 298 } 299 300 void UIPopupCenter::unassignPopupStackParent(UIPopupStack *pPopupStack, QWidget *pParent) 301 { 302 /* Make sure parent is not NULL: */ 303 AssertMsg(pParent, ("Invalid parent passed!")); 304 305 /* Unassign parent: */ 255 306 pPopupStack->setParent(0); 307 308 /* Unassign event-filter: */ 256 309 pParent->removeEventFilter(pPopupStack); 257 310 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.h
r45939 r46976 29 29 class UIPopupStack; 30 30 31 /* Popup integration types: */ 32 enum UIPopupIntegrationType 33 { 34 UIPopupIntegrationType_Embedded, 35 UIPopupIntegrationType_Toplevel 36 }; 37 31 38 /* Popup-center singleton: */ 32 39 class UIPopupCenter: public QObject … … 44 51 static void create(); 45 52 static void destroy(); 53 54 /* API: Stack layout stuff: */ 55 void setStackIntegrationType(UIPopupIntegrationType type); 46 56 47 57 /* API: Main message function. … … 104 114 ~UIPopupCenter(); 105 115 106 /* Helper: Cleanup stuff: */ 116 /* Helpers: Prepare/cleanup stuff: */ 117 void prepare(); 107 118 void cleanup(); 108 119 … … 117 128 void showPopupStack(QWidget *pParent); 118 129 void hidePopupStack(QWidget *pParent); 130 void assignPopupStackParent(UIPopupStack *pPopupStack, QWidget *pParent); 131 void unassignPopupStackParent(UIPopupStack *pPopupStack, QWidget *pParent); 119 132 120 133 /* Static helper: Popup-stack stuff: */ … … 122 135 123 136 /* Variable: Popup-stack stuff: */ 137 UIPopupIntegrationType m_type; 124 138 QMap<QString, QPointer<UIPopupStack> > m_stacks; 125 139 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp
r46813 r46976 535 535 { 536 536 /* Register popup-center connections: */ 537 connect(this, SIGNAL(sigMachineWi dnowsCreated()),537 connect(this, SIGNAL(sigMachineWindowsCreated()), 538 538 &popupCenter(), SLOT(sltShowPopupStack())); 539 connect(this, SIGNAL(sigMachineWi dnowsDestroyed()),539 connect(this, SIGNAL(sigMachineWindowsDestroyed()), 540 540 &popupCenter(), SLOT(sltHidePopupStack())); 541 541 } … … 544 544 { 545 545 /* Unregister popup-center connections: */ 546 disconnect(this, SIGNAL(sigMachineWi dnowsCreated()),546 disconnect(this, SIGNAL(sigMachineWindowsCreated()), 547 547 &popupCenter(), SLOT(sltShowPopupStack())); 548 disconnect(this, SIGNAL(sigMachineWi dnowsDestroyed()),548 disconnect(this, SIGNAL(sigMachineWindowsDestroyed()), 549 549 &popupCenter(), SLOT(sltHidePopupStack())); 550 550 } … … 561 561 /* We emit this signal *before* the remembering new value 562 562 * because we want UIMachineLogic::activeMachineWindow() to be yet alive. */ 563 emit sigMachineWi dnowsDestroyed();563 emit sigMachineWindowsDestroyed(); 564 564 } 565 565 … … 572 572 /* We emit this signal *after* the remembering new value 573 573 * because we want UIMachineLogic::activeMachineWindow() to be already alive. */ 574 emit sigMachineWi dnowsCreated();574 emit sigMachineWindowsCreated(); 575 575 } 576 576 } … … 649 649 # endif /* VBOX_WITH_ICHAT_THEATER */ 650 650 #endif /* Q_WS_MAC */ 651 652 /* Switch popup-center into default integration mode: */ 653 popupCenter().setStackIntegrationType(UIPopupIntegrationType_Embedded); 651 654 } 652 655 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h
r46599 r46976 56 56 57 57 /* Notifiers: Machine-window(s) stuff: */ 58 void sigMachineWi dnowsCreated();59 void sigMachineWi dnowsDestroyed();58 void sigMachineWindowsCreated(); 59 void sigMachineWindowsDestroyed(); 60 60 61 61 public: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
r46924 r46976 24 24 #include "VBoxGlobal.h" 25 25 #include "UIMessageCenter.h" 26 #include "UIPopupCenter.h" 26 27 #include "UISession.h" 27 28 #include "UIActionPoolRuntime.h" … … 112 113 } 113 114 115 void UIMachineLogicSeamless::prepareRequiredFeatures() 116 { 117 /* Call to base-class: */ 118 UIMachineLogic::prepareRequiredFeatures(); 119 120 /* Switch popup-center into 'top-level' integration mode: */ 121 popupCenter().setStackIntegrationType(UIPopupIntegrationType_Toplevel); 122 } 123 114 124 void UIMachineLogicSeamless::prepareActionGroups() 115 125 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.h
r44982 r46976 52 52 53 53 /* Prepare helpers: */ 54 void prepareRequiredFeatures(); 54 55 void prepareActionGroups(); 55 56 void prepareMachineWindows(); … … 60 61 void cleanupMachineWindows(); 61 62 void cleanupActionGroups(); 63 //void cleanupRequiredFeatures(); 62 64 63 65 /* Variables: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp
r45939 r46976 34 34 : m_iLayoutMargin(1), m_iLayoutSpacing(1) 35 35 { 36 #if defined(Q_WS_WIN) || defined (Q_WS_MAC) 37 /* Using Qt API to enable translucent background for the Win/Mac host. 38 * - Under x11 host Qt 4.8.3 has it broken wih KDE 4.9 for now: */ 39 setAttribute(Qt::WA_TranslucentBackground); 40 #endif /* Q_WS_WIN || Q_WS_MAC */ 36 41 } 37 42 … … 109 114 } 110 115 116 void UIPopupStack::setParent(QWidget *pParent, Qt::WindowFlags flags) 117 { 118 /* Call to base-class: */ 119 QWidget::setParent(pParent, flags); 120 /* Recalculate parent status-bar height: */ 121 m_iParentStatusBarHeight = parentStatusBarHeight(pParent); 122 } 123 111 124 void UIPopupStack::sltAdjustGeometry() 112 125 { … … 119 132 const int iHeight = minimumHeightHint(); 120 133 121 /* Move according parent: */ 122 move(0, parentWidget()->height() - iHeight - m_iParentStatusBarHeight); 123 /* Resize according parent: */ 124 resize(iWidth, iHeight); 134 /* Move/resize according parent: */ 135 setGeometry(0, parentWidget()->height() - iHeight - m_iParentStatusBarHeight, 136 iWidth, iHeight); 125 137 126 138 /* Layout content: */ -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.h
r45939 r46976 56 56 /* API: Parent stuff: */ 57 57 void setParent(QWidget *pParent); 58 void setParent(QWidget *pParent, Qt::WindowFlags flags); 58 59 59 60 private slots:
Note:
See TracChangeset
for help on using the changeset viewer.