Changeset 89249 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 24, 2021 4:54:47 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp
r89242 r89249 32 32 UIChooserItemGlobal::UIChooserItemGlobal(UIChooserItem *pParent, UIChooserNodeGlobal *pNode) 33 33 : UIChooserItem(pParent, pNode) 34 , m_iDefaultLightnessStart(0) 35 , m_iDefaultLightnessFinal(0) 34 #ifdef VBOX_WS_MAC 35 , m_iDefaultDarknessStart(0) 36 , m_iDefaultDarknessFinal(0) 37 #endif 36 38 , m_iHoverLightnessStart(0) 37 39 , m_iHoverLightnessFinal(0) … … 328 330 { 329 331 /* Color tones: */ 330 #if def VBOX_WS_MAC331 m_iDefault LightnessStart = 130;332 m_iDefault LightnessFinal = 125;332 #if defined(VBOX_WS_MAC) 333 m_iDefaultDarknessStart = 105; 334 m_iDefaultDarknessFinal = 115; 333 335 m_iHoverLightnessStart = 125; 334 336 m_iHoverLightnessFinal = 115; 335 337 m_iHighlightLightnessStart = 115; 336 338 m_iHighlightLightnessFinal = 105; 337 #else /* VBOX_WS_MAC */ 338 m_iDefaultLightnessStart = 190; 339 m_iDefaultLightnessFinal = 160; 339 #elif defined(VBOX_WS_WIN) 340 340 m_iHoverLightnessStart = 190; 341 341 m_iHoverLightnessFinal = 160; 342 342 m_iHighlightLightnessStart = 160; 343 343 m_iHighlightLightnessFinal = 130; 344 #endif /* !VBOX_WS_MAC */ 344 #else /* !VBOX_WS_MAC && !VBOX_WS_WIN */ 345 m_iHoverLightnessStart = 190; 346 m_iHoverLightnessFinal = 160; 347 m_iHighlightLightnessStart = 160; 348 m_iHighlightLightnessFinal = 130; 349 #endif /* !VBOX_WS_MAC && !VBOX_WS_WIN */ 345 350 346 351 /* Fonts: */ … … 634 639 #ifdef VBOX_WS_MAC 635 640 /* Prepare color: */ 636 const QColor backgroundColor = pal.color(QPalette::Active, QPalette:: Mid);641 const QColor backgroundColor = pal.color(QPalette::Active, QPalette::Window); 637 642 /* Draw gradient: */ 638 643 QLinearGradient bgGrad(rectangle.topLeft(), rectangle.bottomLeft()); 639 bgGrad.setColorAt(0, backgroundColor. lighter(m_iDefaultLightnessStart));640 bgGrad.setColorAt(1, backgroundColor. lighter(m_iDefaultLightnessFinal));644 bgGrad.setColorAt(0, backgroundColor.darker(m_iDefaultDarknessStart)); 645 bgGrad.setColorAt(1, backgroundColor.darker(m_iDefaultDarknessFinal)); 641 646 pPainter->fillRect(rectangle, bgGrad); 642 647 #else 643 /* Prepare color: */ 644 QColor backgroundColor = pal.color(QPalette::Active, QPalette::Mid).lighter(160); 645 /* Draw gradient: */ 646 pPainter->fillRect(rectangle, backgroundColor); 648 /* Draw simple background: */ 649 pPainter->fillRect(rectangle, pal.color(QPalette::Active, QPalette::Window)); 647 650 #endif 648 651 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.h
r89237 r89249 219 219 /** @name Item stuff. 220 220 * @{ */ 221 /** Holds item start default lightness. */ 222 int m_iDefaultLightnessStart; 223 /** Holds item final default lightness. */ 224 int m_iDefaultLightnessFinal; 221 #ifdef VBOX_WS_MAC 222 /** Holds item start default darkness. */ 223 int m_iDefaultDarknessStart; 224 /** Holds item final default darkness. */ 225 int m_iDefaultDarknessFinal; 226 #endif 225 227 /** Holds item start hover lightness. */ 226 228 int m_iHoverLightnessStart; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp
r89242 r89249 50 50 , m_iRootBackgroundDarknessStart(0) 51 51 , m_iRootBackgroundDarknessFinal(0) 52 , m_iItemBackgroundDarknessStart(0) 53 , m_iItemBackgroundDarknessFinal(0) 52 54 , m_iAdditionalHeight(0) 53 , m_iHeaderDarkness(0)54 55 , m_pToggleButton(0) 55 56 , m_pNameEditorWidget(0) … … 72 73 , m_iRootBackgroundDarknessStart(0) 73 74 , m_iRootBackgroundDarknessFinal(0) 75 , m_iItemBackgroundDarknessStart(0) 76 , m_iItemBackgroundDarknessFinal(0) 74 77 , m_iAdditionalHeight(0) 75 , m_iHeaderDarkness(0)76 78 , m_pToggleButton(0) 77 79 , m_pNameEditorWidget(0) … … 1048 1050 m_iRootBackgroundDarknessStart = 115; 1049 1051 m_iRootBackgroundDarknessFinal = 150; 1050 m_iHeaderDarkness = 110; 1052 m_iItemBackgroundDarknessStart = 100; 1053 m_iItemBackgroundDarknessFinal = 105; 1051 1054 1052 1055 /* Prepare self: */ … … 1611 1614 else 1612 1615 { 1613 /* Prepare color: */ 1614 const QColor backgroundColor = QApplication::palette().color(QPalette::Active, 1615 model()->selectedItems().contains(this) ? 1616 QPalette::Highlight : QPalette::Window); 1617 1618 /* Prepare variables: */ 1619 const int iMarginV = data(GroupItemData_MarginV).toInt(); 1620 const int iFullHeaderHeight = 2 * iMarginV + m_minimumHeaderSize.height(); 1621 1622 /* Calculate top rectangle: */ 1623 QRect tRect = rect; 1624 if (nodeToGroupType()->isOpened()) 1625 tRect.setBottom(tRect.top() + iFullHeaderHeight - 1); 1626 1627 /* Prepare top gradient: */ 1628 QLinearGradient tGradient(tRect.bottomLeft(), tRect.topLeft()); 1629 tGradient.setColorAt(1, backgroundColor.lighter(100 + (double)animatedValue() / 100 * 30)); 1630 tGradient.setColorAt(0, backgroundColor); 1631 1632 /* Fill top rectangle: */ 1633 pPainter->fillRect(tRect, tGradient); 1634 1635 /* Calculate bottom rectangle: */ 1636 if (nodeToGroupType()->isOpened()) 1637 { 1638 QRect bRect = rect; 1639 bRect.setTop(bRect.top() + iFullHeaderHeight); 1640 1641 /* Fill top rectangle: */ 1642 pPainter->fillRect(bRect, backgroundColor); 1616 /* Acquire background color: */ 1617 const QColor backgroundColor = model()->selectedItems().contains(this) 1618 ? QApplication::palette().color(QPalette::Active, QPalette::Highlight) 1619 : QApplication::palette().color(QPalette::Active, QPalette::Window); 1620 1621 /* Paint default background: */ 1622 QLinearGradient gradientDefault(rect.topRight(), rect.bottomLeft()); 1623 gradientDefault.setColorAt(0, backgroundColor.darker(m_iItemBackgroundDarknessStart)); 1624 gradientDefault.setColorAt(1, backgroundColor.darker(m_iItemBackgroundDarknessFinal)); 1625 pPainter->fillRect(rect, gradientDefault); 1626 1627 /* If element is hovered: */ 1628 if (animatedValue()) 1629 { 1630 /* Calculate header rectangle: */ 1631 const int iMarginV = data(GroupItemData_MarginV).toInt(); 1632 const int iFullHeaderHeight = 2 * iMarginV + m_minimumHeaderSize.height(); 1633 QRect headRect = rect; 1634 headRect.setHeight(iFullHeaderHeight); 1635 1636 /* Acquire header color: */ 1637 QColor headColor = backgroundColor.lighter(130); 1638 1639 /* Paint hovered background: */ 1640 QColor hcTone1 = headColor; 1641 QColor hcTone2 = headColor; 1642 hcTone1.setAlpha(255 * animatedValue() / 100); 1643 hcTone2.setAlpha(0); 1644 QLinearGradient gradientHovered(headRect.topLeft(), headRect.bottomLeft()); 1645 gradientHovered.setColorAt(0, hcTone1); 1646 gradientHovered.setColorAt(1, hcTone2); 1647 pPainter->fillRect(headRect, gradientHovered); 1643 1648 } 1644 1649 … … 1689 1694 1690 1695 /* Prepare color: */ 1691 const QColor frameColor = QApplication::palette().color(QPalette::Active, QPalette::Highlight).darker( headerDarkness() +10);1696 const QColor frameColor = QApplication::palette().color(QPalette::Active, QPalette::Highlight).darker(110); 1692 1697 1693 1698 /* Create/assign pen: */ … … 1733 1738 1734 1739 /* Get background color: */ 1735 const QColor background = pal.color(QPalette::Active, QPalette::Highlight) .darker(headerDarkness());1740 const QColor background = pal.color(QPalette::Active, QPalette::Highlight); 1736 1741 1737 1742 /* Get foreground color: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h
r89237 r89249 255 255 QVariant data(int iKey) const; 256 256 257 /** Returns item's header darkness. */258 int headerDarkness() const { return m_iHeaderDarkness; }259 260 257 /** Returns additional height. */ 261 258 int additionalHeight() const; … … 328 325 /** Holds root final background darkness. */ 329 326 int m_iRootBackgroundDarknessFinal; 327 /** Holds item start background darkness. */ 328 int m_iItemBackgroundDarknessStart; 329 /** Holds item final background darkness. */ 330 int m_iItemBackgroundDarknessFinal; 330 331 331 332 /** Holds aditional height. */ 332 333 int m_iAdditionalHeight; 333 /** Holds the header darkness. */334 int m_iHeaderDarkness;335 334 336 335 /** Holds group children pixmap. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp
r89242 r89249 545 545 { 546 546 /* Color tones: */ 547 #if def VBOX_WS_MAC548 m_iDefaultLightnessStart = 1 55;549 m_iDefaultLightnessFinal = 1 45;547 #if defined(VBOX_WS_MAC) 548 m_iDefaultLightnessStart = 120; 549 m_iDefaultLightnessFinal = 110; 550 550 m_iHoverLightnessStart = 125; 551 551 m_iHoverLightnessFinal = 115; 552 552 m_iHighlightLightnessStart = 115; 553 553 m_iHighlightLightnessFinal = 105; 554 #el se /* VBOX_WS_MAC */555 m_iDefaultLightnessStart = 1 90;556 m_iDefaultLightnessFinal = 1 60;554 #elif defined(VBOX_WS_WIN) 555 m_iDefaultLightnessStart = 120; 556 m_iDefaultLightnessFinal = 110; 557 557 m_iHoverLightnessStart = 190; 558 558 m_iHoverLightnessFinal = 160; 559 559 m_iHighlightLightnessStart = 160; 560 560 m_iHighlightLightnessFinal = 130; 561 #endif /* !VBOX_WS_MAC */ 561 #else /* !VBOX_WS_MAC && !VBOX_WS_WIN */ 562 m_iDefaultLightnessStart = 110; 563 m_iDefaultLightnessFinal = 100; 564 m_iHoverLightnessStart = 190; 565 m_iHoverLightnessFinal = 160; 566 m_iHighlightLightnessStart = 160; 567 m_iHighlightLightnessFinal = 130; 568 #endif /* !VBOX_WS_MAC && !VBOX_WS_WIN */ 562 569 563 570 /* Fonts: */ … … 977 984 { 978 985 /* Prepare color: */ 979 QColor backgroundColor = pal.color(QPalette::Active, QPalette:: Mid);986 QColor backgroundColor = pal.color(QPalette::Active, QPalette::Window); 980 987 /* Draw gradient: */ 981 988 QLinearGradient bgGrad(rectangle.topLeft(), rectangle.bottomLeft());
Note:
See TracChangeset
for help on using the changeset viewer.