Changeset 43885 in vbox
- Timestamp:
- Nov 15, 2012 6:10:23 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.cpp
r42526 r43885 36 36 QIShadeSplitterHandle(Qt::Orientation orientation, QISplitter *pParent) 37 37 : QSplitterHandle(orientation, pParent) 38 {} 38 { 39 QPalette pal = palette(); 40 QColor windowColor = pal.color(QPalette::Active, QPalette::Window); 41 QColor darkColor = pal.color(QPalette::Active, QPalette::Dark); 42 m_color1 = windowColor; 43 m_color2 = windowColor; 44 m_color = darkColor; 45 } 46 47 void configureColors(const QColor &color1, const QColor &color2) 48 { 49 m_color1 = color1; 50 m_color2 = color2; 51 update(); 52 } 39 53 40 54 protected: … … 44 58 QPainter painter(this); 45 59 QLinearGradient gradient; 46 QColor color = palette().color(QPalette::Window); 47 QGradientStop point1(0, color); 48 QGradientStop point2(0.5, color.darker(115)); 49 QGradientStop point3(1, color); 60 QGradientStop point1(0, m_color1); 61 QGradientStop point2(0.5, m_color); 62 QGradientStop point3(1, m_color2); 50 63 QGradientStops stops; 51 64 stops << point1 << point2 << point3; … … 53 66 if (orientation() == Qt::Horizontal) 54 67 { 55 gradient.setStart(rect().left() , 0);68 gradient.setStart(rect().left() + 1, 0); 56 69 gradient.setFinalStop(rect().right(), 0); 57 70 } 58 71 else 59 72 { 60 gradient.setStart(0, rect().top() );73 gradient.setStart(0, rect().top() + 1); 61 74 gradient.setFinalStop(0, rect().bottom()); 62 75 } 63 76 painter.fillRect(pEvent->rect(), gradient); 64 77 } 78 79 private: 80 81 QColor m_color; 82 QColor m_color1; 83 QColor m_color2; 65 84 }; 66 85 … … 258 277 } 259 278 else 260 return new QIShadeSplitterHandle(orientation(), this); 279 { 280 QIShadeSplitterHandle *pHandle = new QIShadeSplitterHandle(orientation(), this); 281 if (m_color1.isValid() && m_color2.isValid()) 282 pHandle->configureColors(m_color1, m_color2); 283 return pHandle; 284 } 261 285 } 262 286 -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.h
r30868 r43885 6 6 7 7 /* 8 * Copyright (C) 2009-201 0Oracle Corporation8 * Copyright (C) 2009-2012 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 37 37 Type handleType() const { return m_type; } 38 38 39 void configureColors(const QColor &color1, const QColor &color2) { m_color1 = color1; m_color2 = color2; } 40 39 41 protected: 40 42 … … 53 55 bool m_fHandleGrabbed; 54 56 #endif /* Q_WS_MAC */ 57 58 QColor m_color1; 59 QColor m_color2; 55 60 }; 56 61 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r43460 r43885 1346 1346 m_pDetails = new UIGDetails(this); 1347 1347 1348 /* Configure splitter colors: */ 1349 m_pSplitter->configureColors(m_pChooser->palette().color(QPalette::Active, QPalette::Window), 1350 m_pDetails->palette().color(QPalette::Active, QPalette::Window)); 1351 1348 1352 /* Prepare details and snapshots tabs: */ 1349 1353 m_pVMDesktop = new UIVMDesktop(mVMToolBar, m_pAction_Common_Refresh, this); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooser.cpp
r43540 r43885 104 104 setAutoFillBackground(true); 105 105 QPalette pal = palette(); 106 pal.setColor(QPalette::Window, QColor(240, 240, 240));106 pal.setColor(QPalette::Window, pal.color(QPalette::Active, QPalette::Base)); 107 107 setPalette(pal); 108 108 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.cpp
r43853 r43885 48 48 , m_iHighlightDarkness(90) 49 49 , m_iAnimationDarkness(m_iDefaultDarkness) 50 , m_iStrokeDarkness(130)51 50 , m_iDragTokenDarkness(110) 52 51 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItem.h
r43853 r43885 175 175 176 176 /* Other color stuff: */ 177 int strokeDarkness() const { return m_iStrokeDarkness; }178 177 int dragTokenDarkness() const { return m_iDragTokenDarkness; } 179 178 … … 201 200 int m_iHighlightDarkness; 202 201 int m_iAnimationDarkness; 203 int m_iStrokeDarkness;204 202 int m_iDragTokenDarkness; 205 203 }; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp
r43853 r43885 1435 1435 /* Prepare color: */ 1436 1436 QPalette pal = palette(); 1437 QColor windowColor = pal.color(QPalette::Active,1437 QColor headerColor = pal.color(QPalette::Active, 1438 1438 model()->currentItems().contains(this) ? 1439 QPalette::Highlight : QPalette::Window); 1439 QPalette::Highlight : QPalette::Button); 1440 QColor strokeColor = pal.color(QPalette::Active, QPalette::Dark); 1441 QColor bodyColor = pal.color(QPalette::Active, QPalette::Base); 1440 1442 1441 1443 /* Root-item: */ … … 1446 1448 { 1447 1449 /* Simple and clear: */ 1448 pPainter->fillRect(rect, QColor(240, 240, 240));1450 pPainter->fillRect(rect, bodyColor); 1449 1451 } 1450 1452 /* Non-main root-item: */ … … 1471 1473 /* Fill background: */ 1472 1474 QLinearGradient headerGradient(backgroundRect.bottomLeft(), backgroundRect.topLeft()); 1473 headerGradient.setColorAt(1, windowColor.darker(blackoutDarkness()));1474 headerGradient.setColorAt(0, windowColor.darker(animationDarkness()));1475 headerGradient.setColorAt(1, headerColor.darker(blackoutDarkness())); 1476 headerGradient.setColorAt(0, headerColor.darker(animationDarkness())); 1475 1477 pPainter->fillRect(backgroundRect, headerGradient); 1476 1478 1477 1479 /* Stroke path: */ 1478 1480 pPainter->setClipping(false); 1479 pPainter->strokePath(path, windowColor.darker(strokeDarkness()));1481 pPainter->strokePath(path, strokeColor); 1480 1482 } 1481 1483 } … … 1507 1509 /* Prepare top gradient: */ 1508 1510 QLinearGradient tGradient(tRect.bottomLeft(), tRect.topLeft()); 1509 tGradient.setColorAt(1, windowColor.darker(animationDarkness()));1510 tGradient.setColorAt(0, windowColor.darker(blackoutDarkness()));1511 tGradient.setColorAt(1, headerColor.darker(animationDarkness())); 1512 tGradient.setColorAt(0, headerColor.darker(blackoutDarkness())); 1511 1513 /* Fill top rectangle: */ 1512 1514 pPainter->fillRect(tRect, tGradient); … … 1517 1519 QRect midRect = QRect(tRect.bottomLeft(), rect.bottomRight()); 1518 1520 /* Paint all the stuff: */ 1519 pPainter->fillRect(midRect, QColor(245, 245, 245));1521 pPainter->fillRect(midRect, bodyColor); 1520 1522 } 1521 1523 1522 1524 /* Stroke path: */ 1523 1525 pPainter->setClipping(false); 1524 pPainter->strokePath(path, windowColor.darker(strokeDarkness()));1526 pPainter->strokePath(path, strokeColor); 1525 1527 pPainter->setClipPath(path); 1526 1528 … … 1542 1544 dragTokenGradient.setFinalStop(dragTokenRect.bottomLeft()); 1543 1545 } 1544 dragTokenGradient.setColorAt(0, windowColor.darker(dragTokenDarkness()));1545 dragTokenGradient.setColorAt(1, windowColor.darker(dragTokenDarkness() + 40));1546 dragTokenGradient.setColorAt(0, headerColor.darker(dragTokenDarkness())); 1547 dragTokenGradient.setColorAt(1, headerColor.darker(dragTokenDarkness() + 40)); 1546 1548 pPainter->fillRect(dragTokenRect, dragTokenGradient); 1547 1549 } … … 1565 1567 int iFullHeaderHeight = m_headerSize.height(); 1566 1568 1567 /* Update palette: */ 1568 if (model()->currentItems().contains(this)) 1569 { 1570 QPalette pal = palette(); 1571 pPainter->setPen(pal.color(QPalette::HighlightedText)); 1572 } 1569 /* Configure painter color: */ 1570 pPainter->setPen(palette().color(QPalette::Active, 1571 model()->currentItems().contains(this) ? 1572 QPalette::HighlightedText : QPalette::ButtonText)); 1573 1573 1574 1574 /* Update buttons: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemMachine.cpp
r43853 r43885 775 775 { 776 776 /* Prepare color: */ 777 QColor highlight = pal.color(QPalette:: Highlight);777 QColor highlight = pal.color(QPalette::Active, QPalette::Highlight); 778 778 /* Draw gradient: */ 779 779 QLinearGradient bgGrad(rect.topLeft(), rect.bottomLeft()); … … 782 782 pPainter->fillRect(rect, bgGrad); 783 783 } 784 785 784 /* Hovering background: */ 786 785 else if (isHovered()) 787 786 { 788 787 /* Prepare color: */ 789 QColor highlight = pal.color(QPalette:: Highlight);788 QColor highlight = pal.color(QPalette::Active, QPalette::Highlight); 790 789 /* Draw gradient: */ 791 790 QLinearGradient bgGrad(rect.topLeft(), rect.bottomLeft()); … … 833 832 pPainter->save(); 834 833 QPalette pal = palette(); 835 QColor hc = pal.color(QPalette::Active, QPalette::Highlight);836 if (model()->currentItems().contains(this))837 hc = hc.darker(strokeDarkness());838 pPainter->setPen( hc);834 QColor strokeColor = pal.color(QPalette::Active, 835 model()->currentItems().contains(this) ? 836 QPalette::Dark : QPalette::Highlight); 837 pPainter->setPen(strokeColor); 839 838 pPainter->drawRect(rect); 840 839 pPainter->restore(); … … 851 850 int iMachineItemTextSpacing = data(MachineItemData_TextSpacing).toInt(); 852 851 853 /* Update palette: */852 /* Selected item foreground: */ 854 853 if (model()->currentItems().contains(this)) 855 854 { 856 855 QPalette pal = palette(); 857 856 pPainter->setPen(pal.color(QPalette::HighlightedText)); 857 } 858 /* Hovered item foreground: */ 859 else if (isHovered()) 860 { 861 /* Prepare color: */ 862 QPalette pal = palette(); 863 QColor highlight = pal.color(QPalette::Active, QPalette::Highlight); 864 QColor hhl = highlight.lighter(m_iHoverHighlightLightness); 865 if (hhl.value() - hhl.saturation() > 0) 866 pPainter->setPen(pal.color(QPalette::Active, QPalette::Text)); 867 else 868 pPainter->setPen(pal.color(QPalette::Active, QPalette::HighlightedText)); 858 869 } 859 870 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.cpp
r43514 r43885 28 28 : QGraphicsView(pParent) 29 29 { 30 /* Fix palette: */31 QPalette pal = palette();32 pal.setColor(QPalette::Base, QColor(240, 240, 240));33 setPalette(pal);34 35 30 /* Setup frame: */ 36 31 setFrameShape(QFrame::NoFrame); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetails.cpp
r42882 r43885 32 32 , m_pDetailsView(0) 33 33 { 34 /* Fix palette: */35 setAutoFillBackground(true);36 QPalette pal = palette();37 pal.setColor(QPalette::Window, QColor(240, 240, 240));38 setPalette(pal);39 40 34 /* Create main-layout: */ 41 35 m_pMainLayout = new QVBoxLayout(this); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsElement.cpp
r43223 r43885 571 571 int iMaximumHeight = qMax(iPixmapHeight, iNameHeight); 572 572 573 /* Prepare color: */ 574 QPalette pal = palette(); 575 QColor buttonTextColor = pal.color(QPalette::Active, QPalette::ButtonText); 576 QColor linkTextColor = pal.color(QPalette::Active, QPalette::Link); 577 QColor baseTextColor = pal.color(QPalette::Active, QPalette::Text); 578 573 579 /* Paint pixmap: */ 574 580 int iMachinePixmapX = 2 * iMargin; … … 597 603 m_strName, 598 604 /* Name hovered? */ 599 m_fNameHovered );605 m_fNameHovered ? linkTextColor : buttonTextColor); 600 606 601 607 /* Paint text: */ 602 608 if (!m_fClosed && !m_text.isEmpty() && !m_fAnimationRunning) 603 609 { 610 /* Prepare painter: */ 611 pPainter->save(); 612 pPainter->setPen(baseTextColor); 613 604 614 /* Prepare variables: */ 605 615 int iMinimumTextColumnWidth = data(ElementData_MinimumTextColumnWidth).toInt(); … … 673 683 iMachineTextY += qMax(iLeftColumnHeight, iRightColumnHeight); 674 684 } 685 686 /* Restore painter: */ 687 pPainter->restore(); 675 688 } 676 689 } … … 691 704 692 705 /* Prepare color: */ 693 QPalette pal = QApplication::palette(); 694 QColor windowColor = pal.color(QPalette::Active, QPalette::Window); 706 QPalette pal = palette(); 707 QColor headerColor = pal.color(QPalette::Active, QPalette::Button); 708 QColor strokeColor = pal.color(QPalette::Active, QPalette::Dark); 709 QColor bodyColor = pal.color(QPalette::Active, QPalette::Base); 695 710 696 711 /* Add clipping: */ … … 716 731 /* Prepare top gradient: */ 717 732 QLinearGradient tGradient(tRect.bottomLeft(), tRect.topLeft()); 718 tGradient.setColorAt(0, windowColor.darker(110));719 tGradient.setColorAt(1, windowColor.darker(animationDarkness()));733 tGradient.setColorAt(0, headerColor.darker(110)); 734 tGradient.setColorAt(1, headerColor.darker(animationDarkness())); 720 735 721 736 /* Paint all the stuff: */ 722 737 pPainter->fillRect(tRect, tGradient); 723 pPainter->fillRect(bRect, QColor(245, 245, 245));738 pPainter->fillRect(bRect, bodyColor); 724 739 725 740 /* Stroke path: */ 726 741 pPainter->setClipping(false); 727 pPainter->strokePath(path, windowColor.darker(130));742 pPainter->strokePath(path, strokeColor); 728 743 729 744 /* Restore painter: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsItem.cpp
r42689 r43885 124 124 /* static */ 125 125 void UIGDetailsItem::paintText(QPainter *pPainter, const QRect &rect, const QFont &font, 126 const QString &strText, bool fUrl /* = false */)126 const QString &strText, const QColor &color) 127 127 { 128 128 pPainter->save(); 129 129 pPainter->setFont(font); 130 if (fUrl) 131 { 132 QPalette pal = QApplication::palette(); 133 pPainter->setPen(pal.color(QPalette::Link)); 134 } 130 pPainter->setPen(color); 135 131 pPainter->drawText(rect, strText); 136 132 pPainter->restore(); -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsItem.h
r42689 r43885 80 80 static void paintFrameRect(QPainter *pPainter, const QRect &rect, int iRadius); 81 81 static void paintPixmap(QPainter *pPainter, const QRect &rect, const QPixmap &pixmap); 82 static void paintText(QPainter *pPainter, const QRect &rect, const QFont &font, const QString &strText, bool fUrl = false);82 static void paintText(QPainter *pPainter, const QRect &rect, const QFont &font, const QString &strText, const QColor &color); 83 83 84 84 private: -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsView.cpp
r42873 r43885 30 30 /* Fix palette: */ 31 31 QPalette pal = palette(); 32 pal.setColor(QPalette::Base, QColor(240, 240, 240));32 pal.setColor(QPalette::Base, pal.color(QPalette::Active, QPalette::Window)); 33 33 setPalette(pal); 34 34
Note:
See TracChangeset
for help on using the changeset viewer.