Changed: Added the primitive file path and ligo config file to the "data section" - automatically applied these paths to addSearchPath.

--HG--
branch : branch-mission-compiler-qt
This commit is contained in:
sfb 2011-06-01 07:45:20 -05:00
parent 5be81c6487
commit 947d69c97e
4 changed files with 77 additions and 3 deletions

View file

@ -78,6 +78,8 @@ const char * const SEARCH_PATHS = "SearchPaths";
const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes"; const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes";
const char * const LEVELDESIGN_PATH = "LevelDesignPath"; const char * const LEVELDESIGN_PATH = "LevelDesignPath";
const char * const ASSETS_PATH = "AssetsPath"; const char * const ASSETS_PATH = "AssetsPath";
const char * const PRIMITIVES_PATH = "PrimitivesPath";
const char * const LIGOCONFIG_FILE = "LigoConfigFile";
const char * const REMAP_EXTENSIONS = "RemapExtensions"; const char * const REMAP_EXTENSIONS = "RemapExtensions";
const char * const LOG_SECTION = "LogSettings"; const char * const LOG_SECTION = "LogSettings";

View file

@ -82,6 +82,15 @@ void GeneralSettingsPage::applyGeneralSettings()
else else
QApplication::setPalette(m_originalPalette); QApplication::setPalette(m_originalPalette);
settings->endGroup(); settings->endGroup();
// Add primitives path and ligo config file to CPath
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
QString primitivePath = settings->value(Core::Constants::PRIMITIVES_PATH, "l:/primitives").toString();
QString ligoConfigFile = settings->value(Core::Constants::LIGOCONFIG_FILE, "l:/leveldesign/world_editor_files/world_editor_classes.xml").toString();
NLMISC::CPath::addSearchPath(primitivePath.toStdString(), true, false);
NLMISC::CPath::display();
NLMISC::CPath::addSearchFile(ligoConfigFile.toStdString());
settings->endGroup();
} }
QWidget *GeneralSettingsPage::createPage(QWidget *parent) QWidget *GeneralSettingsPage::createPage(QWidget *parent)
@ -94,6 +103,8 @@ QWidget *GeneralSettingsPage::createPage(QWidget *parent)
connect(m_ui.pluginsPathButton, SIGNAL(clicked()), this, SLOT(setPluginsPath())); connect(m_ui.pluginsPathButton, SIGNAL(clicked()), this, SLOT(setPluginsPath()));
connect(m_ui.leveldesignPathButton, SIGNAL(clicked()), this, SLOT(setLevelDesignPath())); connect(m_ui.leveldesignPathButton, SIGNAL(clicked()), this, SLOT(setLevelDesignPath()));
connect(m_ui.assetsPathButton, SIGNAL(clicked()), this, SLOT(setAssetsPath())); connect(m_ui.assetsPathButton, SIGNAL(clicked()), this, SLOT(setAssetsPath()));
connect(m_ui.primitivesPathButton, SIGNAL(clicked()), this, SLOT(setPrimitivesPath()));
connect(m_ui.ligoConfigFileButton, SIGNAL(clicked()), this, SLOT(setLigoConfigFile()));
return m_page; return m_page;
} }
@ -135,6 +146,27 @@ void GeneralSettingsPage::setLevelDesignPath()
} }
} }
void GeneralSettingsPage::setPrimitivesPath()
{
QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the primitives path"),
m_ui.primitivesPathLineEdit->text());
if (!newPath.isEmpty())
{
m_ui.primitivesPathLineEdit->setText(newPath);
}
}
void GeneralSettingsPage::setLigoConfigFile()
{
QString newFile = QFileDialog::getOpenFileName(0, tr("Set the ligo config file"),
m_ui.ligoConfigFileLineEdit->text());
if (!newFile.isEmpty())
{
m_ui.ligoConfigFileLineEdit->setText(newFile);
}
}
void GeneralSettingsPage::setAssetsPath() void GeneralSettingsPage::setAssetsPath()
{ {
QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the assets path"), QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the assets path"),
@ -165,6 +197,8 @@ void GeneralSettingsPage::readSettings()
settings->beginGroup(Core::Constants::DATA_PATH_SECTION); settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
m_ui.leveldesignPathLineEdit->setText(settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString()); m_ui.leveldesignPathLineEdit->setText(settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString());
m_ui.assetsPathLineEdit->setText(settings->value(Core::Constants::ASSETS_PATH, "w:/database").toString()); m_ui.assetsPathLineEdit->setText(settings->value(Core::Constants::ASSETS_PATH, "w:/database").toString());
m_ui.primitivesPathLineEdit->setText(settings->value(Core::Constants::PRIMITIVES_PATH, "l:/primitives").toString());
m_ui.ligoConfigFileLineEdit->setText(settings->value(Core::Constants::LIGOCONFIG_FILE, "l:/leveldesign/world_editor_files/world_editor_classes.xml").toString());
settings->endGroup(); settings->endGroup();
} }
@ -185,6 +219,8 @@ void GeneralSettingsPage::writeSettings()
settings->beginGroup(Core::Constants::DATA_PATH_SECTION); settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
settings->setValue(Core::Constants::LEVELDESIGN_PATH, m_ui.leveldesignPathLineEdit->text()); settings->setValue(Core::Constants::LEVELDESIGN_PATH, m_ui.leveldesignPathLineEdit->text());
settings->setValue(Core::Constants::ASSETS_PATH, m_ui.assetsPathLineEdit->text()); settings->setValue(Core::Constants::ASSETS_PATH, m_ui.assetsPathLineEdit->text());
settings->setValue(Core::Constants::PRIMITIVES_PATH, m_ui.primitivesPathLineEdit->text());
settings->setValue(Core::Constants::LIGOCONFIG_FILE, m_ui.ligoConfigFileLineEdit->text());
settings->endGroup(); settings->endGroup();
settings->sync(); settings->sync();
} }

View file

@ -57,6 +57,8 @@ private Q_SLOTS:
void setPluginsPath(); void setPluginsPath();
void setLevelDesignPath(); void setLevelDesignPath();
void setAssetsPath(); void setAssetsPath();
void setPrimitivesPath();
void setLigoConfigFile();
private: private:
void readSettings(); void readSettings();

View file

@ -105,7 +105,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="pluginsPathLabel"> <widget class="QLabel" name="pluginsPathLabel">
<property name="text"> <property name="text">
<string>Plugins path:</string> <string>Plugins</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -129,7 +129,7 @@
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="leveldesignPathLabel"> <widget class="QLabel" name="leveldesignPathLabel">
<property name="text"> <property name="text">
<string>Level design path:</string> <string>Sheets</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -153,7 +153,7 @@
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="assetsPathLabel"> <widget class="QLabel" name="assetsPathLabel">
<property name="text"> <property name="text">
<string>Assets path:</string> <string>Assets Database:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -174,6 +174,40 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0">
<widget class="QLabel" name="primitivesPathLabel">
<property name="text">
<string>Primitives</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="primitivesPathLineEdit"/>
</item>
<item row="3" column="2">
<widget class="QToolButton" name="primitivesPathButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="ligoConfigFileLineEdit"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="ligoConfigFileLabel">
<property name="text">
<string>Ligo Config File</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QToolButton" name="ligoConfigFileButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>