Theming: theme compile output pane

Change-Id: Ic364457884765ea755d0dc6e3e35296d5bd36359
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Thorben Kroeger
2015-03-19 20:00:15 +01:00
committed by Orgad Shaneh
parent 0b6b5631b7
commit a4bb572a3b
4 changed files with 21 additions and 10 deletions

View File

@@ -87,6 +87,10 @@ OutputPaneToggleButtonTextColorChecked=text
OutputPaneToggleButtonTextColorUnchecked=text OutputPaneToggleButtonTextColorUnchecked=text
QtOutputFormatter_LinkTextColor=ff0000ff QtOutputFormatter_LinkTextColor=ff0000ff
CompileOutput_ErrorOutput=ffff6c6c
CompileOutput_MessageOutput=ff008787
CompileOutput_ErrorMessageOutput=ffff6c6c
Welcome_BackgroundColorNormal=normalBackground Welcome_BackgroundColorNormal=normalBackground
Welcome_Button_BorderColorNormal=0 Welcome_Button_BorderColorNormal=0
Welcome_Button_BorderColorPressed=0 Welcome_Button_BorderColorPressed=0

View File

@@ -81,6 +81,10 @@ OutputPaneToggleButtonTextColorChecked=ffffffff
OutputPaneToggleButtonTextColorUnchecked=ff000000 OutputPaneToggleButtonTextColorUnchecked=ff000000
QtOutputFormatter_LinkTextColor=ff0000aa QtOutputFormatter_LinkTextColor=ff0000aa
CompileOutput_ErrorOutput=ffaa0000
CompileOutput_MessageOutput=ff0000aa
CompileOutput_ErrorMessageOutput=ffaa0000
Welcome_BackgroundColorNormal=ffffffff Welcome_BackgroundColorNormal=ffffffff
Welcome_Button_BorderColorNormal=ff737373 Welcome_Button_BorderColorNormal=ff737373
Welcome_Button_BorderColorPressed=ff333333 Welcome_Button_BorderColorPressed=ff333333

View File

@@ -133,6 +133,12 @@ public:
QtOutputFormatter_LinkTextColor, QtOutputFormatter_LinkTextColor,
/* Compile Output Pane */
CompileOutput_ErrorOutput,
CompileOutput_MessageOutput,
CompileOutput_ErrorMessageOutput,
/* Welcome Plugin */ /* Welcome Plugin */
Welcome_TextColorNormal, Welcome_TextColorNormal,

View File

@@ -42,6 +42,7 @@
#include <texteditor/texteditorsettings.h> #include <texteditor/texteditorsettings.h>
#include <texteditor/fontsettings.h> #include <texteditor/fontsettings.h>
#include <utils/ansiescapecodehandler.h> #include <utils/ansiescapecodehandler.h>
#include <utils/theme/theme.h>
#include <QIcon> #include <QIcon>
#include <QTextCharFormat> #include <QTextCharFormat>
@@ -184,30 +185,26 @@ QList<QWidget *> CompileOutputWindow::toolBarWidgets() const
return QList<QWidget *>() << m_cancelBuildButton; return QList<QWidget *>() << m_cancelBuildButton;
} }
static QColor mix_colors(const QColor &a, const QColor &b)
{
return QColor((a.red() + 2 * b.red()) / 3, (a.green() + 2 * b.green()) / 3,
(a.blue() + 2* b.blue()) / 3, (a.alpha() + 2 * b.alpha()) / 3);
}
void CompileOutputWindow::appendText(const QString &text, BuildStep::OutputFormat format) void CompileOutputWindow::appendText(const QString &text, BuildStep::OutputFormat format)
{ {
using Utils::Theme;
QPalette p = m_outputWindow->palette(); QPalette p = m_outputWindow->palette();
Theme *theme = Utils::creatorTheme();
QTextCharFormat textFormat; QTextCharFormat textFormat;
switch (format) { switch (format) {
case BuildStep::NormalOutput: case BuildStep::NormalOutput:
textFormat.setForeground(p.color(QPalette::Text)); textFormat.setForeground(theme->color(Theme::TextColorNormal));
textFormat.setFontWeight(QFont::Normal); textFormat.setFontWeight(QFont::Normal);
break; break;
case BuildStep::ErrorOutput: case BuildStep::ErrorOutput:
textFormat.setForeground(mix_colors(p.color(QPalette::Text), QColor(Qt::red))); textFormat.setForeground(theme->color(Theme::CompileOutput_ErrorOutput));
textFormat.setFontWeight(QFont::Normal); textFormat.setFontWeight(QFont::Normal);
break; break;
case BuildStep::MessageOutput: case BuildStep::MessageOutput:
textFormat.setForeground(mix_colors(p.color(QPalette::Text), QColor(Qt::blue))); textFormat.setForeground(theme->color(Theme::CompileOutput_MessageOutput));
break; break;
case BuildStep::ErrorMessageOutput: case BuildStep::ErrorMessageOutput:
textFormat.setForeground(mix_colors(p.color(QPalette::Text), QColor(Qt::red))); textFormat.setForeground(theme->color(Theme::CompileOutput_ErrorMessageOutput));
textFormat.setFontWeight(QFont::Bold); textFormat.setFontWeight(QFont::Bold);
break; break;