forked from qt-creator/qt-creator
Themes: Add a theme flag for "default" or "flat" ProjectsMode
I'd like a "flat" style to have a "default" projects mode. This patch introduces a FlatProjectsMode. The painting code of the widgets in the project mode follow that instead of the Theme::WidgetStyle. In the course of it, DoubleTabWidget does not imitate the dummy toolbar anymore, but calls the style painting code, instead. That makes the theme color DoubleTabWidget1stEmptyAreaBackgroundColor obsolete, so that key disappears from the Theme enum and also from the creatorthemes. Change-Id: Ia1479c761f61753d6738a43bbde368bf0b8814b2 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -31,7 +31,6 @@ ComboBoxTextColor=text
|
||||
DetailsButtonBackgroundColorHover=hoverBackground
|
||||
DetailsWidgetBackgroundColor=ff4a4a4a
|
||||
DockWidgetResizeHandleColor=shadowBackground
|
||||
DoubleTabWidget1stEmptyAreaBackgroundColor=normalBackground
|
||||
DoubleTabWidget1stSeparatorColor=hoverBackground
|
||||
DoubleTabWidget1stTabActiveTextColor=text
|
||||
DoubleTabWidget1stTabBackgroundColor=ff4a4a4a
|
||||
@@ -174,6 +173,7 @@ DrawSearchResultWidgetFrame=false
|
||||
DrawTargetSelectorBottom=false
|
||||
ApplyThemePaletteGlobally=true
|
||||
FlatSideBarIcons=true
|
||||
FlatProjectsMode=true
|
||||
|
||||
[Gradients]
|
||||
DetailsWidgetHeaderGradient\1\color=0
|
||||
|
@@ -7,7 +7,7 @@ shadowBackground=ff404244
|
||||
text=ff000000
|
||||
textDisabled=55000000
|
||||
toolBarItem=b6fbfdff
|
||||
toolBarItemDisabled=38fbfdff
|
||||
toolBarItemDisabled=88a4a6a8
|
||||
hoverBackground=ff515151
|
||||
selectedBackground=ff151515
|
||||
normalBackground=ffffffff
|
||||
@@ -30,18 +30,17 @@ CanceledSearchTextColor=ff0000
|
||||
ComboBoxArrowColor=toolBarItem
|
||||
ComboBoxArrowColorDisabled=toolBarItemDisabled
|
||||
ComboBoxTextColor=toolBarItem
|
||||
DetailsButtonBackgroundColorHover=hoverBackground
|
||||
DetailsWidgetBackgroundColor=ff4a4a4a
|
||||
DetailsButtonBackgroundColorHover=b4ffffff
|
||||
DetailsWidgetBackgroundColor=28ffffff
|
||||
DockWidgetResizeHandleColor=splitter
|
||||
DoubleTabWidget1stEmptyAreaBackgroundColor=normalBackground
|
||||
DoubleTabWidget1stSeparatorColor=hoverBackground
|
||||
DoubleTabWidget1stTabActiveTextColor=text
|
||||
DoubleTabWidget1stTabBackgroundColor=ff4a4a4a
|
||||
DoubleTabWidget1stTabInactiveTextColor=textDisabled
|
||||
DoubleTabWidget2ndSeparatorColor=hoverBackground
|
||||
DoubleTabWidget2ndTabActiveTextColor=text
|
||||
DoubleTabWidget2ndTabBackgroundColor=ff434343
|
||||
DoubleTabWidget2ndTabInactiveTextColor=textDisabled
|
||||
DoubleTabWidget1stSeparatorColor=ffff0000
|
||||
DoubleTabWidget1stTabActiveTextColor=ff000000
|
||||
DoubleTabWidget1stTabBackgroundColor=ffff0000
|
||||
DoubleTabWidget1stTabInactiveTextColor=ffffffff
|
||||
DoubleTabWidget2ndSeparatorColor=ffff0000
|
||||
DoubleTabWidget2ndTabActiveTextColor=ffffffff
|
||||
DoubleTabWidget2ndTabBackgroundColor=ffff0000
|
||||
DoubleTabWidget2ndTabInactiveTextColor=ff000000
|
||||
EditorPlaceholderColor=normalBackground
|
||||
FancyToolBarSeparatorColor=43ffffff
|
||||
FancyTabBarBackgroundColor=shadowBackground
|
||||
@@ -176,6 +175,7 @@ DrawSearchResultWidgetFrame=false
|
||||
DrawTargetSelectorBottom=false
|
||||
ApplyThemePaletteGlobally=false
|
||||
FlatSideBarIcons=true
|
||||
FlatProjectsMode=false
|
||||
|
||||
[Gradients]
|
||||
DetailsWidgetHeaderGradient\1\color=0
|
||||
|
@@ -25,7 +25,6 @@ ComboBoxTextColor=ffffffff
|
||||
DetailsButtonBackgroundColorHover=b4ffffff
|
||||
DetailsWidgetBackgroundColor=28ffffff
|
||||
DockWidgetResizeHandleColor=ff000000
|
||||
DoubleTabWidget1stEmptyAreaBackgroundColor=ffff0000
|
||||
DoubleTabWidget1stSeparatorColor=ffff0000
|
||||
DoubleTabWidget1stTabActiveTextColor=ff000000
|
||||
DoubleTabWidget1stTabBackgroundColor=ffff0000
|
||||
@@ -168,6 +167,7 @@ DrawSearchResultWidgetFrame=true
|
||||
DrawTargetSelectorBottom=true
|
||||
ApplyThemePaletteGlobally=false
|
||||
FlatSideBarIcons=false
|
||||
FlatProjectsMode=false
|
||||
|
||||
[Gradients]
|
||||
DetailsWidgetHeaderGradient\1\color=ffffff
|
||||
|
@@ -122,7 +122,7 @@ void DetailsButton::paintEvent(QPaintEvent *e)
|
||||
c.setAlpha (int(m_fader * c.alpha()));
|
||||
|
||||
QRect r = rect();
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleDefault)
|
||||
if (!creatorTheme()->flag(Theme::FlatProjectsMode))
|
||||
r.adjust(1, 1, -2, -2);
|
||||
p.fillRect(r, c);
|
||||
}
|
||||
@@ -158,7 +158,7 @@ QPixmap DetailsButton::cacheRendering(const QSize &size, bool checked)
|
||||
p.setRenderHint(QPainter::Antialiasing, true);
|
||||
p.translate(0.5, 0.5);
|
||||
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) {
|
||||
if (!creatorTheme()->flag(Theme::FlatProjectsMode)) {
|
||||
QLinearGradient lg;
|
||||
lg.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||
lg.setFinalStop(0, 1);
|
||||
|
@@ -146,7 +146,7 @@ QPixmap DetailsWidget::createBackground(const QSize &size, int topHeight, QWidge
|
||||
else
|
||||
p.fillRect(fullRect, creatorTheme()->color(Theme::DetailsWidgetBackgroundColor));
|
||||
|
||||
if (creatorTheme()->widgetStyle () == Theme::StyleDefault) {
|
||||
if (!creatorTheme()->flag(Theme::FlatProjectsMode)) {
|
||||
QLinearGradient lg(topRect.topLeft(), topRect.bottomLeft());
|
||||
lg.setStops(creatorTheme()->gradient(Theme::DetailsWidgetHeaderGradient));
|
||||
p.fillRect(topRect, lg);
|
||||
|
@@ -70,7 +70,6 @@ public:
|
||||
DetailsButtonBackgroundColorHover,
|
||||
DetailsWidgetBackgroundColor,
|
||||
DockWidgetResizeHandleColor,
|
||||
DoubleTabWidget1stEmptyAreaBackgroundColor,
|
||||
DoubleTabWidget1stSeparatorColor,
|
||||
DoubleTabWidget1stTabActiveTextColor,
|
||||
DoubleTabWidget1stTabBackgroundColor,
|
||||
@@ -260,7 +259,8 @@ public:
|
||||
ComboBoxDrawTextShadow,
|
||||
DerivePaletteFromTheme,
|
||||
ApplyThemePaletteGlobally,
|
||||
FlatSideBarIcons
|
||||
FlatSideBarIcons,
|
||||
FlatProjectsMode
|
||||
};
|
||||
|
||||
enum WidgetStyle {
|
||||
|
@@ -52,7 +52,7 @@ static const int OVERFLOW_DROPDOWN_WIDTH = StyleHelper::navigationWidgetHeight()
|
||||
static void drawFirstLevelSeparator(QPainter *painter, const QPointF &top, const QPointF &bottom)
|
||||
{
|
||||
QLinearGradient grad(top, bottom);
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) {
|
||||
if (!creatorTheme()->flag(Theme::FlatProjectsMode)) {
|
||||
grad.setColorAt(0, QColor(255, 255, 255, 20));
|
||||
grad.setColorAt(0.4, QColor(255, 255, 255, 60));
|
||||
grad.setColorAt(0.7, QColor(255, 255, 255, 50));
|
||||
@@ -74,7 +74,7 @@ static void drawFirstLevelSeparator(QPainter *painter, const QPointF &top, const
|
||||
static void drawSecondLevelSeparator(QPainter *painter, QPoint top, QPoint bottom)
|
||||
{
|
||||
QLinearGradient grad(top, bottom);
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) {
|
||||
if (!creatorTheme()->flag(Theme::FlatProjectsMode)) {
|
||||
grad.setColorAt(0, QColor(255, 255, 255, 0));
|
||||
grad.setColorAt(0.4, QColor(255, 255, 255, 100));
|
||||
grad.setColorAt(0.7, QColor(255, 255, 255, 100));
|
||||
@@ -359,18 +359,13 @@ void DoubleTabWidget::paintEvent(QPaintEvent *event)
|
||||
// draw top level tab bar
|
||||
r.setHeight(StyleHelper::navigationWidgetHeight());
|
||||
|
||||
const QRectF borderRect = QRectF(r).adjusted(0.5, 0.5, -0.5, -0.5);
|
||||
if (creatorTheme()->widgetStyle () == Theme::StyleDefault) {
|
||||
QPoint offset = window()->mapToGlobal(QPoint(0, 0)) - mapToGlobal(r.topLeft());
|
||||
QRect gradientSpan = QRect(offset, window()->size());
|
||||
StyleHelper::horizontalGradient(&painter, gradientSpan, r);
|
||||
painter.setPen(StyleHelper::borderColor());
|
||||
QColor lighter(255, 255, 255, 40);
|
||||
painter.drawLine(borderRect.bottomLeft(), borderRect.bottomRight());
|
||||
painter.setPen(lighter);
|
||||
painter.drawLine(borderRect.topLeft(), borderRect.topRight());
|
||||
} else {
|
||||
painter.fillRect(r, creatorTheme()->color(Theme::DoubleTabWidget1stEmptyAreaBackgroundColor));
|
||||
{
|
||||
QStyleOptionToolBar option;
|
||||
option.rect = r;
|
||||
option.state = QStyle::State_Horizontal;
|
||||
setProperty("panelwidget", true);
|
||||
QApplication::style()->drawControl(QStyle::CE_ToolBar, &option, &painter, this);
|
||||
setProperty("panelwidget", false);
|
||||
}
|
||||
|
||||
QFontMetrics fm(font());
|
||||
@@ -383,7 +378,7 @@ void DoubleTabWidget::paintEvent(QPaintEvent *event)
|
||||
}
|
||||
|
||||
QLinearGradient grad(QPoint(0, 0), QPoint(0, r.height() + OTHER_HEIGHT - 1));
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleFlat) {
|
||||
if (creatorTheme()->flag(Theme::FlatProjectsMode)) {
|
||||
grad.setColorAt(0, creatorTheme()->color(Theme::DoubleTabWidget1stTabBackgroundColor));
|
||||
} else {
|
||||
grad.setColorAt(0, QColor(247, 247, 247));
|
||||
@@ -392,7 +387,7 @@ void DoubleTabWidget::paintEvent(QPaintEvent *event)
|
||||
|
||||
// draw background of second bar
|
||||
painter.fillRect(QRect(0, r.height(), r.width(), OTHER_HEIGHT), grad);
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) {
|
||||
if (!creatorTheme()->flag(Theme::FlatProjectsMode)) {
|
||||
painter.setPen(QColor(0x505050));
|
||||
painter.drawLine(QPointF(0.5, r.height() + OTHER_HEIGHT - 0.5),
|
||||
QPointF(r.width() - 0.5, r.height() + OTHER_HEIGHT - 0.5));
|
||||
@@ -477,7 +472,7 @@ void DoubleTabWidget::paintEvent(QPaintEvent *event)
|
||||
r.height() + 1),
|
||||
grad);
|
||||
|
||||
if (actualIndex != 0 && creatorTheme()->widgetStyle() == Theme::StyleDefault) {
|
||||
if (actualIndex != 0 && !creatorTheme()->flag(Theme::FlatProjectsMode)) {
|
||||
painter.setPen(QColor(255, 255, 255, 170));
|
||||
painter.drawLine(QLineF(x + 0.5, 0.5, x + 0.5, r.height() - 0.5));
|
||||
}
|
||||
@@ -486,7 +481,7 @@ void DoubleTabWidget::paintEvent(QPaintEvent *event)
|
||||
painter.drawText(x, baseline, tab.displayName());
|
||||
x += nameWidth.at(actualIndex);
|
||||
x += MARGIN;
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) {
|
||||
if (!creatorTheme()->flag(Theme::FlatProjectsMode)) {
|
||||
painter.setPen(StyleHelper::borderColor());
|
||||
painter.drawLine(QLineF(x + 0.5, 0.5, x + 0.5, r.height() - 0.5));
|
||||
painter.setPen(QColor(0, 0, 0, 20));
|
||||
@@ -526,7 +521,7 @@ void DoubleTabWidget::paintEvent(QPaintEvent *event)
|
||||
int textWidth = fm.width(subTabs.at(i));
|
||||
if (currentTab.currentSubTab == i) {
|
||||
const QRect tabRect(x, y, 2 * SELECTION_IMAGE_WIDTH + textWidth, imageHeight);
|
||||
if (creatorTheme()->widgetStyle() == Theme::StyleDefault) {
|
||||
if (!creatorTheme()->flag(Theme::FlatProjectsMode)) {
|
||||
StyleHelper::drawCornerImage(m_selection, &painter, tabRect, 15, 0, 15, 0);
|
||||
} else {
|
||||
painter.setBrush(creatorTheme()->color(Theme::DoubleTabWidget2ndTabBackgroundColor));
|
||||
|
@@ -39,7 +39,7 @@ TargetSettingsWidget::TargetSettingsWidget(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
if (Utils::creatorTheme()->widgetStyle() == Utils::Theme::StyleFlat) {
|
||||
if (Utils::creatorTheme()->flag(Utils::Theme::FlatProjectsMode)) {
|
||||
ui->separator->setVisible(false);
|
||||
ui->shadow->setVisible(false);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user