diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt
index 426d3aa61..467b00876 100644
--- a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt
@@ -7,6 +7,7 @@ ADD_SUBDIRECTORY(disp_sheet_id)
ADD_SUBDIRECTORY(object_viewer)
ADD_SUBDIRECTORY(georges_editor)
ADD_SUBDIRECTORY(translation_manager)
+ADD_SUBDIRECTORY(bnp_manager)
# Note: Temporarily disabled until development continues.
#ADD_SUBDIRECTORY(zone_painter)
# Ryzom Specific Plugins
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/CMakeLists.txt
new file mode 100644
index 000000000..e06c82c94
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/CMakeLists.txt
@@ -0,0 +1,46 @@
+INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${LIBXML2_INCLUDE_DIR}
+ ${QT_INCLUDES})
+
+FILE(GLOB SRC *.cpp *.h)
+SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
+
+SET(OVQT_PLUG_BNP_MANAGER_HDR bnp_manager_plugin.h
+ bnp_manager_window.h
+ bnp_dirtree_dialog.h
+ bnp_filesystem_model.h
+ bnp_file.h
+ bnp_filelist_dialog.h
+ )
+SET(OVQT_PLUG_BNP_MANAGER_UIS bnp_dirtree_form.ui
+ bnp_filelist_dialog.ui
+ )
+
+SET(OVQT_PLUGIN_BNP_MANAGER_RCS bnp_manager.qrc)
+
+SET(QT_USE_QTGUI TRUE)
+
+QT4_ADD_RESOURCES(OVQT_PLUGIN_BNP_MANAGER_RC_SRCS ${OVQT_PLUGIN_BNP_MANAGER_RCS})
+QT4_WRAP_CPP(OVQT_PLUG_BNP_MANAGER_MOC_SRC ${OVQT_PLUG_BNP_MANAGER_HDR})
+QT4_WRAP_UI(OVQT_PLUG_BNP_MANAGER_UI_HDRS ${OVQT_PLUG_BNP_MANAGER_UIS})
+
+SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_BNP_MANAGER_UIS} ${OVQT_PLUGIN_BNP_MANAGER_RCS})
+SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_BNP_MANAGER_UI_HDRS})
+SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_BNP_MANAGER_MOC_SRC})
+SOURCE_GROUP("BNP Manager Plugin" FILES ${SRC})
+SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
+
+ADD_LIBRARY(ovqt_plugin_bnp_manager MODULE ${SRC} ${OVQT_PLUG_BNP_MANAGER_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUGIN_BNP_MANAGER_RC_SRCS} ${OVQT_PLUG_BNP_MANAGER_UI_HDRS})
+
+TARGET_LINK_LIBRARIES(ovqt_plugin_bnp_manager ovqt_plugin_core nelmisc nelgeorges ${QT_LIBRARIES})
+
+NL_DEFAULT_PROPS(ovqt_plugin_bnp_manager "NeL, Tools, 3D: Object Viewer Qt Plugin: BNP Manager")
+NL_ADD_RUNTIME_FLAGS(ovqt_plugin_bnp_manager)
+NL_ADD_LIB_SUFFIX(ovqt_plugin_bnp_manager)
+
+ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
+
+INSTALL(TARGETS ovqt_plugin_bnp_manager LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_dialog.cpp
new file mode 100644
index 000000000..9487f66ae
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_dialog.cpp
@@ -0,0 +1,87 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+// Project includes
+#include "bnp_dirtree_dialog.h"
+#include "bnp_filesystem_model.h"
+
+// Qt includes
+#include
+
+// NeL includes
+#include
+
+namespace BNPManager
+{
+
+CBnpDirTreeDialog::CBnpDirTreeDialog(QString bnpPath, QWidget *parent)
+ : QDockWidget(parent),
+ m_DataPath(bnpPath)
+{
+ // Setup the dialog
+ m_ui.setupUi(this);
+
+ // Filter settings to only display files with bnp extension.
+ // Could be changed to display all files and react according to the extension:
+ // Bnp file: opened and displayed
+ // all other files: added to the currently opened bnp file
+ QStringList filter;
+ filter << tr("*.bnp");
+
+ // Setup the directory tree model
+ m_dirModel= new BNPFileSystemModel;
+ m_dirModel->setRootPath(m_DataPath);
+ m_dirModel->setFilter(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::AllEntries);
+ m_dirModel->setNameFilters(filter);
+ m_dirModel->setNameFilterDisables(0);
+
+ m_ui.dirTree->setModel(m_dirModel);
+
+ m_ui.dirTree->setRootIndex(m_dirModel->index(m_DataPath));
+
+ // Trigger if one filename is activated
+ // In future drag&drop should be also possible
+ connect(m_ui.dirTree, SIGNAL(activated(QModelIndex)),
+ this, SLOT(fileSelected(QModelIndex)));
+}
+// ***************************************************************************
+CBnpDirTreeDialog::~CBnpDirTreeDialog()
+{
+
+}
+// ***************************************************************************
+void CBnpDirTreeDialog::fileSelected(QModelIndex index)
+{
+ if (index.isValid() && !m_dirModel->isDir(index))
+ {
+ // emit the according signal to BNPManagerWindow class
+ Q_EMIT selectedForm(m_dirModel->fileInfo(index).filePath());
+ }
+}
+// ***************************************************************************
+void CBnpDirTreeDialog::changeFile(QString file)
+{
+
+}
+// ***************************************************************************
+void CBnpDirTreeDialog::BnpPathChanged(QString path)
+{
+
+}
+// ***************************************************************************
+}
+
+
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_dialog.h
new file mode 100644
index 000000000..33b221a4d
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_dialog.h
@@ -0,0 +1,80 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#ifndef BNP_DIRTREE_DIALOG_H
+#define BNP_DIRTREE_DIALOG_H
+
+// Qt includes
+#include
+
+// STL includes
+
+// NeL includes
+
+// Project includes
+#include "ui_bnp_dirtree_form.h"
+
+namespace BNPManager
+{
+
+class BNPFileSystemModel;
+
+class CBnpDirTreeDialog : public QDockWidget
+{
+ Q_OBJECT
+public:
+
+ /**
+ * Constructor
+ * \param path to root directory, which should be displayed
+ */
+ CBnpDirTreeDialog(QString bnpPath, QWidget *parent = 0);
+
+ /**
+ * Destructor
+ */
+ ~CBnpDirTreeDialog();
+
+ /**
+ * Change the root path for the dir tree view
+ * \param data path to the new directory
+ */
+ void BnpPathChanged(QString);
+
+private:
+
+ Ui::CBnpDirTreeDialog m_ui;
+
+ // path ro data root directory
+ QString m_DataPath;
+
+ BNPFileSystemModel *m_dirModel;
+
+Q_SIGNALS:
+ void selectedForm(const QString);
+
+private Q_SLOTS:
+ /**
+ * Triggered if the user activates (double klick on windows)
+ * a file name in the dir tree view
+ * \param selected ModelIndex (filename)
+ */
+ void fileSelected(QModelIndex index);
+
+ void changeFile(QString file);
+};
+}
+#endif
\ No newline at end of file
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_form.ui
new file mode 100644
index 000000000..751c4f055
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_form.ui
@@ -0,0 +1,58 @@
+
+
+ CBnpDirTreeDialog
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 200
+ 141
+
+
+
+ QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable
+
+
+ BNP Datapath
+
+
+
+
+ 50
+ 0
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.cpp
new file mode 100644
index 000000000..d9b2f45c1
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.cpp
@@ -0,0 +1,313 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+// Project includes
+#include "bnp_file.h"
+
+// Nel includes
+#include
+#include
+#include
+#include
+#include
+
+// Qt includes
+
+using namespace NLMISC;
+using namespace std;
+
+
+namespace BNPManager
+{
+
+PackedFile::PackedFile()
+{
+ m_size = 0;
+ m_pos = 0;
+}
+
+NLMISC_SAFE_SINGLETON_IMPL(BNPFileHandle);
+
+BNPFileHandle::BNPFileHandle()
+{
+ m_offsetFromBeginning = 0;
+}
+// ***************************************************************************
+BNPFileHandle::~BNPFileHandle()
+{
+ // Erase the list
+ m_packedFiles.clear();
+}
+// ***************************************************************************
+void BNPFileHandle::releaseInstance()
+{
+ if (_Instance)
+ {
+ NLMISC::INelContext::getInstance().releaseSingletonPointer("BNPFileHandle", _Instance);
+ delete _Instance;
+ _Instance = NULL;
+ }
+}
+// ***************************************************************************
+bool BNPFileHandle::unpack(const string &dirName, const vector& fileList)
+{
+ CIFile bnp;
+ bnp.open(m_openedBNPFile);
+
+ TPackedFilesList::iterator it_files = m_packedFiles.begin();
+
+ for (it_files; it_files != m_packedFiles.end(); it_files++)
+ {
+ // Check if the file should be unpacked or not
+ if (find(fileList.begin(), fileList.end(), it_files->m_name) != fileList.end())
+ {
+ string filename = dirName + "/" + it_files->m_name;
+
+ COFile out;
+ if ( out.open(filename) )
+ {
+ bnp.seek(it_files->m_pos, IStream::begin);
+ uint8 *ptr = new uint8[it_files->m_size];
+ bnp.serialBuffer(ptr,it_files->m_size);
+ out.serialBuffer(ptr,it_files->m_size);
+ delete [] ptr;
+ }
+ out.close();
+ }
+ }
+
+ bnp.close();
+ return true;
+}
+// ***************************************************************************
+// Read the header from a big file
+bool BNPFileHandle::readHeader(const std::string &filePath)
+{
+ m_packedFiles.clear();
+
+ m_openedBNPFile = filePath;
+
+ CIFile bnp;
+ bnp.open (filePath);
+
+ bnp.seek(0, IStream::end);
+ uint32 nFileSize = bnp.getFileSize();
+ bnp.seek(nFileSize-sizeof(uint32), IStream::begin);
+
+ uint32 nOffsetFromBegining;
+
+ bnp.serial(nOffsetFromBegining);
+
+ if ( !bnp.seek (nOffsetFromBegining, IStream::begin) )
+ {
+ nlwarning("Could not read offset from begining");
+ bnp.close();
+ return false;
+ }
+
+ uint32 nNbFile;
+ bnp.serial(nNbFile);
+
+ for (uint32 i = 0; i < nNbFile; ++i)
+ {
+ uint8 nStringSize;
+ char sName[256];
+
+ bnp.serial(nStringSize);
+ bnp.serialBuffer( (uint8*)sName, nStringSize);
+ sName[nStringSize] = 0;
+
+ PackedFile tmpPackedFile;
+ tmpPackedFile.m_name = sName;
+ tmpPackedFile.m_path = m_openedBNPFile;
+
+ bnp.serial(tmpPackedFile.m_size);
+ bnp.serial(tmpPackedFile.m_pos);
+
+ m_packedFiles.push_back (tmpPackedFile);
+ }
+
+ bnp.close();
+ return true;
+}
+// ***************************************************************************
+void BNPFileHandle::list(TPackedFilesList& FileList)
+{
+ PackedFile tmpFile;
+ TPackedFilesList::iterator it = m_packedFiles.begin();
+ while (it != m_packedFiles.end() )
+ {
+ tmpFile.m_name = it->m_name;
+ tmpFile.m_pos = it->m_pos;
+ tmpFile.m_size = it->m_size;
+ tmpFile.m_path = it->m_path;
+ FileList.push_back(tmpFile);
+ it++;
+ }
+}
+// ***************************************************************************
+bool BNPFileHandle::writeHeader( const std::string &filePath, uint32 offset )
+{
+ COFile bnp;
+ bnp.open(filePath, true);
+ if ( !bnp.isOpen() )
+ return false;
+
+ uint32 nNbFile = (uint32)m_packedFiles.size();
+ bnp.serial(nNbFile);
+
+ for (uint32 i = 0; i < nNbFile; ++i)
+ {
+ uint8 nStringSize = (uint8)m_packedFiles[i].m_name.size();
+ bnp.serial( nStringSize );
+ bnp.serialBuffer( (uint8*)m_packedFiles[i].m_name.c_str(), nStringSize );
+ bnp.serial(m_packedFiles[i].m_size);
+ bnp.serial(m_packedFiles[i].m_pos);
+ }
+
+ bnp.serial(offset);
+
+ bnp.close();
+
+ return true;
+}
+// ***************************************************************************
+void BNPFileHandle::fileNames(std::vector &fileNames)
+{
+ TPackedFilesList::iterator it = m_packedFiles.begin();
+ while (it != m_packedFiles.end() )
+ {
+ fileNames.push_back(it->m_name);
+ it++;
+ }
+}
+// ***************************************************************************
+void BNPFileHandle::addFiles( const vector &filePathes)
+{
+ uint32 OffsetFromBegining = 0;
+
+ // create packed files and add them to the private vector
+ vector::const_iterator it_vec = filePathes.begin();
+ while (it_vec != filePathes.end() )
+ {
+ PackedFile tmpFile;
+ tmpFile.m_name = CFile::getFilename (*it_vec);
+ // Leave position to 0 and set the value during the new bnp file is creating
+ // We need the position only for the header at the end
+ tmpFile.m_pos = 0;
+ tmpFile.m_size = CFile::getFileSize(*it_vec);
+ tmpFile.m_path = *it_vec;
+ m_packedFiles.push_back( tmpFile );
+
+ it_vec++;
+ }
+
+ // sort packed files alphabetic
+ std::sort ( m_packedFiles.begin(), m_packedFiles.end(), compare );
+
+ // create a new temporary bnp file with extension *.tmp
+ TPackedFilesList::iterator it_packed = m_packedFiles.begin();
+ while (it_packed != m_packedFiles.end() )
+ {
+ append(m_openedBNPFile + ".tmp", *it_packed);
+ // Set now the new offset for the new header
+ it_packed->m_pos = OffsetFromBegining;
+ OffsetFromBegining += it_packed->m_size;
+
+ it_packed++;
+ }
+
+ writeHeader(m_openedBNPFile + ".tmp", OffsetFromBegining);
+
+ CFile::deleteFile( m_openedBNPFile );
+ string src = m_openedBNPFile + ".tmp";
+ CFile::moveFile( m_openedBNPFile.c_str(), src.c_str() );
+}
+// ***************************************************************************
+void BNPFileHandle::deleteFiles( const vector& fileNames)
+{
+ vector::const_iterator it_vec;
+ TPackedFilesList::iterator it_packed;
+ uint32 OffsetFromBegining = 0;
+ string tmpFile = m_openedBNPFile + ".tmp";
+
+ // create a new temporary bnp file with extension *.tmp
+ it_packed = m_packedFiles.begin();
+ while (it_packed != m_packedFiles.end() )
+ {
+ // check each packed file if it should be deleted
+ it_vec = find (fileNames.begin(), fileNames.end(), it_packed->m_name );
+ if ( it_vec != fileNames.end() )
+ {
+ nlinfo("Deleting file %s.", it_packed->m_name.c_str() );
+ it_packed = m_packedFiles.erase(it_packed);
+ }
+ else
+ {
+ append(tmpFile, *it_packed);
+ // Set now the new offset for the new header
+ it_packed->m_pos = OffsetFromBegining;
+ OffsetFromBegining += it_packed->m_size;
+
+ it_packed++;
+ }
+ }
+
+ writeHeader(tmpFile, OffsetFromBegining);
+
+ CFile::deleteFile( m_openedBNPFile );
+ string src = m_openedBNPFile + ".tmp";
+ CFile::moveFile( m_openedBNPFile.c_str(), src.c_str() );
+}
+// ***************************************************************************
+void BNPFileHandle::append(const string &destination, const PackedFile &source)
+{
+ // check if the file exists and create one if not
+ if ( !CFile::fileExists(destination) )
+ CFile::createEmptyFile( destination );
+
+ COFile bnpfile;
+ CIFile packedfile;
+ bnpfile.open(destination, true);
+ packedfile.open(source.m_path);
+ if ( !bnpfile.isOpen() ) return;
+
+
+ uint8 *ptr = new uint8[source.m_size];
+
+ // check if the source is a bnp file.
+ if ( nlstricmp( CFile::getExtension(source.m_path), "bnp" ) == 0 )
+ {
+ // Jump to the file position inside the bnp
+ packedfile.seek(source.m_pos, IStream::begin);
+ }
+ // Read the source
+ packedfile.serialBuffer(ptr, source.m_size);
+
+ // Append the data to the destination
+ bnpfile.serialBuffer(ptr, source.m_size);
+
+ delete [] ptr;
+
+ packedfile.close();
+ bnpfile.close();
+}
+// ***************************************************************************
+bool BNPFileHandle::compare(const PackedFile &left, const PackedFile &right)
+{
+ return nlstricmp (left.m_name.c_str(), right.m_name.c_str()) < 0;
+}
+} // namespace BNPManager
\ No newline at end of file
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.h
new file mode 100644
index 000000000..e03d0e664
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.h
@@ -0,0 +1,139 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#ifndef BNP_FILE_H
+#define BNP_FILE_H
+
+// Project includes
+
+// Nel includes
+#include "nel/misc/types_nl.h"
+#include
+
+// Qt includes
+#include
+
+
+namespace BNPManager
+{
+
+struct PackedFile
+{
+ PackedFile();
+ std::string m_name;
+ uint32 m_size;
+ uint32 m_pos;
+ std::string m_path;
+};
+
+typedef std::vector TPackedFilesList;
+
+class BNPFileHandle
+{
+ NLMISC_SAFE_SINGLETON_DECL(BNPFileHandle)
+
+ /**
+ * Private constructor
+ */
+ BNPFileHandle();
+
+ /**
+ * Private destructor
+ */
+ ~BNPFileHandle();
+
+public:
+ // release memory
+ static void releaseInstance();
+
+ /*void append (const QString destFilename, const QString origFilename, uint32 sizeToRead);
+ void packRecurse();*/
+
+ /**
+ * Read the header from the bnp file and create a filelist
+ * \param filename (consisting the whole path)
+ */
+ bool readHeader (const std::string &filePath);
+
+ bool writeHeader (const std::string &filePath, uint32 offset);
+
+ /**
+ * Append the header to a created bnp file
+ * \param filename (consisting the whole path)
+ */
+ void appendHeader (const std::string &filename) {};
+
+ /**
+ * Create a vector of all packed files inside the bnp file
+ * \param reference to the vector, which has to be filled
+ */
+ void list (TPackedFilesList& FileList);
+
+ /**
+ * Create a vector of all file names inside the bnp file
+ * \param reference to the vector, which has to be filled
+ */
+ void fileNames( std::vector& fileNames );
+
+ /**
+ * Add files to the current aktive bnp file
+ * \param vector of file pathes to add
+ */
+ void addFiles( const std::vector& filePathes );
+
+ /**
+ * Delete files from the current aktive bnp file
+ * \param vector of files names
+ */
+ void deleteFiles (const std::vector& fileNames);
+
+ /**
+ * Unpack the selected packed files into user defined dir
+ * \param directory path, where the files should be unpacked
+ * \param list of files, which has to be unpacked
+ */
+ bool unpack (const std::string &dirName, const std::vector& fileList);
+
+ /**
+ * Compares two filenames
+ * \param left: left packed file
+ * \param right: right packed file
+ * \return: TODO
+ */
+ static bool compare(const PackedFile &left, const PackedFile &right);
+
+private:
+
+ /**
+ * Append one file to an existing bnp file
+ * \param destination: the active bnp file to append the file
+ * \param source: the source file to pack
+ */
+ void append( const std::string& destination, const PackedFile& source );
+
+ TPackedFilesList m_packedFiles;
+
+ // currently opened and displayed bnp file
+ std::string m_openedBNPFile;
+
+ // offset where the header of the bnp file begins
+ uint32 m_offsetFromBeginning;
+
+};
+
+}
+
+#endif
\ No newline at end of file
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.cpp
new file mode 100644
index 000000000..b78e6c0bf
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.cpp
@@ -0,0 +1,122 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+// Project includes
+#include "bnp_filelist_dialog.h"
+#include "bnp_file.h"
+
+// Qt includes
+#include
+
+// NeL includes
+#include
+
+using namespace std;
+
+namespace BNPManager
+{
+
+BnpFileListDialog::BnpFileListDialog(QString bnpPath, QWidget *parent)
+ : QDockWidget(parent),
+ m_DataPath(bnpPath)
+{
+ m_ui.setupUi(this);
+}
+// ***************************************************************************
+BnpFileListDialog::~BnpFileListDialog()
+{
+
+}
+// ***************************************************************************
+void BnpFileListDialog::setupTable(int nbrows)
+{
+ // delete all old entries
+ m_ui.tableWidget->clear();
+
+ // set 2 colums: filename and size
+ m_ui.tableWidget->setColumnCount(2);
+
+ // set number of rows according to the number of files in the bnp file
+ m_ui.tableWidget->setRowCount(nbrows);
+
+ // only entire rows can be selected
+ m_ui.tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
+
+ // set the horizontal headers
+ QStringList labels;
+ labels << tr("Filename") << tr("Size");
+ m_ui.tableWidget->setHorizontalHeaderLabels(labels);
+
+ m_ui.tableWidget->horizontalHeader()->setResizeMode(0, QHeaderView::Interactive);
+ m_ui.tableWidget->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch );
+ m_ui.tableWidget->verticalHeader()->hide();
+
+ // set vertical size a little bit smaller
+ m_ui.tableWidget->verticalHeader()->setDefaultSectionSize(15);
+ m_ui.tableWidget->setShowGrid(false);
+ m_ui.tableWidget->setObjectName("tablewidget");
+}
+// ***************************************************************************
+bool BnpFileListDialog::loadTable(const QString fileName)
+{
+ // reference to the BNPFileHandle singletone instance
+ BNPFileHandle& myBNPFileHandle = BNPFileHandle::getInstance();
+ // string vector of all packed files inside a bnp
+ TPackedFilesList filelist;
+ int row = 0;
+
+ // read the header from the bnp file
+ if (!myBNPFileHandle.readHeader( fileName.toStdString()) )
+ {
+ return false;
+ }
+ myBNPFileHandle.list( filelist );
+
+ // create table with number of rows
+ setupTable(filelist.size());
+
+ // fill the table items
+ TPackedFilesList::iterator it = filelist.begin();
+ while (it != filelist.end() )
+ {
+ QTableWidgetItem *nameItem = new QTableWidgetItem (it->m_name.c_str() );
+ QTableWidgetItem *sizeItem = new QTableWidgetItem (tr("%1 KB").arg(it->m_size));
+ m_ui.tableWidget->setItem(row, 0, nameItem);
+ m_ui.tableWidget->setItem(row, 1, sizeItem);
+ it++;
+ row++;
+ }
+
+ return true;
+}
+// ***************************************************************************
+void BnpFileListDialog::getSelections(TSelectionList& SelectionList)
+{
+ QModelIndex index;
+ QAbstractItemModel *model = m_ui.tableWidget->model();
+ QItemSelectionModel *selection = m_ui.tableWidget->selectionModel();
+ QModelIndexList indexes = selection->selectedRows();
+
+ Q_FOREACH(index, indexes)
+ {
+ QVariant data = model->data(index);
+ QString filename = data.toString();
+ SelectionList.push_back( filename.toStdString() );
+ }
+}
+// ***************************************************************************
+
+} // namespace BNPManager
\ No newline at end of file
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.h
new file mode 100644
index 000000000..f2cc021a9
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.h
@@ -0,0 +1,81 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#ifndef BNP_FILELIST_DIALOG_H
+#define BNP_FILELIST_DIALOG_H
+
+// Qt includes
+#include
+
+// STL includes
+#include
+#include
+
+// NeL includes
+
+// Project includes
+#include "ui_bnp_filelist_dialog.h"
+
+namespace BNPManager
+{
+
+typedef std::vector TSelectionList;
+
+class BnpFileListDialog : public QDockWidget
+{
+ Q_OBJECT
+
+public:
+
+ // Constructor
+ BnpFileListDialog(QString bnpPath, QWidget *parent = 0);
+
+ // Destructor
+ ~BnpFileListDialog();
+
+ /**
+ * Load the bnp file and setup the table view
+ * \param Filename
+ * \return true if everything went well
+ */
+ bool loadTable(const QString filename);
+
+ /**
+ * Set the dimension of the table
+ * \param number of rows
+ */
+ void setupTable(int nbrows);
+
+ /**
+ * Fill the files selected in the table view to
+ * unpack them.
+ * \param reference to a vector of filenames.
+ * \return true if everything went well
+ */
+ void getSelections(TSelectionList& SelectionList);
+
+private:
+
+ Ui::BnpFileListDialog m_ui;
+
+ // common data path as root folder for the dirtree view
+ QString m_DataPath;
+
+};
+
+}
+
+#endif
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.ui
new file mode 100644
index 000000000..9f62ff7c0
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.ui
@@ -0,0 +1,70 @@
+
+
+ BnpFileListDialog
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 200
+ 141
+
+
+
+ true
+
+
+ QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable
+
+
+ BNP File List
+
+
+
+
+ 50
+ 0
+
+
+
+ -
+
+
+ true
+
+
+ QAbstractItemView::NoEditTriggers
+
+
+ QAbstractItemView::SelectRows
+
+
+ false
+
+
+ 15
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filesystem_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filesystem_model.cpp
new file mode 100644
index 000000000..eaf6389f5
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filesystem_model.cpp
@@ -0,0 +1,52 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see
+
+#include "bnp_filesystem_model.h"
+
+#include
+#include
+
+namespace BNPManager
+{
+
+BNPFileSystemModel::BNPFileSystemModel(QObject *parent)
+ : QFileSystemModel(parent)
+{
+
+}
+// ***************************************************************************
+BNPFileSystemModel::~BNPFileSystemModel()
+{
+
+}
+// ***************************************************************************
+int BNPFileSystemModel::columnCount(const QModelIndex &) const
+{
+ return 1;
+}
+// ***************************************************************************
+QVariant BNPFileSystemModel::data(const QModelIndex& index, int role) const
+{
+
+ if (role == Qt::DecorationRole)
+ {
+ if (isDir(index))
+ return QApplication::style()->standardIcon(QStyle::SP_DirIcon);
+ }
+ return QFileSystemModel::data(index, role);
+}
+// ***************************************************************************
+} // namespace BNPManager
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filesystem_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filesystem_model.h
new file mode 100644
index 000000000..2ca086b39
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filesystem_model.h
@@ -0,0 +1,49 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see
+
+#ifndef BNP_FILESYSTEM_MODEL_H
+#define BNP_FILESYSTEM_MODEL_H
+
+#include
+
+namespace BNPManager
+{
+
+class BNPFileSystemModel : public QFileSystemModel
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Constructor
+ */
+ BNPFileSystemModel(QObject *parent = 0);
+
+ /**
+ * Destructor
+ */
+ ~BNPFileSystemModel();
+
+ int columnCount(const QModelIndex &) const;
+
+ QVariant data(const QModelIndex& index, int role) const ;
+
+};
+
+}
+
+#endif
\ No newline at end of file
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager.qrc b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager.qrc
new file mode 100644
index 000000000..bf32595d6
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager.qrc
@@ -0,0 +1,9 @@
+
+
+ images/ic_nel_bnp_make.png
+ images/ic_nel_delete_item.png
+ images/ic_nel_add_item.png
+ images/ic_nel_export.png
+ images/ic_nel_reset_all.png
+
+
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_constants.h
new file mode 100644
index 000000000..7ec5eecd0
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_constants.h
@@ -0,0 +1,37 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#ifndef BNP_MANAGER_CONSTANTS_H
+#define BNP_MANAGER_CONSTANTS_H
+
+namespace BNPManager
+{
+namespace Constants
+{
+//settings
+const char * const BNP_MANAGER_SECTION = "BNPManager";
+
+//resources
+const char *const ICON_ADD = ":/images/ic_nel_add_item.png";
+const char *const ICON_DELETE = ":/images/ic_nel_delete_item.png";
+const char *const ICON_UNPACK = ":/images/ic_nel_export.png";
+const char *const ICON_CLOSE = ":/images/ic_nel_reset_all.png";
+
+
+} // namespace Constants
+} // namespace Plugin
+
+#endif
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_plugin.cpp
new file mode 100644
index 000000000..70015773b
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_plugin.cpp
@@ -0,0 +1,89 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+// Project includes
+#include "bnp_manager_plugin.h"
+#include "bnp_manager_window.h"
+
+#include "../core/icore.h"
+#include "../core/core_constants.h"
+#include "../core/menu_manager.h"
+
+// NeL includes
+#include "nel/misc/debug.h"
+
+// Qt includes
+#include
+#include
+
+namespace BNPManager
+{
+
+ BNPManagerPlugin::BNPManagerPlugin()
+ {
+ }
+
+ BNPManagerPlugin::~BNPManagerPlugin()
+ {
+ Q_FOREACH(QObject *obj, m_autoReleaseObjects)
+ {
+ m_plugMan->removeObject(obj);
+ }
+ qDeleteAll(m_autoReleaseObjects);
+ m_autoReleaseObjects.clear();
+ }
+
+bool BNPManagerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
+{
+ Q_UNUSED(errorString);
+ m_plugMan = pluginManager;
+
+ addAutoReleasedObject(new BNPManagerContext(this));
+ return true;
+}
+
+void BNPManagerPlugin::extensionsInitialized()
+{
+}
+
+void BNPManagerPlugin::shutdown()
+{
+
+}
+
+void BNPManagerPlugin::setNelContext(NLMISC::INelContext *nelContext)
+{
+#ifdef NL_OS_WINDOWS
+ // Ensure that a context doesn't exist yet.
+ // This only applies to platforms without PIC, e.g. Windows.
+ nlassert(!NLMISC::INelContext::isContextInitialised());
+#endif // NL_OS_WINDOWS
+ m_libContext = new NLMISC::CLibraryContext(*nelContext);
+}
+
+void BNPManagerPlugin::addAutoReleasedObject(QObject *obj)
+{
+ m_plugMan->addObject(obj);
+ m_autoReleaseObjects.prepend(obj);
+}
+
+/*void BNPManagerContext::open()
+{
+ m_BnpManagerWindow->open();
+}*/
+}
+
+Q_EXPORT_PLUGIN(BNPManager::BNPManagerPlugin)
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_plugin.h
new file mode 100644
index 000000000..55e2e8444
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_plugin.h
@@ -0,0 +1,130 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#ifndef BNP_MANAGER_PLUGIN_H
+#define BNP_MANAGER_PLUGIN_H
+
+// Project includes
+#include "../../extension_system/iplugin.h"
+#include "../core/icontext.h"
+#include "bnp_manager_window.h"
+
+// NeL includes
+#include "nel/misc/app_context.h"
+#include
+
+// Qt includes
+#include
+#include
+
+namespace NLMISC
+{
+class CLibraryContext;
+}
+
+namespace ExtensionSystem
+{
+class IPluginSpec;
+}
+
+namespace BNPManager
+{
+class m_BnpManagerWindow;
+
+class BNPManagerPlugin : public QObject, public ExtensionSystem::IPlugin
+{
+ Q_OBJECT
+ Q_INTERFACES(ExtensionSystem::IPlugin)
+
+public:
+ BNPManagerPlugin();
+ virtual ~BNPManagerPlugin();
+
+ virtual bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
+ virtual void extensionsInitialized();
+ virtual void shutdown();
+ virtual void setNelContext(NLMISC::INelContext *nelContext);
+
+ void addAutoReleasedObject(QObject *obj);
+
+protected:
+
+ NLMISC::CLibraryContext *m_libContext;
+
+private:
+
+ ExtensionSystem::IPluginManager *m_plugMan;
+ QList m_autoReleaseObjects;
+};
+
+/**
+ * Implementation of the IContext interface
+ *
+ * \date 2011
+ */
+
+class BNPManagerContext : public Core::IContext
+{
+ Q_OBJECT
+
+public:
+ // Constructor
+ BNPManagerContext(QObject *parent = 0) : IContext(parent)
+ {
+ // run new manager window app
+ m_BnpManagerWindow = new BNPManagerWindow();
+ }
+
+ // Destructor
+ virtual ~BNPManagerContext() {}
+
+ virtual QString id() const
+ {
+ return QLatin1String("BNPManagerContext");
+ }
+ virtual QString trName() const
+ {
+ return tr("BNP Manager");
+ }
+ virtual QIcon icon() const
+ {
+ return QIcon(":/images/ic_nel_bnp_make.png");
+ }
+
+ virtual void open()
+ {
+ m_BnpManagerWindow->open();
+ }
+
+ virtual QUndoStack *undoStack()
+ {
+ return m_BnpManagerWindow->m_undoStack;
+ }
+
+ virtual QWidget *widget()
+ {
+ return m_BnpManagerWindow;
+ }
+
+ BNPManagerWindow *m_BnpManagerWindow;
+
+};
+
+} // namespace Plugin
+
+
+
+#endif // BNP_MANAGER_PLUGIN_H
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.cpp
new file mode 100644
index 000000000..33157733e
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.cpp
@@ -0,0 +1,291 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+// Project includes
+#include "bnp_manager_window.h"
+#include "bnp_manager_constants.h"
+#include "bnp_dirtree_dialog.h"
+#include "bnp_filelist_dialog.h"
+#include "bnp_file.h"
+
+#include "../core/icore.h"
+#include "../core/menu_manager.h"
+#include "../core/core_constants.h"
+#include "../../extension_system/iplugin_spec.h"
+
+// NeL includes
+#include
+#include
+
+// Qt includes
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace std;
+using namespace NLMISC;
+
+
+namespace BNPManager
+{
+
+BNPManagerWindow::BNPManagerWindow(QWidget *parent)
+ : QMainWindow(parent)
+{
+ // add new mainwindow for sheet dockwidgets
+ QTableWidget* hideWidget = new QTableWidget(0,0,this);
+ setCentralWidget(hideWidget);
+ hideWidget->hide();
+
+ // Read the settings
+ readSettings();
+
+ // create main dialogs and display them
+ createDialogs();
+
+ // create actions like open, close, add etc.
+ createActions();
+
+ // create a toolbar with icons
+ createToolBars();
+
+ // this SLOT is triggered if the user activates a bnp files in the
+ // dirtree view
+ connect(m_BnpDirTreeDialog, SIGNAL(selectedForm(const QString)),
+ this, SLOT(loadFile(const QString)));
+
+ // not used
+ m_undoStack = new QUndoStack(this);
+}
+// ***************************************************************************
+BNPManagerWindow::~BNPManagerWindow()
+{
+ writeSettings();
+}
+// ***************************************************************************
+void BNPManagerWindow::createDialogs()
+{
+ // create dialog to list the contents of the specified
+ // bnp data file directory
+ m_BnpDirTreeDialog = new CBnpDirTreeDialog(tr(m_DataPath.toStdString().c_str()),this);
+ addDockWidget(Qt::LeftDockWidgetArea, m_BnpDirTreeDialog);
+ m_BnpDirTreeDialog->setVisible(true);
+ restoreDockWidget(m_BnpDirTreeDialog);
+
+ // create dialog to list the packed file contents of bnp files on
+ // the right hand side
+ m_BnpFileListDialog = new BnpFileListDialog(m_DataPath,this);
+ addDockWidget(Qt::RightDockWidgetArea, m_BnpFileListDialog);
+ m_BnpFileListDialog->setVisible(true);
+ restoreDockWidget(m_BnpFileListDialog);
+}
+// ***************************************************************************
+void BNPManagerWindow::createActions()
+{
+ // open action
+ m_openAction = new QAction(tr("&Open..."), this);
+ m_openAction->setIcon(QIcon(Core::Constants::ICON_OPEN));
+ m_openAction->setStatusTip(tr("Open file"));
+ connect(m_openAction, SIGNAL(triggered()), this, SLOT( open() ));
+
+ // close action
+ m_closeAction = new QAction(tr("&Close..."), this);
+ m_closeAction->setIcon(QIcon(Constants::ICON_CLOSE));
+ m_closeAction->setStatusTip(tr("Close the BNP File"));
+ connect(m_closeAction, SIGNAL(triggered()), this, SLOT( close() ));
+
+ // add files into the bnp file
+ m_addFilesAction = new QAction(tr("&Add..."), this);
+ m_addFilesAction->setIcon(QIcon(Constants::ICON_ADD));
+ m_addFilesAction->setStatusTip(tr("Add Files to BNP"));
+ connect(m_addFilesAction, SIGNAL(triggered()), this, SLOT( addFiles() ));
+
+ // delete files from the bnp file
+ m_deleteFilesAction = new QAction(tr("&Delete..."), this);
+ m_deleteFilesAction->setIcon(QIcon(Constants::ICON_DELETE));
+ m_deleteFilesAction->setStatusTip(tr("Delete Files"));
+ connect(m_deleteFilesAction, SIGNAL(triggered()), this, SLOT( deleteFiles() ));
+
+ // unpack selected files into user defined dir
+ m_unpackFilesAction = new QAction(tr("&Unpack..."), this);
+ m_unpackFilesAction->setIcon(QIcon(Constants::ICON_UNPACK));
+ m_unpackFilesAction->setStatusTip(tr("Unpack Files"));
+ connect(m_unpackFilesAction, SIGNAL(triggered()), this, SLOT( unpackFiles() ));
+}
+// ***************************************************************************
+void BNPManagerWindow::createToolBars()
+{
+ m_fileToolBar = addToolBar(tr("&File"));
+ m_fileToolBar->addAction(m_openAction);
+ m_fileToolBar->addAction(m_closeAction);
+
+ m_toolsBar = addToolBar(tr("&Tools"));
+ m_toolsBar->addAction(m_addFilesAction);
+ m_toolsBar->addAction(m_deleteFilesAction);
+ m_toolsBar->addAction(m_unpackFilesAction);
+}
+// ***************************************************************************
+bool BNPManagerWindow::loadFile(const QString fileName)
+{
+ m_BnpFileListDialog->loadTable(fileName);
+ return true;
+}
+// ***************************************************************************
+void BNPManagerWindow::open()
+{
+ QString fileName;
+ // file dialog to select with file should be opened
+ fileName = QFileDialog::getOpenFileName(this,
+ tr("Open BNP file"), tr(m_DataPath.toStdString().c_str()), tr("BNP Files (*.bnp)"));
+
+ // Check if filename is empty
+ if (fileName.isNull())
+ return;
+
+ m_openedBNPFile = fileName;
+ loadFile(fileName);
+}
+// ***************************************************************************
+void BNPManagerWindow::close()
+{
+ //TODO
+}
+// ***************************************************************************
+void BNPManagerWindow::addFiles()
+{
+ // reference to the BNPFileHandle singletone instance
+ BNPFileHandle& myBNPFileHandle = BNPFileHandle::getInstance();
+
+ // vector of all current packed filenames
+ vector currentFiles;
+
+ // vector of files to add
+ vector addFiles;
+
+ // open a file dialog and to add files
+ QStringList FileList;
+
+ FileList = QFileDialog::getOpenFileNames(this,tr("Add Files..."),
+ QDir::currentPath(), tr("All Files (*.*)") );
+
+ // get all current filenames from the opened bnp file
+ myBNPFileHandle.fileNames(currentFiles);
+
+ QStringList::iterator it_list = FileList.begin();
+ while (it_list != FileList.end() )
+ {
+ string fileName = CFile::getFilename (it_list->toStdString() );
+ if ( std::find(currentFiles.begin(), currentFiles.end(), fileName ) != currentFiles.end() )
+ {
+ // Ask the user if he wants to override the existing file
+ // atm only warn the user and do not override
+ QMessageBox::warning(this, tr("BNP Manager"),
+ tr("File is already in the list!"),
+ QMessageBox::Ok,
+ QMessageBox::Ok);
+ }
+ else
+ {
+ addFiles.push_back( it_list->toStdString() );
+ // log it
+ nlinfo("Add file %s", fileName.c_str() );
+ }
+ it_list++;
+ }
+
+ if ( !addFiles.empty() )
+ {
+ myBNPFileHandle.addFiles( addFiles );
+ }
+ loadFile(m_openedBNPFile);
+}
+// ***************************************************************************
+void BNPManagerWindow::deleteFiles()
+{
+ QFileDialog filedialog(this);
+ BNPFileHandle& myBNPFileHandle = BNPFileHandle::getInstance();
+ vector selectedRows;
+
+ m_BnpFileListDialog->getSelections(selectedRows);
+
+ // Check if files were selected. If not, inform the user.
+ if (selectedRows.empty())
+ {
+ QMessageBox::information(this, tr("BNP Manager"),
+ tr("No files selected!"),
+ QMessageBox::Ok,
+ QMessageBox::Ok);
+ return;
+ }
+
+ myBNPFileHandle.deleteFiles(selectedRows);
+ loadFile(m_openedBNPFile);
+}
+// ***************************************************************************
+void BNPManagerWindow::unpackFiles()
+{
+ QFileDialog filedialog(this);
+ BNPFileHandle& myBNPFileHandle = BNPFileHandle::getInstance();
+ vector selectedrows;
+
+ m_BnpFileListDialog->getSelections(selectedrows);
+
+ // Check if files were selected. If not, inform the user.
+ // TODO: Ask the user if nothing was selected, if he wants to unpack all
+ // files. This is more like Winzip.
+ if (selectedrows.empty())
+ {
+ QMessageBox::information(this, tr("BNP Manager"),
+ tr("No files selected!"),
+ QMessageBox::Ok,
+ QMessageBox::Ok);
+ return;
+ }
+
+ QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
+ tr(m_DataPath.toStdString().c_str()),
+ QFileDialog::ShowDirsOnly
+ | QFileDialog::DontResolveSymlinks);
+
+ // If anything went wrong or the user pressed "cancel"
+ if ( dir.isEmpty() )
+ return;
+
+ if (myBNPFileHandle.unpack(dir.toStdString(),selectedrows))
+ {
+ QMessageBox::information(this, tr("BNP Manager"),
+ tr("All files has been exported successfully."),
+ QMessageBox::Ok,
+ QMessageBox::Ok);
+ }
+}
+// ***************************************************************************
+void BNPManagerWindow::readSettings()
+{
+ QSettings *settings = Core::ICore::instance()->settings();
+
+ settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
+ m_DataPath = settings->value(Core::Constants::ASSETS_PATH, "w:/database").toString();
+ settings->endGroup();
+}
+// ***************************************************************************
+void BNPManagerWindow::writeSettings()
+{
+}
+} // namespace BNPManager
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.h
new file mode 100644
index 000000000..b31d17a09
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.h
@@ -0,0 +1,145 @@
+// Object Viewer Qt - BNP Manager Plugin - MMORPG Framework
+// Copyright (C) 2011 Roland Winklmeier
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#ifndef BNP_MANAGER_WINDOW_H
+#define BNP_MANAGER_WINDOW_H
+
+// Project includes
+//#include "ui_bnp_manager_window.h"
+
+// Qt includes
+#include
+#include
+#include
+#include
+
+
+namespace BNPManager
+{
+
+class CBnpDirTreeDialog;
+class BnpFileListDialog;
+class BNPFileHandle;
+
+/**
+ * Main window class. Derived from QMainWindow and implements
+ * the basic layout like menue, toolbars and dialogs.
+ *
+ * \date 2011
+ */
+
+class BNPManagerWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+
+ // Constructor
+ BNPManagerWindow(QWidget *parent = 0);
+
+ //Destructor
+ ~BNPManagerWindow();
+
+
+ QUndoStack *m_undoStack;
+
+public Q_SLOTS:
+
+ /**
+ * Open a file dialog to choose which file should be opened.
+ * \return Filename string
+ */
+ void open();
+
+ /**
+ * Load a certain bnp file into the manager
+ * \param Filename
+ * \return true if everything went well
+ */
+ bool loadFile(const QString fileName);
+
+ /**
+ * close an opened bnp file and reset all views
+ */
+ void close();
+
+ /**
+ * Add files into an opened bnp file.
+ * \param Filelist
+ */
+ void addFiles();
+
+ /**
+ * Unpack the files marked in the filelist dialog into user defined
+ * directory.
+ * \param TBD
+ * \return true if everything went well
+ */
+ void unpackFiles();
+
+ /**
+ * Delete marked files from the bnp file
+ * \param TBD
+ */
+ void deleteFiles();
+
+private:
+
+ /**
+ * Read plugin settings and set the window accordingly
+ */
+ void readSettings();
+
+ /**
+ * Write plugin settings
+ */
+ void writeSettings();
+
+ /**
+ * Create all plugin dialogs
+ */
+ void createDialogs();
+
+ /**
+ * Create all plugin actions
+ */
+ void createActions();
+
+ /**
+ * Create the plugin toolbar
+ */
+ void createToolBars();
+
+ QToolBar *m_fileToolBar;
+ QToolBar *m_toolsBar;
+
+ QAction *m_openAction;
+ QAction *m_closeAction;
+ QAction *m_addFilesAction;
+ QAction *m_unpackFilesAction;
+ QAction *m_deleteFilesAction;
+
+ CBnpDirTreeDialog *m_BnpDirTreeDialog;
+ BnpFileListDialog *m_BnpFileListDialog;
+
+ QString m_DataPath;
+ QString m_openedBNPFile;
+
+}; /* class BNPManagerWindow */
+
+} /* namespace Plugin */
+
+#endif
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.ui
new file mode 100644
index 000000000..4e695f72c
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.ui
@@ -0,0 +1,50 @@
+
+
+ BNPManagerWindow
+
+
+
+ 0
+ 0
+ 800
+ 600
+
+
+
+ BNP Manager
+
+
+
+
+
+
+ QWidget#centralwidget {
+ image: url(:/images/ic_nel_georges_editor.png);
+ }
+
+
+ -
+
+
+ -
+
+
+
+
+
+
+ toolBar
+
+
+ TopToolBarArea
+
+
+ false
+
+
+
+
+
+
+
+
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_add_item.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_add_item.png
new file mode 100644
index 000000000..bde338f78
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_add_item.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_bnp_make.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_bnp_make.png
new file mode 100644
index 000000000..19b749b1d
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_bnp_make.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_delete_item.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_delete_item.png
new file mode 100644
index 000000000..a5a1787d5
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_delete_item.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_export.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_export.png
new file mode 100644
index 000000000..9fc71c09d
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_export.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_reset_all.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_reset_all.png
new file mode 100644
index 000000000..c67287408
Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_reset_all.png differ
diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/ovqt_plugin_bnp_manager.xml b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/ovqt_plugin_bnp_manager.xml
new file mode 100644
index 000000000..43cea2022
--- /dev/null
+++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/ovqt_plugin_bnp_manager.xml
@@ -0,0 +1,10 @@
+
+ ovqt_plugin_bnp_manager
+ BNPManager
+ 0.1
+ Krolock
+ Edit BNP Files
+
+
+
+
\ No newline at end of file