void UIPopupCenter::showPopupStack(QWidget *pParent) { /* Make sure parent is set! */ AssertPtrReturnVoid(pParent); /* Make sure corresponding popup-stack *exists*: */ const QString strPopupStackID(popupStackID(pParent)); if (!m_stacks.contains(strPopupStackID)) return; /* Assign stack with passed parent: */ UIPopupStack *pPopupStack = m_stacks[strPopupStackID]; assignPopupStackParent(pPopupStack, pParent, m_stackTypes[strPopupStackID]); pPopupStack->show(); }
void UIPopupCenter::showPopupPane(QWidget *pParent, const QString &strPopupPaneID, const QString &strMessage, const QString &strDetails, int iButton1, int iButton2, const QString &strButtonText1, const QString &strButtonText2, bool fProposeAutoConfirmation) { /* Make sure at least one button is valid: */ if (iButton1 == 0 && iButton2 == 0) iButton1 = AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape; /* Check if popup-pane was auto-confirmed before: */ if (fProposeAutoConfirmation) { QStringList confirmedPopupList = vboxGlobal().virtualBox().GetExtraData(GUI_SuppressMessages).split(','); if (confirmedPopupList.contains(strPopupPaneID)) { int iResultCode = AlertOption_AutoConfirmed; if (iButton1 & AlertButtonOption_Default) iResultCode |= (iButton1 & AlertButtonMask); else if (iButton2 & AlertButtonOption_Default) iResultCode |= (iButton2 & AlertButtonMask); emit sigPopupPaneDone(strPopupPaneID, iResultCode); return; } } /* Make sure parent is always set! */ AssertMsg(pParent, ("Parent is NULL!")); if (!pParent) return; /* Looking for the corresponding popup-stack: */ QString strPopupStackID = pParent->metaObject()->className(); UIPopupStack *pPopupStack = 0; /* Is there already popup-stack with the same ID? */ if (m_stacks.contains(strPopupStackID)) { /* Get existing one: */ pPopupStack = m_stacks[strPopupStackID]; } /* There is no popup-stack with the same ID? */ else { /* Create new one: */ pPopupStack = m_stacks[strPopupStackID] = new UIPopupStack(pParent); /* Attach popup-stack connections: */ connect(pPopupStack, SIGNAL(sigPopupPaneDone(QString, int)), this, SLOT(sltPopupPaneDone(QString, int))); connect(pPopupStack, SIGNAL(sigRemove()), this, SLOT(sltRemovePopupStack())); /* Show popup-stack: */ pPopupStack->show(); } /* Looking for the corresponding popup-pane: */ if (pPopupStack->exists(strPopupPaneID)) { /* Update existing one: */ pPopupStack->updatePopupPane(strPopupPaneID, strMessage, strDetails); } else { /* Compose button description map: */ QMap<int, QString> buttonDescriptions; if (iButton1 != 0 && !buttonDescriptions.contains(iButton1)) buttonDescriptions[iButton1] = strButtonText1; if (iButton2 != 0 && !buttonDescriptions.contains(iButton2)) buttonDescriptions[iButton2] = strButtonText2; /* Create new one: */ pPopupStack->createPopupPane(strPopupPaneID, strMessage, strDetails, buttonDescriptions, fProposeAutoConfirmation); } }