NOISSUE Register settings for setting a server

This commit is contained in:
Janrupf 2021-05-22 13:28:23 +02:00
parent 2e2a5d0943
commit f0eb5b4a0c
2 changed files with 23 additions and 0 deletions

View File

@ -111,6 +111,11 @@ MinecraftInstance::MinecraftInstance(SettingsObjectPtr globalSettings, SettingsO
m_settings->registerOverride(globalSettings->getSetting("ShowGameTime"), gameTimeOverride); m_settings->registerOverride(globalSettings->getSetting("ShowGameTime"), gameTimeOverride);
m_settings->registerOverride(globalSettings->getSetting("RecordGameTime"), gameTimeOverride); m_settings->registerOverride(globalSettings->getSetting("RecordGameTime"), gameTimeOverride);
// Join server on launch, this does not have a global override
m_settings->registerSetting("JoinServerOnLaunch", false);
m_settings->registerSetting("JoinServerOnLaunchAddress", "");
m_settings->registerSetting("JoinServerOnLaunchPort", 25565);
// DEPRECATED: Read what versions the user configuration thinks should be used // DEPRECATED: Read what versions the user configuration thinks should be used
m_settings->registerSetting({"IntendedVersion", "MinecraftVersion"}, ""); m_settings->registerSetting({"IntendedVersion", "MinecraftVersion"}, "");
m_settings->registerSetting("LWJGLVersion", ""); m_settings->registerSetting("LWJGLVersion", "");

View File

@ -191,6 +191,20 @@ void InstanceSettingsPage::applySettings()
m_settings->reset("ShowGameTime"); m_settings->reset("ShowGameTime");
m_settings->reset("RecordGameTime"); m_settings->reset("RecordGameTime");
} }
// Join server on launch
bool joinServerOnLaunch = ui->serverJoinGroupBox->isChecked();
m_settings->set("JoinServerOnLaunch", joinServerOnLaunch);
if (joinServerOnLaunch)
{
m_settings->set("JoinServerOnLaunchAddress", ui->serverJoinAddress->text());
m_settings->set("JoinServerOnLaunchPort", ui->serverJoinPort->value());
}
else
{
m_settings->reset("JoinServerOnLaunchAddress");
m_settings->reset("JoinServerOnLaunchPort");
}
} }
void InstanceSettingsPage::loadSettings() void InstanceSettingsPage::loadSettings()
@ -257,6 +271,10 @@ void InstanceSettingsPage::loadSettings()
ui->gameTimeGroupBox->setChecked(m_settings->get("OverrideGameTime").toBool()); ui->gameTimeGroupBox->setChecked(m_settings->get("OverrideGameTime").toBool());
ui->showGameTime->setChecked(m_settings->get("ShowGameTime").toBool()); ui->showGameTime->setChecked(m_settings->get("ShowGameTime").toBool());
ui->recordGameTime->setChecked(m_settings->get("RecordGameTime").toBool()); ui->recordGameTime->setChecked(m_settings->get("RecordGameTime").toBool());
ui->serverJoinGroupBox->setChecked(m_settings->get("JoinServerOnLaunch").toBool());
ui->serverJoinAddress->setText(m_settings->get("JoinServerOnLaunchAddress").toString());
ui->serverJoinPort->setValue(m_settings->get("JoinServerOnLaunchPort").toInt());
} }
void InstanceSettingsPage::on_javaDetectBtn_clicked() void InstanceSettingsPage::on_javaDetectBtn_clicked()