mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 02:41:49 -05:00
yuzu qt: Make most UISettings a BasicSetting
For simple primitive settings, moves their defaults and labels to definition time. Also fixes typo and clang-format yuzu qt: config: Fix rng_seed
This commit is contained in:
parent
b91b76df4f
commit
7a8de138df
12 changed files with 107 additions and 91 deletions
|
@ -97,14 +97,19 @@ RendererVulkan::RendererVulkan(Core::TelemetrySession& telemetry_session_,
|
||||||
Core::Frontend::EmuWindow& emu_window,
|
Core::Frontend::EmuWindow& emu_window,
|
||||||
Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_,
|
Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_,
|
||||||
std::unique_ptr<Core::Frontend::GraphicsContext> context_) try
|
std::unique_ptr<Core::Frontend::GraphicsContext> context_) try
|
||||||
: RendererBase(emu_window, std::move(context_)), telemetry_session(telemetry_session_),
|
: RendererBase(emu_window, std::move(context_)),
|
||||||
cpu_memory(cpu_memory_), gpu(gpu_), library(OpenLibrary()),
|
telemetry_session(telemetry_session_),
|
||||||
|
cpu_memory(cpu_memory_),
|
||||||
|
gpu(gpu_),
|
||||||
|
library(OpenLibrary()),
|
||||||
instance(CreateInstance(library, dld, VK_API_VERSION_1_1, render_window.GetWindowInfo().type,
|
instance(CreateInstance(library, dld, VK_API_VERSION_1_1, render_window.GetWindowInfo().type,
|
||||||
true, Settings::values.renderer_debug.GetValue())),
|
true, Settings::values.renderer_debug.GetValue())),
|
||||||
debug_callback(Settings::values.renderer_debug ? CreateDebugCallback(instance) : nullptr),
|
debug_callback(Settings::values.renderer_debug ? CreateDebugCallback(instance) : nullptr),
|
||||||
surface(CreateSurface(instance, render_window)),
|
surface(CreateSurface(instance, render_window)),
|
||||||
device(CreateDevice(instance, dld, *surface)), memory_allocator(device, false),
|
device(CreateDevice(instance, dld, *surface)),
|
||||||
state_tracker(gpu), scheduler(device, state_tracker),
|
memory_allocator(device, false),
|
||||||
|
state_tracker(gpu),
|
||||||
|
scheduler(device, state_tracker),
|
||||||
swapchain(*surface, device, scheduler, render_window.GetFramebufferLayout().width,
|
swapchain(*surface, device, scheduler, render_window.GetFramebufferLayout().width,
|
||||||
render_window.GetFramebufferLayout().height, false),
|
render_window.GetFramebufferLayout().height, false),
|
||||||
blit_screen(cpu_memory, render_window, device, memory_allocator, swapchain, scheduler,
|
blit_screen(cpu_memory, render_window, device, memory_allocator, swapchain, scheduler,
|
||||||
|
|
|
@ -272,7 +272,12 @@ void Config::Initialize(const std::string& config_name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicity std::string definition: Qt can't implicitly convert a std::string to a QVariant, nor
|
/* {Read,Write}BasicSetting and WriteGlobalSetting templates must be defined here before their
|
||||||
|
* usages later in this file. This allows explicit definition of some types that don't work
|
||||||
|
* nicely with the general version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Explicit std::string definition: Qt can't implicitly convert a std::string to a QVariant, nor
|
||||||
// can it implicitly convert a QVariant back to a {std::,Q}string
|
// can it implicitly convert a QVariant back to a {std::,Q}string
|
||||||
template <>
|
template <>
|
||||||
void Config::ReadBasicSetting(Settings::BasicSetting<std::string>& setting) {
|
void Config::ReadBasicSetting(Settings::BasicSetting<std::string>& setting) {
|
||||||
|
@ -1375,8 +1380,7 @@ void Config::SaveRendererValues() {
|
||||||
void Config::SaveScreenshotValues() {
|
void Config::SaveScreenshotValues() {
|
||||||
qt_config->beginGroup(QStringLiteral("Screenshots"));
|
qt_config->beginGroup(QStringLiteral("Screenshots"));
|
||||||
|
|
||||||
WriteSetting(QStringLiteral("enable_screenshot_save_as"),
|
WriteBasicSetting(UISettings::values.enable_screenshot_save_as);
|
||||||
UISettings::values.enable_screenshot_save_as);
|
|
||||||
WriteSetting(QStringLiteral("screenshot_path"),
|
WriteSetting(QStringLiteral("screenshot_path"),
|
||||||
QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::ScreenshotsDir)));
|
QString::fromStdString(FS::GetYuzuPathString(FS::YuzuPath::ScreenshotsDir)));
|
||||||
|
|
||||||
|
@ -1412,10 +1416,10 @@ void Config::SaveSystemValues() {
|
||||||
WriteGlobalSetting(Settings::values.time_zone_index);
|
WriteGlobalSetting(Settings::values.time_zone_index);
|
||||||
|
|
||||||
WriteSetting(QStringLiteral("rng_seed_enabled"),
|
WriteSetting(QStringLiteral("rng_seed_enabled"),
|
||||||
Settings::values.rng_seed.GetValue(global).has_value(),
|
Settings::values.rng_seed.GetValue(global).has_value(), false,
|
||||||
Settings::values.rng_seed.UsingGlobal(), false);
|
Settings::values.rng_seed.UsingGlobal());
|
||||||
WriteSetting(QStringLiteral("rng_seed"), Settings::values.rng_seed.GetValue(global).value_or(0),
|
WriteSetting(QStringLiteral("rng_seed"), Settings::values.rng_seed.GetValue(global).value_or(0),
|
||||||
Settings::values.rng_seed.UsingGlobal(), 0);
|
0, Settings::values.rng_seed.UsingGlobal());
|
||||||
|
|
||||||
if (global) {
|
if (global) {
|
||||||
WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(),
|
WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(),
|
||||||
|
@ -1436,10 +1440,8 @@ void Config::SaveUIValues() {
|
||||||
|
|
||||||
WriteSetting(QStringLiteral("theme"), UISettings::values.theme,
|
WriteSetting(QStringLiteral("theme"), UISettings::values.theme,
|
||||||
QString::fromUtf8(UISettings::themes[0].second));
|
QString::fromUtf8(UISettings::themes[0].second));
|
||||||
WriteSetting(QStringLiteral("enable_discord_presence"),
|
WriteBasicSetting(UISettings::values.enable_discord_presence);
|
||||||
UISettings::values.enable_discord_presence, true);
|
WriteBasicSetting(UISettings::values.select_user_on_boot);
|
||||||
WriteSetting(QStringLiteral("select_user_on_boot"), UISettings::values.select_user_on_boot,
|
|
||||||
false);
|
|
||||||
|
|
||||||
SaveUIGamelistValues();
|
SaveUIGamelistValues();
|
||||||
SaveUILayoutValues();
|
SaveUILayoutValues();
|
||||||
|
@ -1447,18 +1449,17 @@ void Config::SaveUIValues() {
|
||||||
SaveScreenshotValues();
|
SaveScreenshotValues();
|
||||||
SaveShortcutValues();
|
SaveShortcutValues();
|
||||||
|
|
||||||
WriteSetting(QStringLiteral("singleWindowMode"), UISettings::values.single_window_mode, true);
|
WriteBasicSetting(UISettings::values.single_window_mode);
|
||||||
WriteSetting(QStringLiteral("fullscreen"), UISettings::values.fullscreen, false);
|
WriteBasicSetting(UISettings::values.fullscreen);
|
||||||
WriteSetting(QStringLiteral("displayTitleBars"), UISettings::values.display_titlebar, true);
|
WriteBasicSetting(UISettings::values.display_titlebar);
|
||||||
WriteSetting(QStringLiteral("showFilterBar"), UISettings::values.show_filter_bar, true);
|
WriteBasicSetting(UISettings::values.show_filter_bar);
|
||||||
WriteSetting(QStringLiteral("showStatusBar"), UISettings::values.show_status_bar, true);
|
WriteBasicSetting(UISettings::values.show_status_bar);
|
||||||
WriteSetting(QStringLiteral("confirmClose"), UISettings::values.confirm_before_closing, true);
|
WriteBasicSetting(UISettings::values.confirm_before_closing);
|
||||||
WriteSetting(QStringLiteral("firstStart"), UISettings::values.first_start, true);
|
WriteBasicSetting(UISettings::values.first_start);
|
||||||
WriteSetting(QStringLiteral("calloutFlags"), UISettings::values.callout_flags, 0);
|
WriteBasicSetting(UISettings::values.callout_flags);
|
||||||
WriteSetting(QStringLiteral("showConsole"), UISettings::values.show_console, false);
|
WriteBasicSetting(UISettings::values.show_console);
|
||||||
WriteSetting(QStringLiteral("pauseWhenInBackground"),
|
WriteBasicSetting(UISettings::values.pause_when_in_background);
|
||||||
UISettings::values.pause_when_in_background, false);
|
WriteBasicSetting(UISettings::values.hide_mouse);
|
||||||
WriteSetting(QStringLiteral("hideInactiveMouse"), UISettings::values.hide_mouse, false);
|
|
||||||
|
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
}
|
}
|
||||||
|
@ -1466,11 +1467,11 @@ void Config::SaveUIValues() {
|
||||||
void Config::SaveUIGamelistValues() {
|
void Config::SaveUIGamelistValues() {
|
||||||
qt_config->beginGroup(QStringLiteral("UIGameList"));
|
qt_config->beginGroup(QStringLiteral("UIGameList"));
|
||||||
|
|
||||||
WriteSetting(QStringLiteral("show_add_ons"), UISettings::values.show_add_ons, true);
|
WriteBasicSetting(UISettings::values.show_add_ons);
|
||||||
WriteSetting(QStringLiteral("icon_size"), UISettings::values.icon_size, 64);
|
WriteBasicSetting(UISettings::values.icon_size);
|
||||||
WriteSetting(QStringLiteral("row_1_text_id"), UISettings::values.row_1_text_id, 3);
|
WriteBasicSetting(UISettings::values.row_1_text_id);
|
||||||
WriteSetting(QStringLiteral("row_2_text_id"), UISettings::values.row_2_text_id, 2);
|
WriteBasicSetting(UISettings::values.row_2_text_id);
|
||||||
WriteSetting(QStringLiteral("cache_game_list"), UISettings::values.cache_game_list, true);
|
WriteBasicSetting(UISettings::values.cache_game_list);
|
||||||
qt_config->beginWriteArray(QStringLiteral("favorites"));
|
qt_config->beginWriteArray(QStringLiteral("favorites"));
|
||||||
for (int i = 0; i < UISettings::values.favorited_ids.size(); i++) {
|
for (int i = 0; i < UISettings::values.favorited_ids.size(); i++) {
|
||||||
qt_config->setArrayIndex(i);
|
qt_config->setArrayIndex(i);
|
||||||
|
@ -1491,8 +1492,7 @@ void Config::SaveUILayoutValues() {
|
||||||
WriteSetting(QStringLiteral("gameListHeaderState"), UISettings::values.gamelist_header_state);
|
WriteSetting(QStringLiteral("gameListHeaderState"), UISettings::values.gamelist_header_state);
|
||||||
WriteSetting(QStringLiteral("microProfileDialogGeometry"),
|
WriteSetting(QStringLiteral("microProfileDialogGeometry"),
|
||||||
UISettings::values.microprofile_geometry);
|
UISettings::values.microprofile_geometry);
|
||||||
WriteSetting(QStringLiteral("microProfileDialogVisible"),
|
WriteBasicSetting(UISettings::values.microprofile_visible);
|
||||||
UISettings::values.microprofile_visible, false);
|
|
||||||
|
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ void ConfigureDebug::SetConfiguration() {
|
||||||
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
|
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
|
||||||
|
|
||||||
ui->toggle_console->setEnabled(runtime_lock);
|
ui->toggle_console->setEnabled(runtime_lock);
|
||||||
ui->toggle_console->setChecked(UISettings::values.show_console);
|
ui->toggle_console->setChecked(UISettings::values.show_console.GetValue());
|
||||||
ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter.GetValue()));
|
ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter.GetValue()));
|
||||||
ui->homebrew_args_edit->setText(
|
ui->homebrew_args_edit->setText(
|
||||||
QString::fromStdString(Settings::values.program_args.GetValue()));
|
QString::fromStdString(Settings::values.program_args.GetValue()));
|
||||||
|
|
|
@ -55,7 +55,7 @@ void ConfigureFilesystem::setConfiguration() {
|
||||||
ui->dump_exefs->setChecked(Settings::values.dump_exefs.GetValue());
|
ui->dump_exefs->setChecked(Settings::values.dump_exefs.GetValue());
|
||||||
ui->dump_nso->setChecked(Settings::values.dump_nso.GetValue());
|
ui->dump_nso->setChecked(Settings::values.dump_nso.GetValue());
|
||||||
|
|
||||||
ui->cache_game_list->setChecked(UISettings::values.cache_game_list);
|
ui->cache_game_list->setChecked(UISettings::values.cache_game_list.GetValue());
|
||||||
|
|
||||||
UpdateEnabledControls();
|
UpdateEnabledControls();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,10 @@ void ConfigureGeneral::SetConfiguration() {
|
||||||
ui->use_multi_core->setEnabled(runtime_lock);
|
ui->use_multi_core->setEnabled(runtime_lock);
|
||||||
ui->use_multi_core->setChecked(Settings::values.use_multi_core.GetValue());
|
ui->use_multi_core->setChecked(Settings::values.use_multi_core.GetValue());
|
||||||
|
|
||||||
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
|
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing.GetValue());
|
||||||
ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot);
|
ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot.GetValue());
|
||||||
ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background);
|
ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background.GetValue());
|
||||||
ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse);
|
ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse.GetValue());
|
||||||
|
|
||||||
ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue());
|
ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue());
|
||||||
ui->frame_limit->setValue(Settings::values.frame_limit.GetValue());
|
ui->frame_limit->setValue(Settings::values.frame_limit.GetValue());
|
||||||
|
|
|
@ -113,11 +113,12 @@ void ConfigureUi::SetConfiguration() {
|
||||||
ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme));
|
ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme));
|
||||||
ui->language_combobox->setCurrentIndex(
|
ui->language_combobox->setCurrentIndex(
|
||||||
ui->language_combobox->findData(UISettings::values.language));
|
ui->language_combobox->findData(UISettings::values.language));
|
||||||
ui->show_add_ons->setChecked(UISettings::values.show_add_ons);
|
ui->show_add_ons->setChecked(UISettings::values.show_add_ons.GetValue());
|
||||||
ui->icon_size_combobox->setCurrentIndex(
|
ui->icon_size_combobox->setCurrentIndex(
|
||||||
ui->icon_size_combobox->findData(UISettings::values.icon_size));
|
ui->icon_size_combobox->findData(UISettings::values.icon_size.GetValue()));
|
||||||
|
|
||||||
ui->enable_screenshot_save_as->setChecked(UISettings::values.enable_screenshot_save_as);
|
ui->enable_screenshot_save_as->setChecked(
|
||||||
|
UISettings::values.enable_screenshot_save_as.GetValue());
|
||||||
ui->screenshot_path_edit->setText(QString::fromStdString(
|
ui->screenshot_path_edit->setText(QString::fromStdString(
|
||||||
Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)));
|
Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)));
|
||||||
}
|
}
|
||||||
|
@ -178,7 +179,7 @@ void ConfigureUi::InitializeRowComboBoxes() {
|
||||||
|
|
||||||
void ConfigureUi::UpdateFirstRowComboBox(bool init) {
|
void ConfigureUi::UpdateFirstRowComboBox(bool init) {
|
||||||
const int currentIndex =
|
const int currentIndex =
|
||||||
init ? UISettings::values.row_1_text_id
|
init ? UISettings::values.row_1_text_id.GetValue()
|
||||||
: ui->row_1_text_combobox->findData(ui->row_1_text_combobox->currentData());
|
: ui->row_1_text_combobox->findData(ui->row_1_text_combobox->currentData());
|
||||||
|
|
||||||
ui->row_1_text_combobox->clear();
|
ui->row_1_text_combobox->clear();
|
||||||
|
@ -197,7 +198,7 @@ void ConfigureUi::UpdateFirstRowComboBox(bool init) {
|
||||||
|
|
||||||
void ConfigureUi::UpdateSecondRowComboBox(bool init) {
|
void ConfigureUi::UpdateSecondRowComboBox(bool init) {
|
||||||
const int currentIndex =
|
const int currentIndex =
|
||||||
init ? UISettings::values.row_2_text_id
|
init ? UISettings::values.row_2_text_id.GetValue()
|
||||||
: ui->row_2_text_combobox->findData(ui->row_2_text_combobox->currentData());
|
: ui->row_2_text_combobox->findData(ui->row_2_text_combobox->currentData());
|
||||||
|
|
||||||
ui->row_2_text_combobox->clear();
|
ui->row_2_text_combobox->clear();
|
||||||
|
|
|
@ -103,7 +103,7 @@ void ConfigureWeb::SetConfiguration() {
|
||||||
|
|
||||||
user_verified = true;
|
user_verified = true;
|
||||||
|
|
||||||
ui->toggle_discordrpc->setChecked(UISettings::values.enable_discord_presence);
|
ui->toggle_discordrpc->setChecked(UISettings::values.enable_discord_presence.GetValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureWeb::ApplyConfiguration() {
|
void ConfigureWeb::ApplyConfiguration() {
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
void ToggleConsole() {
|
void ToggleConsole() {
|
||||||
static bool console_shown = false;
|
static bool console_shown = false;
|
||||||
if (console_shown == UISettings::values.show_console) {
|
if (console_shown == UISettings::values.show_console.GetValue()) {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
console_shown = UISettings::values.show_console;
|
console_shown = UISettings::values.show_console.GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_DEBUG)
|
#if defined(_WIN32) && !defined(_DEBUG)
|
||||||
|
|
|
@ -244,7 +244,8 @@ void GameList::OnUpdateThemedIcons() {
|
||||||
for (int i = 0; i < item_model->invisibleRootItem()->rowCount(); i++) {
|
for (int i = 0; i < item_model->invisibleRootItem()->rowCount(); i++) {
|
||||||
QStandardItem* child = item_model->invisibleRootItem()->child(i);
|
QStandardItem* child = item_model->invisibleRootItem()->child(i);
|
||||||
|
|
||||||
const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64);
|
const int icon_size =
|
||||||
|
std::min(static_cast<int>(UISettings::values.icon_size.GetValue()), 64);
|
||||||
switch (child->data(GameListItem::TypeRole).value<GameListItemType>()) {
|
switch (child->data(GameListItem::TypeRole).value<GameListItemType>()) {
|
||||||
case GameListItemType::SdmcDir:
|
case GameListItemType::SdmcDir:
|
||||||
child->setData(
|
child->setData(
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
setData(qulonglong(program_id), ProgramIdRole);
|
setData(qulonglong(program_id), ProgramIdRole);
|
||||||
setData(game_type, FileTypeRole);
|
setData(game_type, FileTypeRole);
|
||||||
|
|
||||||
const u32 size = UISettings::values.icon_size;
|
const u32 size = UISettings::values.icon_size.GetValue();
|
||||||
|
|
||||||
QPixmap picture;
|
QPixmap picture;
|
||||||
if (!picture.loadFromData(picture_data.data(), static_cast<u32>(picture_data.size()))) {
|
if (!picture.loadFromData(picture_data.data(), static_cast<u32>(picture_data.size()))) {
|
||||||
|
@ -108,8 +108,8 @@ public:
|
||||||
data(TitleRole).toString(),
|
data(TitleRole).toString(),
|
||||||
}};
|
}};
|
||||||
|
|
||||||
const auto& row1 = row_data.at(UISettings::values.row_1_text_id);
|
const auto& row1 = row_data.at(UISettings::values.row_1_text_id.GetValue());
|
||||||
const int row2_id = UISettings::values.row_2_text_id;
|
const int row2_id = UISettings::values.row_2_text_id.GetValue();
|
||||||
|
|
||||||
if (role == SortRole) {
|
if (role == SortRole) {
|
||||||
return row1.toLower();
|
return row1.toLower();
|
||||||
|
@ -233,7 +233,8 @@ public:
|
||||||
UISettings::GameDir* game_dir = &directory;
|
UISettings::GameDir* game_dir = &directory;
|
||||||
setData(QVariant(UISettings::values.game_dirs.indexOf(directory)), GameDirRole);
|
setData(QVariant(UISettings::values.game_dirs.indexOf(directory)), GameDirRole);
|
||||||
|
|
||||||
const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64);
|
const int icon_size =
|
||||||
|
std::min(static_cast<int>(UISettings::values.icon_size.GetValue()), 64);
|
||||||
switch (dir_type) {
|
switch (dir_type) {
|
||||||
case GameListItemType::SdmcDir:
|
case GameListItemType::SdmcDir:
|
||||||
setData(
|
setData(
|
||||||
|
@ -294,7 +295,8 @@ public:
|
||||||
explicit GameListAddDir() {
|
explicit GameListAddDir() {
|
||||||
setData(type(), TypeRole);
|
setData(type(), TypeRole);
|
||||||
|
|
||||||
const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64);
|
const int icon_size =
|
||||||
|
std::min(static_cast<int>(UISettings::values.icon_size.GetValue()), 64);
|
||||||
setData(QIcon::fromTheme(QStringLiteral("plus"))
|
setData(QIcon::fromTheme(QStringLiteral("plus"))
|
||||||
.pixmap(icon_size)
|
.pixmap(icon_size)
|
||||||
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||||
|
@ -316,7 +318,8 @@ public:
|
||||||
explicit GameListFavorites() {
|
explicit GameListFavorites() {
|
||||||
setData(type(), TypeRole);
|
setData(type(), TypeRole);
|
||||||
|
|
||||||
const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64);
|
const int icon_size =
|
||||||
|
std::min(static_cast<int>(UISettings::values.icon_size.GetValue()), 64);
|
||||||
setData(QIcon::fromTheme(QStringLiteral("star"))
|
setData(QIcon::fromTheme(QStringLiteral("star"))
|
||||||
.pixmap(icon_size)
|
.pixmap(icon_size)
|
||||||
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||||
|
|
|
@ -155,11 +155,13 @@ enum class CalloutFlag : uint32_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
void GMainWindow::ShowTelemetryCallout() {
|
void GMainWindow::ShowTelemetryCallout() {
|
||||||
if (UISettings::values.callout_flags & static_cast<uint32_t>(CalloutFlag::Telemetry)) {
|
if (UISettings::values.callout_flags.GetValue() &
|
||||||
|
static_cast<uint32_t>(CalloutFlag::Telemetry)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UISettings::values.callout_flags |= static_cast<uint32_t>(CalloutFlag::Telemetry);
|
UISettings::values.callout_flags =
|
||||||
|
UISettings::values.callout_flags.GetValue() | static_cast<uint32_t>(CalloutFlag::Telemetry);
|
||||||
const QString telemetry_message =
|
const QString telemetry_message =
|
||||||
tr("<a href='https://yuzu-emu.org/help/feature/telemetry/'>Anonymous "
|
tr("<a href='https://yuzu-emu.org/help/feature/telemetry/'>Anonymous "
|
||||||
"data is collected</a> to help improve yuzu. "
|
"data is collected</a> to help improve yuzu. "
|
||||||
|
@ -215,7 +217,7 @@ GMainWindow::GMainWindow()
|
||||||
default_theme_paths = QIcon::themeSearchPaths();
|
default_theme_paths = QIcon::themeSearchPaths();
|
||||||
UpdateUITheme();
|
UpdateUITheme();
|
||||||
|
|
||||||
SetDiscordEnabled(UISettings::values.enable_discord_presence);
|
SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue());
|
||||||
discord_rpc->Update();
|
discord_rpc->Update();
|
||||||
|
|
||||||
RegisterMetaTypes();
|
RegisterMetaTypes();
|
||||||
|
@ -1059,23 +1061,24 @@ void GMainWindow::RestoreUIState() {
|
||||||
render_window->restoreGeometry(UISettings::values.renderwindow_geometry);
|
render_window->restoreGeometry(UISettings::values.renderwindow_geometry);
|
||||||
#if MICROPROFILE_ENABLED
|
#if MICROPROFILE_ENABLED
|
||||||
microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry);
|
microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry);
|
||||||
microProfileDialog->setVisible(UISettings::values.microprofile_visible);
|
microProfileDialog->setVisible(UISettings::values.microprofile_visible.GetValue());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
game_list->LoadInterfaceLayout();
|
game_list->LoadInterfaceLayout();
|
||||||
|
|
||||||
ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode);
|
ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode.GetValue());
|
||||||
ToggleWindowMode();
|
ToggleWindowMode();
|
||||||
|
|
||||||
ui.action_Fullscreen->setChecked(UISettings::values.fullscreen);
|
ui.action_Fullscreen->setChecked(UISettings::values.fullscreen.GetValue());
|
||||||
|
|
||||||
ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar);
|
ui.action_Display_Dock_Widget_Headers->setChecked(
|
||||||
|
UISettings::values.display_titlebar.GetValue());
|
||||||
OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked());
|
OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked());
|
||||||
|
|
||||||
ui.action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar);
|
ui.action_Show_Filter_Bar->setChecked(UISettings::values.show_filter_bar.GetValue());
|
||||||
game_list->SetFilterVisible(ui.action_Show_Filter_Bar->isChecked());
|
game_list->SetFilterVisible(ui.action_Show_Filter_Bar->isChecked());
|
||||||
|
|
||||||
ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar);
|
ui.action_Show_Status_Bar->setChecked(UISettings::values.show_status_bar.GetValue());
|
||||||
statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked());
|
statusBar()->setVisible(ui.action_Show_Status_Bar->isChecked());
|
||||||
Debugger::ToggleConsole();
|
Debugger::ToggleConsole();
|
||||||
}
|
}
|
||||||
|
@ -1242,13 +1245,14 @@ bool GMainWindow::LoadROM(const QString& filename, std::size_t program_index) {
|
||||||
const Core::System::ResultStatus result{
|
const Core::System::ResultStatus result{
|
||||||
system.Load(*render_window, filename.toStdString(), program_index)};
|
system.Load(*render_window, filename.toStdString(), program_index)};
|
||||||
|
|
||||||
const auto drd_callout =
|
const auto drd_callout = (UISettings::values.callout_flags.GetValue() &
|
||||||
(UISettings::values.callout_flags & static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0;
|
static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0;
|
||||||
|
|
||||||
if (result == Core::System::ResultStatus::Success &&
|
if (result == Core::System::ResultStatus::Success &&
|
||||||
system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory &&
|
system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory &&
|
||||||
drd_callout) {
|
drd_callout) {
|
||||||
UISettings::values.callout_flags |= static_cast<u32>(CalloutFlag::DRDDeprecation);
|
UISettings::values.callout_flags = UISettings::values.callout_flags.GetValue() |
|
||||||
|
static_cast<u32>(CalloutFlag::DRDDeprecation);
|
||||||
QMessageBox::warning(
|
QMessageBox::warning(
|
||||||
this, tr("Warning Outdated Game Format"),
|
this, tr("Warning Outdated Game Format"),
|
||||||
tr("You are using the deconstructed ROM directory format for this game, which is an "
|
tr("You are using the deconstructed ROM directory format for this game, which is an "
|
||||||
|
@ -2609,7 +2613,7 @@ void GMainWindow::ResetWindowSize1080() {
|
||||||
|
|
||||||
void GMainWindow::OnConfigure() {
|
void GMainWindow::OnConfigure() {
|
||||||
const auto old_theme = UISettings::values.theme;
|
const auto old_theme = UISettings::values.theme;
|
||||||
const bool old_discord_presence = UISettings::values.enable_discord_presence;
|
const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue();
|
||||||
|
|
||||||
ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get());
|
ConfigureDialog configure_dialog(this, hotkey_registry, input_subsystem.get());
|
||||||
connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this,
|
connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this,
|
||||||
|
@ -2666,8 +2670,8 @@ void GMainWindow::OnConfigure() {
|
||||||
if (UISettings::values.theme != old_theme) {
|
if (UISettings::values.theme != old_theme) {
|
||||||
UpdateUITheme();
|
UpdateUITheme();
|
||||||
}
|
}
|
||||||
if (UISettings::values.enable_discord_presence != old_discord_presence) {
|
if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) {
|
||||||
SetDiscordEnabled(UISettings::values.enable_discord_presence);
|
SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue());
|
||||||
}
|
}
|
||||||
emit UpdateThemedIcons();
|
emit UpdateThemedIcons();
|
||||||
|
|
||||||
|
@ -2823,7 +2827,8 @@ void GMainWindow::OnCaptureScreenshot() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor, filename);
|
render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor.GetValue(),
|
||||||
|
filename);
|
||||||
OnStartGame();
|
OnStartGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "common/settings.h"
|
||||||
|
|
||||||
namespace UISettings {
|
namespace UISettings {
|
||||||
|
|
||||||
|
@ -48,26 +49,26 @@ struct Values {
|
||||||
QByteArray gamelist_header_state;
|
QByteArray gamelist_header_state;
|
||||||
|
|
||||||
QByteArray microprofile_geometry;
|
QByteArray microprofile_geometry;
|
||||||
bool microprofile_visible;
|
Settings::BasicSetting<bool> microprofile_visible{false, "microProfileDialogVisible"};
|
||||||
|
|
||||||
bool single_window_mode;
|
Settings::BasicSetting<bool> single_window_mode{true, "singleWindowMode"};
|
||||||
bool fullscreen;
|
Settings::BasicSetting<bool> fullscreen{false, "fullscreen"};
|
||||||
bool display_titlebar;
|
Settings::BasicSetting<bool> display_titlebar{true, "displayTitleBars"};
|
||||||
bool show_filter_bar;
|
Settings::BasicSetting<bool> show_filter_bar{true, "showFilterBar"};
|
||||||
bool show_status_bar;
|
Settings::BasicSetting<bool> show_status_bar{true, "showStatusBar"};
|
||||||
|
|
||||||
bool confirm_before_closing;
|
Settings::BasicSetting<bool> confirm_before_closing{true, "confirmClose"};
|
||||||
bool first_start;
|
Settings::BasicSetting<bool> first_start{true, "firstStart"};
|
||||||
bool pause_when_in_background;
|
Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
|
||||||
bool hide_mouse;
|
Settings::BasicSetting<bool> hide_mouse{false, "hideInactiveMouse"};
|
||||||
|
|
||||||
bool select_user_on_boot;
|
Settings::BasicSetting<bool> select_user_on_boot{false, "select_user_on_boot"};
|
||||||
|
|
||||||
// Discord RPC
|
// Discord RPC
|
||||||
bool enable_discord_presence;
|
Settings::BasicSetting<bool> enable_discord_presence{true, "enable_discord_presence"};
|
||||||
|
|
||||||
bool enable_screenshot_save_as;
|
Settings::BasicSetting<bool> enable_screenshot_save_as{true, "enable_screenshot_save_as"};
|
||||||
u16 screenshot_resolution_factor;
|
Settings::BasicSetting<u16> screenshot_resolution_factor{0, "screenshot_resolution_factor"};
|
||||||
|
|
||||||
QString roms_path;
|
QString roms_path;
|
||||||
QString symbols_path;
|
QString symbols_path;
|
||||||
|
@ -83,18 +84,18 @@ struct Values {
|
||||||
// Shortcut name <Shortcut, context>
|
// Shortcut name <Shortcut, context>
|
||||||
std::vector<Shortcut> shortcuts;
|
std::vector<Shortcut> shortcuts;
|
||||||
|
|
||||||
uint32_t callout_flags;
|
Settings::BasicSetting<uint32_t> callout_flags{0, "calloutFlags"};
|
||||||
|
|
||||||
// logging
|
// logging
|
||||||
bool show_console;
|
Settings::BasicSetting<bool> show_console{false, "showConsole"};
|
||||||
|
|
||||||
// Game List
|
// Game List
|
||||||
bool show_add_ons;
|
Settings::BasicSetting<bool> show_add_ons{true, "show_add_ons"};
|
||||||
uint32_t icon_size;
|
Settings::BasicSetting<uint32_t> icon_size{64, "icon_size"};
|
||||||
uint8_t row_1_text_id;
|
Settings::BasicSetting<uint8_t> row_1_text_id{3, "row_1_text_id"};
|
||||||
uint8_t row_2_text_id;
|
Settings::BasicSetting<uint8_t> row_2_text_id{2, "row_2_text_id"};
|
||||||
std::atomic_bool is_game_list_reload_pending{false};
|
std::atomic_bool is_game_list_reload_pending{false};
|
||||||
bool cache_game_list;
|
Settings::BasicSetting<bool> cache_game_list{true, "cache_game_list"};
|
||||||
|
|
||||||
bool configuration_applied;
|
bool configuration_applied;
|
||||||
bool reset_to_defaults;
|
bool reset_to_defaults;
|
||||||
|
|
Loading…
Reference in a new issue