mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-12-27 21:15:19 +00:00
Also reload the instance cfg
While this should work, there don't seem to be any places where the signals are listened for, so changes probably will only be available when calling Setting::get TODO: Fix that ^
This commit is contained in:
parent
44f21406e9
commit
f1dc456802
@ -28,6 +28,11 @@ void INISettingsObject::setFilePath(const QString &filePath)
|
||||
m_filePath = filePath;
|
||||
}
|
||||
|
||||
bool INISettingsObject::reload()
|
||||
{
|
||||
return m_ini.loadFile(m_filePath) && SettingsObject::reload();
|
||||
}
|
||||
|
||||
void INISettingsObject::changeSetting(const Setting &setting, QVariant value)
|
||||
{
|
||||
if (contains(setting.id()))
|
||||
|
@ -47,6 +47,8 @@ public:
|
||||
*/
|
||||
virtual void setFilePath(const QString &filePath);
|
||||
|
||||
bool reload() override;
|
||||
|
||||
protected
|
||||
slots:
|
||||
virtual void changeSetting(const Setting &setting, QVariant value);
|
||||
|
@ -126,6 +126,15 @@ bool SettingsObject::contains(const QString &id)
|
||||
return m_settings.contains(id);
|
||||
}
|
||||
|
||||
bool SettingsObject::reload()
|
||||
{
|
||||
for (auto setting : m_settings.values())
|
||||
{
|
||||
setting->set(setting->get());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void SettingsObject::connectSignals(const Setting &setting)
|
||||
{
|
||||
connect(&setting, SIGNAL(settingChanged(const Setting &, QVariant)),
|
||||
|
@ -113,6 +113,12 @@ public:
|
||||
*/
|
||||
bool contains(const QString &id);
|
||||
|
||||
/*!
|
||||
* \brief Reloads the settings and emit signals for changed settings
|
||||
* \return True if reloading was successful
|
||||
*/
|
||||
virtual bool reload();
|
||||
|
||||
signals:
|
||||
/*!
|
||||
* \brief Signal emitted when one of this SettingsObject object's settings changes.
|
||||
|
@ -171,8 +171,7 @@ bool BaseInstance::canLaunch() const
|
||||
|
||||
bool BaseInstance::reload()
|
||||
{
|
||||
// TODO reload the instance settings
|
||||
return true;
|
||||
return settings().reload();
|
||||
}
|
||||
|
||||
QString BaseInstance::baseJar() const
|
||||
|
Loading…
Reference in New Issue
Block a user