From b5697f0b943382333c9f3589e971ccd0d683dc17 Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Thu, 26 May 2011 13:19:38 +0300 Subject: [PATCH] Added: #1193 Added recursive search paths settings page. --- .../src/plugins/core/core_plugin.cpp | 4 ++- .../core/search_paths_settings_page.cpp | 31 ++++++++++++++----- .../plugins/core/search_paths_settings_page.h | 3 +- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp index 6cb58ba67..468c79700 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp @@ -61,12 +61,14 @@ bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QStr bool success = m_mainWindow->initialize(errorString); GeneralSettingsPage *generalSettings = new GeneralSettingsPage(this); - CSearchPathsSettingsPage *searchPathPage = new CSearchPathsSettingsPage(this); + CSearchPathsSettingsPage *searchPathPage = new CSearchPathsSettingsPage(false, this); + CSearchPathsSettingsPage *recureseSearchPathPage = new CSearchPathsSettingsPage(true, this); generalSettings->applyGeneralSettings(); searchPathPage->applySearchPaths(); addAutoReleasedObject(generalSettings); addAutoReleasedObject(searchPathPage); + addAutoReleasedObject(recureseSearchPathPage); return success; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp index 94ebec8d1..8238ef6ff 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp @@ -33,8 +33,9 @@ namespace Core QString lastDir = "."; -CSearchPathsSettingsPage::CSearchPathsSettingsPage(QObject *parent) +CSearchPathsSettingsPage::CSearchPathsSettingsPage(bool recurse, QObject *parent) : IOptionsPage(parent), + m_recurse(recurse), m_page(0) { } @@ -45,12 +46,18 @@ CSearchPathsSettingsPage::~CSearchPathsSettingsPage() QString CSearchPathsSettingsPage::id() const { - return QLatin1String("search_paths"); + if (m_recurse) + return QLatin1String("search_recurse_paths"); + else + return QLatin1String("search_paths"); } QString CSearchPathsSettingsPage::trName() const { - return tr("Search Paths"); + if (m_recurse) + return tr("Search Recurse Paths"); + else + return tr("Search Paths"); } QString CSearchPathsSettingsPage::category() const @@ -95,7 +102,11 @@ void CSearchPathsSettingsPage::applySearchPaths() QStringList paths, remapExt; QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(Core::Constants::DATA_PATH_SECTION); - paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList(); + if (m_recurse) + paths = settings->value(Core::Constants::RECURSIVE_SEARCH_PATHS).toStringList(); + else + paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList(); + remapExt = settings->value(Core::Constants::REMAP_EXTENSIONS).toStringList(); settings->endGroup(); @@ -104,7 +115,7 @@ void CSearchPathsSettingsPage::applySearchPaths() Q_FOREACH(QString path, paths) { - NLMISC::CPath::addSearchPath(path.toStdString(), false, false); + NLMISC::CPath::addSearchPath(path.toStdString(), m_recurse, false); } } @@ -159,7 +170,10 @@ void CSearchPathsSettingsPage::readSettings() QStringList paths; QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(Core::Constants::DATA_PATH_SECTION); - paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList(); + if (m_recurse) + paths = settings->value(Core::Constants::RECURSIVE_SEARCH_PATHS).toStringList(); + else + paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList(); settings->endGroup(); Q_FOREACH(QString path, paths) { @@ -178,7 +192,10 @@ void CSearchPathsSettingsPage::writeSettings() QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(Core::Constants::DATA_PATH_SECTION); - settings->setValue(Core::Constants::SEARCH_PATHS, paths); + if (m_recurse) + paths = settings->value(Core::Constants::RECURSIVE_SEARCH_PATHS).toStringList(); + else + paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList(); settings->endGroup(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h index 90eab513a..fc8e6003c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h @@ -37,7 +37,7 @@ class CSearchPathsSettingsPage : public Core::IOptionsPage Q_OBJECT public: - CSearchPathsSettingsPage(QObject *parent = 0); + explicit CSearchPathsSettingsPage(bool recurse, QObject *parent = 0); ~CSearchPathsSettingsPage(); QString id() const; @@ -63,6 +63,7 @@ private: void writeSettings(); void checkEnabledButton(); + bool m_recurse; QWidget *m_page; Ui::CSearchPathsSettingsPage m_ui; };