VirtualBox

Changeset 74596 in vbox for trunk/src


Ignore:
Timestamp:
Oct 3, 2018 2:25:09 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9241: macOS: VirtualBox Manager: Sync global chooser item palette with main tool-bar palette.

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

Legend:

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

    r74578 r74596  
    441441                        m_pToolBar->setContextMenuPolicy(Qt::CustomContextMenu);
    442442                        m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
     443#ifdef VBOX_WS_MAC
     444                        m_pToolBar->emulateMacToolbar();
     445#endif
    443446
    444447                        /* Add tool-bar into layout: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp

    r74548 r74596  
    4343                                         int iPosition /* = -1 */)
    4444    : UIChooserItem(pParent, pParent->isTemporary())
    45     , m_iHoverLightness(0)
    46     , m_iHighlightLightness(0)
    47     , m_iHoverHighlightLightness(0)
     45    , m_iDefaultLightnessMin(0)
     46    , m_iDefaultLightnessMax(0)
     47    , m_iHoverLightnessMin(0)
     48    , m_iHoverLightnessMax(0)
     49    , m_iHighlightLightnessMin(0)
     50    , m_iHighlightLightnessMax(0)
    4851    , m_iMinimumNameWidth(0)
    4952    , m_iMaximumNameWidth(0)
     
    7376                                         int iPosition /* = -1 */)
    7477    : UIChooserItem(pParent, pParent->isTemporary())
    75     , m_iHoverLightness(0)
    76     , m_iHighlightLightness(0)
    77     , m_iHoverHighlightLightness(0)
     78    , m_iDefaultLightnessMin(0)
     79    , m_iDefaultLightnessMax(0)
     80    , m_iHoverLightnessMin(0)
     81    , m_iHoverLightnessMax(0)
     82    , m_iHighlightLightnessMin(0)
     83    , m_iHighlightLightnessMax(0)
    7884    , m_iMinimumNameWidth(0)
    7985    , m_iMaximumNameWidth(0)
     
    416422    /* Colors: */
    417423#ifdef VBOX_WS_MAC
    418     m_iHighlightLightness = 115;
    419     m_iHoverLightness = 110;
    420     m_iHoverHighlightLightness = 120;
     424    m_iHighlightLightnessMin = 105;
     425    m_iHighlightLightnessMax = 115;
     426    m_iHoverLightnessMin = 115;
     427    m_iHoverLightnessMax = 125;
     428    m_iDefaultLightnessMin = 125;
     429    m_iDefaultLightnessMax = 130;
    421430#else /* VBOX_WS_MAC */
    422     m_iHighlightLightness = 130;
    423     m_iHoverLightness = 155;
    424     m_iHoverHighlightLightness = 175;
     431    m_iHighlightLightnessMin = 130;
     432    m_iHighlightLightnessMax = 160;
     433    m_iHoverLightnessMin = 160;
     434    m_iHoverLightnessMax = 190;
     435    m_iDefaultLightnessMin = 160;
     436    m_iDefaultLightnessMax = 190;
    425437#endif /* !VBOX_WS_MAC */
    426438
     
    576588    {
    577589        /* Prepare color: */
    578         QColor highlight = pal.color(QPalette::Active, QPalette::Highlight);
     590        QColor backgroundColor = pal.color(QPalette::Active, QPalette::Highlight);
    579591        /* Draw gradient: */
    580592        QLinearGradient bgGrad(rectangle.topLeft(), rectangle.bottomLeft());
    581         bgGrad.setColorAt(0, highlight.lighter(m_iHighlightLightness));
    582         bgGrad.setColorAt(1, highlight);
     593        bgGrad.setColorAt(0, backgroundColor.lighter(m_iHighlightLightnessMax));
     594        bgGrad.setColorAt(1, backgroundColor.lighter(m_iHighlightLightnessMin));
    583595        pPainter->fillRect(rectangle, bgGrad);
    584596    }
     
    587599    {
    588600        /* Prepare color: */
    589         QColor highlight = pal.color(QPalette::Active, QPalette::Highlight);
     601        QColor backgroundColor = pal.color(QPalette::Active, QPalette::Highlight);
    590602        /* Draw gradient: */
    591603        QLinearGradient bgGrad(rectangle.topLeft(), rectangle.bottomLeft());
    592         bgGrad.setColorAt(0, highlight.lighter(m_iHoverHighlightLightness));
    593         bgGrad.setColorAt(1, highlight.lighter(m_iHoverLightness));
     604        bgGrad.setColorAt(0, backgroundColor.lighter(m_iHoverLightnessMax));
     605        bgGrad.setColorAt(1, backgroundColor.lighter(m_iHoverLightnessMin));
    594606        pPainter->fillRect(rectangle, bgGrad);
     607    }
     608    /* Default background: */
     609    else
     610    {
     611#ifdef VBOX_WS_MAC
     612        /* Prepare color: */
     613        QColor backgroundColor = pal.color(QPalette::Active, QPalette::Mid);
     614        /* Draw gradient: */
     615        QLinearGradient bgGrad(rectangle.topLeft(), rectangle.bottomLeft());
     616        bgGrad.setColorAt(0, backgroundColor.lighter(m_iDefaultLightnessMax));
     617        bgGrad.setColorAt(1, backgroundColor.lighter(m_iDefaultLightnessMin));
     618        pPainter->fillRect(rectangle, bgGrad);
     619#else
     620        /* Prepare color: */
     621        QColor backgroundColor = pal.color(QPalette::Active, QPalette::Mid);
     622        /* Draw gradient: */
     623        QLinearGradient bgGrad(rectangle.topLeft(), rectangle.bottomLeft());
     624        bgGrad.setColorAt(0, backgroundColor.lighter(m_iDefaultLightnessMax));
     625        bgGrad.setColorAt(1, backgroundColor.lighter(m_iDefaultLightnessMin));
     626        pPainter->fillRect(rectangle, bgGrad);
     627#endif
    595628    }
    596629
     
    619652    pPainter->setPen(pen);
    620653
    621     /* Draw rectangle: */
    622     pPainter->drawRect(rectangle);
     654    /* Draw borders: */
     655    pPainter->drawLine(rectangle.topLeft(),    rectangle.topRight()    + QPoint(1, 0));
     656    pPainter->drawLine(rectangle.bottomLeft(), rectangle.bottomRight() + QPoint(1, 0));
     657    pPainter->drawLine(rectangle.topLeft(),    rectangle.bottomLeft());
    623658
    624659    /* Restore painter: */
     
    647682        const QPalette pal = palette();
    648683        const QColor highlight = pal.color(QPalette::Active, QPalette::Highlight);
    649         const QColor hhl = highlight.lighter(m_iHoverHighlightLightness);
     684        const QColor hhl = highlight.lighter(m_iHoverLightnessMax);
    650685        if (hhl.value() - hhl.saturation() > 0)
    651686            pPainter->setPen(pal.color(QPalette::Active, QPalette::Text));
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.h

    r74482 r74596  
    226226    /** @name Item stuff.
    227227      * @{ */
    228         /** Holds item hover lightness. */
    229         int  m_iHoverLightness;
    230         /** Holds item highlight lightness. */
    231         int  m_iHighlightLightness;
    232         /** Holds item hover highlight lightness. */
    233         int  m_iHoverHighlightLightness;
     228        /** Holds item minimum default lightness. */
     229        int  m_iDefaultLightnessMin;
     230        /** Holds item maximum default lightness. */
     231        int  m_iDefaultLightnessMax;
     232        /** Holds item minimum hover lightness. */
     233        int  m_iHoverLightnessMin;
     234        /** Holds item maximum hover lightness. */
     235        int  m_iHoverLightnessMax;
     236        /** Holds item minimum highlight lightness. */
     237        int  m_iHighlightLightnessMin;
     238        /** Holds item maximum highlight lightness. */
     239        int  m_iHighlightLightnessMax;
    234240
    235241        /** Holds item pixmap. */
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