summaryrefslogtreecommitdiffstats
path: root/Tools/QtBiomeVisualiser/GeneratorSetup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/QtBiomeVisualiser/GeneratorSetup.cpp')
-rw-r--r--Tools/QtBiomeVisualiser/GeneratorSetup.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/Tools/QtBiomeVisualiser/GeneratorSetup.cpp b/Tools/QtBiomeVisualiser/GeneratorSetup.cpp
index f5412404c..8f97e1f37 100644
--- a/Tools/QtBiomeVisualiser/GeneratorSetup.cpp
+++ b/Tools/QtBiomeVisualiser/GeneratorSetup.cpp
@@ -3,7 +3,7 @@
#include <QLabel>
#include <QLineEdit>
#include "src/Generating/BioGen.h"
-#include "inifile/iniFile.h"
+#include "src/IniFile.h"
@@ -14,6 +14,8 @@ static const QString s_GeneratorNames[] =
QString("Checkerboard"),
QString("Constant"),
QString("DistortedVoronoi"),
+ QString("Grown"),
+ QString("GrownProt"),
QString("MultiStepMap"),
QString("TwoLevel"),
QString("Voronoi"),
@@ -31,6 +33,7 @@ GeneratorSetup::GeneratorSetup(const AString & a_IniFileName, QWidget * a_Parent
m_eSeed = new QLineEdit();
m_eSeed->setValidator(new QIntValidator());
m_eSeed->setText("0");
+ m_eSeed->setProperty("INI.SectionName", QVariant("Seed"));
m_eSeed->setProperty("INI.ItemName", QVariant("Seed"));
m_cbGenerator = new QComboBox();
m_cbGenerator->setMinimumWidth(120);
@@ -53,17 +56,12 @@ GeneratorSetup::GeneratorSetup(const AString & a_IniFileName, QWidget * a_Parent
setLayout(m_MainLayout);
// Load the INI file, if specified, otherwise set defaults:
- if (!a_IniFileName.empty() && m_IniFile->ReadFile(a_IniFileName))
- {
- m_cbGenerator->setCurrentText(QString::fromStdString(m_IniFile->GetValue("Generator", "BiomeGen")));
- m_eSeed->setText(QString::number(m_IniFile->GetValueI("Generator", "Seed")));
- }
- else
+ if (a_IniFileName.empty() || !m_IniFile->ReadFile(a_IniFileName))
{
m_IniFile->SetValue("Generator", "Generator", "Composable");
m_IniFile->SetValue("Generator", "BiomeGen", m_cbGenerator->currentText().toStdString());
bool dummy;
- delete cBiomeGen::CreateBiomeGen(*m_IniFile, 0, dummy);
+ cBiomeGen::CreateBiomeGen(*m_IniFile, 0, dummy);
}
updateFromIni();
@@ -95,7 +93,7 @@ void GeneratorSetup::generatorChanged(const QString & a_NewName)
// Create a dummy biome gen from the INI file, this will create the defaults in the INI file:
bool dummy;
- delete cBiomeGen::CreateBiomeGen(*m_IniFile, m_Seed, dummy);
+ cBiomeGen::CreateBiomeGen(*m_IniFile, m_Seed, dummy);
// Read all values from the INI file and put them into the form layout:
updateFromIni();
@@ -110,8 +108,9 @@ void GeneratorSetup::generatorChanged(const QString & a_NewName)
void GeneratorSetup::editChanged(const QString & a_NewValue)
{
- QString itemName = sender()->property("INI.ItemName").toString();
- m_IniFile->SetValue("Generator", itemName.toStdString(), a_NewValue.toStdString());
+ QString sectionName = sender()->property("INI.SectionName").toString();
+ QString itemName = sender()->property("INI.ItemName").toString();
+ m_IniFile->SetValue(sectionName.toStdString(), itemName.toStdString(), a_NewValue.toStdString());
emit generatorUpdated();
}
@@ -121,6 +120,7 @@ void GeneratorSetup::editChanged(const QString & a_NewValue)
void GeneratorSetup::updateFromIni()
{
+ m_eSeed->setText(QString::number(m_IniFile->GetValueI("Seed", "Seed", 0)));
int keyID = m_IniFile->FindKey("Generator");
if (keyID <= -1)
{
@@ -141,6 +141,7 @@ void GeneratorSetup::updateFromIni()
QLineEdit * edit = new QLineEdit();
edit->setText(QString::fromStdString(itemValue));
+ edit->setProperty("INI.SectionName", QVariant("Generator"));
edit->setProperty("INI.ItemName", QVariant(QString::fromStdString(itemName)));
// Remove the generator name prefix from the item name, for clarity purposes: