qt: save gui settings to separate file (#2984)

* initial save classes for gui save file

* fixup

* some more settings passed to the new saving file

* even more variables parsing

* more settings

* fixup

* more settings

* more settings

* clang fix

* fixed wrong setting

* more setting

* more setting

* added ca_ES

* rename to general_settings

* added set-addon-folder in main

* fixup

* fixup2

* added sr_CS

* Update CMakeLists.txt

---------

Co-authored-by: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com>
This commit is contained in:
georgemoralis 2025-06-12 13:27:52 +03:00 committed by GitHub
parent 34d0d85c15
commit a1d6cd15f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 383 additions and 370 deletions

View file

@ -9,11 +9,13 @@
#include "game_list_frame.h"
#include "game_list_utils.h"
GameListFrame::GameListFrame(std::shared_ptr<GameInfoClass> game_info_get,
GameListFrame::GameListFrame(std::shared_ptr<gui_settings> gui_settings,
std::shared_ptr<GameInfoClass> game_info_get,
std::shared_ptr<CompatibilityInfoClass> compat_info_get,
QWidget* parent)
: QTableWidget(parent), m_game_info(game_info_get), m_compat_info(compat_info_get) {
icon_size = Config::getIconSize();
: QTableWidget(parent), m_gui_settings(std::move(gui_settings)), m_game_info(game_info_get),
m_compat_info(compat_info_get) {
icon_size = m_gui_settings->GetValue(gui::gl_icon_size).toInt();
this->setShowGrid(false);
this->setEditTriggers(QAbstractItemView::NoEditTriggers);
this->setSelectionBehavior(QAbstractItemView::SelectRows);
@ -97,7 +99,7 @@ void GameListFrame::onCurrentCellChanged(int currentRow, int currentColumn, int
}
void GameListFrame::PlayBackgroundMusic(QTableWidgetItem* item) {
if (!item || !Config::getPlayBGM()) {
if (!item || !m_gui_settings->GetValue(gui::gl_playBackgroundMusic).toBool()) {
BackgroundMusicPlayer::getInstance().stopMusic();
return;
}
@ -172,7 +174,7 @@ void GameListFrame::SetListBackgroundImage(QTableWidgetItem* item) {
}
// If background images are hidden, clear the background image
if (!Config::getShowBackgroundImage()) {
if (!m_gui_settings->GetValue(gui::gl_showBackgroundImage).toBool()) {
backgroundImage = QImage();
m_last_opacity = -1; // Reset opacity tracking when disabled
m_current_game_path.clear(); // Reset current game path
@ -181,7 +183,7 @@ void GameListFrame::SetListBackgroundImage(QTableWidgetItem* item) {
}
const auto& game = m_game_info->m_games[item->row()];
const int opacity = Config::getBackgroundImageOpacity();
const int opacity = m_gui_settings->GetValue(gui::gl_backgroundImageOpacity).toInt();
// Recompute if opacity changed or we switched to a different game
if (opacity != m_last_opacity || game.pic_path != m_current_game_path) {
@ -200,7 +202,8 @@ void GameListFrame::SetListBackgroundImage(QTableWidgetItem* item) {
void GameListFrame::RefreshListBackgroundImage() {
QPalette palette;
if (!backgroundImage.isNull() && Config::getShowBackgroundImage()) {
if (!backgroundImage.isNull() &&
m_gui_settings->GetValue(gui::gl_showBackgroundImage).toBool()) {
QSize widgetSize = size();
QPixmap scaledPixmap =
QPixmap::fromImage(backgroundImage)