mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-01 00:39:43 +00:00
Configure mav navmeshdb file size from the launcher
This commit is contained in:
parent
1baee5ddba
commit
7038c82690
4 changed files with 48 additions and 6 deletions
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -84,6 +84,30 @@
|
|||
</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">
|
||||
|
|
Loading…
Reference in a new issue