VirtualBox

Changeset 42872 in vbox for trunk/src


Ignore:
Timestamp:
Aug 18, 2012 12:54:44 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: 6234: Support for VM groups: Color palette fix.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.cpp

    r42832 r42872  
    4646    , m_iAnimationDuration(400)
    4747    , m_iDefaultDarkness(103)
     48    , m_iBlackoutDarkness(110)
    4849    , m_iHighlightDarkness(90)
    49     , m_iGradient(m_iDefaultDarkness)
     50    , m_iStrokeDarkness(130)
     51    , m_iAnimationDarkness(m_iDefaultDarkness)
    5052{
    5153    /* Basic item setup: */
     
    6769
    6870        /* Forward animation: */
    69         m_pForwardAnimation = new QPropertyAnimation(this, "gradient", this);
     71        m_pForwardAnimation = new QPropertyAnimation(this, "animationDarkness", this);
    7072        m_pForwardAnimation->setDuration(m_iAnimationDuration);
    7173        m_pForwardAnimation->setStartValue(m_iDefaultDarkness);
     
    7375
    7476        /* Backward animation: */
    75         m_pBackwardAnimation = new QPropertyAnimation(this, "gradient", this);
     77        m_pBackwardAnimation = new QPropertyAnimation(this, "animationDarkness", this);
    7678        m_pBackwardAnimation->setDuration(m_iAnimationDuration);
    7779        m_pBackwardAnimation->setStartValue(m_iHighlightDarkness);
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.h

    r42734 r42872  
    5252{
    5353    Q_OBJECT;
    54     Q_PROPERTY(int gradient READ gradient WRITE setGradient);
     54    Q_PROPERTY(int animationDarkness READ animationDarkness WRITE setAnimationDarkness);
    5555
    5656signals:
     
    140140
    141141    /* Hover stuff: */
    142     int gradient() const { return m_iGradient; }
    143     void setGradient(int iGradient) { m_iGradient = iGradient; update(); }
     142    void setAnimationDarkness(int iAnimationDarkness) { m_iAnimationDarkness = iAnimationDarkness; update(); }
     143
     144    /* Color stuff: */
     145    int defaultDarkness() const { return m_iDefaultDarkness; }
     146    int blackoutDarkness() const { return m_iBlackoutDarkness; }
     147    int highlightDarkness() const { return m_iHighlightDarkness; }
     148    int strokeDarkness() const { return m_iStrokeDarkness; }
     149    int animationDarkness() const { return m_iAnimationDarkness; }
     150    int dragTokenDarkness() const { return m_iDragTokenDarkness; }
    144151
    145152    /* Helpers: Text compression stuff: */
     
    162169    int m_iAnimationDuration;
    163170    int m_iDefaultDarkness;
     171    int m_iBlackoutDarkness;
    164172    int m_iHighlightDarkness;
    165     int m_iGradient;
     173    int m_iStrokeDarkness;
     174    int m_iAnimationDarkness;
     175    int m_iDragTokenDarkness;
    166176};
    167177
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp

    r42828 r42872  
    703703
    704704        /* Prepare body indent: */
    705         iPreviousVerticalIndent = 2 * iVerticalMargin + iFullHeaderHeight;
     705        iPreviousVerticalIndent = 3 * iVerticalMargin + iFullHeaderHeight;
    706706    }
    707707
     
    790790    if (!fClosedGroup)
    791791    {
    792         /* We should take into account: */
     792        /* We should take into account vertical indent: */
     793        iProposedHeight += iVerticalMargin;
     794        /* And every item height: */
    793795        QList<UIGChooserItem*> allItems = items();
    794796        for (int i = 0; i < allItems.size(); ++i)
    795797        {
    796             /* Every item height: */
    797798            UIGChooserItem *pItem = allItems[i];
    798799            iProposedHeight += (pItem->minimumHeightHint() + iMinorSpacing);
     
    10801081    /* Prepare color: */
    10811082    QPalette pal = palette();
    1082     QColor base = pal.color(QPalette::Active, model()->selectionList().contains(this) ?
    1083                             QPalette::Highlight : QPalette::Window);
     1083    QColor windowColor = pal.color(QPalette::Active, model()->selectionList().contains(this) ?
     1084                                   QPalette::Highlight : QPalette::Window);
     1085    QColor base(Qt::white);
    10841086
    10851087    /* Root item: */
     
    10901092        {
    10911093            /* Simple and clear: */
    1092             pPainter->fillRect(rect, base);
     1094            pPainter->fillRect(rect, base.darker(106));
    10931095        }
    10941096        else
     
    11131115            /* Fill background: */
    11141116            QLinearGradient headerGradient(backgroundRect.bottomLeft(), backgroundRect.topLeft());
    1115             headerGradient.setColorAt(0, base.darker(gradient()));
    1116             headerGradient.setColorAt(1, base.darker(110));
     1117            headerGradient.setColorAt(1, windowColor.darker(blackoutDarkness()));
     1118            headerGradient.setColorAt(0, windowColor.darker(animationDarkness()));
    11171119            pPainter->fillRect(backgroundRect, headerGradient);
    11181120
    11191121            /* Stroke path: */
    11201122            pPainter->setClipping(false);
    1121             pPainter->strokePath(path, base.darker(130));
     1123            pPainter->strokePath(path, windowColor.darker(strokeDarkness()));
    11221124        }
    11231125    }
     
    11491151        /* Prepare top gradient: */
    11501152        QLinearGradient tGradient(tRect.bottomLeft(), tRect.topLeft());
    1151         tGradient.setColorAt(0, base.darker(110));
    1152         tGradient.setColorAt(1, base.darker(gradient()));
     1153        tGradient.setColorAt(1, windowColor.darker(animationDarkness()));
     1154        tGradient.setColorAt(0, windowColor.darker(blackoutDarkness()));
    11531155        /* Fill top rectangle: */
    11541156        pPainter->fillRect(tRect, tGradient);
     
    11591161            QRect midRect = QRect(tRect.bottomLeft(), rect.bottomRight());
    11601162            /* Paint all the stuff: */
    1161             pPainter->fillRect(midRect, base.darker(110));
     1163            pPainter->fillRect(midRect, base.darker(defaultDarkness()));
    11621164        }
    11631165
    11641166         /* Stroke path: */
    11651167        pPainter->setClipping(false);
    1166         pPainter->strokePath(path, base.darker(130));
     1168        pPainter->strokePath(path, windowColor.darker(strokeDarkness()));
    11671169        pPainter->setClipPath(path);
    11681170
     
    11841186                dragTokenGradient.setFinalStop(dragTokenRect.bottomLeft());
    11851187            }
    1186             dragTokenGradient.setColorAt(0, base.darker(110));
    1187             dragTokenGradient.setColorAt(1, base.darker(150));
     1188            dragTokenGradient.setColorAt(0, windowColor.darker(blackoutDarkness()));
     1189            dragTokenGradient.setColorAt(1, windowColor.darker(dragTokenDarkness()));
    11881190            pPainter->fillRect(dragTokenRect, dragTokenGradient);
    11891191        }
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp

    r42828 r42872  
    556556        /* Prepare top gradient: */
    557557        QLinearGradient tGradient(tRect.bottomLeft(), tRect.topLeft());
    558         tGradient.setColorAt(0, highlight.darker(103));
    559         tGradient.setColorAt(1, highlight.darker(110));
     558        tGradient.setColorAt(1, highlight.darker(blackoutDarkness()));
     559        tGradient.setColorAt(0, highlight.darker(defaultDarkness()));
    560560        /* Prepare bottom gradient: */
    561561        QLinearGradient bGradient(bRect.topLeft(), bRect.bottomLeft());
    562         bGradient.setColorAt(0, highlight.darker(103));
    563         bGradient.setColorAt(1, highlight.darker(110));
     562        bGradient.setColorAt(0, highlight.darker(defaultDarkness()));
     563        bGradient.setColorAt(1, highlight.darker(blackoutDarkness()));
    564564
    565565        /* Paint all the stuff: */
    566         pPainter->fillRect(midRect, highlight.darker(103));
     566        pPainter->fillRect(midRect, highlight.darker(defaultDarkness()));
    567567        pPainter->fillRect(tRect, tGradient);
    568568        pPainter->fillRect(bRect, bGradient);
     
    573573    {
    574574        /* Choose color: */
    575         QColor baseLight = pal.color(QPalette::Active, model()->selectionList().contains(this) ||
    576                                                        model()->selectionList().contains(parentItem()) ?
    577                                                        QPalette::Highlight : QPalette::Window);
    578         QColor blurBase = pal.color(QPalette::Active, model()->selectionList().contains(this) ||
    579                                                       model()->selectionList().contains(parentItem()) ?
    580                                                       QPalette::Highlight : QPalette::Window);
    581         if (!parentItem()->isRoot())
    582             blurBase = blurBase.darker(110);
     575        QColor baseLight = model()->selectionList().contains(this) ? pal.color(QPalette::Active, QPalette::Highlight) :
     576                                                                     QColor(Qt::white);
     577        QColor blurBase = model()->selectionList().contains(this) ? pal.color(QPalette::Active, QPalette::Highlight) :
     578                                                                    QColor(Qt::white);
     579        if (!model()->selectionList().contains(this) && !parentItem()->isRoot())
     580            blurBase = blurBase.darker(defaultDarkness());
    583581        blurBase.setAlpha(0);
    584582
     
    589587        /* Add blur itself: */
    590588        QPainter blurPainter(&background);
    591         blurPainter.setBrush(baseLight.darker(gradient()));
     589        blurPainter.setBrush(baseLight.darker(animationDarkness()));
    592590        blurPainter.setPen(Qt::NoPen);
    593591        blurPainter.drawRoundedRect(rect.adjusted(5, 5, -5, -5), 5, 5);
     
    620618            dragTokenGradient.setFinalStop(dragTokenRect.bottomLeft());
    621619        }
    622         dragTokenGradient.setColorAt(0, base.darker(110));
    623         dragTokenGradient.setColorAt(1, base.darker(150));
     620        dragTokenGradient.setColorAt(0, base.darker(blackoutDarkness()));
     621        dragTokenGradient.setColorAt(1, base.darker(dragTokenDarkness()));
    624622        pPainter->fillRect(dragTokenRect, dragTokenGradient);
    625623    }
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.cpp

    r42802 r42872  
    3030    /* Fix palette: */
    3131    QPalette pal = palette();
    32     pal.setColor(QPalette::Base, pal.color(QPalette::Window));
     32    pal.setColor(QPalette::Base, QColor(Qt::white).darker(106));
    3333    setPalette(pal);
    3434
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp

    r42856 r42872  
    5454    , m_iDefaultDarkness(103)
    5555    , m_iHighlightDarkness(90)
    56     , m_iGradient(m_iDefaultDarkness)
     56    , m_iAnimationDarkness(m_iDefaultDarkness)
    5757{
    5858    /* Prepare element: */
     
    416416
    417417    /* Forward animation: */
    418     m_pForwardAnimation = new QPropertyAnimation(this, "gradient", this);
     418    m_pForwardAnimation = new QPropertyAnimation(this, "animationDarkness", this);
    419419    m_pForwardAnimation->setDuration(m_iAnimationDuration);
    420420    m_pForwardAnimation->setStartValue(m_iDefaultDarkness);
     
    422422
    423423    /* Backward animation: */
    424     m_pBackwardAnimation = new QPropertyAnimation(this, "gradient", this);
     424    m_pBackwardAnimation = new QPropertyAnimation(this, "animationDarkness", this);
    425425    m_pBackwardAnimation->setDuration(m_iAnimationDuration);
    426426    m_pBackwardAnimation->setStartValue(m_iHighlightDarkness);
     
    691691    QPalette pal = QApplication::palette();
    692692    QColor windowColor = pal.color(QPalette::Active, QPalette::Window);
     693    QColor base(Qt::white);
     694    base = base.darker(m_iDefaultDarkness);
    693695
    694696    /* Add clipping: */
     
    715717    QLinearGradient tGradient(tRect.bottomLeft(), tRect.topLeft());
    716718    tGradient.setColorAt(0, windowColor.darker(110));
    717     tGradient.setColorAt(1, windowColor.darker(gradient()));
     719    tGradient.setColorAt(1, windowColor.darker(animationDarkness()));
    718720
    719721    /* Paint all the stuff: */
    720722    pPainter->fillRect(tRect, tGradient);
    721     pPainter->fillRect(bRect, windowColor.darker(97));
     723    pPainter->fillRect(bRect, base);
    722724
    723725    /* Stroke path: */
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.h

    r42856 r42872  
    4545{
    4646    Q_OBJECT;
    47     Q_PROPERTY(int gradient READ gradient WRITE setGradient);
     47    Q_PROPERTY(int animationDarkness READ animationDarkness WRITE setAnimationDarkness);
    4848    Q_PROPERTY(int additionalHeight READ additionalHeight WRITE setAdditionalHeight);
    4949
     
    144144
    145145    /* Helpers: Hover stuff: */
    146     int gradient() const { return m_iGradient; }
    147     void setGradient(int iGradient) { m_iGradient = iGradient; update(); }
     146    int animationDarkness() const { return m_iAnimationDarkness; }
     147    void setAnimationDarkness(int iAnimationDarkness) { m_iAnimationDarkness = iAnimationDarkness; update(); }
    148148
    149149    /* Helpers: Animation stuff: */
     
    215215    int m_iDefaultDarkness;
    216216    int m_iHighlightDarkness;
    217     int m_iGradient;
     217    int m_iAnimationDarkness;
    218218};
    219219
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsView.cpp

    r42529 r42872  
    3030    /* Fix palette: */
    3131    QPalette pal = palette();
    32     pal.setColor(QPalette::Base, pal.color(QPalette::Window));
     32    pal.setColor(QPalette::Base, QColor(Qt::white).darker(106));
    3333    setPalette(pal);
    3434
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