2020-03-22 03:16:32 +00:00
|
|
|
#include "generalsettingswidget.h"
|
2020-08-06 12:08:22 +00:00
|
|
|
#include "autoupdaterdialog.h"
|
2020-08-22 06:44:06 +00:00
|
|
|
#include "frontend-common/controller_interface.h"
|
2020-12-21 16:47:48 +00:00
|
|
|
#include "mainwindow.h"
|
2020-11-03 11:21:11 +00:00
|
|
|
#include "qtutils.h"
|
2020-12-21 16:47:48 +00:00
|
|
|
#include "scmversion/scmversion.h"
|
2020-03-22 03:17:03 +00:00
|
|
|
#include "settingsdialog.h"
|
2020-03-22 03:16:32 +00:00
|
|
|
#include "settingwidgetbinder.h"
|
|
|
|
|
2020-03-22 03:17:03 +00:00
|
|
|
GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QWidget* parent, SettingsDialog* dialog)
|
2020-03-22 03:16:32 +00:00
|
|
|
: QWidget(parent), m_host_interface(host_interface)
|
|
|
|
{
|
|
|
|
m_ui.setupUi(this);
|
|
|
|
|
2020-08-22 06:44:06 +00:00
|
|
|
for (u32 i = 0; i < static_cast<u32>(ControllerInterface::Backend::Count); i++)
|
|
|
|
{
|
|
|
|
m_ui.controllerBackend->addItem(qApp->translate(
|
|
|
|
"ControllerInterface", ControllerInterface::GetBackendName(static_cast<ControllerInterface::Backend>(i))));
|
|
|
|
}
|
|
|
|
|
2020-07-21 09:49:04 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.pauseOnStart, "Main", "StartPaused", false);
|
2020-12-04 14:16:22 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.pauseOnFocusLoss, "Main", "PauseOnFocusLoss",
|
|
|
|
false);
|
2020-07-21 09:49:04 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.startFullscreen, "Main", "StartFullscreen",
|
|
|
|
false);
|
2020-12-06 14:06:32 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.hideCursorInFullscreen, "Main",
|
|
|
|
"HideCursorInFullscreen", true);
|
2020-07-21 09:49:04 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.renderToMain, "Main", "RenderToMainWindow", true);
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.saveStateOnExit, "Main", "SaveStateOnExit", true);
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.confirmPowerOff, "Main", "ConfirmPowerOff", true);
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.loadDevicesFromSaveStates, "Main",
|
|
|
|
"LoadDevicesFromSaveStates", false);
|
2020-08-20 14:08:40 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.applyGameSettings, "Main", "ApplyGameSettings",
|
|
|
|
true);
|
2020-09-10 14:18:12 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.autoLoadCheats, "Main", "AutoLoadCheats", false);
|
2020-03-22 03:16:39 +00:00
|
|
|
|
2020-08-22 06:44:06 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToEnumSetting(
|
|
|
|
m_host_interface, m_ui.controllerBackend, "Main", "ControllerBackend", &ControllerInterface::ParseBackendName,
|
|
|
|
&ControllerInterface::GetBackendName, ControllerInterface::GetDefaultBackend());
|
2020-03-22 03:16:32 +00:00
|
|
|
|
2020-05-26 16:06:56 +00:00
|
|
|
dialog->registerWidgetHelp(
|
2020-07-28 09:42:14 +00:00
|
|
|
m_ui.confirmPowerOff, tr("Confirm Power Off"), tr("Checked"),
|
|
|
|
tr("Determines whether a prompt will be displayed to confirm shutting down the emulator/game "
|
|
|
|
"when the hotkey is pressed."));
|
|
|
|
dialog->registerWidgetHelp(m_ui.saveStateOnExit, tr("Save State On Exit"), tr("Checked"),
|
|
|
|
tr("Automatically saves the emulator state when powering down or exiting. You can then "
|
|
|
|
"resume directly from where you left off next time."));
|
|
|
|
dialog->registerWidgetHelp(m_ui.startFullscreen, tr("Start Fullscreen"), tr("Unchecked"),
|
|
|
|
tr("Automatically switches to fullscreen mode when a game is started."));
|
2020-12-06 14:06:32 +00:00
|
|
|
dialog->registerWidgetHelp(m_ui.hideCursorInFullscreen, tr("Hide Cursor In Fullscreen"), tr("Checked"),
|
|
|
|
tr("Hides the mouse pointer/cursor when the emulator is in fullscreen mode."));
|
2020-03-22 03:17:03 +00:00
|
|
|
dialog->registerWidgetHelp(
|
2020-07-28 09:42:14 +00:00
|
|
|
m_ui.renderToMain, tr("Render To Main Window"), tr("Checked"),
|
|
|
|
tr("Renders the display of the simulated console to the main window of the application, over "
|
|
|
|
"the game list. If unchecked, the display will render in a separate window."));
|
|
|
|
dialog->registerWidgetHelp(m_ui.pauseOnStart, tr("Pause On Start"), tr("Unchecked"),
|
|
|
|
tr("Pauses the emulator when a game is started."));
|
2020-12-04 16:45:12 +00:00
|
|
|
dialog->registerWidgetHelp(m_ui.pauseOnFocusLoss, tr("Pause On Focus Loss"), tr("Unchecked"),
|
|
|
|
tr("Pauses the emulator when you minimize the window or switch to another application, "
|
|
|
|
"and unpauses when you switch back."));
|
2020-07-28 09:42:14 +00:00
|
|
|
dialog->registerWidgetHelp(
|
|
|
|
m_ui.loadDevicesFromSaveStates, tr("Load Devices From Save States"), tr("Unchecked"),
|
|
|
|
tr("When enabled, memory cards and controllers will be overwritten when save states are loaded. This can "
|
|
|
|
"result in lost saves, and controller type mismatches. For deterministic save states, enable this option, "
|
|
|
|
"otherwise leave disabled."));
|
2020-08-20 14:08:40 +00:00
|
|
|
dialog->registerWidgetHelp(
|
|
|
|
m_ui.applyGameSettings, tr("Apply Per-Game Settings"), tr("Checked"),
|
|
|
|
tr("When enabled, per-game settings will be applied, and incompatible enhancements will be disabled. You should "
|
|
|
|
"leave this option enabled except when testing enhancements with incompatible games."));
|
2021-01-28 11:03:51 +00:00
|
|
|
dialog->registerWidgetHelp(m_ui.autoLoadCheats, tr("Automatically Load Cheats"), tr("Unchecked"),
|
|
|
|
tr("Automatically loads and applies cheats on game start."));
|
2020-08-22 06:44:06 +00:00
|
|
|
dialog->registerWidgetHelp(m_ui.controllerBackend, tr("Controller Backend"),
|
|
|
|
qApp->translate("ControllerInterface", ControllerInterface::GetBackendName(
|
|
|
|
ControllerInterface::GetDefaultBackend())),
|
|
|
|
tr("Determines the backend which is used for controller input. Windows users may prefer "
|
|
|
|
"to use XInput over SDL2 for compatibility."));
|
2020-04-30 15:01:53 +00:00
|
|
|
|
|
|
|
// Since this one is compile-time selected, we don't put it in the .ui file.
|
2020-12-06 14:06:32 +00:00
|
|
|
int current_col = 0;
|
2020-08-20 14:08:40 +00:00
|
|
|
int current_row = m_ui.formLayout_4->rowCount() - current_col;
|
2020-04-30 15:01:53 +00:00
|
|
|
#ifdef WITH_DISCORD_PRESENCE
|
|
|
|
{
|
|
|
|
QCheckBox* enableDiscordPresence = new QCheckBox(tr("Enable Discord Presence"), m_ui.groupBox_4);
|
2020-07-21 09:49:04 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, enableDiscordPresence, "Main",
|
|
|
|
"EnableDiscordPresence");
|
2020-08-20 14:08:40 +00:00
|
|
|
m_ui.formLayout_4->addWidget(enableDiscordPresence, current_row, current_col);
|
2020-07-28 09:42:14 +00:00
|
|
|
dialog->registerWidgetHelp(enableDiscordPresence, tr("Enable Discord Presence"), tr("Unchecked"),
|
|
|
|
tr("Shows the game you are currently playing as part of your profile in Discord."));
|
2020-08-20 14:08:40 +00:00
|
|
|
current_col++;
|
|
|
|
current_row += (current_col / 2);
|
|
|
|
current_col %= 2;
|
2020-04-30 15:01:53 +00:00
|
|
|
}
|
|
|
|
#endif
|
2020-08-06 12:08:22 +00:00
|
|
|
if (AutoUpdaterDialog::isSupported())
|
|
|
|
{
|
2020-12-21 16:47:48 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.autoUpdateEnabled, "AutoUpdater",
|
2020-08-19 10:54:02 +00:00
|
|
|
"CheckAtStartup", true);
|
2020-12-21 16:47:48 +00:00
|
|
|
dialog->registerWidgetHelp(m_ui.autoUpdateEnabled, tr("Enable Automatic Update Check"), tr("Checked"),
|
2020-08-06 12:08:22 +00:00
|
|
|
tr("Automatically checks for updates to the program on startup. Updates can be deferred "
|
|
|
|
"until later or skipped entirely."));
|
2020-12-21 16:47:48 +00:00
|
|
|
|
|
|
|
m_ui.autoUpdateTag->addItems(AutoUpdaterDialog::getTagList());
|
|
|
|
SettingWidgetBinder::BindWidgetToStringSetting(m_host_interface, m_ui.autoUpdateTag, "AutoUpdater", "UpdateTag",
|
|
|
|
AutoUpdaterDialog::getDefaultTag());
|
|
|
|
|
|
|
|
m_ui.autoUpdateCurrentVersion->setText(tr("%1 (%2)").arg(g_scm_tag_str).arg(g_scm_date_str));
|
|
|
|
connect(m_ui.checkForUpdates, &QPushButton::clicked,
|
|
|
|
[this]() { m_host_interface->getMainWindow()->checkForUpdates(true); });
|
2020-08-20 14:08:40 +00:00
|
|
|
current_col++;
|
|
|
|
current_row += (current_col / 2);
|
|
|
|
current_col %= 2;
|
2020-08-06 12:08:22 +00:00
|
|
|
}
|
2020-12-21 16:47:48 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
m_ui.verticalLayout->removeWidget(m_ui.automaticUpdaterGroup);
|
|
|
|
m_ui.automaticUpdaterGroup->hide();
|
|
|
|
}
|
2020-03-22 03:16:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GeneralSettingsWidget::~GeneralSettingsWidget() = default;
|