2015-12-20 23:36:39 +00:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-12-20 23:36:39 +00:00
|
|
|
|
2018-07-06 22:40:15 +00:00
|
|
|
#include "DolphinQt/Settings.h"
|
2018-05-28 01:48:04 +00:00
|
|
|
|
2021-03-24 19:53:37 +00:00
|
|
|
#include <atomic>
|
2023-08-01 17:52:36 +00:00
|
|
|
#include <memory>
|
2021-03-24 19:53:37 +00:00
|
|
|
|
2018-05-06 16:25:37 +00:00
|
|
|
#include <QApplication>
|
2023-08-01 17:52:36 +00:00
|
|
|
#include <QColor>
|
2017-05-09 16:49:10 +00:00
|
|
|
#include <QDir>
|
2018-05-06 16:25:37 +00:00
|
|
|
#include <QFile>
|
2020-05-01 14:31:47 +00:00
|
|
|
#include <QFileInfo>
|
2020-09-15 08:33:30 +00:00
|
|
|
#include <QFontDatabase>
|
2023-08-01 17:52:36 +00:00
|
|
|
#include <QPalette>
|
2021-09-23 03:57:52 +00:00
|
|
|
#include <QRadioButton>
|
2015-12-20 23:36:39 +00:00
|
|
|
#include <QSize>
|
2023-08-01 17:52:36 +00:00
|
|
|
#include <QStyle>
|
2021-04-28 16:15:53 +00:00
|
|
|
#include <QWidget>
|
2015-12-20 23:36:39 +00:00
|
|
|
|
2021-08-11 18:33:59 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include <fmt/format.h>
|
|
|
|
|
2023-07-31 21:22:53 +00:00
|
|
|
#include <winrt/Windows.UI.ViewManagement.h>
|
|
|
|
|
2021-08-11 18:33:59 +00:00
|
|
|
#include <QTabBar>
|
|
|
|
#include <QToolButton>
|
|
|
|
#endif
|
|
|
|
|
2017-06-21 08:26:06 +00:00
|
|
|
#include "AudioCommon/AudioCommon.h"
|
2018-05-28 01:48:04 +00:00
|
|
|
|
2017-09-20 16:29:32 +00:00
|
|
|
#include "Common/Config/Config.h"
|
2015-12-20 23:36:39 +00:00
|
|
|
#include "Common/FileUtil.h"
|
2017-05-20 15:53:17 +00:00
|
|
|
#include "Common/StringUtil.h"
|
2018-05-28 01:48:04 +00:00
|
|
|
|
2022-03-31 05:44:32 +00:00
|
|
|
#include "Core/Config/GraphicsSettings.h"
|
2018-07-07 01:29:46 +00:00
|
|
|
#include "Core/Config/MainSettings.h"
|
2015-12-20 23:36:39 +00:00
|
|
|
#include "Core/ConfigManager.h"
|
2017-09-04 18:12:13 +00:00
|
|
|
#include "Core/Core.h"
|
2019-07-03 20:34:07 +00:00
|
|
|
#include "Core/IOS/IOS.h"
|
2018-07-09 04:45:27 +00:00
|
|
|
#include "Core/NetPlayClient.h"
|
|
|
|
#include "Core/NetPlayServer.h"
|
2022-10-13 19:01:55 +00:00
|
|
|
#include "Core/System.h"
|
2018-05-28 01:48:04 +00:00
|
|
|
|
2021-05-20 22:33:38 +00:00
|
|
|
#include "DolphinQt/Host.h"
|
2018-07-06 22:40:15 +00:00
|
|
|
#include "DolphinQt/QtUtils/QueueOnObject.h"
|
2018-05-28 01:48:04 +00:00
|
|
|
|
2018-07-05 21:17:07 +00:00
|
|
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
2017-05-20 15:53:17 +00:00
|
|
|
#include "InputCommon/InputConfig.h"
|
2015-12-20 23:36:39 +00:00
|
|
|
|
2019-03-17 00:09:06 +00:00
|
|
|
#include "VideoCommon/NetPlayChatUI.h"
|
2019-04-02 21:13:42 +00:00
|
|
|
#include "VideoCommon/NetPlayGolfUI.h"
|
2019-03-17 00:09:06 +00:00
|
|
|
|
2023-07-30 22:27:48 +00:00
|
|
|
static bool s_system_dark = false;
|
2023-08-01 17:52:36 +00:00
|
|
|
static std::unique_ptr<QPalette> s_default_palette;
|
2023-07-30 22:27:48 +00:00
|
|
|
|
2017-09-04 18:12:13 +00:00
|
|
|
Settings::Settings()
|
|
|
|
{
|
2017-09-15 17:33:22 +00:00
|
|
|
qRegisterMetaType<Core::State>();
|
2020-12-31 12:03:20 +00:00
|
|
|
Core::AddOnStateChangedCallback([this](Core::State new_state) {
|
2018-04-22 10:49:07 +00:00
|
|
|
QueueOnObject(this, [this, new_state] { emit EmulationStateChanged(new_state); });
|
|
|
|
});
|
2017-09-20 16:29:32 +00:00
|
|
|
|
2021-03-24 19:53:37 +00:00
|
|
|
Config::AddConfigChangedCallback([this] {
|
|
|
|
static std::atomic<bool> do_once{true};
|
|
|
|
if (do_once.exchange(false))
|
|
|
|
{
|
|
|
|
// Calling ConfigChanged() with a "delay" can have risks, for example, if from
|
|
|
|
// code we change some configs that result in Qt greying out some setting, we could
|
|
|
|
// end up editing that setting before its greyed out, sending out an event,
|
|
|
|
// which might not be expected or handled by the code, potentially crashing.
|
|
|
|
// The only safe option would be to wait on the Qt thread to have finished executing this.
|
|
|
|
QueueOnObject(this, [this] {
|
|
|
|
do_once = true;
|
|
|
|
emit ConfigChanged();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2018-05-06 16:25:37 +00:00
|
|
|
|
2022-06-03 06:32:21 +00:00
|
|
|
m_hotplug_callback_handle = g_controller_interface.RegisterDevicesChangedCallback([this] {
|
2023-06-02 16:00:51 +00:00
|
|
|
if (Core::IsHostThread())
|
2021-05-20 22:33:38 +00:00
|
|
|
{
|
|
|
|
emit DevicesChanged();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Any device shared_ptr in the host thread needs to be released immediately as otherwise
|
|
|
|
// they'd continue living until the queued event has run, but some devices can't be recreated
|
|
|
|
// until they are destroyed.
|
|
|
|
// This is safe from any thread. Devices will be refreshed and re-acquired and in
|
2021-11-17 20:55:02 +00:00
|
|
|
// DevicesChanged(). Calling it without queueing shouldn't cause any deadlocks but is slow.
|
2021-05-20 22:33:38 +00:00
|
|
|
emit ReleaseDevices();
|
|
|
|
|
|
|
|
QueueOnObject(this, [this] { emit DevicesChanged(); });
|
|
|
|
}
|
|
|
|
});
|
2017-09-04 18:12:13 +00:00
|
|
|
}
|
2015-12-20 23:36:39 +00:00
|
|
|
|
2018-07-09 04:45:27 +00:00
|
|
|
Settings::~Settings() = default;
|
|
|
|
|
2022-06-03 06:32:21 +00:00
|
|
|
void Settings::UnregisterDevicesChangedCallback()
|
|
|
|
{
|
|
|
|
g_controller_interface.UnregisterDevicesChangedCallback(m_hotplug_callback_handle);
|
|
|
|
}
|
|
|
|
|
2017-05-31 07:17:39 +00:00
|
|
|
Settings& Settings::Instance()
|
|
|
|
{
|
|
|
|
static Settings settings;
|
|
|
|
return settings;
|
|
|
|
}
|
|
|
|
|
2018-03-23 11:10:53 +00:00
|
|
|
QSettings& Settings::GetQSettings()
|
|
|
|
{
|
|
|
|
static QSettings settings(
|
|
|
|
QStringLiteral("%1/Qt.ini").arg(QString::fromStdString(File::GetUserPath(D_CONFIG_IDX))),
|
|
|
|
QSettings::IniFormat);
|
|
|
|
return settings;
|
|
|
|
}
|
|
|
|
|
2017-05-31 23:15:48 +00:00
|
|
|
void Settings::SetThemeName(const QString& theme_name)
|
|
|
|
{
|
2021-12-31 02:00:39 +00:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_THEME_NAME, theme_name.toStdString());
|
2017-05-31 23:15:48 +00:00
|
|
|
emit ThemeChanged();
|
|
|
|
}
|
|
|
|
|
2018-05-06 16:25:37 +00:00
|
|
|
QString Settings::GetCurrentUserStyle() const
|
|
|
|
{
|
2020-05-01 14:31:47 +00:00
|
|
|
if (GetQSettings().contains(QStringLiteral("userstyle/name")))
|
|
|
|
return GetQSettings().value(QStringLiteral("userstyle/name")).toString();
|
|
|
|
|
|
|
|
// Migration code for the old way of storing this setting
|
|
|
|
return QFileInfo(GetQSettings().value(QStringLiteral("userstyle/path")).toString()).fileName();
|
2018-05-06 16:25:37 +00:00
|
|
|
}
|
|
|
|
|
2023-08-01 17:52:36 +00:00
|
|
|
void Settings::InitDefaultPalette()
|
|
|
|
{
|
|
|
|
s_default_palette = std::make_unique<QPalette>(qApp->palette());
|
|
|
|
}
|
|
|
|
|
2023-07-31 21:22:53 +00:00
|
|
|
void Settings::UpdateSystemDark()
|
|
|
|
{
|
|
|
|
#ifdef _WIN32
|
|
|
|
// Check if the system is set to dark mode so we can set the default theme and window
|
|
|
|
// decorations accordingly.
|
|
|
|
{
|
|
|
|
using namespace winrt::Windows::UI::ViewManagement;
|
|
|
|
const UISettings settings;
|
|
|
|
const auto& color = settings.GetColorValue(UIColorType::Foreground);
|
|
|
|
|
|
|
|
const bool is_system_dark = 5 * color.G + 2 * color.R + color.B > 8 * 128;
|
|
|
|
Settings::Instance().SetSystemDark(is_system_dark);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2023-07-30 22:27:48 +00:00
|
|
|
void Settings::SetSystemDark(bool dark)
|
|
|
|
{
|
|
|
|
s_system_dark = dark;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::IsSystemDark()
|
|
|
|
{
|
|
|
|
return s_system_dark;
|
|
|
|
}
|
|
|
|
|
2023-08-01 18:47:17 +00:00
|
|
|
bool Settings::IsThemeDark()
|
|
|
|
{
|
|
|
|
return qApp->palette().color(QPalette::Base).valueF() < 0.5;
|
|
|
|
}
|
|
|
|
|
2022-05-10 00:01:14 +00:00
|
|
|
// Calling this before the main window has been created breaks the style of some widgets.
|
2020-05-01 14:31:47 +00:00
|
|
|
void Settings::SetCurrentUserStyle(const QString& stylesheet_name)
|
2018-05-06 16:25:37 +00:00
|
|
|
{
|
|
|
|
QString stylesheet_contents;
|
|
|
|
|
2021-04-28 16:15:53 +00:00
|
|
|
// If we haven't found one, we continue with an empty (default) style
|
2020-05-01 14:31:47 +00:00
|
|
|
if (!stylesheet_name.isEmpty() && AreUserStylesEnabled())
|
2018-05-06 16:25:37 +00:00
|
|
|
{
|
|
|
|
// Load custom user stylesheet
|
2020-05-01 14:31:47 +00:00
|
|
|
QDir directory = QDir(QString::fromStdString(File::GetUserPath(D_STYLES_IDX)));
|
|
|
|
QFile stylesheet(directory.filePath(stylesheet_name));
|
2018-05-06 16:25:37 +00:00
|
|
|
|
|
|
|
if (stylesheet.open(QFile::ReadOnly))
|
|
|
|
stylesheet_contents = QString::fromUtf8(stylesheet.readAll().data());
|
|
|
|
}
|
|
|
|
|
2023-07-30 22:35:48 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
if (stylesheet_contents.isEmpty())
|
|
|
|
{
|
|
|
|
// No theme selected or found. Usually we would just fallthrough and set an empty stylesheet
|
|
|
|
// which would select Qt's default theme, but unlike other OSes we don't automatically get a
|
|
|
|
// default dark theme on Windows when the user has selected dark mode in the Windows settings.
|
|
|
|
// So manually check if the user wants dark mode and, if yes, load our embedded dark theme.
|
|
|
|
if (IsSystemDark())
|
|
|
|
{
|
|
|
|
QFile file(QStringLiteral(":/dolphin_dark_win/dark.qss"));
|
|
|
|
if (file.open(QFile::ReadOnly))
|
|
|
|
stylesheet_contents = QString::fromUtf8(file.readAll().data());
|
2023-08-01 17:52:36 +00:00
|
|
|
|
|
|
|
QPalette palette = qApp->style()->standardPalette();
|
|
|
|
palette.setColor(QPalette::Window, QColor(32, 32, 32));
|
|
|
|
palette.setColor(QPalette::WindowText, QColor(220, 220, 220));
|
|
|
|
palette.setColor(QPalette::Base, QColor(32, 32, 32));
|
|
|
|
palette.setColor(QPalette::AlternateBase, QColor(48, 48, 48));
|
|
|
|
palette.setColor(QPalette::PlaceholderText, QColor(126, 126, 126));
|
|
|
|
palette.setColor(QPalette::Text, QColor(220, 220, 220));
|
|
|
|
palette.setColor(QPalette::Button, QColor(48, 48, 48));
|
|
|
|
palette.setColor(QPalette::ButtonText, QColor(220, 220, 220));
|
|
|
|
palette.setColor(QPalette::BrightText, QColor(255, 255, 255));
|
|
|
|
palette.setColor(QPalette::Highlight, QColor(0, 120, 215));
|
|
|
|
palette.setColor(QPalette::HighlightedText, QColor(255, 255, 255));
|
|
|
|
palette.setColor(QPalette::Link, QColor(100, 160, 220));
|
|
|
|
palette.setColor(QPalette::LinkVisited, QColor(100, 160, 220));
|
|
|
|
qApp->setPalette(palette);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// reset any palette changes that may exist from a previously set dark mode
|
|
|
|
if (s_default_palette)
|
|
|
|
qApp->setPalette(*s_default_palette);
|
2023-07-30 22:35:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-04-28 16:15:53 +00:00
|
|
|
// Define tooltips style if not already defined
|
|
|
|
if (!stylesheet_contents.contains(QStringLiteral("QToolTip"), Qt::CaseSensitive))
|
|
|
|
{
|
|
|
|
const QPalette& palette = qApp->palette();
|
|
|
|
QColor window_color;
|
|
|
|
QColor text_color;
|
|
|
|
QColor unused_text_emphasis_color;
|
|
|
|
QColor border_color;
|
|
|
|
GetToolTipStyle(window_color, text_color, unused_text_emphasis_color, border_color, palette,
|
|
|
|
palette);
|
|
|
|
|
|
|
|
const auto tooltip_stylesheet =
|
|
|
|
QStringLiteral("QToolTip { background-color: #%1; color: #%2; padding: 8px; "
|
|
|
|
"border: 1px; border-style: solid; border-color: #%3; }")
|
|
|
|
.arg(window_color.rgba(), 0, 16)
|
|
|
|
.arg(text_color.rgba(), 0, 16)
|
|
|
|
.arg(border_color.rgba(), 0, 16);
|
|
|
|
stylesheet_contents.append(QStringLiteral("%1").arg(tooltip_stylesheet));
|
|
|
|
}
|
|
|
|
|
2018-05-06 16:25:37 +00:00
|
|
|
qApp->setStyleSheet(stylesheet_contents);
|
|
|
|
|
2020-05-01 14:31:47 +00:00
|
|
|
GetQSettings().setValue(QStringLiteral("userstyle/name"), stylesheet_name);
|
2018-05-06 16:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::AreUserStylesEnabled() const
|
|
|
|
{
|
|
|
|
return GetQSettings().value(QStringLiteral("userstyle/enabled"), false).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetUserStylesEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
GetQSettings().setValue(QStringLiteral("userstyle/enabled"), enabled);
|
|
|
|
}
|
|
|
|
|
2021-04-28 16:15:53 +00:00
|
|
|
void Settings::GetToolTipStyle(QColor& window_color, QColor& text_color,
|
|
|
|
QColor& emphasis_text_color, QColor& border_color,
|
|
|
|
const QPalette& palette, const QPalette& high_contrast_palette) const
|
|
|
|
{
|
|
|
|
const auto theme_window_color = palette.color(QPalette::Base);
|
|
|
|
const auto theme_window_hsv = theme_window_color.toHsv();
|
|
|
|
const auto brightness = theme_window_hsv.value();
|
|
|
|
const bool brightness_over_threshold = brightness > 128;
|
|
|
|
const QColor emphasis_text_color_1 = Qt::yellow;
|
|
|
|
const QColor emphasis_text_color_2 = QColor(QStringLiteral("#0090ff")); // ~light blue
|
|
|
|
if (Config::Get(Config::MAIN_USE_HIGH_CONTRAST_TOOLTIPS))
|
|
|
|
{
|
|
|
|
window_color = brightness_over_threshold ? QColor(72, 72, 72) : Qt::white;
|
|
|
|
text_color = brightness_over_threshold ? Qt::white : Qt::black;
|
|
|
|
emphasis_text_color = brightness_over_threshold ? emphasis_text_color_1 : emphasis_text_color_2;
|
|
|
|
border_color = high_contrast_palette.color(QPalette::Window).darker(160);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
window_color = palette.color(QPalette::Window);
|
|
|
|
text_color = palette.color(QPalette::Text);
|
|
|
|
emphasis_text_color = brightness_over_threshold ? emphasis_text_color_2 : emphasis_text_color_1;
|
|
|
|
border_color = palette.color(QPalette::Text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-20 23:36:39 +00:00
|
|
|
QStringList Settings::GetPaths() const
|
|
|
|
{
|
2017-06-22 22:11:53 +00:00
|
|
|
QStringList list;
|
2022-01-01 16:53:12 +00:00
|
|
|
for (const auto& path : Config::GetIsoPaths())
|
2017-06-22 22:11:53 +00:00
|
|
|
list << QString::fromStdString(path);
|
|
|
|
return list;
|
2017-05-31 07:42:15 +00:00
|
|
|
}
|
|
|
|
|
2017-06-22 22:11:53 +00:00
|
|
|
void Settings::AddPath(const QString& qpath)
|
2015-12-20 23:36:39 +00:00
|
|
|
{
|
2017-06-22 22:11:53 +00:00
|
|
|
std::string path = qpath.toStdString();
|
2022-01-01 16:53:12 +00:00
|
|
|
std::vector<std::string> paths = Config::GetIsoPaths();
|
2015-12-20 23:36:39 +00:00
|
|
|
|
2017-06-22 22:11:53 +00:00
|
|
|
if (std::find(paths.begin(), paths.end(), path) != paths.end())
|
2017-05-31 07:42:15 +00:00
|
|
|
return;
|
|
|
|
|
2017-06-22 22:11:53 +00:00
|
|
|
paths.emplace_back(path);
|
2022-01-01 16:53:12 +00:00
|
|
|
Config::SetIsoPaths(paths);
|
2017-06-22 22:11:53 +00:00
|
|
|
emit PathAdded(qpath);
|
2017-05-04 04:19:51 +00:00
|
|
|
}
|
|
|
|
|
2017-06-22 22:11:53 +00:00
|
|
|
void Settings::RemovePath(const QString& qpath)
|
2017-05-04 04:19:51 +00:00
|
|
|
{
|
2017-06-22 22:11:53 +00:00
|
|
|
std::string path = qpath.toStdString();
|
2022-01-01 16:53:12 +00:00
|
|
|
std::vector<std::string> paths = Config::GetIsoPaths();
|
2017-05-04 04:19:51 +00:00
|
|
|
|
2017-06-22 22:11:53 +00:00
|
|
|
auto new_end = std::remove(paths.begin(), paths.end(), path);
|
|
|
|
if (new_end == paths.end())
|
|
|
|
return;
|
2015-12-20 23:36:39 +00:00
|
|
|
|
2017-06-22 22:11:53 +00:00
|
|
|
paths.erase(new_end, paths.end());
|
2022-01-01 16:53:12 +00:00
|
|
|
Config::SetIsoPaths(paths);
|
2017-06-22 22:11:53 +00:00
|
|
|
emit PathRemoved(qpath);
|
2015-12-20 23:36:39 +00:00
|
|
|
}
|
|
|
|
|
2018-07-06 18:27:07 +00:00
|
|
|
void Settings::RefreshGameList()
|
2018-04-19 21:07:36 +00:00
|
|
|
{
|
2018-07-06 18:27:07 +00:00
|
|
|
emit GameListRefreshRequested();
|
2018-04-19 21:07:36 +00:00
|
|
|
}
|
2019-10-09 21:51:49 +00:00
|
|
|
|
2020-09-27 02:01:54 +00:00
|
|
|
void Settings::NotifyRefreshGameListStarted()
|
|
|
|
{
|
|
|
|
emit GameListRefreshStarted();
|
|
|
|
}
|
|
|
|
|
2019-10-09 21:51:49 +00:00
|
|
|
void Settings::NotifyRefreshGameListComplete()
|
|
|
|
{
|
|
|
|
emit GameListRefreshCompleted();
|
|
|
|
}
|
2018-04-19 21:07:36 +00:00
|
|
|
|
2018-07-30 01:16:37 +00:00
|
|
|
void Settings::RefreshMetadata()
|
|
|
|
{
|
|
|
|
emit MetadataRefreshRequested();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::NotifyMetadataRefreshComplete()
|
|
|
|
{
|
|
|
|
emit MetadataRefreshCompleted();
|
|
|
|
}
|
|
|
|
|
2018-06-04 19:44:46 +00:00
|
|
|
void Settings::ReloadTitleDB()
|
|
|
|
{
|
|
|
|
emit TitleDBReloadRequested();
|
|
|
|
}
|
|
|
|
|
2018-06-06 08:52:27 +00:00
|
|
|
bool Settings::IsAutoRefreshEnabled() const
|
|
|
|
{
|
|
|
|
return GetQSettings().value(QStringLiteral("gamelist/autorefresh"), true).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetAutoRefreshEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
if (IsAutoRefreshEnabled() == enabled)
|
|
|
|
return;
|
|
|
|
|
|
|
|
GetQSettings().setValue(QStringLiteral("gamelist/autorefresh"), enabled);
|
|
|
|
|
|
|
|
emit AutoRefreshToggled(enabled);
|
|
|
|
}
|
|
|
|
|
2018-01-31 18:58:02 +00:00
|
|
|
QString Settings::GetDefaultGame() const
|
|
|
|
{
|
2018-07-07 01:29:46 +00:00
|
|
|
return QString::fromStdString(Config::Get(Config::MAIN_DEFAULT_ISO));
|
2018-01-31 18:58:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetDefaultGame(QString path)
|
|
|
|
{
|
|
|
|
if (GetDefaultGame() != path)
|
|
|
|
{
|
2018-07-07 01:29:46 +00:00
|
|
|
Config::SetBase(Config::MAIN_DEFAULT_ISO, path.toStdString());
|
2018-01-31 18:58:02 +00:00
|
|
|
emit DefaultGameChanged(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-01 10:29:39 +00:00
|
|
|
bool Settings::GetPreferredView() const
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
return GetQSettings().value(QStringLiteral("PreferredView"), true).toBool();
|
2016-01-01 10:29:39 +00:00
|
|
|
}
|
|
|
|
|
2017-08-05 08:28:53 +00:00
|
|
|
void Settings::SetPreferredView(bool list)
|
2016-01-01 10:29:39 +00:00
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
GetQSettings().setValue(QStringLiteral("PreferredView"), list);
|
2015-12-20 23:36:39 +00:00
|
|
|
}
|
|
|
|
|
2016-02-15 01:56:40 +00:00
|
|
|
int Settings::GetStateSlot() const
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
return GetQSettings().value(QStringLiteral("Emulation/StateSlot"), 1).toInt();
|
2016-02-15 01:56:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetStateSlot(int slot)
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
GetQSettings().setValue(QStringLiteral("Emulation/StateSlot"), slot);
|
2015-12-20 23:36:39 +00:00
|
|
|
}
|
2017-05-08 17:03:59 +00:00
|
|
|
|
2021-12-31 02:00:39 +00:00
|
|
|
void Settings::SetCursorVisibility(Config::ShowCursor hideCursor)
|
2017-06-01 06:49:06 +00:00
|
|
|
{
|
2021-12-31 02:00:39 +00:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_SHOW_CURSOR, hideCursor);
|
2021-09-23 03:57:52 +00:00
|
|
|
emit CursorVisibilityChanged();
|
2017-06-01 06:49:06 +00:00
|
|
|
}
|
|
|
|
|
2021-12-31 02:00:39 +00:00
|
|
|
Config::ShowCursor Settings::GetCursorVisibility() const
|
2017-06-01 06:49:06 +00:00
|
|
|
{
|
2021-12-31 02:00:39 +00:00
|
|
|
return Config::Get(Config::MAIN_SHOW_CURSOR);
|
2017-06-01 06:49:06 +00:00
|
|
|
}
|
|
|
|
|
2021-05-09 10:28:04 +00:00
|
|
|
void Settings::SetLockCursor(bool lock_cursor)
|
|
|
|
{
|
2021-12-31 02:00:39 +00:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_LOCK_CURSOR, lock_cursor);
|
2021-05-09 10:28:04 +00:00
|
|
|
emit LockCursorChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::GetLockCursor() const
|
|
|
|
{
|
2021-12-31 02:00:39 +00:00
|
|
|
return Config::Get(Config::MAIN_LOCK_CURSOR);
|
2021-05-09 10:28:04 +00:00
|
|
|
}
|
|
|
|
|
2018-04-22 08:56:15 +00:00
|
|
|
void Settings::SetKeepWindowOnTop(bool top)
|
|
|
|
{
|
|
|
|
if (IsKeepWindowOnTopEnabled() == top)
|
|
|
|
return;
|
|
|
|
|
2019-03-03 04:41:50 +00:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_KEEP_WINDOW_ON_TOP, top);
|
2018-04-22 08:56:15 +00:00
|
|
|
emit KeepWindowOnTopChanged(top);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::IsKeepWindowOnTopEnabled() const
|
|
|
|
{
|
2019-03-03 04:41:50 +00:00
|
|
|
return Config::Get(Config::MAIN_KEEP_WINDOW_ON_TOP);
|
2018-04-22 08:56:15 +00:00
|
|
|
}
|
|
|
|
|
2022-03-31 05:44:32 +00:00
|
|
|
bool Settings::GetGraphicModsEnabled() const
|
|
|
|
{
|
|
|
|
return Config::Get(Config::GFX_MODS_ENABLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetGraphicModsEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
if (GetGraphicModsEnabled() == enabled)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Config::SetBaseOrCurrent(Config::GFX_MODS_ENABLE, enabled);
|
|
|
|
emit EnableGfxModsChanged(enabled);
|
|
|
|
}
|
|
|
|
|
2017-06-21 08:26:06 +00:00
|
|
|
int Settings::GetVolume() const
|
|
|
|
{
|
2021-10-14 00:29:04 +00:00
|
|
|
return Config::Get(Config::MAIN_AUDIO_VOLUME);
|
2017-06-21 08:26:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetVolume(int volume)
|
|
|
|
{
|
|
|
|
if (GetVolume() != volume)
|
|
|
|
{
|
2021-10-14 00:29:04 +00:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_VOLUME, volume);
|
2017-06-21 08:26:06 +00:00
|
|
|
emit VolumeChanged(volume);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::IncreaseVolume(int volume)
|
|
|
|
{
|
2022-10-13 19:01:55 +00:00
|
|
|
AudioCommon::IncreaseVolume(Core::System::GetInstance(), volume);
|
2017-06-21 08:26:06 +00:00
|
|
|
emit VolumeChanged(GetVolume());
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::DecreaseVolume(int volume)
|
|
|
|
{
|
2022-10-13 19:01:55 +00:00
|
|
|
AudioCommon::DecreaseVolume(Core::System::GetInstance(), volume);
|
2017-06-21 08:26:06 +00:00
|
|
|
emit VolumeChanged(GetVolume());
|
|
|
|
}
|
|
|
|
|
2017-07-04 13:21:33 +00:00
|
|
|
bool Settings::IsLogVisible() const
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
return GetQSettings().value(QStringLiteral("logging/logvisible")).toBool();
|
2017-07-04 13:21:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetLogVisible(bool visible)
|
|
|
|
{
|
|
|
|
if (IsLogVisible() != visible)
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
GetQSettings().setValue(QStringLiteral("logging/logvisible"), visible);
|
2017-07-04 13:21:33 +00:00
|
|
|
emit LogVisibilityChanged(visible);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::IsLogConfigVisible() const
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
return GetQSettings().value(QStringLiteral("logging/logconfigvisible")).toBool();
|
2017-07-04 13:21:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetLogConfigVisible(bool visible)
|
|
|
|
{
|
|
|
|
if (IsLogConfigVisible() != visible)
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
GetQSettings().setValue(QStringLiteral("logging/logconfigvisible"), visible);
|
2017-07-04 13:21:33 +00:00
|
|
|
emit LogConfigVisibilityChanged(visible);
|
|
|
|
}
|
|
|
|
}
|
2017-08-01 10:55:21 +00:00
|
|
|
|
2018-07-13 00:37:12 +00:00
|
|
|
std::shared_ptr<NetPlay::NetPlayClient> Settings::GetNetPlayClient()
|
2017-08-01 10:55:21 +00:00
|
|
|
{
|
2018-07-13 00:37:12 +00:00
|
|
|
return m_client;
|
2017-08-01 10:55:21 +00:00
|
|
|
}
|
|
|
|
|
2018-07-06 23:39:42 +00:00
|
|
|
void Settings::ResetNetPlayClient(NetPlay::NetPlayClient* client)
|
2017-08-01 10:55:21 +00:00
|
|
|
{
|
|
|
|
m_client.reset(client);
|
2019-03-17 00:09:06 +00:00
|
|
|
|
|
|
|
g_netplay_chat_ui.reset();
|
2019-04-02 21:13:42 +00:00
|
|
|
g_netplay_golf_ui.reset();
|
2017-08-01 10:55:21 +00:00
|
|
|
}
|
|
|
|
|
2018-07-13 00:37:12 +00:00
|
|
|
std::shared_ptr<NetPlay::NetPlayServer> Settings::GetNetPlayServer()
|
2017-08-01 10:55:21 +00:00
|
|
|
{
|
2018-07-13 00:37:12 +00:00
|
|
|
return m_server;
|
2017-08-01 10:55:21 +00:00
|
|
|
}
|
|
|
|
|
2018-07-06 23:39:42 +00:00
|
|
|
void Settings::ResetNetPlayServer(NetPlay::NetPlayServer* server)
|
2017-08-01 10:55:21 +00:00
|
|
|
{
|
|
|
|
m_server.reset(server);
|
|
|
|
}
|
2017-08-30 19:00:59 +00:00
|
|
|
|
|
|
|
bool Settings::GetCheatsEnabled() const
|
|
|
|
{
|
2021-08-11 11:52:08 +00:00
|
|
|
return Config::Get(Config::MAIN_ENABLE_CHEATS);
|
2017-08-30 19:00:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetCheatsEnabled(bool enabled)
|
|
|
|
{
|
2021-08-11 11:52:08 +00:00
|
|
|
if (Config::Get(Config::MAIN_ENABLE_CHEATS) != enabled)
|
2017-08-30 19:00:59 +00:00
|
|
|
{
|
2021-08-11 11:52:08 +00:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_CHEATS, enabled);
|
2017-08-30 19:00:59 +00:00
|
|
|
emit EnableCheatsChanged(enabled);
|
|
|
|
}
|
|
|
|
}
|
2017-09-19 12:14:45 +00:00
|
|
|
|
|
|
|
void Settings::SetDebugModeEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
if (IsDebugModeEnabled() != enabled)
|
|
|
|
{
|
2021-12-31 02:00:39 +00:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_ENABLE_DEBUGGING, enabled);
|
2017-09-19 12:14:45 +00:00
|
|
|
emit DebugModeToggled(enabled);
|
Only force-show the code widget when first enabling the debugger
Before, any call of Settings::SetDebugModeEnabled(true) would show it. This means that if the debugging UI is enabled, but the user manually closed the code widget, then toggling any option on the interface pane (such as "Pause on Focus Loss") would cause the code widget to reappear. Additionally, closing and reopening dolphin did not call SetDebugModeEnabled, so the code widget did not reappear in that case (it only appeared after touching the interface pane). This is a bit silly, so now only enabling the debugger does it.
This also somewhat resolves an inconsistency introduced by the previous commit: prior to it, --debugger would call SetDebugModeEnabled(true) and thus show the code pane; after these commits, it does not, as it acts like a config change. This is a behavior difference, but not a particularly important one.
2023-04-18 06:18:42 +00:00
|
|
|
if (enabled)
|
|
|
|
SetCodeVisible(true);
|
2017-09-19 12:14:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::IsDebugModeEnabled() const
|
|
|
|
{
|
2021-12-31 02:00:39 +00:00
|
|
|
return Config::Get(Config::MAIN_ENABLE_DEBUGGING);
|
2017-09-19 12:14:45 +00:00
|
|
|
}
|
2017-09-13 17:33:45 +00:00
|
|
|
|
|
|
|
void Settings::SetRegistersVisible(bool enabled)
|
|
|
|
{
|
|
|
|
if (IsRegistersVisible() != enabled)
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
GetQSettings().setValue(QStringLiteral("debugger/showregisters"), enabled);
|
2017-09-13 17:33:45 +00:00
|
|
|
|
|
|
|
emit RegistersVisibilityChanged(enabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-21 07:48:49 +00:00
|
|
|
bool Settings::IsThreadsVisible() const
|
|
|
|
{
|
|
|
|
return GetQSettings().value(QStringLiteral("debugger/showthreads")).toBool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetThreadsVisible(bool enabled)
|
|
|
|
{
|
|
|
|
if (IsThreadsVisible() == enabled)
|
|
|
|
return;
|
|
|
|
|
|
|
|
GetQSettings().setValue(QStringLiteral("debugger/showthreads"), enabled);
|
|
|
|
emit ThreadsVisibilityChanged(enabled);
|
|
|
|
}
|
|
|
|
|
2017-09-13 17:33:45 +00:00
|
|
|
bool Settings::IsRegistersVisible() const
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
return GetQSettings().value(QStringLiteral("debugger/showregisters")).toBool();
|
2017-09-13 17:33:45 +00:00
|
|
|
}
|
2017-09-27 06:53:05 +00:00
|
|
|
|
|
|
|
void Settings::SetWatchVisible(bool enabled)
|
|
|
|
{
|
|
|
|
if (IsWatchVisible() != enabled)
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
GetQSettings().setValue(QStringLiteral("debugger/showwatch"), enabled);
|
2017-09-27 06:53:05 +00:00
|
|
|
|
|
|
|
emit WatchVisibilityChanged(enabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::IsWatchVisible() const
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
return GetQSettings().value(QStringLiteral("debugger/showwatch")).toBool();
|
2017-09-27 06:53:05 +00:00
|
|
|
}
|
2017-10-03 16:43:44 +00:00
|
|
|
|
|
|
|
void Settings::SetBreakpointsVisible(bool enabled)
|
|
|
|
{
|
|
|
|
if (IsBreakpointsVisible() != enabled)
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
GetQSettings().setValue(QStringLiteral("debugger/showbreakpoints"), enabled);
|
2017-10-03 16:43:44 +00:00
|
|
|
|
|
|
|
emit BreakpointsVisibilityChanged(enabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::IsBreakpointsVisible() const
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
return GetQSettings().value(QStringLiteral("debugger/showbreakpoints")).toBool();
|
2017-10-03 16:43:44 +00:00
|
|
|
}
|
2018-02-06 22:12:17 +00:00
|
|
|
|
2018-02-14 22:25:01 +00:00
|
|
|
void Settings::SetCodeVisible(bool enabled)
|
|
|
|
{
|
|
|
|
if (IsCodeVisible() != enabled)
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
GetQSettings().setValue(QStringLiteral("debugger/showcode"), enabled);
|
2018-02-14 22:25:01 +00:00
|
|
|
|
|
|
|
emit CodeVisibilityChanged(enabled);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::IsCodeVisible() const
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
return GetQSettings().value(QStringLiteral("debugger/showcode")).toBool();
|
2018-02-14 22:25:01 +00:00
|
|
|
}
|
|
|
|
|
2018-03-16 11:39:53 +00:00
|
|
|
void Settings::SetMemoryVisible(bool enabled)
|
|
|
|
{
|
|
|
|
if (IsMemoryVisible() == enabled)
|
|
|
|
return;
|
|
|
|
QSettings().setValue(QStringLiteral("debugger/showmemory"), enabled);
|
|
|
|
|
|
|
|
emit MemoryVisibilityChanged(enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::IsMemoryVisible() const
|
|
|
|
{
|
|
|
|
return QSettings().value(QStringLiteral("debugger/showmemory")).toBool();
|
2020-04-19 19:30:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetNetworkVisible(bool enabled)
|
|
|
|
{
|
|
|
|
if (IsNetworkVisible() == enabled)
|
|
|
|
return;
|
|
|
|
|
|
|
|
GetQSettings().setValue(QStringLiteral("debugger/shownetwork"), enabled);
|
|
|
|
emit NetworkVisibilityChanged(enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::IsNetworkVisible() const
|
|
|
|
{
|
|
|
|
return GetQSettings().value(QStringLiteral("debugger/shownetwork")).toBool();
|
2018-03-16 11:39:53 +00:00
|
|
|
}
|
|
|
|
|
2018-04-09 13:31:20 +00:00
|
|
|
void Settings::SetJITVisible(bool enabled)
|
|
|
|
{
|
|
|
|
if (IsJITVisible() == enabled)
|
|
|
|
return;
|
|
|
|
QSettings().setValue(QStringLiteral("debugger/showjit"), enabled);
|
|
|
|
|
|
|
|
emit JITVisibilityChanged(enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::IsJITVisible() const
|
|
|
|
{
|
|
|
|
return QSettings().value(QStringLiteral("debugger/showjit")).toBool();
|
|
|
|
}
|
|
|
|
|
2018-08-19 22:39:57 +00:00
|
|
|
void Settings::RefreshWidgetVisibility()
|
|
|
|
{
|
|
|
|
emit DebugModeToggled(IsDebugModeEnabled());
|
|
|
|
emit LogVisibilityChanged(IsLogVisible());
|
|
|
|
emit LogConfigVisibilityChanged(IsLogConfigVisible());
|
|
|
|
}
|
|
|
|
|
2018-02-14 22:25:01 +00:00
|
|
|
void Settings::SetDebugFont(QFont font)
|
|
|
|
{
|
|
|
|
if (GetDebugFont() != font)
|
|
|
|
{
|
2018-03-23 11:10:53 +00:00
|
|
|
GetQSettings().setValue(QStringLiteral("debugger/font"), font);
|
2018-02-14 22:25:01 +00:00
|
|
|
|
|
|
|
emit DebugFontChanged(font);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QFont Settings::GetDebugFont() const
|
|
|
|
{
|
2020-09-15 08:33:30 +00:00
|
|
|
QFont default_font = QFont(QFontDatabase::systemFont(QFontDatabase::FixedFont).family());
|
2022-03-31 03:28:39 +00:00
|
|
|
default_font.setPointSizeF(9.0);
|
2018-02-14 22:25:01 +00:00
|
|
|
|
2018-03-23 11:10:53 +00:00
|
|
|
return GetQSettings().value(QStringLiteral("debugger/font"), default_font).value<QFont>();
|
2018-02-14 22:25:01 +00:00
|
|
|
}
|
2018-03-22 11:20:15 +00:00
|
|
|
|
|
|
|
void Settings::SetAutoUpdateTrack(const QString& mode)
|
|
|
|
{
|
|
|
|
if (mode == GetAutoUpdateTrack())
|
|
|
|
return;
|
|
|
|
|
2021-12-27 18:09:47 +00:00
|
|
|
Config::SetBase(Config::MAIN_AUTOUPDATE_UPDATE_TRACK, mode.toStdString());
|
2018-03-22 11:20:15 +00:00
|
|
|
|
|
|
|
emit AutoUpdateTrackChanged(mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::GetAutoUpdateTrack() const
|
|
|
|
{
|
2021-12-27 18:09:47 +00:00
|
|
|
return QString::fromStdString(Config::Get(Config::MAIN_AUTOUPDATE_UPDATE_TRACK));
|
2018-03-22 11:20:15 +00:00
|
|
|
}
|
2018-03-23 22:25:17 +00:00
|
|
|
|
2020-11-28 20:09:37 +00:00
|
|
|
void Settings::SetFallbackRegion(const DiscIO::Region& region)
|
|
|
|
{
|
|
|
|
if (region == GetFallbackRegion())
|
|
|
|
return;
|
|
|
|
|
|
|
|
Config::SetBase(Config::MAIN_FALLBACK_REGION, region);
|
|
|
|
|
|
|
|
emit FallbackRegionChanged(region);
|
|
|
|
}
|
|
|
|
|
|
|
|
DiscIO::Region Settings::GetFallbackRegion() const
|
|
|
|
{
|
|
|
|
return Config::Get(Config::MAIN_FALLBACK_REGION);
|
|
|
|
}
|
|
|
|
|
2018-03-23 22:25:17 +00:00
|
|
|
void Settings::SetAnalyticsEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
if (enabled == IsAnalyticsEnabled())
|
|
|
|
return;
|
|
|
|
|
2020-09-09 18:19:30 +00:00
|
|
|
Config::SetBase(Config::MAIN_ANALYTICS_ENABLED, enabled);
|
2018-03-23 22:25:17 +00:00
|
|
|
|
|
|
|
emit AnalyticsToggled(enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::IsAnalyticsEnabled() const
|
|
|
|
{
|
2020-09-09 18:19:30 +00:00
|
|
|
return Config::Get(Config::MAIN_ANALYTICS_ENABLED);
|
2018-03-23 22:25:17 +00:00
|
|
|
}
|
2018-04-19 09:32:00 +00:00
|
|
|
|
|
|
|
void Settings::SetToolBarVisible(bool visible)
|
|
|
|
{
|
|
|
|
if (IsToolBarVisible() == visible)
|
|
|
|
return;
|
|
|
|
|
|
|
|
GetQSettings().setValue(QStringLiteral("toolbar/visible"), visible);
|
|
|
|
|
|
|
|
emit ToolBarVisibilityChanged(visible);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::IsToolBarVisible() const
|
|
|
|
{
|
2018-04-28 19:27:29 +00:00
|
|
|
return GetQSettings().value(QStringLiteral("toolbar/visible"), true).toBool();
|
2018-04-19 09:32:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetWidgetsLocked(bool locked)
|
|
|
|
{
|
|
|
|
if (AreWidgetsLocked() == locked)
|
|
|
|
return;
|
|
|
|
|
|
|
|
GetQSettings().setValue(QStringLiteral("widgets/locked"), locked);
|
|
|
|
|
|
|
|
emit WidgetLockChanged(locked);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::AreWidgetsLocked() const
|
|
|
|
{
|
|
|
|
return GetQSettings().value(QStringLiteral("widgets/locked"), true).toBool();
|
|
|
|
}
|
2018-04-29 17:13:40 +00:00
|
|
|
|
|
|
|
bool Settings::IsBatchModeEnabled() const
|
|
|
|
{
|
|
|
|
return m_batch;
|
|
|
|
}
|
|
|
|
void Settings::SetBatchModeEnabled(bool batch)
|
|
|
|
{
|
|
|
|
m_batch = batch;
|
|
|
|
}
|
2018-08-02 10:55:30 +00:00
|
|
|
|
2019-07-03 20:34:07 +00:00
|
|
|
bool Settings::IsSDCardInserted() const
|
|
|
|
{
|
2022-01-06 03:48:41 +00:00
|
|
|
return Config::Get(Config::MAIN_WII_SD_CARD);
|
2019-07-03 20:34:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetSDCardInserted(bool inserted)
|
|
|
|
{
|
|
|
|
if (IsSDCardInserted() != inserted)
|
|
|
|
{
|
2022-01-06 03:48:41 +00:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_WII_SD_CARD, inserted);
|
2019-07-03 20:34:07 +00:00
|
|
|
emit SDCardInsertionChanged(inserted);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-02 10:55:30 +00:00
|
|
|
bool Settings::IsUSBKeyboardConnected() const
|
|
|
|
{
|
2022-01-06 04:00:46 +00:00
|
|
|
return Config::Get(Config::MAIN_WII_KEYBOARD);
|
2018-08-02 10:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetUSBKeyboardConnected(bool connected)
|
|
|
|
{
|
|
|
|
if (IsUSBKeyboardConnected() != connected)
|
|
|
|
{
|
2022-01-06 04:00:46 +00:00
|
|
|
Config::SetBaseOrCurrent(Config::MAIN_WII_KEYBOARD, connected);
|
2018-08-02 10:55:30 +00:00
|
|
|
emit USBKeyboardConnectionChanged(connected);
|
|
|
|
}
|
|
|
|
}
|