mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-07-07 18:47:56 -05:00
Merge pull request #6539 from lat9nq/default-setting
general: Move most settings' defaults and labels into their definition
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -102,28 +102,75 @@ private:
|
||||
void SaveUILayoutValues();
|
||||
void SaveWebServiceValues();
|
||||
|
||||
/**
|
||||
* Reads a setting from the qt_config.
|
||||
*
|
||||
* @param name The setting's identifier
|
||||
* @param default_value The value to use when the setting is not already present in the config
|
||||
*/
|
||||
QVariant ReadSetting(const QString& name) const;
|
||||
QVariant ReadSetting(const QString& name, const QVariant& default_value) const;
|
||||
// Templated ReadSettingGlobal functions will also look for the use_global setting and set
|
||||
// both the value and the global state properly
|
||||
template <typename Type>
|
||||
void ReadSettingGlobal(Settings::Setting<Type>& setting, const QString& name);
|
||||
template <typename Type>
|
||||
void ReadSettingGlobal(Settings::Setting<Type>& setting, const QString& name,
|
||||
const QVariant& default_value);
|
||||
|
||||
/**
|
||||
* Only reads a setting from the qt_config if the current config is a global config, or if the
|
||||
* current config is a custom config and the setting is overriding the global setting. Otherwise
|
||||
* it does nothing.
|
||||
*
|
||||
* @param setting The variable to be modified
|
||||
* @param name The setting's identifier
|
||||
* @param default_value The value to use when the setting is not already present in the config
|
||||
*/
|
||||
template <typename Type>
|
||||
void ReadSettingGlobal(Type& setting, const QString& name, const QVariant& default_value) const;
|
||||
// Templated WriteSettingGlobal functions will also write the global state if needed and will
|
||||
// skip writing the actual setting if it defers to the global value
|
||||
|
||||
/**
|
||||
* Writes a setting to the qt_config.
|
||||
*
|
||||
* @param name The setting's idetentifier
|
||||
* @param value Value of the setting
|
||||
* @param default_value Default of the setting if not present in qt_config
|
||||
* @param use_global Specifies if the custom or global config should be in use, for custom
|
||||
* configs
|
||||
*/
|
||||
void WriteSetting(const QString& name, const QVariant& value);
|
||||
void WriteSetting(const QString& name, const QVariant& value, const QVariant& default_value);
|
||||
void WriteSetting(const QString& name, const QVariant& value, const QVariant& default_value,
|
||||
bool use_global);
|
||||
|
||||
/**
|
||||
* Reads a value from the qt_config and applies it to the setting, using its label and default
|
||||
* value. If the config is a custom config, this will also read the global state of the setting
|
||||
* and apply that information to it.
|
||||
*
|
||||
* @param The setting
|
||||
*/
|
||||
template <typename Type>
|
||||
void WriteSettingGlobal(const QString& name, const Settings::Setting<Type>& setting);
|
||||
void ReadGlobalSetting(Settings::Setting<Type>& setting);
|
||||
|
||||
/**
|
||||
* Sets a value to the qt_config using the setting's label and default value. If the config is a
|
||||
* custom config, it will apply the global state, and the custom value if needed.
|
||||
*
|
||||
* @param The setting
|
||||
*/
|
||||
template <typename Type>
|
||||
void WriteSettingGlobal(const QString& name, const Settings::Setting<Type>& setting,
|
||||
const QVariant& default_value);
|
||||
void WriteSettingGlobal(const QString& name, const QVariant& value, bool use_global,
|
||||
const QVariant& default_value);
|
||||
void WriteGlobalSetting(const Settings::Setting<Type>& setting);
|
||||
|
||||
/**
|
||||
* Reads a value from the qt_config using the setting's label and default value and applies the
|
||||
* value to the setting.
|
||||
*
|
||||
* @param The setting
|
||||
*/
|
||||
template <typename Type>
|
||||
void ReadBasicSetting(Settings::BasicSetting<Type>& setting);
|
||||
|
||||
/** Sets a value from the setting in the qt_config using the setting's label and default value.
|
||||
*
|
||||
* @param The setting
|
||||
*/
|
||||
template <typename Type>
|
||||
void WriteBasicSetting(const Settings::BasicSetting<Type>& setting);
|
||||
|
||||
ConfigType type;
|
||||
std::unique_ptr<QSettings> qt_config;
|
||||
|
@ -69,7 +69,7 @@ void ConfigureAudio::SetOutputSinkFromSinkID() {
|
||||
[[maybe_unused]] const QSignalBlocker blocker(ui->output_sink_combo_box);
|
||||
|
||||
int new_sink_index = 0;
|
||||
const QString sink_id = QString::fromStdString(Settings::values.sink_id);
|
||||
const QString sink_id = QString::fromStdString(Settings::values.sink_id.GetValue());
|
||||
for (int index = 0; index < ui->output_sink_combo_box->count(); index++) {
|
||||
if (ui->output_sink_combo_box->itemText(index) == sink_id) {
|
||||
new_sink_index = index;
|
||||
@ -83,7 +83,7 @@ void ConfigureAudio::SetOutputSinkFromSinkID() {
|
||||
void ConfigureAudio::SetAudioDeviceFromDeviceID() {
|
||||
int new_device_index = -1;
|
||||
|
||||
const QString device_id = QString::fromStdString(Settings::values.audio_device_id);
|
||||
const QString device_id = QString::fromStdString(Settings::values.audio_device_id.GetValue());
|
||||
for (int index = 0; index < ui->audio_device_combo_box->count(); index++) {
|
||||
if (ui->audio_device_combo_box->itemText(index) == device_id) {
|
||||
new_device_index = index;
|
||||
@ -106,9 +106,9 @@ void ConfigureAudio::ApplyConfiguration() {
|
||||
Settings::values.sink_id =
|
||||
ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex())
|
||||
.toStdString();
|
||||
Settings::values.audio_device_id =
|
||||
Settings::values.audio_device_id.SetValue(
|
||||
ui->audio_device_combo_box->itemText(ui->audio_device_combo_box->currentIndex())
|
||||
.toStdString();
|
||||
.toStdString());
|
||||
|
||||
// Guard if during game and set to game-specific value
|
||||
if (Settings::values.volume.UsingGlobal()) {
|
||||
|
@ -24,23 +24,26 @@ void ConfigureCpuDebug::SetConfiguration() {
|
||||
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
|
||||
|
||||
ui->cpuopt_page_tables->setEnabled(runtime_lock);
|
||||
ui->cpuopt_page_tables->setChecked(Settings::values.cpuopt_page_tables);
|
||||
ui->cpuopt_page_tables->setChecked(Settings::values.cpuopt_page_tables.GetValue());
|
||||
ui->cpuopt_block_linking->setEnabled(runtime_lock);
|
||||
ui->cpuopt_block_linking->setChecked(Settings::values.cpuopt_block_linking);
|
||||
ui->cpuopt_block_linking->setChecked(Settings::values.cpuopt_block_linking.GetValue());
|
||||
ui->cpuopt_return_stack_buffer->setEnabled(runtime_lock);
|
||||
ui->cpuopt_return_stack_buffer->setChecked(Settings::values.cpuopt_return_stack_buffer);
|
||||
ui->cpuopt_return_stack_buffer->setChecked(
|
||||
Settings::values.cpuopt_return_stack_buffer.GetValue());
|
||||
ui->cpuopt_fast_dispatcher->setEnabled(runtime_lock);
|
||||
ui->cpuopt_fast_dispatcher->setChecked(Settings::values.cpuopt_fast_dispatcher);
|
||||
ui->cpuopt_fast_dispatcher->setChecked(Settings::values.cpuopt_fast_dispatcher.GetValue());
|
||||
ui->cpuopt_context_elimination->setEnabled(runtime_lock);
|
||||
ui->cpuopt_context_elimination->setChecked(Settings::values.cpuopt_context_elimination);
|
||||
ui->cpuopt_context_elimination->setChecked(
|
||||
Settings::values.cpuopt_context_elimination.GetValue());
|
||||
ui->cpuopt_const_prop->setEnabled(runtime_lock);
|
||||
ui->cpuopt_const_prop->setChecked(Settings::values.cpuopt_const_prop);
|
||||
ui->cpuopt_const_prop->setChecked(Settings::values.cpuopt_const_prop.GetValue());
|
||||
ui->cpuopt_misc_ir->setEnabled(runtime_lock);
|
||||
ui->cpuopt_misc_ir->setChecked(Settings::values.cpuopt_misc_ir);
|
||||
ui->cpuopt_misc_ir->setChecked(Settings::values.cpuopt_misc_ir.GetValue());
|
||||
ui->cpuopt_reduce_misalign_checks->setEnabled(runtime_lock);
|
||||
ui->cpuopt_reduce_misalign_checks->setChecked(Settings::values.cpuopt_reduce_misalign_checks);
|
||||
ui->cpuopt_reduce_misalign_checks->setChecked(
|
||||
Settings::values.cpuopt_reduce_misalign_checks.GetValue());
|
||||
ui->cpuopt_fastmem->setEnabled(runtime_lock);
|
||||
ui->cpuopt_fastmem->setChecked(Settings::values.cpuopt_fastmem);
|
||||
ui->cpuopt_fastmem->setChecked(Settings::values.cpuopt_fastmem.GetValue());
|
||||
}
|
||||
|
||||
void ConfigureCpuDebug::ApplyConfiguration() {
|
||||
|
@ -31,20 +31,21 @@ void ConfigureDebug::SetConfiguration() {
|
||||
const bool runtime_lock = !Core::System::GetInstance().IsPoweredOn();
|
||||
|
||||
ui->toggle_console->setEnabled(runtime_lock);
|
||||
ui->toggle_console->setChecked(UISettings::values.show_console);
|
||||
ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter));
|
||||
ui->homebrew_args_edit->setText(QString::fromStdString(Settings::values.program_args));
|
||||
ui->toggle_console->setChecked(UISettings::values.show_console.GetValue());
|
||||
ui->log_filter_edit->setText(QString::fromStdString(Settings::values.log_filter.GetValue()));
|
||||
ui->homebrew_args_edit->setText(
|
||||
QString::fromStdString(Settings::values.program_args.GetValue()));
|
||||
ui->fs_access_log->setEnabled(runtime_lock);
|
||||
ui->fs_access_log->setChecked(Settings::values.enable_fs_access_log);
|
||||
ui->reporting_services->setChecked(Settings::values.reporting_services);
|
||||
ui->quest_flag->setChecked(Settings::values.quest_flag);
|
||||
ui->use_debug_asserts->setChecked(Settings::values.use_debug_asserts);
|
||||
ui->use_auto_stub->setChecked(Settings::values.use_auto_stub);
|
||||
ui->fs_access_log->setChecked(Settings::values.enable_fs_access_log.GetValue());
|
||||
ui->reporting_services->setChecked(Settings::values.reporting_services.GetValue());
|
||||
ui->quest_flag->setChecked(Settings::values.quest_flag.GetValue());
|
||||
ui->use_debug_asserts->setChecked(Settings::values.use_debug_asserts.GetValue());
|
||||
ui->use_auto_stub->setChecked(Settings::values.use_auto_stub.GetValue());
|
||||
ui->enable_graphics_debugging->setEnabled(runtime_lock);
|
||||
ui->enable_graphics_debugging->setChecked(Settings::values.renderer_debug);
|
||||
ui->enable_graphics_debugging->setChecked(Settings::values.renderer_debug.GetValue());
|
||||
ui->disable_macro_jit->setEnabled(runtime_lock);
|
||||
ui->disable_macro_jit->setChecked(Settings::values.disable_macro_jit);
|
||||
ui->extended_logging->setChecked(Settings::values.extended_logging);
|
||||
ui->disable_macro_jit->setChecked(Settings::values.disable_macro_jit.GetValue());
|
||||
ui->extended_logging->setChecked(Settings::values.extended_logging.GetValue());
|
||||
}
|
||||
|
||||
void ConfigureDebug::ApplyConfiguration() {
|
||||
@ -61,7 +62,7 @@ void ConfigureDebug::ApplyConfiguration() {
|
||||
Settings::values.extended_logging = ui->extended_logging->isChecked();
|
||||
Debugger::ToggleConsole();
|
||||
Common::Log::Filter filter;
|
||||
filter.ParseFilterString(Settings::values.log_filter);
|
||||
filter.ParseFilterString(Settings::values.log_filter.GetValue());
|
||||
Common::Log::SetGlobalFilter(filter);
|
||||
}
|
||||
|
||||
|
@ -43,18 +43,19 @@ void ConfigureFilesystem::setConfiguration() {
|
||||
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::NANDDir)));
|
||||
ui->sdmc_directory_edit->setText(
|
||||
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::SDMCDir)));
|
||||
ui->gamecard_path_edit->setText(QString::fromStdString(Settings::values.gamecard_path));
|
||||
ui->gamecard_path_edit->setText(
|
||||
QString::fromStdString(Settings::values.gamecard_path.GetValue()));
|
||||
ui->dump_path_edit->setText(
|
||||
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::DumpDir)));
|
||||
ui->load_path_edit->setText(
|
||||
QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::LoadDir)));
|
||||
|
||||
ui->gamecard_inserted->setChecked(Settings::values.gamecard_inserted);
|
||||
ui->gamecard_current_game->setChecked(Settings::values.gamecard_current_game);
|
||||
ui->dump_exefs->setChecked(Settings::values.dump_exefs);
|
||||
ui->dump_nso->setChecked(Settings::values.dump_nso);
|
||||
ui->gamecard_inserted->setChecked(Settings::values.gamecard_inserted.GetValue());
|
||||
ui->gamecard_current_game->setChecked(Settings::values.gamecard_current_game.GetValue());
|
||||
ui->dump_exefs->setChecked(Settings::values.dump_exefs.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();
|
||||
}
|
||||
|
@ -40,10 +40,10 @@ void ConfigureGeneral::SetConfiguration() {
|
||||
ui->use_multi_core->setEnabled(runtime_lock);
|
||||
ui->use_multi_core->setChecked(Settings::values.use_multi_core.GetValue());
|
||||
|
||||
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing);
|
||||
ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot);
|
||||
ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background);
|
||||
ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse);
|
||||
ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing.GetValue());
|
||||
ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot.GetValue());
|
||||
ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background.GetValue());
|
||||
ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse.GetValue());
|
||||
|
||||
ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue());
|
||||
ui->frame_limit->setValue(Settings::values.frame_limit.GetValue());
|
||||
|
@ -148,12 +148,12 @@ void ConfigureInputAdvanced::LoadConfiguration() {
|
||||
}
|
||||
}
|
||||
|
||||
ui->debug_enabled->setChecked(Settings::values.debug_pad_enabled);
|
||||
ui->mouse_enabled->setChecked(Settings::values.mouse_enabled);
|
||||
ui->keyboard_enabled->setChecked(Settings::values.keyboard_enabled);
|
||||
ui->emulate_analog_keyboard->setChecked(Settings::values.emulate_analog_keyboard);
|
||||
ui->mouse_panning->setChecked(Settings::values.mouse_panning);
|
||||
ui->mouse_panning_sensitivity->setValue(Settings::values.mouse_panning_sensitivity);
|
||||
ui->debug_enabled->setChecked(Settings::values.debug_pad_enabled.GetValue());
|
||||
ui->mouse_enabled->setChecked(Settings::values.mouse_enabled.GetValue());
|
||||
ui->keyboard_enabled->setChecked(Settings::values.keyboard_enabled.GetValue());
|
||||
ui->emulate_analog_keyboard->setChecked(Settings::values.emulate_analog_keyboard.GetValue());
|
||||
ui->mouse_panning->setChecked(Settings::values.mouse_panning.GetValue());
|
||||
ui->mouse_panning_sensitivity->setValue(Settings::values.mouse_panning_sensitivity.GetValue());
|
||||
ui->touchscreen_enabled->setChecked(Settings::values.touchscreen.enabled);
|
||||
|
||||
UpdateUIEnabled();
|
||||
|
@ -101,15 +101,16 @@ ConfigureMotionTouch::ConfigureMotionTouch(QWidget* parent,
|
||||
ConfigureMotionTouch::~ConfigureMotionTouch() = default;
|
||||
|
||||
void ConfigureMotionTouch::SetConfiguration() {
|
||||
const Common::ParamPackage motion_param(Settings::values.motion_device);
|
||||
const Common::ParamPackage touch_param(Settings::values.touch_device);
|
||||
const Common::ParamPackage motion_param(Settings::values.motion_device.GetValue());
|
||||
const Common::ParamPackage touch_param(Settings::values.touch_device.GetValue());
|
||||
|
||||
ui->touch_from_button_checkbox->setChecked(Settings::values.use_touch_from_button);
|
||||
ui->touch_from_button_checkbox->setChecked(Settings::values.use_touch_from_button.GetValue());
|
||||
touch_from_button_maps = Settings::values.touch_from_button_maps;
|
||||
for (const auto& touch_map : touch_from_button_maps) {
|
||||
ui->touch_from_button_map->addItem(QString::fromStdString(touch_map.name));
|
||||
}
|
||||
ui->touch_from_button_map->setCurrentIndex(Settings::values.touch_from_button_map_index);
|
||||
ui->touch_from_button_map->setCurrentIndex(
|
||||
Settings::values.touch_from_button_map_index.GetValue());
|
||||
ui->motion_sensitivity->setValue(motion_param.Get("sensitivity", 0.01f));
|
||||
|
||||
min_x = touch_param.Get("min_x", 100);
|
||||
@ -124,7 +125,7 @@ void ConfigureMotionTouch::SetConfiguration() {
|
||||
udp_server_list_model->setStringList({});
|
||||
ui->udp_server_list->setModel(udp_server_list_model);
|
||||
|
||||
std::stringstream ss(Settings::values.udp_input_servers);
|
||||
std::stringstream ss(Settings::values.udp_input_servers.GetValue());
|
||||
std::string token;
|
||||
|
||||
while (std::getline(ss, token, ',')) {
|
||||
|
@ -166,7 +166,7 @@ void ConfigureProfileManager::PopulateUserList() {
|
||||
void ConfigureProfileManager::UpdateCurrentUser() {
|
||||
ui->pm_add->setEnabled(profile_manager->GetUserCount() < Service::Account::MAX_USERS);
|
||||
|
||||
const auto& current_user = profile_manager->GetUser(Settings::values.current_user);
|
||||
const auto& current_user = profile_manager->GetUser(Settings::values.current_user.GetValue());
|
||||
ASSERT(current_user);
|
||||
const auto username = GetAccountUsername(*profile_manager, *current_user);
|
||||
|
||||
@ -245,15 +245,18 @@ void ConfigureProfileManager::DeleteUser() {
|
||||
this, tr("Confirm Delete"),
|
||||
tr("You are about to delete user with name \"%1\". Are you sure?").arg(username));
|
||||
|
||||
if (confirm == QMessageBox::No)
|
||||
if (confirm == QMessageBox::No) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Settings::values.current_user == tree_view->currentIndex().row())
|
||||
if (Settings::values.current_user.GetValue() == tree_view->currentIndex().row()) {
|
||||
Settings::values.current_user = 0;
|
||||
}
|
||||
UpdateCurrentUser();
|
||||
|
||||
if (!profile_manager->RemoveUser(*uuid))
|
||||
if (!profile_manager->RemoveUser(*uuid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
item_model->removeRows(tree_view->currentIndex().row(), 1);
|
||||
tree_view->clearSelection();
|
||||
|
@ -65,7 +65,7 @@ void ConfigureService::RetranslateUi() {
|
||||
|
||||
void ConfigureService::SetConfiguration() {
|
||||
const int index =
|
||||
ui->bcat_source->findData(QString::fromStdString(Settings::values.bcat_backend));
|
||||
ui->bcat_source->findData(QString::fromStdString(Settings::values.bcat_backend.GetValue()));
|
||||
ui->bcat_source->setCurrentIndex(index == -1 ? 0 : index);
|
||||
}
|
||||
|
||||
|
@ -113,11 +113,12 @@ void ConfigureUi::SetConfiguration() {
|
||||
ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme));
|
||||
ui->language_combobox->setCurrentIndex(
|
||||
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->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(
|
||||
Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)));
|
||||
}
|
||||
@ -178,7 +179,7 @@ void ConfigureUi::InitializeRowComboBoxes() {
|
||||
|
||||
void ConfigureUi::UpdateFirstRowComboBox(bool init) {
|
||||
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->clear();
|
||||
@ -197,7 +198,7 @@ void ConfigureUi::UpdateFirstRowComboBox(bool init) {
|
||||
|
||||
void ConfigureUi::UpdateSecondRowComboBox(bool init) {
|
||||
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->clear();
|
||||
|
@ -88,22 +88,22 @@ void ConfigureWeb::SetConfiguration() {
|
||||
ui->web_signup_link->setOpenExternalLinks(true);
|
||||
ui->web_token_info_link->setOpenExternalLinks(true);
|
||||
|
||||
if (Settings::values.yuzu_username.empty()) {
|
||||
if (Settings::values.yuzu_username.GetValue().empty()) {
|
||||
ui->username->setText(tr("Unspecified"));
|
||||
} else {
|
||||
ui->username->setText(QString::fromStdString(Settings::values.yuzu_username));
|
||||
ui->username->setText(QString::fromStdString(Settings::values.yuzu_username.GetValue()));
|
||||
}
|
||||
|
||||
ui->toggle_telemetry->setChecked(Settings::values.enable_telemetry);
|
||||
ui->edit_token->setText(QString::fromStdString(
|
||||
GenerateDisplayToken(Settings::values.yuzu_username, Settings::values.yuzu_token)));
|
||||
ui->toggle_telemetry->setChecked(Settings::values.enable_telemetry.GetValue());
|
||||
ui->edit_token->setText(QString::fromStdString(GenerateDisplayToken(
|
||||
Settings::values.yuzu_username.GetValue(), Settings::values.yuzu_token.GetValue())));
|
||||
|
||||
// Connect after setting the values, to avoid calling OnLoginChanged now
|
||||
connect(ui->edit_token, &QLineEdit::textChanged, this, &ConfigureWeb::OnLoginChanged);
|
||||
|
||||
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() {
|
||||
|
@ -15,10 +15,10 @@
|
||||
namespace Debugger {
|
||||
void ToggleConsole() {
|
||||
static bool console_shown = false;
|
||||
if (console_shown == UISettings::values.show_console) {
|
||||
if (console_shown == UISettings::values.show_console.GetValue()) {
|
||||
return;
|
||||
} else {
|
||||
console_shown = UISettings::values.show_console;
|
||||
console_shown = UISettings::values.show_console.GetValue();
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !defined(_DEBUG)
|
||||
|
@ -244,7 +244,8 @@ void GameList::OnUpdateThemedIcons() {
|
||||
for (int i = 0; i < item_model->invisibleRootItem()->rowCount(); 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>()) {
|
||||
case GameListItemType::SdmcDir:
|
||||
child->setData(
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
setData(qulonglong(program_id), ProgramIdRole);
|
||||
setData(game_type, FileTypeRole);
|
||||
|
||||
const u32 size = UISettings::values.icon_size;
|
||||
const u32 size = UISettings::values.icon_size.GetValue();
|
||||
|
||||
QPixmap picture;
|
||||
if (!picture.loadFromData(picture_data.data(), static_cast<u32>(picture_data.size()))) {
|
||||
@ -108,8 +108,8 @@ public:
|
||||
data(TitleRole).toString(),
|
||||
}};
|
||||
|
||||
const auto& row1 = row_data.at(UISettings::values.row_1_text_id);
|
||||
const int row2_id = UISettings::values.row_2_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.GetValue();
|
||||
|
||||
if (role == SortRole) {
|
||||
return row1.toLower();
|
||||
@ -233,7 +233,8 @@ public:
|
||||
UISettings::GameDir* game_dir = &directory;
|
||||
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) {
|
||||
case GameListItemType::SdmcDir:
|
||||
setData(
|
||||
@ -294,7 +295,8 @@ public:
|
||||
explicit GameListAddDir() {
|
||||
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"))
|
||||
.pixmap(icon_size)
|
||||
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||
@ -316,7 +318,8 @@ public:
|
||||
explicit GameListFavorites() {
|
||||
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"))
|
||||
.pixmap(icon_size)
|
||||
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||
|
@ -156,11 +156,13 @@ enum class CalloutFlag : uint32_t {
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 =
|
||||
tr("<a href='https://yuzu-emu.org/help/feature/telemetry/'>Anonymous "
|
||||
"data is collected</a> to help improve yuzu. "
|
||||
@ -177,7 +179,7 @@ static void InitializeLogging() {
|
||||
using namespace Common;
|
||||
|
||||
Log::Filter log_filter;
|
||||
log_filter.ParseFilterString(Settings::values.log_filter);
|
||||
log_filter.ParseFilterString(Settings::values.log_filter.GetValue());
|
||||
Log::SetGlobalFilter(log_filter);
|
||||
|
||||
const auto log_dir = FS::GetYuzuPath(FS::YuzuPath::LogDir);
|
||||
@ -216,7 +218,7 @@ GMainWindow::GMainWindow()
|
||||
default_theme_paths = QIcon::themeSearchPaths();
|
||||
UpdateUITheme();
|
||||
|
||||
SetDiscordEnabled(UISettings::values.enable_discord_presence);
|
||||
SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue());
|
||||
discord_rpc->Update();
|
||||
|
||||
RegisterMetaTypes();
|
||||
@ -1060,23 +1062,24 @@ void GMainWindow::RestoreUIState() {
|
||||
render_window->restoreGeometry(UISettings::values.renderwindow_geometry);
|
||||
#if MICROPROFILE_ENABLED
|
||||
microProfileDialog->restoreGeometry(UISettings::values.microprofile_geometry);
|
||||
microProfileDialog->setVisible(UISettings::values.microprofile_visible);
|
||||
microProfileDialog->setVisible(UISettings::values.microprofile_visible.GetValue());
|
||||
#endif
|
||||
|
||||
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();
|
||||
|
||||
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());
|
||||
|
||||
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());
|
||||
|
||||
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());
|
||||
Debugger::ToggleConsole();
|
||||
}
|
||||
@ -1243,13 +1246,14 @@ bool GMainWindow::LoadROM(const QString& filename, std::size_t program_index) {
|
||||
const Core::System::ResultStatus result{
|
||||
system.Load(*render_window, filename.toStdString(), program_index)};
|
||||
|
||||
const auto drd_callout =
|
||||
(UISettings::values.callout_flags & static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0;
|
||||
const auto drd_callout = (UISettings::values.callout_flags.GetValue() &
|
||||
static_cast<u32>(CalloutFlag::DRDDeprecation)) == 0;
|
||||
|
||||
if (result == Core::System::ResultStatus::Success &&
|
||||
system.GetAppLoader().GetFileType() == Loader::FileType::DeconstructedRomDirectory &&
|
||||
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(
|
||||
this, tr("Warning Outdated Game Format"),
|
||||
tr("You are using the deconstructed ROM directory format for this game, which is an "
|
||||
@ -2453,7 +2457,8 @@ void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_tex
|
||||
}
|
||||
|
||||
void GMainWindow::OnMenuReportCompatibility() {
|
||||
if (!Settings::values.yuzu_token.empty() && !Settings::values.yuzu_username.empty()) {
|
||||
if (!Settings::values.yuzu_token.GetValue().empty() &&
|
||||
!Settings::values.yuzu_username.GetValue().empty()) {
|
||||
CompatDB compatdb{this};
|
||||
compatdb.exec();
|
||||
} else {
|
||||
@ -2618,7 +2623,7 @@ void GMainWindow::ResetWindowSize1080() {
|
||||
|
||||
void GMainWindow::OnConfigure() {
|
||||
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());
|
||||
connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this,
|
||||
@ -2675,8 +2680,8 @@ void GMainWindow::OnConfigure() {
|
||||
if (UISettings::values.theme != old_theme) {
|
||||
UpdateUITheme();
|
||||
}
|
||||
if (UISettings::values.enable_discord_presence != old_discord_presence) {
|
||||
SetDiscordEnabled(UISettings::values.enable_discord_presence);
|
||||
if (UISettings::values.enable_discord_presence.GetValue() != old_discord_presence) {
|
||||
SetDiscordEnabled(UISettings::values.enable_discord_presence.GetValue());
|
||||
}
|
||||
emit UpdateThemedIcons();
|
||||
|
||||
@ -2832,7 +2837,8 @@ void GMainWindow::OnCaptureScreenshot() {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor, filename);
|
||||
render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor.GetValue(),
|
||||
filename);
|
||||
OnStartGame();
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
#include "common/common_types.h"
|
||||
#include "common/settings.h"
|
||||
|
||||
namespace UISettings {
|
||||
|
||||
@ -48,26 +49,26 @@ struct Values {
|
||||
QByteArray gamelist_header_state;
|
||||
|
||||
QByteArray microprofile_geometry;
|
||||
bool microprofile_visible;
|
||||
Settings::BasicSetting<bool> microprofile_visible{false, "microProfileDialogVisible"};
|
||||
|
||||
bool single_window_mode;
|
||||
bool fullscreen;
|
||||
bool display_titlebar;
|
||||
bool show_filter_bar;
|
||||
bool show_status_bar;
|
||||
Settings::BasicSetting<bool> single_window_mode{true, "singleWindowMode"};
|
||||
Settings::BasicSetting<bool> fullscreen{false, "fullscreen"};
|
||||
Settings::BasicSetting<bool> display_titlebar{true, "displayTitleBars"};
|
||||
Settings::BasicSetting<bool> show_filter_bar{true, "showFilterBar"};
|
||||
Settings::BasicSetting<bool> show_status_bar{true, "showStatusBar"};
|
||||
|
||||
bool confirm_before_closing;
|
||||
bool first_start;
|
||||
bool pause_when_in_background;
|
||||
bool hide_mouse;
|
||||
Settings::BasicSetting<bool> confirm_before_closing{true, "confirmClose"};
|
||||
Settings::BasicSetting<bool> first_start{true, "firstStart"};
|
||||
Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
|
||||
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
|
||||
bool enable_discord_presence;
|
||||
Settings::BasicSetting<bool> enable_discord_presence{true, "enable_discord_presence"};
|
||||
|
||||
bool enable_screenshot_save_as;
|
||||
u16 screenshot_resolution_factor;
|
||||
Settings::BasicSetting<bool> enable_screenshot_save_as{true, "enable_screenshot_save_as"};
|
||||
Settings::BasicSetting<u16> screenshot_resolution_factor{0, "screenshot_resolution_factor"};
|
||||
|
||||
QString roms_path;
|
||||
QString symbols_path;
|
||||
@ -83,18 +84,18 @@ struct Values {
|
||||
// Shortcut name <Shortcut, context>
|
||||
std::vector<Shortcut> shortcuts;
|
||||
|
||||
uint32_t callout_flags;
|
||||
Settings::BasicSetting<uint32_t> callout_flags{0, "calloutFlags"};
|
||||
|
||||
// logging
|
||||
bool show_console;
|
||||
Settings::BasicSetting<bool> show_console{false, "showConsole"};
|
||||
|
||||
// Game List
|
||||
bool show_add_ons;
|
||||
uint32_t icon_size;
|
||||
uint8_t row_1_text_id;
|
||||
uint8_t row_2_text_id;
|
||||
Settings::BasicSetting<bool> show_add_ons{true, "show_add_ons"};
|
||||
Settings::BasicSetting<uint32_t> icon_size{64, "icon_size"};
|
||||
Settings::BasicSetting<uint8_t> row_1_text_id{3, "row_1_text_id"};
|
||||
Settings::BasicSetting<uint8_t> row_2_text_id{2, "row_2_text_id"};
|
||||
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 reset_to_defaults;
|
||||
|
Reference in New Issue
Block a user