Merge pull request 'fix: Adjust & Update Theming for Specific Files from Previous Commit' (#17) from fix/add-updated-files-themes into main

Reviewed-on: https://git.citron-emu.org/Citron/Emulator/pulls/17
This commit is contained in:
Collecting
2025-11-02 05:19:24 +00:00
3 changed files with 77 additions and 13 deletions

View File

@@ -712,6 +712,11 @@ QMenu::item:selected {
color: palette(highlighted-text);
}
QMenu::item:disabled {
color: palette(disabled, text); /* Use the system's disabled text color */
background-color: transparent;
}
QMenu::separator {
height: 1px;
background-color: palette(midlight);

View File

@@ -1,5 +1,6 @@
/*
* SPDX-FileCopyrightText: 2018 yuzu Emulator Project
* SPDX-FileCopyrightText: 2025 citron Emulator Project
* SPDX-License-Identifier: GPL-2.0-or-later
*/
QAbstractSpinBox {
@@ -685,3 +686,58 @@ QDialog#QtSoftwareKeyboardDialog QPushButton#button_space:disabled,
QDialog#QtSoftwareKeyboardDialog QPushButton#button_space_shift:disabled {
image: url(:/overlay/osk_button_Y_disabled.png);
}
QMenuBar {
background-color: #2b2b2b;
color: #d0d0d0;
border-bottom: 1px solid #3d3d3d;
}
QMenuBar::item {
background-color: transparent;
padding: 4px 10px;
color: #d0d0d0;
}
QMenuBar::item:selected {
background-color: #4a4a4a;
color: #ffffff;
}
QMenuBar::item:pressed {
background-color: #5d5d5d;
border-bottom: 1px solid #5d5d5d;
color: #ffffff;
}
/*
* Dropdown Menu Styling
*/
QMenu {
background-color: #2b2b2b;
color: #d0d0d0;
border: 1px solid #4a4a4a;
padding: 5px;
}
QMenu::item {
padding: 5px 25px;
border: 1px solid transparent;
}
QMenu::item:selected {
background-color: #4a9eff;
color: #ffffff;
}
QMenu::item:disabled {
color: #787878; /* A standard, noticeable grey for disabled text */
background-color: transparent; /* Prevent hover effects */
}
QMenu::separator {
height: 1px;
background-color: #4a4a4a;
margin: 4px;
}

View File

@@ -5754,38 +5754,45 @@ static void AdjustLinkColor() {
}
void GMainWindow::UpdateUITheme() {
const QString default_theme = QString::fromUtf8(
UISettings::themes[static_cast<size_t>(UISettings::default_theme)].second);
QString current_theme = QString::fromStdString(UISettings::values.theme);
const QString default_theme_name = QString::fromUtf8(
UISettings::themes[static_cast<size_t>(UISettings::default_theme)].second);
if (current_theme.isEmpty()) {
current_theme = default_theme;
current_theme = default_theme_name;
}
#ifdef _WIN32
QIcon::setThemeName(current_theme);
AdjustLinkColor();
#else
if (current_theme == QStringLiteral("default") || current_theme == QStringLiteral("colorful")) {
QIcon::setThemeName(current_theme == QStringLiteral("colorful") ? current_theme
: startup_icon_theme);
bool is_adaptive_theme = (current_theme == QStringLiteral("default") || current_theme == QStringLiteral("colorful"));
if (is_adaptive_theme) {
// For adaptive themes, check the OS state and load the appropriate stylesheet.
QIcon::setThemeName(current_theme == QStringLiteral("colorful") ? current_theme : startup_icon_theme);
QIcon::setThemeSearchPaths(QStringList(default_theme_paths));
if (CheckDarkMode()) {
current_theme = QStringLiteral("default_dark");
// If OS is dark, use the dark variant of the adaptive theme.
current_theme.append(QStringLiteral("_dark"));
}
} else {
// For explicit themes, use the dedicated icon sets.
QIcon::setThemeName(current_theme);
QIcon::setThemeSearchPaths(QStringList(QStringLiteral(":/icons")));
AdjustLinkColor();
}
#endif
if (current_theme != default_theme) {
// The rest of the function remains the same, loading the resolved theme name.
if (current_theme != default_theme_name) {
QString theme_uri{QStringLiteral(":%1/style.qss").arg(current_theme)};
QFile f(theme_uri);
if (!f.open(QFile::ReadOnly | QFile::Text)) {
LOG_ERROR(Frontend, "Unable to open style \"{}\", fallback to the default theme",
UISettings::values.theme);
current_theme = default_theme;
current_theme = default_theme_name;
}
}
@@ -5794,17 +5801,13 @@ void GMainWindow::UpdateUITheme() {
if (f.open(QFile::ReadOnly | QFile::Text)) {
QTextStream ts(&f);
qApp->setStyleSheet(ts.readAll());
setStyleSheet(ts.readAll());
} else {
LOG_ERROR(Frontend, "Unable to set style \"{}\", stylesheet file not found",
UISettings::values.theme);
qApp->setStyleSheet({});
setStyleSheet({});
}
emit themeChanged();
}
void GMainWindow::LoadTranslation() {