Simplify the sidebar splitter theming

This commit is contained in:
luisangelsm
2026-02-28 09:13:20 +01:00
parent d71048b152
commit b62ce07b15
2 changed files with 2 additions and 35 deletions

View File

@ -136,20 +136,12 @@ struct EmptyContainerTheme {
QMap<int, QPixmap> emptyLabelIcons; // Keyed by YACReader::LabelColors enum value
};
struct SidebarThemeTemplates {
// Non-macOS splitter template: %1 = background color, %2 = height
QString styledSplitterQSS = "QSplitter::handle { image: none; background-color: %1; }"
"QSplitter::handle:vertical { height: %2px;}";
// macOS splitter template: %1 = height, %2 = background color
QString nativeSplitterQSS = "QSplitter::handle:vertical { height: %1px; background-color: %2;}";
};
struct SidebarTheme {
QColor backgroundColor;
QColor separatorColor;
QColor sectionSeparatorColor; // Horizontal separators between sidebar sections
QString splitterQSS;
QString splitterQSS = "QSplitter::handle { image: none; background-color: transparent; }"
"QSplitter::handle:vertical { height: 39px; }";
// When true, section title strings are uppercased after translation
bool uppercaseLabels;

View File

@ -64,17 +64,10 @@ struct EmptyContainerParams {
};
struct SidebarParams {
SidebarThemeTemplates t;
bool useStyledSplitter; // true for non-macOS, false for macOS
QColor backgroundColor;
QColor separatorColor;
QColor sectionSeparatorColor; // Horizontal separators between sidebar sections
// Splitter parameters
QColor splitterBackgroundColor;
int splitterHeight;
bool uppercaseLabels;
// Title bar colors
@ -420,15 +413,6 @@ Theme makeTheme(const ThemeParams &params)
theme.sidebar.backgroundColor = sb.backgroundColor;
theme.sidebar.separatorColor = sb.separatorColor;
theme.sidebar.sectionSeparatorColor = sb.sectionSeparatorColor;
if (sb.useStyledSplitter) {
theme.sidebar.splitterQSS = sb.t.styledSplitterQSS
.arg(sb.splitterBackgroundColor.name())
.arg(sb.splitterHeight);
} else {
theme.sidebar.splitterQSS = sb.t.nativeSplitterQSS
.arg(sb.splitterHeight)
.arg(sb.splitterBackgroundColor.name());
}
theme.sidebar.uppercaseLabels = sb.uppercaseLabels;
theme.sidebar.titleTextColor = sb.titleTextColor;
theme.sidebar.titleDropShadowColor = sb.titleDropShadowColor;
@ -921,12 +905,9 @@ ThemeParams classicThemeParams()
params.emptyContainerParams = ec;
SidebarParams sb;
sb.useStyledSplitter = true;
sb.backgroundColor = QColor(0x454545);
sb.separatorColor = QColor(0xBDBFBF);
sb.sectionSeparatorColor = QColor(0x575757);
sb.splitterBackgroundColor = QColor(0x454545);
sb.splitterHeight = 39;
sb.uppercaseLabels = true;
sb.titleTextColor = QColor(0xBDBFBF);
sb.titleDropShadowColor = Qt::black;
@ -1174,12 +1155,9 @@ ThemeParams lightThemeParams()
params.emptyContainerParams = ec;
SidebarParams sb;
sb.useStyledSplitter = true;
sb.backgroundColor = QColor(0xF1F1F1);
sb.separatorColor = QColor(0x808080);
sb.sectionSeparatorColor = QColor(0xD0D0D0);
sb.splitterBackgroundColor = QColor(0xF1F1F1);
sb.splitterHeight = 39;
sb.uppercaseLabels = true;
sb.titleTextColor = QColor(0x808080);
sb.titleDropShadowColor = QColor(0xFFFFFF);
@ -1427,12 +1405,9 @@ ThemeParams darkThemeParams()
params.emptyContainerParams = ec;
SidebarParams sb;
sb.useStyledSplitter = true;
sb.backgroundColor = QColor(0x454545);
sb.separatorColor = QColor(0xBDBFBF);
sb.sectionSeparatorColor = QColor(0x575757);
sb.splitterBackgroundColor = QColor(0x454545);
sb.splitterHeight = 39;
sb.uppercaseLabels = true;
sb.titleTextColor = QColor(0xBDBFBF);
sb.titleDropShadowColor = Qt::black;