1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-05-31 12:11:31 +00:00

Merge branch 'navmeshdb_launcher_updates' into 'master'

Support max navmeshdb file size and removal of unused tile in the launcher UI

See merge request OpenMW/openmw!1749
This commit is contained in:
psi29a 2022-04-07 16:22:41 +00:00
commit 42b9024c82
4 changed files with 63 additions and 7 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());
@ -493,7 +503,11 @@ void Launcher::DataFilesPage::startNavMeshTool()
mNavMeshToolProgress = NavMeshToolProgress {};
if (!mNavMeshToolInvoker->startProcess(QLatin1String("openmw-navmeshtool"), QStringList({"--write-binary-log"})))
QStringList arguments({"--write-binary-log"});
if (ui.navMeshRemoveUnusedTilesCheckBox->checkState() == Qt::Checked)
arguments.append("--remove-unused-tiles");
if (!mNavMeshToolInvoker->startProcess(QLatin1String("openmw-navmeshtool"), arguments))
return;
ui.cancelNavMeshButton->setEnabled(true);

View file

@ -116,7 +116,7 @@ std::int64_t Manager::getInt64 (const std::string& setting, const std::string& c
{
const std::string& value = getString(setting, category);
std::stringstream stream(value);
std::size_t number = 0;
std::int64_t number = 0;
stream >> number;
return number;
}
@ -172,6 +172,13 @@ void Manager::setInt (const std::string& setting, const std::string& category, c
setString(setting, category, stream.str());
}
void Manager::setInt64 (const std::string& setting, const std::string& category, const std::int64_t value)
{
std::ostringstream stream;
stream << value;
setString(setting, category, stream.str());
}
void Manager::setFloat (const std::string &setting, const std::string &category, const float value)
{
std::ostringstream stream;

View file

@ -62,6 +62,7 @@ namespace Settings
static osg::Vec3f getVector3 (const std::string& setting, const std::string& category);
static void setInt (const std::string& setting, const std::string& category, int value);
static void setInt64 (const std::string& setting, const std::string& category, std::int64_t value);
static void setFloat (const std::string& setting, const std::string& category, float value);
static void setDouble (const std::string& setting, const std::string& category, double value);
static void setString (const std::string& setting, const std::string& category, const std::string& value);

View file

@ -74,6 +74,40 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="navMeshRemoveUnusedTilesCheckBox">
<property name="text">
<string>Remove unused tiles</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Max size</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="navMeshMaxSizeSpinBox">
<property name="suffix">
<string> MiB</string>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
<property name="value">
<number>2048</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPlainTextEdit" name="navMeshLogPlainTextEdit">
<property name="enabled">