VirtualBox

Changeset 74977 in vbox


Ignore:
Timestamp:
Oct 22, 2018 5:45:47 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
125999
Message:

FE/Qt: bugref:9241: VirtualBox Manager: Chooser & Tools panes: Glass-light animation.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp

    r74878 r74977  
    4242UIChooserItemGlobal::UIChooserItemGlobal(UIChooserItem *pParent,
    4343                                         int iPosition /* = -1 */)
    44     : UIChooserItem(pParent, pParent->isTemporary())
     44    : UIChooserItem(pParent, pParent->isTemporary(), 0, 100)
    4545    , m_iDefaultLightnessMin(0)
    4646    , m_iDefaultLightnessMax(0)
     
    7575                                         UIChooserItemGlobal * ,
    7676                                         int iPosition /* = -1 */)
    77     : UIChooserItem(pParent, pParent->isTemporary())
     77    : UIChooserItem(pParent, pParent->isTemporary(), 0, 100)
    7878    , m_iDefaultLightnessMin(0)
    7979    , m_iDefaultLightnessMax(0)
     
    594594        bgGrad.setColorAt(1, backgroundColor.lighter(m_iHighlightLightnessMin));
    595595        pPainter->fillRect(rectangle, bgGrad);
     596
     597        if (isHovered())
     598        {
     599            /* Prepare color: */
     600            QColor animationColor1 = QColor(Qt::white);
     601            QColor animationColor2 = QColor(Qt::white);
     602#ifdef VBOX_WS_MAC
     603            animationColor1.setAlpha(90);
     604#else
     605            animationColor1.setAlpha(30);
     606#endif
     607            animationColor2.setAlpha(0);
     608            /* Draw hovering animated gradient: */
     609            QRect animatedRect = rectangle;
     610            animatedRect.setWidth(animatedRect.height());
     611            const int iLength = 2 * animatedRect.width() + rectangle.width();
     612            const int iShift = - animatedRect.width() + iLength * animatedValue() / 100;
     613            animatedRect.moveLeft(iShift);
     614            QLinearGradient bgAnimatedGrad(animatedRect.topLeft(), animatedRect.bottomRight());
     615            bgAnimatedGrad.setColorAt(0,   animationColor2);
     616            bgAnimatedGrad.setColorAt(0.1, animationColor2);
     617            bgAnimatedGrad.setColorAt(0.5, animationColor1);
     618            bgAnimatedGrad.setColorAt(0.9, animationColor2);
     619            bgAnimatedGrad.setColorAt(1,   animationColor2);
     620            pPainter->fillRect(rectangle, bgAnimatedGrad);
     621        }
    596622    }
    597623    /* Hovering background: */
     
    605631        bgGrad.setColorAt(1, backgroundColor.lighter(m_iHoverLightnessMin));
    606632        pPainter->fillRect(rectangle, bgGrad);
     633
     634        /* Prepare color: */
     635        QColor animationColor1 = QColor(Qt::white);
     636        QColor animationColor2 = QColor(Qt::white);
     637#ifdef VBOX_WS_MAC
     638        animationColor1.setAlpha(120);
     639#else
     640        animationColor1.setAlpha(50);
     641#endif
     642        animationColor2.setAlpha(0);
     643        /* Draw hovering animated gradient: */
     644        QRect animatedRect = rectangle;
     645        animatedRect.setWidth(animatedRect.height());
     646        const int iLength = 2 * animatedRect.width() + rectangle.width();
     647        const int iShift = - animatedRect.width() + iLength * animatedValue() / 100;
     648        animatedRect.moveLeft(iShift);
     649        QLinearGradient bgAnimatedGrad(animatedRect.topLeft(), animatedRect.bottomRight());
     650        bgAnimatedGrad.setColorAt(0,   animationColor2);
     651        bgAnimatedGrad.setColorAt(0.1, animationColor2);
     652        bgAnimatedGrad.setColorAt(0.5, animationColor1);
     653        bgAnimatedGrad.setColorAt(0.9, animationColor2);
     654        bgAnimatedGrad.setColorAt(1,   animationColor2);
     655        pPainter->fillRect(rectangle, bgAnimatedGrad);
    607656    }
    608657    /* Default background: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp

    r74942 r74977  
    4848
    4949UIChooserItemMachine::UIChooserItemMachine(UIChooserItem *pParent,
    50                                              const CMachine &machine,
    51                                              int iPosition /* = -1 */)
    52     : UIChooserItem(pParent, pParent->isTemporary())
     50                                           const CMachine &machine,
     51                                           int iPosition /* = -1 */)
     52    : UIChooserItem(pParent, pParent->isTemporary(), 0, 100)
    5353    , UIVirtualMachineItem(machine)
    5454    , m_iDefaultLightnessMin(0)
     
    8686
    8787UIChooserItemMachine::UIChooserItemMachine(UIChooserItem *pParent,
    88                                              UIChooserItemMachine *pCopyFrom,
    89                                              int iPosition /* = -1 */)
    90     : UIChooserItem(pParent, pParent->isTemporary())
     88                                           UIChooserItemMachine *pCopyFrom,
     89                                           int iPosition /* = -1 */)
     90    : UIChooserItem(pParent, pParent->isTemporary(), 0, 100)
    9191    , UIVirtualMachineItem(pCopyFrom->machine())
    9292    , m_iDefaultLightnessMin(0)
     
    961961        bgGrad.setColorAt(1, backgroundColor.lighter(m_iHighlightLightnessMin));
    962962        pPainter->fillRect(rectangle, bgGrad);
     963
     964        if (isHovered())
     965        {
     966            /* Prepare color: */
     967            QColor animationColor1 = QColor(Qt::white);
     968            QColor animationColor2 = QColor(Qt::white);
     969#ifdef VBOX_WS_MAC
     970            animationColor1.setAlpha(90);
     971#else
     972            animationColor1.setAlpha(30);
     973#endif
     974            animationColor2.setAlpha(0);
     975            /* Draw hovering animated gradient: */
     976            QRect animatedRect = rectangle;
     977            animatedRect.setWidth(animatedRect.height());
     978            const int iLength = 2 * animatedRect.width() + rectangle.width();
     979            const int iShift = - animatedRect.width() + iLength * animatedValue() / 100;
     980            animatedRect.moveLeft(iShift);
     981            QLinearGradient bgAnimatedGrad(animatedRect.topLeft(), animatedRect.bottomRight());
     982            bgAnimatedGrad.setColorAt(0,   animationColor2);
     983            bgAnimatedGrad.setColorAt(0.1, animationColor2);
     984            bgAnimatedGrad.setColorAt(0.5, animationColor1);
     985            bgAnimatedGrad.setColorAt(0.9, animationColor2);
     986            bgAnimatedGrad.setColorAt(1,   animationColor2);
     987            pPainter->fillRect(rectangle, bgAnimatedGrad);
     988        }
    963989    }
    964990    /* Hovering background: */
     
    972998        bgGrad.setColorAt(1, backgroundColor.lighter(m_iHoverLightnessMin));
    973999        pPainter->fillRect(rectangle, bgGrad);
     1000
     1001        /* Prepare color: */
     1002        QColor animationColor1 = QColor(Qt::white);
     1003        QColor animationColor2 = QColor(Qt::white);
     1004#ifdef VBOX_WS_MAC
     1005        animationColor1.setAlpha(120);
     1006#else
     1007        animationColor1.setAlpha(50);
     1008#endif
     1009        animationColor2.setAlpha(0);
     1010        /* Draw hovering animated gradient: */
     1011        QRect animatedRect = rectangle;
     1012        animatedRect.setWidth(animatedRect.height());
     1013        const int iLength = 2 * animatedRect.width() + rectangle.width();
     1014        const int iShift = - animatedRect.width() + iLength * animatedValue() / 100;
     1015        animatedRect.moveLeft(iShift);
     1016        QLinearGradient bgAnimatedGrad(animatedRect.topLeft(), animatedRect.bottomRight());
     1017        bgAnimatedGrad.setColorAt(0,   animationColor2);
     1018        bgAnimatedGrad.setColorAt(0.1, animationColor2);
     1019        bgAnimatedGrad.setColorAt(0.5, animationColor1);
     1020        bgAnimatedGrad.setColorAt(0.9, animationColor2);
     1021        bgAnimatedGrad.setColorAt(1,   animationColor2);
     1022        pPainter->fillRect(rectangle, bgAnimatedGrad);
    9741023    }
    9751024    /* Default background: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.cpp

    r74962 r74977  
    192192    , m_pHoveringAnimationBackward(0)
    193193    , m_iAnimationDuration(400)
    194     , m_iDefaultValue(100)
    195     , m_iHoveredValue(90)
     194    , m_iDefaultValue(0)
     195    , m_iHoveredValue(100)
    196196    , m_iAnimatedValue(m_iDefaultValue)
    197197    , m_iDefaultLightnessMin(0)
     
    714714        bgGrad.setColorAt(1, backgroundColor.lighter(m_iHighlightLightnessMin));
    715715        pPainter->fillRect(rectangle, bgGrad);
     716
     717        if (isEnabled() && isHovered())
     718        {
     719            /* Prepare color: */
     720            QColor animationColor1 = QColor(Qt::white);
     721            QColor animationColor2 = QColor(Qt::white);
     722#ifdef VBOX_WS_MAC
     723            animationColor1.setAlpha(90);
     724#else
     725            animationColor1.setAlpha(30);
     726#endif
     727            animationColor2.setAlpha(0);
     728            /* Draw hovering animated gradient: */
     729            QRect animatedRect = rectangle;
     730            animatedRect.setWidth(animatedRect.height());
     731            const int iLength = 2 * animatedRect.width() + rectangle.width();
     732            const int iShift = - animatedRect.width() + iLength * animatedValue() / 100;
     733            animatedRect.moveLeft(iShift);
     734            QLinearGradient bgAnimatedGrad(animatedRect.topLeft(), animatedRect.bottomRight());
     735            bgAnimatedGrad.setColorAt(0,   animationColor2);
     736            bgAnimatedGrad.setColorAt(0.1, animationColor2);
     737            bgAnimatedGrad.setColorAt(0.5, animationColor1);
     738            bgAnimatedGrad.setColorAt(0.9, animationColor2);
     739            bgAnimatedGrad.setColorAt(1,   animationColor2);
     740            pPainter->fillRect(rectangle, bgAnimatedGrad);
    716741        }
     742    }
    717743    /* Hovering background: */
    718744    else if (isHovered())
     
    727753        bgGrad.setColorAt(1, backgroundColor.lighter(m_iHoverLightnessMin));
    728754        pPainter->fillRect(rectangle, bgGrad);
     755
     756        if (isEnabled())
     757        {
     758            /* Prepare color: */
     759            QColor animationColor1 = QColor(Qt::white);
     760            QColor animationColor2 = QColor(Qt::white);
     761#ifdef VBOX_WS_MAC
     762            animationColor1.setAlpha(120);
     763#else
     764            animationColor1.setAlpha(50);
     765#endif
     766            animationColor2.setAlpha(0);
     767            /* Draw hovering animated gradient: */
     768            QRect animatedRect = rectangle;
     769            animatedRect.setWidth(animatedRect.height());
     770            const int iLength = 2 * animatedRect.width() + rectangle.width();
     771            const int iShift = - animatedRect.width() + iLength * animatedValue() / 100;
     772            animatedRect.moveLeft(iShift);
     773            QLinearGradient bgAnimatedGrad(animatedRect.topLeft(), animatedRect.bottomRight());
     774            bgAnimatedGrad.setColorAt(0,   animationColor2);
     775            bgAnimatedGrad.setColorAt(0.1, animationColor2);
     776            bgAnimatedGrad.setColorAt(0.5, animationColor1);
     777            bgAnimatedGrad.setColorAt(0.9, animationColor2);
     778            bgAnimatedGrad.setColorAt(1,   animationColor2);
     779            pPainter->fillRect(rectangle, bgAnimatedGrad);
    729780        }
     781    }
    730782    /* Default background: */
    731783    else
Note: See TracChangeset for help on using the changeset viewer.

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