mirror of
https://github.com/YACReader/yacreader
synced 2026-04-12 15:49:53 -04:00
Simplify the sidebar splitter theming
This commit is contained in:
@ -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;
|
||||
|
||||
@ -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 ¶ms)
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user