mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-10 05:38:49 +00:00
QT save fixes II (#3119)
* added recentFiles save/load * gui language * fixups for language * fixed language issue with savedata (it was saving based on gui language and not on console language) * clang fix * elf dirs added * added theme
This commit is contained in:
@@ -12,7 +12,8 @@
|
||||
#include "main_window_themes.h"
|
||||
#include "ui_about_dialog.h"
|
||||
|
||||
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDialog) {
|
||||
AboutDialog::AboutDialog(std::shared_ptr<gui_settings> gui_settings, QWidget* parent)
|
||||
: QDialog(parent), ui(new Ui::AboutDialog), m_gui_settings(std::move(gui_settings)) {
|
||||
ui->setupUi(this);
|
||||
preloadImages();
|
||||
|
||||
@@ -57,7 +58,7 @@ void AboutDialog::preloadImages() {
|
||||
}
|
||||
|
||||
void AboutDialog::updateImagesForCurrentTheme() {
|
||||
Theme currentTheme = static_cast<Theme>(Config::getMainWindowTheme());
|
||||
Theme currentTheme = static_cast<Theme>(m_gui_settings->GetValue(gui::gen_theme).toInt());
|
||||
bool isDarkTheme = (currentTheme == Theme::Dark || currentTheme == Theme::Green ||
|
||||
currentTheme == Theme::Blue || currentTheme == Theme::Violet);
|
||||
if (isDarkTheme) {
|
||||
@@ -188,7 +189,7 @@ void AboutDialog::removeHoverEffect(QLabel* label) {
|
||||
}
|
||||
|
||||
bool AboutDialog::isDarkTheme() const {
|
||||
Theme currentTheme = static_cast<Theme>(Config::getMainWindowTheme());
|
||||
Theme currentTheme = static_cast<Theme>(m_gui_settings->GetValue(gui::gen_theme).toInt());
|
||||
return currentTheme == Theme::Dark || currentTheme == Theme::Green ||
|
||||
currentTheme == Theme::Blue || currentTheme == Theme::Violet;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include <QUrl>
|
||||
#include "gui_settings.h"
|
||||
|
||||
namespace Ui {
|
||||
class AboutDialog;
|
||||
@@ -17,7 +18,7 @@ class AboutDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutDialog(QWidget* parent = nullptr);
|
||||
explicit AboutDialog(std::shared_ptr<gui_settings> gui_settings, QWidget* parent = nullptr);
|
||||
~AboutDialog();
|
||||
bool eventFilter(QObject* obj, QEvent* event);
|
||||
|
||||
@@ -33,4 +34,5 @@ private:
|
||||
|
||||
QPixmap originalImages[5];
|
||||
QPixmap invertedImages[5];
|
||||
std::shared_ptr<gui_settings> m_gui_settings;
|
||||
};
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
|
||||
#include "elf_viewer.h"
|
||||
|
||||
ElfViewer::ElfViewer(QWidget* parent) : QTableWidget(parent) {
|
||||
dir_list_std = Config::getElfViewer();
|
||||
for (const auto& str : dir_list_std) {
|
||||
dir_list.append(QString::fromStdString(str));
|
||||
ElfViewer::ElfViewer(std::shared_ptr<gui_settings> gui_settings, QWidget* parent)
|
||||
: QTableWidget(parent), m_gui_settings(std::move(gui_settings)) {
|
||||
|
||||
list = gui_settings::Var2List(m_gui_settings->GetValue(gui::gen_elfDirs));
|
||||
for (const auto& str : list) {
|
||||
dir_list.append(str);
|
||||
}
|
||||
|
||||
CheckElfFolders();
|
||||
@@ -55,11 +57,11 @@ void ElfViewer::OpenElfFolder() {
|
||||
}
|
||||
std::ranges::sort(m_elf_list);
|
||||
OpenElfFiles();
|
||||
dir_list_std.clear();
|
||||
list.clear();
|
||||
for (auto dir : dir_list) {
|
||||
dir_list_std.push_back(dir.toStdString());
|
||||
list.push_back(dir);
|
||||
}
|
||||
Config::setElfViewer(dir_list_std);
|
||||
m_gui_settings->SetValue(gui::gen_elfDirs, gui_settings::List2Var(list));
|
||||
} else {
|
||||
// qDebug() << "Folder selection canceled.";
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
class ElfViewer : public QTableWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ElfViewer(QWidget* parent = nullptr);
|
||||
explicit ElfViewer(std::shared_ptr<gui_settings> gui_settings, QWidget* parent = nullptr);
|
||||
QStringList m_elf_list;
|
||||
|
||||
private:
|
||||
@@ -21,7 +21,8 @@ private:
|
||||
Core::Loader::Elf m_elf_file;
|
||||
QStringList dir_list;
|
||||
QStringList elf_headers_list;
|
||||
std::vector<std::string> dir_list_std;
|
||||
QList<QString> list;
|
||||
std::shared_ptr<gui_settings> m_gui_settings;
|
||||
|
||||
void SetTableItem(QTableWidget* game_list, int row, int column, QString itemStr) {
|
||||
QTableWidgetItem* item = new QTableWidgetItem();
|
||||
|
||||
@@ -34,7 +34,8 @@ GameGridFrame::GameGridFrame(std::shared_ptr<gui_settings> gui_settings,
|
||||
connect(this->horizontalScrollBar(), &QScrollBar::valueChanged, this,
|
||||
&GameGridFrame::RefreshGridBackgroundImage);
|
||||
connect(this, &QTableWidget::customContextMenuRequested, this, [=, this](const QPoint& pos) {
|
||||
m_gui_context_menus.RequestGameMenu(pos, m_game_info->m_games, m_compat_info, this, false);
|
||||
m_gui_context_menus.RequestGameMenu(pos, m_game_info->m_games, m_compat_info,
|
||||
m_gui_settings, this, false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,8 @@ GameListFrame::GameListFrame(std::shared_ptr<gui_settings> gui_settings,
|
||||
});
|
||||
|
||||
connect(this, &QTableWidget::customContextMenuRequested, this, [=, this](const QPoint& pos) {
|
||||
m_gui_context_menus.RequestGameMenu(pos, m_game_info->m_games, m_compat_info, this, true);
|
||||
m_gui_context_menus.RequestGameMenu(pos, m_game_info->m_games, m_compat_info,
|
||||
m_gui_settings, this, true);
|
||||
});
|
||||
|
||||
connect(this, &QTableWidget::cellClicked, this, [=, this](int row, int column) {
|
||||
|
||||
@@ -32,8 +32,10 @@ class GuiContextMenus : public QObject {
|
||||
public:
|
||||
void RequestGameMenu(const QPoint& pos, QVector<GameInfo>& m_games,
|
||||
std::shared_ptr<CompatibilityInfoClass> m_compat_info,
|
||||
QTableWidget* widget, bool isList) {
|
||||
std::shared_ptr<gui_settings> settings, QTableWidget* widget,
|
||||
bool isList) {
|
||||
QPoint global_pos = widget->viewport()->mapToGlobal(pos);
|
||||
std::shared_ptr<gui_settings> m_gui_settings = std::move(settings);
|
||||
int itemID = 0;
|
||||
if (isList) {
|
||||
itemID = widget->currentRow();
|
||||
@@ -357,7 +359,7 @@ public:
|
||||
|
||||
QString gameName = QString::fromStdString(m_games[itemID].name);
|
||||
TrophyViewer* trophyViewer =
|
||||
new TrophyViewer(trophyPath, gameTrpPath, gameName, allTrophyGames);
|
||||
new TrophyViewer(m_gui_settings, trophyPath, gameTrpPath, gameName, allTrophyGames);
|
||||
trophyViewer->show();
|
||||
connect(widget->parent(), &QWidget::destroyed, trophyViewer,
|
||||
[trophyViewer]() { trophyViewer->deleteLater(); });
|
||||
|
||||
@@ -17,6 +17,12 @@ const QString game_grid = "game_grid";
|
||||
const gui_value gen_checkForUpdates = gui_value(general_settings, "checkForUpdates", false);
|
||||
const gui_value gen_showChangeLog = gui_value(general_settings, "showChangeLog", false);
|
||||
const gui_value gen_updateChannel = gui_value(general_settings, "updateChannel", "Release");
|
||||
const gui_value gen_recentFiles =
|
||||
gui_value(main_window, "recentFiles", QVariant::fromValue(QList<QString>()));
|
||||
const gui_value gen_guiLanguage = gui_value(general_settings, "guiLanguage", "en_US");
|
||||
const gui_value gen_elfDirs =
|
||||
gui_value(main_window, "elfDirs", QVariant::fromValue(QList<QString>()));
|
||||
const gui_value gen_theme = gui_value(general_settings, "theme", 0);
|
||||
|
||||
// main window settings
|
||||
const gui_value mw_geometry = gui_value(main_window, "geometry", QByteArray());
|
||||
|
||||
@@ -39,8 +39,6 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
SaveWindowState();
|
||||
const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
||||
Config::saveMainWindow(config_dir / "config.toml");
|
||||
}
|
||||
|
||||
bool MainWindow::Init() {
|
||||
@@ -297,7 +295,7 @@ void MainWindow::CreateDockWindows() {
|
||||
m_game_list_frame->setObjectName("gamelist");
|
||||
m_game_grid_frame.reset(new GameGridFrame(m_gui_settings, m_game_info, m_compat_info, this));
|
||||
m_game_grid_frame->setObjectName("gamegridlist");
|
||||
m_elf_viewer.reset(new ElfViewer(this));
|
||||
m_elf_viewer.reset(new ElfViewer(m_gui_settings, this));
|
||||
m_elf_viewer->setObjectName("elflist");
|
||||
|
||||
int table_mode = m_gui_settings->GetValue(gui::gl_mode).toInt();
|
||||
@@ -492,7 +490,7 @@ void MainWindow::CreateConnects() {
|
||||
#endif
|
||||
|
||||
connect(ui->aboutAct, &QAction::triggered, this, [this]() {
|
||||
auto aboutDialog = new AboutDialog(this);
|
||||
auto aboutDialog = new AboutDialog(m_gui_settings, this);
|
||||
aboutDialog->exec();
|
||||
});
|
||||
|
||||
@@ -771,14 +769,14 @@ void MainWindow::CreateConnects() {
|
||||
|
||||
QString gameName = QString::fromStdString(firstGame.name);
|
||||
TrophyViewer* trophyViewer =
|
||||
new TrophyViewer(trophyPath, gameTrpPath, gameName, allTrophyGames);
|
||||
new TrophyViewer(m_gui_settings, trophyPath, gameTrpPath, gameName, allTrophyGames);
|
||||
trophyViewer->show();
|
||||
});
|
||||
|
||||
// Themes
|
||||
connect(ui->setThemeDark, &QAction::triggered, &m_window_themes, [this]() {
|
||||
m_window_themes.SetWindowTheme(Theme::Dark, ui->mw_searchbar);
|
||||
Config::setMainWindowTheme(static_cast<int>(Theme::Dark));
|
||||
m_gui_settings->SetValue(gui::gen_theme, static_cast<int>(Theme::Dark));
|
||||
if (isIconBlack) {
|
||||
SetUiIcons(false);
|
||||
isIconBlack = false;
|
||||
@@ -786,7 +784,7 @@ void MainWindow::CreateConnects() {
|
||||
});
|
||||
connect(ui->setThemeLight, &QAction::triggered, &m_window_themes, [this]() {
|
||||
m_window_themes.SetWindowTheme(Theme::Light, ui->mw_searchbar);
|
||||
Config::setMainWindowTheme(static_cast<int>(Theme::Light));
|
||||
m_gui_settings->SetValue(gui::gen_theme, static_cast<int>(Theme::Light));
|
||||
if (!isIconBlack) {
|
||||
SetUiIcons(true);
|
||||
isIconBlack = true;
|
||||
@@ -794,7 +792,7 @@ void MainWindow::CreateConnects() {
|
||||
});
|
||||
connect(ui->setThemeGreen, &QAction::triggered, &m_window_themes, [this]() {
|
||||
m_window_themes.SetWindowTheme(Theme::Green, ui->mw_searchbar);
|
||||
Config::setMainWindowTheme(static_cast<int>(Theme::Green));
|
||||
m_gui_settings->SetValue(gui::gen_theme, static_cast<int>(Theme::Green));
|
||||
if (isIconBlack) {
|
||||
SetUiIcons(false);
|
||||
isIconBlack = false;
|
||||
@@ -802,7 +800,7 @@ void MainWindow::CreateConnects() {
|
||||
});
|
||||
connect(ui->setThemeBlue, &QAction::triggered, &m_window_themes, [this]() {
|
||||
m_window_themes.SetWindowTheme(Theme::Blue, ui->mw_searchbar);
|
||||
Config::setMainWindowTheme(static_cast<int>(Theme::Blue));
|
||||
m_gui_settings->SetValue(gui::gen_theme, static_cast<int>(Theme::Blue));
|
||||
if (isIconBlack) {
|
||||
SetUiIcons(false);
|
||||
isIconBlack = false;
|
||||
@@ -810,7 +808,7 @@ void MainWindow::CreateConnects() {
|
||||
});
|
||||
connect(ui->setThemeViolet, &QAction::triggered, &m_window_themes, [this]() {
|
||||
m_window_themes.SetWindowTheme(Theme::Violet, ui->mw_searchbar);
|
||||
Config::setMainWindowTheme(static_cast<int>(Theme::Violet));
|
||||
m_gui_settings->SetValue(gui::gen_theme, static_cast<int>(Theme::Violet));
|
||||
if (isIconBlack) {
|
||||
SetUiIcons(false);
|
||||
isIconBlack = false;
|
||||
@@ -818,7 +816,7 @@ void MainWindow::CreateConnects() {
|
||||
});
|
||||
connect(ui->setThemeGruvbox, &QAction::triggered, &m_window_themes, [this]() {
|
||||
m_window_themes.SetWindowTheme(Theme::Gruvbox, ui->mw_searchbar);
|
||||
Config::setMainWindowTheme(static_cast<int>(Theme::Gruvbox));
|
||||
m_gui_settings->SetValue(gui::gen_theme, static_cast<int>(Theme::Gruvbox));
|
||||
if (isIconBlack) {
|
||||
SetUiIcons(false);
|
||||
isIconBlack = false;
|
||||
@@ -826,7 +824,7 @@ void MainWindow::CreateConnects() {
|
||||
});
|
||||
connect(ui->setThemeTokyoNight, &QAction::triggered, &m_window_themes, [this]() {
|
||||
m_window_themes.SetWindowTheme(Theme::TokyoNight, ui->mw_searchbar);
|
||||
Config::setMainWindowTheme(static_cast<int>(Theme::TokyoNight));
|
||||
m_gui_settings->SetValue(gui::gen_theme, static_cast<int>(Theme::TokyoNight));
|
||||
if (isIconBlack) {
|
||||
SetUiIcons(false);
|
||||
isIconBlack = false;
|
||||
@@ -834,7 +832,7 @@ void MainWindow::CreateConnects() {
|
||||
});
|
||||
connect(ui->setThemeOled, &QAction::triggered, &m_window_themes, [this]() {
|
||||
m_window_themes.SetWindowTheme(Theme::Oled, ui->mw_searchbar);
|
||||
Config::setMainWindowTheme(static_cast<int>(Theme::Oled));
|
||||
m_gui_settings->SetValue(gui::gen_theme, static_cast<int>(Theme::Oled));
|
||||
if (isIconBlack) {
|
||||
SetUiIcons(false);
|
||||
isIconBlack = false;
|
||||
@@ -981,7 +979,7 @@ void MainWindow::InstallDirectory() {
|
||||
}
|
||||
|
||||
void MainWindow::SetLastUsedTheme() {
|
||||
Theme lastTheme = static_cast<Theme>(Config::getMainWindowTheme());
|
||||
Theme lastTheme = static_cast<Theme>(m_gui_settings->GetValue(gui::gen_theme).toInt());
|
||||
m_window_themes.SetWindowTheme(lastTheme, ui->mw_searchbar);
|
||||
|
||||
switch (lastTheme) {
|
||||
@@ -1122,33 +1120,32 @@ void MainWindow::HandleResize(QResizeEvent* event) {
|
||||
}
|
||||
|
||||
void MainWindow::AddRecentFiles(QString filePath) {
|
||||
std::vector<std::string> vec = Config::getRecentFiles();
|
||||
if (!vec.empty()) {
|
||||
if (filePath.toStdString() == vec.at(0)) {
|
||||
QList<QString> list = gui_settings::Var2List(m_gui_settings->GetValue(gui::gen_recentFiles));
|
||||
if (!list.empty()) {
|
||||
if (filePath == list.at(0)) {
|
||||
return;
|
||||
}
|
||||
auto it = std::find(vec.begin(), vec.end(), filePath.toStdString());
|
||||
if (it != vec.end()) {
|
||||
vec.erase(it);
|
||||
auto it = std::find(list.begin(), list.end(), filePath);
|
||||
if (it != list.end()) {
|
||||
list.erase(it);
|
||||
}
|
||||
}
|
||||
vec.insert(vec.begin(), filePath.toStdString());
|
||||
if (vec.size() > 6) {
|
||||
vec.pop_back();
|
||||
list.insert(list.begin(), filePath);
|
||||
if (list.size() > 6) {
|
||||
list.pop_back();
|
||||
}
|
||||
Config::setRecentFiles(vec);
|
||||
const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
||||
Config::saveMainWindow(config_dir / "config.toml");
|
||||
m_gui_settings->SetValue(gui::gen_recentFiles, gui_settings::List2Var(list));
|
||||
CreateRecentGameActions(); // Refresh the QActions.
|
||||
}
|
||||
|
||||
void MainWindow::CreateRecentGameActions() {
|
||||
m_recent_files_group = new QActionGroup(this);
|
||||
ui->menuRecent->clear();
|
||||
std::vector<std::string> vec = Config::getRecentFiles();
|
||||
for (int i = 0; i < vec.size(); i++) {
|
||||
QList<QString> list = gui_settings::Var2List(m_gui_settings->GetValue(gui::gen_recentFiles));
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
QAction* recentFileAct = new QAction(this);
|
||||
recentFileAct->setText(QString::fromStdString(vec.at(i)));
|
||||
recentFileAct->setText(list.at(i));
|
||||
ui->menuRecent->addAction(recentFileAct);
|
||||
m_recent_files_group->addAction(recentFileAct);
|
||||
}
|
||||
@@ -1165,7 +1162,7 @@ void MainWindow::CreateRecentGameActions() {
|
||||
}
|
||||
|
||||
void MainWindow::LoadTranslation() {
|
||||
auto language = QString::fromStdString(Config::getEmulatorLanguage());
|
||||
auto language = m_gui_settings->GetValue(gui::gen_guiLanguage).toString();
|
||||
|
||||
const QString base_dir = QStringLiteral(":/translations");
|
||||
QString base_path = QStringLiteral("%1/%2.qm").arg(base_dir).arg(language);
|
||||
@@ -1190,8 +1187,8 @@ void MainWindow::LoadTranslation() {
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::OnLanguageChanged(const std::string& locale) {
|
||||
Config::setEmulatorLanguage(locale);
|
||||
void MainWindow::OnLanguageChanged(const QString& locale) {
|
||||
m_gui_settings->SetValue(gui::gen_guiLanguage, locale);
|
||||
|
||||
LoadTranslation();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ private Q_SLOTS:
|
||||
void ShowGameList();
|
||||
void RefreshGameTable();
|
||||
void HandleResize(QResizeEvent* event);
|
||||
void OnLanguageChanged(const std::string& locale);
|
||||
void OnLanguageChanged(const QString& locale);
|
||||
void toggleLabelsUnderIcons();
|
||||
|
||||
private:
|
||||
|
||||
@@ -75,3 +75,17 @@ void settings::SetValue(const QString& key, const QString& name, const QVariant&
|
||||
}
|
||||
}
|
||||
}
|
||||
QVariant settings::List2Var(const QList<QString>& list) {
|
||||
QByteArray ba;
|
||||
QDataStream stream(&ba, QIODevice::WriteOnly);
|
||||
stream << list;
|
||||
return QVariant(ba);
|
||||
}
|
||||
|
||||
QList<QString> settings::Var2List(const QVariant& var) {
|
||||
QList<QString> list;
|
||||
QByteArray ba = var.toByteArray();
|
||||
QDataStream stream(&ba, QIODevice::ReadOnly);
|
||||
stream >> list;
|
||||
return list;
|
||||
}
|
||||
@@ -35,6 +35,8 @@ public:
|
||||
|
||||
QVariant GetValue(const QString& key, const QString& name, const QVariant& def) const;
|
||||
QVariant GetValue(const gui_value& entry) const;
|
||||
static QVariant List2Var(const QList<QString>& list);
|
||||
static QList<QString> Var2List(const QVariant& var);
|
||||
|
||||
public Q_SLOTS:
|
||||
/** Remove entry */
|
||||
|
||||
@@ -594,7 +594,7 @@ void SettingsDialog::OnLanguageChanged(int index) {
|
||||
|
||||
ui->retranslateUi(this);
|
||||
|
||||
emit LanguageChanged(ui->emulatorLanguageComboBox->itemData(index).toString().toStdString());
|
||||
emit LanguageChanged(ui->emulatorLanguageComboBox->itemData(index).toString());
|
||||
}
|
||||
|
||||
void SettingsDialog::OnCursorStateChanged(s16 index) {
|
||||
@@ -886,4 +886,5 @@ void SettingsDialog::setDefaultValues() {
|
||||
} else {
|
||||
m_gui_settings->SetValue(gui::gen_updateChannel, "Nightly");
|
||||
}
|
||||
m_gui_settings->SetValue(gui::gen_guiLanguage, "en_US");
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
int exec() override;
|
||||
|
||||
signals:
|
||||
void LanguageChanged(const std::string& locale);
|
||||
void LanguageChanged(const QString& locale);
|
||||
void CompatibilityChanged();
|
||||
void BackgroundOpacityChanged(int opacity);
|
||||
|
||||
|
||||
@@ -104,14 +104,16 @@ void TrophyViewer::updateTableFilters() {
|
||||
}
|
||||
}
|
||||
|
||||
TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath, QString gameName,
|
||||
TrophyViewer::TrophyViewer(std::shared_ptr<gui_settings> gui_settings, QString trophyPath,
|
||||
QString gameTrpPath, QString gameName,
|
||||
const QVector<TrophyGameInfo>& allTrophyGames)
|
||||
: QMainWindow(), allTrophyGames_(allTrophyGames), currentGameName_(gameName) {
|
||||
: QMainWindow(), allTrophyGames_(allTrophyGames), currentGameName_(gameName),
|
||||
m_gui_settings(std::move(gui_settings)) {
|
||||
this->setWindowTitle(tr("Trophy Viewer") + " - " + currentGameName_);
|
||||
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
tabWidget = new QTabWidget(this);
|
||||
|
||||
auto lan = Config::getEmulatorLanguage();
|
||||
auto lan = m_gui_settings->GetValue(gui::gen_guiLanguage).toString();
|
||||
if (lan == "en_US" || lan == "zh_CN" || lan == "zh_TW" || lan == "ja_JP" || lan == "ko_KR" ||
|
||||
lan == "lt_LT" || lan == "nb_NO" || lan == "nl_NL") {
|
||||
useEuropeanDateFormat = false;
|
||||
@@ -463,7 +465,7 @@ void TrophyViewer::SetTableItem(QTableWidget* parent, int row, int column, QStri
|
||||
item->setTextAlignment(Qt::AlignCenter);
|
||||
item->setFont(QFont("Arial", 12, QFont::Bold));
|
||||
|
||||
Theme theme = static_cast<Theme>(Config::getMainWindowTheme());
|
||||
Theme theme = static_cast<Theme>(m_gui_settings->GetValue(gui::gen_theme).toInt());
|
||||
|
||||
if (theme == Theme::Light) {
|
||||
item->setForeground(QBrush(Qt::black));
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "common/types.h"
|
||||
#include "core/file_format/trp.h"
|
||||
#include "gui_settings.h"
|
||||
|
||||
struct TrophyGameInfo {
|
||||
QString name;
|
||||
@@ -34,7 +35,8 @@ class TrophyViewer : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TrophyViewer(
|
||||
QString trophyPath, QString gameTrpPath, QString gameName = "",
|
||||
std::shared_ptr<gui_settings> gui_settings, QString trophyPath, QString gameTrpPath,
|
||||
QString gameName = "",
|
||||
const QVector<TrophyGameInfo>& allTrophyGames = QVector<TrophyGameInfo>());
|
||||
|
||||
void updateTrophyInfo();
|
||||
@@ -77,4 +79,5 @@ private:
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
std::shared_ptr<gui_settings> m_gui_settings;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user