Themes: Make toolbar highlights optional

Following Diana's flat style motto "remove unnecessary lines", this
patch makes highlights and shadows in the toolbars optional, and removes
them for the new flat theme.

"default" and "dark" are not affected by this change.

Change-Id: Iadbbaa669e318406a154fed3e07890fd40f5f621
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Alessandro Portale
2016-03-04 11:08:46 +01:00
parent cfaba1a190
commit a0fbfd3bd4
5 changed files with 29 additions and 23 deletions

View File

@@ -171,6 +171,7 @@ DrawIndicatorBranch=true
DrawProgressBarSunken=false DrawProgressBarSunken=false
DrawSearchResultWidgetFrame=false DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false DrawTargetSelectorBottom=false
DrawToolBarHighlights=true
ApplyThemePaletteGlobally=true ApplyThemePaletteGlobally=true
FlatSideBarIcons=true FlatSideBarIcons=true
FlatProjectsMode=true FlatProjectsMode=true

View File

@@ -173,6 +173,7 @@ DrawIndicatorBranch=true
DrawProgressBarSunken=false DrawProgressBarSunken=false
DrawSearchResultWidgetFrame=false DrawSearchResultWidgetFrame=false
DrawTargetSelectorBottom=false DrawTargetSelectorBottom=false
DrawToolBarHighlights=false
ApplyThemePaletteGlobally=false ApplyThemePaletteGlobally=false
FlatSideBarIcons=true FlatSideBarIcons=true
FlatProjectsMode=false FlatProjectsMode=false

View File

@@ -165,6 +165,7 @@ DrawIndicatorBranch=false
DrawProgressBarSunken=true DrawProgressBarSunken=true
DrawSearchResultWidgetFrame=true DrawSearchResultWidgetFrame=true
DrawTargetSelectorBottom=true DrawTargetSelectorBottom=true
DrawToolBarHighlights=true
ApplyThemePaletteGlobally=false ApplyThemePaletteGlobally=false
FlatSideBarIcons=false FlatSideBarIcons=false
FlatProjectsMode=false FlatProjectsMode=false

View File

@@ -256,6 +256,7 @@ public:
DrawSearchResultWidgetFrame, DrawSearchResultWidgetFrame,
DrawProgressBarSunken, DrawProgressBarSunken,
DrawIndicatorBranch, DrawIndicatorBranch,
DrawToolBarHighlights,
ComboBoxDrawTextShadow, ComboBoxDrawTextShadow,
DerivePaletteFromTheme, DerivePaletteFromTheme,
ApplyThemePaletteGlobally, ApplyThemePaletteGlobally,

View File

@@ -830,32 +830,34 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt
else else
StyleHelper::verticalGradient(painter, gradientSpan, rect, drawLightColored); StyleHelper::verticalGradient(painter, gradientSpan, rect, drawLightColored);
if (!drawLightColored) if (creatorTheme()->flag(Theme::DrawToolBarHighlights)) {
painter->setPen(StyleHelper::borderColor()); if (!drawLightColored)
else painter->setPen(StyleHelper::borderColor());
painter->setPen(QColor(0x888888)); else
painter->setPen(QColor(0x888888));
if (horizontal) { if (horizontal) {
// Note: This is a hack to determine if the // Note: This is a hack to determine if the
// toolbar should draw the top or bottom outline // toolbar should draw the top or bottom outline
// (needed for the find toolbar for instance) // (needed for the find toolbar for instance)
const QColor hightLight = creatorTheme()->widgetStyle() == Theme::StyleDefault const QColor hightLight = creatorTheme()->widgetStyle() == Theme::StyleDefault
? StyleHelper::sidebarHighlight() ? StyleHelper::sidebarHighlight()
: creatorTheme()->color(Theme::FancyToolBarSeparatorColor); : creatorTheme()->color(Theme::FancyToolBarSeparatorColor);
const QColor borderColor = drawLightColored const QColor borderColor = drawLightColored
? QColor(255, 255, 255, 180) : hightLight; ? QColor(255, 255, 255, 180) : hightLight;
if (widget && widget->property("topBorder").toBool()) { if (widget && widget->property("topBorder").toBool()) {
painter->drawLine(borderRect.topLeft(), borderRect.topRight()); painter->drawLine(borderRect.topLeft(), borderRect.topRight());
painter->setPen(borderColor); painter->setPen(borderColor);
painter->drawLine(borderRect.topLeft() + QPointF(0, 1), borderRect.topRight() + QPointF(0, 1)); painter->drawLine(borderRect.topLeft() + QPointF(0, 1), borderRect.topRight() + QPointF(0, 1));
} else {
painter->drawLine(borderRect.bottomLeft(), borderRect.bottomRight());
painter->setPen(borderColor);
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
}
} else { } else {
painter->drawLine(borderRect.bottomLeft(), borderRect.bottomRight()); painter->drawLine(borderRect.topLeft(), borderRect.bottomLeft());
painter->setPen(borderColor); painter->drawLine(borderRect.topRight(), borderRect.bottomRight());
painter->drawLine(borderRect.topLeft(), borderRect.topRight());
} }
} else {
painter->drawLine(borderRect.topLeft(), borderRect.bottomLeft());
painter->drawLine(borderRect.topRight(), borderRect.bottomRight());
} }
} }
break; break;