From 351047bb515b618956c4c75eec3853094c1d54ed Mon Sep 17 00:00:00 2001 From: dnk-88 Date: Sat, 21 May 2011 01:54:20 +0300 Subject: [PATCH] Fixed: #1193 Settings of "remap extensions" loads from settings file. --- .../object_viewer_qt/src/plugins/core/core_constants.h | 1 + .../src/plugins/core/search_paths_settings_page.cpp | 9 ++++++--- .../src/plugins/core/search_paths_settings_page.h | 1 + .../object_viewer_qt/src/plugins/example/qnel_widget.cpp | 2 +- .../src/plugins/object_viewer/graphics_viewport.cpp | 2 +- .../plugins/object_viewer/particle_workspace_dialog.cpp | 2 +- 6 files changed, 11 insertions(+), 6 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 a3b7c0d72..b902b6c0f 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,7 @@ 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 REMAP_EXTENSIONS = "RemapExtensions"; //resources const char * const ICON_NEL = ":/core/images/nel.png"; 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 6f0fcb47d..94ebec8d1 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 @@ -92,17 +92,20 @@ void CSearchPathsSettingsPage::finish() void CSearchPathsSettingsPage::applySearchPaths() { - QStringList paths; + QStringList paths, remapExt; QSettings *settings = Core::ICore::instance()->settings(); settings->beginGroup(Core::Constants::DATA_PATH_SECTION); paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList(); + remapExt = settings->value(Core::Constants::REMAP_EXTENSIONS).toStringList(); settings->endGroup(); + + for (int i = 1; i < remapExt.size(); i += 2) + NLMISC::CPath::remapExtension(remapExt.at(i - 1).toStdString(), remapExt.at(i).toStdString(), true); + Q_FOREACH(QString path, paths) { NLMISC::CPath::addSearchPath(path.toStdString(), false, false); } - NLMISC::CPath::remapExtension("png", "tga", true); - NLMISC::CPath::remapExtension("png", "dds", true); } void CSearchPathsSettingsPage::addPath() 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 15f28f6c8..90eab513a 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 @@ -49,6 +49,7 @@ public: void apply(); void finish(); + // Set of the search paths(not recursive) and the remap extensions (loading from settings file) void applySearchPaths(); private Q_SLOTS: diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp index 759e8f304..4872923db 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp @@ -38,7 +38,7 @@ QNLWidget::QNLWidget(QWidget *parent) m_initialized(false), m_interval(25) { - setAttribute(Qt::WA_OpaquePaintEvent); + setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_PaintOnScreen); setMouseTracking(true); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp index 7eaed0a1b..c5d1ae677 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp @@ -49,7 +49,7 @@ namespace NLQT CGraphicsViewport::CGraphicsViewport(QWidget *parent) : QNLWidget(parent) { - setAttribute(Qt::WA_OpaquePaintEvent); + setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_PaintOnScreen); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp index 4d6d35c9f..858922af1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_workspace_dialog.cpp @@ -226,7 +226,7 @@ void CParticleWorkspaceDialog::clickedItem(const QModelIndex & index) _treeModel->getOwnerNode(_currentItem)->getPSPointer()->setCurrentEditedElement(NULL); _currentItem = static_cast(index.internalPointer()); - + if (_currentItem == 0) return;