2017-05-04 07:47:59 +00:00
|
|
|
// Copyright 2017 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-05-04 07:47:59 +00:00
|
|
|
|
2018-07-06 22:40:15 +00:00
|
|
|
#include "DolphinQt/Settings/InterfacePane.h"
|
2017-05-04 07:47:59 +00:00
|
|
|
|
|
|
|
#include <QCheckBox>
|
|
|
|
#include <QComboBox>
|
2018-08-09 13:20:46 +00:00
|
|
|
#include <QFileInfo>
|
2017-05-04 07:47:59 +00:00
|
|
|
#include <QFormLayout>
|
|
|
|
#include <QGroupBox>
|
2018-05-06 16:25:37 +00:00
|
|
|
#include <QLabel>
|
2021-09-23 03:57:52 +00:00
|
|
|
#include <QRadioButton>
|
2017-05-04 07:47:59 +00:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
#include "Common/CommonPaths.h"
|
|
|
|
#include "Common/FileSearch.h"
|
|
|
|
#include "Common/FileUtil.h"
|
2018-05-25 02:17:04 +00:00
|
|
|
#include "Common/MsgHandler.h"
|
2017-05-12 18:56:00 +00:00
|
|
|
#include "Common/StringUtil.h"
|
2018-05-28 01:48:04 +00:00
|
|
|
|
2020-07-20 09:22:53 +00:00
|
|
|
#include "Core/Config/MainSettings.h"
|
2018-07-30 01:16:37 +00:00
|
|
|
#include "Core/Config/UISettings.h"
|
2017-05-04 07:47:59 +00:00
|
|
|
|
2019-03-04 19:49:00 +00:00
|
|
|
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
2022-04-18 22:25:35 +00:00
|
|
|
#include "DolphinQt/QtUtils/SignalBlocking.h"
|
2018-07-06 22:40:15 +00:00
|
|
|
#include "DolphinQt/Settings.h"
|
2017-06-01 06:49:06 +00:00
|
|
|
|
2018-07-30 01:16:37 +00:00
|
|
|
#include "UICommon/GameFile.h"
|
|
|
|
|
2017-07-17 21:49:51 +00:00
|
|
|
static QComboBox* MakeLanguageComboBox()
|
|
|
|
{
|
|
|
|
static const struct
|
|
|
|
{
|
|
|
|
const QString name;
|
|
|
|
const char* id;
|
|
|
|
} languages[] = {
|
2017-11-05 10:07:41 +00:00
|
|
|
{QStringLiteral(u"Bahasa Melayu"), "ms"}, // Malay
|
|
|
|
{QStringLiteral(u"Catal\u00E0"), "ca"}, // Catalan
|
|
|
|
{QStringLiteral(u"\u010Ce\u0161tina"), "cs"}, // Czech
|
|
|
|
{QStringLiteral(u"Dansk"), "da"}, // Danish
|
|
|
|
{QStringLiteral(u"Deutsch"), "de"}, // German
|
|
|
|
{QStringLiteral(u"English"), "en"}, // English
|
|
|
|
{QStringLiteral(u"Espa\u00F1ol"), "es"}, // Spanish
|
|
|
|
{QStringLiteral(u"Fran\u00E7ais"), "fr"}, // French
|
|
|
|
{QStringLiteral(u"Hrvatski"), "hr"}, // Croatian
|
|
|
|
{QStringLiteral(u"Italiano"), "it"}, // Italian
|
|
|
|
{QStringLiteral(u"Magyar"), "hu"}, // Hungarian
|
|
|
|
{QStringLiteral(u"Nederlands"), "nl"}, // Dutch
|
|
|
|
{QStringLiteral(u"Norsk bokm\u00E5l"), "nb"}, // Norwegian
|
|
|
|
{QStringLiteral(u"Polski"), "pl"}, // Polish
|
|
|
|
{QStringLiteral(u"Portugu\u00EAs"), "pt"}, // Portuguese
|
|
|
|
{QStringLiteral(u"Portugu\u00EAs (Brasil)"), "pt_BR"}, // Portuguese (Brazil)
|
|
|
|
{QStringLiteral(u"Rom\u00E2n\u0103"), "ro"}, // Romanian
|
|
|
|
{QStringLiteral(u"Srpski"), "sr"}, // Serbian
|
2023-04-02 09:33:42 +00:00
|
|
|
{QStringLiteral(u"Suomi"), "fi"}, // Finnish
|
2017-11-05 10:07:41 +00:00
|
|
|
{QStringLiteral(u"Svenska"), "sv"}, // Swedish
|
|
|
|
{QStringLiteral(u"T\u00FCrk\u00E7e"), "tr"}, // Turkish
|
|
|
|
{QStringLiteral(u"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"), "el"}, // Greek
|
|
|
|
{QStringLiteral(u"\u0420\u0443\u0441\u0441\u043A\u0438\u0439"), "ru"}, // Russian
|
|
|
|
{QStringLiteral(u"\u0627\u0644\u0639\u0631\u0628\u064A\u0629"), "ar"}, // Arabic
|
|
|
|
{QStringLiteral(u"\u0641\u0627\u0631\u0633\u06CC"), "fa"}, // Farsi
|
|
|
|
{QStringLiteral(u"\uD55C\uAD6D\uC5B4"), "ko"}, // Korean
|
|
|
|
{QStringLiteral(u"\u65E5\u672C\u8A9E"), "ja"}, // Japanese
|
|
|
|
{QStringLiteral(u"\u7B80\u4F53\u4E2D\u6587"), "zh_CN"}, // Simplified Chinese
|
|
|
|
{QStringLiteral(u"\u7E41\u9AD4\u4E2D\u6587"), "zh_TW"}, // Traditional Chinese
|
2017-07-17 21:49:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
auto* combobox = new QComboBox();
|
2019-07-30 11:57:06 +00:00
|
|
|
combobox->addItem(QObject::tr("<System Language>"), QString{});
|
2017-07-17 21:49:51 +00:00
|
|
|
for (const auto& lang : languages)
|
|
|
|
combobox->addItem(lang.name, QString::fromLatin1(lang.id));
|
|
|
|
|
|
|
|
// The default, QComboBox::AdjustToContentsOnFirstShow, causes a noticeable pause when opening the
|
|
|
|
// SettingWindow for the first time. The culprit seems to be non-Latin graphemes in the above
|
|
|
|
// list. QComboBox::AdjustToContents still has some lag but it's much less noticeable.
|
|
|
|
combobox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
|
|
|
|
|
|
|
return combobox;
|
|
|
|
}
|
|
|
|
|
2017-05-04 07:47:59 +00:00
|
|
|
InterfacePane::InterfacePane(QWidget* parent) : QWidget(parent)
|
|
|
|
{
|
|
|
|
CreateLayout();
|
|
|
|
LoadConfig();
|
2018-05-06 16:25:37 +00:00
|
|
|
ConnectLayout();
|
2017-05-04 07:47:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void InterfacePane::CreateLayout()
|
|
|
|
{
|
|
|
|
m_main_layout = new QVBoxLayout;
|
|
|
|
// Create layout here
|
|
|
|
CreateUI();
|
|
|
|
CreateInGame();
|
|
|
|
|
|
|
|
m_main_layout->addStretch(1);
|
|
|
|
setLayout(m_main_layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
void InterfacePane::CreateUI()
|
|
|
|
{
|
|
|
|
auto* groupbox = new QGroupBox(tr("User Interface"));
|
|
|
|
auto* groupbox_layout = new QVBoxLayout;
|
|
|
|
groupbox->setLayout(groupbox_layout);
|
|
|
|
m_main_layout->addWidget(groupbox);
|
|
|
|
|
2017-05-05 10:38:59 +00:00
|
|
|
auto* combobox_layout = new QFormLayout;
|
2018-06-12 13:45:33 +00:00
|
|
|
combobox_layout->setFormAlignment(Qt::AlignLeft | Qt::AlignTop);
|
|
|
|
combobox_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
|
|
|
|
2017-05-05 10:38:59 +00:00
|
|
|
groupbox_layout->addLayout(combobox_layout);
|
|
|
|
|
2017-07-17 21:49:51 +00:00
|
|
|
m_combobox_language = MakeLanguageComboBox();
|
2017-05-05 10:38:59 +00:00
|
|
|
combobox_layout->addRow(tr("&Language:"), m_combobox_language);
|
|
|
|
|
2017-05-04 07:47:59 +00:00
|
|
|
// Theme Combobox
|
|
|
|
m_combobox_theme = new QComboBox;
|
2017-05-05 10:38:59 +00:00
|
|
|
combobox_layout->addRow(tr("&Theme:"), m_combobox_theme);
|
2017-05-04 07:47:59 +00:00
|
|
|
|
|
|
|
// List avalable themes
|
2018-05-06 16:25:37 +00:00
|
|
|
auto theme_search_results =
|
2017-06-21 04:24:26 +00:00
|
|
|
Common::DoFileSearch({File::GetUserPath(D_THEMES_IDX), File::GetSysDirectory() + THEMES_DIR});
|
2020-03-16 20:03:21 +00:00
|
|
|
for (const std::string& path : theme_search_results)
|
2017-05-04 07:47:59 +00:00
|
|
|
{
|
2020-03-16 20:03:21 +00:00
|
|
|
const QString qt_name = QString::fromStdString(PathToFileName(path));
|
2017-05-04 07:47:59 +00:00
|
|
|
m_combobox_theme->addItem(qt_name);
|
|
|
|
}
|
|
|
|
|
2018-05-06 16:25:37 +00:00
|
|
|
// User Style Combobox
|
|
|
|
m_combobox_userstyle = new QComboBox;
|
|
|
|
m_label_userstyle = new QLabel(tr("User Style:"));
|
|
|
|
combobox_layout->addRow(m_label_userstyle, m_combobox_userstyle);
|
|
|
|
|
|
|
|
auto userstyle_search_results = Common::DoFileSearch({File::GetUserPath(D_STYLES_IDX)});
|
|
|
|
|
2019-07-30 11:57:06 +00:00
|
|
|
m_combobox_userstyle->addItem(tr("(None)"), QString{});
|
2018-05-06 16:25:37 +00:00
|
|
|
|
2020-03-16 20:03:21 +00:00
|
|
|
for (const std::string& path : userstyle_search_results)
|
2018-05-06 16:25:37 +00:00
|
|
|
{
|
2020-05-01 14:31:47 +00:00
|
|
|
const QFileInfo file_info(QString::fromStdString(path));
|
|
|
|
m_combobox_userstyle->addItem(file_info.completeBaseName(), file_info.fileName());
|
2018-05-06 16:25:37 +00:00
|
|
|
}
|
|
|
|
|
2017-05-04 07:47:59 +00:00
|
|
|
// Checkboxes
|
2017-07-23 13:28:34 +00:00
|
|
|
m_checkbox_use_builtin_title_database = new QCheckBox(tr("Use Built-In Database of Game Names"));
|
2018-05-06 16:25:37 +00:00
|
|
|
m_checkbox_use_userstyle = new QCheckBox(tr("Use Custom User Style"));
|
2018-07-30 01:16:37 +00:00
|
|
|
m_checkbox_use_covers =
|
|
|
|
new QCheckBox(tr("Download Game Covers from GameTDB.com for Use in Grid Mode"));
|
2017-09-25 08:21:04 +00:00
|
|
|
m_checkbox_show_debugging_ui = new QCheckBox(tr("Show Debugging UI"));
|
2020-02-07 23:56:13 +00:00
|
|
|
m_checkbox_focused_hotkeys = new QCheckBox(tr("Hotkeys Require Window Focus"));
|
2020-02-08 19:04:25 +00:00
|
|
|
m_checkbox_disable_screensaver = new QCheckBox(tr("Inhibit Screensaver During Emulation"));
|
2017-09-25 08:21:04 +00:00
|
|
|
|
2017-07-23 13:28:34 +00:00
|
|
|
groupbox_layout->addWidget(m_checkbox_use_builtin_title_database);
|
2018-05-06 16:25:37 +00:00
|
|
|
groupbox_layout->addWidget(m_checkbox_use_userstyle);
|
2018-07-30 01:16:37 +00:00
|
|
|
groupbox_layout->addWidget(m_checkbox_use_covers);
|
2017-09-25 08:21:04 +00:00
|
|
|
groupbox_layout->addWidget(m_checkbox_show_debugging_ui);
|
2020-02-07 23:56:13 +00:00
|
|
|
groupbox_layout->addWidget(m_checkbox_focused_hotkeys);
|
2020-02-08 19:04:25 +00:00
|
|
|
groupbox_layout->addWidget(m_checkbox_disable_screensaver);
|
2017-05-04 07:47:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void InterfacePane::CreateInGame()
|
|
|
|
{
|
2019-05-18 21:01:38 +00:00
|
|
|
auto* groupbox = new QGroupBox(tr("Render Window"));
|
2017-05-04 07:47:59 +00:00
|
|
|
auto* groupbox_layout = new QVBoxLayout;
|
|
|
|
groupbox->setLayout(groupbox_layout);
|
|
|
|
m_main_layout->addWidget(groupbox);
|
|
|
|
|
2019-05-24 18:18:49 +00:00
|
|
|
m_checkbox_top_window = new QCheckBox(tr("Keep Window on Top"));
|
2017-05-04 07:47:59 +00:00
|
|
|
m_checkbox_confirm_on_stop = new QCheckBox(tr("Confirm on Stop"));
|
|
|
|
m_checkbox_use_panic_handlers = new QCheckBox(tr("Use Panic Handlers"));
|
2018-03-23 16:29:03 +00:00
|
|
|
m_checkbox_enable_osd = new QCheckBox(tr("Show On-Screen Display Messages"));
|
2017-05-15 14:49:52 +00:00
|
|
|
m_checkbox_show_active_title = new QCheckBox(tr("Show Active Title in Window Title"));
|
2017-05-04 07:47:59 +00:00
|
|
|
m_checkbox_pause_on_focus_lost = new QCheckBox(tr("Pause on Focus Loss"));
|
2021-05-09 10:28:04 +00:00
|
|
|
|
2021-09-23 03:57:52 +00:00
|
|
|
auto* mouse_groupbox = new QGroupBox(tr("Mouse Cursor Visibility"));
|
|
|
|
auto* m_vboxlayout_hide_mouse = new QVBoxLayout;
|
|
|
|
mouse_groupbox->setLayout(m_vboxlayout_hide_mouse);
|
|
|
|
|
|
|
|
m_radio_cursor_visible_movement = new QRadioButton(tr("On Movement"));
|
|
|
|
m_radio_cursor_visible_movement->setToolTip(
|
|
|
|
tr("Mouse Cursor hides after inactivity and returns upon Mouse Cursor movement."));
|
|
|
|
m_radio_cursor_visible_never = new QRadioButton(tr("Never"));
|
|
|
|
m_radio_cursor_visible_never->setToolTip(
|
|
|
|
tr("Mouse Cursor will never be visible while a game is running."));
|
|
|
|
m_radio_cursor_visible_always = new QRadioButton(tr("Always"));
|
|
|
|
m_radio_cursor_visible_always->setToolTip(tr("Mouse Cursor will always be visible."));
|
|
|
|
|
|
|
|
m_vboxlayout_hide_mouse->addWidget(m_radio_cursor_visible_movement);
|
|
|
|
m_vboxlayout_hide_mouse->addWidget(m_radio_cursor_visible_never);
|
|
|
|
m_vboxlayout_hide_mouse->addWidget(m_radio_cursor_visible_always);
|
|
|
|
|
|
|
|
m_checkbox_lock_mouse = new QCheckBox(tr("Lock Mouse Cursor"));
|
2021-05-09 10:28:04 +00:00
|
|
|
m_checkbox_lock_mouse->setToolTip(tr("Will lock the Mouse Cursor to the Render Widget as long as "
|
|
|
|
"it has focus. You can set a hotkey to unlock it."));
|
2017-05-04 07:47:59 +00:00
|
|
|
|
2021-09-23 03:57:52 +00:00
|
|
|
mouse_groupbox->setLayout(m_vboxlayout_hide_mouse);
|
2019-05-24 18:18:49 +00:00
|
|
|
groupbox_layout->addWidget(m_checkbox_top_window);
|
2017-05-04 07:47:59 +00:00
|
|
|
groupbox_layout->addWidget(m_checkbox_confirm_on_stop);
|
|
|
|
groupbox_layout->addWidget(m_checkbox_use_panic_handlers);
|
|
|
|
groupbox_layout->addWidget(m_checkbox_enable_osd);
|
2017-05-15 14:49:52 +00:00
|
|
|
groupbox_layout->addWidget(m_checkbox_show_active_title);
|
2017-05-04 07:47:59 +00:00
|
|
|
groupbox_layout->addWidget(m_checkbox_pause_on_focus_lost);
|
2021-09-23 03:57:52 +00:00
|
|
|
groupbox_layout->addWidget(mouse_groupbox);
|
2021-05-09 10:28:04 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
groupbox_layout->addWidget(m_checkbox_lock_mouse);
|
|
|
|
#endif
|
2017-05-04 07:47:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void InterfacePane::ConnectLayout()
|
|
|
|
{
|
2018-05-12 21:54:35 +00:00
|
|
|
connect(m_checkbox_use_builtin_title_database, &QCheckBox::toggled, this,
|
2017-07-23 13:29:43 +00:00
|
|
|
&InterfacePane::OnSaveConfig);
|
2018-07-30 01:16:37 +00:00
|
|
|
connect(m_checkbox_use_covers, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
2020-02-08 19:04:25 +00:00
|
|
|
connect(m_checkbox_disable_screensaver, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
2018-05-12 21:54:35 +00:00
|
|
|
connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
2020-02-07 23:56:13 +00:00
|
|
|
connect(m_checkbox_focused_hotkeys, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
2022-08-08 01:25:19 +00:00
|
|
|
connect(
|
|
|
|
m_combobox_theme, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
|
|
|
[this](int index) { Settings::Instance().SetThemeName(m_combobox_theme->itemText(index)); });
|
2020-08-22 01:09:04 +00:00
|
|
|
connect(m_combobox_userstyle, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
2018-05-06 16:25:37 +00:00
|
|
|
&InterfacePane::OnSaveConfig);
|
2019-07-30 13:35:46 +00:00
|
|
|
connect(m_combobox_language, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
2017-07-17 21:49:51 +00:00
|
|
|
&InterfacePane::OnSaveConfig);
|
2019-05-24 18:18:49 +00:00
|
|
|
connect(m_checkbox_top_window, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
2018-05-12 21:54:35 +00:00
|
|
|
connect(m_checkbox_confirm_on_stop, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
|
|
|
connect(m_checkbox_use_panic_handlers, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
2018-08-09 13:22:52 +00:00
|
|
|
connect(m_checkbox_show_active_title, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
2018-05-12 21:54:35 +00:00
|
|
|
connect(m_checkbox_enable_osd, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
|
|
|
connect(m_checkbox_pause_on_focus_lost, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
2021-09-23 03:57:52 +00:00
|
|
|
connect(m_radio_cursor_visible_movement, &QRadioButton::toggled, this,
|
|
|
|
&InterfacePane::OnCursorVisibleMovement);
|
|
|
|
connect(m_radio_cursor_visible_never, &QRadioButton::toggled, this,
|
|
|
|
&InterfacePane::OnCursorVisibleNever);
|
|
|
|
connect(m_radio_cursor_visible_always, &QRadioButton::toggled, this,
|
|
|
|
&InterfacePane::OnCursorVisibleAlways);
|
2021-05-09 10:28:04 +00:00
|
|
|
connect(m_checkbox_lock_mouse, &QCheckBox::toggled, &Settings::Instance(),
|
|
|
|
&Settings::SetLockCursor);
|
2018-05-06 16:25:37 +00:00
|
|
|
connect(m_checkbox_use_userstyle, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
|
2017-05-04 07:47:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void InterfacePane::LoadConfig()
|
|
|
|
{
|
2022-04-18 22:25:35 +00:00
|
|
|
SignalBlocking(m_checkbox_use_builtin_title_database)
|
|
|
|
->setChecked(Config::Get(Config::MAIN_USE_BUILT_IN_TITLE_DATABASE));
|
|
|
|
SignalBlocking(m_checkbox_show_debugging_ui)
|
|
|
|
->setChecked(Settings::Instance().IsDebugModeEnabled());
|
|
|
|
SignalBlocking(m_combobox_language)
|
|
|
|
->setCurrentIndex(m_combobox_language->findData(
|
|
|
|
QString::fromStdString(Config::Get(Config::MAIN_INTERFACE_LANGUAGE))));
|
|
|
|
SignalBlocking(m_combobox_theme)
|
|
|
|
->setCurrentIndex(
|
|
|
|
m_combobox_theme->findText(QString::fromStdString(Config::Get(Config::MAIN_THEME_NAME))));
|
2017-05-04 07:47:59 +00:00
|
|
|
|
2018-05-06 16:25:37 +00:00
|
|
|
const QString userstyle = Settings::Instance().GetCurrentUserStyle();
|
2020-05-01 14:31:47 +00:00
|
|
|
const int index = m_combobox_userstyle->findData(QFileInfo(userstyle).fileName());
|
2018-05-06 16:25:37 +00:00
|
|
|
|
2018-08-09 13:20:46 +00:00
|
|
|
if (index > 0)
|
2022-04-18 22:25:35 +00:00
|
|
|
SignalBlocking(m_combobox_userstyle)->setCurrentIndex(index);
|
2018-05-06 16:25:37 +00:00
|
|
|
|
2022-04-18 22:25:35 +00:00
|
|
|
SignalBlocking(m_checkbox_use_userstyle)->setChecked(Settings::Instance().AreUserStylesEnabled());
|
2018-05-06 16:25:37 +00:00
|
|
|
|
|
|
|
const bool visible = m_checkbox_use_userstyle->isChecked();
|
|
|
|
|
|
|
|
m_combobox_userstyle->setVisible(visible);
|
|
|
|
m_label_userstyle->setVisible(visible);
|
|
|
|
|
2019-05-24 18:18:49 +00:00
|
|
|
// Render Window Options
|
2022-04-18 22:25:35 +00:00
|
|
|
SignalBlocking(m_checkbox_top_window)
|
|
|
|
->setChecked(Settings::Instance().IsKeepWindowOnTopEnabled());
|
|
|
|
SignalBlocking(m_checkbox_confirm_on_stop)->setChecked(Config::Get(Config::MAIN_CONFIRM_ON_STOP));
|
|
|
|
SignalBlocking(m_checkbox_use_panic_handlers)
|
|
|
|
->setChecked(Config::Get(Config::MAIN_USE_PANIC_HANDLERS));
|
|
|
|
SignalBlocking(m_checkbox_enable_osd)->setChecked(Config::Get(Config::MAIN_OSD_MESSAGES));
|
|
|
|
SignalBlocking(m_checkbox_show_active_title)
|
|
|
|
->setChecked(Config::Get(Config::MAIN_SHOW_ACTIVE_TITLE));
|
|
|
|
SignalBlocking(m_checkbox_pause_on_focus_lost)
|
|
|
|
->setChecked(Config::Get(Config::MAIN_PAUSE_ON_FOCUS_LOST));
|
|
|
|
SignalBlocking(m_checkbox_use_covers)->setChecked(Config::Get(Config::MAIN_USE_GAME_COVERS));
|
|
|
|
SignalBlocking(m_checkbox_focused_hotkeys)->setChecked(Config::Get(Config::MAIN_FOCUSED_HOTKEYS));
|
|
|
|
SignalBlocking(m_radio_cursor_visible_movement)
|
|
|
|
->setChecked(Settings::Instance().GetCursorVisibility() == Config::ShowCursor::OnMovement);
|
|
|
|
SignalBlocking(m_radio_cursor_visible_always)
|
|
|
|
->setChecked(Settings::Instance().GetCursorVisibility() == Config::ShowCursor::Constantly);
|
|
|
|
SignalBlocking(m_radio_cursor_visible_never)
|
|
|
|
->setChecked(Settings::Instance().GetCursorVisibility() == Config::ShowCursor::Never);
|
|
|
|
|
|
|
|
SignalBlocking(m_checkbox_lock_mouse)->setChecked(Settings::Instance().GetLockCursor());
|
|
|
|
SignalBlocking(m_checkbox_disable_screensaver)
|
|
|
|
->setChecked(Config::Get(Config::MAIN_DISABLE_SCREENSAVER));
|
2017-05-04 07:47:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void InterfacePane::OnSaveConfig()
|
|
|
|
{
|
2021-12-31 02:00:39 +00:00
|
|
|
Config::SetBase(Config::MAIN_USE_BUILT_IN_TITLE_DATABASE,
|
|
|
|
m_checkbox_use_builtin_title_database->isChecked());
|
2017-09-25 08:21:04 +00:00
|
|
|
Settings::Instance().SetDebugModeEnabled(m_checkbox_show_debugging_ui->isChecked());
|
2018-05-06 16:25:37 +00:00
|
|
|
Settings::Instance().SetUserStylesEnabled(m_checkbox_use_userstyle->isChecked());
|
2018-08-09 13:20:46 +00:00
|
|
|
Settings::Instance().SetCurrentUserStyle(m_combobox_userstyle->currentData().toString());
|
2018-05-06 16:25:37 +00:00
|
|
|
|
|
|
|
const bool visible = m_checkbox_use_userstyle->isChecked();
|
|
|
|
|
|
|
|
m_combobox_userstyle->setVisible(visible);
|
|
|
|
m_label_userstyle->setVisible(visible);
|
2017-05-04 07:47:59 +00:00
|
|
|
|
2019-05-24 18:18:49 +00:00
|
|
|
// Render Window Options
|
|
|
|
Settings::Instance().SetKeepWindowOnTop(m_checkbox_top_window->isChecked());
|
2021-12-31 02:00:39 +00:00
|
|
|
Config::SetBase(Config::MAIN_CONFIRM_ON_STOP, m_checkbox_confirm_on_stop->isChecked());
|
2020-07-20 09:22:53 +00:00
|
|
|
Config::SetBase(Config::MAIN_USE_PANIC_HANDLERS, m_checkbox_use_panic_handlers->isChecked());
|
|
|
|
Config::SetBase(Config::MAIN_OSD_MESSAGES, m_checkbox_enable_osd->isChecked());
|
2021-12-31 02:00:39 +00:00
|
|
|
Config::SetBase(Config::MAIN_SHOW_ACTIVE_TITLE, m_checkbox_show_active_title->isChecked());
|
|
|
|
Config::SetBase(Config::MAIN_PAUSE_ON_FOCUS_LOST, m_checkbox_pause_on_focus_lost->isChecked());
|
2017-05-04 07:47:59 +00:00
|
|
|
|
2017-07-17 21:49:51 +00:00
|
|
|
auto new_language = m_combobox_language->currentData().toString().toStdString();
|
2021-12-31 02:00:39 +00:00
|
|
|
if (new_language != Config::Get(Config::MAIN_INTERFACE_LANGUAGE))
|
2017-07-17 21:49:51 +00:00
|
|
|
{
|
2021-12-31 02:00:39 +00:00
|
|
|
Config::SetBase(Config::MAIN_INTERFACE_LANGUAGE, new_language);
|
2019-03-04 19:49:00 +00:00
|
|
|
ModalMessageBox::information(
|
|
|
|
this, tr("Restart Required"),
|
|
|
|
tr("You must restart Dolphin in order for the change to take effect."));
|
2017-07-17 21:49:51 +00:00
|
|
|
}
|
|
|
|
|
2018-07-30 01:16:37 +00:00
|
|
|
const bool use_covers = m_checkbox_use_covers->isChecked();
|
|
|
|
|
|
|
|
if (use_covers != Config::Get(Config::MAIN_USE_GAME_COVERS))
|
|
|
|
{
|
|
|
|
Config::SetBase(Config::MAIN_USE_GAME_COVERS, use_covers);
|
|
|
|
Settings::Instance().RefreshMetadata();
|
|
|
|
}
|
|
|
|
|
2020-02-07 23:56:13 +00:00
|
|
|
Config::SetBase(Config::MAIN_FOCUSED_HOTKEYS, m_checkbox_focused_hotkeys->isChecked());
|
2020-02-08 19:04:25 +00:00
|
|
|
Config::SetBase(Config::MAIN_DISABLE_SCREENSAVER, m_checkbox_disable_screensaver->isChecked());
|
2020-02-07 23:56:13 +00:00
|
|
|
|
2021-12-31 02:00:39 +00:00
|
|
|
Config::Save();
|
2017-05-04 07:47:59 +00:00
|
|
|
}
|
2021-09-23 03:57:52 +00:00
|
|
|
|
|
|
|
void InterfacePane::OnCursorVisibleMovement()
|
|
|
|
{
|
2021-12-31 02:00:39 +00:00
|
|
|
Settings::Instance().SetCursorVisibility(Config::ShowCursor::OnMovement);
|
2021-09-23 03:57:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void InterfacePane::OnCursorVisibleNever()
|
|
|
|
{
|
2021-12-31 02:00:39 +00:00
|
|
|
Settings::Instance().SetCursorVisibility(Config::ShowCursor::Never);
|
2021-09-23 03:57:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void InterfacePane::OnCursorVisibleAlways()
|
|
|
|
{
|
2021-12-31 02:00:39 +00:00
|
|
|
Settings::Instance().SetCursorVisibility(Config::ShowCursor::Constantly);
|
2021-09-23 03:57:52 +00:00
|
|
|
}
|