Terminal: Improve color tooltips

Change-Id: Ifc2fdb4369767a65c79a784d1f68caac81497db1
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Marcus Tillmanns
2023-10-10 10:19:53 +02:00
parent f73d288609
commit c4ea695411

View File

@@ -69,11 +69,13 @@ static QString defaultShell()
void setupColor(TerminalSettings *settings,
ColorAspect &color,
const QString &label,
const QColor &defaultColor)
const QColor &defaultColor,
const QString &humanReadableName = {})
{
color.setSettingsKey(keyFromString(label));
color.setDefaultValue(defaultColor);
color.setToolTip(Tr::tr("The color used for %1.").arg(label));
color.setToolTip(Tr::tr("The color used for %1.")
.arg(humanReadableName.isEmpty() ? label : humanReadableName));
settings->registerAspect(&color);
}
@@ -502,47 +504,37 @@ TerminalSettings::TerminalSettings()
enableMouseTracking.setToolTip(Tr::tr("Enables mouse tracking in the terminal."));
enableMouseTracking.setDefaultValue(true);
setupColor(this,
foregroundColor,
"Foreground",
Utils::creatorTheme()->color(Theme::TerminalForeground));
setupColor(this,
backgroundColor,
"Background",
Utils::creatorTheme()->color(Theme::TerminalBackground));
setupColor(this,
selectionColor,
"Selection",
Utils::creatorTheme()->color(Theme::TerminalSelection));
Theme *theme = Utils::creatorTheme();
setupColor(this,
findMatchColor,
"Find matches",
Utils::creatorTheme()->color(Theme::TerminalFindMatch));
setupColor(this, foregroundColor, "Foreground", theme->color(Theme::TerminalForeground));
setupColor(this, backgroundColor, "Background", theme->color(Theme::TerminalBackground));
setupColor(this, selectionColor, "Selection", theme->color(Theme::TerminalSelection));
setupColor(this, colors[0], "0", Utils::creatorTheme()->color(Theme::TerminalAnsi0));
setupColor(this, colors[8], "8", Utils::creatorTheme()->color(Theme::TerminalAnsi8));
setupColor(this, findMatchColor, "Find matches", theme->color(Theme::TerminalFindMatch));
setupColor(this, colors[1], "1", Utils::creatorTheme()->color(Theme::TerminalAnsi1));
setupColor(this, colors[9], "9", Utils::creatorTheme()->color(Theme::TerminalAnsi9));
setupColor(this, colors[0], "0", theme->color(Theme::TerminalAnsi0), "black");
setupColor(this, colors[8], "8", theme->color(Theme::TerminalAnsi8), "bright black");
setupColor(this, colors[2], "2", Utils::creatorTheme()->color(Theme::TerminalAnsi2));
setupColor(this, colors[10], "10", Utils::creatorTheme()->color(Theme::TerminalAnsi10));
setupColor(this, colors[1], "1", theme->color(Theme::TerminalAnsi1), "red");
setupColor(this, colors[9], "9", theme->color(Theme::TerminalAnsi9), "bright red");
setupColor(this, colors[3], "3", Utils::creatorTheme()->color(Theme::TerminalAnsi3));
setupColor(this, colors[11], "11", Utils::creatorTheme()->color(Theme::TerminalAnsi11));
setupColor(this, colors[2], "2", theme->color(Theme::TerminalAnsi2), "green");
setupColor(this, colors[10], "10", theme->color(Theme::TerminalAnsi10), "bright green");
setupColor(this, colors[4], "4", Utils::creatorTheme()->color(Theme::TerminalAnsi4));
setupColor(this, colors[12], "12", Utils::creatorTheme()->color(Theme::TerminalAnsi12));
setupColor(this, colors[3], "3", theme->color(Theme::TerminalAnsi3), "yellow");
setupColor(this, colors[11], "11", theme->color(Theme::TerminalAnsi11), "bright yellow");
setupColor(this, colors[5], "5", Utils::creatorTheme()->color(Theme::TerminalAnsi5));
setupColor(this, colors[13], "13", Utils::creatorTheme()->color(Theme::TerminalAnsi13));
setupColor(this, colors[4], "4", theme->color(Theme::TerminalAnsi4), "blue");
setupColor(this, colors[12], "12", theme->color(Theme::TerminalAnsi12), "bright blue");
setupColor(this, colors[6], "6", Utils::creatorTheme()->color(Theme::TerminalAnsi6));
setupColor(this, colors[14], "14", Utils::creatorTheme()->color(Theme::TerminalAnsi14));
setupColor(this, colors[5], "5", theme->color(Theme::TerminalAnsi5), "magenta");
setupColor(this, colors[13], "13", theme->color(Theme::TerminalAnsi13), "bright magenta");
setupColor(this, colors[7], "7", Utils::creatorTheme()->color(Theme::TerminalAnsi7));
setupColor(this, colors[15], "15", Utils::creatorTheme()->color(Theme::TerminalAnsi15));
setupColor(this, colors[6], "6", theme->color(Theme::TerminalAnsi6), "cyan");
setupColor(this, colors[14], "14", theme->color(Theme::TerminalAnsi14), "bright cyan");
setupColor(this, colors[7], "7", theme->color(Theme::TerminalAnsi7), "white");
setupColor(this, colors[15], "15", theme->color(Theme::TerminalAnsi15), "bright white");
setLayouter([this] {
using namespace Layouting;