2015-12-20 16:36:39 -07:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include <QSize>
|
|
|
|
|
|
|
|
#include "Common/FileUtil.h"
|
|
|
|
#include "Core/ConfigManager.h"
|
|
|
|
#include "DolphinQt2/Settings.h"
|
|
|
|
|
|
|
|
static QString GetSettingsPath()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return QString::fromStdString(File::GetUserPath(D_CONFIG_IDX)) + QStringLiteral("/UI.ini");
|
2015-12-20 16:36:39 -07:00
|
|
|
}
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
Settings::Settings(QObject* parent) : QSettings(GetSettingsPath(), QSettings::IniFormat, parent)
|
2015-12-20 16:36:39 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::GetThemeDir() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
QString theme_name = value(QStringLiteral("Theme"), QStringLiteral("Clean")).toString();
|
|
|
|
return QString::fromStdString(File::GetThemeDir(theme_name.toStdString()));
|
2015-12-20 16:36:39 -07:00
|
|
|
}
|
|
|
|
|
2016-07-12 23:52:45 -06:00
|
|
|
bool Settings::IsInDevelopmentWarningEnabled() const
|
|
|
|
{
|
|
|
|
// There's intentionally no way to set this from the UI.
|
|
|
|
// Add it to your INI manually instead.
|
|
|
|
return value(QStringLiteral("ShowDevelopmentWarning"), true).toBool();
|
|
|
|
}
|
|
|
|
|
2015-12-20 16:36:39 -07:00
|
|
|
QString Settings::GetLastGame() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return value(QStringLiteral("GameList/LastGame")).toString();
|
2015-12-20 16:36:39 -07:00
|
|
|
}
|
|
|
|
|
2015-12-21 20:46:03 -07:00
|
|
|
void Settings::SetLastGame(const QString& path)
|
2015-12-20 16:36:39 -07:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
setValue(QStringLiteral("GameList/LastGame"), path);
|
2015-12-20 16:36:39 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
QStringList Settings::GetPaths() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return value(QStringLiteral("GameList/Paths")).toStringList();
|
2015-12-20 16:36:39 -07:00
|
|
|
}
|
|
|
|
|
2015-12-21 20:46:03 -07:00
|
|
|
void Settings::SetPaths(const QStringList& paths)
|
2015-12-20 16:36:39 -07:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
setValue(QStringLiteral("GameList/Paths"), paths);
|
2015-12-20 16:36:39 -07:00
|
|
|
}
|
|
|
|
|
2015-12-30 20:03:13 -07:00
|
|
|
void Settings::RemovePath(int i)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
QStringList paths = GetPaths();
|
|
|
|
paths.removeAt(i);
|
|
|
|
SetPaths(paths);
|
2015-12-30 20:03:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::GetDefaultGame() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return QString::fromStdString(SConfig::GetInstance().m_strDefaultISO);
|
2015-12-30 20:03:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetDefaultGame(const QString& path)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
SConfig::GetInstance().m_strDefaultISO = path.toStdString();
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
2015-12-30 20:03:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::GetDVDRoot() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return QString::fromStdString(SConfig::GetInstance().m_strDVDRoot);
|
2015-12-30 20:03:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetDVDRoot(const QString& path)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
SConfig::GetInstance().m_strDVDRoot = path.toStdString();
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
2015-12-30 20:03:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::GetApploader() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return QString::fromStdString(SConfig::GetInstance().m_strApploader);
|
2015-12-30 20:03:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetApploader(const QString& path)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
SConfig::GetInstance().m_strApploader = path.toStdString();
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
2015-12-30 20:03:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::GetWiiNAND() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return QString::fromStdString(SConfig::GetInstance().m_NANDPath);
|
2015-12-30 20:03:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetWiiNAND(const QString& path)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
SConfig::GetInstance().m_NANDPath = path.toStdString();
|
|
|
|
SConfig::GetInstance().SaveSettings();
|
2015-12-30 20:03:13 -07:00
|
|
|
}
|
|
|
|
|
2016-07-06 12:33:05 -06:00
|
|
|
DiscIO::Language Settings::GetWiiSystemLanguage() const
|
2015-12-20 16:36:39 -07:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return SConfig::GetInstance().GetCurrentLanguage(true);
|
2015-12-20 16:36:39 -07:00
|
|
|
}
|
|
|
|
|
2016-07-06 12:33:05 -06:00
|
|
|
DiscIO::Language Settings::GetGCSystemLanguage() const
|
2015-12-20 16:36:39 -07:00
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return SConfig::GetInstance().GetCurrentLanguage(false);
|
2015-12-20 16:36:39 -07:00
|
|
|
}
|
|
|
|
|
2016-01-01 03:29:39 -07:00
|
|
|
bool Settings::GetPreferredView() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return value(QStringLiteral("PreferredView"), true).toBool();
|
2016-01-01 03:29:39 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetPreferredView(bool table)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
setValue(QStringLiteral("PreferredView"), table);
|
2016-01-01 03:29:39 -07:00
|
|
|
}
|
|
|
|
|
2015-12-20 16:36:39 -07:00
|
|
|
bool Settings::GetConfirmStop() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return value(QStringLiteral("Emulation/ConfirmStop"), true).toBool();
|
2015-12-20 16:36:39 -07:00
|
|
|
}
|
|
|
|
|
2016-02-14 18:56:40 -07:00
|
|
|
int Settings::GetStateSlot() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return value(QStringLiteral("Emulation/StateSlot"), 1).toInt();
|
2016-02-14 18:56:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::SetStateSlot(int slot)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
setValue(QStringLiteral("Emulation/StateSlot"), slot);
|
2016-02-14 18:56:40 -07:00
|
|
|
}
|
|
|
|
|
2015-12-20 16:36:39 -07:00
|
|
|
bool Settings::GetRenderToMain() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return value(QStringLiteral("Graphics/RenderToMain"), false).toBool();
|
2015-12-20 16:36:39 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::GetFullScreen() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return value(QStringLiteral("Graphics/FullScreen"), false).toBool();
|
2015-12-20 16:36:39 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
QSize Settings::GetRenderWindowSize() const
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return value(QStringLiteral("Graphics/RenderWindowSize"), QSize(640, 480)).toSize();
|
2015-12-20 16:36:39 -07:00
|
|
|
}
|