Configure mav navmeshdb file size from the launcher

This commit is contained in:
elsid 2022-04-07 16:35:18 +02:00
parent 1baee5ddba
commit 7038c82690
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40
4 changed files with 48 additions and 6 deletions

View file

@ -84,6 +84,11 @@ namespace Launcher
};
}
};
int getMaxNavMeshDbFileSizeMiB()
{
return static_cast<int>(Settings::Manager::getInt64("max navmeshdb file size", "Navigator") / (1024 * 1024));
}
}
}
@ -164,6 +169,8 @@ void Launcher::DataFilesPage::buildView()
bool Launcher::DataFilesPage::loadSettings()
{
ui.navMeshMaxSizeSpinBox->setValue(getMaxNavMeshDbFileSizeMiB());
QStringList profiles = mLauncherSettings.getContentLists();
QString currentProfile = mLauncherSettings.getCurrentContentListName();
@ -217,13 +224,16 @@ QStringList Launcher::DataFilesPage::filesInProfile(const QString& profileName,
void Launcher::DataFilesPage::saveSettings(const QString &profile)
{
QString profileName = profile;
if (const int value = ui.navMeshMaxSizeSpinBox->value(); value != getMaxNavMeshDbFileSizeMiB())
Settings::Manager::setInt64("max navmeshdb file size", "Navigator", static_cast<std::int64_t>(value) * 1024 * 1024);
if (profileName.isEmpty())
profileName = ui.profilesComboBox->currentText();
QString profileName = profile;
//retrieve the files selected for the profile
ContentSelectorModel::ContentFileList items = mSelector->selectedFiles();
if (profileName.isEmpty())
profileName = ui.profilesComboBox->currentText();
//retrieve the files selected for the profile
ContentSelectorModel::ContentFileList items = mSelector->selectedFiles();
//set the value of the current profile (not necessarily the profile being saved!)
mLauncherSettings.setCurrentContentListName(ui.profilesComboBox->currentText());