VirtualBox

Changeset 74599 in vbox for trunk/src/VBox


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

FE/Qt: bugref:9241: VirtualBox Manager: Sync tool item look&feel with chooser machine item.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools
Files:
4 edited

Legend:

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

    r74503 r74599  
    194194    , m_iHoveredValue(90)
    195195    , m_iAnimatedValue(m_iDefaultValue)
     196    , m_iDefaultLightnessMin(0)
     197    , m_iDefaultLightnessMax(0)
    196198    , m_iHoverLightnessMin(0)
    197199    , m_iHoverLightnessMax(0)
     
    433435    m_iHighlightLightnessMin = 105;
    434436    m_iHighlightLightnessMax = 115;
    435     m_iHoverLightnessMin = 110;
    436     m_iHoverLightnessMax = 120;
     437    m_iHoverLightnessMin = 115;
     438    m_iHoverLightnessMax = 125;
     439    m_iDefaultLightnessMin = 145;
     440    m_iDefaultLightnessMax = 155;
    437441#else /* VBOX_WS_MAC */
    438442    m_iHighlightLightnessMin = 130;
     
    440444    m_iHoverLightnessMin = 160;
    441445    m_iHoverLightnessMax = 190;
     446    m_iDefaultLightnessMin = 160;
     447    m_iDefaultLightnessMax = 190;
    442448#endif /* !VBOX_WS_MAC */
    443449
     
    730736        /* Draw gradient: */
    731737        QLinearGradient bgGrad(rectangle.topLeft(), rectangle.bottomLeft());
    732         bgGrad.setColorAt(0, backgroundColor.lighter(m_iHoverLightnessMax));
    733         bgGrad.setColorAt(1, backgroundColor.lighter(m_iHoverLightnessMin));
     738        bgGrad.setColorAt(0, backgroundColor.lighter(m_iDefaultLightnessMax));
     739        bgGrad.setColorAt(1, backgroundColor.lighter(m_iDefaultLightnessMin));
    734740        pPainter->fillRect(rectangle, bgGrad);
    735741    }
     
    756762    /* Default frame: */
    757763    else
    758         strokeColor = pal.color(QPalette::Active, QPalette::Mid).lighter(m_iHoverLightnessMin);
     764        strokeColor = pal.color(QPalette::Active, QPalette::Mid).lighter(m_iDefaultLightnessMin);
    759765
    760766    /* Create/assign pen: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.h

    r74249 r74599  
    279279        int                 m_iAnimatedValue;
    280280
     281        /** Holds minimum default lightness tone. */
     282        int  m_iDefaultLightnessMin;
     283        /** Holds maximum default lightness tone. */
     284        int  m_iDefaultLightnessMax;
    281285        /** Holds minimum hover lightness tone. */
    282286        int  m_iHoverLightnessMin;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp

    r74561 r74599  
    290290void UIToolsModel::updateLayout()
    291291{
    292     /* Initialize variables: */
     292    /* Prepare variables: */
     293    const int iMargin = data(ToolsModelData_Margin).toInt();
     294    const int iSpacing = data(ToolsModelData_Spacing).toInt();
    293295    const QSize viewportSize = scene()->views()[0]->viewport()->size();
    294296    const int iViewportWidth = viewportSize.width();
    295     int iVerticalIndent = 0;
     297    int iVerticalIndent = iMargin;
    296298
    297299    /* Layout the children: */
     
    306308
    307309        /* Set item position: */
    308         pItem->setPos(0, iVerticalIndent);
     310        pItem->setPos(iMargin, iVerticalIndent);
    309311        /* Set root-item size: */
    310312        pItem->resize(iViewportWidth, pItem->minimumHeightHint());
     
    312314        pItem->show();
    313315        /* Advance vertical indent: */
    314         iVerticalIndent += pItem->minimumHeightHint();
     316        iVerticalIndent += (pItem->minimumHeightHint() + iSpacing);
    315317    }
    316318}
     
    324326void UIToolsModel::sltItemMinimumWidthHintChanged()
    325327{
     328    /* Prepare variables: */
     329    const int iMargin = data(ToolsModelData_Margin).toInt();
     330
    326331    /* Calculate maximum horizontal width: */
    327332    int iMinimumWidthHint = 0;
     333    iMinimumWidthHint += 2 * iMargin;
    328334    foreach (UIToolsItem *pItem, items())
    329335        iMinimumWidthHint = qMax(iMinimumWidthHint, pItem->minimumWidthHint());
     336
     337    /* Notify listeners: */
    330338    emit sigItemMinimumWidthHintChanged(iMinimumWidthHint);
    331339}
     
    333341void UIToolsModel::sltItemMinimumHeightHintChanged()
    334342{
     343    /* Prepare variables: */
     344    const int iMargin = data(ToolsModelData_Margin).toInt();
     345    const int iSpacing = data(ToolsModelData_Spacing).toInt();
     346
    335347    /* Calculate summary vertical height: */
    336348    int iMinimumHeightHint = 0;
     349    iMinimumHeightHint += 2 * iMargin;
    337350    foreach (UIToolsItem *pItem, items())
    338351        if (pItem->isVisible())
    339             iMinimumHeightHint += pItem->minimumHeightHint();
     352            iMinimumHeightHint += (pItem->minimumHeightHint() + iSpacing);
     353    iMinimumHeightHint -= iSpacing;
     354
     355    /* Notify listeners: */
    340356    emit sigItemMinimumHeightHintChanged(iMinimumHeightHint);
    341357}
     
    535551    /* Cleanup scene: */
    536552    cleanupScene();
     553}
     554
     555QVariant UIToolsModel::data(int iKey) const
     556{
     557    /* Provide other members with required data: */
     558    switch (iKey)
     559    {
     560        /* Layout hints: */
     561        case ToolsModelData_Margin:  return 0;
     562        case ToolsModelData_Spacing: return 1;
     563
     564        /* Default: */
     565        default: break;
     566    }
     567    return QVariant();
    537568}
    538569
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.h

    r74319 r74599  
    181181
    182182private:
     183
     184    /** Data field types. */
     185    enum ToolsModelData
     186    {
     187        /* Layout hints: */
     188        ToolsModelData_Margin,
     189        ToolsModelData_Spacing,
     190    };
    183191
    184192    /** @name Prepare/Cleanup cascade.
     
    211219    /** @name General stuff.
    212220      * @{ */
     221        /** Returns abstractly stored data value for certain @a iKey. */
     222        QVariant data(int iKey) const;
     223
    213224        /** Returns @a enmType string representation.
    214225          * @todo move to UIConverter one day .. */
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