2017-05-03 22:19:51 -06:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-04 19:22:19 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-05-03 22:19:51 -06:00
|
|
|
|
2018-07-06 16:40:15 -06:00
|
|
|
#include "DolphinQt/Settings/GeneralPane.h"
|
2017-05-03 22:19:51 -06:00
|
|
|
|
2018-05-26 07:06:57 -06:00
|
|
|
#include <map>
|
|
|
|
|
2017-05-03 22:19:51 -06:00
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QComboBox>
|
|
|
|
#include <QFormLayout>
|
|
|
|
#include <QGroupBox>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QSlider>
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QWidget>
|
|
|
|
|
2023-06-07 19:53:38 -06:00
|
|
|
#include "Core/Config/AchievementSettings.h"
|
2018-07-19 16:10:37 -06:00
|
|
|
#include "Core/Config/MainSettings.h"
|
2018-06-08 14:56:11 -06:00
|
|
|
#include "Core/Config/UISettings.h"
|
2017-05-03 22:19:51 -06:00
|
|
|
#include "Core/ConfigManager.h"
|
2018-04-21 14:09:46 -06:00
|
|
|
#include "Core/Core.h"
|
2020-09-15 04:13:10 -06:00
|
|
|
#include "Core/DolphinAnalytics.h"
|
2017-05-05 04:38:59 -06:00
|
|
|
#include "Core/PowerPC/PowerPC.h"
|
2018-05-27 19:48:04 -06:00
|
|
|
|
2019-03-04 12:49:00 -07:00
|
|
|
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
2022-03-08 00:51:29 -07:00
|
|
|
#include "DolphinQt/QtUtils/NonDefaultQPushButton.h"
|
2023-07-30 16:42:15 -06:00
|
|
|
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
2022-02-26 15:06:33 -07:00
|
|
|
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
2018-07-06 16:40:15 -06:00
|
|
|
#include "DolphinQt/Settings.h"
|
2018-05-27 19:48:04 -06:00
|
|
|
|
2018-03-22 05:20:15 -06:00
|
|
|
#include "UICommon/AutoUpdate.h"
|
2018-06-05 22:16:42 -06:00
|
|
|
#ifdef USE_DISCORD_PRESENCE
|
|
|
|
#include "UICommon/DiscordPresence.h"
|
|
|
|
#endif
|
2018-03-22 05:20:15 -06:00
|
|
|
|
|
|
|
constexpr int AUTO_UPDATE_DISABLE_INDEX = 0;
|
2023-01-17 00:28:40 -07:00
|
|
|
constexpr int AUTO_UPDATE_BETA_INDEX = 1;
|
|
|
|
constexpr int AUTO_UPDATE_DEV_INDEX = 2;
|
2018-03-22 05:20:15 -06:00
|
|
|
|
|
|
|
constexpr const char* AUTO_UPDATE_DISABLE_STRING = "";
|
|
|
|
constexpr const char* AUTO_UPDATE_BETA_STRING = "beta";
|
|
|
|
constexpr const char* AUTO_UPDATE_DEV_STRING = "dev";
|
2017-05-03 22:19:51 -06:00
|
|
|
|
2020-11-28 13:09:37 -07:00
|
|
|
constexpr int FALLBACK_REGION_NTSCJ_INDEX = 0;
|
|
|
|
constexpr int FALLBACK_REGION_NTSCU_INDEX = 1;
|
|
|
|
constexpr int FALLBACK_REGION_PAL_INDEX = 2;
|
|
|
|
constexpr int FALLBACK_REGION_NTSCK_INDEX = 3;
|
|
|
|
|
2017-05-03 22:19:51 -06:00
|
|
|
GeneralPane::GeneralPane(QWidget* parent) : QWidget(parent)
|
|
|
|
{
|
|
|
|
CreateLayout();
|
|
|
|
LoadConfig();
|
2018-03-27 12:27:03 -06:00
|
|
|
|
|
|
|
ConnectLayout();
|
2018-04-21 14:09:46 -06:00
|
|
|
|
|
|
|
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
|
|
|
|
&GeneralPane::OnEmulationStateChanged);
|
2021-05-22 23:39:35 -06:00
|
|
|
connect(&Settings::Instance(), &Settings::ConfigChanged, this, &GeneralPane::LoadConfig);
|
2019-10-26 09:50:54 -06:00
|
|
|
|
|
|
|
OnEmulationStateChanged(Core::GetState());
|
2017-05-03 22:19:51 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralPane::CreateLayout()
|
|
|
|
{
|
|
|
|
m_main_layout = new QVBoxLayout;
|
|
|
|
// Create layout here
|
|
|
|
CreateBasic();
|
2018-03-22 05:20:15 -06:00
|
|
|
|
|
|
|
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
|
|
|
CreateAutoUpdate();
|
|
|
|
|
2020-11-28 13:09:37 -07:00
|
|
|
CreateFallbackRegion();
|
|
|
|
|
2017-05-03 22:19:51 -06:00
|
|
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
|
|
|
CreateAnalytics();
|
|
|
|
#endif
|
2017-06-20 20:18:34 -06:00
|
|
|
|
2017-05-03 22:19:51 -06:00
|
|
|
m_main_layout->addStretch(1);
|
|
|
|
setLayout(m_main_layout);
|
|
|
|
}
|
|
|
|
|
2018-04-21 14:09:46 -06:00
|
|
|
void GeneralPane::OnEmulationStateChanged(Core::State state)
|
|
|
|
{
|
|
|
|
const bool running = state != Core::State::Uninitialized;
|
|
|
|
|
|
|
|
m_checkbox_dualcore->setEnabled(!running);
|
2023-06-07 19:53:38 -06:00
|
|
|
#ifdef USE_RETRO_ACHIEVEMENTS
|
|
|
|
bool hardcore = Config::Get(Config::RA_HARDCORE_ENABLED);
|
|
|
|
m_checkbox_cheats->setEnabled(!running && !hardcore);
|
|
|
|
#else // USE_RETRO_ACHIEVEMENTS
|
2018-04-21 14:09:46 -06:00
|
|
|
m_checkbox_cheats->setEnabled(!running);
|
2023-06-07 19:53:38 -06:00
|
|
|
#endif // USE_RETRO_ACHIEVEMENTS
|
2019-06-30 03:48:49 -06:00
|
|
|
m_checkbox_override_region_settings->setEnabled(!running);
|
2018-07-17 04:03:41 -06:00
|
|
|
#ifdef USE_DISCORD_PRESENCE
|
2018-07-14 15:38:55 -06:00
|
|
|
m_checkbox_discord_presence->setEnabled(!running);
|
2018-07-17 04:03:41 -06:00
|
|
|
#endif
|
2020-11-28 13:09:37 -07:00
|
|
|
m_combobox_fallback_region->setEnabled(!running);
|
2018-04-21 14:09:46 -06:00
|
|
|
}
|
|
|
|
|
2017-05-03 22:19:51 -06:00
|
|
|
void GeneralPane::ConnectLayout()
|
|
|
|
{
|
2018-03-27 12:27:03 -06:00
|
|
|
connect(m_checkbox_dualcore, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
|
|
|
connect(m_checkbox_cheats, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
2019-06-30 03:48:49 -06:00
|
|
|
connect(m_checkbox_override_region_settings, &QCheckBox::stateChanged, this,
|
|
|
|
&GeneralPane::OnSaveConfig);
|
2018-11-05 11:20:45 -07:00
|
|
|
connect(m_checkbox_auto_disc_change, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
2018-05-31 20:54:15 -06:00
|
|
|
#ifdef USE_DISCORD_PRESENCE
|
|
|
|
connect(m_checkbox_discord_presence, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
|
|
|
#endif
|
2018-03-22 05:20:15 -06:00
|
|
|
|
|
|
|
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
|
|
|
{
|
2023-11-04 15:01:39 -06:00
|
|
|
connect(m_combobox_update_track, &QComboBox::currentIndexChanged, this,
|
2018-03-22 05:20:15 -06:00
|
|
|
&GeneralPane::OnSaveConfig);
|
|
|
|
connect(&Settings::Instance(), &Settings::AutoUpdateTrackChanged, this,
|
|
|
|
&GeneralPane::LoadConfig);
|
|
|
|
}
|
|
|
|
|
2017-05-03 22:19:51 -06:00
|
|
|
// Advanced
|
2023-11-04 15:01:39 -06:00
|
|
|
connect(m_combobox_speedlimit, &QComboBox::currentIndexChanged, [this]() {
|
2022-03-22 00:53:42 -06:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_EMULATION_SPEED,
|
|
|
|
m_combobox_speedlimit->currentIndex() * 0.1f);
|
|
|
|
Config::Save();
|
|
|
|
});
|
2017-05-03 22:19:51 -06:00
|
|
|
|
2023-11-04 15:01:39 -06:00
|
|
|
connect(m_combobox_fallback_region, &QComboBox::currentIndexChanged, this,
|
2020-11-28 13:09:37 -07:00
|
|
|
&GeneralPane::OnSaveConfig);
|
|
|
|
connect(&Settings::Instance(), &Settings::FallbackRegionChanged, this, &GeneralPane::LoadConfig);
|
|
|
|
|
2017-05-03 22:19:51 -06:00
|
|
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
2018-03-23 16:25:17 -06:00
|
|
|
connect(&Settings::Instance(), &Settings::AnalyticsToggled, this, &GeneralPane::LoadConfig);
|
2018-03-27 12:27:03 -06:00
|
|
|
connect(m_checkbox_enable_analytics, &QCheckBox::toggled, this, &GeneralPane::OnSaveConfig);
|
2019-07-23 16:18:58 -06:00
|
|
|
connect(m_button_generate_new_identity, &QPushButton::clicked, this,
|
2017-05-03 22:19:51 -06:00
|
|
|
&GeneralPane::GenerateNewIdentity);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeneralPane::CreateBasic()
|
|
|
|
{
|
|
|
|
auto* basic_group = new QGroupBox(tr("Basic Settings"));
|
|
|
|
auto* basic_group_layout = new QVBoxLayout;
|
|
|
|
basic_group->setLayout(basic_group_layout);
|
|
|
|
m_main_layout->addWidget(basic_group);
|
|
|
|
|
2017-05-05 04:38:59 -06:00
|
|
|
m_checkbox_dualcore = new QCheckBox(tr("Enable Dual Core (speedup)"));
|
|
|
|
basic_group_layout->addWidget(m_checkbox_dualcore);
|
|
|
|
|
|
|
|
m_checkbox_cheats = new QCheckBox(tr("Enable Cheats"));
|
|
|
|
basic_group_layout->addWidget(m_checkbox_cheats);
|
|
|
|
|
2019-06-30 03:48:49 -06:00
|
|
|
m_checkbox_override_region_settings = new QCheckBox(tr("Allow Mismatched Region Settings"));
|
|
|
|
basic_group_layout->addWidget(m_checkbox_override_region_settings);
|
|
|
|
|
2018-11-05 11:20:45 -07:00
|
|
|
m_checkbox_auto_disc_change = new QCheckBox(tr("Change Discs Automatically"));
|
|
|
|
basic_group_layout->addWidget(m_checkbox_auto_disc_change);
|
|
|
|
|
2018-05-31 20:54:15 -06:00
|
|
|
#ifdef USE_DISCORD_PRESENCE
|
2018-06-05 22:16:42 -06:00
|
|
|
m_checkbox_discord_presence = new QCheckBox(tr("Show Current Game on Discord"));
|
2018-05-31 20:54:15 -06:00
|
|
|
basic_group_layout->addWidget(m_checkbox_discord_presence);
|
|
|
|
#endif
|
|
|
|
|
2017-05-05 04:38:59 -06:00
|
|
|
auto* speed_limit_layout = new QFormLayout;
|
2018-06-12 07:45:33 -06:00
|
|
|
speed_limit_layout->setFormAlignment(Qt::AlignLeft | Qt::AlignTop);
|
|
|
|
speed_limit_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
2017-05-05 04:38:59 -06:00
|
|
|
basic_group_layout->addLayout(speed_limit_layout);
|
|
|
|
|
|
|
|
m_combobox_speedlimit = new QComboBox();
|
|
|
|
|
|
|
|
m_combobox_speedlimit->addItem(tr("Unlimited"));
|
|
|
|
for (int i = 10; i <= 200; i += 10) // from 10% to 200%
|
|
|
|
{
|
2017-05-24 05:09:05 -06:00
|
|
|
QString str;
|
|
|
|
if (i != 100)
|
2018-05-30 04:43:59 -06:00
|
|
|
str = QStringLiteral("%1%").arg(i);
|
2017-05-24 05:09:05 -06:00
|
|
|
else
|
2018-05-30 04:43:59 -06:00
|
|
|
str = tr("%1% (Normal Speed)").arg(i);
|
2017-05-05 04:38:59 -06:00
|
|
|
|
2017-05-24 05:09:05 -06:00
|
|
|
m_combobox_speedlimit->addItem(str);
|
2017-05-05 04:38:59 -06:00
|
|
|
}
|
2017-05-03 22:19:51 -06:00
|
|
|
|
2017-05-05 04:38:59 -06:00
|
|
|
speed_limit_layout->addRow(tr("&Speed Limit:"), m_combobox_speedlimit);
|
2017-05-03 22:19:51 -06:00
|
|
|
}
|
|
|
|
|
2018-03-22 05:20:15 -06:00
|
|
|
void GeneralPane::CreateAutoUpdate()
|
|
|
|
{
|
|
|
|
auto* auto_update_group = new QGroupBox(tr("Auto Update Settings"));
|
2021-09-08 14:08:43 -06:00
|
|
|
auto* auto_update_group_layout = new QFormLayout;
|
|
|
|
auto_update_group->setLayout(auto_update_group_layout);
|
2018-03-22 05:20:15 -06:00
|
|
|
m_main_layout->addWidget(auto_update_group);
|
|
|
|
|
2021-09-08 14:08:43 -06:00
|
|
|
auto_update_group_layout->setFormAlignment(Qt::AlignLeft | Qt::AlignTop);
|
|
|
|
auto_update_group_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
2019-03-16 09:20:21 -06:00
|
|
|
|
2018-03-22 05:20:15 -06:00
|
|
|
m_combobox_update_track = new QComboBox(this);
|
|
|
|
|
2021-09-08 14:08:43 -06:00
|
|
|
auto_update_group_layout->addRow(tr("&Auto Update:"), m_combobox_update_track);
|
2018-03-22 05:20:15 -06:00
|
|
|
|
2023-01-17 00:28:40 -07:00
|
|
|
for (const QString& option :
|
|
|
|
{tr("Don't Update"), tr("Beta (once a month)"), tr("Dev (multiple times a day)")})
|
2018-03-22 05:20:15 -06:00
|
|
|
m_combobox_update_track->addItem(option);
|
|
|
|
}
|
|
|
|
|
2020-11-28 13:09:37 -07:00
|
|
|
void GeneralPane::CreateFallbackRegion()
|
|
|
|
{
|
|
|
|
auto* fallback_region_group = new QGroupBox(tr("Fallback Region"));
|
2021-09-08 14:08:43 -06:00
|
|
|
auto* fallback_region_group_layout = new QVBoxLayout;
|
|
|
|
fallback_region_group->setLayout(fallback_region_group_layout);
|
2020-11-28 13:09:37 -07:00
|
|
|
m_main_layout->addWidget(fallback_region_group);
|
|
|
|
|
2021-09-08 14:08:43 -06:00
|
|
|
auto* fallback_region_dropdown_layout = new QFormLayout;
|
|
|
|
fallback_region_dropdown_layout->setFormAlignment(Qt::AlignLeft | Qt::AlignTop);
|
|
|
|
fallback_region_dropdown_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
|
|
|
fallback_region_group_layout->addLayout(fallback_region_dropdown_layout);
|
|
|
|
|
2020-11-28 13:09:37 -07:00
|
|
|
m_combobox_fallback_region = new QComboBox(this);
|
2021-09-08 14:08:43 -06:00
|
|
|
fallback_region_dropdown_layout->addRow(tr("Fallback Region:"), m_combobox_fallback_region);
|
2020-11-28 13:09:37 -07:00
|
|
|
|
2021-09-08 14:08:43 -06:00
|
|
|
for (const QString& option : {tr("NTSC-J"), tr("NTSC-U"), tr("PAL"), tr("NTSC-K")})
|
|
|
|
m_combobox_fallback_region->addItem(option);
|
2020-11-28 13:09:37 -07:00
|
|
|
|
|
|
|
auto* fallback_region_description =
|
|
|
|
new QLabel(tr("Dolphin will use this for titles whose region cannot be determined "
|
|
|
|
"automatically."));
|
|
|
|
fallback_region_description->setWordWrap(true);
|
2021-09-08 14:08:43 -06:00
|
|
|
fallback_region_group_layout->addWidget(fallback_region_description);
|
2020-11-28 13:09:37 -07:00
|
|
|
}
|
|
|
|
|
2017-05-03 22:19:51 -06:00
|
|
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
|
|
|
void GeneralPane::CreateAnalytics()
|
|
|
|
{
|
2017-07-23 04:58:32 -06:00
|
|
|
auto* analytics_group = new QGroupBox(tr("Usage Statistics Reporting Settings"));
|
2017-05-03 22:19:51 -06:00
|
|
|
auto* analytics_group_layout = new QVBoxLayout;
|
|
|
|
analytics_group->setLayout(analytics_group_layout);
|
|
|
|
m_main_layout->addWidget(analytics_group);
|
|
|
|
|
|
|
|
m_checkbox_enable_analytics = new QCheckBox(tr("Enable Usage Statistics Reporting"));
|
2022-03-08 00:51:29 -07:00
|
|
|
m_button_generate_new_identity =
|
|
|
|
new NonDefaultQPushButton(tr("Generate a New Statistics Identity"));
|
2017-05-03 22:19:51 -06:00
|
|
|
analytics_group_layout->addWidget(m_checkbox_enable_analytics);
|
|
|
|
analytics_group_layout->addWidget(m_button_generate_new_identity);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void GeneralPane::LoadConfig()
|
|
|
|
{
|
2021-05-22 23:39:35 -06:00
|
|
|
const QSignalBlocker blocker(this);
|
|
|
|
|
2018-03-22 05:20:15 -06:00
|
|
|
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
|
|
|
{
|
|
|
|
const auto track = Settings::Instance().GetAutoUpdateTrack().toStdString();
|
2023-01-17 00:28:40 -07:00
|
|
|
|
|
|
|
// If the track doesn't match any known value, set to "beta" which is the
|
|
|
|
// default config value on Dolphin release builds.
|
2018-03-22 05:20:15 -06:00
|
|
|
if (track == AUTO_UPDATE_DISABLE_STRING)
|
2022-02-26 15:06:33 -07:00
|
|
|
SignalBlocking(m_combobox_update_track)->setCurrentIndex(AUTO_UPDATE_DISABLE_INDEX);
|
2023-01-17 00:28:40 -07:00
|
|
|
else if (track == AUTO_UPDATE_DEV_STRING)
|
2022-02-26 15:06:33 -07:00
|
|
|
SignalBlocking(m_combobox_update_track)->setCurrentIndex(AUTO_UPDATE_DEV_INDEX);
|
2023-01-17 00:28:40 -07:00
|
|
|
else
|
|
|
|
SignalBlocking(m_combobox_update_track)->setCurrentIndex(AUTO_UPDATE_BETA_INDEX);
|
2018-03-22 05:20:15 -06:00
|
|
|
}
|
|
|
|
|
2017-06-23 17:09:45 -06:00
|
|
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
2022-02-26 15:06:33 -07:00
|
|
|
SignalBlocking(m_checkbox_enable_analytics)
|
|
|
|
->setChecked(Settings::Instance().IsAnalyticsEnabled());
|
2017-06-23 17:09:45 -06:00
|
|
|
#endif
|
2022-02-26 15:06:33 -07:00
|
|
|
SignalBlocking(m_checkbox_dualcore)->setChecked(Config::Get(Config::MAIN_CPU_THREAD));
|
|
|
|
SignalBlocking(m_checkbox_cheats)->setChecked(Settings::Instance().GetCheatsEnabled());
|
|
|
|
SignalBlocking(m_checkbox_override_region_settings)
|
|
|
|
->setChecked(Config::Get(Config::MAIN_OVERRIDE_REGION_SETTINGS));
|
|
|
|
SignalBlocking(m_checkbox_auto_disc_change)
|
|
|
|
->setChecked(Config::Get(Config::MAIN_AUTO_DISC_CHANGE));
|
|
|
|
|
2018-05-31 20:54:15 -06:00
|
|
|
#ifdef USE_DISCORD_PRESENCE
|
2022-02-26 15:06:33 -07:00
|
|
|
SignalBlocking(m_checkbox_discord_presence)
|
|
|
|
->setChecked(Config::Get(Config::MAIN_USE_DISCORD_PRESENCE));
|
2018-05-31 20:54:15 -06:00
|
|
|
#endif
|
2022-01-05 15:22:07 -07:00
|
|
|
int selection = qRound(Config::Get(Config::MAIN_EMULATION_SPEED) * 10);
|
2017-05-05 04:38:59 -06:00
|
|
|
if (selection < m_combobox_speedlimit->count())
|
2022-02-26 15:06:33 -07:00
|
|
|
SignalBlocking(m_combobox_speedlimit)->setCurrentIndex(selection);
|
2020-11-28 13:09:37 -07:00
|
|
|
|
|
|
|
const auto fallback = Settings::Instance().GetFallbackRegion();
|
|
|
|
if (fallback == DiscIO::Region::NTSC_J)
|
2022-02-26 15:06:33 -07:00
|
|
|
SignalBlocking(m_combobox_fallback_region)->setCurrentIndex(FALLBACK_REGION_NTSCJ_INDEX);
|
2020-11-28 13:09:37 -07:00
|
|
|
else if (fallback == DiscIO::Region::NTSC_U)
|
2022-02-26 15:06:33 -07:00
|
|
|
SignalBlocking(m_combobox_fallback_region)->setCurrentIndex(FALLBACK_REGION_NTSCU_INDEX);
|
2020-11-28 13:09:37 -07:00
|
|
|
else if (fallback == DiscIO::Region::PAL)
|
2022-02-26 15:06:33 -07:00
|
|
|
SignalBlocking(m_combobox_fallback_region)->setCurrentIndex(FALLBACK_REGION_PAL_INDEX);
|
2020-11-28 13:09:37 -07:00
|
|
|
else if (fallback == DiscIO::Region::NTSC_K)
|
2022-02-26 15:06:33 -07:00
|
|
|
SignalBlocking(m_combobox_fallback_region)->setCurrentIndex(FALLBACK_REGION_NTSCK_INDEX);
|
2020-11-28 13:09:37 -07:00
|
|
|
else
|
2022-02-26 15:06:33 -07:00
|
|
|
SignalBlocking(m_combobox_fallback_region)->setCurrentIndex(FALLBACK_REGION_NTSCJ_INDEX);
|
2017-05-03 22:19:51 -06:00
|
|
|
}
|
|
|
|
|
2018-03-22 05:20:15 -06:00
|
|
|
static QString UpdateTrackFromIndex(int index)
|
|
|
|
{
|
|
|
|
QString value;
|
|
|
|
|
|
|
|
switch (index)
|
|
|
|
{
|
|
|
|
case AUTO_UPDATE_DISABLE_INDEX:
|
|
|
|
value = QString::fromStdString(AUTO_UPDATE_DISABLE_STRING);
|
|
|
|
break;
|
|
|
|
case AUTO_UPDATE_BETA_INDEX:
|
|
|
|
value = QString::fromStdString(AUTO_UPDATE_BETA_STRING);
|
|
|
|
break;
|
|
|
|
case AUTO_UPDATE_DEV_INDEX:
|
|
|
|
value = QString::fromStdString(AUTO_UPDATE_DEV_STRING);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2020-11-28 13:09:37 -07:00
|
|
|
static DiscIO::Region UpdateFallbackRegionFromIndex(int index)
|
|
|
|
{
|
|
|
|
DiscIO::Region value = DiscIO::Region::Unknown;
|
|
|
|
|
|
|
|
switch (index)
|
|
|
|
{
|
|
|
|
case FALLBACK_REGION_NTSCJ_INDEX:
|
|
|
|
value = DiscIO::Region::NTSC_J;
|
|
|
|
break;
|
|
|
|
case FALLBACK_REGION_NTSCU_INDEX:
|
|
|
|
value = DiscIO::Region::NTSC_U;
|
|
|
|
break;
|
|
|
|
case FALLBACK_REGION_PAL_INDEX:
|
|
|
|
value = DiscIO::Region::PAL;
|
|
|
|
break;
|
|
|
|
case FALLBACK_REGION_NTSCK_INDEX:
|
|
|
|
value = DiscIO::Region::NTSC_K;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
value = DiscIO::Region::NTSC_J;
|
|
|
|
}
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2017-05-03 22:19:51 -06:00
|
|
|
void GeneralPane::OnSaveConfig()
|
|
|
|
{
|
2019-03-03 09:58:37 -07:00
|
|
|
Config::ConfigChangeCallbackGuard config_guard;
|
|
|
|
|
2018-03-27 12:27:03 -06:00
|
|
|
auto& settings = SConfig::GetInstance();
|
2018-03-22 05:20:15 -06:00
|
|
|
if (AutoUpdateChecker::SystemSupportsAutoUpdates())
|
|
|
|
{
|
|
|
|
Settings::Instance().SetAutoUpdateTrack(
|
|
|
|
UpdateTrackFromIndex(m_combobox_update_track->currentIndex()));
|
|
|
|
}
|
|
|
|
|
2018-05-31 20:54:15 -06:00
|
|
|
#ifdef USE_DISCORD_PRESENCE
|
2018-06-05 22:16:42 -06:00
|
|
|
Discord::SetDiscordPresenceEnabled(m_checkbox_discord_presence->isChecked());
|
2018-05-31 20:54:15 -06:00
|
|
|
#endif
|
|
|
|
|
2017-06-23 17:09:45 -06:00
|
|
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
2018-03-23 16:25:17 -06:00
|
|
|
Settings::Instance().SetAnalyticsEnabled(m_checkbox_enable_analytics->isChecked());
|
2019-06-23 11:26:07 -06:00
|
|
|
DolphinAnalytics::Instance().ReloadConfig();
|
2017-06-23 17:09:45 -06:00
|
|
|
#endif
|
2018-07-19 16:10:37 -06:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_CPU_THREAD, m_checkbox_dualcore->isChecked());
|
2017-08-30 13:00:59 -06:00
|
|
|
Settings::Instance().SetCheatsEnabled(m_checkbox_cheats->isChecked());
|
2019-06-30 03:48:49 -06:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_OVERRIDE_REGION_SETTINGS,
|
|
|
|
m_checkbox_override_region_settings->isChecked());
|
2018-11-05 11:20:45 -07:00
|
|
|
Config::SetBase(Config::MAIN_AUTO_DISC_CHANGE, m_checkbox_auto_disc_change->isChecked());
|
2018-07-19 16:10:37 -06:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_CHEATS, m_checkbox_cheats->isChecked());
|
2020-11-28 13:09:37 -07:00
|
|
|
Settings::Instance().SetFallbackRegion(
|
|
|
|
UpdateFallbackRegionFromIndex(m_combobox_fallback_region->currentIndex()));
|
2018-05-26 07:06:57 -06:00
|
|
|
|
2018-03-27 12:27:03 -06:00
|
|
|
settings.SaveSettings();
|
2017-05-03 22:19:51 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
|
|
|
void GeneralPane::GenerateNewIdentity()
|
|
|
|
{
|
2019-06-23 11:26:07 -06:00
|
|
|
DolphinAnalytics::Instance().GenerateNewIdentity();
|
|
|
|
DolphinAnalytics::Instance().ReloadConfig();
|
2019-03-04 12:49:00 -07:00
|
|
|
ModalMessageBox message_box(this);
|
2017-05-03 22:19:51 -06:00
|
|
|
message_box.setIcon(QMessageBox::Information);
|
|
|
|
message_box.setWindowTitle(tr("Identity Generation"));
|
|
|
|
message_box.setText(tr("New identity generated."));
|
2023-07-30 16:42:15 -06:00
|
|
|
SetQWidgetWindowDecorations(&message_box);
|
2017-05-03 22:19:51 -06:00
|
|
|
message_box.exec();
|
|
|
|
}
|
|
|
|
#endif
|