VirtualBox

Ignore:
Timestamp:
Apr 24, 2013 1:09:42 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Popup-center: Popup-stack: Better encapsulation for the popup-pane create/update cases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupStack.cpp

    r45691 r45696  
    4040}
    4141
    42 void UIPopupStack::updatePopupPane(const QString &strPopupPaneID,
     42bool UIPopupStack::exists(const QString &strPopupPaneID) const
     43{
     44    /* Is there already popup-pane with the same ID? */
     45    return m_panes.contains(strPopupPaneID);
     46}
     47
     48void UIPopupStack::createPopupPane(const QString &strPopupPaneID,
    4349                                   const QString &strMessage, const QString &strDetails,
    4450                                   const QMap<int, QString> &buttonDescriptions,
    4551                                   bool fProposeAutoConfirmation)
    4652{
    47     /* Looking for the corresponding popup-pane: */
    48     UIPopupPane *pPopupPane = 0;
    49     /* Is there already popup-pane with the same ID? */
     53    /* Make sure there is no such popup-pane already: */
    5054    if (m_panes.contains(strPopupPaneID))
    5155    {
    52         /* Get existing one: */
    53         pPopupPane = m_panes[strPopupPaneID];
    54         /* Update message and details: */
    55         pPopupPane->setMessage(strMessage);
    56         pPopupPane->setDetails(strDetails);
    57     }
    58     /* There is no popup-pane with the same ID? */
    59     else
    60     {
    61         /* Create new one: */
    62         pPopupPane = m_panes[strPopupPaneID] = new UIPopupPane(this,
    63                                                                strMessage, strDetails,
    64                                                                buttonDescriptions,
    65                                                                fProposeAutoConfirmation);
    66         /* Attach popup-pane connection: */
    67         connect(pPopupPane, SIGNAL(sigSizeHintChanged()), this, SLOT(sltAdjustGeometry()));
    68         connect(pPopupPane, SIGNAL(sigDone(int)), this, SLOT(sltPopupPaneDone(int)));
    69         /* Show popup-pane: */
    70         pPopupPane->show();
    71     }
     56        AssertMsgFailed(("Popup-pane already exists!"));
     57        return;
     58    }
     59
     60    /* Create new popup-pane: */
     61    UIPopupPane *pPopupPane = m_panes[strPopupPaneID] = new UIPopupPane(this,
     62                                                                        strMessage, strDetails,
     63                                                                        buttonDescriptions,
     64                                                                        fProposeAutoConfirmation);
     65    /* Attach popup-pane connection: */
     66    connect(pPopupPane, SIGNAL(sigSizeHintChanged()), this, SLOT(sltAdjustGeometry()));
     67    connect(pPopupPane, SIGNAL(sigDone(int)), this, SLOT(sltPopupPaneDone(int)));
     68    /* Show popup-pane: */
     69    pPopupPane->show();
     70
     71    /* Propagate desired width: */
     72    setDesiredWidth(parentWidget()->width());
     73    /* Adjust geometry: */
     74    sltAdjustGeometry();
     75}
     76
     77void UIPopupStack::updatePopupPane(const QString &strPopupPaneID,
     78                                   const QString &strMessage, const QString &strDetails)
     79{
     80    /* Make sure there is such popup-pane already: */
     81    if (!m_panes.contains(strPopupPaneID))
     82    {
     83        AssertMsgFailed(("Popup-pane doesn't exists!"));
     84        return;
     85    }
     86
     87    /* Get existing popup-pane: */
     88    UIPopupPane *pPopupPane = m_panes[strPopupPaneID];
     89    /* Update message and details: */
     90    pPopupPane->setMessage(strMessage);
     91    pPopupPane->setDetails(strDetails);
    7292
    7393    /* Propagate desired width: */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette