mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-07 13:20:25 +00:00
Configure mav navmeshdb file size from the launcher
This commit is contained in:
parent
1baee5ddba
commit
7038c82690
@ -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()
|
bool Launcher::DataFilesPage::loadSettings()
|
||||||
{
|
{
|
||||||
|
ui.navMeshMaxSizeSpinBox->setValue(getMaxNavMeshDbFileSizeMiB());
|
||||||
|
|
||||||
QStringList profiles = mLauncherSettings.getContentLists();
|
QStringList profiles = mLauncherSettings.getContentLists();
|
||||||
QString currentProfile = mLauncherSettings.getCurrentContentListName();
|
QString currentProfile = mLauncherSettings.getCurrentContentListName();
|
||||||
|
|
||||||
@ -217,13 +224,16 @@ QStringList Launcher::DataFilesPage::filesInProfile(const QString& profileName,
|
|||||||
|
|
||||||
void Launcher::DataFilesPage::saveSettings(const QString &profile)
|
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())
|
QString profileName = profile;
|
||||||
profileName = ui.profilesComboBox->currentText();
|
|
||||||
|
|
||||||
//retrieve the files selected for the profile
|
if (profileName.isEmpty())
|
||||||
ContentSelectorModel::ContentFileList items = mSelector->selectedFiles();
|
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!)
|
//set the value of the current profile (not necessarily the profile being saved!)
|
||||||
mLauncherSettings.setCurrentContentListName(ui.profilesComboBox->currentText());
|
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);
|
const std::string& value = getString(setting, category);
|
||||||
std::stringstream stream(value);
|
std::stringstream stream(value);
|
||||||
std::size_t number = 0;
|
std::int64_t number = 0;
|
||||||
stream >> number;
|
stream >> number;
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
@ -172,6 +172,13 @@ void Manager::setInt (const std::string& setting, const std::string& category, c
|
|||||||
setString(setting, category, stream.str());
|
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)
|
void Manager::setFloat (const std::string &setting, const std::string &category, const float value)
|
||||||
{
|
{
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
|
@ -62,6 +62,7 @@ namespace Settings
|
|||||||
static osg::Vec3f getVector3 (const std::string& setting, const std::string& category);
|
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 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 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 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);
|
static void setString (const std::string& setting, const std::string& category, const std::string& value);
|
||||||
|
@ -84,6 +84,30 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<widget class="QPlainTextEdit" name="navMeshLogPlainTextEdit">
|
<widget class="QPlainTextEdit" name="navMeshLogPlainTextEdit">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user