VirtualBox

Changeset 45586 in vbox for trunk


Ignore:
Timestamp:
Apr 17, 2013 12:53:04 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Popup-center, popup-pane: Implementing main framework stuff (part 5).

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp

    r45523 r45586  
    141141                                 const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3) const
    142142{
    143     /* Choose at least one button by 'default': */
    144     if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0)
    145         iButton1 = AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape;
    146 
    147     /* Create popup-box window: */
    148     QWidget *pPopupBoxParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
    149     UIPopupPane *pPopupBox = new UIPopupPane(pPopupBoxParent, strId,
    150                                              strMessage, strDetails,
    151                                              iButton1, iButton2, iButton3,
    152                                              strButtonText1, strButtonText2, strButtonText3);
    153     m_popups.insert(strId, pPopupBox);
    154     connect(pPopupBox, SIGNAL(sigDone(int)), this, SLOT(sltPopupDone(int)));
    155     pPopupBox->show();
     143    /* Prepare popup-pane: */
     144    UIPopupPane *pPopupPane = 0;
     145    /* Is there already popup-pane with the same ID? */
     146    if (m_popups.contains(strId))
     147    {
     148        /* Get existing one: */
     149        pPopupPane = m_popups[strId];
     150        /* And update message and details: */
     151        pPopupPane->setMessage(strMessage);
     152        pPopupPane->setDetails(strDetails);
     153    }
     154    /* There is no popup-pane with the same ID? */
     155    else
     156    {
     157        /* Choose at least one button to be the 'default' and 'escape': */
     158        if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0)
     159            iButton1 = AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape;
     160        /* Create popup-pane and insert it into our map: */
     161        QWidget *pPopupBoxParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
     162        pPopupPane = new UIPopupPane(pPopupBoxParent, strId,
     163                                     strMessage, strDetails,
     164                                     iButton1, iButton2, iButton3,
     165                                     strButtonText1, strButtonText2, strButtonText3);
     166        m_popups.insert(strId, pPopupPane);
     167        /* Attach popup-pane connections: */
     168        connect(pPopupPane, SIGNAL(sigDone(int)), this, SLOT(sltPopupDone(int)));
     169    }
     170    /* Show popup-pane: */
     171    pPopupPane->show();
    156172}
    157173
     
    182198    if (fSupportsAbsolute)
    183199    {
    184         alert(0, QString("remindAboutMouseIntegrationOn"),
     200        alert(0, QString("remindAboutMouseIntegration"),
    185201              tr("<p>The Virtual Machine reports that the guest OS supports <b>mouse pointer integration</b>. "
    186202                 "This means that you do not need to <i>capture</i> the mouse pointer to be able to use it in your guest OS -- "
     
    195211    else
    196212    {
    197         alert(0, QString("remindAboutMouseIntegrationOff"),
     213        alert(0, QString("remindAboutMouseIntegration"),
    198214              tr("<p>The Virtual Machine reports that the guest OS does not support <b>mouse pointer integration</b> "
    199215                 "in the current video mode. You need to capture the mouse (by clicking over the VM display "
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.cpp

    r45523 r45586  
    5050    /* State-machine 'forward' animation: */
    5151    QPropertyAnimation *pForwardAnimation = new QPropertyAnimation(pParent, strPropertyName, pParent);
     52    pForwardAnimation->setEasingCurve(QEasingCurve(QEasingCurve::InOutCubic));
    5253    pForwardAnimation->setDuration(iAnimationDuration);
    5354    pForwardAnimation->setStartValue(iStartValue);
     
    5556    /* State-machine 'backward' animation: */
    5657    QPropertyAnimation *pBackwardAnimation = new QPropertyAnimation(pParent, strPropertyName, pParent);
     58    pBackwardAnimation->setEasingCurve(QEasingCurve(QEasingCurve::InOutCubic));
    5759    pBackwardAnimation->setDuration(iAnimationDuration);
    5860    pBackwardAnimation->setStartValue(iFinalValue);
     
    189191    /* Cleanup: */
    190192    cleanup();
     193}
     194
     195void UIPopupPane::setMessage(const QString &strMessage)
     196{
     197    /* Make sure somthing changed: */
     198    if (m_strMessage == strMessage)
     199        return;
     200
     201    /* Fetch new message: */
     202    m_strMessage = strMessage;
     203    m_pTextPane->setText(m_strMessage);
     204}
     205
     206void UIPopupPane::setDetails(const QString &strDetails)
     207{
     208    /* Make sure somthing changed: */
     209    if (m_strDetails == strDetails)
     210        return;
     211
     212    /* Fetch new details: */
     213    m_strDetails = strDetails;
    191214}
    192215
     
    579602    /* Configure painter clipping: */
    580603    QPainterPath path;
    581     int iDiameter = 5;
     604    int iDiameter = 6;
    582605    QSizeF arcSize(2 * iDiameter, 2 * iDiameter);
    583606    path.moveTo(iDiameter, 0);
     
    594617    /* Fill with background: */
    595618    QColor currentColor(palette().color(QPalette::Window));
    596     QColor newColor(currentColor.red(), currentColor.green(), currentColor.blue(), opacity());
    597     painter.fillRect(rect, newColor);
     619    QColor newColor1(currentColor.red(), currentColor.green(), currentColor.blue(), opacity());
     620    QColor newColor2 = newColor1.darker(115);
     621    QLinearGradient headerGradient(rect.topLeft(), rect.topRight());
     622    headerGradient.setColorAt(0, newColor1);
     623    headerGradient.setColorAt(1, newColor2);
     624    painter.fillRect(rect, headerGradient);
    598625}
    599626
     
    678705            pMainLayout->addWidget(m_pLabel);
    679706            /* Prepare label: */
     707            QFont currentFont = m_pLabel->font();
     708            currentFont.setPointSize(currentFont.pointSize() - 2);
     709            m_pLabel->setFont(currentFont);
    680710            m_pLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    681711            m_pLabel->setWordWrap(true);
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.h

    r45523 r45586  
    6868    /* API: Id stuff: */
    6969    const QString& id() const { return m_strId; }
     70
     71    /* API: Text stuff: */
     72    void setMessage(const QString &strMessage);
     73    void setDetails(const QString &strDetails);
    7074
    7175private slots:
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