Terminal: Add default themes to Creator themes

Fixes: QTCREATORBUG-28939
Change-Id: I51ded621cdd2e87743a93853686bba09aa9aa44d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Marcus Tillmanns
2023-03-23 14:28:06 +01:00
parent 6e0a50c660
commit 10816ecbe0
10 changed files with 202 additions and 20 deletions

View File

@@ -385,6 +385,26 @@ QmlDesigner_FormeditorBackgroundColor=qmlDesignerButtonColor
QmlDesigner_AlternateBackgroundColor=qmlDesignerButtonColor QmlDesigner_AlternateBackgroundColor=qmlDesignerButtonColor
QmlDesigner_ScrollBarHandleColor=ff505050 QmlDesigner_ScrollBarHandleColor=ff505050
TerminalForeground=ffffffff
TerminalBackground=ff000000
TerminalSelection=7fffffff
TerminalAnsi0=000000
TerminalAnsi1=8b1b10
TerminalAnsi2=4aa32e
TerminalAnsi3=9a9a2f
TerminalAnsi4=0000ab
TerminalAnsi5=a320ac
TerminalAnsi6=49a3b0
TerminalAnsi7=bfbfbf
TerminalAnsi8=666666
TerminalAnsi9=d22d1f
TerminalAnsi10=62d63f
TerminalAnsi11=e5e54b
TerminalAnsi12=0000fe
TerminalAnsi13=d22dde
TerminalAnsi14=69e2e4
TerminalAnsi15=e5e5e6
[Flags] [Flags]
ComboBoxDrawTextShadow=false ComboBoxDrawTextShadow=false
DerivePaletteFromTheme=true DerivePaletteFromTheme=true

View File

@@ -353,6 +353,26 @@ QmlDesigner_FormeditorBackgroundColor=qmlDesignerButtonColor
QmlDesigner_AlternateBackgroundColor=qmlDesignerButtonColor QmlDesigner_AlternateBackgroundColor=qmlDesignerButtonColor
QmlDesigner_ScrollBarHandleColor=ff7a7a7a QmlDesigner_ScrollBarHandleColor=ff7a7a7a
TerminalForeground=ff000000
TerminalBackground=ffffffff
TerminalSelection=7fffffff
TerminalAnsi0=000000
TerminalAnsi1=8b1b10
TerminalAnsi2=4aa32e
TerminalAnsi3=9a9a2f
TerminalAnsi4=0000ab
TerminalAnsi5=a320ac
TerminalAnsi6=49a3b0
TerminalAnsi7=bfbfbf
TerminalAnsi8=666666
TerminalAnsi9=d22d1f
TerminalAnsi10=62d63f
TerminalAnsi11=e5e54b
TerminalAnsi12=0000fe
TerminalAnsi13=d22dde
TerminalAnsi14=69e2e4
TerminalAnsi15=e5e5e6
[Flags] [Flags]
ComboBoxDrawTextShadow=true ComboBoxDrawTextShadow=true
DerivePaletteFromTheme=false DerivePaletteFromTheme=false

View File

@@ -397,6 +397,26 @@ PaletteWindowTextDisabled=textDisabled
PaletteBaseDisabled=backgroundColorDisabled PaletteBaseDisabled=backgroundColorDisabled
PaletteTextDisabled=textDisabled PaletteTextDisabled=textDisabled
TerminalForeground=ff000000
TerminalBackground=ffffffff
TerminalSelection=7fffffff
TerminalAnsi0=000000
TerminalAnsi1=8b1b10
TerminalAnsi2=4aa32e
TerminalAnsi3=9a9a2f
TerminalAnsi4=0000ab
TerminalAnsi5=a320ac
TerminalAnsi6=49a3b0
TerminalAnsi7=bfbfbf
TerminalAnsi8=666666
TerminalAnsi9=d22d1f
TerminalAnsi10=62d63f
TerminalAnsi11=e5e54b
TerminalAnsi12=0000fe
TerminalAnsi13=d22dde
TerminalAnsi14=69e2e4
TerminalAnsi15=e5e5e6
[Flags] [Flags]
ComboBoxDrawTextShadow=false ComboBoxDrawTextShadow=false
DerivePaletteFromTheme=true DerivePaletteFromTheme=true

View File

@@ -497,6 +497,26 @@ PaletteTextDisabled=textDisabled
PaletteMid=ffafafaf PaletteMid=ffafafaf
PalettePlaceholderText=ff808081 PalettePlaceholderText=ff808081
TerminalForeground=ffffffff
TerminalBackground=ff000000
TerminalSelection=7fffffff
TerminalAnsi0=000000
TerminalAnsi1=8b1b10
TerminalAnsi2=4aa32e
TerminalAnsi3=9a9a2f
TerminalAnsi4=0000ab
TerminalAnsi5=a320ac
TerminalAnsi6=49a3b0
TerminalAnsi7=bfbfbf
TerminalAnsi8=666666
TerminalAnsi9=d22d1f
TerminalAnsi10=62d63f
TerminalAnsi11=e5e54b
TerminalAnsi12=0000fe
TerminalAnsi13=d22dde
TerminalAnsi14=69e2e4
TerminalAnsi15=e5e5e6
[Flags] [Flags]
ComboBoxDrawTextShadow=false ComboBoxDrawTextShadow=false
DerivePaletteFromTheme=true DerivePaletteFromTheme=true

View File

@@ -389,6 +389,26 @@ PaletteTextDisabled=textDisabled
PaletteMid=ffa0a0a0 PaletteMid=ffa0a0a0
PalettePlaceholderText=ff7f7f80 PalettePlaceholderText=ff7f7f80
TerminalForeground=ffffffff
TerminalBackground=ff000000
TerminalSelection=7fffffff
TerminalAnsi0=000000
TerminalAnsi1=8b1b10
TerminalAnsi2=4aa32e
TerminalAnsi3=9a9a2f
TerminalAnsi4=0000ab
TerminalAnsi5=a320ac
TerminalAnsi6=49a3b0
TerminalAnsi7=bfbfbf
TerminalAnsi8=666666
TerminalAnsi9=d22d1f
TerminalAnsi10=62d63f
TerminalAnsi11=e5e54b
TerminalAnsi12=0000fe
TerminalAnsi13=d22dde
TerminalAnsi14=69e2e4
TerminalAnsi15=e5e5e6
[Flags] [Flags]
ComboBoxDrawTextShadow=false ComboBoxDrawTextShadow=false
DerivePaletteFromTheme=true DerivePaletteFromTheme=true

View File

@@ -362,6 +362,26 @@ QmlDesigner_FormeditorBackgroundColor=qmlDesignerButtonColor
QmlDesigner_AlternateBackgroundColor=qmlDesignerButtonColor QmlDesigner_AlternateBackgroundColor=qmlDesignerButtonColor
QmlDesigner_ScrollBarHandleColor=ffcccccc QmlDesigner_ScrollBarHandleColor=ffcccccc
TerminalForeground=ff000000
TerminalBackground=ffffffff
TerminalSelection=7fffffff
TerminalAnsi0=000000
TerminalAnsi1=8b1b10
TerminalAnsi2=4aa32e
TerminalAnsi3=9a9a2f
TerminalAnsi4=0000ab
TerminalAnsi5=a320ac
TerminalAnsi6=49a3b0
TerminalAnsi7=bfbfbf
TerminalAnsi8=666666
TerminalAnsi9=d22d1f
TerminalAnsi10=62d63f
TerminalAnsi11=e5e54b
TerminalAnsi12=0000fe
TerminalAnsi13=d22dde
TerminalAnsi14=69e2e4
TerminalAnsi15=e5e5e6
[Flags] [Flags]
ComboBoxDrawTextShadow=false ComboBoxDrawTextShadow=false
DerivePaletteFromTheme=false DerivePaletteFromTheme=false

View File

@@ -360,6 +360,26 @@ QmlDesigner_FormeditorBackgroundColor=qmlDesignerButtonColor
QmlDesigner_AlternateBackgroundColor=qmlDesignerButtonColor QmlDesigner_AlternateBackgroundColor=qmlDesignerButtonColor
QmlDesigner_ScrollBarHandleColor=ff595b5c QmlDesigner_ScrollBarHandleColor=ff595b5c
TerminalForeground=ff000000
TerminalBackground=ffffffff
TerminalSelection=7fffffff
TerminalAnsi0=000000
TerminalAnsi1=8b1b10
TerminalAnsi2=4aa32e
TerminalAnsi3=9a9a2f
TerminalAnsi4=0000ab
TerminalAnsi5=a320ac
TerminalAnsi6=49a3b0
TerminalAnsi7=bfbfbf
TerminalAnsi8=666666
TerminalAnsi9=d22d1f
TerminalAnsi10=62d63f
TerminalAnsi11=e5e54b
TerminalAnsi12=0000fe
TerminalAnsi13=d22dde
TerminalAnsi14=69e2e4
TerminalAnsi15=e5e5e6
[Flags] [Flags]
ComboBoxDrawTextShadow=false ComboBoxDrawTextShadow=false
DerivePaletteFromTheme=false DerivePaletteFromTheme=false

View File

@@ -420,6 +420,27 @@ public:
DSstatePanelBackground, DSstatePanelBackground,
DSstateHighlight, DSstateHighlight,
TerminalForeground,
TerminalBackground,
TerminalSelection,
TerminalAnsi0,
TerminalAnsi1,
TerminalAnsi2,
TerminalAnsi3,
TerminalAnsi4,
TerminalAnsi5,
TerminalAnsi6,
TerminalAnsi7,
TerminalAnsi8,
TerminalAnsi9,
TerminalAnsi10,
TerminalAnsi11,
TerminalAnsi12,
TerminalAnsi13,
TerminalAnsi14,
TerminalAnsi15,
}; };
enum ImageFile { enum ImageFile {

View File

@@ -7,6 +7,7 @@
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/theme/theme.h>
using namespace Utils; using namespace Utils;
@@ -96,33 +97,42 @@ TerminalSettings::TerminalSettings()
shell.setToolTip(Tr::tr("The shell executable to be started as terminal")); shell.setToolTip(Tr::tr("The shell executable to be started as terminal"));
shell.setDefaultValue(defaultShell()); shell.setDefaultValue(defaultShell());
setupColor(this, foregroundColor, "Foreground", QColor::fromRgb(0xff, 0xff, 0xff)); setupColor(this,
setupColor(this, backgroundColor, "Background", QColor::fromRgb(0x0, 0x0, 0x0)); foregroundColor,
setupColor(this, selectionColor, "Selection", QColor::fromRgb(0xFF, 0xFF, 0xFF, 0x7F)); "Foreground",
Utils::creatorTheme()->color(Theme::TerminalForeground));
setupColor(this,
backgroundColor,
"Background",
Utils::creatorTheme()->color(Theme::TerminalBackground));
setupColor(this,
selectionColor,
"Selection",
Utils::creatorTheme()->color(Theme::TerminalSelection));
setupColor(this, colors[0], "0", QColor::fromRgb(0x00, 0x00, 0x00)); setupColor(this, colors[0], "0", Utils::creatorTheme()->color(Theme::TerminalAnsi0));
setupColor(this, colors[8], "8", QColor::fromRgb(102, 102, 102)); setupColor(this, colors[8], "8", Utils::creatorTheme()->color(Theme::TerminalAnsi8));
setupColor(this, colors[1], "1", QColor::fromRgb(139, 27, 16)); setupColor(this, colors[1], "1", Utils::creatorTheme()->color(Theme::TerminalAnsi1));
setupColor(this, colors[9], "9", QColor::fromRgb(210, 45, 31)); setupColor(this, colors[9], "9", Utils::creatorTheme()->color(Theme::TerminalAnsi9));
setupColor(this, colors[2], "2", QColor::fromRgb(74, 163, 46)); setupColor(this, colors[2], "2", Utils::creatorTheme()->color(Theme::TerminalAnsi2));
setupColor(this, colors[10], "10", QColor::fromRgb(98, 214, 63)); setupColor(this, colors[10], "10", Utils::creatorTheme()->color(Theme::TerminalAnsi10));
setupColor(this, colors[3], "3", QColor::fromRgb(154, 154, 47)); setupColor(this, colors[3], "3", Utils::creatorTheme()->color(Theme::TerminalAnsi3));
setupColor(this, colors[11], "11", QColor::fromRgb(229, 229, 75)); setupColor(this, colors[11], "11", Utils::creatorTheme()->color(Theme::TerminalAnsi11));
setupColor(this, colors[4], "4", QColor::fromRgb(0, 0, 171)); setupColor(this, colors[4], "4", Utils::creatorTheme()->color(Theme::TerminalAnsi4));
setupColor(this, colors[12], "12", QColor::fromRgb(0, 0, 254)); setupColor(this, colors[12], "12", Utils::creatorTheme()->color(Theme::TerminalAnsi12));
setupColor(this, colors[5], "5", QColor::fromRgb(163, 32, 172)); setupColor(this, colors[5], "5", Utils::creatorTheme()->color(Theme::TerminalAnsi5));
setupColor(this, colors[13], "13", QColor::fromRgb(210, 45, 222)); setupColor(this, colors[13], "13", Utils::creatorTheme()->color(Theme::TerminalAnsi13));
setupColor(this, colors[6], "6", QColor::fromRgb(73, 163, 176)); setupColor(this, colors[6], "6", Utils::creatorTheme()->color(Theme::TerminalAnsi6));
setupColor(this, colors[14], "14", QColor::fromRgb(105, 226, 228)); setupColor(this, colors[14], "14", Utils::creatorTheme()->color(Theme::TerminalAnsi14));
setupColor(this, colors[7], "7", QColor::fromRgb(191, 191, 191)); setupColor(this, colors[7], "7", Utils::creatorTheme()->color(Theme::TerminalAnsi7));
setupColor(this, colors[15], "15", QColor::fromRgb(229, 229, 230)); setupColor(this, colors[15], "15", Utils::creatorTheme()->color(Theme::TerminalAnsi15));
registerAspect(&font); registerAspect(&font);
registerAspect(&fontSize); registerAspect(&fontSize);

View File

@@ -337,6 +337,7 @@ QWidget *TerminalSettingsPage::widget()
TerminalSettings &settings = TerminalSettings::instance(); TerminalSettings &settings = TerminalSettings::instance();
QPushButton *loadThemeButton = new QPushButton(Tr::tr("Load Theme...")); QPushButton *loadThemeButton = new QPushButton(Tr::tr("Load Theme..."));
QPushButton *resetTheme = new QPushButton(Tr::tr("Reset Theme to default"));
connect(loadThemeButton, &QPushButton::clicked, this, [widget] { connect(loadThemeButton, &QPushButton::clicked, this, [widget] {
const FilePath path = FileUtils::getOpenFilePath( const FilePath path = FileUtils::getOpenFilePath(
@@ -363,6 +364,16 @@ QWidget *TerminalSettingsPage::widget()
QMessageBox::warning(widget, Tr::tr("Error"), result.error()); QMessageBox::warning(widget, Tr::tr("Error"), result.error());
}); });
connect(resetTheme, &QPushButton::clicked, this, [] {
TerminalSettings &settings = TerminalSettings::instance();
settings.foregroundColor.setVolatileValue(settings.foregroundColor.defaultValue());
settings.backgroundColor.setVolatileValue(settings.backgroundColor.defaultValue());
settings.selectionColor.setVolatileValue(settings.selectionColor.defaultValue());
for (auto &color : settings.colors)
color.setVolatileValue(color.defaultValue());
});
// clang-format off // clang-format off
Column { Column {
Row { Row {
@@ -402,7 +413,7 @@ QWidget *TerminalSettingsPage::widget()
settings.colors[14], settings.colors[15] settings.colors[14], settings.colors[15]
}, },
Row { Row {
loadThemeButton, st, loadThemeButton, resetTheme, st,
} }
}, },
}, },