From 947d69c97e5406889f5b2c61e745d6956ef7c166 Mon Sep 17 00:00:00 2001 From: sfb Date: Wed, 1 Jun 2011 07:45:20 -0500 Subject: [PATCH] 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 --- .../src/plugins/core/core_constants.h | 2 + .../plugins/core/general_settings_page.cpp | 36 +++++++++++++++++ .../src/plugins/core/general_settings_page.h | 2 + .../src/plugins/core/general_settings_page.ui | 40 +++++++++++++++++-- 4 files changed, 77 insertions(+), 3 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h index 7f0b5cd15..745812c2a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h @@ -78,6 +78,8 @@ const char * const SEARCH_PATHS = "SearchPaths"; const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes"; const char * const LEVELDESIGN_PATH = "LevelDesignPath"; 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 LOG_SECTION = "LogSettings"; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp index 51da80f67..a050f4789 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp @@ -82,6 +82,15 @@ void GeneralSettingsPage::applyGeneralSettings() else QApplication::setPalette(m_originalPalette); 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) @@ -94,6 +103,8 @@ QWidget *GeneralSettingsPage::createPage(QWidget *parent) connect(m_ui.pluginsPathButton, SIGNAL(clicked()), this, SLOT(setPluginsPath())); connect(m_ui.leveldesignPathButton, SIGNAL(clicked()), this, SLOT(setLevelDesignPath())); 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; } @@ -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() { QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the assets path"), @@ -165,6 +197,8 @@ void GeneralSettingsPage::readSettings() settings->beginGroup(Core::Constants::DATA_PATH_SECTION); 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.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(); } @@ -185,6 +219,8 @@ void GeneralSettingsPage::writeSettings() settings->beginGroup(Core::Constants::DATA_PATH_SECTION); settings->setValue(Core::Constants::LEVELDESIGN_PATH, m_ui.leveldesignPathLineEdit->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->sync(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.h index 2fbcb842a..22ab30e45 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.h @@ -57,6 +57,8 @@ private Q_SLOTS: void setPluginsPath(); void setLevelDesignPath(); void setAssetsPath(); + void setPrimitivesPath(); + void setLigoConfigFile(); private: void readSettings(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.ui index d2aa042e3..7d40b65df 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.ui @@ -105,7 +105,7 @@ - Plugins path: + Plugins @@ -129,7 +129,7 @@ - Level design path: + Sheets @@ -153,7 +153,7 @@ - Assets path: + Assets Database: @@ -174,6 +174,40 @@ + + + + Primitives + + + + + + + + + + ... + + + + + + + + + + Ligo Config File + + + + + + + ... + + +