VirtualBox

Changeset 47013 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 5, 2013 4:09:25 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Popup-pane: Encapsulation cleanup.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/widgets
Files:
2 edited

Legend:

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

    r47012 r47013  
    154154                        iTextPaneHeight);
    155155    m_pTextPane->layoutContent();
    156     /* Button-box: */
     156
     157    /* Button-pane: */
    157158    m_pButtonPane->move(m_iLayoutMargin + iTextPaneWidth + m_iLayoutSpacing,
    158159                        m_iLayoutMargin);
     
    163164void UIPopupPane::sltButtonClicked(int iButtonID)
    164165{
     166    /* Complete popup with corresponding code: */
    165167    done(iButtonID & AlertButtonMask);
    166168}
     
    168170void UIPopupPane::prepare()
    169171{
    170     /* Install 'hover' animation for 'opacity' property: */
    171     UIAnimation::installPropertyAnimation(this, "opacity", "defaultOpacity", "hoveredOpacity",
    172                                           SIGNAL(sigHoverEnter()), SIGNAL(sigHoverLeave()));
    173172    /* Prepare content: */
    174173    prepareContent();
     174    /* Prepare animation: */
     175    prepareAnimation();
    175176}
    176177
     
    179180    /* Prepare this: */
    180181    installEventFilter(this);
     182
    181183    /* Create message-label: */
    182184    m_pTextPane = new UIPopupPaneTextPane(this);
    183185    {
    184186        /* Prepare label: */
    185         connect(m_pTextPane, SIGNAL(sigSizeHintChanged()),
    186                 this, SIGNAL(sigSizeHintChanged()));
     187        connect(m_pTextPane, SIGNAL(sigSizeHintChanged()), this, SIGNAL(sigSizeHintChanged()));
    187188        m_pTextPane->installEventFilter(this);
    188189        m_pTextPane->setText(m_strMessage);
    189190        m_pTextPane->setProposeAutoConfirmation(m_fProposeAutoConfirmation);
    190191    }
     192
    191193    /* Create button-box: */
    192194    m_pButtonPane = new UIPopupPaneButtonPane(this);
    193195    {
    194196        /* Prepare button-box: */
    195         connect(m_pButtonPane, SIGNAL(sigButtonClicked(int)),
    196                 this, SLOT(sltButtonClicked(int)));
     197        connect(m_pButtonPane, SIGNAL(sigButtonClicked(int)), this, SLOT(sltButtonClicked(int)));
    197198        m_pButtonPane->installEventFilter(this);
    198199        m_pButtonPane->setButtons(m_buttonDescriptions);
     
    205206    setFocusProxy(m_pButtonPane);
    206207    m_pTextPane->setFocusProxy(m_pButtonPane);
     208}
     209
     210void UIPopupPane::prepareAnimation()
     211{
     212    /* Install 'hover' animation for 'opacity' property: */
     213    UIAnimation::installPropertyAnimation(this, "opacity", "defaultOpacity", "hoveredOpacity",
     214                                          SIGNAL(sigHoverEnter()), SIGNAL(sigHoverLeave()));
    207215}
    208216
     
    275283    painter.setRenderHint(QPainter::Antialiasing);
    276284
    277     /* Configure painter clipping: */
     285    /* Configure clipping: */
     286    configureClipping(rect, painter);
     287
     288    /* Paint background: */
     289    paintBackground(rect, painter);
     290}
     291
     292void UIPopupPane::configureClipping(const QRect &rect, QPainter &painter)
     293{
     294    /* Configure clipping: */
    278295    QPainterPath path;
    279296    int iDiameter = 6;
     
    289306    path.closeSubpath();
    290307    painter.setClipPath(path);
    291 
    292     /* Fill with background: */
     308}
     309
     310void UIPopupPane::paintBackground(const QRect &rect, QPainter &painter)
     311{
     312    /* Paint background: */
    293313    QColor currentColor(palette().color(QPalette::Window));
    294314    QColor newColor1(currentColor.red(), currentColor.green(), currentColor.blue(), opacity());
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPopupPane.h

    r47012 r47013  
    2828class UIPopupPaneButtonPane;
    2929
    30 /* Popup-pane prototype class: */
     30/* Popup-pane prototype: */
    3131class UIPopupPane : public QWidget
    3232{
     
    8484    void prepare();
    8585    void prepareContent();
     86    void prepareAnimation();
    8687
    8788    /* Handler: Event-filter stuff: */
     
    9091    /* Handler: Event stuff: */
    9192    void paintEvent(QPaintEvent *pEvent);
     93
     94    /* Helpers: Paint stuff: */
     95    void configureClipping(const QRect &rect, QPainter &painter);
     96    void paintBackground(const QRect &rect, QPainter &painter);
    9297
    9398    /* Helper: Complete stuff: */
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