Fix OLED theme background image issue

Fixes #2601

Update the OLED theme to support the "Show background image" option.

* Add code to `src/qt_gui/main_window_themes.cpp` to set the background image if `Config::getShowBackgroundImage()` is true.
* Adjust the opacity and other settings for the OLED theme in `src/qt_gui/main_window_themes.cpp`.
* Update the `SetGridBackgroundImage` function in `src/qt_gui/game_grid_frame.cpp` to handle the OLED theme.
* Update the `SetListBackgroundImage` function in `src/qt_gui/game_list_frame.cpp` to handle the OLED theme.
This commit is contained in:
Michal Margetín 2025-03-06 13:14:44 +01:00
parent 0efe9a4d0f
commit 42db52c229
3 changed files with 14 additions and 4 deletions

View File

@ -1,10 +1,10 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/path_util.h"
#include "game_grid_frame.h"
#include "qt_gui/compatibility_info.h"
GameGridFrame::GameGridFrame(std::shared_ptr<GameInfoClass> game_info_get,
std::shared_ptr<CompatibilityInfoClass> compat_info_get,
QWidget* parent)

View File

@ -1,6 +1,5 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <QToolTip>
#include "common/config.h"
#include "common/logging/log.h"
@ -9,6 +8,7 @@
#include "game_list_frame.h"
#include "game_list_utils.h"
GameListFrame::GameListFrame(std::shared_ptr<GameInfoClass> game_info_get,
std::shared_ptr<CompatibilityInfoClass> compat_info_get,
QWidget* parent)
@ -418,4 +418,4 @@ QString GameListFrame::GetPlayTime(const std::string& serial) {
QTableWidgetItem* GameListFrame::GetCurrentItem() {
return m_current_item;
}
}

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "main_window_themes.h"
#include "common/config.h"
void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
QPalette themePalette;
@ -189,6 +190,15 @@ void WindowThemes::SetWindowTheme(Theme theme, QLineEdit* mw_searchbar) {
"QCheckBox::indicator:unchecked {"
"border: 1px solid #808080; border-radius: 4px; }");
if (Config::getShowBackgroundImage()) {
qApp->setStyleSheet(qApp->styleSheet() +
"QWidget {"
"background-image: url(:/images/background.jpg);"
"background-repeat: no-repeat;"
"background-position: center;"
"background-attachment: fixed;"
"opacity: " + QString::number(Config::getBackgroundImageOpacity() / 100.0) + "; }");
}
break;
}
}
}