diff --git a/.hgignore b/.hgignore index 1f8453d8a..2c278c240 100644 --- a/.hgignore +++ b/.hgignore @@ -43,7 +43,6 @@ default_c *.so *.so.* *_debug -core *.pc *.gch diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 34b33859b..c0552eb54 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -197,6 +197,10 @@ IF(WITH_TOOLS) ADD_SUBDIRECTORY(tool) ENDIF(WITH_TOOLS) +IF(WITH_STUDIO) + ADD_SUBDIRECTORY(studio) +ENDIF(WITH_STUDIO) + # To build the documention, you will have to enable it # and then do the equivalent of "make DoxygenDoc". IF(BUILD_DOCUMENTATION) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index dd8dee49f..0474c7d7b 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -229,6 +229,10 @@ Remove the CMakeCache.txt file and try again from another folder, e.g.: ENDMACRO(CHECK_OUT_OF_SOURCE) MACRO(NL_SETUP_DEFAULT_OPTIONS) + IF(WITH_QT) + OPTION(WITH_STUDIO "Build Core Studio" OFF ) + ENDIF(WITH_QT) + ### # Features ### diff --git a/code/nel/include/nel/3d/tile_bank.h b/code/nel/include/nel/3d/tile_bank.h index 9253c5f45..00e0f2cae 100644 --- a/code/nel/include/nel/3d/tile_bank.h +++ b/code/nel/include/nel/3d/tile_bank.h @@ -86,6 +86,11 @@ public: _BitmapName[bitmapType]=name; } + std::string getFileName (TBitmap bitmapType) const + { + return _BitmapName[bitmapType]; + } + /// Get the additional orientation (CCW) for alpha texture. uint8 getRotAlpha () { @@ -161,6 +166,9 @@ public: { return _Name; }; + + std::set getTileSets() const{ return _TileSet; } + void setName (const std::string& name); void addTileSet (const std::string& name); void removeTileSet (const std::string& name); @@ -169,6 +177,8 @@ public: return _TileSet.find (name)!=_TileSet.end(); } + void clear(){ _TileSet.clear(); } + void serial(class NLMISC::IStream &f) throw(NLMISC::EStream); private: diff --git a/code/nel/include/nel/gui/action_handler.h b/code/nel/include/nel/gui/action_handler.h index 70c4b386e..48b49e451 100644 --- a/code/nel/include/nel/gui/action_handler.h +++ b/code/nel/include/nel/gui/action_handler.h @@ -68,6 +68,8 @@ namespace NLGUI return _GlobalInstance; } + void getActionHandlers( std::vector< std::string > &handlers ); + /// return pointer to action handler or null if it doesn't exist IActionHandler *getActionHandler(const std::string &name) const { diff --git a/code/nel/include/nel/gui/ctrl_base.h b/code/nel/include/nel/gui/ctrl_base.h index 28eeb2cd0..71e6cad56 100644 --- a/code/nel/include/nel/gui/ctrl_base.h +++ b/code/nel/include/nel/gui/ctrl_base.h @@ -171,7 +171,9 @@ namespace NLGUI THotSpot _ToolTipPosRefAlt : 6; protected: void convertTooltipHotSpot(const char *prop, THotSpot &parentHS, THotSpot &childHS); + void convertTooltipHotSpot(const char *prop, THotSpot &HS ); static std::string TooltipHotSpotToString( THotSpot parent, THotSpot child ); + static std::string TooltipHotSpotToString( THotSpot HS ); void mapAHString( const std::string &key, const std::string &value ); std::string getAHString( const std::string &key ) const; diff --git a/code/nel/include/nel/gui/view_renderer.h b/code/nel/include/nel/gui/view_renderer.h index 83ac4457e..fe5dad405 100644 --- a/code/nel/include/nel/gui/view_renderer.h +++ b/code/nel/include/nel/gui/view_renderer.h @@ -286,6 +286,12 @@ namespace NLGUI */ void flush (); + /// Retrives a texture + bool getTexture( NLMISC::CBitmap &bm, const std::string &name ); + + /// Retrieve the texture names + void getTextureNames( std::vector< std::string > &textures ); + /** * get a texture file pointer from a string name. O(logN) * \param id : the id of the texture diff --git a/code/nel/include/nel/misc/path.h b/code/nel/include/nel/misc/path.h index 73652a581..f3120c907 100644 --- a/code/nel/include/nel/misc/path.h +++ b/code/nel/include/nel/misc/path.h @@ -200,6 +200,10 @@ public: */ void getFileListByName(const std::string &extension, const std::string &name, std::vector &filenames); + /** Create a list of file having the requested string in the path and the requested extension. + */ + void getFileListByPath(const std::string &extension, const std::string &path, std::vector &filenames); + /** Make a path relative to another if possible, else doesn't change it. * \param basePath is the base path to be relative to. * \param relativePath is the path to make relative to basePath. @@ -492,6 +496,10 @@ public: */ static void getFileListByName(const std::string &extension, const std::string &name, std::vector &filenames); + /** Create a list of file having the requested string in the path and the requested extension + */ + static void getFileListByPath(const std::string &extension, const std::string &path, std::vector &filenames); + /** Make a path relative to another if possible, else doesn't change it. * \param basePath is the base path to be relative to. * \param relativePath is the path to make relative to basePath. diff --git a/code/nel/src/gui/action_handler.cpp b/code/nel/src/gui/action_handler.cpp index 8b0d9c4ee..d7214ef06 100644 --- a/code/nel/src/gui/action_handler.cpp +++ b/code/nel/src/gui/action_handler.cpp @@ -111,6 +111,18 @@ namespace NLGUI } } + void CAHManager::getActionHandlers( std::vector< std::string > &handlers ) + { + handlers.clear(); + + std::map< string, IActionHandler* >::iterator itr = FactoryMap.begin(); + while( itr != FactoryMap.end() ) + { + handlers.push_back( itr->first ); + ++itr; + } + } + // ------------------------------------------------------------------------------------------------ IActionHandler* CAHManager::getAH(const std::string &name, std::string ¶ms) { diff --git a/code/nel/src/gui/ctrl_base.cpp b/code/nel/src/gui/ctrl_base.cpp index f0a2c2f89..5c250a0da 100644 --- a/code/nel/src/gui/ctrl_base.cpp +++ b/code/nel/src/gui/ctrl_base.cpp @@ -86,7 +86,7 @@ namespace NLGUI break; } - return ""; + return "control"; } CCtrlBase::TToolTipParentType CCtrlBase::stringToToolTipParent( const std::string &str ) @@ -220,28 +220,22 @@ namespace NLGUI else if( name == "tooltip_posref" ) { - std::string s; - if( ( _ToolTipParentPosRef == Hotspot_TTAuto ) && ( _ToolTipPosRef == Hotspot_TTAuto ) ) - return "auto"; - else{ - s = CInterfaceElement::HotSpotToString( _ToolTipParentPosRef ); - s += " "; - s += CInterfaceElement::HotSpotToString( _ToolTipPosRef ); - return s; - } + return TooltipHotSpotToString( _ToolTipPosRef ); + } + else + if( name == "tooltip_parent_posref" ) + { + return TooltipHotSpotToString( _ToolTipParentPosRef ); } else if( name == "tooltip_posref_alt" ) { - std::string s; - if( ( _ToolTipParentPosRefAlt == Hotspot_TTAuto ) && ( _ToolTipPosRefAlt == Hotspot_TTAuto ) ) - return "auto"; - else{ - s = CInterfaceElement::HotSpotToString( _ToolTipParentPosRefAlt ); - s += " "; - s += CInterfaceElement::HotSpotToString( _ToolTipPosRefAlt ); - return s; - } + return TooltipHotSpotToString( _ToolTipPosRefAlt ); + } + else + if( name == "tooltip_parent_posref_alt" ) + { + return TooltipHotSpotToString( _ToolTipParentPosRefAlt ); } else if( name == "instant_help" ) @@ -293,21 +287,65 @@ namespace NLGUI else if( name == "tooltip_posref" ) { - THotSpot parentHS; THotSpot HS; - convertTooltipHotSpot( value.c_str(), parentHS, HS ); - _ToolTipParentPosRef = parentHS; + convertTooltipHotSpot( value.c_str(), HS ); _ToolTipPosRef = HS; + + // When auto is set, both of them need to be auto + if( _ToolTipPosRef == Hotspot_TTAuto ) + _ToolTipParentPosRef = Hotspot_TTAuto; + else + if( _ToolTipParentPosRef == Hotspot_TTAuto ) + _ToolTipParentPosRef = _ToolTipPosRef; + + return; + } + else + if( name == "tooltip_parent_posref" ) + { + THotSpot HS; + convertTooltipHotSpot( value.c_str(), HS ); + _ToolTipParentPosRef = HS; + + // When auto is set, both of them need to be auto + if( _ToolTipParentPosRef == Hotspot_TTAuto ) + _ToolTipPosRef = Hotspot_TTAuto; + else + if( _ToolTipPosRef == Hotspot_TTAuto ) + _ToolTipPosRef = _ToolTipParentPosRef; + return; } else if( name == "tooltip_posref_alt" ) { - THotSpot parentHS; THotSpot HS; - convertTooltipHotSpot( value.c_str(), parentHS, HS ); - _ToolTipParentPosRefAlt = parentHS; + convertTooltipHotSpot( value.c_str(), HS ); _ToolTipPosRefAlt = HS; + + // When auto is set, both of them need to be auto + if( _ToolTipPosRefAlt == Hotspot_TTAuto ) + _ToolTipParentPosRefAlt = Hotspot_TTAuto; + else + if( _ToolTipParentPosRefAlt == Hotspot_TTAuto ) + _ToolTipPosRefAlt = _ToolTipParentPosRefAlt; + + return; + } + else + if( name == "tooltip_parent_posref_alt" ) + { + THotSpot HS; + convertTooltipHotSpot( value.c_str(), HS ); + _ToolTipParentPosRefAlt = HS; + + // When auto is set, both of them need to be auto + if( _ToolTipParentPosRefAlt == Hotspot_TTAuto ) + _ToolTipPosRefAlt = Hotspot_TTAuto; + else + if( _ToolTipPosRefAlt == Hotspot_TTAuto ) + _ToolTipPosRefAlt = _ToolTipParentPosRefAlt; + return; } else @@ -374,6 +412,21 @@ namespace NLGUI } } + void CCtrlBase::convertTooltipHotSpot(const char *prop, THotSpot &HS ) + { + if(prop) + { + const char *ptr = (const char*)prop; + if(stricmp(ptr, "auto")==0) + { + HS = Hotspot_TTAuto; + } + else if(strlen(ptr)==2) + { + HS = convertHotSpot(ptr); + } + } + } std::string CCtrlBase::TooltipHotSpotToString( THotSpot parent, THotSpot child ) { @@ -393,6 +446,20 @@ namespace NLGUI return s; } + std::string CCtrlBase::TooltipHotSpotToString( THotSpot HS ) + { + std::string s; + if( HS == Hotspot_TTAuto ) + { + s = "auto"; + } + else + { + s = HotSpotToString( HS ); + } + return s; + } + // *************************************************************************** bool CCtrlBase::emptyContextHelp() const { diff --git a/code/nel/src/gui/ctrl_text_button.cpp b/code/nel/src/gui/ctrl_text_button.cpp index cdf006a51..d3a0f6765 100644 --- a/code/nel/src/gui/ctrl_text_button.cpp +++ b/code/nel/src/gui/ctrl_text_button.cpp @@ -149,11 +149,16 @@ namespace NLGUI } else if( name == "text_posref" ) + { + std::string pr; + pr = CInterfaceElement::HotSpotToString( _TextPosRef ); + return pr; + } + else + if( name == "text_parent_posref" ) { std::string pr; pr = CInterfaceElement::HotSpotToString( _TextParentPosRef ); - pr += " "; - pr += CInterfaceElement::HotSpotToString( _TextPosRef ); return pr; } else @@ -324,10 +329,13 @@ namespace NLGUI else if( name == "text_posref" ) { - THotSpot parent, posref; - CInterfaceElement::convertHotSpotCouple( value.c_str(), parent, posref ); - _TextPosRef = posref; - _TextParentPosRef = parent; + _TextPosRef = convertHotSpot( value.c_str() ); + return; + } + else + if( name == "text_parent_posref" ) + { + _TextParentPosRef = convertHotSpot( value.c_str() ); return; } else diff --git a/code/nel/src/gui/group_paragraph.cpp b/code/nel/src/gui/group_paragraph.cpp index 00ea5f3b7..9e065c878 100644 --- a/code/nel/src/gui/group_paragraph.cpp +++ b/code/nel/src/gui/group_paragraph.cpp @@ -209,6 +209,8 @@ namespace NLGUI } nlassert(false); + + return ""; } else if( name == "align" ) @@ -229,6 +231,8 @@ namespace NLGUI } nlassert(false); + + return ""; } else if( name == "space" ) diff --git a/code/nel/src/gui/group_table.cpp b/code/nel/src/gui/group_table.cpp index 9f019ed48..2fdd7e364 100644 --- a/code/nel/src/gui/group_table.cpp +++ b/code/nel/src/gui/group_table.cpp @@ -89,6 +89,8 @@ namespace NLGUI } nlassert(false); + + return ""; } else if( name == "valign" ) @@ -106,6 +108,8 @@ namespace NLGUI } nlassert(false); + + return ""; } else if( name == "left_margin" ) diff --git a/code/nel/src/gui/interface_element.cpp b/code/nel/src/gui/interface_element.cpp index 15f9cf812..0225d2797 100644 --- a/code/nel/src/gui/interface_element.cpp +++ b/code/nel/src/gui/interface_element.cpp @@ -130,12 +130,17 @@ namespace NLGUI if( name == "posref" ) { std::string posref; - posref = HotSpotToString( getParentPosRef() ); - posref += " "; posref += HotSpotToString( getPosRef() ); return posref; } else + if( name == "parentposref" ) + { + std::string parentPosRef; + parentPosRef = HotSpotToString( getParentPosRef() ); + return parentPosRef; + } + else if( name == "sizeref" ) { return getSizeRefAsString( _SizeRef, _SizeDivW, _SizeDivH ); @@ -221,10 +226,15 @@ namespace NLGUI else if( name == "posref" ) { - convertHotSpotCouple( value.c_str(), _ParentPosRef, _PosRef ); + convertHotSpot( value.c_str() ); return; } else + if( name == "parentposref" ) + { + convertHotSpot( value.c_str() ); + } + else if( name == "sizeref" ) { parseSizeRef( value.c_str() ); diff --git a/code/nel/src/gui/view_renderer.cpp b/code/nel/src/gui/view_renderer.cpp index b2758c634..6e6675599 100644 --- a/code/nel/src/gui/view_renderer.cpp +++ b/code/nel/src/gui/view_renderer.cpp @@ -1064,6 +1064,46 @@ namespace NLGUI } } + bool CViewRenderer::getTexture( NLMISC::CBitmap &bm, const std::string &name ) + { + TTextureMap::const_iterator itr = _TextureMap.find( name ); + if( itr == _TextureMap.end() ) + return false; + + sint32 id = itr->second; + SImage *si = getSImage( id ); + NLMISC::CBitmap *src = si->GlobalTexturePtr->Texture->generateDatas(); + + if( src->getPixelFormat() != NLMISC::CBitmap::RGBA ) + return false; + + uint x0 = (uint)( si->UVMin.U * si->GlobalTexturePtr->Width ); + uint y0 = (uint)( si->UVMin.V * si->GlobalTexturePtr->Height ); + uint x1 = (uint)( si->UVMax.U * si->GlobalTexturePtr->Width ); + uint y1 = (uint)( si->UVMax.V * si->GlobalTexturePtr->Height ); + + if( x1 == x0 ) + return false; + + if( y1 == y0 ) + return false; + + bm.resize( x1 - x0, y1 - y0 ); + bm.blit( *src, x0, y0, ( x1 - x0 ), ( y1 - y0 ), 0, 0 ); + + return true; + } + + void CViewRenderer::getTextureNames( std::vector< std::string > &textures ) + { + TTextureMap::const_iterator itr = _TextureMap.begin(); + while( itr != _TextureMap.end() ) + { + textures.push_back( itr->first ); + ++itr; + } + } + /* * getTextureIdFromName */ diff --git a/code/nel/src/misc/path.cpp b/code/nel/src/misc/path.cpp index 743f8f514..d47b8ce4a 100644 --- a/code/nel/src/misc/path.cpp +++ b/code/nel/src/misc/path.cpp @@ -221,6 +221,67 @@ void CFileContainer::getFileListByName(const std::string &extension, const std:: } } +void CPath::getFileListByPath(const std::string &extension, const std::string &path, std::vector &filenames) +{ + getInstance()->_FileContainer.getFileListByPath(extension, path, filenames); +} + +void CFileContainer::getFileListByPath(const std::string &extension, const std::string &path, std::vector &filenames) +{ + if (!_MemoryCompressed) + { + TFiles::iterator first(_Files.begin()), last(_Files.end()); + + if( !path.empty() ) + { + for (; first != last; ++ first) + { + string ext = SSMext.get(first->second.idExt); + string p = SSMpath.get(first->second.idPath); + if (p.find(path) != string::npos && (ext == extension || extension.empty())) + { + filenames.push_back(first->first); + } + } + } + // if extension is empty we keep all files + else + { + for (; first != last; ++ first) + { + filenames.push_back(first->first); + } + } + } + else + { + // compressed memory version + std::vector::iterator first(_MCFiles.begin()), last(_MCFiles.end()); + + if( !path.empty() ) + { + for (; first != last; ++ first) + { + string ext = SSMext.get(first->idExt); + string p = SSMpath.get(first->idPath); + + if (strstr(p.c_str(), path.c_str()) != NULL && (ext == extension || extension.empty())) + { + filenames.push_back(first->Name); + } + } + } + // if extension is empty we keep all files + else + { + for (; first != last; ++ first) + { + filenames.push_back(first->Name); + } + } + } +} + void CPath::clearMap () { getInstance()->_FileContainer.clearMap(); diff --git a/code/nel/tools/3d/CMakeLists.txt b/code/nel/tools/3d/CMakeLists.txt index 2ac0ac1c5..cb709ffaa 100644 --- a/code/nel/tools/3d/CMakeLists.txt +++ b/code/nel/tools/3d/CMakeLists.txt @@ -59,7 +59,6 @@ IF(WITH_NEL_TOOLS AND WITH_3D) IF(WITH_QT) ADD_SUBDIRECTORY(tile_edit_qt) - ADD_SUBDIRECTORY(object_viewer_qt) ADD_SUBDIRECTORY(object_viewer_widget) ENDIF(WITH_QT) diff --git a/code/nel/tools/3d/object_viewer_qt/ovqt_config.h.cmake b/code/nel/tools/3d/object_viewer_qt/ovqt_config.h.cmake deleted file mode 100644 index 5b3a49654..000000000 --- a/code/nel/tools/3d/object_viewer_qt/ovqt_config.h.cmake +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef OVQT_CONFIG_H -#define OVQT_CONFIG_H - -#define DATA_DIR "${NL_SHARE_ABSOLUTE_PREFIX}/object_viewer_qt" -#define PLUGINS_DIR "${NL_LIB_ABSOLUTE_PREFIX}/object_viewer_qt" - -#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/CMakeLists.txt deleted file mode 100644 index d77b0e6a1..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -ADD_SUBDIRECTORY(3rdparty) - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${QT_INCLUDES}) -INCLUDE( ${QT_USE_FILE} ) - -CONFIGURE_FILE(translations/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY) - -FILE(GLOB OBJECT_VIEWER_SRC extension_system/*.h - extension_system/*.cpp - *.h *.cpp) - -SET(OBJECT_VIEWER_HDR extension_system/iplugin_manager.h - extension_system/plugin_manager.h) - -SET(OBJECT_VIEWER_RCS object_viewer_qt.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc) - -SET(OBJECT_VIEWER_TS translations/object_viewer_qt_en.ts - translations/object_viewer_qt_fr.ts - translations/object_viewer_qt_de.ts - translations/object_viewer_qt_ru.ts) - -SET(QT_USE_QTGUI TRUE) -SET(QT_USE_QTOPENGL TRUE) - -IF(WIN32) - SET(OBJECT_VIEWER_RC object_viewer_qt.rc) -ENDIF(WIN32) - -QT4_ADD_TRANSLATION(OBJECT_VIEWER_QM ${OBJECT_VIEWER_TS}) -QT4_ADD_RESOURCES( OBJECT_VIEWER_RC_SRCS ${OBJECT_VIEWER_RCS}) -QT4_WRAP_CPP( OBJECT_VIEWER_MOC_SRCS ${OBJECT_VIEWER_HDR} ) - -SOURCE_GROUP(QtResources FILES ${OBJECT_VIEWER_RCS}) -SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${OBJECT_VIEWER_MOC_SRCS} ${OBJECT_VIEWER_RC_SRCS}) - -ADD_EXECUTABLE(object_viewer_qt WIN32 MACOSX_BUNDLE - ${OBJECT_VIEWER_SRC} - ${OBJECT_VIEWER_MOC_SRCS} - ${OBJECT_VIEWER_RC_SRCS} - ${OBJECT_VIEWER_RC}) - -TARGET_LINK_LIBRARIES(object_viewer_qt - nelmisc - ${QT_LIBRARIES} - ${QT_QTMAIN_LIBRARY}) - -ADD_DEFINITIONS(-DQT_NO_KEYWORDS ${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS}) -NL_DEFAULT_PROPS(object_viewer_qt "NeL, Tools, 3D: Object Viewer Qt") -NL_ADD_RUNTIME_FLAGS(object_viewer_qt) - -ADD_SUBDIRECTORY(plugins) - -INSTALL(TARGETS object_viewer_qt RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT runtime BUNDLE DESTINATION /Applications) diff --git a/code/nel/tools/3d/object_viewer_qt/src/images/nel_ide_load.png b/code/nel/tools/3d/object_viewer_qt/src/images/nel_ide_load.png deleted file mode 100644 index 1ec9d823f..000000000 Binary files a/code/nel/tools/3d/object_viewer_qt/src/images/nel_ide_load.png and /dev/null differ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp deleted file mode 100644 index 744bb58da..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.cpp +++ /dev/null @@ -1,163 +0,0 @@ -// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework -// Copyright (C) 2011 Adrian Jaekel -// -// 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 "stdpch.h" -#include "formitem.h" - -// Qt includes - -// NeL includes -#include -#include -#include - -namespace GeorgesQt -{ - - CFormItem::CFormItem(NLGEORGES::UFormElm* elm, const QList &data, CFormItem *parent, - NLGEORGES::UFormElm::TWhereIsValue wV, NLGEORGES::UFormElm::TWhereIsNode wN) - { - parentItem = parent; - itemData = data; - formElm = elm; - whereV = wV; - whereN = wN; - } - - CFormItem::~CFormItem() - { - qDeleteAll(childItems); - } - - void CFormItem::appendChild(CFormItem *item) - { - childItems.append(item); - } - - CFormItem *CFormItem::child(int row) - { - return childItems.value(row); - } - - int CFormItem::childCount() const - { - return childItems.count(); - } - - int CFormItem::columnCount() const - { - //nlinfo("columnCount %d",itemData.count()); - return itemData.count(); - } - - QVariant CFormItem::data(int column) const - { - return itemData.value(column); - } - - CFormItem *CFormItem::parent() - { - return parentItem; - } - - int CFormItem::row() const - { - if (parentItem) - return parentItem->childItems.indexOf(const_cast(this)); - - return 0; - } - - bool CFormItem::setData(int column, const QVariant &value) - { - if (column < 0 || column >= itemData.size()) - return false; - - // TODO: default values - if (!formElm) - return false; - - itemData[column] = value; - if (formElm->isAtom()) - { - const NLGEORGES::UType *type = formElm->getType(); - if (type) - { - switch (type->getType()) - { - case NLGEORGES::UType::UnsignedInt: - case NLGEORGES::UType::SignedInt: - case NLGEORGES::UType::Double: - case NLGEORGES::UType::String: - if (parentItem->formElm->isArray()) - { - //((NLGEORGES::CFormElm*)parentItem->formElm);//->arrayInsertNodeByName( - //if(parentItem->formElm->getArrayNode(elmName, num)) - //{ - //} - - bool ok; - // TODO: the node can be renamed from eg "#0" to "foobar" - int arrayIndex = itemData[0].toString().remove("#").toInt(&ok); - if(ok) - { - NLGEORGES::UFormElm *elmt = 0; - if(parentItem->formElm->getArrayNode(&elmt, arrayIndex) && elmt) - { - if (elmt->isAtom()) - { - ((NLGEORGES::CFormElmAtom*)elmt)->setValue(value.toString().toUtf8().constData()); - nldebug(QString("array element string %1 %2") - .arg(itemData[0].toString()).arg(value.toString()) - .toUtf8().constData()); - } - } - } - } - else - { - if(parentItem->formElm->setValueByName( - value.toString().toUtf8().constData(), - itemData[0].toString().toUtf8().constData())) - { - nldebug(QString("string %1 %2") - .arg(itemData[0].toString()).arg(value.toString()) - .toUtf8().constData()); - } - else - { - nldebug(QString("FAILED string %1 %2") - .arg(itemData[0].toString()).arg(value.toString()) - .toUtf8().constData()); - } - } - break; - case NLGEORGES::UType::Color: - nldebug("Color is TODO"); - break; - default: - break; - } - } - } - else - { - nldebug("setting sth other than Atom"); - } - //formElm->setValueByName(); - return true; - } -} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor.qrc b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor.qrc deleted file mode 100644 index 3d514dbc0..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - images/ic_nel_georges_editor.png - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp deleted file mode 100644 index dd0220bbf..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.cpp +++ /dev/null @@ -1,704 +0,0 @@ -// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework -// Copyright (C) 2011 Adrian Jaekel -// -// 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 "stdpch.h" -#include "georgesform_model.h" -#include "formitem.h" - -// NeL includes -#include -#include -#include -#include -#include -#include - -// Qt includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace NLGEORGES; - -namespace GeorgesQt -{ - - CGeorgesFormModel::CGeorgesFormModel(UFormElm *rootElm, QMap< QString, QStringList> deps, - QString comment, QStringList parents, bool *expanded, QObject *parent) : QAbstractItemModel(parent) - { - - m_rootData << "Value" << "Data" << "Extra";// << "Type"; - m_rootElm = rootElm; - m_rootItem = new CFormItem(m_rootElm, m_rootData); - m_dependencies = deps; - m_comments = comment; - m_parents = parents; - m_parentRows = new QList; - m_expanded = expanded; - - setupModelData(); - } - - CGeorgesFormModel::~CGeorgesFormModel() - { - delete m_rootItem; - } - - /******************************************************************************/ - - QVariant CGeorgesFormModel::data(const QModelIndex &p_index, int p_role) const - { - if (!p_index.isValid()) - return QVariant(); - - switch (p_role) - { - case Qt::DisplayRole: - { - return getItem(p_index)->data(p_index.column()); - } - case Qt::BackgroundRole: - { - QBrush defaultBrush = QBrush(QColor(255,0,0,30)); - QBrush parentBrush = QBrush(QColor(0,255,0,30)); - - // if elm not existing it must be some kind of default or type value - if(!getItem(p_index)->getFormElm()) - { - return defaultBrush; - } - - // else it might be some parent elm - switch (getItem(p_index)->nodeFrom()) - { - case NLGEORGES::UFormElm::NodeParentForm: - { - return parentBrush; - } - case NLGEORGES::UFormElm::NodeForm: - { - switch (getItem(p_index)->valueFrom()) - { - case NLGEORGES::UFormElm::ValueParentForm: - { - return parentBrush; - } - default: - { - // parent status test kindof ugly, testing only 2 steps deep - // only needed for colorization as treeview default hides childs - // when parent is hidden - CFormItem *parent = getItem(p_index)->parent(); - if (parent) - { - if (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm) - { - return parentBrush; - } - - CFormItem *parentParent = parent->parent(); - if (parentParent) - { - if (parentParent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm) - { - return parentBrush; - } - } // endif parentParent - } // endif parent - } // end default - } // end switch valueFrom - } // end case nodeForm - } // end switch nodeFrom - return QVariant(); - } - case Qt::DecorationRole: - { - if (p_index.column() == 2) - { - //p_index. - QModelIndex in = index(p_index.row(),p_index.column()-1,p_index.parent()); - CFormItem *item = getItem(in); - - QString value = item->data(1).toString(); - //QString path = NLMISC::CPath::lookup(value.toUtf8().constData(),false).c_str(); - - /*if (value.contains(".shape")) - { - if (Modules::objViewInt()) - { - QIcon *icon = Modules::objViewInt()->saveOneImage(value.toUtf8().constData()); - if (icon) - { - if(icon->isNull()) - return QIcon(":/images/pqrticles.png"); - else - return QIcon(*icon); - } - else - { - return QIcon(); - } - } - }*/ - if(value.contains(".tga") || value.contains(".png")) - { - QString path = NLMISC::CPath::lookup(value.toUtf8().constData(),false).c_str(); - if(path.isEmpty()) - { - path = ":/images/pqrticles.png"; - } - return QIcon(path); - } - } - return QVariant(); - break; - } - case Qt::ToolTipRole: - { - if (p_index.column() == 2) - { - QModelIndex in = index(p_index.row(),p_index.column()-1,p_index.parent()); - CFormItem *item = getItem(in); - QString value = item->data(1).toString(); - - /*if (value.contains(".shape")) - { - if (Modules::objViewInt()) - { - QIcon *icon = Modules::objViewInt()->saveOneImage(value.toUtf8().constData()); - if (icon) - { - if(icon->isNull()) - return QIcon(":/images/pqrticles.png"); - else - return QIcon(*icon); - } - else - { - return QIcon(); - } - } - }*/ - if(value.contains(".tga") || value.contains(".png")) - { - QString path = NLMISC::CPath::lookup(value.toUtf8().constData(),false).c_str(); - if(path.isEmpty()) - { - path = ":/images/pqrticles.png"; - } - - QString imageTooltip = QString("").arg(path); - - return imageTooltip; - } - } - return QVariant(); - break; - } - default: - return QVariant(); - } - } - - /******************************************************************************/ - - CFormItem *CGeorgesFormModel::getItem(const QModelIndex &index) const - { - if (index.isValid()) - { - CFormItem *item = static_cast(index.internalPointer()); - if (item) - return item; - } - return m_rootItem; - } - - /******************************************************************************/ - - bool CGeorgesFormModel::setData(const QModelIndex &index, const QVariant &value, - int role) - { - - if (role != Qt::EditRole) - return false; - - CFormItem *item = getItem(index); - bool result = item->setData(index.column(), value); - - Q_EMIT dataChanged(index, index); - - //setupModelData(); - return result; - } - - /******************************************************************************/ - - Qt::ItemFlags CGeorgesFormModel::flags(const QModelIndex& index) const { - - if (!index.isValid()) - return 0; - - Qt::ItemFlags returnValue = Qt::ItemIsSelectable | Qt::ItemIsEnabled; - - if(index.column() == 1) - returnValue |= Qt::ItemIsEditable; - - return returnValue; - - } - - /******************************************************************************/ - - QVariant CGeorgesFormModel::headerData(int section, - Qt::Orientation orientation, int role) const - { - if (orientation == Qt::Horizontal) - { - if (role == Qt::DisplayRole) - return m_rootItem->data(section); - if (role == Qt::TextAlignmentRole) - return Qt::AlignLeft; - if (section == 0 && role == Qt::DecorationRole) - { - // transparent pixmap as we paint it ourself with tree brach - // if we extend the HeaderView::paintSection for the CE_HeaderLabel - // we could drop this - QPixmap pixmap = QPixmap( - QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize), - QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize)); - // Create new picture for transparent - QPixmap transparent(pixmap.size()); - - // Do transparency - transparent.fill(Qt::transparent); - QPainter p(&transparent); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.drawPixmap(0, 0, pixmap); - p.setCompositionMode(QPainter::CompositionMode_DestinationIn); - // Set transparency level to 150 (possible values are 0-255) - // The alpha channel of a color specifies the transparency effect, - // 0 represents a fully transparent color, while 255 represents - // a fully opaque color. - p.fillRect(transparent.rect(), QColor(0, 0, 0, 0)); - p.end(); - - // Set original picture's reference to new transparent one - pixmap = transparent; - return pixmap; - } - } - return QVariant(); - } - - /******************************************************************************/ - - QModelIndex CGeorgesFormModel::index(int row, int column, const QModelIndex &parent) - const - { - if (!hasIndex(row, column, parent)) - return QModelIndex(); - - CFormItem *parentItem; - - if (!parent.isValid()) - parentItem = m_rootItem; - else - parentItem = static_cast(parent.internalPointer()); - - CFormItem *childItem = parentItem->child(row); - if (childItem) - return createIndex(row, column, childItem); - else - return QModelIndex(); - } - - /******************************************************************************/ - - QModelIndex CGeorgesFormModel::parent(const QModelIndex &index) const - { - if (!index.isValid()) - return QModelIndex(); - - CFormItem *childItem = static_cast(index.internalPointer()); - CFormItem *parentItem = childItem->parent(); - - if (parentItem == m_rootItem) - return QModelIndex(); - - return createIndex(parentItem->row(), 0, parentItem); - } - - /******************************************************************************/ - - int CGeorgesFormModel::rowCount(const QModelIndex &parent) const { - - CFormItem *parentItem; - if (parent.column() > 0) - return 0; - - if (!parent.isValid()) - parentItem = m_rootItem; - else - parentItem = static_cast(parent.internalPointer()); - - return parentItem->childCount(); - - } - - /******************************************************************************/ - - int CGeorgesFormModel::columnCount(const QModelIndex &parent) const { - - if (parent.isValid()) - return static_cast(parent.internalPointer())->columnCount(); - else - return m_rootItem->columnCount(); - - } - - /******************************************************************************/ - - void CGeorgesFormModel::loadFormData(UFormElm *root, CFormItem *parent) { - - if (!root) - return; - - uint num = 0; - - - if (root->isStruct()) - { - //((CFormElm*)root)->getForm()->getComment(); - uint structSize = 0; - root->getStructSize(structSize); - while (num < structSize) - { - UFormElm::TWhereIsNode *whereN = new UFormElm::TWhereIsNode; - UFormElm::TWhereIsValue *whereV = new UFormElm::TWhereIsValue; - // Append a new item to the current parent's list of children. - std::string elmName; - if(root->getStructNodeName(num, elmName)) - { - QList columnData; - //QVariant value; - std::string value; - //NLMISC::CRGBA value_color; - //uint value_uint; - //sint value_sint; - //double value_double; - QString elmtType; - UFormElm *elmt = 0; - if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true)) - { - if (elmt) - { - if (elmt->isArray()) - elmtType = "Array"; - if (elmt->isStruct()) - elmtType = "Struct"; - if (elmt->isAtom()) - { - elmtType = "Atom"; - uint numDefinitions = 0; - const UType *type = elmt->getType(); - if (type) - { - numDefinitions = type->getNumDefinition(); - root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV); - switch (type->getType()) - { - case UType::UnsignedInt: - { - uint v; - NLMISC::fromString(value, v); - value = NLMISC::toString(v); - elmtType.append("_uint");break; - } - case UType::SignedInt: - { - sint v; - NLMISC::fromString(value, v); - value = NLMISC::toString(v); - elmtType.append("_sint");break; - } - case UType::Double: - float v; - NLMISC::fromString(value, v); - value = NLMISC::toString(v); - elmtType.append("_double");break; - case UType::String: - elmtType.append("_string");break; - case UType::Color: - elmtType.append("_color");break; - default: - elmtType.append("_unknownType"); - } - } - else - { - elmtType.append("_noType"); - } - - if (numDefinitions) - { - std::string l, v; - QString tmpLabel, tmpValue; - for (uint i = 0; i < numDefinitions; i++) - { - type->getDefinition(i,l,v); - tmpLabel = l.c_str(); - tmpValue = v.c_str(); - if (type->getType() == UType::SignedInt) - { - if (QString("%1").arg(value.c_str()).toDouble() == tmpValue.toDouble()) { - value = l; - break; - } - } - if (type->getType() == UType::String) - { - if (QString(value.c_str()) == tmpValue) - { - value = l; - break; - } - } - } - } - } - if (elmt->isVirtualStruct()) - { - root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV); - elmtType = "VirtualStruct"; - } - switch (*whereN) - { - case UFormElm::NodeForm: - elmtType.append("_fromForm"); break; - case UFormElm::NodeParentForm: - elmtType.append("_fromParentForm"); break; - case UFormElm::NodeDfn: - elmtType.append("_isDFN"); break; - case UFormElm::NodeType: - elmtType.append("_isType"); break; - default: - elmtType.append("_noNode"); - } - switch (*whereV) - { - case UFormElm::ValueForm: - elmtType.append("_formValue"); break; - case UFormElm::ValueParentForm: - elmtType.append("_parentValue"); break; - case UFormElm::ValueDefaultDfn: - elmtType.append("_dfnValue"); break; - case UFormElm::ValueDefaultType: - elmtType.append("_typeValue"); break; - default: - elmtType.append("_noValue"); - } - columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType; - parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN)); - //if (parents.last()->childCount() > 0) { - // parents << parents.last()->child(parents.last()->childCount()-1); - //} - loadFormData(elmt, parent->child(parent->childCount()-1)); - } - else - { - // add Defaults - // TODO: spams warnings for non ATOM values but i dont get type of non existing nodes - bool success = root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV); - switch (*whereN) - { - case UFormElm::NodeForm: - elmtType.append("_fromForm"); break; - case UFormElm::NodeParentForm: - elmtType.append("_fromParentForm"); break; - case UFormElm::NodeDfn: - elmtType.append("_isDFN"); break; - case UFormElm::NodeType: - elmtType.append("_isType"); break; - default: - elmtType.append("_noNode"); - } - switch (*whereV) - { - case UFormElm::ValueForm: - elmtType.append("_formValue"); break; - case UFormElm::ValueParentForm: - elmtType.append("_parentValue"); break; - case UFormElm::ValueDefaultDfn: - elmtType.append("_dfnValue"); break; - case UFormElm::ValueDefaultType: - elmtType.append("_typeValue"); break; - default: - elmtType.append("_noValue"); - } - - columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType; - parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN)); - } - } - else - { - nlinfo("getNodeByName returned false"); - } - } - num++; - } - } - if (root->isArray()) - { - uint arraySize = 0; - root->getArraySize(arraySize); - while (num < arraySize) - { - std::string elmName; - if(root->getArrayNodeName(elmName, num)) - { - QList columnData; - std::string value; - QString elmtType; - - UFormElm *elmt = 0; - if(root->getArrayNode(&elmt,0) && elmt) - { - if (elmt->isArray()) - elmtType = "Array"; - if (elmt->isStruct()) { - elmtType = "Struct"; - } - if (elmt->isAtom()) - { - elmt->getValue(value); - elmtType = "Atom"; - } - if (elmt->isVirtualStruct()) - elmtType = "VirtualStruct"; - - elmtType.append("_arrayValue"); - columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType; - parent->appendChild(new CFormItem(elmt, columnData, parent)); - loadFormData(elmt, parent->child(parent->childCount()-1)); - } - } - num++; - } - } - } - - /******************************************************************************/ - - void CGeorgesFormModel::loadFormHeader() - { - - if (m_parents.size()) - { - CFormItem *fi_pars = new CFormItem(m_rootElm, QList() << "parents" << "" << "", m_rootItem); - m_rootItem->appendChild(fi_pars); - - Q_FOREACH(QString str, m_parents) - { - fi_pars->appendChild(new CFormItem(m_rootElm, QList() << str << "" << "", fi_pars)); - } - } - - /*QStringList dfns = _dependencies["dfn"]; - QStringList typs = _dependencies["typ"]; - - _dependencies.remove("dfn"); - _dependencies.remove("typ"); - - CFormItem *fi_dep = new CFormItem(_rootElm, QList() << "dependencies", _rootItem); - _rootItem->appendChild(fi_dep); - - if (!dfns.isEmpty()) { - CFormItem *fi_dfn = new CFormItem(_rootElm, QList() << "dfn", fi_dep); - fi_dep->appendChild(fi_dfn); - foreach(QString str, dfns) { - fi_dfn->appendChild(new CFormItem(_rootElm, QList() << str, fi_dfn)); - } - } - if (!typs.isEmpty()) { - CFormItem *fi_typ = new CFormItem(_rootElm, QList() << "typ", fi_dep); - fi_dep->appendChild(fi_typ); - foreach(QString str, typs) { - fi_typ->appendChild(new CFormItem(_rootElm, QList() << str, fi_typ)); - } - } - if (!_dependencies.isEmpty()) { - CFormItem *fi_other = new CFormItem(_rootElm, QList() << "other", fi_dep); - fi_dep->appendChild(fi_other); - foreach(QStringList list, _dependencies) { - foreach(QString str, list) { - fi_other->appendChild(new CFormItem(_rootElm, QList() << str, fi_other)); - } - } - }*/ - } - - /******************************************************************************/ - - void CGeorgesFormModel::setupModelData() - { - loadFormHeader(); - loadFormData(m_rootElm, m_rootItem); - } - - /******************************************************************************/ - - void CGeorgesFormModel::setShowParents( bool show ) { - m_showParents = show; - Q_EMIT layoutAboutToBeChanged(); - Q_EMIT layoutChanged(); - } - void CGeorgesFormModel::setShowDefaults( bool show ) - { - m_showDefaults = show; - Q_EMIT layoutAboutToBeChanged(); - Q_EMIT layoutChanged(); - } - - void CGeorgesFormModel::addParentForm(QString parentForm) - { - beginResetModel(); - m_parents.push_back(parentForm); - delete m_rootItem; - m_rootItem = new CFormItem(m_rootElm, m_rootData); - setupModelData(); - endResetModel(); - } - - void CGeorgesFormModel::removeParentForm(QString parentForm) - { - beginResetModel(); - m_parents.removeOne(parentForm); - - delete m_rootItem; - m_rootItem = new CFormItem(m_rootElm, m_rootData); - setupModelData(); - endResetModel(); - } -} /* namespace GeorgesQt */ - -/* end of file */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.cpp deleted file mode 100644 index 3fd7abb7b..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.cpp +++ /dev/null @@ -1,174 +0,0 @@ -// Object Viewer Qt GUI Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// 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 "nel3d_widget.h" -#include "nel/3d/u_driver.h" -#include "nel/3d/text_context.h" -#include "nel/3d/driver_user.h" -#include "nel/misc/rgba.h" -#include "nel/misc/path.h" -#include "nel/misc/event_listener.h" -#include "nel/gui/event_listener.h" - -#ifdef NL_OS_WINDOWS -#include -#endif - - - -namespace GUIEditor -{ - Nel3DWidget::Nel3DWidget( QWidget *parent ) : - QWidget( parent ) - { - driver = NULL; - textContext = NULL; - - // Need to set this attribute with a NULL paintengine returned to Qt - // so that we can render the widget normally ourselves, without the image - // disappearing when a widget is resized or shown on top of us - setAttribute( Qt::WA_PaintOnScreen, true ); - eventListener = NULL; - } - - Nel3DWidget::~Nel3DWidget() - { - if( driver != NULL ) - { - if( textContext != NULL ) - { - driver->deleteTextContext( textContext ); - textContext = NULL; - } - - driver->release(); - delete driver; - driver = NULL; - } - delete eventListener; - } - - void Nel3DWidget::init() - { - nlassert( driver == NULL ); - - driver = NL3D::UDriver::createDriver( 0, false, 0 ); - driver->setMatrixMode2D11(); - driver->setDisplay( winId(), NL3D::UDriver::CMode( width(), height(), 32, true ) ); - eventListener = new NLGUI::CEventListener(); - eventListener->addToServer( &driver->EventServer ); - } - - void Nel3DWidget::createTextContext( std::string fontFile ) - { - if( driver == NULL ) - return; - - std::string font; - - try - { - font = NLMISC::CPath::lookup( fontFile ); - } - catch( ... ) - { - nlinfo( "Font %s cannot be found, cannot create textcontext!", fontFile.c_str() ); - exit( EXIT_FAILURE ); - } - - if( textContext != NULL ) - { - driver->deleteTextContext( textContext ); - textContext = NULL; - } - - textContext = driver->createTextContext( font ); - } - - void Nel3DWidget::clear() - { - if( driver == NULL ) - return; - driver->clearBuffers( NLMISC::CRGBA::Black ); - driver->swapBuffers(); - } - - -#if defined ( NL_OS_WINDOWS ) - - typedef bool ( *winProc )( NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); - - bool Nel3DWidget::winEvent( MSG *message, long *result ) - { - if( driver != NULL ) - { - NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver(); - if( iDriver != NULL ) - { - winProc proc = (winProc)iDriver->getWindowProc(); - return proc( iDriver, message->hwnd, message->message, message->wParam, message->lParam ); - } - } - - return false; - } - -#elif defined( NL_OS_MAC ) - - typedef bool ( *cocoaProc )( NL3D::IDriver *, const void *e ); - - bool Nel3DWidget::macEvent( EventHandlerCallRef caller, EventRef event ) - { - if( caller ) - nlerror( "You are using QtCarbon! Only QtCocoa supported, please upgrade Qt" ); - - if( driver != NULL ) - { - NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver(); - if( iDriver != NULL ) - { - cocoaProc proc = ( cocoaProc )iDriver->getWindowProc(); - return proc( iDriver, event ); - } - } - - return false; - } - -#elif defined( NL_OS_UNIX ) - - typedef bool ( *x11Proc )( NL3D::IDriver *drv, XEvent *e ); - - bool Nel3DWidget::x11Event( XEvent *event ) - { - if( driver != NULL ) - { - NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver(); - if( driver != NULL ) - { - x11Proc proc = ( x11Proc )iDriver->getWindowProc(); - return proc( iDriver, event ); - } - } - - return false; - } -#endif - -} - - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.h deleted file mode 100644 index fb4321d49..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nel3d_widget.h +++ /dev/null @@ -1,79 +0,0 @@ -// Object Viewer Qt GUI Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// 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 NEL3D_WIDGET_H -#define NEL3D_WIDGET_H - -#include -#include "nel/misc/types_nl.h" -#include - -namespace NLGUI -{ - class CEventListener; -} - -namespace NL3D -{ - class UDriver; - class UTextContext; -} - -namespace GUIEditor -{ - /// Nel 3D interface to Qt - class Nel3DWidget : public QWidget - { - Q_OBJECT - public: - Nel3DWidget( QWidget *parent = NULL ); - virtual ~Nel3DWidget(); - - virtual void init(); - void createTextContext( std::string fontFile ); - - NL3D::UDriver* getDriver() const{ return driver; } - NL3D::UTextContext* getTextContext() const{ return textContext; } - - - // Need to return NULL paintengine to Qt so that we can - // render the widget normally ourselves, without the image - // disappearing when a widget is resized or shown on top of us - QPaintEngine* paintEngine() const{ return NULL; } - - public Q_SLOTS: - void clear(); - - protected: - -#if defined(NL_OS_WINDOWS) - virtual bool winEvent( MSG *message, long *result ); -#elif defined(NL_OS_MAC) - virtual bool macEvent( EventHandlerCallRef caller, EventRef event ); -#elif defined(NL_OS_UNIX) - virtual bool x11Event( XEvent *event ); -#endif - - private: - NL3D::UDriver *driver; - NL3D::UTextContext *textContext; - NLGUI::CEventListener *eventListener; - }; -} - -#endif - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.cpp deleted file mode 100644 index 82330bfaf..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.cpp +++ /dev/null @@ -1,173 +0,0 @@ -// Object Viewer Qt GUI Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// 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 "property_browser_ctrl.h" -#include "../../3rdparty/qtpropertybrowser/QtVariantPropertyManager" -#include "../../3rdparty/qtpropertybrowser/QtTreePropertyBrowser" -#include "nel/gui/interface_group.h" -#include "nel/gui/widget_manager.h" -#include -#include "widget_info_tree.h" - -namespace GUIEditor -{ - CPropBrowserCtrl::CPropBrowserCtrl() - { - browser = NULL; - propertyMgr = new QtVariantPropertyManager; - } - - CPropBrowserCtrl::~CPropBrowserCtrl() - { - delete propertyMgr; - propertyMgr = NULL; - browser = NULL; - } - - void CPropBrowserCtrl::setBrowser( QtTreePropertyBrowser *b ) - { - browser = b; - } - - void CPropBrowserCtrl::setupWidgetInfo( CWidgetInfoTree *tree ) - { - widgetInfo.clear(); - - std::vector< std::string > names; - tree->getNames( names ); - - std::vector< std::string >::const_iterator itr; - for( itr = names.begin(); itr != names.end(); ++itr ) - { - CWidgetInfoTreeNode *node = tree->findNodeByName( *itr ); - const SWidgetInfo &w = node->getInfo(); - widgetInfo[ w.GUIName ] = w; - } - } - - void CPropBrowserCtrl::clear() - { - browser->clear(); - disconnect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ), - this, SLOT( onPropertyChanged( QtProperty* ) ) ); - } - - void CPropBrowserCtrl::onSelectionChanged( std::string &id ) - { - if( browser == NULL ) - return; - - disconnect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ), - this, SLOT( onPropertyChanged( QtProperty* ) ) ); - - browser->clear(); - - CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( id ); - if( e == NULL ) - { - connect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ), - this, SLOT( onPropertyChanged( QtProperty* ) ) ); - - return; - } - - currentElement = id; - - std::string n = e->getClassName(); - - setupProperties( n, e ); - connect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ), - this, SLOT( onPropertyChanged( QtProperty* ) ) ); - } - - void CPropBrowserCtrl::onPropertyChanged( QtProperty *prop ) - { - QString propName = prop->propertyName(); - QString propValue = prop->valueText(); - - // for some reason booleans cannot be extracted from a QtProperty :( - if( propValue.isEmpty() ) - { - QtVariantProperty *p = propertyMgr->variantProperty( prop ); - if( p != NULL ) - propValue = p->value().toString(); - } - - CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement ); - if( e == NULL ) - return; - e->setProperty( propName.toUtf8().constData(), propValue.toUtf8().constData() ); - - - // Make sure the changes are applied - bool active = e->getActive(); - e->setActive( !active ); - e->setActive( active ); - } - - void CPropBrowserCtrl::setupProperties( const std::string &type, const CInterfaceElement *element ) - { - std::map< std::string, SWidgetInfo >::iterator itr = widgetInfo.find( type ); - if( itr == widgetInfo.end() ) - return; - SWidgetInfo &w = itr->second; - - std::vector< SPropEntry >::const_iterator pItr; - for( pItr = w.props.begin(); pItr != w.props.end(); ++pItr ) - { - const SPropEntry &prop = *pItr; - setupProperty( prop, element ); - } - - QtVariantEditorFactory *factory = new QtVariantEditorFactory; - browser->setFactoryForManager( propertyMgr, factory ); - } - - void CPropBrowserCtrl::setupProperty( const SPropEntry &prop, const CInterfaceElement *element ) - { - QtVariantProperty *p = NULL; - QVariant v; - - if( prop.propType == "string" ) - { - p = propertyMgr->addProperty( QVariant::String, prop.propName.c_str() ); - v = element->getProperty( prop.propName ).c_str(); - } - else - if( prop.propType == "bool" ) - { - p = propertyMgr->addProperty( QVariant::Bool, prop.propName.c_str() ); - bool value = false; - NLMISC::fromString( element->getProperty( prop.propName ), value ); - v = value; - } - else - if( prop.propType == "int" ) - { - p = propertyMgr->addProperty( QVariant::Int, prop.propName.c_str() ); - sint32 value = 0; - NLMISC::fromString( element->getProperty( prop.propName ), value ); - v = value; - } - - if( p == NULL ) - return; - - p->setValue( v ); - browser->addProperty( p ); - } -} 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 deleted file mode 100644 index d8e36e785..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/* - Object Viewer Qt - Copyright (C) 2010 Dzmitry Kamiahin - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -*/ - -#include "stdpch.h" -#include "graphics_viewport.h" - -// STL includes - -// Qt includes -#include -#include -#include -#include - -// NeL includes -#include - -#include -#include - -#include -#include - -// Project includes -#include "modules.h" - -using namespace std; -using namespace NL3D; - -namespace NLQT -{ - -CGraphicsViewport::CGraphicsViewport(QWidget *parent) - : QNLWidget(parent) -{ - setAttribute(Qt::WA_OpaquePaintEvent); - setAttribute(Qt::WA_NoSystemBackground); - setAttribute(Qt::WA_PaintOnScreen); -} - -CGraphicsViewport::~CGraphicsViewport() -{ - -} - -void CGraphicsViewport::init() -{ - //H_AUTO2 - nldebug("CGraphicsViewport::init"); - -#if defined(NL_OS_UNIX) && !defined(NL_OS_MAC) - makeCurrent(); -#endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC) - - Modules::objView().init((nlWindow)winId(), width(), height()); - Modules::psEdit().init(); - Modules::veget().init(); - - setMouseTracking(true); - setFocusPolicy(Qt::StrongFocus); -} - -void CGraphicsViewport::release() -{ - //H_AUTO2 - nldebug("CGraphicsViewport::release"); - - Modules::veget().release(); - Modules::psEdit().release(); - Modules::objView().release(); -} - - -QAction *CGraphicsViewport::createSaveScreenshotAction(QObject *parent) -{ - QAction *action = new QAction(parent); - connect(action, SIGNAL(triggered()), this, SLOT(saveScreenshot())); - return action; -} - -QAction *CGraphicsViewport::createSetBackgroundColor(QObject *parent) -{ - QAction *action = new QAction(parent); - connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundColor())); - return action; -} - -void CGraphicsViewport::saveScreenshot() -{ - Modules::objView().saveScreenshot("screenshot", false, true, false); -} - -void CGraphicsViewport::setBackgroundColor() -{ - QColor color = QColorDialog::getColor(QColor(Modules::objView().getBackgroundColor().R, - Modules::objView().getBackgroundColor().G, - Modules::objView().getBackgroundColor().B)); - if (color.isValid()) - Modules::objView().setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue())); -} - -void CGraphicsViewport::resizeEvent(QResizeEvent *resizeEvent) -{ - QWidget::resizeEvent(resizeEvent); - if (Modules::objView().getDriver()) - Modules::objView().setSizeViewport(resizeEvent->size().width(), resizeEvent->size().height()); -} - -#if defined(NL_OS_WINDOWS) - -typedef bool (*winProc)(NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - -bool CGraphicsViewport::winEvent(MSG *message, long *result) -{ - if (Modules::objView().getDriver() && Modules::objView().getDriver()->isActive()) - { - NL3D::IDriver *driver = dynamic_cast(Modules::objView().getDriver())->getDriver(); - if (driver) - { - winProc proc = (winProc)driver->getWindowProc(); - - // TODO: shouldn't it return false like the others? - // see macEvent() and x11Event() below - return proc(driver, message->hwnd, message->message, message->wParam, message->lParam); - } - } - - return false; -} - -#elif defined(NL_OS_MAC) - -typedef bool (*cocoaProc)(NL3D::IDriver *, const void *e); - -bool CGraphicsViewport::macEvent(EventHandlerCallRef caller, EventRef event) -{ - if(caller) - nlerror("You are using QtCarbon! Only QtCocoa supported, please upgrade Qt"); - - if (Modules::objView().getDriver() && Modules::objView().getDriver()->isActive()) - { - NL3D::IDriver *driver = dynamic_cast(Modules::objView().getDriver())->getDriver(); - if (driver) - { - cocoaProc proc = (cocoaProc)driver->getWindowProc(); - proc(driver, event); - } - } - - // return false to let Qt handle the event as well, - // else the widget would never get focus - return false; -} - -#elif defined(NL_OS_UNIX) - -typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e); - -bool CGraphicsViewport::x11Event(XEvent *event) -{ - if (Modules::objView().getDriver() && Modules::objView().getDriver()->isActive()) - { - NL3D::IDriver *driver = dynamic_cast(Modules::objView().getDriver())->getDriver(); - if (driver) - { - x11Proc proc = (x11Proc)driver->getWindowProc(); - proc(driver, event); - } - } - - // return false to let Qt handle the event as well, - // else the widget would never get focus - // TODO: test me please, i have no linux at hand (rti) - return false; -} -#endif - -} /* namespace NLQT */ - diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/CMakeLists.txt deleted file mode 100644 index 34f237757..000000000 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -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_SHEET_BUILDER_HDR sheetbuilderconfgdialog.h sheetbuilderdialog.h ovqt_sheet_builder.h) - -SET(QT_USE_QTGUI TRUE) -SET(QT_USE_QTOPENGL TRUE) - -QT4_WRAP_CPP(OVQT_PLUG_SHEET_BUILDER_MOC_SRC ${OVQT_PLUG_SHEET_BUILDER_HDR}) - -SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_SHEET_BUILDER_MOC_SRC}) -SOURCE_GROUP("Sheet builder Plugin" FILES ${SRC}) -SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) - -ADD_LIBRARY(ovqt_plugin_sheet_builder MODULE ${SRC} ${OVQT_PLUG_SHEET_BUILDER_MOC_SRC} ${OVQT_EXT_SYS_SRC}) - -TARGET_LINK_LIBRARIES(ovqt_plugin_sheet_builder ovqt_plugin_core nelmisc ${QT_LIBRARIES}) - -NL_DEFAULT_PROPS(ovqt_plugin_sheet_builder "NeL, Tools, 3D: Object Viewer Qt Plugin: Sheet builder") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_sheet_builder) -NL_ADD_LIB_SUFFIX(ovqt_plugin_sheet_builder) - -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) - - -IF(WIN32) - IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) - ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) - ENDIF(WITH_INSTALL_LIBRARIES) -ELSE(WIN32) - IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) - ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) - ENDIF(WITH_INSTALL_LIBRARIES) -ENDIF(WIN32) - -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_sheet_builder.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) - diff --git a/code/nel/tools/3d/object_viewer_qt/CMakeLists.txt b/code/studio/CMakeLists.txt similarity index 79% rename from code/nel/tools/3d/object_viewer_qt/CMakeLists.txt rename to code/studio/CMakeLists.txt index ff1128b9f..bf9ee062c 100644 --- a/code/nel/tools/3d/object_viewer_qt/CMakeLists.txt +++ b/code/studio/CMakeLists.txt @@ -16,9 +16,9 @@ ELSEIF(APPLE) SET(OVQT_PLUGIN_DIR "plugins") SET(OVQT_DATA_DIR ".") ELSE(WIN32) - SET(OVQT_PLUGIN_SPECS_DIR ${NL_SHARE_PREFIX}/object_viewer_qt/plugins) - SET(OVQT_PLUGIN_DIR ${NL_LIB_PREFIX}/object_viewer_qt) - SET(OVQT_DATA_DIR ${NL_SHARE_PREFIX}/object_viewer_qt/data) + SET(OVQT_PLUGIN_SPECS_DIR ${NL_SHARE_PREFIX}/studio/plugins) + SET(OVQT_PLUGIN_DIR ${NL_LIB_PREFIX}/studio) + SET(OVQT_DATA_DIR ${NL_SHARE_PREFIX}/studio/data) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ovqt_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/ovqt_config.h) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) @@ -27,7 +27,7 @@ ELSE(WIN32) ENDIF(WIN32) IF(UNIX AND WITH_STATIC) - MESSAGE(FATAL_ERROR "OVQT does not work with static NeL builds on Unix atm.") + MESSAGE(FATAL_ERROR "Studio does not work with static NeL builds on Unix atm.") ENDIF() ADD_SUBDIRECTORY(src) diff --git a/code/nel/tools/3d/object_viewer_qt/data/andbasr.ttf b/code/studio/data/andbasr.ttf similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/data/andbasr.ttf rename to code/studio/data/andbasr.ttf diff --git a/code/nel/tools/3d/object_viewer_qt/doc/html/cdirection_widget.png b/code/studio/doc/html/cdirection_widget.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/doc/html/cdirection_widget.png rename to code/studio/doc/html/cdirection_widget.png diff --git a/code/nel/tools/3d/object_viewer_qt/doc/html/cedit_color_widget.png b/code/studio/doc/html/cedit_color_widget.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/doc/html/cedit_color_widget.png rename to code/studio/doc/html/cedit_color_widget.png diff --git a/code/nel/tools/3d/object_viewer_qt/doc/html/cedit_range_float_widget.png b/code/studio/doc/html/cedit_range_float_widget.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/doc/html/cedit_range_float_widget.png rename to code/studio/doc/html/cedit_range_float_widget.png diff --git a/code/nel/tools/3d/object_viewer_qt/doc/html/cedit_range_int_widget.png b/code/studio/doc/html/cedit_range_int_widget.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/doc/html/cedit_range_int_widget.png rename to code/studio/doc/html/cedit_range_int_widget.png diff --git a/code/nel/tools/3d/object_viewer_qt/doc/html/gui_struct.png b/code/studio/doc/html/gui_struct.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/doc/html/gui_struct.png rename to code/studio/doc/html/gui_struct.png diff --git a/code/nel/tools/3d/object_viewer_qt/doc/html/object_viewer_qt_window.png b/code/studio/doc/html/object_viewer_qt_window.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/doc/html/object_viewer_qt_window.png rename to code/studio/doc/html/object_viewer_qt_window.png diff --git a/code/nel/tools/3d/object_viewer_qt/doc/make_ovqt_dox.bat b/code/studio/doc/make_ovqt_dox.bat similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/doc/make_ovqt_dox.bat rename to code/studio/doc/make_ovqt_dox.bat diff --git a/code/nel/tools/3d/object_viewer_qt/doc/make_ovqt_dox.sh b/code/studio/doc/make_ovqt_dox.sh similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/doc/make_ovqt_dox.sh rename to code/studio/doc/make_ovqt_dox.sh diff --git a/code/nel/tools/3d/object_viewer_qt/doc/ovqt.dox b/code/studio/doc/ovqt.dox similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/doc/ovqt.dox rename to code/studio/doc/ovqt.dox diff --git a/code/studio/ovqt_config.h.cmake b/code/studio/ovqt_config.h.cmake new file mode 100644 index 000000000..9d4907473 --- /dev/null +++ b/code/studio/ovqt_config.h.cmake @@ -0,0 +1,7 @@ +#ifndef OVQT_CONFIG_H +#define OVQT_CONFIG_H + +#define DATA_DIR "${NL_SHARE_ABSOLUTE_PREFIX}/studio" +#define PLUGINS_DIR "${NL_LIB_ABSOLUTE_PREFIX}/studio" + +#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/CMakeLists.txt b/code/studio/src/3rdparty/CMakeLists.txt similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/CMakeLists.txt rename to code/studio/src/3rdparty/CMakeLists.txt diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/CMakeLists.txt b/code/studio/src/3rdparty/qtpropertybrowser/CMakeLists.txt similarity index 97% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/CMakeLists.txt rename to code/studio/src/3rdparty/qtpropertybrowser/CMakeLists.txt index f4ed13e0a..fa834dabf 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/CMakeLists.txt +++ b/code/studio/src/3rdparty/qtpropertybrowser/CMakeLists.txt @@ -96,3 +96,5 @@ ADD_DEFINITIONS(-DQT_SHARED) NL_DEFAULT_PROPS(qt_property_browser "3rdParty: Qt Property Browser 2.5") NL_ADD_RUNTIME_FLAGS(qt_property_browser) NL_ADD_LIB_SUFFIX(qt_property_browser) + +INSTALL(TARGETS qt_property_browser LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/LGPL_EXCEPTION.txt b/code/studio/src/3rdparty/qtpropertybrowser/LGPL_EXCEPTION.txt similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/LGPL_EXCEPTION.txt rename to code/studio/src/3rdparty/qtpropertybrowser/LGPL_EXCEPTION.txt diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/LICENSE.GPL3 b/code/studio/src/3rdparty/qtpropertybrowser/LICENSE.GPL3 similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/LICENSE.GPL3 rename to code/studio/src/3rdparty/qtpropertybrowser/LICENSE.GPL3 diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/LICENSE.LGPL b/code/studio/src/3rdparty/qtpropertybrowser/LICENSE.LGPL similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/LICENSE.LGPL rename to code/studio/src/3rdparty/qtpropertybrowser/LICENSE.LGPL diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtAbstractEditorFactoryBase b/code/studio/src/3rdparty/qtpropertybrowser/QtAbstractEditorFactoryBase similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtAbstractEditorFactoryBase rename to code/studio/src/3rdparty/qtpropertybrowser/QtAbstractEditorFactoryBase diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtAbstractPropertyBrowser b/code/studio/src/3rdparty/qtpropertybrowser/QtAbstractPropertyBrowser similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtAbstractPropertyBrowser rename to code/studio/src/3rdparty/qtpropertybrowser/QtAbstractPropertyBrowser diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtAbstractPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtAbstractPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtAbstractPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtAbstractPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtBoolPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtBoolPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtBoolPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtBoolPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtBrowserItem b/code/studio/src/3rdparty/qtpropertybrowser/QtBrowserItem similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtBrowserItem rename to code/studio/src/3rdparty/qtpropertybrowser/QtBrowserItem diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtButtonPropertyBrowser b/code/studio/src/3rdparty/qtpropertybrowser/QtButtonPropertyBrowser similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtButtonPropertyBrowser rename to code/studio/src/3rdparty/qtpropertybrowser/QtButtonPropertyBrowser diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtCharEditorFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtCharEditorFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtCharEditorFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtCharEditorFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtCharPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtCharPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtCharPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtCharPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtCheckBoxFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtCheckBoxFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtCheckBoxFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtCheckBoxFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtColorEditorFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtColorEditorFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtColorEditorFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtColorEditorFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtColorPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtColorPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtColorPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtColorPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtCursorEditorFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtCursorEditorFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtCursorEditorFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtCursorEditorFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtCursorPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtCursorPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtCursorPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtCursorPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtDateEditFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtDateEditFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtDateEditFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtDateEditFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtDatePropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtDatePropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtDatePropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtDatePropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtDateTimeEditFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtDateTimeEditFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtDateTimeEditFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtDateTimeEditFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtDateTimePropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtDateTimePropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtDateTimePropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtDateTimePropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtDoublePropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtDoublePropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtDoublePropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtDoublePropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtDoubleSpinBoxFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtDoubleSpinBoxFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtDoubleSpinBoxFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtDoubleSpinBoxFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtEnumEditorFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtEnumEditorFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtEnumEditorFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtEnumEditorFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtEnumPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtEnumPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtEnumPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtEnumPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtFlagPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtFlagPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtFlagPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtFlagPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtFontEditorFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtFontEditorFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtFontEditorFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtFontEditorFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtFontPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtFontPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtFontPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtFontPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtGroupBoxPropertyBrowser b/code/studio/src/3rdparty/qtpropertybrowser/QtGroupBoxPropertyBrowser similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtGroupBoxPropertyBrowser rename to code/studio/src/3rdparty/qtpropertybrowser/QtGroupBoxPropertyBrowser diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtGroupPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtGroupPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtGroupPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtGroupPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtIntPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtIntPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtIntPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtIntPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtKeySequenceEditorFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtKeySequenceEditorFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtKeySequenceEditorFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtKeySequenceEditorFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtKeySequencePropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtKeySequencePropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtKeySequencePropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtKeySequencePropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtLineEditFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtLineEditFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtLineEditFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtLineEditFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtLocalePropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtLocalePropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtLocalePropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtLocalePropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtPointFPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtPointFPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtPointFPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtPointFPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtPointPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtPointPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtPointPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtPointPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtProperty b/code/studio/src/3rdparty/qtpropertybrowser/QtProperty similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtProperty rename to code/studio/src/3rdparty/qtpropertybrowser/QtProperty diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtRectFPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtRectFPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtRectFPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtRectFPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtRectPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtRectPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtRectPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtRectPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtScrollBarFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtScrollBarFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtScrollBarFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtScrollBarFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtSizeFPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtSizeFPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtSizeFPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtSizeFPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtSizePolicyPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtSizePolicyPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtSizePolicyPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtSizePolicyPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtSizePropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtSizePropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtSizePropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtSizePropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtSliderFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtSliderFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtSliderFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtSliderFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtSpinBoxFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtSpinBoxFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtSpinBoxFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtSpinBoxFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtStringPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtStringPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtStringPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtStringPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtTimeEditFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtTimeEditFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtTimeEditFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtTimeEditFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtTimePropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtTimePropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtTimePropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtTimePropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtTreePropertyBrowser b/code/studio/src/3rdparty/qtpropertybrowser/QtTreePropertyBrowser similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtTreePropertyBrowser rename to code/studio/src/3rdparty/qtpropertybrowser/QtTreePropertyBrowser diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtVariantEditorFactory b/code/studio/src/3rdparty/qtpropertybrowser/QtVariantEditorFactory similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtVariantEditorFactory rename to code/studio/src/3rdparty/qtpropertybrowser/QtVariantEditorFactory diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtVariantProperty b/code/studio/src/3rdparty/qtpropertybrowser/QtVariantProperty similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtVariantProperty rename to code/studio/src/3rdparty/qtpropertybrowser/QtVariantProperty diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtVariantPropertyManager b/code/studio/src/3rdparty/qtpropertybrowser/QtVariantPropertyManager similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/QtVariantPropertyManager rename to code/studio/src/3rdparty/qtpropertybrowser/QtVariantPropertyManager diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/README.TXT b/code/studio/src/3rdparty/qtpropertybrowser/README.TXT similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/README.TXT rename to code/studio/src/3rdparty/qtpropertybrowser/README.TXT diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-arrow.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-arrow.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-arrow.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-arrow.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-busy.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-busy.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-busy.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-busy.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-closedhand.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-closedhand.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-closedhand.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-closedhand.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-cross.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-cross.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-cross.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-cross.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-forbidden.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-forbidden.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-forbidden.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-forbidden.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-hand.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-hand.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-hand.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-hand.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-hsplit.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-hsplit.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-hsplit.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-hsplit.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-ibeam.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-ibeam.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-ibeam.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-ibeam.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-openhand.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-openhand.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-openhand.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-openhand.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-sizeall.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-sizeall.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-sizeall.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-sizeall.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-sizeb.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-sizeb.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-sizeb.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-sizeb.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-sizef.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-sizef.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-sizef.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-sizef.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-sizeh.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-sizeh.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-sizeh.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-sizeh.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-sizev.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-sizev.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-sizev.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-sizev.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-uparrow.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-uparrow.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-uparrow.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-uparrow.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-vsplit.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-vsplit.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-vsplit.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-vsplit.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-wait.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-wait.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-wait.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-wait.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-whatsthis.png b/code/studio/src/3rdparty/qtpropertybrowser/images/cursor-whatsthis.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/cursor-whatsthis.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/cursor-whatsthis.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/resetproperty.png b/code/studio/src/3rdparty/qtpropertybrowser/images/resetproperty.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/images/resetproperty.png rename to code/studio/src/3rdparty/qtpropertybrowser/images/resetproperty.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.cpp rename to code/studio/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.h b/code/studio/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.h rename to code/studio/src/3rdparty/qtpropertybrowser/qtbuttonpropertybrowser.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qteditorfactory.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qteditorfactory.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qteditorfactory.cpp rename to code/studio/src/3rdparty/qtpropertybrowser/qteditorfactory.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qteditorfactory.h b/code/studio/src/3rdparty/qtpropertybrowser/qteditorfactory.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qteditorfactory.h rename to code/studio/src/3rdparty/qtpropertybrowser/qteditorfactory.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.cpp rename to code/studio/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.h b/code/studio/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.h rename to code/studio/src/3rdparty/qtpropertybrowser/qtgroupboxpropertybrowser.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertybrowser.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertybrowser.cpp rename to code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertybrowser.h b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertybrowser.h rename to code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertybrowser.pri b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.pri similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertybrowser.pri rename to code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.pri diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertybrowser.qrc b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.qrc similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertybrowser.qrc rename to code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowser.qrc diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils.cpp rename to code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils_p.h b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils_p.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils_p.h rename to code/studio/src/3rdparty/qtpropertybrowser/qtpropertybrowserutils_p.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertymanager.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertymanager.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertymanager.cpp rename to code/studio/src/3rdparty/qtpropertybrowser/qtpropertymanager.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertymanager.h b/code/studio/src/3rdparty/qtpropertybrowser/qtpropertymanager.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtpropertymanager.h rename to code/studio/src/3rdparty/qtpropertybrowser/qtpropertymanager.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.cpp rename to code/studio/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.h b/code/studio/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.h rename to code/studio/src/3rdparty/qtpropertybrowser/qttreepropertybrowser.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtvariantproperty.cpp b/code/studio/src/3rdparty/qtpropertybrowser/qtvariantproperty.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtvariantproperty.cpp rename to code/studio/src/3rdparty/qtpropertybrowser/qtvariantproperty.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtvariantproperty.h b/code/studio/src/3rdparty/qtpropertybrowser/qtvariantproperty.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/3rdparty/qtpropertybrowser/qtvariantproperty.h rename to code/studio/src/3rdparty/qtpropertybrowser/qtvariantproperty.h diff --git a/code/studio/src/CMakeLists.txt b/code/studio/src/CMakeLists.txt new file mode 100644 index 000000000..9bc071bf2 --- /dev/null +++ b/code/studio/src/CMakeLists.txt @@ -0,0 +1,60 @@ +ADD_SUBDIRECTORY(3rdparty) + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LIBXML2_INCLUDE_DIR} ${NEL_INCLUDE_DIR} ${QT_INCLUDES}) +INCLUDE( ${QT_USE_FILE} ) + +CONFIGURE_FILE(translations/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY) + +FILE(GLOB STUDIO_SRC extension_system/*.h + extension_system/*.cpp + *.h *.cpp) + +SET(STUDIO_HDR extension_system/iplugin_manager.h + extension_system/plugin_manager.h + settings_dialog.h + splash_screen.h + pm_watcher.h ) + +SET(STUDIO_RCS studio.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc) + +SET(STUDIO_TS translations/object_viewer_qt_en.ts + translations/object_viewer_qt_fr.ts + translations/object_viewer_qt_de.ts + translations/object_viewer_qt_ru.ts) + +SET(STUDIO_PLUGIN_UIS settings_dialog.ui ) + +SET(QT_USE_QTGUI TRUE) +SET(QT_USE_QTOPENGL TRUE) + +IF(WIN32) + SET(STUDIO_RC studio.rc) +ENDIF(WIN32) + +QT4_ADD_TRANSLATION(STUDIO_QM ${STUDIO_TS}) +QT4_ADD_RESOURCES( STUDIO_RC_SRCS ${STUDIO_RCS}) +QT4_WRAP_CPP( STUDIO_MOC_SRCS ${STUDIO_HDR} ) +QT4_WRAP_UI( STUDIO_PLUGIN_UI_HDRS ${STUDIO_PLUGIN_UIS}) + +SOURCE_GROUP(QtResources FILES ${STUDIO_RCS} ${STUDIO_PLUGIN_UIS} ) +SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${STUDIO_MOC_SRCS} ${STUDIO_RC_SRCS}) + +ADD_EXECUTABLE(studio WIN32 MACOSX_BUNDLE + ${STUDIO_SRC} + ${STUDIO_MOC_SRCS} + ${STUDIO_RC_SRCS} + ${STUDIO_RC} + ${STUDIO_PLUGIN_UIS} ) + +TARGET_LINK_LIBRARIES(studio + nelmisc + ${QT_LIBRARIES} + ${QT_QTMAIN_LIBRARY}) + +ADD_DEFINITIONS(-DQT_NO_KEYWORDS ${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS}) +NL_DEFAULT_PROPS(studio "Tools: Studio") +NL_ADD_RUNTIME_FLAGS(studio) + +ADD_SUBDIRECTORY(plugins) + +INSTALL(TARGETS studio RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT runtime BUNDLE DESTINATION /Applications) diff --git a/code/nel/tools/3d/object_viewer_qt/src/description.h b/code/studio/src/description.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/description.h rename to code/studio/src/description.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin.h b/code/studio/src/extension_system/iplugin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin.h rename to code/studio/src/extension_system/iplugin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h b/code/studio/src/extension_system/iplugin_manager.h similarity index 90% rename from code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h rename to code/studio/src/extension_system/iplugin_manager.h index e38748e77..f60f45890 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_manager.h +++ b/code/studio/src/extension_system/iplugin_manager.h @@ -55,6 +55,9 @@ public: virtual void setPluginPaths(const QStringList &paths) = 0; virtual QList plugins() const = 0; + virtual bool loadPlugin( const QString &plugin ) = 0; + virtual bool unloadPlugin( ExtensionSystem::IPluginSpec *plugin ) = 0; + // Settings virtual void setSettings(QSettings *settings) = 0; virtual QSettings *settings() const = 0; @@ -133,6 +136,16 @@ Q_SIGNALS: /// Signal that the list of available plugins has changed. void pluginsChanged(); + + void pluginCount( int count ); + + void pluginLoading( const char *plugin ); + void pluginInitializing( const char *plugin ); + void pluginStarting( const char *plugin ); + + void pluginsLoaded(); + void pluginsInitialized(); + void pluginsStarted(); }; }; // namespace ExtensionSystem diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_spec.h b/code/studio/src/extension_system/iplugin_spec.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/extension_system/iplugin_spec.h rename to code/studio/src/extension_system/iplugin_spec.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp b/code/studio/src/extension_system/plugin_manager.cpp similarity index 70% rename from code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp rename to code/studio/src/extension_system/plugin_manager.cpp index 9b9da508b..37cd85237 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.cpp +++ b/code/studio/src/extension_system/plugin_manager.cpp @@ -92,21 +92,144 @@ void PluginManager::loadPlugins() setPluginState(spec, State::Resolved); QList queue = loadQueue(); + Q_EMIT pluginCount( queue.count() ); Q_FOREACH (PluginSpec *spec, queue) setPluginState(spec, State::Loaded); + + Q_EMIT pluginsLoaded(); Q_FOREACH (PluginSpec *spec, queue) setPluginState(spec, State::Initialized); + + Q_EMIT pluginsInitialized(); QListIterator it(queue); it.toBack(); while (it.hasPrevious()) setPluginState(it.previous(), State::Running); + + Q_EMIT pluginsStarted(); Q_EMIT pluginsChanged(); } +bool PluginManager::loadPluginSpec( const QString &plugin ) +{ + nlinfo( "Loading plugin spec %s", plugin.toUtf8().data() ); + + PluginSpec *spec = new PluginSpec; + spec->m_pluginManager = this; + if( !spec->setSpecFileName( plugin ) ) + { + nlinfo( "Error loading plugin spec %s", plugin.toUtf8().data() ); + return false; + } + + m_pluginSpecs.append( spec ); + m_ipluginSpecs.append( spec ); + + return true; +} + +bool PluginManager::loadPlugin( const QString &plugin ) +{ + if( !loadPluginSpec( plugin ) ) + return false; + + ExtensionSystem::PluginSpec *spec = m_pluginSpecs.last(); + + if( !spec->resolveDependencies( m_pluginSpecs ) ) + { + nlinfo( "Error resolving dependencies for plugin spec %s", plugin.toUtf8().data() ); + return false; + } + + if( !spec->loadLibrary() ) + { + nlinfo( "Error loading plugin %s", spec->fileName().toUtf8().data() ); + return false; + } + + if( !spec->initializePlugin() ) + { + nlinfo( "Error initializing plugin %s", spec->fileName().toUtf8().data() ); + spec->kill(); + return false; + } + + if( !spec->initializeExtensions() ) + { + nlinfo( "Error starting plugin %s", spec->fileName().toUtf8().data() ); + spec->stop(); + spec->kill(); + return false; + } + + nlinfo( "Loaded plugin %s ( %s )", spec->name().data(), spec->fileName().toUtf8().data() ); + + Q_EMIT pluginsChanged(); + + return true; +} + +bool PluginManager::unloadPlugin( ExtensionSystem::IPluginSpec *plugin ) +{ + ExtensionSystem::PluginSpec *spec = static_cast< ExtensionSystem::PluginSpec* >( plugin ); + + // Let's see if anything depends on this one + QListIterator< ExtensionSystem::PluginSpec* > itr( m_pluginSpecs ); + while( itr.hasNext() ) + { + ExtensionSystem::PluginSpec *sp = itr.next(); + QList< ExtensionSystem::PluginSpec* > l = sp->dependencySpecs(); + if( l.contains( spec ) ) + return false; + } + + // Stop, delete then remove plugin + spec->stop(); + spec->kill(); + removePlugin( plugin ); + + return true; +} + +void PluginManager::removePlugin( ExtensionSystem::IPluginSpec *plugin ) +{ + QList< ExtensionSystem::IPluginSpec* >::iterator itr1; + QList< ExtensionSystem::PluginSpec* >::iterator itr2; + + QList< ExtensionSystem::IPluginSpec* >::iterator i1 = m_ipluginSpecs.begin(); + while( i1 != m_ipluginSpecs.end() ) + { + if( *i1 == plugin ) + { + itr1 = i1; + break; + } + i1++; + } + + QList< ExtensionSystem::PluginSpec* >::iterator i2 = m_pluginSpecs.begin(); + while( i2 != m_pluginSpecs.end() ) + { + if( *i2 == static_cast< ExtensionSystem::PluginSpec* >( plugin ) ) + { + itr2 = i2; + break; + } + i2++; + } + + m_ipluginSpecs.erase( itr1 ); + m_pluginSpecs.erase( itr2 ); + delete plugin; + + Q_EMIT pluginsChanged(); + +} + QStringList PluginManager::getPluginPaths() const { return m_pluginPaths; @@ -183,7 +306,7 @@ void PluginManager::readPluginPaths() while (!searchPaths.isEmpty()) { const QDir dir(searchPaths.takeFirst()); - const QFileInfoList files = dir.entryInfoList(QStringList() << QString("ovqt_plugin_*.%1").arg(m_extension), QDir::Files); + const QFileInfoList files = dir.entryInfoList(QStringList() << QString("studio_plugin_*.%1").arg(m_extension), QDir::Files); Q_FOREACH (const QFileInfo &file, files) pluginsList << file.absoluteFilePath(); const QFileInfoList dirs = dir.entryInfoList(QDir::Dirs|QDir::NoDotAndDotDot); @@ -193,11 +316,7 @@ void PluginManager::readPluginPaths() Q_FOREACH (const QString &pluginFile, pluginsList) { - PluginSpec *spec = new PluginSpec; - spec->m_pluginManager = this; - spec->setSpecFileName(pluginFile); - m_pluginSpecs.append(spec); - m_ipluginSpecs.append(spec); + loadPluginSpec( pluginFile.toUtf8().data() ); } Q_EMIT pluginsChanged(); @@ -218,6 +337,7 @@ void PluginManager::setPluginState(PluginSpec *spec, int destState) spec->resolveDependencies(m_pluginSpecs); return; case State::Running: + Q_EMIT pluginStarting( spec->name().toUtf8().data() ); spec->initializeExtensions(); return; case State::Deleted: @@ -239,9 +359,11 @@ void PluginManager::setPluginState(PluginSpec *spec, int destState) switch (destState) { case State::Loaded: + Q_EMIT pluginLoading( spec->name().toUtf8().data() ); spec->loadLibrary(); return; case State::Initialized: + Q_EMIT pluginInitializing( spec->name().toUtf8().data() ); spec->initializePlugin(); break; case State::Stopped: diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.h b/code/studio/src/extension_system/plugin_manager.h similarity index 91% rename from code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.h rename to code/studio/src/extension_system/plugin_manager.h index 9ab1ae135..ca31e1552 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_manager.h +++ b/code/studio/src/extension_system/plugin_manager.h @@ -51,6 +51,10 @@ public: virtual QList plugins() const; QList loadQueue(); + bool loadPlugin( const QString &plugin ); + bool unloadPlugin( ExtensionSystem::IPluginSpec *plugin ); + + // Settings virtual void setSettings(QSettings *settings); virtual QSettings *settings() const; @@ -58,6 +62,8 @@ public: void writeSettings(); private: + bool loadPluginSpec( const QString &plugin ); + void removePlugin( ExtensionSystem::IPluginSpec *plugin ); void setPluginState(PluginSpec *spec, int destState); void readPluginPaths(); bool loadQueue(PluginSpec *spec, QList &queue, QList &circularityCheckQueue); diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp b/code/studio/src/extension_system/plugin_spec.cpp similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp rename to code/studio/src/extension_system/plugin_spec.cpp index 89f8046bb..97a08ea64 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.cpp +++ b/code/studio/src/extension_system/plugin_spec.cpp @@ -84,6 +84,13 @@ PluginSpec::PluginSpec() #else # error "You must define the lib suffix for your platform" #endif + loader = NULL; +} + +PluginSpec::~PluginSpec() +{ + delete loader; + loader = NULL; } QString PluginSpec::name() const @@ -292,6 +299,8 @@ bool PluginSpec::isEnabled() const bool PluginSpec::loadLibrary() { + nlassert( loader == NULL ); + if (m_hasError) return false; if (m_state != State::Resolved) @@ -301,14 +310,16 @@ bool PluginSpec::loadLibrary() return reportError(QCoreApplication::translate("PluginSpec", "Loading the library failed because state != Resolved")); } - QPluginLoader loader(m_filePath); - if (!loader.load()) - return reportError(loader.errorString()); + loader = new QPluginLoader( m_filePath ); + if (!loader->load()) + return reportError(loader->errorString()); - IPlugin *pluginObject = qobject_cast(loader.instance()); + IPlugin *pluginObject = qobject_cast(loader->instance()); if (!pluginObject) { - loader.unload(); + loader->unload(); + delete loader; + loader = NULL; return reportError(QCoreApplication::translate("PluginSpec", "Plugin is not valid (does not derive from IPlugin)")); } @@ -412,8 +423,17 @@ void PluginSpec::kill() { if (!m_plugin) return; - delete m_plugin; - m_plugin = 0; + + bool b = loader->unload(); + if( !b ) + { + nlinfo( "Plugin %s couldn't be unloaded.", this->m_name.toAscii().data() ); + } + + //delete m_plugin; + m_plugin = NULL; + delete loader; + loader = NULL; m_state = State::Deleted; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h b/code/studio/src/extension_system/plugin_spec.h similarity index 97% rename from code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h rename to code/studio/src/extension_system/plugin_spec.h index 0ce74d004..d2abe1ef8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/extension_system/plugin_spec.h +++ b/code/studio/src/extension_system/plugin_spec.h @@ -25,12 +25,15 @@ #include #include +class QPluginLoader; + namespace ExtensionSystem { class PluginSpec: public IPluginSpec { public: + ~PluginSpec(); virtual QString name() const; virtual QString version() const; virtual QString vendor() const; @@ -54,7 +57,7 @@ public: private: PluginSpec(); - + bool setFileName(const QString &fileName); bool setSpecFileName(const QString &specFileName); bool readSpec(); @@ -96,6 +99,8 @@ private: IPluginManager *m_pluginManager; QList m_dependencySpecs; + QPluginLoader *loader; + friend class PluginManager; }; diff --git a/code/studio/src/images/studio_splash.png b/code/studio/src/images/studio_splash.png new file mode 100644 index 000000000..06f0504b9 Binary files /dev/null and b/code/studio/src/images/studio_splash.png differ diff --git a/code/nel/tools/3d/object_viewer_qt/src/main.cpp b/code/studio/src/main.cpp similarity index 86% rename from code/nel/tools/3d/object_viewer_qt/src/main.cpp rename to code/studio/src/main.cpp index d0407ccfd..e758037c0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/main.cpp +++ b/code/studio/src/main.cpp @@ -37,15 +37,19 @@ #include #include #include -#include +//#include #include #include +#include "settings_dialog.h" +#include "splash_screen.h" +#include "pm_watcher.h" + #ifdef HAVE_OVQT_CONFIG_H #include "ovqt_config.h" #endif -static const char *appNameC = "ObjectViewerQt"; +static const char *appNameC = "RyzomCoreStudio"; // nel_qt log file name #define NLQT_LOG_FILE "nel_qt.log" @@ -104,6 +108,7 @@ static inline QString msgCoreLoadFailure(const QString &why) return QCoreApplication::translate("Application", "Failed to load Core plugin: %1").arg(why); } + #ifdef NL_OS_WINDOWS int __stdcall WinMain(void *hInstance, void *hPrevInstance, void *lpCmdLine, int nShowCmd) #else // NL_OS_WINDOWS @@ -138,14 +143,29 @@ int main(int argc, char **argv) #else // NL_OS_WINDOWS QApplication app(argc, argv); #endif // NL_OS_WINDOWS - QSplashScreen *splash = new QSplashScreen(); - splash->setPixmap(QPixmap(":/images/nel_ide_load.png")); + + SplashScreen *splash = new SplashScreen(); + splash->setPixmap(QPixmap(":/images/studio_splash.png")); + splash->setProgressBarEnabled( true ); + splash->setText( "Starting up..." ); + splash->setProgress( 0 ); splash->show(); QSettings::setDefaultFormat(QSettings::IniFormat); QSettings *settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, QLatin1String("RyzomCore"), QLatin1String(appNameC)); + bool firstRun = settings->value( "FirstRun", true ).toBool(); + if( firstRun ) + { + settings->setValue( "FirstRun", false ); + + SettingsDialog sd; + sd.setSettings( settings ); + sd.load(); + sd.exec(); + } + QTranslator translator; QTranslator qtTranslator; QString locale = settings->value("Language", QLocale::system().name()).toString(); @@ -155,6 +175,9 @@ int main(int argc, char **argv) app.installTranslator(&translator); app.installTranslator(&qtTranslator); + splash->setText( "Loading plugins..." ); + splash->setProgress( 20 ); + #if defined(NL_OS_MAC) QDir::setCurrent(qApp->applicationDirPath() + QString("/../Resources")); NLMISC::CLibrary::addLibPath((qApp->applicationDirPath() + QString("/../PlugIns/nel")).toUtf8().constData()); @@ -164,14 +187,21 @@ int main(int argc, char **argv) pluginManager.setSettings(settings); QStringList pluginPaths; #if defined(NL_OS_MAC) - pluginPaths << settings->value("PluginPath", qApp->applicationDirPath() + QString("/../PlugIns/ovqt")).toString(); + pluginPaths << settings->value("PluginPath", qApp->applicationDirPath() + QString("/../PlugIns/studio")).toString(); #else pluginPaths << settings->value("PluginPath", QString("%1/plugins").arg(DATA_DIR)).toString(); #endif pluginManager.setPluginPaths(pluginPaths); + + PluginManagerWatcher watcher; + watcher.setPluginManager( &pluginManager ); + watcher.setSplashScreen( splash ); + watcher.connect(); + pluginManager.loadPlugins(); + watcher.disconnect(); splash->hide(); ExtensionSystem::IPluginSpec *corePlugin = pluginManager.pluginByName("Core"); @@ -180,7 +210,7 @@ int main(int argc, char **argv) { QDir absolutePluginPaths(pluginPaths.join(QLatin1String(","))); QString absolutePaths = absolutePluginPaths.absolutePath(); - const QString reason = QCoreApplication::translate("Application", "Could not find ovqt_plugin_core in %1").arg(absolutePaths); + const QString reason = QCoreApplication::translate("Application", "Could not find studio_plugin_core in %1").arg(absolutePaths); displayError(msgCoreLoadFailure(reason)); QString newPath = QFileDialog::getExistingDirectory(0, QCoreApplication::translate("Application", "Change the plugins path"), QDir::homePath()); @@ -205,7 +235,7 @@ int main(int argc, char **argv) errors.append(spec->fileName() + " : " + spec->errorString()); if (!errors.isEmpty()) - QMessageBox::warning(0, QCoreApplication::translate("Application", "Object Viewer Qt - Plugin loader messages"), + QMessageBox::warning(0, QCoreApplication::translate("Application", "Studio - Plugin loader messages"), errors.join(QString::fromLatin1("\n\n"))); int result = app.exec(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt b/code/studio/src/plugins/CMakeLists.txt similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt rename to code/studio/src/plugins/CMakeLists.txt index 3e99bdc43..5916be455 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt +++ b/code/studio/src/plugins/CMakeLists.txt @@ -13,6 +13,7 @@ IF(WITH_GUI) ENDIF(WITH_GUI) ADD_SUBDIRECTORY(translation_manager) +ADD_SUBDIRECTORY(tile_editor) ADD_SUBDIRECTORY(bnp_manager) # Note: Temporarily disabled until development continues. #ADD_SUBDIRECTORY(zone_painter) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/CMakeLists.txt b/code/studio/src/plugins/bnp_manager/CMakeLists.txt similarity index 67% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/CMakeLists.txt rename to code/studio/src/plugins/bnp_manager/CMakeLists.txt index 2991da073..406a927b8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/CMakeLists.txt +++ b/code/studio/src/plugins/bnp_manager/CMakeLists.txt @@ -34,16 +34,16 @@ 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}) +ADD_LIBRARY(studio_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}) +TARGET_LINK_LIBRARIES(studio_plugin_bnp_manager studio_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) +NL_DEFAULT_PROPS(studio_plugin_bnp_manager "Tools: Studio Plugin: BNP Manager") +NL_ADD_RUNTIME_FLAGS(studio_plugin_bnp_manager) +NL_ADD_LIB_SUFFIX(studio_plugin_bnp_manager) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) -INSTALL(TARGETS ovqt_plugin_bnp_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_bnp_manager.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(TARGETS studio_plugin_bnp_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} ARCHIVE DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_bnp_manager.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_dialog.cpp b/code/studio/src/plugins/bnp_manager/bnp_dirtree_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_dialog.cpp rename to code/studio/src/plugins/bnp_manager/bnp_dirtree_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_dialog.h b/code/studio/src/plugins/bnp_manager/bnp_dirtree_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_dialog.h rename to code/studio/src/plugins/bnp_manager/bnp_dirtree_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_form.ui b/code/studio/src/plugins/bnp_manager/bnp_dirtree_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_dirtree_form.ui rename to code/studio/src/plugins/bnp_manager/bnp_dirtree_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.cpp b/code/studio/src/plugins/bnp_manager/bnp_file.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.cpp rename to code/studio/src/plugins/bnp_manager/bnp_file.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.h b/code/studio/src/plugins/bnp_manager/bnp_file.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_file.h rename to code/studio/src/plugins/bnp_manager/bnp_file.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.cpp b/code/studio/src/plugins/bnp_manager/bnp_filelist_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.cpp rename to code/studio/src/plugins/bnp_manager/bnp_filelist_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.h b/code/studio/src/plugins/bnp_manager/bnp_filelist_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.h rename to code/studio/src/plugins/bnp_manager/bnp_filelist_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.ui b/code/studio/src/plugins/bnp_manager/bnp_filelist_dialog.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filelist_dialog.ui rename to code/studio/src/plugins/bnp_manager/bnp_filelist_dialog.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filesystem_model.cpp b/code/studio/src/plugins/bnp_manager/bnp_filesystem_model.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filesystem_model.cpp rename to code/studio/src/plugins/bnp_manager/bnp_filesystem_model.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filesystem_model.h b/code/studio/src/plugins/bnp_manager/bnp_filesystem_model.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_filesystem_model.h rename to code/studio/src/plugins/bnp_manager/bnp_filesystem_model.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager.qrc b/code/studio/src/plugins/bnp_manager/bnp_manager.qrc similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager.qrc rename to code/studio/src/plugins/bnp_manager/bnp_manager.qrc diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_constants.h b/code/studio/src/plugins/bnp_manager/bnp_manager_constants.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_constants.h rename to code/studio/src/plugins/bnp_manager/bnp_manager_constants.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_plugin.cpp b/code/studio/src/plugins/bnp_manager/bnp_manager_plugin.cpp similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_plugin.cpp rename to code/studio/src/plugins/bnp_manager/bnp_manager_plugin.cpp index e4bf7f594..509dd2997 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_plugin.cpp +++ b/code/studio/src/plugins/bnp_manager/bnp_manager_plugin.cpp @@ -44,6 +44,9 @@ namespace BNPManager } qDeleteAll(m_autoReleaseObjects); m_autoReleaseObjects.clear(); + + delete m_libContext; + m_libContext = NULL; } bool BNPManagerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_plugin.h b/code/studio/src/plugins/bnp_manager/bnp_manager_plugin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_plugin.h rename to code/studio/src/plugins/bnp_manager/bnp_manager_plugin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.cpp b/code/studio/src/plugins/bnp_manager/bnp_manager_window.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.cpp rename to code/studio/src/plugins/bnp_manager/bnp_manager_window.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.h b/code/studio/src/plugins/bnp_manager/bnp_manager_window.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.h rename to code/studio/src/plugins/bnp_manager/bnp_manager_window.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.ui b/code/studio/src/plugins/bnp_manager/bnp_manager_window.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_manager_window.ui rename to code/studio/src/plugins/bnp_manager/bnp_manager_window.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_proxy_model.cpp b/code/studio/src/plugins/bnp_manager/bnp_proxy_model.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_proxy_model.cpp rename to code/studio/src/plugins/bnp_manager/bnp_proxy_model.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_proxy_model.h b/code/studio/src/plugins/bnp_manager/bnp_proxy_model.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/bnp_proxy_model.h rename to code/studio/src/plugins/bnp_manager/bnp_proxy_model.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_add_item.png b/code/studio/src/plugins/bnp_manager/images/ic_nel_add_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_add_item.png rename to code/studio/src/plugins/bnp_manager/images/ic_nel_add_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_bnp_make.png b/code/studio/src/plugins/bnp_manager/images/ic_nel_bnp_make.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_bnp_make.png rename to code/studio/src/plugins/bnp_manager/images/ic_nel_bnp_make.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_delete_item.png b/code/studio/src/plugins/bnp_manager/images/ic_nel_delete_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_delete_item.png rename to code/studio/src/plugins/bnp_manager/images/ic_nel_delete_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_export.png b/code/studio/src/plugins/bnp_manager/images/ic_nel_export.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_export.png rename to code/studio/src/plugins/bnp_manager/images/ic_nel_export.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_new.png b/code/studio/src/plugins/bnp_manager/images/ic_nel_new.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_new.png rename to code/studio/src/plugins/bnp_manager/images/ic_nel_new.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_reset_all.png b/code/studio/src/plugins/bnp_manager/images/ic_nel_reset_all.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/images/ic_nel_reset_all.png rename to code/studio/src/plugins/bnp_manager/images/ic_nel_reset_all.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/ovqt_plugin_bnp_manager.xml b/code/studio/src/plugins/bnp_manager/studio_plugin_bnp_manager.xml similarity index 76% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/ovqt_plugin_bnp_manager.xml rename to code/studio/src/plugins/bnp_manager/studio_plugin_bnp_manager.xml index a368a123c..591611504 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/bnp_manager/ovqt_plugin_bnp_manager.xml +++ b/code/studio/src/plugins/bnp_manager/studio_plugin_bnp_manager.xml @@ -1,5 +1,5 @@ - ovqt_plugin_bnp_manager + studio_plugin_bnp_manager BNPManager 0.1 Krolock diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/CMakeLists.txt b/code/studio/src/plugins/core/CMakeLists.txt similarity index 57% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/CMakeLists.txt rename to code/studio/src/plugins/core/CMakeLists.txt index 5a20ba46c..2c21c9b58 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/CMakeLists.txt +++ b/code/studio/src/plugins/core/CMakeLists.txt @@ -4,6 +4,11 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDES}) FILE(GLOB SRC *.cpp *.h) +SET( SRC ${SRC} + ${CMAKE_CURRENT_SOURCE_DIR}/Nel3DWidget/nel3d_widget.h + ${CMAKE_CURRENT_SOURCE_DIR}/Nel3DWidget/nel3d_widget.cpp + ) + 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) @@ -22,6 +27,7 @@ SET(OVQT_CORE_PLUGIN_HDR search_paths_settings_page.h general_settings_page.h plugin_view_dialog.h + ${CMAKE_CURRENT_SOURCE_DIR}/Nel3DWidget/nel3d_widget.h ) SET(OVQT_CORE_PLUGIN_UIS settings_dialog.ui @@ -45,29 +51,29 @@ SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_CORE_PLUGIN_MOC_SRC}) SOURCE_GROUP("Core Plugin" FILES ${SRC}) SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) -ADD_LIBRARY(ovqt_plugin_core SHARED ${SRC} ${OVQT_CORE_PLUGIN_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_CORE_PLUGIN_RC_SRCS} ${OVQT_CORE_PLUGIN_UI_HDRS}) +ADD_LIBRARY(studio_plugin_core SHARED ${SRC} ${OVQT_CORE_PLUGIN_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_CORE_PLUGIN_RC_SRCS} ${OVQT_CORE_PLUGIN_UI_HDRS}) -TARGET_LINK_LIBRARIES(ovqt_plugin_core nelmisc ${QT_LIBRARIES}) +TARGET_LINK_LIBRARIES(studio_plugin_core nelmisc nel3d ${QT_LIBRARIES}) -NL_DEFAULT_PROPS(ovqt_plugin_core "NeL, Tools, 3D: Object Viewer Qt Plugin: Core") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_core) -NL_ADD_LIB_SUFFIX(ovqt_plugin_core) +NL_DEFAULT_PROPS(studio_plugin_core "Tools: Studio Plugin: Core") +NL_ADD_RUNTIME_FLAGS(studio_plugin_core) +NL_ADD_LIB_SUFFIX(studio_plugin_core) ADD_DEFINITIONS(-DCORE_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) IF(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_core LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_core LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ELSE(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_core LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_core LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_core LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ENDIF(WIN32) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_core.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_core.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp b/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp new file mode 100644 index 000000000..dc0bb858b --- /dev/null +++ b/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.cpp @@ -0,0 +1,178 @@ +// Ryzom Core MMORPG framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "nel3d_widget.h" +#include "nel/3d/u_driver.h" +#include "nel/3d/text_context.h" +#include "nel/3d/driver_user.h" +#include "nel/misc/rgba.h" +#include "nel/misc/path.h" + +#ifdef NL_OS_WINDOWS +#include +#endif + +#include + +Nel3DWidget::Nel3DWidget( QWidget *parent ) : +QWidget( parent ) +{ + driver = NULL; + textContext = NULL; + + // Need to set this attribute with a NULL paintengine returned to Qt + // so that we can render the widget normally ourselves, without the image + // disappearing when a widget is resized or shown on top of us + setAttribute( Qt::WA_PaintOnScreen, true ); + setAttribute( Qt::WA_OpaquePaintEvent, true ); + setAttribute( Qt::WA_NoSystemBackground, true ); +} + +Nel3DWidget::~Nel3DWidget() +{ + if( driver != NULL ) + { + if( textContext != NULL ) + { + driver->deleteTextContext( textContext ); + textContext = NULL; + } + + driver->release(); + delete driver; + driver = NULL; + } +} + +void Nel3DWidget::init() +{ + nlassert( driver == NULL ); + + driver = NL3D::UDriver::createDriver( 0, false, 0 ); + driver->setDisplay( winId(), NL3D::UDriver::CMode( width(), height(), 32, true ) ); +} + +void Nel3DWidget::createTextContext( std::string fontFile ) +{ + if( driver == NULL ) + return; + + std::string font; + + try + { + font = NLMISC::CPath::lookup( fontFile ); + } + catch( ... ) + { + nlinfo( "Font %s cannot be found, cannot create textcontext!", fontFile.c_str() ); + exit( EXIT_FAILURE ); + } + + if( textContext != NULL ) + { + driver->deleteTextContext( textContext ); + textContext = NULL; + } + + textContext = driver->createTextContext( font ); +} + +void Nel3DWidget::clear() +{ + if( driver == NULL ) + return; + driver->clearBuffers( NLMISC::CRGBA::Black ); + driver->swapBuffers(); +} + +void Nel3DWidget::showEvent( QShowEvent *evnt ) +{ + QWidget::showEvent( evnt ); + + if( driver != NULL ) + driver->activate(); +} + +void Nel3DWidget::resizeEvent( QResizeEvent *evnt ) +{ + QWidget::resizeEvent( evnt ); + + Q_EMIT( evnt->size().width(), evnt->size().height() ); +} + +#if defined ( NL_OS_WINDOWS ) + +typedef bool ( *winProc )( NL3D::IDriver *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); + +bool Nel3DWidget::winEvent( MSG *message, long *result ) +{ + if( driver != NULL ) + { + NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver(); + if( iDriver != NULL ) + { + winProc proc = (winProc)iDriver->getWindowProc(); + return proc( iDriver, message->hwnd, message->message, message->wParam, message->lParam ); + } + } + + return false; +} + +#elif defined( NL_OS_MAC ) + +typedef bool ( *cocoaProc )( NL3D::IDriver *, const void *e ); + +bool Nel3DWidget::macEvent( EventHandlerCallRef caller, EventRef event ) +{ + if( caller ) + nlerror( "You are using QtCarbon! Only QtCocoa supported, please upgrade Qt" ); + + if( driver != NULL ) + { + NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver(); + if( iDriver != NULL ) + { + cocoaProc proc = ( cocoaProc )iDriver->getWindowProc(); + return proc( iDriver, event ); + } + } + + return false; +} + +#elif defined( NL_OS_UNIX ) + +typedef bool ( *x11Proc )( NL3D::IDriver *drv, XEvent *e ); + +bool Nel3DWidget::x11Event( XEvent *event ) +{ + if( driver != NULL ) + { + NL3D::IDriver *iDriver = dynamic_cast< NL3D::CDriverUser* >( driver )->getDriver(); + if( driver != NULL ) + { + x11Proc proc = ( x11Proc )iDriver->getWindowProc(); + return proc( iDriver, event ); + } + } + + return false; +} +#endif + diff --git a/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h b/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h new file mode 100644 index 000000000..059e1b738 --- /dev/null +++ b/code/studio/src/plugins/core/Nel3DWidget/nel3d_widget.h @@ -0,0 +1,79 @@ +// Ryzom Core MMORPG framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 NEL3D_WIDGET_H +#define NEL3D_WIDGET_H + +#include +#include "nel/misc/types_nl.h" +#include + +#include "../core_global.h" + +namespace NL3D +{ + class UDriver; + class UTextContext; +} + +/// Nel 3D interface to Qt +class CORE_EXPORT Nel3DWidget : public QWidget +{ + Q_OBJECT +public: + Nel3DWidget( QWidget *parent = NULL ); + virtual ~Nel3DWidget(); + + void init(); + void createTextContext( std::string fontFile ); + + NL3D::UDriver* getDriver() const{ return driver; } + NL3D::UTextContext* getTextContext() const{ return textContext; } + + + // Need to return NULL paintengine to Qt so that we can + // render the widget normally ourselves, without the image + // disappearing when a widget is resized or shown on top of us + QPaintEngine* paintEngine() const{ return NULL; } + +Q_SIGNALS: + void resize( int width, int height ); + +public Q_SLOTS: + void clear(); + +protected: + + void showEvent( QShowEvent *evnt ); + void resizeEvent( QResizeEvent *evnt ); + +#if defined(NL_OS_WINDOWS) + bool winEvent( MSG *message, long *result ); +#elif defined(NL_OS_MAC) + bool macEvent( EventHandlerCallRef caller, EventRef event ); +#elif defined(NL_OS_UNIX) + bool x11Event( XEvent *event ); +#endif + +private: + NL3D::UDriver *driver; + NL3D::UTextContext *textContext; + +}; + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/context_manager.cpp b/code/studio/src/plugins/core/context_manager.cpp similarity index 94% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/context_manager.cpp rename to code/studio/src/plugins/core/context_manager.cpp index 8355b5cb8..3b02b411c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/context_manager.cpp +++ b/code/studio/src/plugins/core/context_manager.cpp @@ -36,13 +36,11 @@ struct ContextManagerPrivate Core::MainWindow *m_mainWindow; QTabWidget *m_tabWidget; QVector m_contexts; - int m_oldCurrent; }; ContextManagerPrivate::ContextManagerPrivate(Core::MainWindow *mainWindow, QTabWidget *tabWidget) : m_mainWindow(mainWindow), - m_tabWidget(tabWidget), - m_oldCurrent(-1) + m_tabWidget(tabWidget) { } @@ -135,8 +133,8 @@ void ContextManager::removeContextObject(IContext *context) const int index = indexOf(context->id()); QWidget *widget = d->m_tabWidget->widget(index); - d->m_tabWidget->removeTab(index); d->m_contexts.remove(index); + d->m_tabWidget->removeTab(index); delete widget; } @@ -145,11 +143,7 @@ void ContextManager::currentTabChanged(int index) if (index >= 0) { IContext *context = d->m_contexts.at(index); - IContext *oldContext = 0; - if (d->m_oldCurrent >= 0) - oldContext = d->m_contexts.at(d->m_oldCurrent); - d->m_oldCurrent = index; - Q_EMIT currentContextChanged(context, oldContext); + Q_EMIT currentContextChanged(context); } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/context_manager.h b/code/studio/src/plugins/core/context_manager.h similarity index 92% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/context_manager.h rename to code/studio/src/plugins/core/context_manager.h index 8151648e7..9b0a62c7e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/context_manager.h +++ b/code/studio/src/plugins/core/context_manager.h @@ -51,8 +51,7 @@ public: void unregisterUndoStack(QUndoStack *stack); Q_SIGNALS: - // the default argument '=0' is important for connects without the oldContext argument. - void currentContextChanged(Core::IContext *context, Core::IContext *oldContext = 0); + void currentContextChanged(Core::IContext *context); public Q_SLOTS: void activateContext(const QString &id); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.cpp b/code/studio/src/plugins/core/core.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.cpp rename to code/studio/src/plugins/core/core.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.h b/code/studio/src/plugins/core/core.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.h rename to code/studio/src/plugins/core/core.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.qrc b/code/studio/src/plugins/core/core.qrc similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.qrc rename to code/studio/src/plugins/core/core.qrc diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h b/code/studio/src/plugins/core/core_constants.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h rename to code/studio/src/plugins/core/core_constants.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_global.h b/code/studio/src/plugins/core/core_global.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_global.h rename to code/studio/src/plugins/core/core_global.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp b/code/studio/src/plugins/core/core_plugin.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.cpp rename to code/studio/src/plugins/core/core_plugin.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.h b/code/studio/src/plugins/core/core_plugin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_plugin.h rename to code/studio/src/plugins/core/core_plugin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp b/code/studio/src/plugins/core/general_settings_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.cpp rename to code/studio/src/plugins/core/general_settings_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.h b/code/studio/src/plugins/core/general_settings_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.h rename to code/studio/src/plugins/core/general_settings_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.ui b/code/studio/src/plugins/core/general_settings_page.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/general_settings_page.ui rename to code/studio/src/plugins/core/general_settings_page.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_add_item.png b/code/studio/src/plugins/core/icons/ic_nel_add_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_add_item.png rename to code/studio/src/plugins/core/icons/ic_nel_add_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_crash.png b/code/studio/src/plugins/core/icons/ic_nel_crash.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_crash.png rename to code/studio/src/plugins/core/icons/ic_nel_crash.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_delete_item.png b/code/studio/src/plugins/core/icons/ic_nel_delete_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_delete_item.png rename to code/studio/src/plugins/core/icons/ic_nel_delete_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_down_item.png b/code/studio/src/plugins/core/icons/ic_nel_down_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_down_item.png rename to code/studio/src/plugins/core/icons/ic_nel_down_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_generic_settings.png b/code/studio/src/plugins/core/icons/ic_nel_generic_settings.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_generic_settings.png rename to code/studio/src/plugins/core/icons/ic_nel_generic_settings.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_new.png b/code/studio/src/plugins/core/icons/ic_nel_new.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_new.png rename to code/studio/src/plugins/core/icons/ic_nel_new.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_open.png b/code/studio/src/plugins/core/icons/ic_nel_open.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_open.png rename to code/studio/src/plugins/core/icons/ic_nel_open.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_path_settings.png b/code/studio/src/plugins/core/icons/ic_nel_path_settings.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_path_settings.png rename to code/studio/src/plugins/core/icons/ic_nel_path_settings.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_pill.png b/code/studio/src/plugins/core/icons/ic_nel_pill.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_pill.png rename to code/studio/src/plugins/core/icons/ic_nel_pill.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_redo.png b/code/studio/src/plugins/core/icons/ic_nel_redo.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_redo.png rename to code/studio/src/plugins/core/icons/ic_nel_redo.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_reset_all.png b/code/studio/src/plugins/core/icons/ic_nel_reset_all.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_reset_all.png rename to code/studio/src/plugins/core/icons/ic_nel_reset_all.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_save.png b/code/studio/src/plugins/core/icons/ic_nel_save.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_save.png rename to code/studio/src/plugins/core/icons/ic_nel_save.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_save_as.png b/code/studio/src/plugins/core/icons/ic_nel_save_as.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_save_as.png rename to code/studio/src/plugins/core/icons/ic_nel_save_as.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_undo.png b/code/studio/src/plugins/core/icons/ic_nel_undo.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_undo.png rename to code/studio/src/plugins/core/icons/ic_nel_undo.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_up_item.png b/code/studio/src/plugins/core/icons/ic_nel_up_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_up_item.png rename to code/studio/src/plugins/core/icons/ic_nel_up_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icontext.h b/code/studio/src/plugins/core/icontext.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icontext.h rename to code/studio/src/plugins/core/icontext.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icore.h b/code/studio/src/plugins/core/icore.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icore.h rename to code/studio/src/plugins/core/icore.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icore_listener.h b/code/studio/src/plugins/core/icore_listener.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/icore_listener.h rename to code/studio/src/plugins/core/icore_listener.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/images/nel.png b/code/studio/src/plugins/core/images/nel.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/images/nel.png rename to code/studio/src/plugins/core/images/nel.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/images/preferences.png b/code/studio/src/plugins/core/images/preferences.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/images/preferences.png rename to code/studio/src/plugins/core/images/preferences.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/ioptions_page.h b/code/studio/src/plugins/core/ioptions_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/ioptions_page.h rename to code/studio/src/plugins/core/ioptions_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp b/code/studio/src/plugins/core/main_window.cpp similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp rename to code/studio/src/plugins/core/main_window.cpp index a90e67bc0..4ccd32564 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp +++ b/code/studio/src/plugins/core/main_window.cpp @@ -46,13 +46,13 @@ MainWindow::MainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget * m_undoGroup(0), m_settings(0) { - QCoreApplication::setApplicationName(QLatin1String("ObjectViewerQt")); + QCoreApplication::setApplicationName(QLatin1String("Studio")); QCoreApplication::setApplicationVersion(QLatin1String(Core::Constants::OVQT_VERSION_LONG)); QCoreApplication::setOrganizationName(QLatin1String("RyzomCore")); setObjectName(Constants::MAIN_WINDOW); setWindowIcon(QIcon(Constants::ICON_PILL)); - setWindowTitle(tr("Object Viewer Qt")); + setWindowTitle(tr("Ryzom Core Studio")); m_pluginManager = pluginManager; m_settings = m_pluginManager->settings(); @@ -232,8 +232,8 @@ bool MainWindow::showOptionsDialog(const QString &group, void MainWindow::about() { - QMessageBox::about(this, tr("About Object Viewer Qt"), - tr("

Object Viewer Qt

" + QMessageBox::about(this, tr("About Ryzom Core Studio"), + tr("

Ryzom Core Studio

" "

Ryzom Core team

Compiled on %1 %2").arg(__DATE__).arg(__TIME__)); } @@ -438,9 +438,6 @@ void MainWindow::createMenus() m_toolsMenu = m_menuBar->addMenu(tr("&Tools")); menuManager()->registerMenu(m_toolsMenu, Constants::M_TOOLS); - m_sheetMenu = m_toolsMenu->addMenu(tr("&Sheet")); - menuManager()->registerMenu(m_sheetMenu, Constants::M_SHEET); - // m_toolsMenu->addSeparator(); m_toolsMenu->addAction(m_settingsAction); @@ -452,6 +449,9 @@ void MainWindow::createMenus() m_helpMenu->addAction(m_aboutAction); m_helpMenu->addAction(m_aboutQtAction); m_helpMenu->addAction(m_pluginViewAction); + + m_sheetMenu = m_menuBar->addMenu(tr("&Sheet")); + menuManager()->registerMenu(m_sheetMenu, Constants::M_SHEET); } void MainWindow::createStatusBar() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h b/code/studio/src/plugins/core/main_window.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.h rename to code/studio/src/plugins/core/main_window.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.cpp b/code/studio/src/plugins/core/menu_manager.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.cpp rename to code/studio/src/plugins/core/menu_manager.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.h b/code/studio/src/plugins/core/menu_manager.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/menu_manager.h rename to code/studio/src/plugins/core/menu_manager.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.cpp b/code/studio/src/plugins/core/plugin_view_dialog.cpp similarity index 67% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.cpp rename to code/studio/src/plugins/core/plugin_view_dialog.cpp index 175902d39..cccc98509 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.cpp +++ b/code/studio/src/plugins/core/plugin_view_dialog.cpp @@ -25,6 +25,8 @@ #include #include #include +#include +#include // Project includes #include "../../extension_system/iplugin_spec.h" @@ -43,6 +45,10 @@ PluginView::PluginView(ExtensionSystem::IPluginManager *pluginManager, QWidget * connect(m_pluginManager, SIGNAL(pluginsChanged()), this, SLOT(updateList())); connect(this, SIGNAL(accepted()), this, SLOT(updateSettings())); + connect( m_ui.pluginTreeWidget, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ), this, SLOT( onItemClicked() ) ); + connect( m_ui.unloadButton, SIGNAL( clicked( bool ) ), this, SLOT( onUnloadClicked() ) ); + connect( m_ui.loadButton, SIGNAL( clicked( bool ) ), this, SLOT( onLoadClicked() ) ); + // WhiteList is list of plugins which can not disable. m_whiteList << Constants::OVQT_CORE_PLUGIN; updateList(); @@ -59,6 +65,7 @@ void PluginView::updateList() static QIcon notLoadedIcon = QApplication::style()->standardIcon(QStyle::SP_DialogResetButton); m_specToItem.clear(); + m_itemToSpec.clear(); QList items; Q_FOREACH (ExtensionSystem::IPluginSpec *spec, m_pluginManager->plugins()) @@ -81,6 +88,7 @@ void PluginView::updateList() items.append(item); m_specToItem.insert(spec, item); + m_itemToSpec.insert(item, spec); } m_ui.pluginTreeWidget->clear(); @@ -105,4 +113,60 @@ void PluginView::updateSettings() } } -} /* namespace Core */ \ No newline at end of file +void PluginView::onItemClicked() +{ + m_ui.unloadButton->setEnabled( true ); +} + +void PluginView::onUnloadClicked() +{ + QTreeWidgetItem *item = m_ui.pluginTreeWidget->currentItem(); + if( item == NULL ) + { + QMessageBox::warning( this, + tr( "Plugin unload" ), + tr( "No plugin selected!" ) ); + return; + } + + QMap< QTreeWidgetItem*, ExtensionSystem::IPluginSpec* >::const_iterator itr + = m_itemToSpec.find( item ); + if( itr == m_itemToSpec.end() ) + return; + + bool success = m_pluginManager->unloadPlugin( itr.value() ); + if( !success ) + { + QMessageBox::warning( this, + tr( "Plugin unload" ), + tr( "Failed to unload plugin." ) ); + } +} + +void PluginView::onLoadClicked() +{ + QString f = QFileDialog::getOpenFileName( this, + tr( "Loading a plugin" ), + ".", + "Plugin specifications ( *.xml )" ); + + if( f.isEmpty() ) + { + return; + } + + QApplication::setOverrideCursor( Qt::WaitCursor ); + bool success = m_pluginManager->loadPlugin( f ); + QApplication::setOverrideCursor( Qt::ArrowCursor ); + + if( !success ) + { + QMessageBox::warning( this, + tr( "Loading plugin" ), + tr( "Error loading plugin!" ) ); + } +} + + +} /* namespace Core */ + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.h b/code/studio/src/plugins/core/plugin_view_dialog.h similarity index 91% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.h rename to code/studio/src/plugins/core/plugin_view_dialog.h index aae16749d..e7c1123c1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.h +++ b/code/studio/src/plugins/core/plugin_view_dialog.h @@ -44,10 +44,15 @@ private Q_SLOTS: void updateList(); void updateSettings(); + void onItemClicked(); + void onUnloadClicked(); + void onLoadClicked(); + private: const int m_checkStateColumn; QMap m_specToItem; + QMap m_itemToSpec; QStringList m_whiteList; ExtensionSystem::IPluginManager *m_pluginManager; Ui::PluginView m_ui; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.ui b/code/studio/src/plugins/core/plugin_view_dialog.ui similarity index 85% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.ui rename to code/studio/src/plugins/core/plugin_view_dialog.ui index 9d7d395be..45c4695e8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/plugin_view_dialog.ui +++ b/code/studio/src/plugins/core/plugin_view_dialog.ui @@ -17,7 +17,7 @@ true - + true @@ -79,7 +79,34 @@ + + + + false + + + All objects list + + + + + + false + + + Unload plugin + + + + + + + Load plugin + + + + Qt::Horizontal @@ -92,27 +119,17 @@ - + Close - - - - false - - - All objects list - - - - + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.cpp b/code/studio/src/plugins/core/qtwin.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.cpp rename to code/studio/src/plugins/core/qtwin.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.h b/code/studio/src/plugins/core/qtwin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/qtwin.h rename to code/studio/src/plugins/core/qtwin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp b/code/studio/src/plugins/core/search_paths_settings_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.cpp rename to code/studio/src/plugins/core/search_paths_settings_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h b/code/studio/src/plugins/core/search_paths_settings_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.h rename to code/studio/src/plugins/core/search_paths_settings_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.ui b/code/studio/src/plugins/core/search_paths_settings_page.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/search_paths_settings_page.ui rename to code/studio/src/plugins/core/search_paths_settings_page.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.cpp b/code/studio/src/plugins/core/settings_dialog.cpp similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.cpp rename to code/studio/src/plugins/core/settings_dialog.cpp index 4b7bbac3a..0b38e4e80 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.cpp +++ b/code/studio/src/plugins/core/settings_dialog.cpp @@ -17,7 +17,7 @@ // along with this program. If not, see . // Project includes -#include "settings_dialog.h" +#include "../core/settings_dialog.h" #include "ioptions_page.h" // Qt includes diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.h b/code/studio/src/plugins/core/settings_dialog.h similarity index 97% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.h rename to code/studio/src/plugins/core/settings_dialog.h index 9e1c86444..a90f88b18 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.h +++ b/code/studio/src/plugins/core/settings_dialog.h @@ -19,7 +19,7 @@ #ifndef SETTINGS_DIALOG_H #define SETTINGS_DIALOG_H -#include "ui_settings_dialog.h" +#include "../core/ui_settings_dialog.h" // Qt includes #include diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.ui b/code/studio/src/plugins/core/settings_dialog.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/settings_dialog.ui rename to code/studio/src/plugins/core/settings_dialog.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/ovqt_plugin_core.xml b/code/studio/src/plugins/core/studio_plugin_core.xml similarity index 67% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/core/ovqt_plugin_core.xml rename to code/studio/src/plugins/core/studio_plugin_core.xml index 2f5d6e9a8..335ed8845 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/ovqt_plugin_core.xml +++ b/code/studio/src/plugins/core/studio_plugin_core.xml @@ -1,5 +1,5 @@ - ovqt_plugin_core + studio_plugin_core Core 0.8 Ryzom Core diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/CMakeLists.txt b/code/studio/src/plugins/disp_sheet_id/CMakeLists.txt similarity index 51% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/CMakeLists.txt rename to code/studio/src/plugins/disp_sheet_id/CMakeLists.txt index 7e5c0e409..bce24b667 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/CMakeLists.txt +++ b/code/studio/src/plugins/disp_sheet_id/CMakeLists.txt @@ -26,34 +26,34 @@ SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_DISP_SHEET_ID_PLUGIN_MOC_SRC}) SOURCE_GROUP("Display sheet id Plugin" FILES ${SRC}) SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) -ADD_LIBRARY(ovqt_plugin_disp_sheet_id MODULE ${SRC} ${OVQT_DISP_SHEET_ID_PLUGIN_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_DISP_SHEET_ID_PLUGIN_UI_HDRS}) +ADD_LIBRARY(studio_plugin_disp_sheet_id MODULE ${SRC} ${OVQT_DISP_SHEET_ID_PLUGIN_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_DISP_SHEET_ID_PLUGIN_UI_HDRS}) -TARGET_LINK_LIBRARIES(ovqt_plugin_disp_sheet_id ovqt_plugin_core nelmisc ${QT_LIBRARIES}) +TARGET_LINK_LIBRARIES(studio_plugin_disp_sheet_id studio_plugin_core nelmisc ${QT_LIBRARIES}) IF(WITH_STLPORT) - TARGET_LINK_LIBRARIES(ovqt_plugin_disp_sheet_id ${CMAKE_THREAD_LIBS_INIT}) + TARGET_LINK_LIBRARIES(studio_plugin_disp_sheet_id ${CMAKE_THREAD_LIBS_INIT}) ENDIF(WITH_STLPORT) -NL_DEFAULT_PROPS(ovqt_plugin_disp_sheet_id "NeL, Tools, 3D: Object Viewer Qt Plugin: Display sheet id") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_disp_sheet_id) -NL_ADD_LIB_SUFFIX(ovqt_plugin_disp_sheet_id) +NL_DEFAULT_PROPS(studio_plugin_disp_sheet_id "Tools: Studio Plugin: Display sheet id") +NL_ADD_RUNTIME_FLAGS(studio_plugin_disp_sheet_id) +NL_ADD_LIB_SUFFIX(studio_plugin_disp_sheet_id) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) IF(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ELSE(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_disp_sheet_id LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ENDIF(WIN32) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_disp_sheet_id.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_disp_sheet_id.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/disp_sheet_id_plugin.cpp b/code/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.cpp similarity index 88% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/disp_sheet_id_plugin.cpp rename to code/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.cpp index 62d2f0430..46a8ee6bd 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/disp_sheet_id_plugin.cpp +++ b/code/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.cpp @@ -34,6 +34,21 @@ using namespace SheetIdViewPlugin; +DispSheetIdPlugin::DispSheetIdPlugin() +{ +} + +DispSheetIdPlugin::~DispSheetIdPlugin() +{ + Core::MenuManager *menuManager = Core::ICore::instance()->menuManager(); + QAction *a = menuManager->action( "SheetIdView" ); + menuManager->unregisterAction( "SheetIdView" ); + delete a; + + delete m_LibContext; + m_LibContext = NULL; +} + bool DispSheetIdPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) { Q_UNUSED(errorString); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/disp_sheet_id_plugin.h b/code/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.h similarity index 97% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/disp_sheet_id_plugin.h rename to code/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.h index 8eaf3ead9..7506b84cc 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/disp_sheet_id_plugin.h +++ b/code/studio/src/plugins/disp_sheet_id/disp_sheet_id_plugin.h @@ -37,6 +37,9 @@ class DispSheetIdPlugin : public QObject, public ExtensionSystem::IPlugin Q_INTERFACES(ExtensionSystem::IPlugin) public: + DispSheetIdPlugin(); + ~DispSheetIdPlugin(); + bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); void extensionsInitialized(); void setNelContext(NLMISC::INelContext *nelContext); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/sheet_id_view.cpp b/code/studio/src/plugins/disp_sheet_id/sheet_id_view.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/sheet_id_view.cpp rename to code/studio/src/plugins/disp_sheet_id/sheet_id_view.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/sheet_id_view.h b/code/studio/src/plugins/disp_sheet_id/sheet_id_view.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/sheet_id_view.h rename to code/studio/src/plugins/disp_sheet_id/sheet_id_view.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/sheet_id_view.ui b/code/studio/src/plugins/disp_sheet_id/sheet_id_view.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/sheet_id_view.ui rename to code/studio/src/plugins/disp_sheet_id/sheet_id_view.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/ovqt_plugin_disp_sheet_id.xml b/code/studio/src/plugins/disp_sheet_id/studio_plugin_disp_sheet_id.xml similarity index 76% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/ovqt_plugin_disp_sheet_id.xml rename to code/studio/src/plugins/disp_sheet_id/studio_plugin_disp_sheet_id.xml index 173ce4479..4ac055b1a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/disp_sheet_id/ovqt_plugin_disp_sheet_id.xml +++ b/code/studio/src/plugins/disp_sheet_id/studio_plugin_disp_sheet_id.xml @@ -1,5 +1,5 @@ - ovqt_plugin_disp_sheet_id + studio_plugin_disp_sheet_id DisplaySheetId 1.0 pemeon diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/CMakeLists.txt b/code/studio/src/plugins/example/CMakeLists.txt similarity index 54% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/example/CMakeLists.txt rename to code/studio/src/plugins/example/CMakeLists.txt index 27e8698df..fd4008fc4 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/CMakeLists.txt +++ b/code/studio/src/plugins/example/CMakeLists.txt @@ -28,29 +28,29 @@ SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_EXAMPLE_MOC_SRC}) SOURCE_GROUP("Example Plugin" FILES ${SRC}) SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) -ADD_LIBRARY(ovqt_plugin_example MODULE ${SRC} ${OVQT_PLUG_EXAMPLE_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_EXAMPLE_UI_HDRS}) +ADD_LIBRARY(studio_plugin_example MODULE ${SRC} ${OVQT_PLUG_EXAMPLE_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_EXAMPLE_UI_HDRS}) -TARGET_LINK_LIBRARIES(ovqt_plugin_example ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) +TARGET_LINK_LIBRARIES(studio_plugin_example studio_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) -NL_DEFAULT_PROPS(ovqt_plugin_example "NeL, Tools, 3D: Object Viewer Qt Plugin: Example") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_example) -NL_ADD_LIB_SUFFIX(ovqt_plugin_example) +NL_DEFAULT_PROPS(studio_plugin_example "Tools: Studio Plugin: Example") +NL_ADD_RUNTIME_FLAGS(studio_plugin_example) +NL_ADD_LIB_SUFFIX(studio_plugin_example) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) IF(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ELSE(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_example LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ENDIF(WIN32) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_example.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_example.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/example_plugin.cpp b/code/studio/src/plugins/example/example_plugin.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/example/example_plugin.cpp rename to code/studio/src/plugins/example/example_plugin.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/example_plugin.h b/code/studio/src/plugins/example/example_plugin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/example/example_plugin.h rename to code/studio/src/plugins/example/example_plugin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/example_settings_page.cpp b/code/studio/src/plugins/example/example_settings_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/example/example_settings_page.cpp rename to code/studio/src/plugins/example/example_settings_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/example_settings_page.h b/code/studio/src/plugins/example/example_settings_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/example/example_settings_page.h rename to code/studio/src/plugins/example/example_settings_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/example_settings_page.ui b/code/studio/src/plugins/example/example_settings_page.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/example/example_settings_page.ui rename to code/studio/src/plugins/example/example_settings_page.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp b/code/studio/src/plugins/example/qnel_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.cpp rename to code/studio/src/plugins/example/qnel_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.h b/code/studio/src/plugins/example/qnel_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/example/qnel_widget.h rename to code/studio/src/plugins/example/qnel_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/simple_viewer.cpp b/code/studio/src/plugins/example/simple_viewer.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/example/simple_viewer.cpp rename to code/studio/src/plugins/example/simple_viewer.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/simple_viewer.h b/code/studio/src/plugins/example/simple_viewer.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/example/simple_viewer.h rename to code/studio/src/plugins/example/simple_viewer.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/ovqt_plugin_example.xml b/code/studio/src/plugins/example/studio_plugin_example.xml similarity index 78% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/example/ovqt_plugin_example.xml rename to code/studio/src/plugins/example/studio_plugin_example.xml index ae6664d52..434e37907 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/example/ovqt_plugin_example.xml +++ b/code/studio/src/plugins/example/studio_plugin_example.xml @@ -1,5 +1,5 @@ - ovqt_plugin_example + studio_plugin_example ExamplePlugin 0.2 dnk-88 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt b/code/studio/src/plugins/georges_editor/CMakeLists.txt similarity index 52% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt rename to code/studio/src/plugins/georges_editor/CMakeLists.txt index 40a8dcbfe..c2d3c1da7 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt +++ b/code/studio/src/plugins/georges_editor/CMakeLists.txt @@ -1,19 +1,24 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${LIBXML2_INCLUDE_DIR} - ${QT_INCLUDES}) + ${QT_INCLUDES} + ${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/qtpropertybrowser) 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) + ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h + ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h) SET(OVQT_PLUG_GEORGES_EDITOR_HDR georges_editor_plugin.h georges_editor_form.h georges_dirtree_dialog.h georges_filesystem_model.h georges_treeview_dialog.h - expandable_headerview.h) + expandable_headerview.h + browser_ctrl.h + browser_ctrl_pvt.h + ) SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui georges_dirtree_form.ui @@ -34,34 +39,34 @@ SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC}) SOURCE_GROUP("Georges Editor Plugin" FILES ${SRC}) SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) -ADD_LIBRARY(ovqt_plugin_georges_editor MODULE ${SRC} ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS} ${OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS}) +ADD_LIBRARY(studio_plugin_georges_editor MODULE ${SRC} ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS} ${OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS}) -TARGET_LINK_LIBRARIES(ovqt_plugin_georges_editor ovqt_plugin_core nelmisc nelgeorges ${QT_LIBRARIES}) +TARGET_LINK_LIBRARIES(studio_plugin_georges_editor studio_plugin_core nelmisc nelgeorges qt_property_browser ${QT_LIBRARIES}) -NL_DEFAULT_PROPS(ovqt_plugin_georges_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Georges Editor") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_georges_editor) -NL_ADD_LIB_SUFFIX(ovqt_plugin_georges_editor) +NL_DEFAULT_PROPS(studio_plugin_georges_editor "Tools: Studio Plugin: Georges Editor") +NL_ADD_RUNTIME_FLAGS(studio_plugin_georges_editor) +NL_ADD_LIB_SUFFIX(studio_plugin_georges_editor) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) IF(WITH_PCH) - ADD_NATIVE_PRECOMPILED_HEADER(ovqt_plugin_georges_editor ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) + ADD_NATIVE_PRECOMPILED_HEADER(studio_plugin_georges_editor ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) ENDIF(WITH_PCH) IF(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ELSE(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_georges_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ENDIF(WIN32) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_georges_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_georges_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/studio/src/plugins/georges_editor/actions.cpp b/code/studio/src/plugins/georges_editor/actions.cpp new file mode 100644 index 000000000..c96bca95c --- /dev/null +++ b/code/studio/src/plugins/georges_editor/actions.cpp @@ -0,0 +1,103 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// 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 "actions.h" +#include "formitem.h" +#include "georgesform_model.h" + +// Qt includes + + +// NeL includes +#include +#include +#include +#include +#include +#include +#include + +namespace GeorgesQt +{ + + CUndoFormArrayRenameCommand::CUndoFormArrayRenameCommand(CGeorgesFormModel *model, CFormItem *item, const QVariant &value, QUndoCommand *parent) + : QUndoCommand("Rename Form Array Member", parent), m_model(model), m_item(item) + { + m_newValue = value.toString(); + } + + void CUndoFormArrayRenameCommand::redo() + { + update(true); + } + + void CUndoFormArrayRenameCommand::undo() + { + update(false); + } + + void CUndoFormArrayRenameCommand::update(bool redo) + { + // Get the parent node + const NLGEORGES::CFormDfn *parentDfn; + uint indexDfn; + const NLGEORGES::CFormDfn *nodeDfn; + const NLGEORGES::CType *nodeType; + NLGEORGES::CFormElm *node; + NLGEORGES::UFormDfn::TEntryType type; + bool isArray; + bool vdfnArray; + NLGEORGES::CForm *form=static_cast(m_item->form()); + NLGEORGES::CFormElm *elm = static_cast(&form->Elements); + + nlverify ( elm->getNodeByName (m_item->formName().c_str (), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, isArray, vdfnArray, true, NLGEORGES_FIRST_ROUND) ); + if (node) + { + std::string tmpName; + node->getFormName(tmpName); + + NLGEORGES::CFormElmArray* array = static_cast (node->getParent ()); + + // In the redo stage save the old value, just in case. + if(redo) + { + // If the name of the element is empty then give it a nice default. + if(array->Elements[m_item->structId()].Name.empty()) + { + m_oldValue.append("#"); + m_oldValue.append(QString("%1").arg(m_item->structId())); + } + else + { + m_oldValue = QString(array->Elements[m_item->structId()].Name.c_str()); + } + } + + QString value; + if(redo) + value = m_newValue; + else + value = m_oldValue; + + + array->Elements[m_item->structId()].Name = value.toAscii().data(); + m_item->setName(value.toAscii().data()); + + m_model->emitDataChanged(m_model->index(m_item->row(), 0, m_item)); + } + } +} \ No newline at end of file diff --git a/code/studio/src/plugins/georges_editor/actions.h b/code/studio/src/plugins/georges_editor/actions.h new file mode 100644 index 000000000..0c57b0577 --- /dev/null +++ b/code/studio/src/plugins/georges_editor/actions.h @@ -0,0 +1,48 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// 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 ACTIONS_H +#define ACTIONS_H + +#include +#include + +namespace GeorgesQt +{ + class CFormItem; + class CGeorgesFormModel; + + class CUndoFormArrayRenameCommand : public QUndoCommand + { + public: + CUndoFormArrayRenameCommand(CGeorgesFormModel *model, CFormItem *item, const QVariant &value, QUndoCommand *parent = 0); + ~CUndoFormArrayRenameCommand() {} + + void redo(); + void undo(); + + void update(bool redo); + + protected: + CFormItem *m_item; + CGeorgesFormModel *m_model; + + QString m_newValue; + QString m_oldValue; + }; +} + +#endif // ACTIONS_H \ No newline at end of file diff --git a/code/studio/src/plugins/georges_editor/browser_ctrl.cpp b/code/studio/src/plugins/georges_editor/browser_ctrl.cpp new file mode 100644 index 000000000..aa431b45c --- /dev/null +++ b/code/studio/src/plugins/georges_editor/browser_ctrl.cpp @@ -0,0 +1,81 @@ +#include "browser_ctrl.h" +#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h" +#include "3rdparty/qtpropertybrowser/qtvariantproperty.h" +#include + +#include "nel/georges/form.h" + +#include "formitem.h" + +#include "browser_ctrl_pvt.h" + +BrowserCtrl::BrowserCtrl( QtTreePropertyBrowser *browser ) : +QObject( browser ) +{ + m_pvt = new BrowserCtrlPvt(); + m_pvt->setBrowser( browser ); + + connect( m_pvt, SIGNAL( arrayResized( const QString&, int ) ), this, SLOT( onArrayResized( const QString&, int ) ) ); + connect( m_pvt, SIGNAL( modified() ), this, SLOT( onModified() ) ); +} + +BrowserCtrl::~BrowserCtrl() +{ + delete m_pvt; + m_pvt = NULL; +} + +void BrowserCtrl::clicked( const QModelIndex &idx ) +{ + disableMgrConnections(); + m_pvt->clear(); + + GeorgesQt::CFormItem *item = static_cast< GeorgesQt::CFormItem* >( idx.internalPointer() ); + NLGEORGES::UFormElm &root = m_form->getRootNode(); + NLGEORGES::CFormElm *rootNode = dynamic_cast< NLGEORGES::CFormElm* >( &root ); + m_pvt->setRootNode( rootNode ); + NLGEORGES::UFormElm *node = NULL; + bool b = false; + + b = m_form->getRootNode().getNodeByName( &node, item->formName().c_str() ); + + if( !b || ( node == NULL ) ) + return; + + m_pvt->setupNode( node ); + + enableMgrConnections(); + +} + +void BrowserCtrl::onValueChanged( QtProperty *p, const QVariant &value ) +{ + m_pvt->onValueChanged( p, value ); +} + +void BrowserCtrl::onArrayResized( const QString &name, int size ) +{ + Q_EMIT arrayResized( name, size ); +} + +void BrowserCtrl::onModified() +{ + Q_EMIT modified(); +} + +void BrowserCtrl::enableMgrConnections() +{ + QtVariantPropertyManager *mgr = m_pvt->manager(); + + connect( mgr, SIGNAL( valueChanged( QtProperty*, const QVariant & ) ), + this, SLOT( onValueChanged( QtProperty*, const QVariant & ) ) ); +} + +void BrowserCtrl::disableMgrConnections() +{ + QtVariantPropertyManager *mgr = m_pvt->manager(); + + disconnect( mgr, SIGNAL( valueChanged( QtProperty*, const QVariant & ) ), + this, SLOT( onValueChanged( QtProperty*, const QVariant & ) ) ); +} + diff --git a/code/studio/src/plugins/georges_editor/browser_ctrl.h b/code/studio/src/plugins/georges_editor/browser_ctrl.h new file mode 100644 index 000000000..9c70f51bb --- /dev/null +++ b/code/studio/src/plugins/georges_editor/browser_ctrl.h @@ -0,0 +1,47 @@ +#ifndef BROWSER_CTRL_H +#define BROWSER_CTRL_H + +#include + +namespace NLGEORGES +{ + class UForm; +} + +class QtTreePropertyBrowser; +class QModelIndex; +class QVariant; +class QtProperty; + +class BrowserCtrlPvt; + +class BrowserCtrl : public QObject +{ + Q_OBJECT +public: + BrowserCtrl( QtTreePropertyBrowser *browser ); + ~BrowserCtrl(); + void setForm( NLGEORGES::UForm *form ){ m_form = form; } + +public Q_SLOTS: + void clicked( const QModelIndex &idx ); + +Q_SIGNALS: + void arrayResized( const QString &name, int size ); + void modified(); + +private Q_SLOTS: + void onValueChanged( QtProperty *p, const QVariant &value ); + void onArrayResized( const QString &name, int size ); + void onModified(); + +private: + void enableMgrConnections(); + void disableMgrConnections(); + + + BrowserCtrlPvt *m_pvt; + NLGEORGES::UForm *m_form; +}; + +#endif diff --git a/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp b/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp new file mode 100644 index 000000000..0e22765da --- /dev/null +++ b/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp @@ -0,0 +1,205 @@ +#include "browser_ctrl_pvt.h" +#include "3rdparty/qtpropertybrowser/qttreepropertybrowser.h" +#include "3rdparty/qtpropertybrowser/qtvariantproperty.h" +#include + +namespace +{ + + QVariant::Type getValueType( const NLGEORGES::UType *typ ) + { + QVariant::Type t = QVariant::String; + + NLGEORGES::UType::TType ttyp = NLGEORGES::UType::String; + if( typ != NULL ) + ttyp = typ->getType(); + + switch( ttyp ) + { + case NLGEORGES::UType::UnsignedInt: t = QVariant::UInt; break; + case NLGEORGES::UType::SignedInt: t = QVariant::Int; break; + case NLGEORGES::UType::Double: t = QVariant::Double; break; + case NLGEORGES::UType::Color: t = QVariant::Color; break; + case NLGEORGES::UType::String: t = QVariant::String; break; + } + + return t; + } + +} + + +BrowserCtrlPvt::BrowserCtrlPvt( QObject *parent ) : +QObject( parent ) +{ + mgr = new QtVariantPropertyManager(); + factory = new QtVariantEditorFactory(); + m_currentNode = NULL; + m_rootNode = NULL; +} + +BrowserCtrlPvt::~BrowserCtrlPvt() +{ + delete mgr; + mgr = NULL; + delete factory; + factory = NULL; + m_browser = NULL; +} + +void BrowserCtrlPvt::setupAtom( NLGEORGES::CFormElmStruct::CFormElmStructElm &elm ) +{ + QString key = elm.Name.c_str(); + QString value = ""; + QVariant::Type t = QVariant::String; + + if( elm.Element != NULL ) + { + t = getValueType( elm.Element->getType() ); + + std::string formName; + elm.Element->getFormName( formName, NULL ); + + std::string v; + m_rootNode->getValueByName( v, formName.c_str(), NLGEORGES::UFormElm::NoEval, NULL, 0 ); + value = v.c_str(); + } + + QtVariantProperty *p = mgr->addProperty( t, key ); + p->setValue( value ); + m_browser->addProperty( p ); +} + +void BrowserCtrlPvt::setupArray( NLGEORGES::UFormElm *node ) +{ + NLGEORGES::CFormElmArray *arr = static_cast< NLGEORGES::CFormElmArray* >( node ); + uint size = 0; + arr->getArraySize( size ); + + QString key = QObject::tr( "Array size" ); + QtVariantProperty *p = mgr->addProperty( QVariant::Int, key ); + p->setValue( size ); + m_browser->addProperty( p ); + +} + +void BrowserCtrlPvt::setupStruct( NLGEORGES::UFormElm *node ) +{ + NLGEORGES::CFormElmStruct *st = static_cast< NLGEORGES::CFormElmStruct* >( node ); + + for( int i = 0; i < st->Elements.size(); i++ ) + { + NLGEORGES::CFormElmStruct::CFormElmStructElm &elm = st->Elements[ i ]; + if( ( elm.Element != NULL ) && !elm.Element->isAtom() ) + continue; + + if( elm.Element == NULL ) + { + NLGEORGES::CFormDfn::CEntry &entry = st->FormDfn->getEntry( i ); + if( entry.getArrayFlag() ) + continue; + } + + setupAtom( elm ); + } +} + +void BrowserCtrlPvt::setupNode( NLGEORGES::UFormElm *node ) +{ + if( node->isStruct() ) + setupStruct( node ); + else + if( node->isArray() ) + setupArray( node ); + else + return; + + m_currentNode = node; + m_browser->setFactoryForManager( mgr, factory ); +} + +void BrowserCtrlPvt::clear() +{ + m_browser->clear(); + m_currentNode = NULL; +} + + +void BrowserCtrlPvt::onStructValueChanged( QtProperty *p, const QVariant &value ) +{ + std::string k = p->propertyName().toUtf8().constData(); + std::string v = value.toString().toUtf8().constData(); + + bool created = false; + m_currentNode->setValueByName( v.c_str(), k.c_str(), &created ); + + Q_EMIT modified(); +} + +void BrowserCtrlPvt::onArrayValueChanged( QtProperty *p, const QVariant &value ) +{ + NLGEORGES::CFormElmArray *arr = static_cast< NLGEORGES::CFormElmArray* >( m_currentNode ); + std::string formName; + arr->getFormName( formName, NULL ); + + int newSize = value.toInt(); + int oldSize = arr->Elements.size(); + + if( newSize == oldSize ) + return; + + if( newSize < oldSize ) + { + for( int i = newSize; i < oldSize; i++ ) + { + delete arr->Elements[ i ].Element; + } + + arr->Elements.resize( newSize ); + } + else + { + arr->Elements.resize( newSize ); + + + const NLGEORGES::CFormDfn *parentDfn; + const NLGEORGES::CFormDfn *nodeDfn; + uint indexDfn; + const NLGEORGES::CType *type; + NLGEORGES::UFormDfn::TEntryType entryType; + NLGEORGES::CFormElm *node; + bool created; + bool isArray; + + QString idx; + + for( int i = oldSize; i < newSize; i++ ) + { + idx.clear(); + idx += "["; + idx += QString::number( i ); + idx += "]"; + + bool b; + b = arr->createNodeByName( idx.toUtf8().constData(), &parentDfn, indexDfn, &nodeDfn, &type, &node, entryType, isArray, created ); + } + } + + QString name = formName.c_str(); + Q_EMIT arrayResized( name, newSize ); + Q_EMIT modified(); +} + +void BrowserCtrlPvt::onValueChanged( QtProperty *p, const QVariant &value ) +{ + if( m_currentNode == NULL ) + return; + + if( m_currentNode->isStruct() ) + onStructValueChanged( p, value ); + else + if( m_currentNode->isArray() ) + onArrayValueChanged( p, value ); +} + + diff --git a/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.h b/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.h new file mode 100644 index 000000000..0d0363c1f --- /dev/null +++ b/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.h @@ -0,0 +1,54 @@ +#ifndef BROWSER_CTRL_PVT_H +#define BROWSER_CTRL_PVT_H + +#include + +namespace NLGEORGES +{ + class CFormElm; + class UFormElm; + class CFormElmStruct; +} + +class QtVariantPropertyManager; +class QtVariantEditorFactory; +class QtTreePropertyBrowser; +class QVariant; +class QtProperty; + +class BrowserCtrlPvt : public QObject +{ + Q_OBJECT +public: + BrowserCtrlPvt( QObject *parent = NULL ); + ~BrowserCtrlPvt(); + + void clear(); + void setupNode( NLGEORGES::UFormElm *node ); + void onValueChanged( QtProperty *p, const QVariant &value ); + + QtVariantPropertyManager* manager() const{ return mgr; } + void setRootNode( NLGEORGES::CFormElm *root ){ m_rootNode = root; } + void setBrowser( QtTreePropertyBrowser *browser ){ m_browser = browser; } + +Q_SIGNALS: + void arrayResized( const QString &name, int size ); + void modified(); + +private: + void setupStruct( NLGEORGES::UFormElm *node ); + void setupArray( NLGEORGES::UFormElm *node ); + void setupAtom( NLGEORGES::CFormElmStruct::CFormElmStructElm &elm ); + + void onStructValueChanged( QtProperty *p, const QVariant &value ); + void onArrayValueChanged( QtProperty *p, const QVariant &value ); + + QtVariantPropertyManager *mgr; + QtVariantEditorFactory *factory; + QtTreePropertyBrowser *m_browser; + + NLGEORGES::UFormElm *m_currentNode; + NLGEORGES::CFormElm *m_rootNode; +}; + +#endif diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp b/code/studio/src/plugins/georges_editor/expandable_headerview.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.cpp rename to code/studio/src/plugins/georges_editor/expandable_headerview.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h b/code/studio/src/plugins/georges_editor/expandable_headerview.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/expandable_headerview.h rename to code/studio/src/plugins/georges_editor/expandable_headerview.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp b/code/studio/src/plugins/georges_editor/formdelegate.cpp similarity index 99% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp rename to code/studio/src/plugins/georges_editor/formdelegate.cpp index 91f62c24b..f2a2ba6c3 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.cpp +++ b/code/studio/src/plugins/georges_editor/formdelegate.cpp @@ -38,6 +38,8 @@ #include "georgesform_proxy_model.h" #include "formitem.h" +#if 0 + namespace GeorgesQt { @@ -277,3 +279,5 @@ namespace GeorgesQt editor->setGeometry(r); } } /* namespace GeorgesQt */ + +#endif // 0 \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.h b/code/studio/src/plugins/georges_editor/formdelegate.h similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.h rename to code/studio/src/plugins/georges_editor/formdelegate.h index b6885833e..42b10ef3d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formdelegate.h +++ b/code/studio/src/plugins/georges_editor/formdelegate.h @@ -19,6 +19,8 @@ #include +#if 0 + namespace GeorgesQt { @@ -38,4 +40,6 @@ namespace GeorgesQt }; } +#endif // 0 + #endif // FORMDELEGATE_H diff --git a/code/studio/src/plugins/georges_editor/formitem.cpp b/code/studio/src/plugins/georges_editor/formitem.cpp new file mode 100644 index 000000000..1ca2ecbe1 --- /dev/null +++ b/code/studio/src/plugins/georges_editor/formitem.cpp @@ -0,0 +1,255 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// 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 "formitem.h" +#include "actions.h" +#include "georges_editor_form.h" + +// Qt includes +#include + +// NeL includes +#include +#include +#include +#include + +using namespace NLGEORGES; + +namespace GeorgesQt +{ + CFormItem::CFormItem() + { + } + + CFormItem::~CFormItem() + { + clearChildren(); + } + + void CFormItem::appendChild(CFormItem *item) + { + childItems.append(item); + } + + CFormItem *CFormItem::child(int row) + { + return childItems.value(row); + } + + int CFormItem::childCount() const + { + return childItems.count(); + } + + int CFormItem::columnCount() const + { + //nlinfo("columnCount %d",itemData.count()); + //return itemData.count(); + return 1; + } + + QVariant CFormItem::data(int column) const + { + //return itemData.value(column); + return QVariant(_Name.c_str()); + } + + CFormItem *CFormItem::parent() + { + return parentItem; + } + + int CFormItem::row() const + { + if (parentItem) + return parentItem->childItems.indexOf(const_cast(this)); + + return 0; + } + + bool CFormItem::setData(int column, const QVariant &value) + { + nlwarning("This should not be called anymore."); + return false; + } + + bool CFormItem::isEditable(int column) + { + // Ensure only valid types can be edited. + if(_Type == Null) + return false; + + // Make sure only the first column (name) can be editted. + if (column != 0) + return false; + + if(isArrayMember()) + return true; + + return false; + } + + bool CFormItem::isArray() + { + // If it wasn't a root node then lets check the node type. + const NLGEORGES::CFormDfn *parentDfn; + uint indexDfn; + const NLGEORGES::CFormDfn *nodeDfn; + const NLGEORGES::CType *nodeType; + NLGEORGES::CFormElm *node; + NLGEORGES::UFormDfn::TEntryType type; + bool array; + bool parentVDfnArray; + NLGEORGES::CForm *form = static_cast(m_form); + NLGEORGES::CFormElm *elm = static_cast(&form->getRootNode()); + nlverify ( elm->getNodeByName (_FormName.c_str(), &parentDfn, indexDfn, + &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) ); + + if(array && node) + return true; + + return false; + } + + bool CFormItem::isArrayMember() + { + CFormItem *parent = this->parent(); + + // If it wasn't a root node then lets check the node type. + const NLGEORGES::CFormDfn *parentDfn; + uint indexDfn; + const NLGEORGES::CFormDfn *nodeDfn; + const NLGEORGES::CType *nodeType; + NLGEORGES::CFormElm *parentNode; + NLGEORGES::UFormDfn::TEntryType type; + bool array; + bool parentVDfnArray; + NLGEORGES::CForm *form = static_cast(m_form); + NLGEORGES::CFormElm *elm = static_cast(&form->getRootNode()); + nlverify ( elm->getNodeByName (parent->formName ().c_str (), &parentDfn, indexDfn, + &nodeDfn, &nodeType, &parentNode, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) ); + + if(array && parentNode) + return true; + + return false; + } + + QIcon CFormItem::getItemImage(CFormItem *rootItem) + { + if(_Type == CFormItem::Null) + { + return QIcon(":/images/root.ico"); + } + else if(_Type == CFormItem::Form) + { + // If the parent is the root item then this is the content. + if(parentItem == rootItem) + return QIcon(":/images/root.ico"); + + // If it wasn't a root node then lets check the node type. + const NLGEORGES::CFormDfn *parentDfn; + uint indexDfn; + const NLGEORGES::CFormDfn *nodeDfn; + const NLGEORGES::CType *nodeType; + NLGEORGES::CFormElm *node; + NLGEORGES::UFormDfn::TEntryType type; + bool array; + bool parentVDfnArray; + NLGEORGES::CForm *form = static_cast(m_form); + NLGEORGES::CFormElm *elm = static_cast(&form->getRootNode()); + nlverify ( elm->getNodeByName (_FormName.c_str(), &parentDfn, indexDfn, &nodeDfn, &nodeType, &node, type, array, parentVDfnArray, true, NLGEORGES_FIRST_ROUND) ); + + if(array) + { + return QIcon(":/images/array.ico"); + } + else + { + if(type == NLGEORGES::UFormDfn::EntryType) + { + if(parentDfn) + { + // Not sure what the hell to do with this. Gets filename from parent dfn? + } + return QIcon(":/images/zfee51.ico"); + } + else if(type == NLGEORGES::UFormDfn::EntryDfn) + { + if(parentDfn) + { + // Not sure what the hell to do with this. Gets filename from parent dfn? + } + return QIcon(":/images/struct.ico"); + } + else if(type == NLGEORGES::UFormDfn::EntryVirtualDfn) + { + if(node) + { + // Not sure what the hell to do with this. Gets filename from parent dfn? + std::string dfnName; + NLMISC::safe_cast(node)->getDfnName(dfnName); + // return dfnName.c_str() ? + } + return QIcon(":/images/vstruct.ico"); + } + } + //return QIcon(":/images/struct.ico"); + } + return QIcon(); + } + + CFormItem* CFormItem::findItem( const QString &formName ) + { + CFormItem *item = NULL; + + if( _FormName.c_str() == formName ) + return this; + + for( int i = 0; i < childItems.count(); i++ ) + { + item = childItems[ i ]->findItem( formName ); + if( item != NULL ) + return item; + } + + return item; + } + + void CFormItem::clearChildren() + { + qDeleteAll( childItems ); + childItems.clear(); + } + + CFormItem *CFormItem::add (TSub type, const char *name, uint structId, const char *formName, uint slot, NLGEORGES::UForm *formPtr) + { + CFormItem *newNode = new CFormItem(); + newNode->_Type = type; + newNode->_Name = name; + newNode->parentItem = this; + newNode->_StructId = structId; + newNode->_FormName = formName; + newNode->_Slot = slot; + newNode->m_form = formPtr; + + appendChild(newNode); + return newNode; + } + +} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.h b/code/studio/src/plugins/georges_editor/formitem.h similarity index 50% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.h rename to code/studio/src/plugins/georges_editor/formitem.h index f440d1cf4..d29dfce0c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/formitem.h +++ b/code/studio/src/plugins/georges_editor/formitem.h @@ -18,6 +18,7 @@ #define FORMITEM_H // NeL includes +#include #include // Qt includes @@ -28,17 +29,25 @@ namespace GeorgesQt { class CFormItem - { public: - CFormItem(NLGEORGES::UFormElm *elm, const QList &data, - CFormItem *parent = 0, - NLGEORGES::UFormElm::TWhereIsValue = NLGEORGES::UFormElm::ValueForm, - NLGEORGES::UFormElm::TWhereIsNode = NLGEORGES::UFormElm::NodeForm); + // What is the sub object ? + enum TSub + { + Null, // Nothing in this node (root ?) + Header, // Header node + Type, // This node is a type + Dfn, // This node is a dfn + Form, // This node is a form + }; + + CFormItem(); ~CFormItem(); void appendChild(CFormItem *child); + CFormItem *add (TSub type, const char *name, uint structId, const char *formName, uint slot, NLGEORGES::UForm *formPtr); + CFormItem *child(int row); int childCount() const; int columnCount() const; @@ -46,23 +55,40 @@ namespace GeorgesQt int row() const; CFormItem *parent(); bool setData(int column, const QVariant &value); - NLGEORGES::UFormElm* getFormElm() {return formElm;} - NLGEORGES::UFormElm::TWhereIsValue valueFrom() - { - return whereV; - } - NLGEORGES::UFormElm::TWhereIsNode nodeFrom() - { - return whereN; - } - private: + TSub nodeType() { return _Type; } + std::string formName() { return _FormName; } + + std::string name() { return _Name; } + void setName(std::string name) { _Name = name; } + + uint structId() { return _StructId; } + + NLGEORGES::UForm *form() { return m_form; } + + bool isEditable(int column); + bool isArray(); + bool isArrayMember(); + + QIcon getItemImage(CFormItem *rootItem); + + CFormItem* findItem( const QString &formName ); + + void clearChildren(); + + private: QList childItems; QList itemData; CFormItem *parentItem; NLGEORGES::UFormElm* formElm; - NLGEORGES::UFormElm::TWhereIsValue whereV; - NLGEORGES::UFormElm::TWhereIsNode whereN; + NLGEORGES::UForm *m_form; + + uint _StructId; + std::string _Name; + std::string _FormName; + TSub _Type; + uint _Slot; + }; // CFormItem } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp b/code/studio/src/plugins/georges_editor/georges.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.cpp rename to code/studio/src/plugins/georges_editor/georges.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.h b/code/studio/src/plugins/georges_editor/georges.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges.h rename to code/studio/src/plugins/georges_editor/georges.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp b/code/studio/src/plugins/georges_editor/georges_dirtree_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp rename to code/studio/src/plugins/georges_editor/georges_dirtree_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h b/code/studio/src/plugins/georges_editor/georges_dirtree_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h rename to code/studio/src/plugins/georges_editor/georges_dirtree_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui b/code/studio/src/plugins/georges_editor/georges_dirtree_form.ui similarity index 94% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui rename to code/studio/src/plugins/georges_editor/georges_dirtree_form.ui index e14857e89..64f8cc57c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui +++ b/code/studio/src/plugins/georges_editor/georges_dirtree_form.ui @@ -77,7 +77,7 @@ - + diff --git a/code/studio/src/plugins/georges_editor/georges_editor.qrc b/code/studio/src/plugins/georges_editor/georges_editor.qrc new file mode 100644 index 000000000..8d71d1438 --- /dev/null +++ b/code/studio/src/plugins/georges_editor/georges_editor.qrc @@ -0,0 +1,12 @@ + + + images/array.ico + images/header.ico + images/hold.ico + images/root.ico + images/struct.ico + images/vstruct.ico + images/zfee51.ico + images/ic_nel_georges_editor.png + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_constants.h b/code/studio/src/plugins/georges_editor/georges_editor_constants.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_constants.h rename to code/studio/src/plugins/georges_editor/georges_editor_constants.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp b/code/studio/src/plugins/georges_editor/georges_editor_form.cpp similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp rename to code/studio/src/plugins/georges_editor/georges_editor_form.cpp index 6c46d4964..dc0ca409d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp +++ b/code/studio/src/plugins/georges_editor/georges_editor_form.cpp @@ -36,6 +36,7 @@ namespace GeorgesQt { + QUndoStack *GeorgesEditorForm::UndoStack = NULL; GeorgesEditorForm::GeorgesEditorForm(QWidget *parent) : QMainWindow(parent), @@ -62,7 +63,7 @@ namespace GeorgesQt m_mainDock->setDockNestingEnabled(true); layout->addWidget(m_mainDock); - m_undoStack = new QUndoStack(this); + UndoStack = new QUndoStack(this); Core::MenuManager *menuManager = Core::ICore::instance()->menuManager(); m_openAction = menuManager->action(Core::Constants::OPEN); @@ -115,7 +116,7 @@ namespace GeorgesQt QUndoStack *GeorgesEditorForm::undoStack() const { - return m_undoStack; + return UndoStack; } void GeorgesEditorForm::open() @@ -212,7 +213,7 @@ namespace GeorgesQt } CGeorgesTreeViewDialog *dock = new CGeorgesTreeViewDialog(m_mainDock); - dock->setUndoStack(m_undoStack); + dock->setUndoStack(UndoStack); m_lastActiveDock = dock; m_dockedWidgets.append(dock); @@ -270,10 +271,16 @@ namespace GeorgesQt void GeorgesEditorForm::setModified () { qDebug() << "setModified"; + bool saveEnabled = false; if (m_lastActiveDock) - m_saveAction->setEnabled(m_lastActiveDock->isModified()); + saveEnabled = m_lastActiveDock->isModified(); else - m_saveAction->setEnabled(false); + saveEnabled = false; + + m_saveAction->setEnabled( saveEnabled ); + + QAction *saveAction = Core::ICore::instance()->menuManager()->action( Core::Constants::SAVE ); + saveAction->setEnabled( saveEnabled ); } void GeorgesEditorForm::focusChanged ( QWidget * old, QWidget * now ) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h b/code/studio/src/plugins/georges_editor/georges_editor_form.h similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h rename to code/studio/src/plugins/georges_editor/georges_editor_form.h index 77fdd1ec8..c9cef964c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h +++ b/code/studio/src/plugins/georges_editor/georges_editor_form.h @@ -38,6 +38,8 @@ public: QUndoStack *undoStack() const; + static QUndoStack *UndoStack; + public Q_SLOTS: void open(); void loadFile(const QString fileName); @@ -54,7 +56,6 @@ private: void readSettings(); void writeSettings(); - QUndoStack *m_undoStack; Ui::GeorgesEditorForm m_ui; CGeorgesDirTreeDialog *m_georgesDirTreeDialog; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.ui b/code/studio/src/plugins/georges_editor/georges_editor_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.ui rename to code/studio/src/plugins/georges_editor/georges_editor_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp b/code/studio/src/plugins/georges_editor/georges_editor_plugin.cpp similarity index 96% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp rename to code/studio/src/plugins/georges_editor/georges_editor_plugin.cpp index 075ac41b2..f1b419e4e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp +++ b/code/studio/src/plugins/georges_editor/georges_editor_plugin.cpp @@ -39,6 +39,9 @@ GeorgesEditorPlugin::~GeorgesEditorPlugin() } qDeleteAll(m_autoReleaseObjects); m_autoReleaseObjects.clear(); + + delete m_libContext; + m_libContext = NULL; } bool GeorgesEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.h b/code/studio/src/plugins/georges_editor/georges_editor_plugin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.h rename to code/studio/src/plugins/georges_editor/georges_editor_plugin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp b/code/studio/src/plugins/georges_editor/georges_filesystem_model.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp rename to code/studio/src/plugins/georges_editor/georges_filesystem_model.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h b/code/studio/src/plugins/georges_editor/georges_filesystem_model.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h rename to code/studio/src/plugins/georges_editor/georges_filesystem_model.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp b/code/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp similarity index 52% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp rename to code/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp index c19a01fd7..3ecc73045 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.cpp +++ b/code/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp @@ -14,14 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "stdpch.h" #include "georges_treeview_dialog.h" -#include "georges.h" -#include "georgesform_model.h" -#include "georgesform_proxy_model.h" -#include "formitem.h" -#include "formdelegate.h" -#include "expandable_headerview.h" // Qt includes #include @@ -43,6 +36,15 @@ #include "../core/icore.h" #include "../core/core_constants.h" +// Project includes +#include "georges.h" +#include "georgesform_model.h" +#include "georgesform_proxy_model.h" +#include "formitem.h" +#include "formdelegate.h" +#include "expandable_headerview.h" +#include "browser_ctrl.h" + using namespace NLMISC; using namespace NLGEORGES; @@ -60,7 +62,7 @@ namespace GeorgesQt // Set the default sheet dir dir to the level design path. m_lastSheetDir = "."; QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(Core::Constants::DATA_PATH_SECTION); + settings->beginGroup(Core::Constants::DATA_PATH_SECTION); m_lastSheetDir = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString(); settings->endGroup(); @@ -71,29 +73,31 @@ namespace GeorgesQt m_ui.treeView->header()->setStretchLastSection(true); m_ui.treeViewTabWidget->setTabEnabled (2,false); - m_ui.checkBoxParent->setStyleSheet("background-color: rgba(0,255,0,30)"); - m_ui.checkBoxDefaults->setStyleSheet("background-color: rgba(255,0,0,30)"); m_form = 0; + m_model = NULL; - FormDelegate *formdelegate = new FormDelegate(this); - m_ui.treeView->setItemDelegateForColumn(1, formdelegate); + m_ui.treeView->setContextMenuPolicy(Qt::CustomContextMenu); - // Set up custom context menu. - setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint&))); + m_browserCtrl = new BrowserCtrl( m_ui.propertiesBrowser ); + connect(m_ui.treeView, SIGNAL(customContextMenuRequested(const QPoint&)), + this, SLOT(showContextMenu(const QPoint&))); connect(m_ui.treeView, SIGNAL(doubleClicked (QModelIndex)), this, SLOT(doubleClicked (QModelIndex))); - connect(m_ui.checkBoxParent, SIGNAL(toggled(bool)), - this, SLOT(filterRows())); - connect(m_ui.checkBoxDefaults, SIGNAL(toggled(bool)), - this, SLOT(filterRows())); + connect(m_ui.treeView, SIGNAL(clicked(const QModelIndex&)), + m_browserCtrl, SLOT(clicked(const QModelIndex&))); connect(m_header, SIGNAL(headerClicked(int)), this, SLOT(headerClicked(int))); + connect(m_browserCtrl, SIGNAL(arrayResized(const QString&,int)), this, SLOT(onArrayResized(const QString&,int))); + + connect(m_browserCtrl, SIGNAL(modified()), this, SLOT(modifiedFile())); } CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog() { + m_browserCtrl = NULL; + m_model = NULL; + delete m_form; qDebug() << "DTOR"; } @@ -101,45 +105,46 @@ namespace GeorgesQt void CGeorgesTreeViewDialog::headerClicked(int section) { if (section == 0) - { + { if (*(m_header->expanded())) m_ui.treeView->expandAll(); else m_ui.treeView->collapseAll(); - } + } } void CGeorgesTreeViewDialog::setForm(const CForm *form) { m_form = (UForm*)form; + m_browserCtrl->setForm( (UForm*)form ); } NLGEORGES::CForm* CGeorgesTreeViewDialog::getFormByName(const QString formName) { - if(NLMISC::CPath::exists(formName.toUtf8().constData())) + if(NLMISC::CPath::exists(formName.toAscii().data())) { - //NLGEORGES::CForm *form = dynamic_cast(m_georges->loadForm(formName.toUtf8())); - return (NLGEORGES::CForm *)m_georges->loadForm(formName.toUtf8().constData()); + //NLGEORGES::CForm *form = dynamic_cast(m_georges->loadForm(formName.toAscii().data())); + return (NLGEORGES::CForm *)m_georges->loadForm(formName.toAscii().data()); } //else //{ // CForm *form = 0; // // Load the DFN - // std::string extStr = NLMISC::CFile::getExtension( formName.toUtf8() ); + // std::string extStr = NLMISC::CFile::getExtension( formName.toAscii().data() ); // QString dfnName = QString("%1.dfn").arg(extStr.c_str()); // UFormDfn *formdfn; - // if (NLMISC::CPath::exists(dfnName.toUtf8())) + // if (NLMISC::CPath::exists(dfnName.toAscii().data())) // { - // formdfn = _georges->loadFormDfn (dfnName.toUtf8()); + // formdfn = _georges->loadFormDfn (dfnName.toAscii().data()); // if (!formdfn) // { - // nlwarning("Failed to load dfn: %s", dfnName.toUtf8()); + // nlwarning("Failed to load dfn: %s", dfnName.toAscii().data()); // return 0; // } // } // else // { - // nlwarning("Cannot find dfn: %s", dfnName.toUtf8()); + // nlwarning("Cannot find dfn: %s", dfnName.toAscii().data()); // return 0; // } @@ -155,56 +160,56 @@ namespace GeorgesQt // } // return form; //} - nlinfo("File '%s' does not exist!", formName.toUtf8().constData()); + nlinfo("File '%s' does not exist!", formName.toAscii().data()); return 0; } NLGEORGES::CForm* CGeorgesTreeViewDialog::getFormByDfnName(const QString dfnName) { - if(NLMISC::CPath::exists(dfnName.toUtf8().constData())) - { - // Create a new form object. - NLGEORGES::CForm *form = new NLGEORGES::CForm(); - m_form = form; + if(NLMISC::CPath::exists(dfnName.toAscii().data())) + { + // Create a new form object. + NLGEORGES::CForm *form = new NLGEORGES::CForm(); + m_form = form; - // Retrieve a copy of the root definition. - NLGEORGES::CFormDfn *formDfn = dynamic_cast(m_georges->loadFormDfn(dfnName.toUtf8().constData())); + // Retrieve a copy of the root definition. + NLGEORGES::CFormDfn *formDfn = dynamic_cast(m_georges->loadFormDfn(dfnName.toAscii().data())); - // Next we'll use the root node to build a new form. - NLGEORGES::CFormElmStruct *fes = dynamic_cast(getRootNode(0)); - fes->build(formDfn); + // Next we'll use the root node to build a new form. + NLGEORGES::CFormElmStruct *fes = dynamic_cast(getRootNode(0)); + fes->build(formDfn); - // And then initialize the held elements; - for(uint i = 0; i(getRootNode(i+1)); - fes->build(formDfn); - } + // And then initialize the held elements; + for(uint i = 0; i(getRootNode(i+1)); + fes->build(formDfn); + } - return form; - } - nlinfo("File '%s' does not exist!", dfnName.toUtf8().constData()); - return NULL; + return form; + } + nlinfo("File '%s' does not exist!", dfnName.toAscii().data()); + return NULL; } NLGEORGES::CFormElm *CGeorgesTreeViewDialog::getRootNode(uint slot) { - NLGEORGES::CForm *form = getFormPtr(); + NLGEORGES::CForm *form = getFormPtr(); - if(slot == 0) - { - const NLGEORGES::UFormElm &formElm = form->getRootNode(); - return (NLGEORGES::CFormElm *)&formElm; - } + if(slot == 0) + { + const NLGEORGES::UFormElm &formElm = form->getRootNode(); + return (NLGEORGES::CFormElm *)&formElm; + } - // Make sure the slot value is valid and then return the corresponding element. - nlassert(slot < NLGEORGES::CForm::HeldElementCount+1); - return getFormPtr()->HeldElements[slot-1]; + // Make sure the slot value is valid and then return the corresponding element. + nlassert(slot < NLGEORGES::CForm::HeldElementCount+1); + return getFormPtr()->HeldElements[slot-1]; } NLGEORGES::CForm *CGeorgesTreeViewDialog::getFormPtr() { - return dynamic_cast(m_form); + return dynamic_cast(m_form); } void CGeorgesTreeViewDialog::loadFormIntoDialog(CForm *form) @@ -218,14 +223,16 @@ namespace GeorgesQt UFormElm *root = 0; root = &m_form->getRootNode(); + // Extract the parent forms into the list of parents in the dialog. QStringList parents; - uint cnt = form->getParentCount(); - for (uint i = 0; i < cnt /*form->getParentCount()*/; i++) + uint cnt = form->getParentCount(); + for (uint i = 0; i < cnt /*form->getParentCount()*/; i++) { UForm *u = m_form->getParentForm(i); parents << u->getFilename().c_str(); } + // Exact the comment box for the dialog. QString comments; comments = m_form->getComment().c_str(); @@ -249,39 +256,33 @@ namespace GeorgesQt nlinfo("typ's %d",deps["typ"].count()); nlinfo("dfn's %d",deps["dfn"].count()); - //nlwarning(strList.join(";").toUtf8()); + //nlwarning(strList.join(";").toAscii().data()); if (root) { loadedForm = m_form->getFilename().c_str(); - CGeorgesFormModel *model = new CGeorgesFormModel(root,deps,comments,parents,m_header->expanded()); - CGeorgesFormProxyModel *proxyModel = new CGeorgesFormProxyModel(); - proxyModel->setSourceModel(model); - m_ui.treeView->setModel(proxyModel); + CGeorgesFormModel *model = new CGeorgesFormModel(m_form,deps,comments,parents,m_header->expanded()); + m_ui.treeView->setModel(model); m_ui.treeView->expandAll(); - // this is a debug output row - m_ui.treeView->hideColumn(3); - filterRows(); - - // //_ui.treeView->setRowHidden(0,QModelIndex(),true); connect(model, SIGNAL(dataChanged(const QModelIndex, const QModelIndex)), this, SLOT(modifiedFile())); setWindowTitle(loadedForm); // //Modules::mainWin().getTabBar(); + + m_model = model; } } void CGeorgesTreeViewDialog::addParentForm(QString parentFormNm) { // Try to load the form - NLGEORGES::UForm *uParentForm = m_georges->loadForm(parentFormNm.toUtf8().constData()); + NLGEORGES::UForm *uParentForm = m_georges->loadForm(parentFormNm.toAscii().data()); NLGEORGES::CForm *parentForm = dynamic_cast(uParentForm); NLGEORGES::CForm *mainForm = static_cast(m_form); - CGeorgesFormProxyModel * proxyModel = dynamic_cast(m_ui.treeView->model()); - CGeorgesFormModel *model = dynamic_cast(proxyModel->sourceModel()); + CGeorgesFormModel *model = dynamic_cast(m_ui.treeView->model()); if(parentForm) { @@ -291,11 +292,11 @@ namespace GeorgesQt if (parentForm->Elements.FormDfn == mainForm->Elements.FormDfn) { // This is the parent form selector - if(!mainForm->insertParent(mainForm->getParentCount(),parentFormNm.toUtf8(), parentForm)) - nlwarning("Failed to add parent form: %s", parentFormNm.toUtf8().constData()); + if(!mainForm->insertParent(mainForm->getParentCount(),parentFormNm.toAscii().data(), parentForm)) + nlwarning("Failed to add parent form: %s", parentFormNm.toAscii().data()); else { - nlinfo("Successfullyadded parent form: %s", parentFormNm.toUtf8().constData()); + nlinfo("Successfullyadded parent form: %s", parentFormNm.toAscii().data()); model->addParentForm(parentFormNm); } } @@ -316,12 +317,12 @@ namespace GeorgesQt void CGeorgesTreeViewDialog::write( ) { - NLMISC::COFile file; - std::string s = NLMISC::CPath::lookup(loadedForm.toUtf8().constData(), false); - if(file.open (s)) - { - try - { + NLMISC::COFile file; + std::string s = NLMISC::CPath::lookup(loadedForm.toAscii().data(), false); + if(file.open (s)) + { + try + { // if (loadedForm.contains(".typ")) // { // //nlassert (Type != NULL); @@ -334,7 +335,7 @@ namespace GeorgesQt // // flushValueChange (); // //} // //Type->write (xmlStream.getDocument (), theApp.Georges4CVS); - // //modify (NULL, NULL, false); + // //modify (NULL, NULL, false); // //flushValueChange (); // //UpdateAllViews (NULL); // //return TRUE; @@ -356,9 +357,9 @@ namespace GeorgesQt // } // else // { - nlassert (m_form != NULL); + nlassert (m_form != NULL); - // Write the file + // Write the file // /*if (IsModified ()) // { // ((CForm*)(UForm*)Form)->Header.MinorVersion++; @@ -380,33 +381,29 @@ namespace GeorgesQt // // Get the left view // //CView* pView = getLeftView (); // } - } - catch (Exception &e) - { - nlerror("Error while loading file: %s", e.what()); - } - } - else - { - nlerror("Can't open the file %s for writing.", s.c_str()); - } + } + catch (Exception &e) + { + nlerror("Error while loading file: %s", e.what()); + } + } + else + { + nlerror("Can't open the file %s for writing.", s.c_str()); + } } void CGeorgesTreeViewDialog::doubleClicked ( const QModelIndex & index ) { - // TODO: this is messy :( perhaps this can be done better - CGeorgesFormProxyModel * proxyModel = - dynamic_cast(m_ui.treeView->model()); - CGeorgesFormModel *model = - dynamic_cast(proxyModel->sourceModel()); - QModelIndex sourceIndex = proxyModel->mapToSource(index); + //CGeorgesFormModel *model = + // dynamic_cast((m_ui.treeView->model()); - CFormItem *item = model->getItem(sourceIndex); + //CFormItem *item = model->getItem(index); - if (item->parent() && item->parent()->data(0) == "parents") - { - Q_EMIT changeFile(CPath::lookup(item->data(0).toString().toUtf8().constData(),false).c_str()); - } + //if (item->parent() && item->parent()->data(0) == "parents") + //{ + // Q_EMIT changeFile(CPath::lookup(item->data(0).toString().toAscii().data(),false).c_str()); + //} //// col containing additional stuff like icons //if (index.column() == 2) @@ -415,7 +412,7 @@ namespace GeorgesQt // CFormItem *item = m->getItem(in2); // QString value = item->data(1).toString(); - // QString path = CPath::lookup(value.toUtf8(),false).c_str(); + // QString path = CPath::lookup(value.toAscii().data(),false).c_str(); // if(value.contains(".tga") || value.contains(".png")) // { @@ -443,7 +440,7 @@ namespace GeorgesQt // { // Modules::objViewInt()->resetScene(); // //Modules::config().configRemapExtensions(); - // Modules::objViewInt()->loadMesh(path.toUtf8(),""); + // Modules::objViewInt()->loadMesh(path.toAscii().data(),""); // } // return; // } @@ -456,6 +453,23 @@ namespace GeorgesQt //} } + void CGeorgesTreeViewDialog::onArrayResized( const QString &name, int size ) + { + QModelIndex current = m_ui.treeView->currentIndex(); + QModelIndex parent = current.parent(); + int r = current.row(); + int c = current.column(); + + m_model->arrayResized( name, size ); + m_ui.treeView->reset(); + m_ui.treeView->expandAll(); + + QModelIndex idx = m_model->index( r, c, parent ); + if( !idx.isValid() ) + return; + m_ui.treeView->setCurrentIndex( idx ); + } + void CGeorgesTreeViewDialog::closeEvent(QCloseEvent *event) { Q_EMIT closing(); @@ -472,12 +486,12 @@ namespace GeorgesQt void CGeorgesTreeViewDialog::filterRows() { - CGeorgesFormProxyModel * mp = dynamic_cast(m_ui.treeView->model()); - CGeorgesFormModel *m = dynamic_cast(mp->sourceModel()); - if (m) { - m->setShowParents(m_ui.checkBoxParent->isChecked()); - m->setShowDefaults(m_ui.checkBoxDefaults->isChecked()); - } + //CGeorgesFormProxyModel * mp = dynamic_cast(m_ui.treeView->model()); + //CGeorgesFormModel *m = dynamic_cast(mp->sourceModel()); + //if (m) { + // m->setShowParents(m_ui.checkBoxParent->isChecked()); + // m->setShowDefaults(m_ui.checkBoxDefaults->isChecked()); + //} } void CGeorgesTreeViewDialog::showContextMenu(const QPoint &pos) @@ -485,116 +499,135 @@ namespace GeorgesQt QMenu contextMenu; QMenu *structContext = NULL; QPoint globalPos = this->mapToGlobal(pos); - + // Fisrt we're going to see if we've right clicked on a new item and select it. const QModelIndex &index = this->m_ui.treeView->currentIndex(); if(!index.isValid()) return; - CGeorgesFormProxyModel * mp = dynamic_cast(m_ui.treeView->model()); - CGeorgesFormModel *m = dynamic_cast(mp->sourceModel()); - QModelIndex sourceIndex = mp->mapToSource(index); + CGeorgesFormModel *m = dynamic_cast(m_ui.treeView->model()); - if (m) + if(m) { - - CFormItem *item = m->getItem(sourceIndex); + CFormItem *item = m->getItem(index); // Right click on the "parents" item - if (item->data(0) == "parents") - contextMenu.addAction("Add parent..."); - // Right click on a parent item - else if(item->parent() && item->parent()->data(0) == "parents") + // if (item->data(0) == "parents") + // contextMenu.addAction("Add parent..."); + // // Right click on a parent item + // else if(item->parent() && item->parent()->data(0) == "parents") + // { + // contextMenu.addAction("Add parent..."); + // contextMenu.addAction("Remove parent"); + // } + if(item->isArray()) { - contextMenu.addAction("Add parent..."); - contextMenu.addAction("Remove parent"); + contextMenu.addAction("Append array entry..."); } - else if(item->getFormElm()->isArray()) - contextMenu.addAction("Add array entry..."); - else if(item->getFormElm()->isStruct()) + else if(item->isArrayMember()) { - QMenu *structContext = new QMenu("Add struct element...", this); - contextMenu.addMenu(structContext); - - NLGEORGES::UFormDfn *defn = item->getFormElm()->getStructDfn(); - if(defn) - { - for(uint defnNum=0; defnNum < defn->getNumEntry(); defnNum++) - { - std::string entryName; - std::string dummy; - UFormElm::TWhereIsValue *whereV = new UFormElm::TWhereIsValue; - bool result = defn->getEntryName(defnNum, entryName); - bool result2 = item->getFormElm()->getValueByName(dummy, entryName.c_str(), NLGEORGES::UFormElm::Eval, whereV); - - - if(result2 && *whereV != UFormElm::ValueForm) - { - structContext->addAction(entryName.c_str()); - } - delete whereV; - } - } + contextMenu.addAction("Delete array entry..."); + contextMenu.addAction("Insert after array entry..."); } - else if(item->getFormElm()->isAtom() && item->valueFrom() == NLGEORGES::UFormElm::ValueForm) - contextMenu.addAction("Revert to parent/default..."); + // else if(item->getFormElm()->isStruct()) + // { + // QMenu *structContext = new QMenu("Add struct element...", this); + // contextMenu.addMenu(structContext); - QAction *selectedItem = contextMenu.exec(globalPos); - if(selectedItem) - { - if(selectedItem->text() == "Add parent...") - { - // Get the file extension of the form so we can build a dialog pattern. - QString file = m_form->getFilename().c_str(); - file = file.remove(0,file.indexOf(".")+1); - QString filePattern = "Parent Sheets (*."+file+")"; - - nlinfo("parent defn name '%s'", file.toUtf8().constData()); - QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select parent sheets..."), m_lastSheetDir, filePattern); - if(!fileNames.isEmpty()) - { - Q_FOREACH(QString fileToParent, fileNames) - { - // Get just the filename. Georges doesn't want the path. - QFileInfo pathInfo( fileToParent ); - QString tmpFileName( pathInfo.fileName() ); + // NLGEORGES::UFormDfn *defn = item->getFormElm()->getStructDfn(); + // if(defn) + // { + // for(uint defnNum=0; defnNum < defn->getNumEntry(); defnNum++) + // { + // std::string entryName; + // std::string dummy; + // UFormElm::TWhereIsValue *whereV = new UFormElm::TWhereIsValue; + // bool result = defn->getEntryName(defnNum, entryName); + // bool result2 = item->getFormElm()->getValueByName(dummy, entryName.c_str(), NLGEORGES::UFormElm::Eval, whereV); - nlinfo("requesting to add parent form '%s'", tmpFileName.toUtf8().constData()); - - // Call to add the form and load it into the Georges form. - addParentForm(tmpFileName); + // + // if(result2 && *whereV != UFormElm::ValueForm) + // { + // structContext->addAction(entryName.c_str()); + // } + // delete whereV; + // } + // } + // } + // else if(item->getFormElm()->isAtom() && item->valueFrom() == NLGEORGES::UFormElm::ValueForm) + // contextMenu.addAction("Revert to parent/default..."); - // Save the file lookup path for future dialog boxes. - m_lastSheetDir = pathInfo.absolutePath(); - } - } - m_ui.treeView->expandAll(); - } - else if(selectedItem->text() == "Remove parent") - { - NLGEORGES::CForm *form = static_cast(m_form); - QString parentFileName = item->data(0).toString(); + QAction *selectedItem = contextMenu.exec(QCursor::pos()); + if(selectedItem) + { + if(selectedItem->text() == "Append array entry...") + { - for(uint num = 0; num < form->getParentCount(); num++) - { - QString curParentName = form->getParent(num)->getFilename().c_str(); - if(parentFileName == curParentName) - { - form->removeParent(num); - m->removeParentForm(parentFileName); - break; - } - } - m_ui.treeView->expandAll(); - } + } // Append an array entry... + else if(selectedItem->text() == "Delete array entry...") + { - } // if selected context menu item is valid. + } + else if(selectedItem->text() == "Insert after array entry...") + { + + } + + + // if(selectedItem->text() == "Add parent...") + // { + // // Get the file extension of the form so we can build a dialog pattern. + // QString file = m_form->getFilename().c_str(); + // file = file.remove(0,file.indexOf(".")+1); + // QString filePattern = "Parent Sheets (*."+file+")"; + // + // nlinfo("parent defn name '%s'", file.toAscii().data()); + // QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Select parent sheets..."), m_lastSheetDir, filePattern); + // if(!fileNames.isEmpty()) + // { + // Q_FOREACH(QString fileToParent, fileNames) + // { + // // Get just the filename. Georges doesn't want the path. + // QFileInfo pathInfo( fileToParent ); + // QString tmpFileName( pathInfo.fileName() ); + + // nlinfo("requesting to add parent form '%s'", tmpFileName.toAscii().data()); + // + // // Call to add the form and load it into the Georges form. + // addParentForm(tmpFileName); + + // // Save the file lookup path for future dialog boxes. + // m_lastSheetDir = pathInfo.absolutePath(); + // } + // } + // m_ui.treeView->expandAll(); + // } + // else if(selectedItem->text() == "Remove parent") + // { + // NLGEORGES::CForm *form = static_cast(m_form); + // QString parentFileName = item->data(0).toString(); + + // for(uint num = 0; num < form->getParentCount(); num++) + // { + // QString curParentName = form->getParent(num)->getFilename().c_str(); + // if(parentFileName == curParentName) + // { + // form->removeParent(num); + // m->removeParentForm(parentFileName); + // break; + // } + // } + + // m_ui.treeView->expandAll(); + // } + + } // if selected context menu item is valid. } // if 'm' model valid. - if(structContext) - delete structContext; + //if(structContext) + // delete structContext; } } /* namespace GeorgesQt */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.h b/code/studio/src/plugins/georges_editor/georges_treeview_dialog.h similarity index 84% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.h rename to code/studio/src/plugins/georges_editor/georges_treeview_dialog.h index e34ab572b..7b40fc3ef 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_dialog.h +++ b/code/studio/src/plugins/georges_editor/georges_treeview_dialog.h @@ -32,6 +32,8 @@ // Project includes +class BrowserCtrl; + namespace NLGEORGES { class UForm; @@ -45,6 +47,7 @@ namespace GeorgesQt { class CGeorges; + class CGeorgesFormModel; class CGeorgesTreeViewDialog: public QDockWidget { @@ -57,14 +60,14 @@ namespace GeorgesQt bool isModified() {return m_modified;} void setModified(bool m) {m_modified = m;} - NLGEORGES::CForm* getFormByName(const QString formName); - NLGEORGES::CForm* getFormByDfnName(const QString dfnName); + NLGEORGES::CForm* getFormByName(const QString formName); + NLGEORGES::CForm* getFormByDfnName(const QString dfnName); - /// Retrieves the root element based on the slot (document or held elements.) - NLGEORGES::CFormElm *getRootNode(uint slot); + /// Retrieves the root element based on the slot (document or held elements.) + NLGEORGES::CFormElm *getRootNode(uint slot); - /// Returns the form as a CForm pointer. - NLGEORGES::CForm *getFormPtr(); + /// Returns the form as a CForm pointer. + NLGEORGES::CForm *getFormPtr(); void addParentForm(QString parentFormNm); @@ -100,6 +103,8 @@ namespace GeorgesQt void filterRows(); void headerClicked(int); + void onArrayResized( const QString &name, int size ); + private: Ui::CGeorgesTreeViewDialog m_ui; ExpandableHeaderView *m_header; @@ -113,6 +118,9 @@ namespace GeorgesQt bool m_modified; + BrowserCtrl *m_browserCtrl; + CGeorgesFormModel *m_model; + }; /* CGeorgesTreeViewDialog */ } /* namespace GeorgesQt */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_form.ui b/code/studio/src/plugins/georges_editor/georges_treeview_form.ui similarity index 50% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_form.ui rename to code/studio/src/plugins/georges_editor/georges_treeview_form.ui index 8d53bfdd6..42d9afcf9 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_treeview_form.ui +++ b/code/studio/src/plugins/georges_editor/georges_treeview_form.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 300 + 564 + 525 @@ -18,8 +18,8 @@ - 199 - 165 + 280 + 242 @@ -29,9 +29,21 @@ - + + + 0 + 0 + + + + + + 0 + 0 + + QTabWidget::West @@ -39,60 +51,43 @@ 0 - - Qt::NoFocus - Form - - - 0 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - true - - - - - - - Parent - - - - - + + + Qt::Horizontal - - - 40 - 20 - - - - - - - - Defaults - + + + + 0 + 0 + + + + + 0 + 0 + + + + QAbstractItemView::NoEditTriggers + + + true + + + + + + 0 + 0 + + + @@ -126,8 +121,14 @@ - - - + + + QtTreePropertyBrowser + QWidget +

qttreepropertybrowser.h
+ 1 + + + diff --git a/code/studio/src/plugins/georges_editor/georgesform_model.cpp b/code/studio/src/plugins/georges_editor/georgesform_model.cpp new file mode 100644 index 000000000..90eaaaacd --- /dev/null +++ b/code/studio/src/plugins/georges_editor/georgesform_model.cpp @@ -0,0 +1,601 @@ +// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework +// Copyright (C) 2011 Adrian Jaekel +// +// 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 "georgesform_model.h" + +// System Includes +#include + +// NeL includes +#include +#include +#include +#include +#include +#include +#include +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// project includes +#include "formitem.h" +#include "georges_editor_form.h" +#include "actions.h" + +using namespace NLGEORGES; + +namespace GeorgesQt +{ + + CGeorgesFormModel::CGeorgesFormModel(UForm *form, QMap< QString, QStringList> deps, + QString comment, QStringList parents, bool *expanded, QObject *parent) : QAbstractItemModel(parent) + { + m_form = form; + m_rootData << "Value" << "Data" << "Extra";// << "Type"; + m_rootItem = new CFormItem(); + m_dependencies = deps; + m_comments = comment; + m_parents = parents; + m_parentRows = new QList; + m_expanded = expanded; + + setupModelData(); + } + + CGeorgesFormModel::~CGeorgesFormModel() + { + delete m_rootItem; + } + + /******************************************************************************/ + + QVariant CGeorgesFormModel::data(const QModelIndex &p_index, int p_role) const + { + if (!p_index.isValid()) + return QVariant(); + + switch (p_role) + { + case Qt::DisplayRole: + { + return getItem(p_index)->data(p_index.column()); + } + case Qt::DecorationRole: + { + // Based on the _Type return a QIcon from resources. + CFormItem *item = getItem(p_index); + return item->getItemImage(m_rootItem); + } + default: + return QVariant(); + } + } + + /******************************************************************************/ + + CFormItem *CGeorgesFormModel::getItem(const QModelIndex &index) const + { + if (index.isValid()) + { + CFormItem *item = static_cast(index.internalPointer()); + if (item) + return item; + } + return m_rootItem; + } + + /******************************************************************************/ + + bool CGeorgesFormModel::setData(const QModelIndex &index, const QVariant &value, int role) + { + + if (role != Qt::EditRole) + return false; + + CFormItem *item = getItem(index); + + if(!item->isEditable(index.column())) + return false; + + GeorgesEditorForm::UndoStack->push(new CUndoFormArrayRenameCommand(this,item,value)); + + Q_EMIT dataChanged(index, index); + + //setupModelData(); + return true; + } + + /******************************************************************************/ + + Qt::ItemFlags CGeorgesFormModel::flags(const QModelIndex& index) const { + + if (!index.isValid()) + return 0; + + Qt::ItemFlags returnValue = Qt::ItemIsSelectable | Qt::ItemIsEnabled; + + CFormItem *item = getItem(index); + + if(item->isEditable(index.column())) + { + returnValue |= Qt::ItemIsEditable; + } + + return returnValue; + + } + + /******************************************************************************/ + + QVariant CGeorgesFormModel::headerData(int section, + Qt::Orientation orientation, int role) const + { + if (orientation == Qt::Horizontal) + { + if (role == Qt::DisplayRole) + return m_rootItem->data(section); + if (role == Qt::TextAlignmentRole) + return Qt::AlignLeft; + if (section == 0 && role == Qt::DecorationRole) + { + // transparent pixmap as we paint it ourself with tree brach + // if we extend the HeaderView::paintSection for the CE_HeaderLabel + // we could drop this + QPixmap pixmap = QPixmap( + QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize), + QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize)); + // Create new picture for transparent + QPixmap transparent(pixmap.size()); + + // Do transparency + transparent.fill(Qt::transparent); + QPainter p(&transparent); + p.setCompositionMode(QPainter::CompositionMode_Source); + p.drawPixmap(0, 0, pixmap); + p.setCompositionMode(QPainter::CompositionMode_DestinationIn); + // Set transparency level to 150 (possible values are 0-255) + // The alpha channel of a color specifies the transparency effect, + // 0 represents a fully transparent color, while 255 represents + // a fully opaque color. + p.fillRect(transparent.rect(), QColor(0, 0, 0, 0)); + p.end(); + + // Set original picture's reference to new transparent one + pixmap = transparent; + return pixmap; + } + } + return QVariant(); + } + + /******************************************************************************/ + + QModelIndex CGeorgesFormModel::index(int row, int column, const QModelIndex &parent) + const + { + if (!hasIndex(row, column, parent)) + return QModelIndex(); + + CFormItem *parentItem; + + if (!parent.isValid()) + parentItem = m_rootItem; + else + parentItem = static_cast(parent.internalPointer()); + + CFormItem *childItem = parentItem->child(row); + if (childItem) + return createIndex(row, column, childItem); + else + return QModelIndex(); + } + + QModelIndex CGeorgesFormModel::index(int row, int column, CFormItem *item) const + { + if(item == m_rootItem) + return QModelIndex(); + + return createIndex(row, 0, item); + } + + /******************************************************************************/ + + QModelIndex CGeorgesFormModel::parent(const QModelIndex &index) const + { + if (!index.isValid()) + return QModelIndex(); + + CFormItem *childItem = static_cast(index.internalPointer()); + CFormItem *parentItem = childItem->parent(); + + if (parentItem == m_rootItem) + return QModelIndex(); + + return createIndex(parentItem->row(), 0, parentItem); + } + + /******************************************************************************/ + + int CGeorgesFormModel::rowCount(const QModelIndex &parent) const { + + CFormItem *parentItem; + if (parent.column() > 0) + return 0; + + if (!parent.isValid()) + parentItem = m_rootItem; + else + parentItem = static_cast(parent.internalPointer()); + + return parentItem->childCount(); + + } + + /******************************************************************************/ + + int CGeorgesFormModel::columnCount(const QModelIndex &parent) const { + + if (parent.isValid()) + return static_cast(parent.internalPointer())->columnCount(); + else + return m_rootItem->columnCount(); + + } + + /******************************************************************************/ + + void CGeorgesFormModel::loadFormData(UFormElm *root, CFormItem *parent) { + return; + } + + CFormItem *CGeorgesFormModel::addStruct (CFormItem *parent, + NLGEORGES::CFormElmStruct *_struct, + NLGEORGES::CFormDfn *parentDfn, + const char *name, + uint structId, + const char *formName, + uint slot) +{ + // The form pointer + NLGEORGES::CForm *formPtr = static_cast(m_form); + + // Add the new node + CFormItem *newNode = parent->add(CFormItem::Form, name, structId, formName, slot, m_form); + + // Can be NULL in virtual DFN + if (parentDfn) + { + // Get the parents + std::vector arrayDfn; + arrayDfn.reserve (parentDfn->countParentDfn ()); + parentDfn->getParentDfn (arrayDfn); + + // For each child + uint elm=0; + for (uint dfn=0; dfngetNumEntry (); i++) + { + // Get the entry ref + NLGEORGES::CFormDfn::CEntry &entry = arrayDfn[dfn]->getEntry (i); + + // Form entry name + std::string entryName = (std::string (formName)+"."+entry.getName ()); + + // Is a struct ? + if ( (entry.getType () == NLGEORGES::UFormDfn::EntryDfn) || (entry.getType () == NLGEORGES::UFormDfn::EntryVirtualDfn) ) + { + // Is an array of struct ? + if (entry.getArrayFlag ()) + { + // Get it from the form + CFormElmArray *nextArray = NULL; + if (_struct && _struct->Elements[elm].Element) + nextArray = NLMISC::safe_cast (_struct->Elements[elm].Element); + + // Else, get it from the parent if we are not a virtual DFN (don't inheritate) + + // todo array of virtual struct + if (!nextArray && (entry.getType () != NLGEORGES::UFormDfn::EntryVirtualDfn) ) + { + // For each parent form + for (uint parent=0; parentgetParentCount (); parent++) + { + // Get the node by name + NLGEORGES::UFormElm *uNode; + if (formPtr->getParent (parent)->getRootNode ().getNodeByName (&uNode, entryName.c_str(), NULL, false) && uNode) + { + nextArray = NLMISC::safe_cast (uNode); + } + } + } + + // Add the new struct + addArray (newNode, nextArray, entry.getDfnPtr (), entry.getName().c_str(), elm, entryName.c_str (), slot); + } + else + { + // Add it + NLGEORGES::CFormElmStruct *nextForm = NULL; + + // Get it from the form + if (_struct && _struct->Elements[elm].Element) + nextForm = NLMISC::safe_cast (_struct->Elements[elm].Element); + + // Else, get it from the parent + if (!nextForm) + { + // For each parent form + for (uint parent=0; parentgetParentCount (); parent++) + { + // Get the node by name + NLGEORGES::UFormElm *uNode; + if (formPtr->getParent (parent)->getRootNode ().getNodeByName (&uNode, entryName.c_str(), NULL, false) && uNode) + { + nextForm = NLMISC::safe_cast (uNode); + } + } + } + + // Virtual Dfn pointer + NLGEORGES::CFormElmVirtualStruct *vStruct = ((entry.getType () == NLGEORGES::UFormDfn::EntryVirtualDfn) && nextForm) ? + NLMISC::safe_cast (nextForm) : NULL; + + NLGEORGES::CFormDfn *tmpDfn = vStruct ? + ((NLGEORGES::CFormDfn*)vStruct->FormDfn) : entry.getDfnPtr(); + // Add the new struct + addStruct (newNode, nextForm, tmpDfn, entry.getName().c_str(), elm, entryName.c_str(), slot); + } + } + // Array of type ? + else if ( entry.getArrayFlag () ) + { + NLGEORGES::CFormElmArray *nextArray = NULL; + + // Get it from the form + if (_struct && _struct->Elements[elm].Element) + nextArray = NLMISC::safe_cast (_struct->Elements[elm].Element); + + // Else, get it from the parent + if (!nextArray) + { + // For each parent form + for (uint parent=0; parentgetParentCount (); parent++) + { + // Get the node by name + NLGEORGES::UFormElm *uNode; + if (formPtr->getParent (parent)->getRootNode ().getNodeByName (&uNode, entryName.c_str(), NULL, false) && uNode) + { + nextArray = NLMISC::safe_cast (uNode); + } + } + } + + // Add the new array + addArray ( newNode, nextArray, NULL, entry.getName().c_str(), elm, entryName.c_str(), slot ); + } + + // Next element + elm++; + } + } + } + + return newNode; +} + +// *************************************************************************** + +CFormItem *CGeorgesFormModel::addArray(CFormItem *parent, + NLGEORGES::CFormElmArray *array, + NLGEORGES::CFormDfn *rootDfn, + const char *name, + uint structId, + const char *formName, + uint slot) +{ + // Add the new node + CFormItem *newNode = parent->add (CFormItem::Form, name, structId, formName, slot, m_form); + + // The array exist + if (array) + { + // For each array element + for (uint elm=0; elmElements.size(); elm++) + { + // The form name + char formArrayElmName[512]; + NLMISC::smprintf (formArrayElmName, 512, "%s[%d]", formName, elm); + + // The name + char formArrayName[512]; + if (array->Elements[elm].Name.empty ()) + { + NLMISC::smprintf (formArrayName, 512, "#%d", elm); + } + else + { + NLMISC::smprintf (formArrayName, 512, "%s", array->Elements[elm].Name.c_str()); + } + + // Is a struct + if (rootDfn) + { + // Get struct ptr + NLGEORGES::CFormElmStruct *elmPtr = array->Elements[elm].Element ? static_cast(array->Elements[elm].Element) : NULL; + addStruct (newNode, elmPtr, rootDfn, formArrayName, elm, formArrayElmName, slot); + } + else + { + NLGEORGES::CFormElmArray *elmPtr = array->Elements[elm].Element ? static_cast(array->Elements[elm].Element) : NULL; + newNode->add (CFormItem::Form, formArrayName, elm, formArrayElmName, slot, m_form); + } + } + } + + return newNode; +} + + +void CGeorgesFormModel::arrayResized( const QString &name, int size ) +{ + CFormItem *item = m_rootItem->findItem( name ); + if( item == NULL ) + return; + + NLGEORGES::UFormElm *elm = NULL; + + item->form()->getRootNode().getNodeByName( &elm, name.toUtf8().constData() ); + + if( elm == NULL ) + return; + + NLGEORGES::CFormElmArray *celm = dynamic_cast< NLGEORGES::CFormElmArray* >( elm ); + if( celm == NULL ) + return; + + item->clearChildren(); + + for( int i = 0; i < celm->Elements.size(); i++ ) + { + NLGEORGES::CFormElmArray::CElement &e = celm->Elements[ i ]; + + QString formName = name; + formName += '['; + formName += QString::number( i ); + formName += ']'; + + QString n; + if( e.Name.empty() ) + n = "#" + QString::number( i ); + else + n = e.Name.c_str(); + + item->add( CFormItem::Form, n.toUtf8().constData(), i, formName.toUtf8().constData(), 0, item->form() ); + } + +} + + + + /******************************************************************************/ + + void CGeorgesFormModel::loadFormHeader() + { + + /* if (m_parents.size()) + { + CFormItem *fi_pars = new CFormItem(m_rootElm, QList() << "parents" << "" << "", m_rootItem); + m_rootItem->appendChild(fi_pars); + + Q_FOREACH(QString str, m_parents) + { + fi_pars->appendChild(new CFormItem(m_rootElm, QList() << str << "" << "", fi_pars)); + } + }*/ + + /*QStringList dfns = _dependencies["dfn"]; + QStringList typs = _dependencies["typ"]; + + _dependencies.remove("dfn"); + _dependencies.remove("typ"); + + CFormItem *fi_dep = new CFormItem(_rootElm, QList() << "dependencies", _rootItem); + _rootItem->appendChild(fi_dep); + + if (!dfns.isEmpty()) { + CFormItem *fi_dfn = new CFormItem(_rootElm, QList() << "dfn", fi_dep); + fi_dep->appendChild(fi_dfn); + foreach(QString str, dfns) { + fi_dfn->appendChild(new CFormItem(_rootElm, QList() << str, fi_dfn)); + } + } + if (!typs.isEmpty()) { + CFormItem *fi_typ = new CFormItem(_rootElm, QList() << "typ", fi_dep); + fi_dep->appendChild(fi_typ); + foreach(QString str, typs) { + fi_typ->appendChild(new CFormItem(_rootElm, QList() << str, fi_typ)); + } + } + if (!_dependencies.isEmpty()) { + CFormItem *fi_other = new CFormItem(_rootElm, QList() << "other", fi_dep); + fi_dep->appendChild(fi_other); + foreach(QStringList list, _dependencies) { + foreach(QString str, list) { + fi_other->appendChild(new CFormItem(_rootElm, QList() << str, fi_other)); + } + } + }*/ + } + + /******************************************************************************/ + + void CGeorgesFormModel::setupModelData() + { + m_rootElm = &((NLGEORGES::CForm*)m_form)->Elements; + NLGEORGES::CFormElmStruct *rootstruct = &((NLGEORGES::CForm*)m_form)->Elements; + //loadFormHeader(); + addStruct(m_rootItem, rootstruct, rootstruct->FormDfn, "Content", 0xffffffff, "", 0); + //loadFormData(m_rootElm, m_rootItem); + } + + /******************************************************************************/ + + void CGeorgesFormModel::setShowParents( bool show ) { + m_showParents = show; + Q_EMIT layoutAboutToBeChanged(); + Q_EMIT layoutChanged(); + } + void CGeorgesFormModel::setShowDefaults( bool show ) + { + m_showDefaults = show; + Q_EMIT layoutAboutToBeChanged(); + Q_EMIT layoutChanged(); + } + + void CGeorgesFormModel::addParentForm(QString parentForm) + { + beginResetModel(); + m_parents.push_back(parentForm); + delete m_rootItem; + m_rootItem = new CFormItem(); + setupModelData(); + endResetModel(); + } + + void CGeorgesFormModel::removeParentForm(QString parentForm) + { + beginResetModel(); + m_parents.removeOne(parentForm); + + delete m_rootItem; + m_rootItem = new CFormItem(); + setupModelData(); + endResetModel(); + } +} /* namespace GeorgesQt */ + +/* end of file */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.h b/code/studio/src/plugins/georges_editor/georgesform_model.h similarity index 74% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.h rename to code/studio/src/plugins/georges_editor/georgesform_model.h index 710598236..4ca91398b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_model.h +++ b/code/studio/src/plugins/georges_editor/georgesform_model.h @@ -27,6 +27,10 @@ namespace NLGEORGES { class UFormElm; + class UForm; + class CFormElmStruct; + class CFormDfn; + class CFormElmArray; } namespace GeorgesQt @@ -36,9 +40,8 @@ namespace GeorgesQt class CGeorgesFormModel : public QAbstractItemModel { - public: - CGeorgesFormModel(NLGEORGES::UFormElm *root, QMap< QString, QStringList> deps, + CGeorgesFormModel(NLGEORGES::UForm *form, QMap< QString, QStringList> deps, QString comment, QStringList parents, bool* expanded, QObject *parent = 0); ~CGeorgesFormModel(); @@ -47,6 +50,7 @@ namespace GeorgesQt Qt::ItemFlags flags(const QModelIndex &index) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + QModelIndex index(int row, int column, CFormItem *item) const; QModelIndex parent(const QModelIndex &index) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; @@ -58,15 +62,29 @@ namespace GeorgesQt void setShowDefaults( bool show ); void addParentForm(QString parentForm); void removeParentForm(QString parentForm); - NLGEORGES::UFormElm *getRootForm() { return m_rootElm; } + NLGEORGES::UFormElm *getRootForm() { return m_rootElm; } + + CFormItem *addStruct (CFormItem *parent, NLGEORGES::CFormElmStruct *_struct, NLGEORGES::CFormDfn *parentDfn, + const char *name, uint structId, const char *formName, uint slot); + + CFormItem *addArray(CFormItem *parent, NLGEORGES::CFormElmArray *array, NLGEORGES::CFormDfn *rootDfn, + const char *name, uint structId, const char *formName, uint slot); + + void emitDataChanged(const QModelIndex &index) + { + Q_EMIT dataChanged(index, index); + } + + void arrayResized( const QString &name, int size ); private: void setupModelData(); void loadFormData(NLGEORGES::UFormElm *rootElm, CFormItem *parent); void loadFormHeader(); + NLGEORGES::UForm* m_form; CFormItem* m_rootItem; - NLGEORGES::UFormElm* m_rootElm; + NLGEORGES::UFormElm* m_rootElm; QList m_rootData; QMap< QString, QStringList> m_dependencies; QString m_comments; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp b/code/studio/src/plugins/georges_editor/georgesform_proxy_model.cpp similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp rename to code/studio/src/plugins/georges_editor/georgesform_proxy_model.cpp index 2792699b0..81179f61c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.cpp +++ b/code/studio/src/plugins/georges_editor/georgesform_proxy_model.cpp @@ -14,15 +14,17 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -#include "stdpch.h" -#include "georgesform_proxy_model.h" -#include "formitem.h" -#include "georgesform_model.h" - // NeL includes #include #include +// project includes +#include "formitem.h" +#include "georgesform_proxy_model.h" +#include "georgesform_model.h" + +#if 0 + namespace GeorgesQt { @@ -78,4 +80,5 @@ namespace GeorgesQt } } /* namespace GeorgesQt */ +#endif // 0 /* end of file */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.h b/code/studio/src/plugins/georges_editor/georgesform_proxy_model.h similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.h rename to code/studio/src/plugins/georges_editor/georgesform_proxy_model.h index cfe7fcca6..f4c968f80 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georgesform_proxy_model.h +++ b/code/studio/src/plugins/georges_editor/georgesform_proxy_model.h @@ -20,6 +20,7 @@ // Qt includes #include +#if 0 namespace GeorgesQt { @@ -41,5 +42,5 @@ namespace GeorgesQt };/* class CGeorgesFormProxyModel */ } /* namespace GeorgesQt */ - +#endif // 0 #endif // GEORGESFORM_PROXY_MODEL_H diff --git a/code/studio/src/plugins/georges_editor/images/array.ico b/code/studio/src/plugins/georges_editor/images/array.ico new file mode 100644 index 000000000..923bec0bd Binary files /dev/null and b/code/studio/src/plugins/georges_editor/images/array.ico differ diff --git a/code/studio/src/plugins/georges_editor/images/header.ico b/code/studio/src/plugins/georges_editor/images/header.ico new file mode 100644 index 000000000..5ebb3632a Binary files /dev/null and b/code/studio/src/plugins/georges_editor/images/header.ico differ diff --git a/code/studio/src/plugins/georges_editor/images/hold.ico b/code/studio/src/plugins/georges_editor/images/hold.ico new file mode 100644 index 000000000..4b7f115f1 Binary files /dev/null and b/code/studio/src/plugins/georges_editor/images/hold.ico differ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/images/ic_nel_georges_editor.png b/code/studio/src/plugins/georges_editor/images/ic_nel_georges_editor.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/images/ic_nel_georges_editor.png rename to code/studio/src/plugins/georges_editor/images/ic_nel_georges_editor.png diff --git a/code/studio/src/plugins/georges_editor/images/root.ico b/code/studio/src/plugins/georges_editor/images/root.ico new file mode 100644 index 000000000..3fa430766 Binary files /dev/null and b/code/studio/src/plugins/georges_editor/images/root.ico differ diff --git a/code/studio/src/plugins/georges_editor/images/struct.ico b/code/studio/src/plugins/georges_editor/images/struct.ico new file mode 100644 index 000000000..7e2244dc3 Binary files /dev/null and b/code/studio/src/plugins/georges_editor/images/struct.ico differ diff --git a/code/studio/src/plugins/georges_editor/images/vstruct.ico b/code/studio/src/plugins/georges_editor/images/vstruct.ico new file mode 100644 index 000000000..a184d8a37 Binary files /dev/null and b/code/studio/src/plugins/georges_editor/images/vstruct.ico differ diff --git a/code/studio/src/plugins/georges_editor/images/zfee51.ico b/code/studio/src/plugins/georges_editor/images/zfee51.ico new file mode 100644 index 000000000..ad6bbb756 Binary files /dev/null and b/code/studio/src/plugins/georges_editor/images/zfee51.ico differ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/stdpch.cpp b/code/studio/src/plugins/georges_editor/stdpch.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/stdpch.cpp rename to code/studio/src/plugins/georges_editor/stdpch.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/stdpch.h b/code/studio/src/plugins/georges_editor/stdpch.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/stdpch.h rename to code/studio/src/plugins/georges_editor/stdpch.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/ovqt_plugin_georges_editor.xml b/code/studio/src/plugins/georges_editor/studio_plugin_georges_editor.xml similarity index 77% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/ovqt_plugin_georges_editor.xml rename to code/studio/src/plugins/georges_editor/studio_plugin_georges_editor.xml index a1972dded..700373bf3 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/ovqt_plugin_georges_editor.xml +++ b/code/studio/src/plugins/georges_editor/studio_plugin_georges_editor.xml @@ -1,5 +1,5 @@ - ovqt_plugin_georges_editor + studio_plugin_georges_editor GeorgesEditor 0.4 aquiles diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt b/code/studio/src/plugins/gui_editor/CMakeLists.txt similarity index 67% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt rename to code/studio/src/plugins/gui_editor/CMakeLists.txt index fd1283db8..4b50ec8d1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/CMakeLists.txt +++ b/code/studio/src/plugins/gui_editor/CMakeLists.txt @@ -24,13 +24,16 @@ SET(OVQT_PLUGIN_GUI_EDITOR_HDR action_editor.h property_browser_ctrl.h project_window.h - nel3d_widget.h - nelgui_widget.h + nelgui_ctrl.h new_property_widget.h new_widget_widget.h add_widget_widget.h editor_selection_watcher.h editor_message_processor.h + action_list.h + texture_chooser.h + action_property_manager.h + texture_property_manager.h ) SET(OVQT_PLUGIN_GUI_EDITOR_UIS @@ -46,6 +49,8 @@ SET(OVQT_PLUGIN_GUI_EDITOR_UIS new_property_widget.ui new_widget_widget.ui add_widget_widget.ui + action_list.ui + texture_chooser.ui ) SET(QT_USE_QTGUI TRUE) @@ -61,7 +66,7 @@ SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${OVQT_PLUGIN_GUI_EDITOR_MOC_SRC} OVQT_P SOURCE_GROUP("GUI Editor Plugin" FILES ${SRC}) SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) -ADD_LIBRARY(ovqt_plugin_gui_editor MODULE ${SRC} +ADD_LIBRARY(studio_plugin_gui_editor MODULE ${SRC} ${OVQT_PLUGIN_GUI_EDITOR_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUGIN_GUI_EDITOR_UI_HDRS} @@ -69,8 +74,8 @@ ADD_LIBRARY(ovqt_plugin_gui_editor MODULE ${SRC} ) TARGET_LINK_LIBRARIES( - ovqt_plugin_gui_editor - ovqt_plugin_core + studio_plugin_gui_editor + studio_plugin_core nelmisc nel3d nelgui @@ -80,24 +85,24 @@ TARGET_LINK_LIBRARIES( qt_property_browser ) -NL_DEFAULT_PROPS(ovqt_plugin_gui_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: GUI Editor") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_gui_editor) -NL_ADD_LIB_SUFFIX(ovqt_plugin_gui_editor) +NL_DEFAULT_PROPS(studio_plugin_gui_editor "Tools: Studio Plugin: GUI Editor") +NL_ADD_RUNTIME_FLAGS(studio_plugin_gui_editor) +NL_ADD_LIB_SUFFIX(studio_plugin_gui_editor) ADD_DEFINITIONS(-DGUI_EDITOR_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) IF(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_gui_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_gui_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_gui_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_gui_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ELSE(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_gui_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_gui_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_gui_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_gui_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ENDIF(WIN32) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_gui_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_gui_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.cpp b/code/studio/src/plugins/gui_editor/action_editor.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.cpp rename to code/studio/src/plugins/gui_editor/action_editor.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.h b/code/studio/src/plugins/gui_editor/action_editor.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.h rename to code/studio/src/plugins/gui_editor/action_editor.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.ui b/code/studio/src/plugins/gui_editor/action_editor.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/action_editor.ui rename to code/studio/src/plugins/gui_editor/action_editor.ui diff --git a/code/studio/src/plugins/gui_editor/action_list.cpp b/code/studio/src/plugins/gui_editor/action_list.cpp new file mode 100644 index 000000000..8925e6d04 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/action_list.cpp @@ -0,0 +1,49 @@ +#include "action_list.h" +#include "nel/gui/action_handler.h" +#include +#include + +ActionList::ActionList( QDialog *parent ) : +QDialog( parent ) +{ + setupUi( this ); +} + +ActionList::~ActionList() +{ +} + +void ActionList::load() +{ + actionList->clear(); + + NLGUI::CAHManager *am = NLGUI::CAHManager::getInstance(); + std::vector< std::string > handlers; + am->getActionHandlers( handlers ); + + std::vector< std::string >::const_iterator itr = handlers.begin(); + while( itr != handlers.end() ) + { + actionList->addItem( itr->c_str() ); + ++itr; + } +} + +void ActionList::accept() +{ + QListWidgetItem *item = actionList->currentItem(); + if( item == NULL ) + return; + + selectedAction = item->text(); + + QDialog::accept(); +} + +void ActionList::reject() +{ + selectedAction = ""; + + QDialog::reject(); +} + diff --git a/code/studio/src/plugins/gui_editor/action_list.h b/code/studio/src/plugins/gui_editor/action_list.h new file mode 100644 index 000000000..752d66467 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/action_list.h @@ -0,0 +1,29 @@ +#ifndef ACTION_LIST_H +#define ACTION_LIST_H + + +#include "ui_action_list.h" +#include + + +class ActionList : public QDialog, public Ui::ActionListDialog +{ + Q_OBJECT + +public: + ActionList( QDialog *parent = NULL ); + ~ActionList(); + void load(); + + QString getSelectedAction(){ return selectedAction; } + + +public Q_SLOTS: + void accept(); + void reject(); + +private: + QString selectedAction; +}; + +#endif diff --git a/code/studio/src/plugins/gui_editor/action_list.ui b/code/studio/src/plugins/gui_editor/action_list.ui new file mode 100644 index 000000000..ba147cfc2 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/action_list.ui @@ -0,0 +1,94 @@ + + + ActionListDialog + + + + 0 + 0 + 359 + 258 + + + + Action List + + + + + + + + + 6 + + + 0 + + + + + Qt::Horizontal + + + + 131 + 31 + + + + + + + + OK + + + + + + + Cancel + + + + + + + + + + + okButton + clicked() + ActionListDialog + accept() + + + 278 + 253 + + + 96 + 254 + + + + + cancelButton + clicked() + ActionListDialog + reject() + + + 369 + 253 + + + 179 + 282 + + + + + diff --git a/code/studio/src/plugins/gui_editor/action_property_manager.cpp b/code/studio/src/plugins/gui_editor/action_property_manager.cpp new file mode 100644 index 000000000..9e7690a56 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/action_property_manager.cpp @@ -0,0 +1,333 @@ +// Ryzom Core Studio GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "action_property_manager.h" +#include "action_list.h" +#include +#include +#include +#include +#include + + +////////////////////////////////////////////////////////////////// Manager /////////////////////////////////////////////////////////////////////////// + + +struct ActionPropertyManagerPrivate +{ + QMap< const QtProperty*, QString > values; +}; + +ActionPropertyManager::ActionPropertyManager( QObject *parent ) : +QtAbstractPropertyManager( parent ) +{ + d_ptr = new ActionPropertyManagerPrivate(); +} + +ActionPropertyManager::~ActionPropertyManager() +{ + delete d_ptr; + d_ptr = NULL; +} + +QString ActionPropertyManager::value( const QtProperty *p ) const +{ + return valueText( p ); +} + +void ActionPropertyManager::setValue( QtProperty *p, const QString &value ) +{ + if( !d_ptr->values.contains( p ) ) + return; + + if( d_ptr->values[ p ] == value ) + return; + + d_ptr->values[ p ] = value; + + Q_EMIT propertyChanged( p ); + Q_EMIT valueChanged( p, value ); +} + +bool ActionPropertyManager::hasValue( const QtProperty *p ) const +{ + return d_ptr->values.contains( p ); +} + +QString ActionPropertyManager::valueText( const QtProperty *p ) const +{ + if( !d_ptr->values.contains( p ) ) + return ""; + + return d_ptr->values[ p ]; +} + +void ActionPropertyManager::initializeProperty( QtProperty *p ) +{ + if( d_ptr->values.contains( p ) ) + return; + + d_ptr->values[ p ] = ""; +} + +void ActionPropertyManager::uninitializeProperty( QtProperty *p ) +{ + d_ptr->values.remove( p ); +} + + + +//////////////////////////////////////////////////////////////////// Factory /////////////////////////////////////////////////////////////////////// + + + +struct ActionEditorFactoryPrivate +{ + QMap< QtProperty*, QList< ActionPropertyEditor* > > createdEditors; + QMap< ActionPropertyEditor*, QtProperty* > editorToProperty; + + ~ActionEditorFactoryPrivate() + { + createdEditors.clear(); + + QMap< ActionPropertyEditor*, QtProperty* >::iterator itr = editorToProperty.begin(); + while( itr != editorToProperty.end() ) + { + delete itr.key(); + ++itr; + } + editorToProperty.clear(); + } + + void addEditor( QtProperty *p, ActionPropertyEditor *editor ) + { + QMap< QtProperty*, QList< ActionPropertyEditor* > >::iterator itr = createdEditors.find( p ); + + if( itr != createdEditors.end() ) + { + itr->push_back( editor ); + } + else + { + QList< ActionPropertyEditor* > l; + l.push_back( editor ); + createdEditors.insert( p, l ); + } + + editorToProperty.insert( editor, p ); + } + + void removeEditor( QObject *o ) + { + // Remove from editorToProperty first + QMap< ActionPropertyEditor*, QtProperty* >::iterator itr1 = editorToProperty.begin(); + while( itr1 != editorToProperty.end() ) + { + if( itr1.key() == o ) + break; + + ++itr1; + } + if( itr1 != editorToProperty.end() ) + editorToProperty.erase( itr1 ); + + // Then from createdEditors + QMap< QtProperty*, QList< ActionPropertyEditor* > >::iterator itr2 = createdEditors.begin(); + while( itr2 != createdEditors.end() ) + { + QList< ActionPropertyEditor* > &l = *itr2; + QList< ActionPropertyEditor* >::iterator itr = l.begin(); + while( itr != l.end() ) + { + if( *itr == o ) + { + QList< ActionPropertyEditor* >::iterator d = itr; + ++itr; + l.erase( d ); + continue; + } + + ++itr; + } + + ++itr2; + } + } + +}; + +ActionEditorFactory::ActionEditorFactory( QObject *parent ) : +QtAbstractEditorFactory( parent ) +{ + d_ptr = new ActionEditorFactoryPrivate(); +} + +ActionEditorFactory::~ActionEditorFactory() +{ + delete d_ptr; + d_ptr = NULL; +} + +void ActionEditorFactory::connectPropertyManager( ActionPropertyManager *manager ) +{ + connect( manager, SIGNAL( valueChanged( QtProperty*, const QString& ) ), this, SLOT( onPropertyChanged( QtProperty*, const QString& ) ) ); +} + +void ActionEditorFactory::disconnectPropertyManager( ActionPropertyManager *manager ) +{ + disconnect( manager, SIGNAL( valueChanged( QtProperty*, const QString& ) ), this, SLOT( onPropertyChanged( QtProperty*, const QString& ) ) ); +} + +QWidget* ActionEditorFactory::createEditor( ActionPropertyManager *manager, QtProperty *p, QWidget *parent ) +{ + ActionPropertyEditor *editor = new ActionPropertyEditor( parent ); + editor->setValue( manager->value( p ) ); + + connect( editor, SIGNAL( valueChanged( const QString& ) ), this, SLOT( onSetValue( const QString& ) ) ); + connect( editor, SIGNAL( destroyed( QObject* ) ), this, SLOT( onEditorDestroyed( QObject* ) ) ); + + d_ptr->addEditor( p, editor ); + + return editor; +} + +void ActionEditorFactory::onPropertyChanged( QtProperty *p, const QString &value ) +{ + QMap< QtProperty*, QList< ActionPropertyEditor* > >::iterator itr = d_ptr->createdEditors.find( p ); + if( itr == d_ptr->createdEditors.end() ) + return; + + QList< ActionPropertyEditor* > &l = *itr; + QList< ActionPropertyEditor* >::iterator i = l.begin(); + while( i != l.end() ) + { + ActionPropertyEditor *editor = *i; + + editor->blockSignals( true ); + editor->setValue( value ); + editor->blockSignals( false ); + + ++i; + } +} + +void ActionEditorFactory::onSetValue( const QString &value ) +{ + QObject *s = sender(); + ActionPropertyEditor *editor = qobject_cast< ActionPropertyEditor* >( s ); + if( editor == NULL ) + return; + + QMap< ActionPropertyEditor*, QtProperty* >::iterator itr = d_ptr->editorToProperty.find( editor ); + if( itr == d_ptr->editorToProperty.end() ) + return; + + QtProperty *p = *itr; + + ActionPropertyManager *manager = qobject_cast< ActionPropertyManager* >( p->propertyManager() ); + if( manager == NULL ) + return; + + blockSignals( true ); + manager->setValue( p, value ); + blockSignals( false ); +} + +void ActionEditorFactory::onEditorDestroyed( QObject *editor ) +{ + d_ptr->removeEditor( editor ); +} + + + +//////////////////////////////////////////////////////////////////////// Editor ////////////////////////////////////////////////////////////////// + + + +ActionPropertyEditor::ActionPropertyEditor( QWidget *parent ) : +QWidget( parent ) +{ + setupUi(); + setupConnections(); +} + +ActionPropertyEditor::~ActionPropertyEditor() +{ +} + +void ActionPropertyEditor::setValue( const QString &value ) +{ + if( lineEdit->text() == value ) + return; + + disableConnections(); + lineEdit->setText( value ); + setupConnections(); +} + +void ActionPropertyEditor::showEvent( QShowEvent *e ) +{ + QWidget::showEvent( e ); +} + +void ActionPropertyEditor::onToolButtonClicked() +{ + ActionList d; + d.load(); + + int result = d.exec(); + if( QDialog::Accepted != result ) + return; + + lineEdit->setText( d.getSelectedAction() ); +} + +void ActionPropertyEditor::onTextChanged( const QString &text ) +{ + Q_EMIT valueChanged( text ); +} + +void ActionPropertyEditor::setupConnections() +{ + connect( toolButton, SIGNAL( clicked( bool ) ), this, SLOT( onToolButtonClicked() ) ); + connect( lineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) ); +} + +void ActionPropertyEditor::disableConnections() +{ + disconnect( toolButton, SIGNAL( clicked( bool ) ), this, SLOT( onToolButtonClicked() ) ); + disconnect( lineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) ); +} + +void ActionPropertyEditor::setupUi() +{ + lineEdit = new QLineEdit(); + toolButton = new QToolButton(); + toolButton->setText( "..." ); + + QHBoxLayout *lt = new QHBoxLayout( this ); + lt->setContentsMargins( 0, 0, 0, 0 ); + lt->setSpacing( 0 ); + lt->addWidget( lineEdit ); + lt->addWidget( toolButton ); + + setFocusProxy( lineEdit ); + setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed ); + +} + + diff --git a/code/studio/src/plugins/gui_editor/action_property_manager.h b/code/studio/src/plugins/gui_editor/action_property_manager.h new file mode 100644 index 000000000..06cd714d7 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/action_property_manager.h @@ -0,0 +1,125 @@ +// Ryzom Core Studio GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 ACTION_PROPERTY_MANAGER +#define ACTION_PROPERTY_MANAGER + +#define QT_QTPROPERTYBROWSER_IMPORT + +#include "3rdparty/qtpropertybrowser/qtpropertybrowser.h" +#include + +/////////////////////////////////////////////////////// Manager /////////////////////////////////////////////////////////////////////////// + +struct ActionPropertyManagerPrivate; + +class ActionPropertyManager : public QtAbstractPropertyManager +{ + Q_OBJECT + +public: + ActionPropertyManager( QObject *parent = NULL ); + ~ActionPropertyManager(); + + QString value( const QtProperty *p ) const; + +public Q_SLOTS: + void setValue( QtProperty *p, const QString &value ); + +Q_SIGNALS: + void valueChanged( QtProperty *p, const QString &value ); + +protected: + bool hasValue( const QtProperty *p ) const; + QString valueText( const QtProperty *p ) const; + void initializeProperty( QtProperty *p ); + void uninitializeProperty( QtProperty *p ); + +private: + ActionPropertyManagerPrivate *d_ptr; + + Q_DISABLE_COPY( ActionPropertyManager ); +}; + + +////////////////////////////////////////////////////////////////// Factory ///////////////////////////////////////////////////////////////////////// + +struct ActionEditorFactoryPrivate; + +class ActionEditorFactory : public QtAbstractEditorFactory< ActionPropertyManager > +{ + Q_OBJECT + +public: + ActionEditorFactory( QObject *parent = NULL ); + ~ActionEditorFactory(); + +protected: + void connectPropertyManager( ActionPropertyManager *manager ); + void disconnectPropertyManager( ActionPropertyManager *manager ); + + QWidget* createEditor( ActionPropertyManager *manager, QtProperty *p, QWidget *parent ); + +private Q_SLOTS: + void onPropertyChanged( QtProperty *p, const QString &value ); + void onSetValue( const QString &value ); + void onEditorDestroyed( QObject *editor ); + +private: + ActionEditorFactoryPrivate *d_ptr; + + Q_DISABLE_COPY( ActionEditorFactory ); +}; + + +///////////////////////////////////////////////////////////////// Editor /////////////////////////////////////////////////////////////////////////// + +class QLineEdit; +class QToolButton; + +class ActionPropertyEditor : public QWidget +{ + Q_OBJECT +public: + ActionPropertyEditor( QWidget *parent = NULL ); + ~ActionPropertyEditor(); + +public Q_SLOTS: + void setValue( const QString &value ); + +protected: + void showEvent( QShowEvent *e ); + +private Q_SLOTS: + void onToolButtonClicked(); + void onTextChanged( const QString &text ); + +Q_SIGNALS: + void valueChanged( const QString &value ); + +private: + void setupUi(); + void setupConnections(); + void disableConnections(); + + + QLineEdit *lineEdit; + QToolButton *toolButton; +}; + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/add_widget_widget.cpp b/code/studio/src/plugins/gui_editor/add_widget_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/add_widget_widget.cpp rename to code/studio/src/plugins/gui_editor/add_widget_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/add_widget_widget.h b/code/studio/src/plugins/gui_editor/add_widget_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/add_widget_widget.h rename to code/studio/src/plugins/gui_editor/add_widget_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/add_widget_widget.ui b/code/studio/src/plugins/gui_editor/add_widget_widget.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/add_widget_widget.ui rename to code/studio/src/plugins/gui_editor/add_widget_widget.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp b/code/studio/src/plugins/gui_editor/editor_message_processor.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp rename to code/studio/src/plugins/gui_editor/editor_message_processor.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.h b/code/studio/src/plugins/gui_editor/editor_message_processor.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.h rename to code/studio/src/plugins/gui_editor/editor_message_processor.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_selection_watcher.cpp b/code/studio/src/plugins/gui_editor/editor_selection_watcher.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_selection_watcher.cpp rename to code/studio/src/plugins/gui_editor/editor_selection_watcher.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_selection_watcher.h b/code/studio/src/plugins/gui_editor/editor_selection_watcher.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_selection_watcher.h rename to code/studio/src/plugins/gui_editor/editor_selection_watcher.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_constants.h b/code/studio/src/plugins/gui_editor/gui_editor_constants.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_constants.h rename to code/studio/src/plugins/gui_editor/gui_editor_constants.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_context.cpp b/code/studio/src/plugins/gui_editor/gui_editor_context.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_context.cpp rename to code/studio/src/plugins/gui_editor/gui_editor_context.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_context.h b/code/studio/src/plugins/gui_editor/gui_editor_context.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_context.h rename to code/studio/src/plugins/gui_editor/gui_editor_context.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_core_listener.cpp b/code/studio/src/plugins/gui_editor/gui_editor_core_listener.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_core_listener.cpp rename to code/studio/src/plugins/gui_editor/gui_editor_core_listener.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_core_listener.h b/code/studio/src/plugins/gui_editor/gui_editor_core_listener.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_core_listener.h rename to code/studio/src/plugins/gui_editor/gui_editor_core_listener.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_global.h b/code/studio/src/plugins/gui_editor/gui_editor_global.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_global.h rename to code/studio/src/plugins/gui_editor/gui_editor_global.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_plugin.cpp b/code/studio/src/plugins/gui_editor/gui_editor_plugin.cpp similarity index 96% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_plugin.cpp rename to code/studio/src/plugins/gui_editor/gui_editor_plugin.cpp index d0fea4df3..d5f2403f1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_plugin.cpp +++ b/code/studio/src/plugins/gui_editor/gui_editor_plugin.cpp @@ -37,6 +37,9 @@ namespace GUIEditor qDeleteAll(m_autoReleaseObjects); m_autoReleaseObjects.clear(); + + delete m_libContext; + m_libContext = NULL; } bool GUIEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_plugin.h b/code/studio/src/plugins/gui_editor/gui_editor_plugin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_plugin.h rename to code/studio/src/plugins/gui_editor/gui_editor_plugin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp b/code/studio/src/plugins/gui_editor/gui_editor_window.cpp similarity index 90% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp rename to code/studio/src/plugins/gui_editor/gui_editor_window.cpp index 341338d8d..3f4e318db 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp +++ b/code/studio/src/plugins/gui_editor/gui_editor_window.cpp @@ -40,10 +40,11 @@ #include "project_file_parser.h" #include "project_file_serializer.h" #include "project_window.h" -#include "nelgui_widget.h" +#include "nelgui_ctrl.h" #include "editor_selection_watcher.h" #include "editor_message_processor.h" #include "add_widget_widget.h" +#include "texture_chooser.h" namespace GUIEditor { @@ -55,6 +56,7 @@ namespace GUIEditor GUIEditorWindow::GUIEditorWindow(QWidget *parent) : QMainWindow(parent) { + menu = NULL; m_ui.setupUi(this); messageProcessor = new CEditorMessageProcessor; m_undoStack = new QUndoStack(this); @@ -64,11 +66,13 @@ namespace GUIEditor projectWindow = new ProjectWindow; addWidgetWidget = new AddWidgetWidget; connect( projectWindow, SIGNAL( projectFilesChanged() ), this, SLOT( onProjectFilesChanged() ) ); - viewPort = new NelGUIWidget; - setCentralWidget( viewPort ); + GUICtrl = new NelGUICtrl(); + setCentralWidget( GUICtrl->getViewPort() ); widgetInfoTree = new CWidgetInfoTree; + tc = new TextureChooser(); + createMenus(); readSettings(); @@ -96,9 +100,9 @@ namespace GUIEditor dock->setWidget( propBrowser ); addDockWidget( Qt::RightDockWidgetArea, dock ); - viewPort->init(); + GUICtrl->init(); - connect( viewPort, SIGNAL( guiLoadComplete() ), this, SLOT( onGUILoaded() ) ); + connect( GUICtrl, SIGNAL( guiLoadComplete() ), this, SLOT( onGUILoaded() ) ); connect( widgetProps, SIGNAL( treeChanged() ), this, SLOT( onTreeChanged() ) ); connect( addWidgetWidget, @@ -112,6 +116,11 @@ namespace GUIEditor { writeSettings(); + removeMenus(); + + delete tc; + tc = NULL; + delete messageProcessor; messageProcessor = NULL; @@ -127,8 +136,8 @@ namespace GUIEditor delete projectWindow; projectWindow = NULL; - delete viewPort; - viewPort = NULL; + delete GUICtrl; + GUICtrl = NULL; delete addWidgetWidget; addWidgetWidget = NULL; @@ -178,7 +187,7 @@ namespace GUIEditor currentProject = projectFiles.projectName.c_str(); currentProjectFile = fileName; projectWindow->setupFiles( projectFiles ); - if( viewPort->parse( projectFiles ) ) + if( GUICtrl->parse( projectFiles ) ) { hierarchyView->buildHierarchy( projectFiles.masterGroup ); } @@ -279,14 +288,14 @@ namespace GUIEditor return false; - CEditorSelectionWatcher *w = viewPort->getWatcher(); + CEditorSelectionWatcher *w = GUICtrl->getWatcher(); disconnect( w, SIGNAL( sgnSelectionChanged( std::string& ) ), hierarchyView, SLOT( onSelectionChanged( std::string& ) ) ); disconnect( w, SIGNAL( sgnSelectionChanged( std::string& ) ), &browserCtrl, SLOT( onSelectionChanged( std::string& ) ) ); projectFiles.clearAll(); projectWindow->clear(); hierarchyView->clearHierarchy(); - viewPort->reset(); + GUICtrl->reset(); browserCtrl.clear(); linkList->clear(); procList->clear(); @@ -302,7 +311,7 @@ namespace GUIEditor setCursor( Qt::WaitCursor ); projectWindow->updateFiles( projectFiles ); - if( !viewPort->parse( projectFiles ) ) + if( !GUICtrl->parse( projectFiles ) ) { QMessageBox::critical( this, tr( "Error parsing GUI XML files" ), @@ -318,7 +327,7 @@ namespace GUIEditor procList->onGUILoaded(); linkList->onGUILoaded(); - CEditorSelectionWatcher *w = viewPort->getWatcher(); + CEditorSelectionWatcher *w = GUICtrl->getWatcher(); connect( w, SIGNAL( sgnSelectionChanged( std::string& ) ), hierarchyView, SLOT( onSelectionChanged( std::string& ) ) ); connect( w, SIGNAL( sgnSelectionChanged( std::string& ) ), &browserCtrl, SLOT( onSelectionChanged( std::string& ) ) ); } @@ -337,6 +346,25 @@ namespace GUIEditor addWidgetWidget->setupWidgetInfo( widgetInfoTree ); } + + void GUIEditorWindow::hideEvent( QHideEvent *evnt ) + { + QWidget::hideEvent( evnt ); + GUICtrl->hide(); + } + + void GUIEditorWindow::showEvent( QShowEvent *evnt ) + { + QWidget::showEvent( evnt ); + GUICtrl->show(); + } + + void GUIEditorWindow::onTCClicked() + { + tc->load(); + tc->exec(); + } + void GUIEditorWindow::createMenus() { Core::MenuManager *mm = Core::ICore::instance()->menuManager(); @@ -360,11 +388,9 @@ namespace GUIEditor connect( delAction, SIGNAL( triggered( bool ) ), messageProcessor, SLOT( onDelete() ) ); } - QMenu *menu = mm->menu( Core::Constants::M_TOOLS ); - if( menu != NULL ) + QMenu *m = mm->menuBar()->addMenu( "GUI Editor" ); + if( m != NULL ) { - QMenu *m = menu->addMenu( "GUI Editor" ); - QAction *a = new QAction( "Widget Properties", this ); connect( a, SIGNAL( triggered( bool ) ), widgetProps, SLOT( show() ) ); m->addAction( a ); @@ -384,8 +410,20 @@ namespace GUIEditor a = new QAction( "Add Widget", this ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onAddWidgetClicked() ) ); m->addAction( a ); + + a = new QAction( "Texture Chooser", this ); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onTCClicked() ) ); + m->addAction( a ); + + menu = m; } } + + void GUIEditorWindow::removeMenus() + { + delete menu; + menu = NULL; + } void GUIEditorWindow::readSettings() { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h b/code/studio/src/plugins/gui_editor/gui_editor_window.h similarity index 89% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h rename to code/studio/src/plugins/gui_editor/gui_editor_window.h index e1a8b8b2d..d18a24813 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.h +++ b/code/studio/src/plugins/gui_editor/gui_editor_window.h @@ -26,6 +26,10 @@ class QtTreePropertyBrowser; +class QMenu; + +class TextureChooser; + namespace GUIEditor { @@ -34,7 +38,7 @@ namespace GUIEditor class LinkList; class ProcList; class ProjectWindow; - class NelGUIWidget; + class NelGUICtrl; class CWidgetInfoTree; class CEditorMessageProcessor; class AddWidgetWidget; @@ -63,9 +67,16 @@ private Q_SLOTS: void onGUILoaded(); void onAddWidgetClicked(); void onTreeChanged(); + void onTCClicked(); + + +protected: + void hideEvent( QHideEvent *evnt ); + void showEvent( QShowEvent *evnt ); private: void createMenus(); + void removeMenus(); void readSettings(); @@ -80,7 +91,7 @@ private: LinkList *linkList; ProcList *procList; ProjectWindow *projectWindow; - NelGUIWidget *viewPort; + NelGUICtrl *GUICtrl; CWidgetInfoTree *widgetInfoTree; CEditorMessageProcessor *messageProcessor; AddWidgetWidget *addWidgetWidget; @@ -88,6 +99,10 @@ private: CPropBrowserCtrl browserCtrl; QString currentProject; QString currentProjectFile; + + QMenu *menu; + + TextureChooser *tc; }; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.ui b/code/studio/src/plugins/gui_editor/gui_editor_window.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.ui rename to code/studio/src/plugins/gui_editor/gui_editor_window.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.cpp b/code/studio/src/plugins/gui_editor/link_editor.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.cpp rename to code/studio/src/plugins/gui_editor/link_editor.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.h b/code/studio/src/plugins/gui_editor/link_editor.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.h rename to code/studio/src/plugins/gui_editor/link_editor.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.ui b/code/studio/src/plugins/gui_editor/link_editor.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_editor.ui rename to code/studio/src/plugins/gui_editor/link_editor.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.cpp b/code/studio/src/plugins/gui_editor/link_list.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.cpp rename to code/studio/src/plugins/gui_editor/link_list.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.h b/code/studio/src/plugins/gui_editor/link_list.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.h rename to code/studio/src/plugins/gui_editor/link_list.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.ui b/code/studio/src/plugins/gui_editor/link_list.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/link_list.ui rename to code/studio/src/plugins/gui_editor/link_list.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp b/code/studio/src/plugins/gui_editor/nelgui_ctrl.cpp similarity index 75% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp rename to code/studio/src/plugins/gui_editor/nelgui_ctrl.cpp index d86d31269..03f784944 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.cpp +++ b/code/studio/src/plugins/gui_editor/nelgui_ctrl.cpp @@ -15,13 +15,14 @@ // along with this program. If not, see . -#include "nelgui_widget.h" +#include "nelgui_ctrl.h" #include "nel/misc/path.h" #include "nel/gui/view_renderer.h" #include "nel/gui/interface_group.h" #include "nel/gui/widget_manager.h" #include "nel/gui/action_handler.h" #include "nel/gui/lua_manager.h" +#include "nel/gui/event_listener.h" #include "nel/misc/path.h" #include "nel/misc/i18n.h" #include @@ -29,19 +30,24 @@ #include #include "editor_selection_watcher.h" +#include "../core/Nel3DWidget/nel3d_widget.h" + namespace GUIEditor { std::set< std::string > hwCursors; - NelGUIWidget::NelGUIWidget( QWidget *parent ) : - Nel3DWidget( parent ) + NelGUICtrl::NelGUICtrl( QObject *parent ) : + QObject( parent ) { timerID = 0; guiLoaded = false; watcher = NULL; + w = new Nel3DWidget(); + eventListener = new NLGUI::CEventListener(); + listening = false; } - NelGUIWidget::~NelGUIWidget() + NelGUICtrl::~NelGUICtrl() { guiLoaded = false; if( timerID != 0 ) @@ -49,25 +55,27 @@ namespace GUIEditor NLGUI::CViewRenderer::release(); NLMISC::CI18N::setNoResolution( false ); - + + delete w; + w = NULL; } - void NelGUIWidget::init() + void NelGUICtrl::init() { NLMISC::CI18N::setNoResolution( true ); NLMISC::CPath::remapExtension( "dds", "tga", true ); NLMISC::CPath::remapExtension( "dds", "png", true ); NLMISC::CPath::remapExtension( "png", "tga", true ); - Nel3DWidget::init(); - createTextContext( "Ryzom.ttf" ); + w->init(); + w->createTextContext( "Ryzom.ttf" ); NLGUI::CAHManager::setEditorMode( true ); NLGUI::CLuaManager::setEditorMode( true ); NLGUI::CInterfaceElement::setEditorMode( true ); - NLGUI::CViewRenderer::setDriver( getDriver() ); - NLGUI::CViewRenderer::setTextContext( getTextContext() ); + NLGUI::CViewRenderer::setDriver( w->getDriver() ); + NLGUI::CViewRenderer::setTextContext( w->getTextContext() ); NLGUI::CViewRenderer::hwCursors = &hwCursors; NLGUI::CViewRenderer::getInstance()->init(); @@ -76,7 +84,7 @@ namespace GUIEditor watcher = new CEditorSelectionWatcher(); } - bool NelGUIWidget::parse( SProjectFiles &files ) + bool NelGUICtrl::parse( SProjectFiles &files ) { reset(); IParser *parser = CWidgetManager::getInstance()->getParser(); @@ -115,7 +123,7 @@ namespace GUIEditor return true; } - void NelGUIWidget::reset() + void NelGUICtrl::reset() { guiLoaded = false; if( timerID != 0 ) @@ -125,45 +133,63 @@ namespace GUIEditor CWidgetManager::getInstance()->reset(); CWidgetManager::getInstance()->getParser()->removeAll(); CViewRenderer::getInstance()->reset(); - clear(); + w->clear(); } - void NelGUIWidget::draw() + void NelGUICtrl::draw() { - getDriver()->clearBuffers( NLMISC::CRGBA::Black ); + w->getDriver()->clearBuffers( NLMISC::CRGBA::Black ); CWidgetManager::getInstance()->checkCoords(); CWidgetManager::getInstance()->drawViews( 0 ); - getDriver()->swapBuffers(); + w->getDriver()->swapBuffers(); } - void NelGUIWidget::paintEvent( QPaintEvent *evnt ) - { - if( !guiLoaded ) - clear(); - } - - void NelGUIWidget::timerEvent( QTimerEvent *evnt ) + void NelGUICtrl::timerEvent( QTimerEvent *evnt ) { if( evnt->timerId() == timerID ) { if( guiLoaded ) { - getDriver()->EventServer.pump(); + w->getDriver()->EventServer.pump(); draw(); } + else + { + w->clear(); + } } } - void NelGUIWidget::showEvent( QShowEvent *evnt ) + void NelGUICtrl::show() { if( timerID == 0 ) timerID = startTimer( 200 ); + + if( !listening ) + { + eventListener->addToServer( &w->getDriver()->EventServer ); + listening = true; + } } - void NelGUIWidget::hideEvent( QHideEvent *evnt ) + void NelGUICtrl::hide() { if( timerID != 0 ) + { killTimer( timerID ); + timerID = 0; + } + + if( listening ) + { + eventListener->removeFromServer(); + listening = false; + } + } + + QWidget* NelGUICtrl::getViewPort() + { + return w; } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.h b/code/studio/src/plugins/gui_editor/nelgui_ctrl.h similarity index 77% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.h rename to code/studio/src/plugins/gui_editor/nelgui_ctrl.h index 34c510507..b3c68ff32 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/nelgui_widget.h +++ b/code/studio/src/plugins/gui_editor/nelgui_ctrl.h @@ -18,20 +18,28 @@ #ifndef NELGUI_WIDGET_H #define NELGUI_WIDGET_H -#include "nel3d_widget.h" +#include #include "project_files.h" +class QWidget; +class Nel3DWidget; + +namespace NLGUI +{ + class CEventListener; +} + namespace GUIEditor { class CEditorSelectionWatcher; - /// Qt viewport for the Nel GUI library - class NelGUIWidget : public Nel3DWidget + /// Qt viewport controller for the Nel GUI library + class NelGUICtrl : public QObject { Q_OBJECT public: - NelGUIWidget( QWidget *parent = NULL ); - ~NelGUIWidget(); + NelGUICtrl( QObject *parent = NULL ); + ~NelGUICtrl(); void init(); bool parse( SProjectFiles &files ); @@ -39,20 +47,27 @@ namespace GUIEditor void reset(); CEditorSelectionWatcher* getWatcher(){ return watcher; } + QWidget* getViewPort(); + + void show(); + void hide(); + Q_SIGNALS: void guiLoadComplete(); protected: - void paintEvent( QPaintEvent *evnt ); void timerEvent( QTimerEvent *evnt ); - void showEvent( QShowEvent *evnt ); - void hideEvent( QHideEvent *evnt ); - private: int timerID; bool guiLoaded; CEditorSelectionWatcher *watcher; + + NLGUI::CEventListener *eventListener; + + Nel3DWidget *w; + + bool listening; }; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/new_property_widget.cpp b/code/studio/src/plugins/gui_editor/new_property_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/new_property_widget.cpp rename to code/studio/src/plugins/gui_editor/new_property_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/new_property_widget.h b/code/studio/src/plugins/gui_editor/new_property_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/new_property_widget.h rename to code/studio/src/plugins/gui_editor/new_property_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/new_property_widget.ui b/code/studio/src/plugins/gui_editor/new_property_widget.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/new_property_widget.ui rename to code/studio/src/plugins/gui_editor/new_property_widget.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/new_widget_widget.cpp b/code/studio/src/plugins/gui_editor/new_widget_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/new_widget_widget.cpp rename to code/studio/src/plugins/gui_editor/new_widget_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/new_widget_widget.h b/code/studio/src/plugins/gui_editor/new_widget_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/new_widget_widget.h rename to code/studio/src/plugins/gui_editor/new_widget_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/new_widget_widget.ui b/code/studio/src/plugins/gui_editor/new_widget_widget.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/new_widget_widget.ui rename to code/studio/src/plugins/gui_editor/new_widget_widget.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_editor.cpp b/code/studio/src/plugins/gui_editor/proc_editor.cpp similarity index 96% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_editor.cpp rename to code/studio/src/plugins/gui_editor/proc_editor.cpp index c36b16f64..e96a1cce1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_editor.cpp +++ b/code/studio/src/plugins/gui_editor/proc_editor.cpp @@ -17,6 +17,7 @@ #include "proc_editor.h" #include "action_editor.h" +#include "action_list.h" #include #include #include "nel/gui/interface_group.h" @@ -35,10 +36,15 @@ namespace GUIEditor connect( removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveButtonClicked() ) ); connect( upButton, SIGNAL( clicked( bool ) ), this, SLOT( onUpButtonClicked() ) ); connect( downButton, SIGNAL( clicked( bool ) ), this, SLOT( onDownButtonClicked() ) ); + + alist = new ActionList(); } ProcEditor::~ProcEditor() { + delete alist; + alist = NULL; + delete actionEditor; actionEditor = NULL; } @@ -84,17 +90,13 @@ namespace GUIEditor void ProcEditor::onAddButtonClicked() { - bool ok; - QString name = - QInputDialog::getText( this, - tr( "Adding new Action" ), - tr( "Please specify the name of the new action handler" ), - QLineEdit::Normal, - QString(), - &ok ); - - if( ok ) + alist->load(); + int result = alist->exec(); + + if( result == QDialog::Accepted ) { + QString name = alist->getSelectedAction(); + CProcedure *proc = CWidgetManager::getInstance()->getParser()->getProc( currentProc.toUtf8().constData() ); if( proc != NULL ) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_editor.h b/code/studio/src/plugins/gui_editor/proc_editor.h similarity index 97% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_editor.h rename to code/studio/src/plugins/gui_editor/proc_editor.h index 90579daa4..8debfef02 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_editor.h +++ b/code/studio/src/plugins/gui_editor/proc_editor.h @@ -20,6 +20,8 @@ #include "ui_proc_editor.h" +class ActionList; + namespace GUIEditor { class ActionEditor; @@ -46,6 +48,8 @@ namespace GUIEditor ActionEditor *actionEditor; QString currentProc; + + ActionList *alist; }; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_editor.ui b/code/studio/src/plugins/gui_editor/proc_editor.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_editor.ui rename to code/studio/src/plugins/gui_editor/proc_editor.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.cpp b/code/studio/src/plugins/gui_editor/proc_list.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.cpp rename to code/studio/src/plugins/gui_editor/proc_list.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.h b/code/studio/src/plugins/gui_editor/proc_list.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.h rename to code/studio/src/plugins/gui_editor/proc_list.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.ui b/code/studio/src/plugins/gui_editor/proc_list.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/proc_list.ui rename to code/studio/src/plugins/gui_editor/proc_list.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_parser.cpp b/code/studio/src/plugins/gui_editor/project_file_parser.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_parser.cpp rename to code/studio/src/plugins/gui_editor/project_file_parser.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_parser.h b/code/studio/src/plugins/gui_editor/project_file_parser.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_parser.h rename to code/studio/src/plugins/gui_editor/project_file_parser.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_serializer.cpp b/code/studio/src/plugins/gui_editor/project_file_serializer.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_serializer.cpp rename to code/studio/src/plugins/gui_editor/project_file_serializer.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_serializer.h b/code/studio/src/plugins/gui_editor/project_file_serializer.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_file_serializer.h rename to code/studio/src/plugins/gui_editor/project_file_serializer.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_files.h b/code/studio/src/plugins/gui_editor/project_files.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_files.h rename to code/studio/src/plugins/gui_editor/project_files.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_files/login.xml b/code/studio/src/plugins/gui_editor/project_files/login.xml similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_files/login.xml rename to code/studio/src/plugins/gui_editor/project_files/login.xml diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.cpp b/code/studio/src/plugins/gui_editor/project_window.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.cpp rename to code/studio/src/plugins/gui_editor/project_window.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.h b/code/studio/src/plugins/gui_editor/project_window.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.h rename to code/studio/src/plugins/gui_editor/project_window.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.ui b/code/studio/src/plugins/gui_editor/project_window.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/project_window.ui rename to code/studio/src/plugins/gui_editor/project_window.ui diff --git a/code/studio/src/plugins/gui_editor/property_browser_ctrl.cpp b/code/studio/src/plugins/gui_editor/property_browser_ctrl.cpp new file mode 100644 index 000000000..bd73fb7fa --- /dev/null +++ b/code/studio/src/plugins/gui_editor/property_browser_ctrl.cpp @@ -0,0 +1,976 @@ +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "property_browser_ctrl.h" +#include "../../3rdparty/qtpropertybrowser/QtVariantPropertyManager" +#include "../../3rdparty/qtpropertybrowser/QtEnumPropertyManager" +#include "../../3rdparty/qtpropertybrowser/QtTreePropertyBrowser" +#include "../../3rdparty/qtpropertybrowser/QtEnumEditorFactory" +#include "nel/gui/interface_group.h" +#include "nel/gui/widget_manager.h" +#include +#include "widget_info_tree.h" +#include + +#include "action_property_manager.h" +#include "texture_property_manager.h" + +namespace +{ + class NelBMAlign + { + public: + + enum NELBMAlign + { + LB = 0, + RB = 1, + LT = 2, + RT = 3 + }; + + static int fromString( const std::string &s ) + { + int r = -1; + + if( s == "LB" ) + r = 0; + else + if( s == "RB" ) + r = 1; + else + if( s == "LT" ) + r = 2; + else + if( s == "RT" ) + r = 3; + + return r; + } + + static std::string toString( int value ) + { + std::string s; + + switch( value ) + { + case LB: s = "LB"; break; + case RB: s = "RB"; break; + case LT: s = "LT"; break; + case RT: s = "RT"; break; + } + + return s; + } + }; + + class NelTTParent + { + public: + + enum NELTTParent + { + TTPARENT_MOUSE = 0, + TTPARENT_CONTROL = 1, + TTPARENT_WINDOW = 2, + TTPARENT_SPECIAL_WINDOW = 3 + }; + + static int fromString( const std::string &s ) + { + int r = -1; + + if( s == "mouse" ) + r = TTPARENT_MOUSE; + else + if( s == "control" ) + r = TTPARENT_CONTROL; + else + if( s == "window" ) + r = TTPARENT_WINDOW; + else + if( s == "special" ) + r = TTPARENT_SPECIAL_WINDOW; + + return r; + } + + static std::string toString( int value ) + { + std::string s; + + switch( value ) + { + case TTPARENT_MOUSE: s = "mouse"; break; + case TTPARENT_CONTROL: s = "control"; break; + case TTPARENT_WINDOW: s = "window"; break; + case TTPARENT_SPECIAL_WINDOW: s = "special"; break; + } + + return s; + } + }; + + class NelPosRef + { + public: + + enum NELPosRef + { + POSREF_BL = 0, + POSREF_BM = 1, + POSREF_BR = 2, + POSREF_ML = 3, + POSREF_MM = 4, + POSREF_MR = 5, + POSREF_TL = 6, + POSREF_TM = 7, + POSREF_TR = 8 + }; + + static int fromString( const std::string &s ) + { + int r = -1; + + if( s == "BL" ) + r = POSREF_BL; + else + if( s == "BM" ) + r = POSREF_BM; + else + if( s == "BR" ) + r = POSREF_BR; + else + if( s == "ML" ) + r = POSREF_ML; + else + if( s == "MM" ) + r = POSREF_MM; + else + if( s == "MR" ) + r = POSREF_MR; + else + if( s == "TL" ) + r = POSREF_TL; + else + if( s == "TM" ) + r = POSREF_TM; + else + if( s == "TR" ) + r = POSREF_TR; + + return r; + } + + static std::string toString( int value ) + { + std::string v; + + switch( value ) + { + case POSREF_BL: v = "BL"; break; + case POSREF_BM: v = "BM"; break; + case POSREF_BR: v = "BR"; break; + case POSREF_ML: v = "ML"; break; + case POSREF_MM: v = "MM"; break; + case POSREF_MR: v = "MR"; break; + case POSREF_TL: v = "TL"; break; + case POSREF_TM: v = "TM"; break; + case POSREF_TR: v = "TR"; break; + } + + return v; + } + }; + + + class NelPosRefTT + { + public: + + enum NELPosRef + { + TTPOSREF_BL = 0, + TTPOSREF_BM = 1, + TTPOSREF_BR = 2, + TTPOSREF_ML = 3, + TTPOSREF_MM = 4, + TTPOSREF_MR = 5, + TTPOSREF_TL = 6, + TTPOSREF_TM = 7, + TTPOSREF_TR = 8, + TTPOSREF_AUTO = 9 + }; + + static int fromString( const std::string &s ) + { + int r = -1; + + if( s == "BL" ) + r = TTPOSREF_BL; + else + if( s == "BM" ) + r = TTPOSREF_BM; + else + if( s == "BR" ) + r = TTPOSREF_BR; + else + if( s == "ML" ) + r = TTPOSREF_ML; + else + if( s == "MM" ) + r = TTPOSREF_MM; + else + if( s == "MR" ) + r = TTPOSREF_MR; + else + if( s == "TL" ) + r = TTPOSREF_TL; + else + if( s == "TM" ) + r = TTPOSREF_TM; + else + if( s == "TR" ) + r = TTPOSREF_TR; + else + r = TTPOSREF_AUTO; + + return r; + } + + static std::string toString( int value ) + { + std::string v; + + switch( value ) + { + case TTPOSREF_BL: v = "BL"; break; + case TTPOSREF_BM: v = "BM"; break; + case TTPOSREF_BR: v = "BR"; break; + case TTPOSREF_ML: v = "ML"; break; + case TTPOSREF_MM: v = "MM"; break; + case TTPOSREF_MR: v = "MR"; break; + case TTPOSREF_TL: v = "TL"; break; + case TTPOSREF_TM: v = "TM"; break; + case TTPOSREF_TR: v = "TR"; break; + case TTPOSREF_AUTO: v = "auto"; break; + } + + return v; + } + }; + + + class NelButtonType + { + public: + + enum NELButtonTypes + { + BUTTON_TYPE_PUSH = 0, + BUTTON_TYPE_TOGGLE = 1, + BUTTON_TYPE_RADIO = 2 + }; + + static int fromString( const std::string &s ) + { + int r = -1; + + if( s == "push_button" ) + r = BUTTON_TYPE_PUSH; + else + if( s == "toggle_button" ) + r = BUTTON_TYPE_TOGGLE; + else + if( s == "radio_button" ) + r = BUTTON_TYPE_RADIO; + + return r; + } + + static std::string toString( int value ) + { + std::string v; + + switch( value ) + { + case BUTTON_TYPE_PUSH: v = "push_button"; break; + case BUTTON_TYPE_TOGGLE: v = "toggle_button"; break; + case BUTTON_TYPE_RADIO: v = "radio_button"; break; + } + + return v; + } + + }; + + class NelTxtJustification + { + public: + + enum NELTxtJustification + { + TEXT_CLIPWORD, + TEXT_DONTCLIPWORD, + TEXT_JUSTIFIED + }; + + static int fromString( const std::string &s ) + { + int r = -1; + + if( s == "clip_word" ) + r = TEXT_CLIPWORD; + else + if( s == "dont_clip_word" ) + r = TEXT_DONTCLIPWORD; + else + if( s == "justified" ) + r = TEXT_JUSTIFIED; + + return r; + } + + static std::string toString( int value ) + { + std::string v; + + switch( value ) + { + case TEXT_CLIPWORD: v = "clip_word"; break; + case TEXT_DONTCLIPWORD: v = "dont_clip_word"; break; + case TEXT_JUSTIFIED: v = "justified"; break; + } + + return v; + } + + }; + +} + +namespace GUIEditor +{ + + CPropBrowserCtrl::CPropBrowserCtrl() + { + browser = NULL; + propertyMgr = new QtVariantPropertyManager; + enumMgr = new QtEnumPropertyManager; + actionMgr = new ActionPropertyManager; + textureMgr = new TexturePropertyManager; + + variantFactory = new QtVariantEditorFactory; + enumFactory = new QtEnumEditorFactory; + actionFactory = new ActionEditorFactory; + textureFactory = new TextureEditorFactory; + + ttPairs[ "tooltip_posref" ] = "tooltip_parent_posref"; + ttPairs[ "tooltip_parent_posref" ] = "tooltip_posref"; + ttPairs[ "tooltip_posref_alt" ] = "tooltip_parent_posref_alt"; + ttPairs[ "tooltip_parent_posref_alt" ] = "tooltip_posref_alt"; + + } + + CPropBrowserCtrl::~CPropBrowserCtrl() + { + delete textureMgr; + textureMgr = NULL; + delete actionMgr; + actionMgr = NULL; + delete enumMgr; + enumMgr = NULL; + delete propertyMgr; + propertyMgr = NULL; + + delete textureFactory; + textureFactory = NULL; + delete actionFactory; + actionFactory = NULL; + delete variantFactory; + variantFactory = NULL; + delete enumFactory; + enumFactory = NULL; + + browser = NULL; + } + + void CPropBrowserCtrl::setBrowser( QtTreePropertyBrowser *b ) + { + browser = b; + } + + void CPropBrowserCtrl::setupWidgetInfo( CWidgetInfoTree *tree ) + { + widgetInfo.clear(); + + std::vector< std::string > names; + tree->getNames( names ); + + std::vector< std::string >::const_iterator itr; + for( itr = names.begin(); itr != names.end(); ++itr ) + { + CWidgetInfoTreeNode *node = tree->findNodeByName( *itr ); + const SWidgetInfo &w = node->getInfo(); + widgetInfo[ w.GUIName ] = w; + } + } + + void CPropBrowserCtrl::clear() + { + disablePropertyWatchers(); + browser->clear(); + } + + void CPropBrowserCtrl::onSelectionChanged( std::string &id ) + { + if( browser == NULL ) + return; + + disablePropertyWatchers(); + browser->clear(); + + CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( id ); + if( e == NULL ) + { + enablePropertyWatchers(); + return; + } + + currentElement = id; + + std::string n = e->getClassName(); + + setupProperties( n, e ); + + + // Need to set these up every time, otherwise the editors won't work + // probably the clear() method clears them too... + browser->setFactoryForManager( propertyMgr, variantFactory ); + browser->setFactoryForManager( enumMgr, enumFactory ); + browser->setFactoryForManager( actionMgr, actionFactory ); + browser->setFactoryForManager( textureMgr, textureFactory ); + + enablePropertyWatchers(); + } + + void CPropBrowserCtrl::onPropertyChanged( QtProperty *prop, const QVariant &v ) + { + QString propName = prop->propertyName(); + QString propValue = prop->valueText(); + + // for some reason booleans cannot be extracted from a QtProperty :( + if( propValue.isEmpty() ) + { + QtVariantProperty *p = propertyMgr->variantProperty( prop ); + if( p != NULL ) + propValue = p->value().toString(); + } + + if( v.type() == QVariant::Color ) + { + QColor c = v.value< QColor >(); + QString val = "%1 %2 %3 %4"; + val = val.arg( c.red() ).arg( c.green() ).arg( c.blue() ).arg( c.alpha() ); + propValue = val; + } + + CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement ); + if( e == NULL ) + return; + e->setProperty( propName.toUtf8().constData(), propValue.toUtf8().constData() ); + + + // Make sure the changes are applied + bool active = e->getActive(); + e->setActive( !active ); + e->setActive( active ); + } + + void CPropBrowserCtrl::onEnumPropertyChanged( QtProperty *prop, int value ) + { + QString propName = prop->propertyName(); + std::string n = propName.toUtf8().constData(); + + // Try to find the type for this property + std::map< std::string, std::string >::const_iterator itr = + nameToType.find( n ); + // Not found :( + if( itr == nameToType.end() ) + return; + std::string type = itr->second; + + + if( type == "button_type" ) + { + CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement ); + if( e == NULL ) + return; + + std::string v; + v = NelButtonType::toString( value ); + if( v.empty() ) + return; + + e->setProperty( propName.toUtf8().constData(), v ); + } + else + if( type == "text_justification" ) + { + CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement ); + if( e == NULL ) + return; + + std::string v; + v = NelTxtJustification::toString( value ); + if( v.empty() ) + return; + + e->setProperty( propName.toUtf8().constData(), v ); + } + else + if( type == "posref" ) + { + CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement ); + if( e == NULL ) + return; + + std::string v = NelPosRef::toString( value ); + if( v.empty() ) + return; + + e->setProperty( propName.toUtf8().constData(), v ); + } + else + if( type == "posreftt" ) + { + CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement ); + if( e == NULL ) + return; + + std::string v = NelPosRefTT::toString( value ); + if( v.empty() ) + return; + + e->setProperty( propName.toUtf8().constData(), v ); + + // When auto is set as posref for a tooltip, it's pair MUST be auto as well + // When we set anything other than auto, the pair MUST not be auto either + // Only need to set the widget here, since the actual property is changed in the GUI library automatically + { + // Find the pair + std::map< std::string, std::string >::const_iterator ttItr = + ttPairs.find( n ); + + // Found! + if( ttItr != ttPairs.end() ) + { + + // Find the QtProperty that belongs to the pair + std::map< std::string, QtProperty* >::const_iterator pItr = + ttPosRefProps.find( ttItr->second ); + + // Found! + if( pItr != ttPosRefProps.end() ) + { + disablePropertyWatchers(); + + if( value == NelPosRefTT::TTPOSREF_AUTO ) + enumMgr->setValue( pItr->second, NelPosRefTT::TTPOSREF_AUTO ); + else + { + int v = NelPosRefTT::fromString( pItr->second->valueText().toUtf8().constData() ); + if( v == NelPosRefTT::TTPOSREF_AUTO ) + { + enumMgr->setValue( pItr->second, value ); + } + } + + enablePropertyWatchers(); + } + } + } + } + else + if( type == "tooltip_parent" ) + { + CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement ); + if( e == NULL ) + return; + + std::string v = NelTTParent::toString( value ); + if( v.empty() ) + return; + + e->setProperty( propName.toUtf8().constData(), v ); + } + else + if( type == "bitmap_align" ) + { + CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement ); + if( e == NULL ) + return; + + std::string v = NelBMAlign::toString( value ); + if( v.empty() ) + return; + + e->setProperty( propName.toUtf8().constData(), v ); + } + } + + + void CPropBrowserCtrl::onActionPropertyChanged( QtProperty *p, const QString &v ) + { + QString propName = p->propertyName(); + + CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement ); + if( e == NULL ) + return; + + e->setProperty( propName.toUtf8().constData(), v.toUtf8().constData() ); + } + + void CPropBrowserCtrl::onTexturePropertyChanged( QtProperty *p, const QString &v ) + { + QString propName = p->propertyName(); + + CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( currentElement ); + if( e == NULL ) + return; + + e->setProperty( propName.toUtf8().constData(), v.toUtf8().constData() ); + } + + void CPropBrowserCtrl::enablePropertyWatchers() + { + connect( propertyMgr, SIGNAL( valueChanged( QtProperty*, const QVariant& ) ), + this, SLOT( onPropertyChanged( QtProperty*, const QVariant& ) ) ); + connect( enumMgr, SIGNAL( valueChanged( QtProperty*, int ) ), + this, SLOT( onEnumPropertyChanged( QtProperty*, int ) ) ); + + connect( actionMgr, SIGNAL( valueChanged( QtProperty*, const QString& ) ), + this, SLOT( onActionPropertyChanged( QtProperty*, const QString& ) ) ); + connect( textureMgr, SIGNAL( valueChanged( QtProperty*, const QString& ) ), + this, SLOT( onTexturePropertyChanged( QtProperty*, const QString& ) ) ); + } + + void CPropBrowserCtrl::disablePropertyWatchers() + { + disconnect( propertyMgr, SIGNAL( valueChanged( QtProperty*, const QVariant& ) ), + this, SLOT( onPropertyChanged( QtProperty*, const QVariant& ) ) ); + disconnect( enumMgr, SIGNAL( valueChanged( QtProperty*, int ) ), + this, SLOT( onEnumPropertyChanged( QtProperty*, int ) ) ); + + disconnect( actionMgr, SIGNAL( valueChanged( QtProperty*, const QString& ) ), + this, SLOT( onActionPropertyChanged( QtProperty*, const QString& ) ) ); + disconnect( textureMgr, SIGNAL( valueChanged( QtProperty*, const QString& ) ), + this, SLOT( onTexturePropertyChanged( QtProperty*, const QString& ) ) ); + } + + void CPropBrowserCtrl::setupProperties( const std::string &type, const CInterfaceElement *element ) + { + std::map< std::string, SWidgetInfo >::iterator itr = widgetInfo.find( type ); + if( itr == widgetInfo.end() ) + return; + SWidgetInfo &w = itr->second; + + nameToType.clear(); + ttPosRefProps.clear(); + + std::vector< SPropEntry >::const_iterator pItr; + for( pItr = w.props.begin(); pItr != w.props.end(); ++pItr ) + { + const SPropEntry &prop = *pItr; + nameToType[ prop.propName ] = prop.propType; + setupProperty( prop, element ); + } + } + + void CPropBrowserCtrl::setupProperty( const SPropEntry &prop, const CInterfaceElement *element ) + { + QtVariantProperty *p = NULL; + QVariant v; + + if( prop.propType == "texture" ) + { + std::string j = element->getProperty( prop.propName ); + + if( j.empty() ) + return; + + QtProperty *pp = textureMgr->addProperty( prop.propName.c_str() ); + if( pp == NULL ) + return; + + textureMgr->setValue( pp, j.c_str() ); + browser->addProperty( pp ); + } + else + if( prop.propType == "action" ) + { + std::string j = element->getProperty( prop.propName ); + + if( j.empty() ) + return; + + QtProperty *pp = actionMgr->addProperty( prop.propName.c_str() ); + if( pp == NULL ) + return; + + actionMgr->setValue( pp, j.c_str() ); + browser->addProperty( pp ); + } + else + if( prop.propType == "bitmap_align" ) + { + std::string j = element->getProperty( prop.propName ); + + if( j.empty() ) + return; + + int e = -1; + e = NelBMAlign::fromString( j ); + if( e == -1 ) + return; + + QtProperty *pp = enumMgr->addProperty( prop.propName.c_str() ); + if( pp == NULL ) + return; + + QStringList enums; + enums.push_back( "LB" ); + enums.push_back( "RB" ); + enums.push_back( "LT" ); + enums.push_back( "RT" ); + + enumMgr->setEnumNames( pp, enums ); + enumMgr->setValue( pp, e ); + browser->addProperty( pp ); + } + else + if( prop.propType == "tooltip_parent" ) + { + std::string j = element->getProperty( prop.propName ); + + if( j.empty() ) + return; + + int e = -1; + e = NelTTParent::fromString( j ); + if( e == -1 ) + return; + + QtProperty *pp = enumMgr->addProperty( prop.propName.c_str() ); + if( pp == NULL ) + return; + + QStringList enums; + enums.push_back( "mouse" ); + enums.push_back( "control" ); + enums.push_back( "window" ); + enums.push_back( "special window" ); + + enumMgr->setEnumNames( pp, enums ); + enumMgr->setValue( pp, e ); + browser->addProperty( pp ); + + } + else + if( prop.propType == "button_type" ) + { + std::string btype = element->getProperty( prop.propName ); + if( btype.empty() ) + return; + + int e = -1; + e = NelButtonType::fromString( btype ); + if( e == -1 ) + return; + + QtProperty *pp = enumMgr->addProperty( prop.propName.c_str() ); + if( pp == NULL ) + return; + + QStringList enums; + enums.push_back( "push_button" ); + enums.push_back( "toggle_button" ); + enums.push_back( "radio_button" ); + + enumMgr->setEnumNames( pp, enums ); + enumMgr->setValue( pp, e ); + browser->addProperty( pp ); + return; + } + else + if( prop.propType == "text_justification" ) + { + std::string j = element->getProperty( prop.propName ); + if( j.empty() ) + return; + + int e = -1; + e = NelTxtJustification::fromString( j ); + if( e == -1 ) + return; + + QtProperty *pp = enumMgr->addProperty( prop.propName.c_str() ); + if( pp == NULL ) + return; + + QStringList enums; + enums.push_back( "clip_word" ); + enums.push_back( "dont_clip_word" ); + enums.push_back( "justified" ); + + enumMgr->setEnumNames( pp, enums ); + enumMgr->setValue( pp, e ); + browser->addProperty( pp ); + + return; + } + else + if( prop.propType == "posref" ) + { + std::string j = element->getProperty( prop.propName ); + if( j.empty() ) + return; + + int e = -1; + e = NelPosRef::fromString( j ); + if( e == -1 ) + return; + + QtProperty *pp = enumMgr->addProperty( prop.propName.c_str() ); + if( pp == NULL ) + return; + + QStringList enums; + enums.push_back( "BL" ); + enums.push_back( "BM" ); + enums.push_back( "BR" ); + enums.push_back( "ML" ); + enums.push_back( "MM" ); + enums.push_back( "MR" ); + enums.push_back( "TL" ); + enums.push_back( "TM" ); + enums.push_back( "TR" ); + + enumMgr->setEnumNames( pp, enums ); + enumMgr->setValue( pp, e ); + browser->addProperty( pp ); + + return; + } + else + if( prop.propType == "posreftt" ) + { + std::string j = element->getProperty( prop.propName ); + if( j.empty() ) + return; + + int e = -1; + e = NelPosRefTT::fromString( j ); + if( e == -1 ) + return; + + QtProperty *pp = enumMgr->addProperty( prop.propName.c_str() ); + if( pp == NULL ) + return; + + QStringList enums; + enums.push_back( "BL" ); + enums.push_back( "BM" ); + enums.push_back( "BR" ); + enums.push_back( "ML" ); + enums.push_back( "MM" ); + enums.push_back( "MR" ); + enums.push_back( "TL" ); + enums.push_back( "TM" ); + enums.push_back( "TR" ); + enums.push_back( "auto" ); + + enumMgr->setEnumNames( pp, enums ); + enumMgr->setValue( pp, e ); + browser->addProperty( pp ); + + ttPosRefProps[ prop.propName ] = pp; + + return; + } + else + if( prop.propType == "string" ) + { + p = propertyMgr->addProperty( QVariant::String, prop.propName.c_str() ); + v = element->getProperty( prop.propName ).c_str(); + } + else + if( prop.propType == "bool" ) + { + p = propertyMgr->addProperty( QVariant::Bool, prop.propName.c_str() ); + bool value = false; + NLMISC::fromString( element->getProperty( prop.propName ), value ); + v = value; + } + else + if( prop.propType == "int" ) + { + p = propertyMgr->addProperty( QVariant::Int, prop.propName.c_str() ); + sint32 value = 0; + NLMISC::fromString( element->getProperty( prop.propName ), value ); + v = value; + } + else + if( prop.propType == "color" ) + { + p = propertyMgr->addProperty( QVariant::Color, prop.propName.c_str() ); + + std::string s = element->getProperty( prop.propName ); + // Parse string into a QColor + QString qs = s.c_str(); + QStringList l = qs.split( " " ); + int r = l[ 0 ].toInt(); + int g = l[ 1 ].toInt(); + int b = l[ 2 ].toInt(); + int a = l[ 3 ].toInt(); + + QColor value; + value.setRed( r ); + value.setGreen( g ); + value.setBlue( b ); + value.setAlpha( a ); + v = value; + + + // Remove the subproperties + QList< QtProperty* > pl = p->subProperties(); + QListIterator< QtProperty* > itr( pl ); + while( itr.hasNext() ) + { + delete itr.next(); + } + pl.clear(); + + } + + if( p == NULL ) + return; + + p->setValue( v ); + browser->addProperty( p ); + } +} diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.h b/code/studio/src/plugins/gui_editor/property_browser_ctrl.h similarity index 66% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.h rename to code/studio/src/plugins/gui_editor/property_browser_ctrl.h index 4c5ebce63..abf80d7de 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.h +++ b/code/studio/src/plugins/gui_editor/property_browser_ctrl.h @@ -25,7 +25,16 @@ class QtTreePropertyBrowser; class QtVariantPropertyManager; +class QtEnumPropertyManager; +class QtVariantEditorFactory; +class QtEnumEditorFactory; class QtProperty; +class QVariant; + +class ActionPropertyManager; +class ActionEditorFactory; +class TexturePropertyManager; +class TextureEditorFactory; namespace NLGUI { @@ -53,16 +62,34 @@ namespace GUIEditor void onSelectionChanged( std::string &id ); private Q_SLOTS: - void onPropertyChanged( QtProperty *prop ); + void onPropertyChanged( QtProperty *prop, const QVariant &v ); + void onEnumPropertyChanged( QtProperty *prop, int value ); + void onActionPropertyChanged( QtProperty *p, const QString &v ); + void onTexturePropertyChanged( QtProperty *p, const QString &v ); private: + void enablePropertyWatchers(); + void disablePropertyWatchers(); + void setupProperties( const std::string &type, const NLGUI::CInterfaceElement *element ); void setupProperty( const SPropEntry &prop, const NLGUI::CInterfaceElement *element ); QtTreePropertyBrowser *browser; QtVariantPropertyManager *propertyMgr; + QtEnumPropertyManager *enumMgr; + ActionPropertyManager *actionMgr; + TexturePropertyManager *textureMgr; + + QtVariantEditorFactory *variantFactory; + QtEnumEditorFactory *enumFactory; + ActionEditorFactory *actionFactory; + TextureEditorFactory *textureFactory; + std::string currentElement; std::map< std::string, SWidgetInfo > widgetInfo; + std::map< std::string, std::string > nameToType; + std::map< std::string, QtProperty * > ttPosRefProps; // Tooltip posref properties + std::map< std::string, std::string > ttPairs; }; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/ovqt_plugin_gui_editor.xml b/code/studio/src/plugins/gui_editor/studio_plugin_gui_editor.xml similarity index 77% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/ovqt_plugin_gui_editor.xml rename to code/studio/src/plugins/gui_editor/studio_plugin_gui_editor.xml index 3703509bb..9ba1452e9 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/ovqt_plugin_gui_editor.xml +++ b/code/studio/src/plugins/gui_editor/studio_plugin_gui_editor.xml @@ -1,5 +1,5 @@ - ovqt_plugin_gui_editor + studio_plugin_gui_editor GUI Editor 0.0.1 Ryzom Core diff --git a/code/studio/src/plugins/gui_editor/texture_chooser.cpp b/code/studio/src/plugins/gui_editor/texture_chooser.cpp new file mode 100644 index 000000000..3f988d4f3 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/texture_chooser.cpp @@ -0,0 +1,201 @@ +// Ryzom Core Studio GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "texture_chooser.h" +#include "nel/misc/path.h" +#include "nel/misc/bitmap.h" +#include "nel/misc/file.h" +#include +#include +#include +#include +#include + +#include "nel/gui/view_renderer.h" + +struct TextureChooserPrivate +{ + QListWidget *fileTextures; + QListWidget *atlasTextures; + + TextureChooserPrivate() + { + fileTextures = new QListWidget(); + atlasTextures = new QListWidget(); + } +}; + +TextureChooser::TextureChooser( QDialog *parent ) : +QDialog( parent ) +{ + setupUi( this ); + + d_ptr = new TextureChooserPrivate; + this->tabWidget->clear(); + this->tabWidget->addTab( d_ptr->fileTextures, tr( "File textures" ) ); + this->tabWidget->addTab( d_ptr->atlasTextures, tr( "Atlas texture" ) ); + + setupConnections(); +} + +TextureChooser::~TextureChooser() +{ + delete d_ptr; + d_ptr = NULL; +} + + +void TextureChooser::load() +{ + // Load the file textures + d_ptr->fileTextures->clear(); + + std::vector< std::string > textures; + //NLMISC::CPath::getFileList( "tga", textures ); + NLMISC::CPath::getFileListByPath( "dds", "interfaces", textures ); + NLMISC::CPath::getFileListByPath( "dds", "gamedev", textures ); + + std::sort( textures.begin(), textures.end() ); + + std::vector< std::string >::const_iterator itr = textures.begin(); + while( itr != textures.end() ) + { + d_ptr->fileTextures->addItem( itr->c_str() ); + ++itr; + } + + // Now load the atlas textures + d_ptr->atlasTextures->clear(); + textures.clear(); + + NLGUI::CViewRenderer::getInstance()->getTextureNames( textures ); + itr = textures.begin(); + while( itr != textures.end() ) + { + d_ptr->atlasTextures->addItem( itr->c_str() ); + ++itr; + } + + // set the file textures row after the atlas, because they are shown first + d_ptr->atlasTextures->setCurrentRow( 0 ); + d_ptr->fileTextures->setCurrentRow( 0 ); +} + +void TextureChooser::accept() +{ + QListWidgetItem *item = d_ptr->fileTextures->currentItem(); + if( item == NULL ) + return; + + selection = item->text(); + QDialog::accept(); +} + +void TextureChooser::reject() +{ + selection = ""; + + QDialog::reject(); +} + +void TextureChooser::onFileTxtRowChanged( int row ) +{ + if( row < 0 ) + return; + + QListWidgetItem *item = d_ptr->fileTextures->item( row ); + QString fn = item->text(); + + std::string rfn = fn.toUtf8().constData(); + rfn = NLMISC::CPath::lookup( rfn ); + + NLMISC::CIFile f; + bool b = f.open( rfn ); + if( !b ) + { + return; + } + + NLMISC::CBitmap bm; + uint8 depth = bm.load( f ); + f.close(); + b = bm.convertToType( NLMISC::CBitmap::RGBA ); + if( !b ) + { + return; + } + + setPreviewImage( bm ); +} + +void TextureChooser::onAtlasTxtRowChanged( int row ) +{ + if( row < 0 ) + return; + + QListWidgetItem *item = d_ptr->atlasTextures->item( row ); + QString fn = item->text(); + + std::string rfn = fn.toUtf8().constData(); + + NLMISC::CBitmap bm; + + bool b = NLGUI::CViewRenderer::getInstance()->getTexture( bm, rfn ); + if( !b ) + return; + + setPreviewImage( bm ); +} + + +void TextureChooser::setupConnections() +{ + connect( d_ptr->fileTextures, SIGNAL( currentRowChanged( int ) ), this, SLOT( onFileTxtRowChanged( int ) ) ); + connect( d_ptr->atlasTextures, SIGNAL( currentRowChanged( int ) ), this, SLOT( onAtlasTxtRowChanged( int ) ) ); +} + +void TextureChooser::setPreviewImage( NLMISC::CBitmap &bm ) +{ + // should be depth, but CBitmap always uses 32 bit to store the image + uint32 size = bm.getSize() * ( 32 / 8 ); + uint8 *data = new uint8[ size ]; + bm.getData( data ); + + /// Convert from ABGR to ARGB + { + int i = 0; + while( i < size ) + { + uint8 t = 0; + + /// ABGR + t = data[ i ]; + data[ i ] = data[ i + 2 ]; + data[ i + 2 ] = t; + + i += 4; + } + } + + QImage img( data, bm.getWidth(), bm.getHeight(), QImage::Format_ARGB32 ); + label->setPixmap( QPixmap::fromImage( img ) ); + + delete data; + data = NULL; +} + + + diff --git a/code/studio/src/plugins/gui_editor/texture_chooser.h b/code/studio/src/plugins/gui_editor/texture_chooser.h new file mode 100644 index 000000000..160b31481 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/texture_chooser.h @@ -0,0 +1,58 @@ +// Ryzom Core Studio GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 TEXTURE_CHOOSER_H +#define TEXTURE_CHOOSER_H + +#include "ui_texture_chooser.h" + +namespace NLMISC +{ + class CBitmap; +} + +struct TextureChooserPrivate; + +class TextureChooser : public QDialog, public Ui::TextureChooser +{ + Q_OBJECT + +public: + TextureChooser( QDialog *parent = NULL ); + ~TextureChooser(); + + void load(); + QString getSelection(){ return selection; } + +public Q_SLOTS: + void accept(); + void reject(); + +private Q_SLOTS: + void onFileTxtRowChanged( int row ); + void onAtlasTxtRowChanged( int row ); + +private: + void setupConnections(); + void setPreviewImage( NLMISC::CBitmap &bm ); + + QString selection; + + TextureChooserPrivate *d_ptr; +}; + +#endif + diff --git a/code/studio/src/plugins/gui_editor/texture_chooser.ui b/code/studio/src/plugins/gui_editor/texture_chooser.ui new file mode 100644 index 000000000..a0837ee83 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/texture_chooser.ui @@ -0,0 +1,122 @@ + + + TextureChooser + + + Qt::ApplicationModal + + + + 0 + 0 + 686 + 300 + + + + Texture Chooser + + + + + + + tab + + + + + + + + + 0 + 0 + + + + + 351 + 231 + + + + + + + + + + + 6 + + + 0 + + + + + Qt::Horizontal + + + + 131 + 31 + + + + + + + + OK + + + + + + + Cancel + + + + + + + + + + + okButton + clicked() + TextureChooser + accept() + + + 278 + 253 + + + 96 + 254 + + + + + cancelButton + clicked() + TextureChooser + reject() + + + 369 + 253 + + + 179 + 282 + + + + + diff --git a/code/studio/src/plugins/gui_editor/texture_property_manager.cpp b/code/studio/src/plugins/gui_editor/texture_property_manager.cpp new file mode 100644 index 000000000..6b40abc7f --- /dev/null +++ b/code/studio/src/plugins/gui_editor/texture_property_manager.cpp @@ -0,0 +1,333 @@ +// Ryzom Core Studio GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "texture_property_manager.h" +#include "texture_chooser.h" +#include +#include +#include +#include +#include + + +////////////////////////////////////////////////////////////////// Manager /////////////////////////////////////////////////////////////////////////// + + +struct TexturePropertyManagerPrivate +{ + QMap< const QtProperty*, QString > values; +}; + +TexturePropertyManager::TexturePropertyManager( QObject *parent ) : +QtAbstractPropertyManager( parent ) +{ + d_ptr = new TexturePropertyManagerPrivate(); +} + +TexturePropertyManager::~TexturePropertyManager() +{ + delete d_ptr; + d_ptr = NULL; +} + +QString TexturePropertyManager::value( const QtProperty *p ) const +{ + return valueText( p ); +} + +void TexturePropertyManager::setValue( QtProperty *p, const QString &value ) +{ + if( !d_ptr->values.contains( p ) ) + return; + + if( d_ptr->values[ p ] == value ) + return; + + d_ptr->values[ p ] = value; + + Q_EMIT propertyChanged( p ); + Q_EMIT valueChanged( p, value ); +} + +bool TexturePropertyManager::hasValue( const QtProperty *p ) const +{ + return d_ptr->values.contains( p ); +} + +QString TexturePropertyManager::valueText( const QtProperty *p ) const +{ + if( !d_ptr->values.contains( p ) ) + return ""; + + return d_ptr->values[ p ]; +} + +void TexturePropertyManager::initializeProperty( QtProperty *p ) +{ + if( d_ptr->values.contains( p ) ) + return; + + d_ptr->values[ p ] = ""; +} + +void TexturePropertyManager::uninitializeProperty( QtProperty *p ) +{ + d_ptr->values.remove( p ); +} + + + +//////////////////////////////////////////////////////////////////// Factory /////////////////////////////////////////////////////////////////////// + + + +struct TextureEditorFactoryPrivate +{ + QMap< QtProperty*, QList< TexturePropertyEditor* > > createdEditors; + QMap< TexturePropertyEditor*, QtProperty* > editorToProperty; + + ~TextureEditorFactoryPrivate() + { + createdEditors.clear(); + + QMap< TexturePropertyEditor*, QtProperty* >::iterator itr = editorToProperty.begin(); + while( itr != editorToProperty.end() ) + { + delete itr.key(); + ++itr; + } + editorToProperty.clear(); + } + + void addEditor( QtProperty *p, TexturePropertyEditor *editor ) + { + QMap< QtProperty*, QList< TexturePropertyEditor* > >::iterator itr = createdEditors.find( p ); + + if( itr != createdEditors.end() ) + { + itr->push_back( editor ); + } + else + { + QList< TexturePropertyEditor* > l; + l.push_back( editor ); + createdEditors.insert( p, l ); + } + + editorToProperty.insert( editor, p ); + } + + void removeEditor( QObject *o ) + { + // Remove from editorToProperty first + QMap< TexturePropertyEditor*, QtProperty* >::iterator itr1 = editorToProperty.begin(); + while( itr1 != editorToProperty.end() ) + { + if( itr1.key() == o ) + break; + + ++itr1; + } + if( itr1 != editorToProperty.end() ) + editorToProperty.erase( itr1 ); + + // Then from createdEditors + QMap< QtProperty*, QList< TexturePropertyEditor* > >::iterator itr2 = createdEditors.begin(); + while( itr2 != createdEditors.end() ) + { + QList< TexturePropertyEditor* > &l = *itr2; + QList< TexturePropertyEditor* >::iterator itr = l.begin(); + while( itr != l.end() ) + { + if( *itr == o ) + { + QList< TexturePropertyEditor* >::iterator d = itr; + ++itr; + l.erase( d ); + continue; + } + + ++itr; + } + + ++itr2; + } + } + +}; + +TextureEditorFactory::TextureEditorFactory( QObject *parent ) : +QtAbstractEditorFactory( parent ) +{ + d_ptr = new TextureEditorFactoryPrivate(); +} + +TextureEditorFactory::~TextureEditorFactory() +{ + delete d_ptr; + d_ptr = NULL; +} + +void TextureEditorFactory::connectPropertyManager( TexturePropertyManager *manager ) +{ + connect( manager, SIGNAL( valueChanged( QtProperty*, const QString& ) ), this, SLOT( onPropertyChanged( QtProperty*, const QString& ) ) ); +} + +void TextureEditorFactory::disconnectPropertyManager( TexturePropertyManager *manager ) +{ + disconnect( manager, SIGNAL( valueChanged( QtProperty*, const QString& ) ), this, SLOT( onPropertyChanged( QtProperty*, const QString& ) ) ); +} + +QWidget* TextureEditorFactory::createEditor( TexturePropertyManager *manager, QtProperty *p, QWidget *parent ) +{ + TexturePropertyEditor *editor = new TexturePropertyEditor( parent ); + editor->setValue( manager->value( p ) ); + + connect( editor, SIGNAL( valueChanged( const QString& ) ), this, SLOT( onSetValue( const QString& ) ) ); + connect( editor, SIGNAL( destroyed( QObject* ) ), this, SLOT( onEditorDestroyed( QObject* ) ) ); + + d_ptr->addEditor( p, editor ); + + return editor; +} + +void TextureEditorFactory::onPropertyChanged( QtProperty *p, const QString &value ) +{ + QMap< QtProperty*, QList< TexturePropertyEditor* > >::iterator itr = d_ptr->createdEditors.find( p ); + if( itr == d_ptr->createdEditors.end() ) + return; + + QList< TexturePropertyEditor* > &l = *itr; + QList< TexturePropertyEditor* >::iterator i = l.begin(); + while( i != l.end() ) + { + TexturePropertyEditor *editor = *i; + + editor->blockSignals( true ); + editor->setValue( value ); + editor->blockSignals( false ); + + ++i; + } +} + +void TextureEditorFactory::onSetValue( const QString &value ) +{ + QObject *s = sender(); + TexturePropertyEditor *editor = qobject_cast< TexturePropertyEditor* >( s ); + if( editor == NULL ) + return; + + QMap< TexturePropertyEditor*, QtProperty* >::iterator itr = d_ptr->editorToProperty.find( editor ); + if( itr == d_ptr->editorToProperty.end() ) + return; + + QtProperty *p = *itr; + + TexturePropertyManager *manager = qobject_cast< TexturePropertyManager* >( p->propertyManager() ); + if( manager == NULL ) + return; + + blockSignals( true ); + manager->setValue( p, value ); + blockSignals( false ); +} + +void TextureEditorFactory::onEditorDestroyed( QObject *editor ) +{ + d_ptr->removeEditor( editor ); +} + + + +//////////////////////////////////////////////////////////////////////// Editor ////////////////////////////////////////////////////////////////// + + + +TexturePropertyEditor::TexturePropertyEditor( QWidget *parent ) : +QWidget( parent ) +{ + setupUi(); + setupConnections(); +} + +TexturePropertyEditor::~TexturePropertyEditor() +{ +} + +void TexturePropertyEditor::setValue( const QString &value ) +{ + if( lineEdit->text() == value ) + return; + + disableConnections(); + lineEdit->setText( value ); + setupConnections(); +} + +void TexturePropertyEditor::showEvent( QShowEvent *e ) +{ + QWidget::showEvent( e ); +} + +void TexturePropertyEditor::onToolButtonClicked() +{ + TextureChooser d; + d.load(); + + int result = d.exec(); + if( QDialog::Accepted != result ) + return; + + lineEdit->setText( d.getSelection() ); +} + +void TexturePropertyEditor::onTextChanged( const QString &text ) +{ + Q_EMIT valueChanged( text ); +} + +void TexturePropertyEditor::setupConnections() +{ + connect( toolButton, SIGNAL( clicked( bool ) ), this, SLOT( onToolButtonClicked() ) ); + connect( lineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) ); +} + +void TexturePropertyEditor::disableConnections() +{ + disconnect( toolButton, SIGNAL( clicked( bool ) ), this, SLOT( onToolButtonClicked() ) ); + disconnect( lineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) ); +} + +void TexturePropertyEditor::setupUi() +{ + lineEdit = new QLineEdit(); + toolButton = new QToolButton(); + toolButton->setText( "..." ); + + QHBoxLayout *lt = new QHBoxLayout( this ); + lt->setContentsMargins( 0, 0, 0, 0 ); + lt->setSpacing( 0 ); + lt->addWidget( lineEdit ); + lt->addWidget( toolButton ); + + setFocusProxy( lineEdit ); + setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed ); + +} + + diff --git a/code/studio/src/plugins/gui_editor/texture_property_manager.h b/code/studio/src/plugins/gui_editor/texture_property_manager.h new file mode 100644 index 000000000..9b686ea04 --- /dev/null +++ b/code/studio/src/plugins/gui_editor/texture_property_manager.h @@ -0,0 +1,125 @@ +// Ryzom Core Studio GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 TEXTURE_PROPERTY_MANAGER +#define TEXTURE_PROPERTY_MANAGER + +#define QT_QTPROPERTYBROWSER_IMPORT + +#include "3rdparty/qtpropertybrowser/qtpropertybrowser.h" +#include + +/////////////////////////////////////////////////////// Manager /////////////////////////////////////////////////////////////////////////// + +struct TexturePropertyManagerPrivate; + +class TexturePropertyManager : public QtAbstractPropertyManager +{ + Q_OBJECT + +public: + TexturePropertyManager( QObject *parent = NULL ); + ~TexturePropertyManager(); + + QString value( const QtProperty *p ) const; + +public Q_SLOTS: + void setValue( QtProperty *p, const QString &value ); + +Q_SIGNALS: + void valueChanged( QtProperty *p, const QString &value ); + +protected: + bool hasValue( const QtProperty *p ) const; + QString valueText( const QtProperty *p ) const; + void initializeProperty( QtProperty *p ); + void uninitializeProperty( QtProperty *p ); + +private: + TexturePropertyManagerPrivate *d_ptr; + + Q_DISABLE_COPY( TexturePropertyManager ); +}; + + +////////////////////////////////////////////////////////////////// Factory ///////////////////////////////////////////////////////////////////////// + +struct TextureEditorFactoryPrivate; + +class TextureEditorFactory : public QtAbstractEditorFactory< TexturePropertyManager > +{ + Q_OBJECT + +public: + TextureEditorFactory( QObject *parent = NULL ); + ~TextureEditorFactory(); + +protected: + void connectPropertyManager( TexturePropertyManager *manager ); + void disconnectPropertyManager( TexturePropertyManager *manager ); + + QWidget* createEditor( TexturePropertyManager *manager, QtProperty *p, QWidget *parent ); + +private Q_SLOTS: + void onPropertyChanged( QtProperty *p, const QString &value ); + void onSetValue( const QString &value ); + void onEditorDestroyed( QObject *editor ); + +private: + TextureEditorFactoryPrivate *d_ptr; + + Q_DISABLE_COPY( TextureEditorFactory ); +}; + + +///////////////////////////////////////////////////////////////// Editor /////////////////////////////////////////////////////////////////////////// + +class QLineEdit; +class QToolButton; + +class TexturePropertyEditor : public QWidget +{ + Q_OBJECT +public: + TexturePropertyEditor( QWidget *parent = NULL ); + ~TexturePropertyEditor(); + +public Q_SLOTS: + void setValue( const QString &value ); + +protected: + void showEvent( QShowEvent *e ); + +private Q_SLOTS: + void onToolButtonClicked(); + void onTextChanged( const QString &text ); + +Q_SIGNALS: + void valueChanged( const QString &value ); + +private: + void setupUi(); + void setupConnections(); + void disableConnections(); + + + QLineEdit *lineEdit; + QToolButton *toolButton; +}; + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.cpp b/code/studio/src/plugins/gui_editor/widget_hierarchy.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.cpp rename to code/studio/src/plugins/gui_editor/widget_hierarchy.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.h b/code/studio/src/plugins/gui_editor/widget_hierarchy.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.h rename to code/studio/src/plugins/gui_editor/widget_hierarchy.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.ui b/code/studio/src/plugins/gui_editor/widget_hierarchy.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.ui rename to code/studio/src/plugins/gui_editor/widget_hierarchy.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info.h b/code/studio/src/plugins/gui_editor/widget_info.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info.h rename to code/studio/src/plugins/gui_editor/widget_info.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_serializer.cpp b/code/studio/src/plugins/gui_editor/widget_info_serializer.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_serializer.cpp rename to code/studio/src/plugins/gui_editor/widget_info_serializer.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_serializer.h b/code/studio/src/plugins/gui_editor/widget_info_serializer.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_serializer.h rename to code/studio/src/plugins/gui_editor/widget_info_serializer.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree.h b/code/studio/src/plugins/gui_editor/widget_info_tree.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree.h rename to code/studio/src/plugins/gui_editor/widget_info_tree.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree_node.h b/code/studio/src/plugins/gui_editor/widget_info_tree_node.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree_node.h rename to code/studio/src/plugins/gui_editor/widget_info_tree_node.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree_visitor.h b/code/studio/src/plugins/gui_editor/widget_info_tree_visitor.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree_visitor.h rename to code/studio/src/plugins/gui_editor/widget_info_tree_visitor.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties.cpp b/code/studio/src/plugins/gui_editor/widget_properties.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties.cpp rename to code/studio/src/plugins/gui_editor/widget_properties.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties.h b/code/studio/src/plugins/gui_editor/widget_properties.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties.h rename to code/studio/src/plugins/gui_editor/widget_properties.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties.ui b/code/studio/src/plugins/gui_editor/widget_properties.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties.ui rename to code/studio/src/plugins/gui_editor/widget_properties.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties_parser.cpp b/code/studio/src/plugins/gui_editor/widget_properties_parser.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties_parser.cpp rename to code/studio/src/plugins/gui_editor/widget_properties_parser.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties_parser.h b/code/studio/src/plugins/gui_editor/widget_properties_parser.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties_parser.h rename to code/studio/src/plugins/gui_editor/widget_properties_parser.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.cpp b/code/studio/src/plugins/gui_editor/widget_serializer.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.cpp rename to code/studio/src/plugins/gui_editor/widget_serializer.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.h b/code/studio/src/plugins/gui_editor/widget_serializer.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.h rename to code/studio/src/plugins/gui_editor/widget_serializer.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlBase.xml b/code/studio/src/plugins/gui_editor/widgets/CtrlBase.xml similarity index 74% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlBase.xml rename to code/studio/src/plugins/gui_editor/widgets/CtrlBase.xml index 5c334dea5..8ac372bdb 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlBase.xml +++ b/code/studio/src/plugins/gui_editor/widgets/CtrlBase.xml @@ -30,24 +30,34 @@ tooltip_parent - string + tooltip_parent tooltip_special_parent string - + tooltip_posref - string + posreftt auto - + + + tooltip_parent_posref + posreftt + auto + tooltip_posref_alt - string + posreftt auto - + + + tooltip_parent_posref_alt + posreftt + auto + instant_help bool diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlBaseButton.xml b/code/studio/src/plugins/gui_editor/widgets/CtrlBaseButton.xml similarity index 91% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlBaseButton.xml rename to code/studio/src/plugins/gui_editor/widgets/CtrlBaseButton.xml index 42e2bdef1..33f9f3a3f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlBaseButton.xml +++ b/code/studio/src/plugins/gui_editor/widgets/CtrlBaseButton.xml @@ -10,8 +10,8 @@ button_type - string - push_button + button_type + toggle_button pushed @@ -30,17 +30,17 @@ color - string + color 255 255 255 255 col_pushed - string + color 255 255 255 255 col_over - string + color 255 255 255 255 @@ -60,7 +60,7 @@ onover - string + action @@ -70,7 +70,7 @@ onclick_l - string + action @@ -80,7 +80,7 @@ ondblclick_l - string + action @@ -90,7 +90,7 @@ onclick_r - string + action @@ -100,7 +100,7 @@ onlongclick_l - string + action @@ -110,7 +110,7 @@ onclock_tick - string + action diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlButton.xml b/code/studio/src/plugins/gui_editor/widgets/CtrlButton.xml similarity index 83% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlButton.xml rename to code/studio/src/plugins/gui_editor/widgets/CtrlButton.xml index fb2514e7c..12b82e7f6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlButton.xml +++ b/code/studio/src/plugins/gui_editor/widgets/CtrlButton.xml @@ -2,7 +2,6 @@
CtrlButton CCtrlButton - button CtrlBaseButton false @@ -12,17 +11,17 @@ tx_normal string - log_but_r.tga + tx_pushed string - log_but_r.tga + tx_over string - log_but_over_r.tga + scale diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlColPick.xml b/code/studio/src/plugins/gui_editor/widgets/CtrlColPick.xml similarity index 96% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlColPick.xml rename to code/studio/src/plugins/gui_editor/widgets/CtrlColPick.xml index 6ac05fbcc..ea2ba6171 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlColPick.xml +++ b/code/studio/src/plugins/gui_editor/widgets/CtrlColPick.xml @@ -2,7 +2,6 @@
CtrlColPick CCtrlColPick - colpick CtrlBase false diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlScroll.xml b/code/studio/src/plugins/gui_editor/widgets/CtrlScroll.xml similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlScroll.xml rename to code/studio/src/plugins/gui_editor/widgets/CtrlScroll.xml index a5c8dae1e..1ad970f31 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlScroll.xml +++ b/code/studio/src/plugins/gui_editor/widgets/CtrlScroll.xml @@ -2,7 +2,6 @@
CtrlScroll CCtrlScroll - scroll CtrlBase false diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlTabButton.xml b/code/studio/src/plugins/gui_editor/widgets/CtrlTabButton.xml similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlTabButton.xml rename to code/studio/src/plugins/gui_editor/widgets/CtrlTabButton.xml diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlTextButton.xml b/code/studio/src/plugins/gui_editor/widgets/CtrlTextButton.xml similarity index 87% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlTextButton.xml rename to code/studio/src/plugins/gui_editor/widgets/CtrlTextButton.xml index cacc45ccb..ca66dbd62 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/CtrlTextButton.xml +++ b/code/studio/src/plugins/gui_editor/widgets/CtrlTextButton.xml @@ -2,7 +2,6 @@
CtrlTextButton CCtrlTextButton - text_button CtrlBaseButton false @@ -12,27 +11,27 @@ tx_normal string - but + tx_pushed string - but + tx_over string - but_over + hardtext string - text + wmargin int - 20 + 0 wmin @@ -53,40 +52,45 @@ text_underlined bool false - - + + text_posref - string - MM MM - + posref + MM + + + text_parent_posref + posref + MM + text_color_normal - string + color 255 255 255 255 text_color_pushed - string + color 255 255 255 255 text_color_over - string + color 255 255 255 255 text_shadow_color_normal - string + color 0 0 0 255 text_shadow_color_pushed - string + color 0 0 0 255 text_shadow_color_over - string + color 0 0 0 255 @@ -116,7 +120,7 @@ color - string + color 255 255 255 255 @@ -136,7 +140,7 @@ shadow_color - string + color 0 0 0 255 @@ -146,13 +150,13 @@ justification - string + text_justification dont_clip_word line_maxw int - 200 + 0 multi_line_space diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBGroupSelectNumber.xml b/code/studio/src/plugins/gui_editor/widgets/DBGroupSelectNumber.xml similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBGroupSelectNumber.xml rename to code/studio/src/plugins/gui_editor/widgets/DBGroupSelectNumber.xml index 63be51b5e..624ded887 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBGroupSelectNumber.xml +++ b/code/studio/src/plugins/gui_editor/widgets/DBGroupSelectNumber.xml @@ -2,7 +2,6 @@
DBGroupSelectNumber CDBGroupSelectNumber - select_number InterfaceGroup false diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewBar.xml b/code/studio/src/plugins/gui_editor/widgets/DBViewBar.xml similarity index 94% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewBar.xml rename to code/studio/src/plugins/gui_editor/widgets/DBViewBar.xml index c7f2e488c..c7f644fa4 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewBar.xml +++ b/code/studio/src/plugins/gui_editor/widgets/DBViewBar.xml @@ -2,7 +2,6 @@
DBViewBar CDBViewBar - bar ViewBitmap false @@ -26,7 +25,7 @@ color_negative - string + color 0 0 0 0 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewBar3.xml b/code/studio/src/plugins/gui_editor/widgets/DBViewBar3.xml similarity index 89% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewBar3.xml rename to code/studio/src/plugins/gui_editor/widgets/DBViewBar3.xml index 9b12a637a..8295c5f30 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewBar3.xml +++ b/code/studio/src/plugins/gui_editor/widgets/DBViewBar3.xml @@ -2,7 +2,6 @@
DBViewBar3 CDBViewBar3 - bar3 ViewBitmap false @@ -41,32 +40,32 @@ color1 - string + color 255 255 255 255 color2 - string + color 255 255 255 255 color3 - string + color 255 255 255 255 color1_negative - string + color 0 0 0 0 color2_negative - string + color 0 0 0 0 color3_negative - string + color 0 0 0 0 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewDigit.xml b/code/studio/src/plugins/gui_editor/widgets/DBViewDigit.xml similarity index 88% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewDigit.xml rename to code/studio/src/plugins/gui_editor/widgets/DBViewDigit.xml index 8a2a28831..0c12445f9 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewDigit.xml +++ b/code/studio/src/plugins/gui_editor/widgets/DBViewDigit.xml @@ -2,7 +2,6 @@
DBViewDigit CDBViewDigit - digit CtrlBase false @@ -12,7 +11,7 @@ value string - 0 + numdigit @@ -26,7 +25,7 @@ color - string + color 255 255 255 255 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewNumber.xml b/code/studio/src/plugins/gui_editor/widgets/DBViewNumber.xml similarity index 94% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewNumber.xml rename to code/studio/src/plugins/gui_editor/widgets/DBViewNumber.xml index 95a43025e..c1861df61 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewNumber.xml +++ b/code/studio/src/plugins/gui_editor/widgets/DBViewNumber.xml @@ -2,7 +2,6 @@
DBViewNumber CDBViewNumber - text_number ViewText false @@ -12,7 +11,7 @@ value string - 0 + positive diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewQuantity.xml b/code/studio/src/plugins/gui_editor/widgets/DBViewQuantity.xml similarity index 79% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewQuantity.xml rename to code/studio/src/plugins/gui_editor/widgets/DBViewQuantity.xml index 1b812bccf..c24379c96 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/DBViewQuantity.xml +++ b/code/studio/src/plugins/gui_editor/widgets/DBViewQuantity.xml @@ -2,7 +2,6 @@
DBViewQuantity CDBViewQuantity - text_quantity ViewText false @@ -12,17 +11,17 @@ value string - 0 + valuemax string - 100 + emptytext string - empty text + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupCell.xml b/code/studio/src/plugins/gui_editor/widgets/GroupCell.xml similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupCell.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupCell.xml index 8f8592771..ad0ae6e02 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupCell.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupCell.xml @@ -30,7 +30,7 @@ bgcolor - string + color 0 0 0 0 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupContainer.xml b/code/studio/src/plugins/gui_editor/widgets/GroupContainer.xml similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupContainer.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupContainer.xml index bdbf9931a..3d879a150 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupContainer.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupContainer.xml @@ -2,7 +2,6 @@
GroupContainer CGroupContainer - container InterfaceGroup false @@ -46,7 +45,7 @@ header_color - string + color 255 255 255 255 @@ -111,7 +110,7 @@ on_open - string + action @@ -121,7 +120,7 @@ on_close - string + action @@ -131,7 +130,7 @@ on_close_button - string + action @@ -141,7 +140,7 @@ on_move - string + action @@ -151,7 +150,7 @@ on_deactive_check - string + action @@ -161,7 +160,7 @@ on_resize - string + action @@ -171,7 +170,7 @@ on_alpha_settings_changed - string + action @@ -181,7 +180,7 @@ on_begin_move - string + action diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupEditBox.xml b/code/studio/src/plugins/gui_editor/widgets/GroupEditBox.xml similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupEditBox.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupEditBox.xml index 603af6c04..31ca205c7 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupEditBox.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupEditBox.xml @@ -2,7 +2,6 @@
GroupEditBox CGroupEditBox - edit_box InterfaceGroup false diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupFrame.xml b/code/studio/src/plugins/gui_editor/widgets/GroupFrame.xml similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupFrame.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupFrame.xml index f414e67e7..c7ac89fa2 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupFrame.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupFrame.xml @@ -15,7 +15,7 @@ color - string + color 255 255 255 255 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupHTML.xml b/code/studio/src/plugins/gui_editor/widgets/GroupHTML.xml similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupHTML.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupHTML.xml index b76fe4cd4..5f0521be8 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupHTML.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupHTML.xml @@ -2,7 +2,6 @@
GroupHTML CGroupHTML - html GroupScrollText false @@ -21,47 +20,47 @@ background_color - string + color 0 0 0 255 error_color - string + color 255 0 0 255 link_color - string + color 0 0 255 255 h1_color - string + color 255 255 255 255 h2_color - string + color 255 255 255 255 h3_color - string + color 255 255 255 255 h4_color - string + color 255 255 255 255 h5_color - string + color 255 255 255 255 h6_color - string + color 255 255 255 255 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupHeader.xml b/code/studio/src/plugins/gui_editor/widgets/GroupHeader.xml similarity index 91% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupHeader.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupHeader.xml index bcb517c66..cc96fd742 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupHeader.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupHeader.xml @@ -2,7 +2,6 @@
GroupHeader CGroupHeader - header GroupList false diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupList.xml b/code/studio/src/plugins/gui_editor/widgets/GroupList.xml similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupList.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupList.xml index 1858cd5b3..3ca2db95c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupList.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupList.xml @@ -2,7 +2,6 @@
GroupList CGroupList - list InterfaceGroup false @@ -41,7 +40,7 @@ col_over - string + color 255 255 255 32 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupMenu.xml b/code/studio/src/plugins/gui_editor/widgets/GroupMenu.xml similarity index 88% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupMenu.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupMenu.xml index 4739f0352..cdd42ba95 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupMenu.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupMenu.xml @@ -2,7 +2,6 @@
GroupMenu CGroupMenu - menu GroupModal false @@ -16,7 +15,7 @@ color - string + color 255 255 255 255 @@ -26,32 +25,32 @@ shadow_color - string + color 0 0 0 255 color_over - string + color 255 255 255 255 shadow_color_over - string + color 0 0 0 255 highlight_over - string + color 128 0 0 255 color_grayed - string + color 128 128 128 255 shadow_color_grayed - string + color 0 0 0 255 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupModal.xml b/code/studio/src/plugins/gui_editor/widgets/GroupModal.xml similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupModal.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupModal.xml index afc5005c8..034e3025e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupModal.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupModal.xml @@ -2,7 +2,6 @@
GroupModal CGroupModal - modal GroupFrame false diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupParagraph.xml b/code/studio/src/plugins/gui_editor/widgets/GroupParagraph.xml similarity index 97% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupParagraph.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupParagraph.xml index f05806757..e561e8c5f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupParagraph.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupParagraph.xml @@ -30,7 +30,7 @@ col_over - string + color 255 255 255 32 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupScrollText.xml b/code/studio/src/plugins/gui_editor/widgets/GroupScrollText.xml similarity index 91% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupScrollText.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupScrollText.xml index 8cefb8df2..95719398d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupScrollText.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupScrollText.xml @@ -2,7 +2,6 @@
GroupScrollText CGroupScrollText - scroll_text InterfaceGroup false diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupTab.xml b/code/studio/src/plugins/gui_editor/widgets/GroupTab.xml similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupTab.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupTab.xml index 69db79466..df148a0a3 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupTab.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupTab.xml @@ -2,7 +2,6 @@
GroupTab CGroupTab - tab InterfaceGroup false diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupTable.xml b/code/studio/src/plugins/gui_editor/widgets/GroupTable.xml similarity index 94% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupTable.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupTable.xml index 9c2240adc..9fa957741 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupTable.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupTable.xml @@ -2,7 +2,6 @@
GroupTable CGroupTable - table InterfaceGroup false @@ -26,7 +25,7 @@ bgcolor - string + color 0 0 0 255 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupTree.xml b/code/studio/src/plugins/gui_editor/widgets/GroupTree.xml similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupTree.xml rename to code/studio/src/plugins/gui_editor/widgets/GroupTree.xml index 6bd10ad9f..73b1dea3b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/GroupTree.xml +++ b/code/studio/src/plugins/gui_editor/widgets/GroupTree.xml @@ -2,7 +2,6 @@
GroupTree CGroupTree - tree InterfaceGroup false @@ -11,17 +10,17 @@ col_over - string + color 255 255 255 128 col_select - string + color 255 128 128 128 col_over_back - string + color 64 64 64 255 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceElement.xml b/code/studio/src/plugins/gui_editor/widgets/InterfaceElement.xml similarity index 88% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceElement.xml rename to code/studio/src/plugins/gui_editor/widgets/InterfaceElement.xml index 856480dc7..b16de9ed0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceElement.xml +++ b/code/studio/src/plugins/gui_editor/widgets/InterfaceElement.xml @@ -36,12 +36,17 @@ h int 0 - + posref - string - BL BL - + posref + BL + + + parentposref + posref + BL + sizeref string diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceGroup.xml b/code/studio/src/plugins/gui_editor/widgets/InterfaceGroup.xml similarity index 94% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceGroup.xml rename to code/studio/src/plugins/gui_editor/widgets/InterfaceGroup.xml index c9a8c1546..ddcdf01e6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceGroup.xml +++ b/code/studio/src/plugins/gui_editor/widgets/InterfaceGroup.xml @@ -2,7 +2,6 @@
InterfaceGroup CInterfaceGroup - interface_group CtrlBase false @@ -41,7 +40,7 @@ on_active - string + action @@ -51,7 +50,7 @@ on_deactive - string + action @@ -81,7 +80,7 @@ group_onclick_r - string + action @@ -91,7 +90,7 @@ group_onclick_l - string + action @@ -101,7 +100,7 @@ on_enter - string + action handler diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceGroupWheel.xml b/code/studio/src/plugins/gui_editor/widgets/InterfaceGroupWheel.xml similarity index 88% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceGroupWheel.xml rename to code/studio/src/plugins/gui_editor/widgets/InterfaceGroupWheel.xml index 51590ee33..b095ecac5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/InterfaceGroupWheel.xml +++ b/code/studio/src/plugins/gui_editor/widgets/InterfaceGroupWheel.xml @@ -2,7 +2,6 @@
InterfaceGroupWheel CInterfaceGroupWheel - group_wheel InterfaceGroup false @@ -11,7 +10,7 @@ on_wheel_up - string + action @@ -21,7 +20,7 @@ on_wheel_down - string + action diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/RootGroup.xml b/code/studio/src/plugins/gui_editor/widgets/RootGroup.xml similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/RootGroup.xml rename to code/studio/src/plugins/gui_editor/widgets/RootGroup.xml diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewBitmap.xml b/code/studio/src/plugins/gui_editor/widgets/ViewBitmap.xml similarity index 93% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewBitmap.xml rename to code/studio/src/plugins/gui_editor/widgets/ViewBitmap.xml index 8b931f78b..21ef7daff 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewBitmap.xml +++ b/code/studio/src/plugins/gui_editor/widgets/ViewBitmap.xml @@ -2,7 +2,6 @@
ViewBitmap CViewBitmap - bitmap CtrlBase false @@ -11,7 +10,7 @@ color - string + color 255 255 255 255 @@ -36,7 +35,7 @@ texture - string + texture @@ -61,7 +60,7 @@ align - string + bitmap_align diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewBitmapCombo.xml b/code/studio/src/plugins/gui_editor/widgets/ViewBitmapCombo.xml similarity index 87% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewBitmapCombo.xml rename to code/studio/src/plugins/gui_editor/widgets/ViewBitmapCombo.xml index 190143be5..8fc579675 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewBitmapCombo.xml +++ b/code/studio/src/plugins/gui_editor/widgets/ViewBitmapCombo.xml @@ -2,7 +2,6 @@
ViewBitmapCombo CViewBitmapCombo - bitmap_combo CtrlBase false @@ -26,17 +25,17 @@ col_normal - string + color col_over - string + color col_pushed - string + color diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewText.xml b/code/studio/src/plugins/gui_editor/widgets/ViewText.xml similarity index 93% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewText.xml rename to code/studio/src/plugins/gui_editor/widgets/ViewText.xml index 9490a1eee..415c3167e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewText.xml +++ b/code/studio/src/plugins/gui_editor/widgets/ViewText.xml @@ -2,7 +2,6 @@
ViewText CViewText - text InterfaceElement false @@ -11,7 +10,7 @@ color - string + color 255 255 255 255 @@ -31,7 +30,7 @@ shadow_color - string + color 0 0 0 255 @@ -41,13 +40,13 @@ justification - string + text_justification dont_clip_word line_maxw int - 100 + 0 multi_line_space @@ -102,7 +101,7 @@ hardtext string - some text + hardtext_format diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewTextFormated.xml b/code/studio/src/plugins/gui_editor/widgets/ViewTextFormated.xml similarity index 90% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewTextFormated.xml rename to code/studio/src/plugins/gui_editor/widgets/ViewTextFormated.xml index c5749ca9c..cabd081f0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewTextFormated.xml +++ b/code/studio/src/plugins/gui_editor/widgets/ViewTextFormated.xml @@ -2,7 +2,6 @@
ViewTextFormated CViewTextFormated - text_formated ViewText false diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewTextID.xml b/code/studio/src/plugins/gui_editor/widgets/ViewTextID.xml similarity index 94% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewTextID.xml rename to code/studio/src/plugins/gui_editor/widgets/ViewTextID.xml index b3edc86ab..52e010ec6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewTextID.xml +++ b/code/studio/src/plugins/gui_editor/widgets/ViewTextID.xml @@ -2,7 +2,6 @@
ViewTextID CViewTextID - text_id ViewText false diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewTextIDFormated.xml b/code/studio/src/plugins/gui_editor/widgets/ViewTextIDFormated.xml similarity index 90% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewTextIDFormated.xml rename to code/studio/src/plugins/gui_editor/widgets/ViewTextIDFormated.xml index 3ac6c7962..af8dd54eb 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widgets/ViewTextIDFormated.xml +++ b/code/studio/src/plugins/gui_editor/widgets/ViewTextIDFormated.xml @@ -2,7 +2,6 @@
ViewTextIDFormated CViewTextIDFormated - text_id_formated ViewTextID false diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/CMakeLists.txt b/code/studio/src/plugins/landscape_editor/CMakeLists.txt similarity index 63% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/CMakeLists.txt rename to code/studio/src/plugins/landscape_editor/CMakeLists.txt index 129f672c5..448d86a48 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/CMakeLists.txt +++ b/code/studio/src/plugins/landscape_editor/CMakeLists.txt @@ -41,17 +41,17 @@ SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC} SOURCE_GROUP("Landscape Editor Plugin" FILES ${SRC}) SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) -ADD_LIBRARY(ovqt_plugin_landscape_editor SHARED ${SRC} +ADD_LIBRARY(studio_plugin_landscape_editor SHARED ${SRC} ${OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS} ${OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS}) -TARGET_LINK_LIBRARIES(ovqt_plugin_landscape_editor ovqt_plugin_core nelmisc nel3d nelgeorges nelligo ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) +TARGET_LINK_LIBRARIES(studio_plugin_landscape_editor studio_plugin_core nelmisc nel3d nelgeorges nelligo ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) -NL_DEFAULT_PROPS(ovqt_plugin_landscape_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Landscape Editor") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_landscape_editor) -NL_ADD_LIB_SUFFIX(ovqt_plugin_landscape_editor) +NL_DEFAULT_PROPS(studio_plugin_landscape_editor "Tools: Studio Plugin: Landscape Editor") +NL_ADD_RUNTIME_FLAGS(studio_plugin_landscape_editor) +NL_ADD_LIB_SUFFIX(studio_plugin_landscape_editor) ADD_DEFINITIONS(-DLANDSCAPE_EDITOR_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) @@ -59,16 +59,16 @@ ADD_DEFINITIONS(-DLANDSCAPE_EDITOR_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -D IF(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ELSE(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_landscape_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ENDIF(WIN32) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_landscape_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_landscape_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp b/code/studio/src/plugins/landscape_editor/builder_zone.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.cpp rename to code/studio/src/plugins/landscape_editor/builder_zone.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.h b/code/studio/src/plugins/landscape_editor/builder_zone.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone.h rename to code/studio/src/plugins/landscape_editor/builder_zone.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_base.cpp b/code/studio/src/plugins/landscape_editor/builder_zone_base.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_base.cpp rename to code/studio/src/plugins/landscape_editor/builder_zone_base.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_base.h b/code/studio/src/plugins/landscape_editor/builder_zone_base.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_base.h rename to code/studio/src/plugins/landscape_editor/builder_zone_base.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_region.cpp b/code/studio/src/plugins/landscape_editor/builder_zone_region.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_region.cpp rename to code/studio/src/plugins/landscape_editor/builder_zone_region.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_region.h b/code/studio/src/plugins/landscape_editor/builder_zone_region.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/builder_zone_region.h rename to code/studio/src/plugins/landscape_editor/builder_zone_region.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_grid.png b/code/studio/src/plugins/landscape_editor/icons/ic_grid.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_grid.png rename to code/studio/src/plugins/landscape_editor/icons/ic_grid.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_landscape_item.png b/code/studio/src/plugins/landscape_editor/icons/ic_nel_landscape_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_landscape_item.png rename to code/studio/src/plugins/landscape_editor/icons/ic_nel_landscape_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_landscape_settings.png b/code/studio/src/plugins/landscape_editor/icons/ic_nel_landscape_settings.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_landscape_settings.png rename to code/studio/src/plugins/landscape_editor/icons/ic_nel_landscape_settings.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_transition_land.png b/code/studio/src/plugins/landscape_editor/icons/ic_nel_transition_land.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_transition_land.png rename to code/studio/src/plugins/landscape_editor/icons/ic_nel_transition_land.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_world_editor.png b/code/studio/src/plugins/landscape_editor/icons/ic_nel_world_editor.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_world_editor.png rename to code/studio/src/plugins/landscape_editor/icons/ic_nel_world_editor.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_zone.png b/code/studio/src/plugins/landscape_editor/icons/ic_nel_zone.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_zone.png rename to code/studio/src/plugins/landscape_editor/icons/ic_nel_zone.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_zonel.png b/code/studio/src/plugins/landscape_editor/icons/ic_nel_zonel.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_zonel.png rename to code/studio/src/plugins/landscape_editor/icons/ic_nel_zonel.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_zones.png b/code/studio/src/plugins/landscape_editor/icons/ic_nel_zones.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_nel_zones.png rename to code/studio/src/plugins/landscape_editor/icons/ic_nel_zones.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_snapshot.png b/code/studio/src/plugins/landscape_editor/icons/ic_snapshot.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/icons/ic_snapshot.png rename to code/studio/src/plugins/landscape_editor/icons/ic_snapshot.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_actions.cpp b/code/studio/src/plugins/landscape_editor/landscape_actions.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_actions.cpp rename to code/studio/src/plugins/landscape_editor/landscape_actions.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_actions.h b/code/studio/src/plugins/landscape_editor/landscape_actions.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_actions.h rename to code/studio/src/plugins/landscape_editor/landscape_actions.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor.qrc b/code/studio/src/plugins/landscape_editor/landscape_editor.qrc similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor.qrc rename to code/studio/src/plugins/landscape_editor/landscape_editor.qrc diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_constants.h b/code/studio/src/plugins/landscape_editor/landscape_editor_constants.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_constants.h rename to code/studio/src/plugins/landscape_editor/landscape_editor_constants.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_global.h b/code/studio/src/plugins/landscape_editor/landscape_editor_global.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_global.h rename to code/studio/src/plugins/landscape_editor/landscape_editor_global.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_plugin.cpp b/code/studio/src/plugins/landscape_editor/landscape_editor_plugin.cpp similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_plugin.cpp rename to code/studio/src/plugins/landscape_editor/landscape_editor_plugin.cpp index 73a6f5b25..f97aff691 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_plugin.cpp +++ b/code/studio/src/plugins/landscape_editor/landscape_editor_plugin.cpp @@ -39,6 +39,9 @@ LandscapeEditorPlugin::~LandscapeEditorPlugin() } qDeleteAll(m_autoReleaseObjects); m_autoReleaseObjects.clear(); + + delete m_libContext; + m_libContext = NULL; } bool LandscapeEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_plugin.h b/code/studio/src/plugins/landscape_editor/landscape_editor_plugin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_plugin.h rename to code/studio/src/plugins/landscape_editor/landscape_editor_plugin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp b/code/studio/src/plugins/landscape_editor/landscape_editor_window.cpp similarity index 99% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp rename to code/studio/src/plugins/landscape_editor/landscape_editor_window.cpp index bbc996b94..aeca41906 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.cpp +++ b/code/studio/src/plugins/landscape_editor/landscape_editor_window.cpp @@ -104,6 +104,10 @@ LandscapeEditorWindow::~LandscapeEditorWindow() { writeSettings(); delete m_zoneBuilder; + + Core::ICore::instance()->mainWindow()->statusBar()->removeWidget( m_statusInfo ); + delete m_statusInfo; + m_statusInfo = NULL; } QUndoStack *LandscapeEditorWindow::undoStack() const diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.h b/code/studio/src/plugins/landscape_editor/landscape_editor_window.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.h rename to code/studio/src/plugins/landscape_editor/landscape_editor_window.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.ui b/code/studio/src/plugins/landscape_editor/landscape_editor_window.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_editor_window.ui rename to code/studio/src/plugins/landscape_editor/landscape_editor_window.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_scene.cpp b/code/studio/src/plugins/landscape_editor/landscape_scene.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_scene.cpp rename to code/studio/src/plugins/landscape_editor/landscape_scene.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_scene.h b/code/studio/src/plugins/landscape_editor/landscape_scene.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_scene.h rename to code/studio/src/plugins/landscape_editor/landscape_scene.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_scene_base.cpp b/code/studio/src/plugins/landscape_editor/landscape_scene_base.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_scene_base.cpp rename to code/studio/src/plugins/landscape_editor/landscape_scene_base.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_scene_base.h b/code/studio/src/plugins/landscape_editor/landscape_scene_base.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_scene_base.h rename to code/studio/src/plugins/landscape_editor/landscape_scene_base.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_view.cpp b/code/studio/src/plugins/landscape_editor/landscape_view.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_view.cpp rename to code/studio/src/plugins/landscape_editor/landscape_view.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_view.h b/code/studio/src/plugins/landscape_editor/landscape_view.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/landscape_view.h rename to code/studio/src/plugins/landscape_editor/landscape_view.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp b/code/studio/src/plugins/landscape_editor/list_zones_model.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.cpp rename to code/studio/src/plugins/landscape_editor/list_zones_model.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.h b/code/studio/src/plugins/landscape_editor/list_zones_model.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_model.h rename to code/studio/src/plugins/landscape_editor/list_zones_model.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp b/code/studio/src/plugins/landscape_editor/list_zones_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.cpp rename to code/studio/src/plugins/landscape_editor/list_zones_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.h b/code/studio/src/plugins/landscape_editor/list_zones_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.h rename to code/studio/src/plugins/landscape_editor/list_zones_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.ui b/code/studio/src/plugins/landscape_editor/list_zones_widget.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/list_zones_widget.ui rename to code/studio/src/plugins/landscape_editor/list_zones_widget.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/pixmap_database.cpp b/code/studio/src/plugins/landscape_editor/pixmap_database.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/pixmap_database.cpp rename to code/studio/src/plugins/landscape_editor/pixmap_database.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/pixmap_database.h b/code/studio/src/plugins/landscape_editor/pixmap_database.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/pixmap_database.h rename to code/studio/src/plugins/landscape_editor/pixmap_database.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/project_settings_dialog.cpp b/code/studio/src/plugins/landscape_editor/project_settings_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/project_settings_dialog.cpp rename to code/studio/src/plugins/landscape_editor/project_settings_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/project_settings_dialog.h b/code/studio/src/plugins/landscape_editor/project_settings_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/project_settings_dialog.h rename to code/studio/src/plugins/landscape_editor/project_settings_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/project_settings_dialog.ui b/code/studio/src/plugins/landscape_editor/project_settings_dialog.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/project_settings_dialog.ui rename to code/studio/src/plugins/landscape_editor/project_settings_dialog.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/shapshot_dialog.ui b/code/studio/src/plugins/landscape_editor/shapshot_dialog.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/shapshot_dialog.ui rename to code/studio/src/plugins/landscape_editor/shapshot_dialog.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/snapshot_dialog.cpp b/code/studio/src/plugins/landscape_editor/snapshot_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/snapshot_dialog.cpp rename to code/studio/src/plugins/landscape_editor/snapshot_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/snapshot_dialog.h b/code/studio/src/plugins/landscape_editor/snapshot_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/snapshot_dialog.h rename to code/studio/src/plugins/landscape_editor/snapshot_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/ovqt_plugin_landscape_editor.xml b/code/studio/src/plugins/landscape_editor/studio_plugin_landscape_editor.xml similarity index 77% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/ovqt_plugin_landscape_editor.xml rename to code/studio/src/plugins/landscape_editor/studio_plugin_landscape_editor.xml index a0d32a22a..53dac537b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/ovqt_plugin_landscape_editor.xml +++ b/code/studio/src/plugins/landscape_editor/studio_plugin_landscape_editor.xml @@ -1,5 +1,5 @@ - ovqt_plugin_landscape_editor + studio_plugin_landscape_editor LandscapeEditor 0.8 GSoC2011_dnk-88 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_region_editor.cpp b/code/studio/src/plugins/landscape_editor/zone_region_editor.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_region_editor.cpp rename to code/studio/src/plugins/landscape_editor/zone_region_editor.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_region_editor.h b/code/studio/src/plugins/landscape_editor/zone_region_editor.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/landscape_editor/zone_region_editor.h rename to code/studio/src/plugins/landscape_editor/zone_region_editor.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/CMakeLists.txt b/code/studio/src/plugins/log/CMakeLists.txt similarity index 55% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/log/CMakeLists.txt rename to code/studio/src/plugins/log/CMakeLists.txt index 4cee3da24..7a27f370a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/CMakeLists.txt +++ b/code/studio/src/plugins/log/CMakeLists.txt @@ -26,30 +26,30 @@ SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_LOG_MOC_SRC}) SOURCE_GROUP("Log Plugin" FILES ${SRC}) SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) -ADD_LIBRARY(ovqt_plugin_log MODULE ${SRC} ${OVQT_PLUG_LOG_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_LOG_UI_HDRS}) +ADD_LIBRARY(studio_plugin_log MODULE ${SRC} ${OVQT_PLUG_LOG_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_LOG_UI_HDRS}) -TARGET_LINK_LIBRARIES(ovqt_plugin_log ovqt_plugin_core nelmisc ${QT_LIBRARIES}) +TARGET_LINK_LIBRARIES(studio_plugin_log studio_plugin_core nelmisc ${QT_LIBRARIES}) -NL_DEFAULT_PROPS(ovqt_plugin_log "NeL, Tools, 3D: Object Viewer Qt Plugin: Log") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_log) -NL_ADD_LIB_SUFFIX(ovqt_plugin_log) +NL_DEFAULT_PROPS(studio_plugin_log "Tools: Studio Plugin: Log") +NL_ADD_RUNTIME_FLAGS(studio_plugin_log) +NL_ADD_LIB_SUFFIX(studio_plugin_log) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) IF(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ELSE(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_log LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ENDIF(WIN32) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_log.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_log.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_form.ui b/code/studio/src/plugins/log/log_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_form.ui rename to code/studio/src/plugins/log/log_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp b/code/studio/src/plugins/log/log_plugin.cpp similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp rename to code/studio/src/plugins/log/log_plugin.cpp index 0f86ab90c..11da182a0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp +++ b/code/studio/src/plugins/log/log_plugin.cpp @@ -45,6 +45,7 @@ namespace Plugin CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent) { m_ui.setupUi(this); + logMenu = NULL; } CLogPlugin::~CLogPlugin() @@ -62,6 +63,12 @@ namespace Plugin NLMISC::AssertLog->removeDisplayer(m_displayer); NLMISC::InfoLog->removeDisplayer(m_displayer); delete m_displayer; + + delete logMenu; + logMenu = NULL; + + delete m_libContext; + m_libContext = NULL; } bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) @@ -79,13 +86,15 @@ namespace Plugin Core::ICore *core = Core::ICore::instance(); Core::MenuManager *menuManager = core->menuManager(); - QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW); QMainWindow *wnd = Core::ICore::instance()->mainWindow(); wnd->addDockWidget(Qt::RightDockWidgetArea, this); hide(); - viewMenu->addAction(this->toggleViewAction()); + logMenu = menuManager->menuBar()->addMenu( "Log" ); + QAction *a = toggleViewAction(); + a->setText( tr( "View log" ) ); + logMenu->addAction( a ); } void CLogPlugin::setNelContext(NLMISC::INelContext *nelContext) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h b/code/studio/src/plugins/log/log_plugin.h similarity index 99% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h rename to code/studio/src/plugins/log/log_plugin.h index 2221195a8..9e4f64419 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h +++ b/code/studio/src/plugins/log/log_plugin.h @@ -85,6 +85,8 @@ namespace Plugin NLQT::CQtDisplayer *m_displayer; + QMenu *logMenu; + }; } // namespace Plugin diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp b/code/studio/src/plugins/log/log_settings_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp rename to code/studio/src/plugins/log/log_settings_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.h b/code/studio/src/plugins/log/log_settings_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.h rename to code/studio/src/plugins/log/log_settings_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.ui b/code/studio/src/plugins/log/log_settings_page.ui similarity index 94% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.ui rename to code/studio/src/plugins/log/log_settings_page.ui index 92faef8b6..09ead5c17 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.ui +++ b/code/studio/src/plugins/log/log_settings_page.ui @@ -89,7 +89,7 @@ - + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/qt_displayer.cpp b/code/studio/src/plugins/log/qt_displayer.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/log/qt_displayer.cpp rename to code/studio/src/plugins/log/qt_displayer.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/qt_displayer.h b/code/studio/src/plugins/log/qt_displayer.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/log/qt_displayer.h rename to code/studio/src/plugins/log/qt_displayer.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/ovqt_plugin_log.xml b/code/studio/src/plugins/log/studio_plugin_log.xml similarity index 80% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/log/ovqt_plugin_log.xml rename to code/studio/src/plugins/log/studio_plugin_log.xml index 90b1b1e27..48d97bd87 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/ovqt_plugin_log.xml +++ b/code/studio/src/plugins/log/studio_plugin_log.xml @@ -1,5 +1,5 @@ - ovqt_plugin_log + studio_plugin_log LogPlugin 1.1 aquiles diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/CMakeLists.txt b/code/studio/src/plugins/mission_compiler/CMakeLists.txt similarity index 59% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/CMakeLists.txt rename to code/studio/src/plugins/mission_compiler/CMakeLists.txt index 1dcbebfa8..cbf35b9c7 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/CMakeLists.txt +++ b/code/studio/src/plugins/mission_compiler/CMakeLists.txt @@ -36,13 +36,13 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/ryzom/tools/leveldesign/mission_compiler # Game Share Library INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/src) -ADD_LIBRARY(ovqt_plugin_mission_compiler MODULE ${SRC} ${OVQT_PLUG_MISSION_COMPILER_MOC_SRC} ${OVQT_PLUG_MISSION_COMPILER_RC_SRCS} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_MISSION_COMPILER_UI_HDRS}) +ADD_LIBRARY(studio_plugin_mission_compiler MODULE ${SRC} ${OVQT_PLUG_MISSION_COMPILER_MOC_SRC} ${OVQT_PLUG_MISSION_COMPILER_RC_SRCS} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_MISSION_COMPILER_UI_HDRS}) -TARGET_LINK_LIBRARIES(ovqt_plugin_mission_compiler ovqt_plugin_core nelmisc nelligo ryzom_mission_compiler_lib ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) +TARGET_LINK_LIBRARIES(studio_plugin_mission_compiler studio_plugin_core nelmisc nelligo ryzom_mission_compiler_lib ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) -NL_DEFAULT_PROPS(ovqt_plugin_mission_compiler "NeL, Tools, 3D: Object Viewer Qt Plugin: Mission Compiler") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_mission_compiler) -NL_ADD_LIB_SUFFIX(ovqt_plugin_mission_compiler) +NL_DEFAULT_PROPS(studio_plugin_mission_compiler "Tools: Studio Plugin: Mission Compiler") +NL_ADD_RUNTIME_FLAGS(studio_plugin_mission_compiler) +NL_ADD_LIB_SUFFIX(studio_plugin_mission_compiler) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) @@ -50,17 +50,17 @@ ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS} IF(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ELSE(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_mission_compiler LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ENDIF(WIN32) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_mission_compiler.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_mission_compiler.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/arrow-left-2.png b/code/studio/src/plugins/mission_compiler/images/arrow-left-2.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/arrow-left-2.png rename to code/studio/src/plugins/mission_compiler/images/arrow-left-2.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/arrow-left-double-2.png b/code/studio/src/plugins/mission_compiler/images/arrow-left-double-2.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/arrow-left-double-2.png rename to code/studio/src/plugins/mission_compiler/images/arrow-left-double-2.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/arrow-right-2.png b/code/studio/src/plugins/mission_compiler/images/arrow-right-2.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/arrow-right-2.png rename to code/studio/src/plugins/mission_compiler/images/arrow-right-2.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/arrow-right-double-2.png b/code/studio/src/plugins/mission_compiler/images/arrow-right-double-2.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/arrow-right-double-2.png rename to code/studio/src/plugins/mission_compiler/images/arrow-right-double-2.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/document-export-4.png b/code/studio/src/plugins/mission_compiler/images/document-export-4.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/document-export-4.png rename to code/studio/src/plugins/mission_compiler/images/document-export-4.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/ic_nel_add_item.png b/code/studio/src/plugins/mission_compiler/images/ic_nel_add_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/ic_nel_add_item.png rename to code/studio/src/plugins/mission_compiler/images/ic_nel_add_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/ic_nel_delete_item.png b/code/studio/src/plugins/mission_compiler/images/ic_nel_delete_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/ic_nel_delete_item.png rename to code/studio/src/plugins/mission_compiler/images/ic_nel_delete_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/ic_nel_down_item.png b/code/studio/src/plugins/mission_compiler/images/ic_nel_down_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/ic_nel_down_item.png rename to code/studio/src/plugins/mission_compiler/images/ic_nel_down_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/ic_nel_generic_settings.png b/code/studio/src/plugins/mission_compiler/images/ic_nel_generic_settings.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/ic_nel_generic_settings.png rename to code/studio/src/plugins/mission_compiler/images/ic_nel_generic_settings.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/ic_nel_reset_all.png b/code/studio/src/plugins/mission_compiler/images/ic_nel_reset_all.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/ic_nel_reset_all.png rename to code/studio/src/plugins/mission_compiler/images/ic_nel_reset_all.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/ic_nel_up_item.png b/code/studio/src/plugins/mission_compiler/images/ic_nel_up_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/ic_nel_up_item.png rename to code/studio/src/plugins/mission_compiler/images/ic_nel_up_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/news-subscribe-2.png b/code/studio/src/plugins/mission_compiler/images/news-subscribe-2.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/news-subscribe-2.png rename to code/studio/src/plugins/mission_compiler/images/news-subscribe-2.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/run-build-2.png b/code/studio/src/plugins/mission_compiler/images/run-build-2.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/images/run-build-2.png rename to code/studio/src/plugins/mission_compiler/images/run-build-2.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler.qrc b/code/studio/src/plugins/mission_compiler/mission_compiler.qrc similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler.qrc rename to code/studio/src/plugins/mission_compiler/mission_compiler.qrc diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp rename to code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp index e01f5f617..10985aa38 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.cpp +++ b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.cpp @@ -90,7 +90,14 @@ MissionCompilerMainWindow::MissionCompilerMainWindow(QWidget *parent) : NLLIGO::Register(); // TODO try/catch exception. Crashes if path invalid. - m_ligoConfig.readPrimitiveClass(NLMISC::CPath::lookup("world_editor_classes.xml").c_str(), false); + try{ + m_ligoConfig.readPrimitiveClass(NLMISC::CPath::lookup("world_editor_classes.xml").c_str(), false); + } + catch( NLMISC::Exception &e ) + { + nlinfo( "Exception occured during Mission Compiler LIGO startup: %s", e.what() ); + } + NLLIGO::CPrimitiveContext::instance().CurrentLigoConfig = &m_ligoConfig; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.h b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.h rename to code/studio/src/plugins/mission_compiler/mission_compiler_main_window.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.ui b/code/studio/src/plugins/mission_compiler/mission_compiler_main_window.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_main_window.ui rename to code/studio/src/plugins/mission_compiler/mission_compiler_main_window.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_plugin.cpp b/code/studio/src/plugins/mission_compiler/mission_compiler_plugin.cpp similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_plugin.cpp rename to code/studio/src/plugins/mission_compiler/mission_compiler_plugin.cpp index 98b188fd3..46e51f36d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_plugin.cpp +++ b/code/studio/src/plugins/mission_compiler/mission_compiler_plugin.cpp @@ -30,6 +30,9 @@ MissionCompilerPlugin::~MissionCompilerPlugin() } qDeleteAll(m_autoReleaseObjects); m_autoReleaseObjects.clear(); + + delete m_LibContext; + m_LibContext = NULL; } bool MissionCompilerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_plugin.h b/code/studio/src/plugins/mission_compiler/mission_compiler_plugin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_plugin.h rename to code/studio/src/plugins/mission_compiler/mission_compiler_plugin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_plugin_constants.h b/code/studio/src/plugins/mission_compiler/mission_compiler_plugin_constants.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_plugin_constants.h rename to code/studio/src/plugins/mission_compiler/mission_compiler_plugin_constants.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_settings_page.cpp b/code/studio/src/plugins/mission_compiler/mission_compiler_settings_page.cpp similarity index 97% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_settings_page.cpp rename to code/studio/src/plugins/mission_compiler/mission_compiler_settings_page.cpp index ad115cffd..28dc4f9ce 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_settings_page.cpp +++ b/code/studio/src/plugins/mission_compiler/mission_compiler_settings_page.cpp @@ -191,7 +191,9 @@ void MissionCompilerSettingsPage::writeSettings() { for(int column = 0; column < m_ui.serversTableWidget->columnCount(); column++) { - items << m_ui.serversTableWidget->item(row, column)->text(); + QTableWidgetItem *item = m_ui.serversTableWidget->item(row, column); + if( item != NULL ) + items << item->text(); } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_settings_page.h b/code/studio/src/plugins/mission_compiler/mission_compiler_settings_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_settings_page.h rename to code/studio/src/plugins/mission_compiler/mission_compiler_settings_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_settings_page.ui b/code/studio/src/plugins/mission_compiler/mission_compiler_settings_page.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/mission_compiler_settings_page.ui rename to code/studio/src/plugins/mission_compiler/mission_compiler_settings_page.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.cpp b/code/studio/src/plugins/mission_compiler/server_entry_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.cpp rename to code/studio/src/plugins/mission_compiler/server_entry_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.h b/code/studio/src/plugins/mission_compiler/server_entry_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.h rename to code/studio/src/plugins/mission_compiler/server_entry_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.ui b/code/studio/src/plugins/mission_compiler/server_entry_dialog.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/server_entry_dialog.ui rename to code/studio/src/plugins/mission_compiler/server_entry_dialog.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/ovqt_plugin_mission_compiler.xml b/code/studio/src/plugins/mission_compiler/studio_plugin_mission_compiler.xml similarity index 76% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/ovqt_plugin_mission_compiler.xml rename to code/studio/src/plugins/mission_compiler/studio_plugin_mission_compiler.xml index 072707e07..85bdca66f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/ovqt_plugin_mission_compiler.xml +++ b/code/studio/src/plugins/mission_compiler/studio_plugin_mission_compiler.xml @@ -1,5 +1,5 @@ - ovqt_plugin_mission_compiler + studio_plugin_mission_compiler MissionCompiler 0.1 Ryzom Core diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/validation_file.cpp b/code/studio/src/plugins/mission_compiler/validation_file.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/validation_file.cpp rename to code/studio/src/plugins/mission_compiler/validation_file.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/validation_file.h b/code/studio/src/plugins/mission_compiler/validation_file.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/mission_compiler/validation_file.h rename to code/studio/src/plugins/mission_compiler/validation_file.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/CMakeLists.txt b/code/studio/src/plugins/object_viewer/CMakeLists.txt similarity index 85% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/CMakeLists.txt rename to code/studio/src/plugins/object_viewer/CMakeLists.txt index b550e8ea0..3a4ce9c65 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/CMakeLists.txt +++ b/code/studio/src/plugins/object_viewer/CMakeLists.txt @@ -165,7 +165,7 @@ SOURCE_GROUP("ovqt Plugin PS Src" FILES ${OVQT_PS_SRC}) SOURCE_GROUP("ovqt Plugin Vegetable Src" FILES ${OVQT_VEGETABLE_SRC}) SOURCE_GROUP("ovqt Plugin Widgets Src" FILES ${OVQT_WIDGETS_SRC}) -ADD_LIBRARY(ovqt_plugin_object_viewer MODULE ${SRC} +ADD_LIBRARY(studio_plugin_object_viewer MODULE ${SRC} ${OVQT_SCENE_SRC} ${OVQT_PS_SRC} ${OVQT_VEGETABLE_SRC} @@ -175,8 +175,8 @@ ADD_LIBRARY(ovqt_plugin_object_viewer MODULE ${SRC} ${OBJECT_VIEWER_PLUGIN_UI_HDRS} ${OBJECT_VIEWER_PLUGIN_RC_SRCS}) -TARGET_LINK_LIBRARIES(ovqt_plugin_object_viewer - ovqt_plugin_core +TARGET_LINK_LIBRARIES(studio_plugin_object_viewer + studio_plugin_core nelmisc nel3d nelsound @@ -185,32 +185,32 @@ TARGET_LINK_LIBRARIES(ovqt_plugin_object_viewer ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) -NL_DEFAULT_PROPS(ovqt_plugin_object_viewer "NeL, Tools, 3D: Object Viewer Qt Plugin: Object Viewer") +NL_DEFAULT_PROPS(studio_plugin_object_viewer "Tools: Studio Plugin: Object Viewer") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_object_viewer) -NL_ADD_LIB_SUFFIX(ovqt_plugin_object_viewer) +NL_ADD_RUNTIME_FLAGS(studio_plugin_object_viewer) +NL_ADD_LIB_SUFFIX(studio_plugin_object_viewer) ADD_DEFINITIONS(-DQT_NO_KEYWORDS ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) IF(WITH_PCH) - ADD_NATIVE_PRECOMPILED_HEADER(ovqt_plugin_object_viewer ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) + ADD_NATIVE_PRECOMPILED_HEADER(studio_plugin_object_viewer ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.h ${CMAKE_CURRENT_SOURCE_DIR}/stdpch.cpp) ENDIF(WITH_PCH) IF(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ELSE(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_object_viewer LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ENDIF(WIN32) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_object_viewer.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_object_viewer.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.cpp b/code/studio/src/plugins/object_viewer/graphics_settings_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.cpp rename to code/studio/src/plugins/object_viewer/graphics_settings_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.h b/code/studio/src/plugins/object_viewer/graphics_settings_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.h rename to code/studio/src/plugins/object_viewer/graphics_settings_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.ui b/code/studio/src/plugins/object_viewer/graphics_settings_page.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_settings_page.ui rename to code/studio/src/plugins/object_viewer/graphics_settings_page.ui diff --git a/code/studio/src/plugins/object_viewer/graphics_viewport.cpp b/code/studio/src/plugins/object_viewer/graphics_viewport.cpp new file mode 100644 index 000000000..0cec0be10 --- /dev/null +++ b/code/studio/src/plugins/object_viewer/graphics_viewport.cpp @@ -0,0 +1,129 @@ +/* + Object Viewer Qt + Copyright (C) 2010 Dzmitry Kamiahin + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +*/ + +#include "stdpch.h" +#include "graphics_viewport.h" +#include "../core/Nel3DWidget/nel3d_widget.h" + +// STL includes + +// Qt includes +#include +#include +#include +#include + +// NeL includes +#include + +#include +#include + +#include +#include + +// Project includes +#include "modules.h" + +using namespace std; +using namespace NL3D; + +namespace NLQT +{ + +CGraphicsViewport::CGraphicsViewport(QObject *parent) + : QObject(parent) +{ + w = new Nel3DWidget(); + connect( w, SIGNAL( resize( int, int ) ), this, SLOT( onResize( int, int ) ) ); +} + +CGraphicsViewport::~CGraphicsViewport() +{ + disconnect( w, SIGNAL( resize( int, int ) ), this, SLOT( onResize( int, int ) ) ); + delete w; + w = NULL; +} + +void CGraphicsViewport::init() +{ + //H_AUTO2 + nldebug("CGraphicsViewport::init"); + + w->init(); + Modules::objView().init( w->getDriver() ); + Modules::psEdit().init(); + Modules::veget().init(); + + w->setMouseTracking(true); + w->setFocusPolicy(Qt::StrongFocus); +} + +void CGraphicsViewport::release() +{ + //H_AUTO2 + nldebug("CGraphicsViewport::release"); + + Modules::veget().release(); + Modules::psEdit().release(); + Modules::objView().release(); +} + + +QAction *CGraphicsViewport::createSaveScreenshotAction(QObject *parent) +{ + QAction *action = new QAction(parent); + connect(action, SIGNAL(triggered()), this, SLOT(saveScreenshot())); + return action; +} + +QAction *CGraphicsViewport::createSetBackgroundColor(QObject *parent) +{ + QAction *action = new QAction(parent); + connect(action, SIGNAL(triggered()), this, SLOT(setBackgroundColor())); + return action; +} + +QWidget* CGraphicsViewport::widget() +{ + return w; +} + +void CGraphicsViewport::saveScreenshot() +{ + Modules::objView().saveScreenshot("screenshot", false, true, false); +} + +void CGraphicsViewport::setBackgroundColor() +{ + QColor color = QColorDialog::getColor(QColor(Modules::objView().getBackgroundColor().R, + Modules::objView().getBackgroundColor().G, + Modules::objView().getBackgroundColor().B)); + if (color.isValid()) + Modules::objView().setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue())); +} + +void CGraphicsViewport::onResize( int width, int height ) +{ + if (Modules::objView().getDriver()) + Modules::objView().setSizeViewport( width, height ); +} + +} /* namespace NLQT */ + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h b/code/studio/src/plugins/object_viewer/graphics_viewport.h similarity index 69% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h rename to code/studio/src/plugins/object_viewer/graphics_viewport.h index 0c01fa1ad..9bbad9806 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/graphics_viewport.h +++ b/code/studio/src/plugins/object_viewer/graphics_viewport.h @@ -26,23 +26,14 @@ // STL includes // Qt includes -#include -#include +#include // NeL includes // Project includes - -/* TODO every platform should use QWidget */ -#if defined(NL_OS_WINDOWS) -typedef QWidget QNLWidget; -#elif defined(NL_OS_MAC) -typedef QWidget QNLWidget; -#elif defined(NL_OS_UNIX) -typedef QGLWidget QNLWidget; -#endif // NL_OS_UNIX - +class QWidget; class QAction; +class Nel3DWidget; namespace NLQT { @@ -51,25 +42,22 @@ namespace NLQT @class CGraphicsViewport @brief Responsible for interaction between Qt and NeL. Initializes CObjectViewer, CParticleEditor and CVegetableEditor subsystem. */ -class CGraphicsViewport : public QNLWidget, public NLMISC::IEventEmitter +class CGraphicsViewport : public QObject, public NLMISC::IEventEmitter { Q_OBJECT public: - CGraphicsViewport(QWidget *parent); + CGraphicsViewport(QObject *parent); virtual ~CGraphicsViewport(); - virtual QPaintEngine *paintEngine() const - { - return NULL; - } - void init(); void release(); QAction *createSaveScreenshotAction(QObject *parent); QAction *createSetBackgroundColor(QObject *parent); + QWidget* widget(); + private Q_SLOTS: void saveScreenshot(); void setBackgroundColor(); @@ -77,21 +65,15 @@ private Q_SLOTS: void submitEvents(NLMISC::CEventServer &server, bool allWindows) { } void emulateMouseRawMode(bool) { } -protected: - virtual void resizeEvent(QResizeEvent *resizeEvent); - -#if defined(NL_OS_WINDOWS) - virtual bool winEvent(MSG *message, long *result); -#elif defined(NL_OS_MAC) - virtual bool macEvent(EventHandlerCallRef caller, EventRef event); -#elif defined(NL_OS_UNIX) - virtual bool x11Event(XEvent *event); -#endif + void onResize( int width, int height ); private: CGraphicsViewport(const CGraphicsViewport &); CGraphicsViewport &operator=(const CGraphicsViewport &); + + Nel3DWidget *w; + }; /* class CGraphicsViewport */ } /* namespace NLQT */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_add_item.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_add_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_add_item.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_add_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_anim.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_anim.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_anim.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_anim.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_animset.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_animset.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_animset.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_animset.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_append_item.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_append_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_append_item.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_append_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_bgcolor.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_bgcolor.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_bgcolor.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_bgcolor.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_camera_3dedit.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_camera_3dedit.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_camera_3dedit.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_camera_3dedit.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_camera_add.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_camera_add.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_camera_add.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_camera_add.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_camera_del.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_camera_del.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_camera_del.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_camera_del.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_camera_fps.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_camera_fps.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_camera_fps.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_camera_fps.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_daynight.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_daynight.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_daynight.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_daynight.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_delete_item.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_delete_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_delete_item.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_delete_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_down_item.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_down_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_down_item.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_down_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_framedelay.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_framedelay.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_framedelay.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_framedelay.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_insert_item.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_insert_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_insert_item.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_insert_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_mixer.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_mixer.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_mixer.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_mixer.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_mrm_mesh.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_mrm_mesh.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_mrm_mesh.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_mrm_mesh.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_new.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_new.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_new.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_new.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_open.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_open.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_open.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_open.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_particle_system.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_particle_system.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_particle_system.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_particle_system.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_particle_system_close.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_particle_system_close.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_particle_system_close.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_particle_system_close.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_particles.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_particles.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_particles.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_particles.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_pill.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_pill.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_pill.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_pill.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_reset_all.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_reset_all.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_reset_all.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_reset_all.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_reset_camera.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_reset_camera.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_reset_camera.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_reset_camera.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_save.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_save.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_save.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_save.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_save_as.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_save_as.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_save_as.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_save_as.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_skelscale.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_skelscale.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_skelscale.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_skelscale.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_sound.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_sound.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_sound.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_sound.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_up_item.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_up_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_up_item.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_up_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_veget.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_veget.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_veget.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_veget.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_vegetset.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_vegetset.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_vegetset.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_vegetset.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_water.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_water.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_water.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_water.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_wind.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_wind.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_wind.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_wind.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_workspace_item.png b/code/studio/src/plugins/object_viewer/icons/ic_nel_workspace_item.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/ic_nel_workspace_item.png rename to code/studio/src/plugins/object_viewer/icons/ic_nel_workspace_item.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_collision_zone_item_24.png b/code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_collision_zone_item_24.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_collision_zone_item_24.png rename to code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_collision_zone_item_24.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_emitter_item_24.png b/code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_emitter_item_24.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_emitter_item_24.png rename to code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_emitter_item_24.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_force_item_24.png b/code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_force_item_24.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_force_item_24.png rename to code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_force_item_24.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_instance_item_24.png b/code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_instance_item_24.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_instance_item_24.png rename to code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_instance_item_24.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_light_item_24.png b/code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_light_item_24.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_light_item_24.png rename to code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_light_item_24.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_located_item_24.png b/code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_located_item_24.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_located_item_24.png rename to code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_located_item_24.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_particle_item_24.png b/code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_particle_item_24.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_particle_item_24.png rename to code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_particle_item_24.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_particle_system_24.png b/code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_particle_system_24.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_particle_system_24.png rename to code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_particle_system_24.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_particle_system_close_24.png b/code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_particle_system_close_24.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_particle_system_close_24.png rename to code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_particle_system_close_24.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_sound_item_24.png b/code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_sound_item_24.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_sound_item_24.png rename to code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_sound_item_24.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_workspace_item_24.png b/code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_workspace_item_24.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/icons/particles_system_24/ic_nel_workspace_item_24.png rename to code/studio/src/plugins/object_viewer/icons/particles_system_24/ic_nel_workspace_item_24.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/dqynight.png b/code/studio/src/plugins/object_viewer/images/dqynight.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/dqynight.png rename to code/studio/src/plugins/object_viewer/images/dqynight.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/ico_mrm_mesh.png b/code/studio/src/plugins/object_viewer/images/ico_mrm_mesh.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/ico_mrm_mesh.png rename to code/studio/src/plugins/object_viewer/images/ico_mrm_mesh.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/mixer.png b/code/studio/src/plugins/object_viewer/images/mixer.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/mixer.png rename to code/studio/src/plugins/object_viewer/images/mixer.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/nel.png b/code/studio/src/plugins/object_viewer/images/nel.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/nel.png rename to code/studio/src/plugins/object_viewer/images/nel.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/pause.png b/code/studio/src/plugins/object_viewer/images/pause.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/pause.png rename to code/studio/src/plugins/object_viewer/images/pause.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/play.png b/code/studio/src/plugins/object_viewer/images/play.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/play.png rename to code/studio/src/plugins/object_viewer/images/play.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/polymode.png b/code/studio/src/plugins/object_viewer/images/polymode.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/polymode.png rename to code/studio/src/plugins/object_viewer/images/polymode.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/pqrticles.png b/code/studio/src/plugins/object_viewer/images/pqrticles.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/pqrticles.png rename to code/studio/src/plugins/object_viewer/images/pqrticles.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/refresh.png b/code/studio/src/plugins/object_viewer/images/refresh.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/refresh.png rename to code/studio/src/plugins/object_viewer/images/refresh.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/rmfill.png b/code/studio/src/plugins/object_viewer/images/rmfill.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/rmfill.png rename to code/studio/src/plugins/object_viewer/images/rmfill.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/rmline.png b/code/studio/src/plugins/object_viewer/images/rmline.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/rmline.png rename to code/studio/src/plugins/object_viewer/images/rmline.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/rmpoints.png b/code/studio/src/plugins/object_viewer/images/rmpoints.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/rmpoints.png rename to code/studio/src/plugins/object_viewer/images/rmpoints.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/seek-backward.png b/code/studio/src/plugins/object_viewer/images/seek-backward.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/seek-backward.png rename to code/studio/src/plugins/object_viewer/images/seek-backward.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/seek-forward.png b/code/studio/src/plugins/object_viewer/images/seek-forward.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/seek-forward.png rename to code/studio/src/plugins/object_viewer/images/seek-forward.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/skip-backward.png b/code/studio/src/plugins/object_viewer/images/skip-backward.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/skip-backward.png rename to code/studio/src/plugins/object_viewer/images/skip-backward.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/skip-forward.png b/code/studio/src/plugins/object_viewer/images/skip-forward.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/skip-forward.png rename to code/studio/src/plugins/object_viewer/images/skip-forward.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/sound.png b/code/studio/src/plugins/object_viewer/images/sound.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/sound.png rename to code/studio/src/plugins/object_viewer/images/sound.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/stop.png b/code/studio/src/plugins/object_viewer/images/stop.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/stop.png rename to code/studio/src/plugins/object_viewer/images/stop.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/water.png b/code/studio/src/plugins/object_viewer/images/water.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/water.png rename to code/studio/src/plugins/object_viewer/images/water.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/wind.png b/code/studio/src/plugins/object_viewer/images/wind.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/images/wind.png rename to code/studio/src/plugins/object_viewer/images/wind.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp b/code/studio/src/plugins/object_viewer/main_window.cpp similarity index 91% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp rename to code/studio/src/plugins/object_viewer/main_window.cpp index 2d45f0fb3..dc0c221cc 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.cpp +++ b/code/studio/src/plugins/object_viewer/main_window.cpp @@ -66,17 +66,18 @@ CMainWindow::CMainWindow(QWidget *parent) _isGraphicsInitialized(false), _isGraphicsEnabled(false), _isSoundInitialized(false), - _isSoundEnabled(true), + _isSoundEnabled(false), // MTR workaround for sheet id nonsense _GraphicsViewport(NULL), _lastDir("."), _mouseMode(NL3D::U3dMouseListener::edit3d) { + menu = NULL; nldebug("CMainWindow::CMainWindow:"); setObjectName("CMainWindow"); // create NeL viewport _GraphicsViewport = new CGraphicsViewport(this); - setCentralWidget(_GraphicsViewport); + setCentralWidget(_GraphicsViewport->widget()); setDockNestingEnabled(true); @@ -116,7 +117,7 @@ CMainWindow::CMainWindow(QWidget *parent) _statusBarTimer = new QTimer(this); connect(_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar())); - _statusInfo = new QLabel(this); + _statusInfo = new QLabel(); _statusInfo->hide(); Core::ICore::instance()->mainWindow()->statusBar()->addPermanentWidget(_statusInfo); } @@ -134,6 +135,14 @@ CMainWindow::~CMainWindow() settings->endGroup(); settings->sync(); + removeMenus(); + + // If the status info widget isn't removed it miraclously crashes the application on shutdown... + // Somehow it's deleted while being owned by the status bar, then the status bar also tries to delete is... + Core::ICore::instance()->mainWindow()->statusBar()->removeWidget( _statusInfo ); + delete _statusInfo; + _statusInfo = NULL; + delete _AnimationDialog; delete _AnimationSetDialog; delete _SlotManagerDialog; @@ -270,55 +279,51 @@ void CMainWindow::createMenus() menuManager->registerAction(_reloadTexturesAction, "ObjectViewer.View.ReloadTextures"); menuManager->registerAction(_saveScreenshotAction, "ObjectViewer.View.SaveScreenshot"); - // add actions in view menu - QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW); - viewMenu->addAction(_setBackColorAction); - viewMenu->addAction(_SetupFog->toggleViewAction()); - viewMenu->addAction(_resetSceneAction); - viewMenu->addAction(_reloadTexturesAction); - viewMenu->addAction(_saveScreenshotAction); - - // add actions in tools menu - QMenu *toolsMenu = menuManager->menu(Core::Constants::M_TOOLS); - QAction *settingsAction = menuManager->action(Core::Constants::SETTINGS); - QMenu *ovMenu = new QMenu("Object Viewer", this); + QMenu *ovMenu = menuManager->menuBar()->addMenu( "Object Viewer" ); menuManager->registerMenu(ovMenu, "ObjectViewerQt.ObjectViewer"); - toolsMenu->insertMenu(settingsAction, ovMenu); - ovMenu->insertAction(settingsAction ,_AnimationDialog->toggleViewAction()); + ovMenu->addAction(_setBackColorAction); + ovMenu->addAction(_SetupFog->toggleViewAction()); + ovMenu->addAction(_resetSceneAction); + ovMenu->addAction(_reloadTexturesAction); + ovMenu->addAction(_saveScreenshotAction); + + ovMenu->addSeparator(); + + ovMenu->addAction(_AnimationDialog->toggleViewAction() ); _AnimationDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_ANIM)); - ovMenu->insertAction(settingsAction ,_AnimationSetDialog->toggleViewAction()); + ovMenu->addAction(_AnimationSetDialog->toggleViewAction()); _AnimationSetDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_ANIMSET)); - ovMenu->insertAction(settingsAction ,_SlotManagerDialog->toggleViewAction()); + ovMenu->addAction(_SlotManagerDialog->toggleViewAction()); _SlotManagerDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_MIXER)); - ovMenu->insertAction(settingsAction ,_ParticleControlDialog->toggleViewAction()); + ovMenu->addAction(_ParticleControlDialog->toggleViewAction()); _ParticleControlDialog->toggleViewAction()->setIcon(QIcon(":/images/pqrticles.png")); - ovMenu->insertAction(settingsAction ,_DayNightDialog->toggleViewAction()); + ovMenu->addAction(_DayNightDialog->toggleViewAction()); _DayNightDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_DAYNIGHT)); - ovMenu->insertAction(settingsAction ,_WaterPoolDialog->toggleViewAction()); + ovMenu->addAction(_WaterPoolDialog->toggleViewAction()); _WaterPoolDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_WATER)); _WaterPoolDialog->toggleViewAction()->setEnabled(false); - ovMenu->insertAction(settingsAction ,_VegetableDialog->toggleViewAction()); + ovMenu->addAction(_VegetableDialog->toggleViewAction()); _VegetableDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_VEGET)); - ovMenu->insertAction(settingsAction ,_GlobalWindDialog->toggleViewAction()); + ovMenu->addAction(_GlobalWindDialog->toggleViewAction()); _GlobalWindDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_WIND)); - ovMenu->insertAction(settingsAction ,_SkeletonScaleDialog->toggleViewAction()); + ovMenu->addAction(_SkeletonScaleDialog->toggleViewAction()); _SkeletonScaleDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_SKELSCALE)); - ovMenu->insertAction(settingsAction ,_TuneTimerDialog->toggleViewAction()); + ovMenu->addAction(_TuneTimerDialog->toggleViewAction()); _TuneTimerDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_FRAMEDELAY)); - ovMenu->insertAction(settingsAction ,_SunColorDialog->toggleViewAction()); + ovMenu->addAction(_SunColorDialog->toggleViewAction()); - ovMenu->insertAction(settingsAction ,_TuneMRMDialog->toggleViewAction()); + ovMenu->addAction(_TuneMRMDialog->toggleViewAction()); _TuneMRMDialog->toggleViewAction()->setIcon(QIcon(Constants::ICON_MRM_MESH)); connect(_ParticleControlDialog->toggleViewAction(), SIGNAL(triggered(bool)), @@ -327,7 +332,14 @@ void CMainWindow::createMenus() connect(_ParticleControlDialog->toggleViewAction(), SIGNAL(triggered(bool)), _ParticleWorkspaceDialog->_PropertyDialog, SLOT(setVisible(bool))); - toolsMenu->insertSeparator(settingsAction); + menu = ovMenu; + +} + +void CMainWindow::removeMenus() +{ + delete menu; + menu = NULL; } void CMainWindow::createToolBars() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.h b/code/studio/src/plugins/object_viewer/main_window.h similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.h rename to code/studio/src/plugins/object_viewer/main_window.h index 5a392c191..dff4d9b4b 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/main_window.h +++ b/code/studio/src/plugins/object_viewer/main_window.h @@ -95,6 +95,7 @@ protected: private: void createActions(); void createMenus(); + void removeMenus(); void createToolBars(); void createDialogs(); @@ -144,6 +145,8 @@ private: uint _numTri; float _texMem; sint _mouseMode; + + QMenu *menu; };/* class CMainWindow */ } /* namespace NLQT */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/modules.cpp b/code/studio/src/plugins/object_viewer/modules.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/modules.cpp rename to code/studio/src/plugins/object_viewer/modules.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/modules.h b/code/studio/src/plugins/object_viewer/modules.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/modules.h rename to code/studio/src/plugins/object_viewer/modules.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.cpp b/code/studio/src/plugins/object_viewer/object_viewer.cpp similarity index 96% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.cpp rename to code/studio/src/plugins/object_viewer/object_viewer.cpp index 48c679455..2cf803d3d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.cpp +++ b/code/studio/src/plugins/object_viewer/object_viewer.cpp @@ -70,20 +70,16 @@ CObjectViewer::~CObjectViewer() saveConfig(); } -void CObjectViewer::init(nlWindow wnd, uint16 w, uint16 h) +void CObjectViewer::init( NL3D::UDriver *driver ) { //H_AUTO2 nldebug("CObjectViewert::init"); // create the driver nlassert(!_Driver); - - _Driver = NL3D::UDriver::createDriver(0, _Direct3D, 0); + _Driver = driver; nlassert(_Driver); - // initialize the window with config file values - _Driver->setDisplay(wnd, NL3D::UDriver::CMode(w, h, 32)); - // Create a scene _Scene = _Driver->createScene(false); _Scene->setPolygonBalancingMode(NL3D::UScene::PolygonBalancingClamp); @@ -128,8 +124,8 @@ void CObjectViewer::init(nlWindow wnd, uint16 w, uint16 h) NL3D::CBloomEffect::instance().setDensityBloom(uint8(_BloomDensity)); NL3D::CBloomEffect::instance().setSquareBloom(_BloomSquare); - NL3D::CDriverUser *driver = dynamic_cast(Modules::objView().getDriver()); - _IDriver = driver->getDriver(); + NL3D::CDriverUser *udriver = dynamic_cast(Modules::objView().getDriver()); + _IDriver = udriver->getDriver(); NL3D::CSceneUser *scene = dynamic_cast(Modules::objView().getScene()); _CScene = &scene->getScene(); @@ -158,11 +154,8 @@ void CObjectViewer::release() // delete the light delete _Light; - // release driver - nlassert(_Driver); - _Driver->release(); - delete _Driver; _Driver = 0; + _IDriver = NULL; } void CObjectViewer::updateInput() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.h b/code/studio/src/plugins/object_viewer/object_viewer.h similarity index 99% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.h rename to code/studio/src/plugins/object_viewer/object_viewer.h index 5e978d7e0..e8cc7304e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.h +++ b/code/studio/src/plugins/object_viewer/object_viewer.h @@ -78,7 +78,7 @@ public: /// @param wnd - handle window. /// @param w - width window. /// @param h - height window. - void init(nlWindow wnd, uint16 w, uint16 h); + void init( NL3D::UDriver *driver ); /// Release class. void release(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.qrc b/code/studio/src/plugins/object_viewer/object_viewer.qrc similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer.qrc rename to code/studio/src/plugins/object_viewer/object_viewer.qrc diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer_constants.h b/code/studio/src/plugins/object_viewer/object_viewer_constants.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer_constants.h rename to code/studio/src/plugins/object_viewer/object_viewer_constants.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer_plugin.cpp b/code/studio/src/plugins/object_viewer/object_viewer_plugin.cpp similarity index 95% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer_plugin.cpp rename to code/studio/src/plugins/object_viewer/object_viewer_plugin.cpp index 34fc0f1b4..dce7ad08f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer_plugin.cpp +++ b/code/studio/src/plugins/object_viewer/object_viewer_plugin.cpp @@ -23,6 +23,9 @@ ObjectViewerPlugin::~ObjectViewerPlugin() qDeleteAll(_autoReleaseObjects); _autoReleaseObjects.clear(); Modules::release(); + + delete _LibContext; + _LibContext = NULL; } bool ObjectViewerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer_plugin.h b/code/studio/src/plugins/object_viewer/object_viewer_plugin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/object_viewer_plugin.h rename to code/studio/src/plugins/object_viewer/object_viewer_plugin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/attrib_form.ui b/code/studio/src/plugins/object_viewer/particle_system/attrib_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/attrib_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/attrib_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/attrib_widget.cpp b/code/studio/src/plugins/object_viewer/particle_system/attrib_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/attrib_widget.cpp rename to code/studio/src/plugins/object_viewer/particle_system/attrib_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/attrib_widget.h b/code/studio/src/plugins/object_viewer/particle_system/attrib_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/attrib_widget.h rename to code/studio/src/plugins/object_viewer/particle_system/attrib_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/auto_lod_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/auto_lod_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/auto_lod_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/auto_lod_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/auto_lod_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/auto_lod_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/auto_lod_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/auto_lod_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/auto_lod_form.ui b/code/studio/src/plugins/object_viewer/particle_system/auto_lod_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/auto_lod_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/auto_lod_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_form.ui b/code/studio/src/plugins/object_viewer/particle_system/basic_edit_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/basic_edit_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_widget.cpp b/code/studio/src/plugins/object_viewer/particle_system/basic_edit_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_widget.cpp rename to code/studio/src/plugins/object_viewer/particle_system/basic_edit_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_widget.h b/code/studio/src/plugins/object_viewer/particle_system/basic_edit_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/basic_edit_widget.h rename to code/studio/src/plugins/object_viewer/particle_system/basic_edit_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/bin_op_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/bin_op_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/bin_op_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/bin_op_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/bin_op_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/bin_op_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/bin_op_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/bin_op_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/constraint_mesh_form.ui b/code/studio/src/plugins/object_viewer/particle_system/constraint_mesh_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/constraint_mesh_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/constraint_mesh_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/constraint_mesh_widget.cpp b/code/studio/src/plugins/object_viewer/particle_system/constraint_mesh_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/constraint_mesh_widget.cpp rename to code/studio/src/plugins/object_viewer/particle_system/constraint_mesh_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/constraint_mesh_widget.h b/code/studio/src/plugins/object_viewer/particle_system/constraint_mesh_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/constraint_mesh_widget.h rename to code/studio/src/plugins/object_viewer/particle_system/constraint_mesh_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/curve_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/curve_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/curve_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/curve_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/curve_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/curve_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/curve_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/curve_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/curve_form.ui b/code/studio/src/plugins/object_viewer/particle_system/curve_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/curve_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/curve_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/direction_form.ui b/code/studio/src/plugins/object_viewer/particle_system/direction_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/direction_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/direction_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/direction_widget.cpp b/code/studio/src/plugins/object_viewer/particle_system/direction_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/direction_widget.cpp rename to code/studio/src/plugins/object_viewer/particle_system/direction_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/direction_widget.h b/code/studio/src/plugins/object_viewer/particle_system/direction_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/direction_widget.h rename to code/studio/src/plugins/object_viewer/particle_system/direction_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/dup_ps.cpp b/code/studio/src/plugins/object_viewer/particle_system/dup_ps.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/dup_ps.cpp rename to code/studio/src/plugins/object_viewer/particle_system/dup_ps.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/dup_ps.h b/code/studio/src/plugins/object_viewer/particle_system/dup_ps.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/dup_ps.h rename to code/studio/src/plugins/object_viewer/particle_system/dup_ps.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/emitter_form.ui b/code/studio/src/plugins/object_viewer/particle_system/emitter_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/emitter_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/emitter_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/emitter_page.cpp b/code/studio/src/plugins/object_viewer/particle_system/emitter_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/emitter_page.cpp rename to code/studio/src/plugins/object_viewer/particle_system/emitter_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/emitter_page.h b/code/studio/src/plugins/object_viewer/particle_system/emitter_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/emitter_page.h rename to code/studio/src/plugins/object_viewer/particle_system/emitter_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/follow_path_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/follow_path_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/follow_path_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/follow_path_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/follow_path_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/follow_path_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/follow_path_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/follow_path_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_bindable_form.ui b/code/studio/src/plugins/object_viewer/particle_system/located_bindable_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_bindable_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/located_bindable_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_bindable_page.cpp b/code/studio/src/plugins/object_viewer/particle_system/located_bindable_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_bindable_page.cpp rename to code/studio/src/plugins/object_viewer/particle_system/located_bindable_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_bindable_page.h b/code/studio/src/plugins/object_viewer/particle_system/located_bindable_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_bindable_page.h rename to code/studio/src/plugins/object_viewer/particle_system/located_bindable_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_form.ui b/code/studio/src/plugins/object_viewer/particle_system/located_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/located_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_page.cpp b/code/studio/src/plugins/object_viewer/particle_system/located_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_page.cpp rename to code/studio/src/plugins/object_viewer/particle_system/located_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_page.h b/code/studio/src/plugins/object_viewer/particle_system/located_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/located_page.h rename to code/studio/src/plugins/object_viewer/particle_system/located_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_form.ui b/code/studio/src/plugins/object_viewer/particle_system/mesh_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/mesh_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_widget.cpp b/code/studio/src/plugins/object_viewer/particle_system/mesh_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_widget.cpp rename to code/studio/src/plugins/object_viewer/particle_system/mesh_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_widget.h b/code/studio/src/plugins/object_viewer/particle_system/mesh_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/mesh_widget.h rename to code/studio/src/plugins/object_viewer/particle_system/mesh_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/morph_mesh_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/morph_mesh_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/morph_mesh_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/morph_mesh_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_form.ui b/code/studio/src/plugins/object_viewer/particle_system/morph_mesh_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/morph_mesh_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/morph_mesh_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/multi_tex_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/multi_tex_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/multi_tex_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/multi_tex_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/multi_tex_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/multi_tex_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/multi_tex_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/multi_tex_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/multi_tex_form.ui b/code/studio/src/plugins/object_viewer/particle_system/multi_tex_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/multi_tex_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/multi_tex_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_control_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_control_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_control_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_control_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_control_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/particle_control_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_control_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_control_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_control_form.ui b/code/studio/src/plugins/object_viewer/particle_system/particle_control_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_control_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/particle_control_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_editor.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_editor.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_editor.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_editor.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_editor.h b/code/studio/src/plugins/object_viewer/particle_system/particle_editor.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_editor.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_editor.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_form.ui b/code/studio/src/plugins/object_viewer/particle_system/particle_force_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/particle_force_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_page.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_force_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_page.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_force_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_page.h b/code/studio/src/plugins/object_viewer/particle_system/particle_force_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_force_page.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_force_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_light_form.ui b/code/studio/src/plugins/object_viewer/particle_system/particle_light_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_light_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/particle_light_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_light_page.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_light_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_light_page.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_light_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_light_page.h b/code/studio/src/plugins/object_viewer/particle_system/particle_light_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_light_page.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_light_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_link_skeleton_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_link_skeleton_form.ui b/code/studio/src/plugins/object_viewer/particle_system/particle_link_skeleton_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_link_skeleton_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/particle_link_skeleton_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_node.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_node.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_node.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_node.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_node.h b/code/studio/src/plugins/object_viewer/particle_system/particle_node.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_node.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_node.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_property_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_property_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_property_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_property_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_property_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/particle_property_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_property_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_property_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_form.ui b/code/studio/src/plugins/object_viewer/particle_system/particle_sound_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/particle_sound_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_page.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_sound_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_page.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_sound_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_page.h b/code/studio/src/plugins/object_viewer/particle_system/particle_sound_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_sound_page.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_sound_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_form.ui b/code/studio/src/plugins/object_viewer/particle_system/particle_system_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/particle_system_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_page.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_system_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_page.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_system_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_page.h b/code/studio/src/plugins/object_viewer/particle_system/particle_system_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_system_page.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_system_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_anim_form.ui b/code/studio/src/plugins/object_viewer/particle_system/particle_texture_anim_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_anim_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/particle_texture_anim_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_anim_widget.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_texture_anim_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_anim_widget.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_texture_anim_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_anim_widget.h b/code/studio/src/plugins/object_viewer/particle_system/particle_texture_anim_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_anim_widget.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_texture_anim_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_form.ui b/code/studio/src/plugins/object_viewer/particle_system/particle_texture_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/particle_texture_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_widget.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_texture_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_widget.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_texture_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_widget.h b/code/studio/src/plugins/object_viewer/particle_system/particle_texture_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_texture_widget.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_texture_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_tree_model.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_tree_model.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_tree_model.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_tree_model.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_tree_model.h b/code/studio/src/plugins/object_viewer/particle_system/particle_tree_model.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_tree_model.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_tree_model.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_workspace_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_workspace_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/particle_workspace_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_workspace_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_form.ui b/code/studio/src/plugins/object_viewer/particle_system/particle_workspace_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/particle_workspace_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_page.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_workspace_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_page.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_workspace_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_page.h b/code/studio/src/plugins/object_viewer/particle_system/particle_workspace_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_workspace_page.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_workspace_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_zone_form.ui b/code/studio/src/plugins/object_viewer/particle_system/particle_zone_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_zone_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/particle_zone_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_zone_page.cpp b/code/studio/src/plugins/object_viewer/particle_system/particle_zone_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_zone_page.cpp rename to code/studio/src/plugins/object_viewer/particle_system/particle_zone_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_zone_page.h b/code/studio/src/plugins/object_viewer/particle_system/particle_zone_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/particle_zone_page.h rename to code/studio/src/plugins/object_viewer/particle_system/particle_zone_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_initial_pos.cpp b/code/studio/src/plugins/object_viewer/particle_system/ps_initial_pos.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_initial_pos.cpp rename to code/studio/src/plugins/object_viewer/particle_system/ps_initial_pos.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_initial_pos.h b/code/studio/src/plugins/object_viewer/particle_system/ps_initial_pos.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_initial_pos.h rename to code/studio/src/plugins/object_viewer/particle_system/ps_initial_pos.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_mover_form.ui b/code/studio/src/plugins/object_viewer/particle_system/ps_mover_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_mover_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/ps_mover_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_mover_page.cpp b/code/studio/src/plugins/object_viewer/particle_system/ps_mover_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_mover_page.cpp rename to code/studio/src/plugins/object_viewer/particle_system/ps_mover_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_mover_page.h b/code/studio/src/plugins/object_viewer/particle_system/ps_mover_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_mover_page.h rename to code/studio/src/plugins/object_viewer/particle_system/ps_mover_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_wrapper.h b/code/studio/src/plugins/object_viewer/particle_system/ps_wrapper.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/ps_wrapper.h rename to code/studio/src/plugins/object_viewer/particle_system/ps_wrapper.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/scheme_bank_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/scheme_bank_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/scheme_bank_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/scheme_bank_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_form.ui b/code/studio/src/plugins/object_viewer/particle_system/scheme_bank_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_bank_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/scheme_bank_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.cpp b/code/studio/src/plugins/object_viewer/particle_system/scheme_manager.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.cpp rename to code/studio/src/plugins/object_viewer/particle_system/scheme_manager.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.h b/code/studio/src/plugins/object_viewer/particle_system/scheme_manager.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/scheme_manager.h rename to code/studio/src/plugins/object_viewer/particle_system/scheme_manager.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/spinner_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/spinner_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/spinner_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/spinner_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/spinner_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/spinner_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/spinner_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/spinner_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/tail_form.ui b/code/studio/src/plugins/object_viewer/particle_system/tail_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/tail_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/tail_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/tail_particle_widget.cpp b/code/studio/src/plugins/object_viewer/particle_system/tail_particle_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/tail_particle_widget.cpp rename to code/studio/src/plugins/object_viewer/particle_system/tail_particle_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/tail_particle_widget.h b/code/studio/src/plugins/object_viewer/particle_system/tail_particle_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/tail_particle_widget.h rename to code/studio/src/plugins/object_viewer/particle_system/tail_particle_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_blender_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/value_blender_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_blender_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/value_blender_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_blender_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/value_blender_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_blender_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/value_blender_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/value_from_emitter_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_gradient_dialog.cpp b/code/studio/src/plugins/object_viewer/particle_system/value_gradient_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_gradient_dialog.cpp rename to code/studio/src/plugins/object_viewer/particle_system/value_gradient_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_gradient_dialog.h b/code/studio/src/plugins/object_viewer/particle_system/value_gradient_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_gradient_dialog.h rename to code/studio/src/plugins/object_viewer/particle_system/value_gradient_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_gradient_form.ui b/code/studio/src/plugins/object_viewer/particle_system/value_gradient_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/value_gradient_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/value_gradient_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/workspace_form.ui b/code/studio/src/plugins/object_viewer/particle_system/workspace_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/particle_system/workspace_form.ui rename to code/studio/src/plugins/object_viewer/particle_system/workspace_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_dialog.cpp b/code/studio/src/plugins/object_viewer/scene/animation_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_dialog.cpp rename to code/studio/src/plugins/object_viewer/scene/animation_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_dialog.h b/code/studio/src/plugins/object_viewer/scene/animation_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_dialog.h rename to code/studio/src/plugins/object_viewer/scene/animation_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_form.ui b/code/studio/src/plugins/object_viewer/scene/animation_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_form.ui rename to code/studio/src/plugins/object_viewer/scene/animation_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_dialog.cpp b/code/studio/src/plugins/object_viewer/scene/animation_set_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_dialog.cpp rename to code/studio/src/plugins/object_viewer/scene/animation_set_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_dialog.h b/code/studio/src/plugins/object_viewer/scene/animation_set_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_dialog.h rename to code/studio/src/plugins/object_viewer/scene/animation_set_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_form.ui b/code/studio/src/plugins/object_viewer/scene/animation_set_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/animation_set_form.ui rename to code/studio/src/plugins/object_viewer/scene/animation_set_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/camera_control.cpp b/code/studio/src/plugins/object_viewer/scene/camera_control.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/camera_control.cpp rename to code/studio/src/plugins/object_viewer/scene/camera_control.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/camera_control.h b/code/studio/src/plugins/object_viewer/scene/camera_control.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/camera_control.h rename to code/studio/src/plugins/object_viewer/scene/camera_control.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/day_night_dialog.cpp b/code/studio/src/plugins/object_viewer/scene/day_night_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/day_night_dialog.cpp rename to code/studio/src/plugins/object_viewer/scene/day_night_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/day_night_dialog.h b/code/studio/src/plugins/object_viewer/scene/day_night_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/day_night_dialog.h rename to code/studio/src/plugins/object_viewer/scene/day_night_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/day_night_form.ui b/code/studio/src/plugins/object_viewer/scene/day_night_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/day_night_form.ui rename to code/studio/src/plugins/object_viewer/scene/day_night_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/entity.cpp b/code/studio/src/plugins/object_viewer/scene/entity.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/entity.cpp rename to code/studio/src/plugins/object_viewer/scene/entity.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/entity.h b/code/studio/src/plugins/object_viewer/scene/entity.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/entity.h rename to code/studio/src/plugins/object_viewer/scene/entity.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/global_wind_dialog.cpp b/code/studio/src/plugins/object_viewer/scene/global_wind_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/global_wind_dialog.cpp rename to code/studio/src/plugins/object_viewer/scene/global_wind_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/global_wind_dialog.h b/code/studio/src/plugins/object_viewer/scene/global_wind_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/global_wind_dialog.h rename to code/studio/src/plugins/object_viewer/scene/global_wind_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/global_wind_form.ui b/code/studio/src/plugins/object_viewer/scene/global_wind_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/global_wind_form.ui rename to code/studio/src/plugins/object_viewer/scene/global_wind_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/setup_fog_dialog.cpp b/code/studio/src/plugins/object_viewer/scene/setup_fog_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/setup_fog_dialog.cpp rename to code/studio/src/plugins/object_viewer/scene/setup_fog_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/setup_fog_dialog.h b/code/studio/src/plugins/object_viewer/scene/setup_fog_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/setup_fog_dialog.h rename to code/studio/src/plugins/object_viewer/scene/setup_fog_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/setup_fog_form.ui b/code/studio/src/plugins/object_viewer/scene/setup_fog_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/setup_fog_form.ui rename to code/studio/src/plugins/object_viewer/scene/setup_fog_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_dialog.cpp b/code/studio/src/plugins/object_viewer/scene/skeleton_scale_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_dialog.cpp rename to code/studio/src/plugins/object_viewer/scene/skeleton_scale_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_dialog.h b/code/studio/src/plugins/object_viewer/scene/skeleton_scale_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_dialog.h rename to code/studio/src/plugins/object_viewer/scene/skeleton_scale_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_form.ui b/code/studio/src/plugins/object_viewer/scene/skeleton_scale_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_scale_form.ui rename to code/studio/src/plugins/object_viewer/scene/skeleton_scale_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_tree_model.cpp b/code/studio/src/plugins/object_viewer/scene/skeleton_tree_model.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_tree_model.cpp rename to code/studio/src/plugins/object_viewer/scene/skeleton_tree_model.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_tree_model.h b/code/studio/src/plugins/object_viewer/scene/skeleton_tree_model.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/skeleton_tree_model.h rename to code/studio/src/plugins/object_viewer/scene/skeleton_tree_model.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_form.ui b/code/studio/src/plugins/object_viewer/scene/slot_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_form.ui rename to code/studio/src/plugins/object_viewer/scene/slot_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_manager_dialog.cpp b/code/studio/src/plugins/object_viewer/scene/slot_manager_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_manager_dialog.cpp rename to code/studio/src/plugins/object_viewer/scene/slot_manager_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_manager_dialog.h b/code/studio/src/plugins/object_viewer/scene/slot_manager_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/slot_manager_dialog.h rename to code/studio/src/plugins/object_viewer/scene/slot_manager_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/sun_color_dialog.cpp b/code/studio/src/plugins/object_viewer/scene/sun_color_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/sun_color_dialog.cpp rename to code/studio/src/plugins/object_viewer/scene/sun_color_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/sun_color_dialog.h b/code/studio/src/plugins/object_viewer/scene/sun_color_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/sun_color_dialog.h rename to code/studio/src/plugins/object_viewer/scene/sun_color_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/sun_color_form.ui b/code/studio/src/plugins/object_viewer/scene/sun_color_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/sun_color_form.ui rename to code/studio/src/plugins/object_viewer/scene/sun_color_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_mrm_dialog.cpp b/code/studio/src/plugins/object_viewer/scene/tune_mrm_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_mrm_dialog.cpp rename to code/studio/src/plugins/object_viewer/scene/tune_mrm_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_mrm_dialog.h b/code/studio/src/plugins/object_viewer/scene/tune_mrm_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_mrm_dialog.h rename to code/studio/src/plugins/object_viewer/scene/tune_mrm_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_mrm_form.ui b/code/studio/src/plugins/object_viewer/scene/tune_mrm_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_mrm_form.ui rename to code/studio/src/plugins/object_viewer/scene/tune_mrm_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_timer_dialog.cpp b/code/studio/src/plugins/object_viewer/scene/tune_timer_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_timer_dialog.cpp rename to code/studio/src/plugins/object_viewer/scene/tune_timer_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_timer_dialog.h b/code/studio/src/plugins/object_viewer/scene/tune_timer_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_timer_dialog.h rename to code/studio/src/plugins/object_viewer/scene/tune_timer_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_timer_form.ui b/code/studio/src/plugins/object_viewer/scene/tune_timer_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/tune_timer_form.ui rename to code/studio/src/plugins/object_viewer/scene/tune_timer_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/water_pool_dialog.cpp b/code/studio/src/plugins/object_viewer/scene/water_pool_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/water_pool_dialog.cpp rename to code/studio/src/plugins/object_viewer/scene/water_pool_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/water_pool_dialog.h b/code/studio/src/plugins/object_viewer/scene/water_pool_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/water_pool_dialog.h rename to code/studio/src/plugins/object_viewer/scene/water_pool_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/water_pool_form.ui b/code/studio/src/plugins/object_viewer/scene/water_pool_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/scene/water_pool_form.ui rename to code/studio/src/plugins/object_viewer/scene/water_pool_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_settings_page.cpp b/code/studio/src/plugins/object_viewer/sound_settings_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_settings_page.cpp rename to code/studio/src/plugins/object_viewer/sound_settings_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_settings_page.h b/code/studio/src/plugins/object_viewer/sound_settings_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_settings_page.h rename to code/studio/src/plugins/object_viewer/sound_settings_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_settings_page.ui b/code/studio/src/plugins/object_viewer/sound_settings_page.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_settings_page.ui rename to code/studio/src/plugins/object_viewer/sound_settings_page.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.cpp b/code/studio/src/plugins/object_viewer/sound_system.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.cpp rename to code/studio/src/plugins/object_viewer/sound_system.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.h b/code/studio/src/plugins/object_viewer/sound_system.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/sound_system.h rename to code/studio/src/plugins/object_viewer/sound_system.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/stdpch.cpp b/code/studio/src/plugins/object_viewer/stdpch.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/stdpch.cpp rename to code/studio/src/plugins/object_viewer/stdpch.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/stdpch.h b/code/studio/src/plugins/object_viewer/stdpch.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/stdpch.h rename to code/studio/src/plugins/object_viewer/stdpch.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ovqt_plugin_object_viewer.xml b/code/studio/src/plugins/object_viewer/studio_plugin_object_viewer.xml similarity index 76% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ovqt_plugin_object_viewer.xml rename to code/studio/src/plugins/object_viewer/studio_plugin_object_viewer.xml index 6033c3985..c5ae8c081 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/ovqt_plugin_object_viewer.xml +++ b/code/studio/src/plugins/object_viewer/studio_plugin_object_viewer.xml @@ -1,5 +1,5 @@ - ovqt_plugin_object_viewer + studio_plugin_object_viewer ObjectViewer 0.8 Ryzom Core diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_appearance_page.cpp b/code/studio/src/plugins/object_viewer/vegetable/vegetable_appearance_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_appearance_page.cpp rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_appearance_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_appearance_page.h b/code/studio/src/plugins/object_viewer/vegetable/vegetable_appearance_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_appearance_page.h rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_appearance_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_apperance_form.ui b/code/studio/src/plugins/object_viewer/vegetable/vegetable_apperance_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_apperance_form.ui rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_apperance_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_form.ui b/code/studio/src/plugins/object_viewer/vegetable/vegetable_density_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_form.ui rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_density_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_page.cpp b/code/studio/src/plugins/object_viewer/vegetable/vegetable_density_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_page.cpp rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_density_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_page.h b/code/studio/src/plugins/object_viewer/vegetable/vegetable_density_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_density_page.h rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_density_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog.cpp b/code/studio/src/plugins/object_viewer/vegetable/vegetable_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog.cpp rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog.h b/code/studio/src/plugins/object_viewer/vegetable/vegetable_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog.h rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog_form.ui b/code/studio/src/plugins/object_viewer/vegetable/vegetable_dialog_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_dialog_form.ui rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_dialog_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_editor.cpp b/code/studio/src/plugins/object_viewer/vegetable/vegetable_editor.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_editor.cpp rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_editor.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_editor.h b/code/studio/src/plugins/object_viewer/vegetable/vegetable_editor.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_editor.h rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_editor.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_landscape_form.ui b/code/studio/src/plugins/object_viewer/vegetable/vegetable_landscape_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_landscape_form.ui rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_landscape_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_landscape_page.cpp b/code/studio/src/plugins/object_viewer/vegetable/vegetable_landscape_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_landscape_page.cpp rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_landscape_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_landscape_page.h b/code/studio/src/plugins/object_viewer/vegetable/vegetable_landscape_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_landscape_page.h rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_landscape_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_node.cpp b/code/studio/src/plugins/object_viewer/vegetable/vegetable_node.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_node.cpp rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_node.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_node.h b/code/studio/src/plugins/object_viewer/vegetable/vegetable_node.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_node.h rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_node.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_noise_value_form.ui b/code/studio/src/plugins/object_viewer/vegetable/vegetable_noise_value_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_noise_value_form.ui rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_noise_value_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_noise_value_widget.cpp b/code/studio/src/plugins/object_viewer/vegetable/vegetable_noise_value_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_noise_value_widget.cpp rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_noise_value_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_noise_value_widget.h b/code/studio/src/plugins/object_viewer/vegetable/vegetable_noise_value_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_noise_value_widget.h rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_noise_value_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_rotate_form.ui b/code/studio/src/plugins/object_viewer/vegetable/vegetable_rotate_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_rotate_form.ui rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_rotate_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_rotate_page.cpp b/code/studio/src/plugins/object_viewer/vegetable/vegetable_rotate_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_rotate_page.cpp rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_rotate_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_rotate_page.h b/code/studio/src/plugins/object_viewer/vegetable/vegetable_rotate_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_rotate_page.h rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_rotate_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_scale_form.ui b/code/studio/src/plugins/object_viewer/vegetable/vegetable_scale_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_scale_form.ui rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_scale_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_scale_page.cpp b/code/studio/src/plugins/object_viewer/vegetable/vegetable_scale_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_scale_page.cpp rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_scale_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_scale_page.h b/code/studio/src/plugins/object_viewer/vegetable/vegetable_scale_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable/vegetable_scale_page.h rename to code/studio/src/plugins/object_viewer/vegetable/vegetable_scale_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_settings_page.cpp b/code/studio/src/plugins/object_viewer/vegetable_settings_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_settings_page.cpp rename to code/studio/src/plugins/object_viewer/vegetable_settings_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_settings_page.h b/code/studio/src/plugins/object_viewer/vegetable_settings_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_settings_page.h rename to code/studio/src/plugins/object_viewer/vegetable_settings_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_settings_page.ui b/code/studio/src/plugins/object_viewer/vegetable_settings_page.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/vegetable_settings_page.ui rename to code/studio/src/plugins/object_viewer/vegetable_settings_page.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/color_edit_form.ui b/code/studio/src/plugins/object_viewer/widgets/color_edit_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/color_edit_form.ui rename to code/studio/src/plugins/object_viewer/widgets/color_edit_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/color_edit_widget.cpp b/code/studio/src/plugins/object_viewer/widgets/color_edit_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/color_edit_widget.cpp rename to code/studio/src/plugins/object_viewer/widgets/color_edit_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/color_edit_widget.h b/code/studio/src/plugins/object_viewer/widgets/color_edit_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/color_edit_widget.h rename to code/studio/src/plugins/object_viewer/widgets/color_edit_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_float_form.ui b/code/studio/src/plugins/object_viewer/widgets/edit_range_float_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_float_form.ui rename to code/studio/src/plugins/object_viewer/widgets/edit_range_float_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_uint_form.ui b/code/studio/src/plugins/object_viewer/widgets/edit_range_uint_form.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_uint_form.ui rename to code/studio/src/plugins/object_viewer/widgets/edit_range_uint_form.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_widget.cpp b/code/studio/src/plugins/object_viewer/widgets/edit_range_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_widget.cpp rename to code/studio/src/plugins/object_viewer/widgets/edit_range_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_widget.h b/code/studio/src/plugins/object_viewer/widgets/edit_range_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/edit_range_widget.h rename to code/studio/src/plugins/object_viewer/widgets/edit_range_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/hoverpoints.cpp b/code/studio/src/plugins/object_viewer/widgets/hoverpoints.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/hoverpoints.cpp rename to code/studio/src/plugins/object_viewer/widgets/hoverpoints.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/hoverpoints.h b/code/studio/src/plugins/object_viewer/widgets/hoverpoints.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/object_viewer/widgets/hoverpoints.h rename to code/studio/src/plugins/object_viewer/widgets/hoverpoints.h diff --git a/code/studio/src/plugins/ovqt_sheet_builder/CMakeLists.txt b/code/studio/src/plugins/ovqt_sheet_builder/CMakeLists.txt new file mode 100644 index 000000000..a543421c5 --- /dev/null +++ b/code/studio/src/plugins/ovqt_sheet_builder/CMakeLists.txt @@ -0,0 +1,48 @@ +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_SHEET_BUILDER_HDR sheetbuilderconfgdialog.h sheetbuilderdialog.h ovqt_sheet_builder.h) + +SET(QT_USE_QTGUI TRUE) +SET(QT_USE_QTOPENGL TRUE) + +QT4_WRAP_CPP(OVQT_PLUG_SHEET_BUILDER_MOC_SRC ${OVQT_PLUG_SHEET_BUILDER_HDR}) + +SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_SHEET_BUILDER_MOC_SRC}) +SOURCE_GROUP("Sheet builder Plugin" FILES ${SRC}) +SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) + +ADD_LIBRARY(studio_plugin_sheet_builder MODULE ${SRC} ${OVQT_PLUG_SHEET_BUILDER_MOC_SRC} ${OVQT_EXT_SYS_SRC}) + +TARGET_LINK_LIBRARIES(studio_plugin_sheet_builder studio_plugin_core nelmisc ${QT_LIBRARIES}) + +NL_DEFAULT_PROPS(studio_plugin_sheet_builder "Tools: Studio Plugin: Sheet builder") +NL_ADD_RUNTIME_FLAGS(studio_plugin_sheet_builder) +NL_ADD_LIB_SUFFIX(studio_plugin_sheet_builder) + +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) + + +IF(WIN32) + IF(WITH_INSTALL_LIBRARIES) + INSTALL(TARGETS studio_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + ELSE(WITH_INSTALL_LIBRARIES) + INSTALL(TARGETS studio_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + ENDIF(WITH_INSTALL_LIBRARIES) +ELSE(WIN32) + IF(WITH_INSTALL_LIBRARIES) + INSTALL(TARGETS studio_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + ELSE(WITH_INSTALL_LIBRARIES) + INSTALL(TARGETS studio_plugin_sheet_builder LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + ENDIF(WITH_INSTALL_LIBRARIES) +ENDIF(WIN32) + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_sheet_builder.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp b/code/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp similarity index 88% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp rename to code/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp index 4fd7dfb11..21358ec6f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp +++ b/code/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.cpp @@ -35,6 +35,21 @@ using namespace Plugin; +SheetBuilderPlugin::SheetBuilderPlugin() +{ +} + +SheetBuilderPlugin::~SheetBuilderPlugin() +{ + Core::MenuManager *menuManager = Core::ICore::instance()->menuManager(); + QAction *a = menuManager->action( "SheetBuilder" ); + menuManager->unregisterAction( "SheetBuilder" ); + delete a; + + delete m_LibContext; + m_LibContext = NULL; +} + bool SheetBuilderPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) { Q_UNUSED(errorString); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.h b/code/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.h similarity index 97% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.h rename to code/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.h index 504d0914d..21e2855c1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.h +++ b/code/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.h @@ -36,6 +36,8 @@ class SheetBuilderPlugin : public QObject, public ExtensionSystem::IPlugin Q_OBJECT Q_INTERFACES(ExtensionSystem::IPlugin) public: + SheetBuilderPlugin(); + ~SheetBuilderPlugin(); bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); void extensionsInitialized(); void setNelContext(NLMISC::INelContext *nelContext); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.pro b/code/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.pro similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.pro rename to code/studio/src/plugins/ovqt_sheet_builder/ovqt_sheet_builder.pro diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilder.h b/code/studio/src/plugins/ovqt_sheet_builder/sheetbuilder.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilder.h rename to code/studio/src/plugins/ovqt_sheet_builder/sheetbuilder.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilderconfgdialog.cpp b/code/studio/src/plugins/ovqt_sheet_builder/sheetbuilderconfgdialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilderconfgdialog.cpp rename to code/studio/src/plugins/ovqt_sheet_builder/sheetbuilderconfgdialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilderconfgdialog.h b/code/studio/src/plugins/ovqt_sheet_builder/sheetbuilderconfgdialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilderconfgdialog.h rename to code/studio/src/plugins/ovqt_sheet_builder/sheetbuilderconfgdialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilderdialog.cpp b/code/studio/src/plugins/ovqt_sheet_builder/sheetbuilderdialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilderdialog.cpp rename to code/studio/src/plugins/ovqt_sheet_builder/sheetbuilderdialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilderdialog.h b/code/studio/src/plugins/ovqt_sheet_builder/sheetbuilderdialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/sheetbuilderdialog.h rename to code/studio/src/plugins/ovqt_sheet_builder/sheetbuilderdialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_plugin_sheet_builder.xml b/code/studio/src/plugins/ovqt_sheet_builder/studio_plugin_sheet_builder.xml similarity index 76% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_plugin_sheet_builder.xml rename to code/studio/src/plugins/ovqt_sheet_builder/studio_plugin_sheet_builder.xml index 01dbefa8a..4f1f3210d 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/ovqt_sheet_builder/ovqt_plugin_sheet_builder.xml +++ b/code/studio/src/plugins/ovqt_sheet_builder/studio_plugin_sheet_builder.xml @@ -1,5 +1,5 @@ - ovqt_plugin_sheet_builder + studio_plugin_sheet_builder SheetBuilder 1.0 kharvd diff --git a/code/studio/src/plugins/tile_editor/CMakeLists.txt b/code/studio/src/plugins/tile_editor/CMakeLists.txt new file mode 100644 index 000000000..396522235 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/CMakeLists.txt @@ -0,0 +1,50 @@ +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_TILE_EDITOR_PLUGIN_HDR + tile_model.h + tile_editor_main_window.h + tile_editor_plugin.h + land_edit_dialog.h) + +SET(OVQT_TILE_EDITOR_PLUGIN_UIS + tile_editor_main_window.ui + land_edit_dialog.ui) + +SET(OVQT_PLUG_TILE_EDITOR_RCS tile_editor.qrc) + +SET(QT_USE_QTGUI TRUE) +SET(QT_USE_QTOPENGL TRUE) + +QT4_WRAP_CPP(OVQT_TILE_EDITOR_PLUGIN_MOC_SRC ${OVQT_TILE_EDITOR_PLUGIN_HDR}) +QT4_ADD_RESOURCES( OVQT_PLUG_TILE_EDITOR_RC_SRCS ${OVQT_PLUG_TILE_EDITOR_RCS}) +QT4_WRAP_UI(OVQT_TILE_EDITOR_PLUGIN_UI_HDRS ${OVQT_TILE_EDITOR_PLUGIN_UIS}) + +SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_TILE_EDITOR_PLUGIN_UI_HDRS}) +SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_TILE_EDITOR_PLUGIN_MOC_SRC} ${OVQT_PLUG_TILE_EDITOR_RC_SRCS}) +SOURCE_GROUP("Tile Editor Plugin" FILES ${SRC}) +SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) + +ADD_LIBRARY(studio_plugin_tile_editor MODULE ${SRC} ${OVQT_TILE_EDITOR_PLUGIN_MOC_SRC} ${OVQT_PLUG_TILE_EDITOR_RC_SRCS} ${OVQT_EXT_SYS_SRC} ${OVQT_TILE_EDITOR_PLUGIN_UI_HDRS}) + +TARGET_LINK_LIBRARIES(studio_plugin_tile_editor studio_plugin_core nelmisc ${QT_LIBRARIES}) + +IF(WITH_STLPORT) + TARGET_LINK_LIBRARIES(studio_plugin_tile_editor ${CMAKE_THREAD_LIBS_INIT}) +ENDIF(WITH_STLPORT) + +NL_DEFAULT_PROPS(studio_plugin_tile_editor "Tools: Studio Plugin: Tile Editor") +NL_ADD_RUNTIME_FLAGS(studio_plugin_tile_editor) +NL_ADD_LIB_SUFFIX(studio_plugin_tile_editor) + +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) + +INSTALL(TARGETS studio_plugin_tile_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_tile_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/studio/src/plugins/tile_editor/images/add_tile.png b/code/studio/src/plugins/tile_editor/images/add_tile.png new file mode 100644 index 000000000..a9de8f51d Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/add_tile.png differ diff --git a/code/studio/src/plugins/tile_editor/images/delete_image.png b/code/studio/src/plugins/tile_editor/images/delete_image.png new file mode 100644 index 000000000..1bc3b4e84 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/delete_image.png differ diff --git a/code/studio/src/plugins/tile_editor/images/delete_tile.png b/code/studio/src/plugins/tile_editor/images/delete_tile.png new file mode 100644 index 000000000..613c6a5f8 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/delete_tile.png differ diff --git a/code/studio/src/plugins/tile_editor/images/down.png b/code/studio/src/plugins/tile_editor/images/down.png new file mode 100644 index 000000000..b0033cf64 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/down.png differ diff --git a/code/studio/src/plugins/tile_editor/images/empty_image.png b/code/studio/src/plugins/tile_editor/images/empty_image.png new file mode 100644 index 000000000..9a2e358ab Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/empty_image.png differ diff --git a/code/studio/src/plugins/tile_editor/images/ic_nel_add_item.png b/code/studio/src/plugins/tile_editor/images/ic_nel_add_item.png new file mode 100644 index 000000000..bde338f78 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/ic_nel_add_item.png differ diff --git a/code/studio/src/plugins/tile_editor/images/ic_nel_delete_item.png b/code/studio/src/plugins/tile_editor/images/ic_nel_delete_item.png new file mode 100644 index 000000000..a5a1787d5 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/ic_nel_delete_item.png differ diff --git a/code/studio/src/plugins/tile_editor/images/ic_nel_new.png b/code/studio/src/plugins/tile_editor/images/ic_nel_new.png new file mode 100644 index 000000000..d45dcb467 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/ic_nel_new.png differ diff --git a/code/studio/src/plugins/tile_editor/images/ic_nel_open.png b/code/studio/src/plugins/tile_editor/images/ic_nel_open.png new file mode 100644 index 000000000..c4992affd Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/ic_nel_open.png differ diff --git a/code/studio/src/plugins/tile_editor/images/ic_nel_save.png b/code/studio/src/plugins/tile_editor/images/ic_nel_save.png new file mode 100644 index 000000000..7f7d35e9a Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/ic_nel_save.png differ diff --git a/code/studio/src/plugins/tile_editor/images/ic_nel_save_as.png b/code/studio/src/plugins/tile_editor/images/ic_nel_save_as.png new file mode 100644 index 000000000..1558632b9 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/ic_nel_save_as.png differ diff --git a/code/studio/src/plugins/tile_editor/images/left.png b/code/studio/src/plugins/tile_editor/images/left.png new file mode 100644 index 000000000..9c94db1aa Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/left.png differ diff --git a/code/studio/src/plugins/tile_editor/images/nel.png b/code/studio/src/plugins/tile_editor/images/nel.png new file mode 100644 index 000000000..d2139bb25 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/nel.png differ diff --git a/code/studio/src/plugins/tile_editor/images/replace_image.png b/code/studio/src/plugins/tile_editor/images/replace_image.png new file mode 100644 index 000000000..94d9b76c8 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/replace_image.png differ diff --git a/code/studio/src/plugins/tile_editor/images/reset.png b/code/studio/src/plugins/tile_editor/images/reset.png new file mode 100644 index 000000000..6693e842c Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/reset.png differ diff --git a/code/studio/src/plugins/tile_editor/images/right.png b/code/studio/src/plugins/tile_editor/images/right.png new file mode 100644 index 000000000..eb51b8385 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/right.png differ diff --git a/code/studio/src/plugins/tile_editor/images/rotation0.png b/code/studio/src/plugins/tile_editor/images/rotation0.png new file mode 100644 index 000000000..7434c4959 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/rotation0.png differ diff --git a/code/studio/src/plugins/tile_editor/images/rotation180.png b/code/studio/src/plugins/tile_editor/images/rotation180.png new file mode 100644 index 000000000..7ce524883 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/rotation180.png differ diff --git a/code/studio/src/plugins/tile_editor/images/rotation270.png b/code/studio/src/plugins/tile_editor/images/rotation270.png new file mode 100644 index 000000000..32b47a97c Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/rotation270.png differ diff --git a/code/studio/src/plugins/tile_editor/images/rotation90.png b/code/studio/src/plugins/tile_editor/images/rotation90.png new file mode 100644 index 000000000..2eb11b322 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/rotation90.png differ diff --git a/code/studio/src/plugins/tile_editor/images/up.png b/code/studio/src/plugins/tile_editor/images/up.png new file mode 100644 index 000000000..e5145d052 Binary files /dev/null and b/code/studio/src/plugins/tile_editor/images/up.png differ diff --git a/code/studio/src/plugins/tile_editor/land_edit_dialog.cpp b/code/studio/src/plugins/tile_editor/land_edit_dialog.cpp new file mode 100644 index 000000000..40fbf3024 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/land_edit_dialog.cpp @@ -0,0 +1,105 @@ +// Ryzom Core Studio - Tile Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "land_edit_dialog.h" + +LandEditDialog::LandEditDialog( QWidget *parent ) : +QDialog( parent ) +{ + setupUi( this ); + setupConnections(); +} + +LandEditDialog::~LandEditDialog() +{ +} + +void LandEditDialog::getSelectedTileSets( QStringList &l ) const +{ + int c = tilesetLV->count(); + for( int i = 0; i < c; i++ ) + { + l.push_back( tilesetLV->item( i )->text() ); + } +} + +void LandEditDialog::setSelectedTileSets( QStringList &l ) +{ + tilesetLV->clear(); + + QStringListIterator itr( l ); + while( itr.hasNext() ) + { + tilesetLV->addItem( itr.next() ); + } +} + +void LandEditDialog::setTileSets( const QStringList &l ) +{ + tilesetCB->clear(); + + QStringListIterator itr( l ); + while( itr.hasNext() ) + { + tilesetCB->addItem( itr.next() ); + } +} + +void LandEditDialog::setupConnections() +{ + connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOkClicked() ) ); + connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) ); + connect( addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) ); + connect( removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) ); +} + +void LandEditDialog::onOkClicked() +{ + accept(); +} + +void LandEditDialog::onCancelClicked() +{ + reject(); +} + +void LandEditDialog::onAddClicked() +{ + if( tilesetCB->currentIndex() < 0 ) + return; + + QString text = tilesetCB->currentText(); + + int c = tilesetLV->count(); + for( int i = 0; i < c; i++ ) + { + if( text == tilesetLV->item( i )->text() ) + return; + } + + tilesetLV->addItem( text ); +} + +void LandEditDialog::onRemoveClicked() +{ + if( tilesetLV->currentItem() == NULL ) + return; + + QListWidgetItem *item = tilesetLV->currentItem(); + delete item; +} + diff --git a/code/studio/src/plugins/tile_editor/land_edit_dialog.h b/code/studio/src/plugins/tile_editor/land_edit_dialog.h new file mode 100644 index 000000000..ac3762b46 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/land_edit_dialog.h @@ -0,0 +1,51 @@ +// Ryzom Core Studio - Tile Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 LAND_EDIT_DLG_H +#define LAND_EDIT_DLG_H + + +#include "ui_land_edit_dialog.h" +#include + +class LandEditDialog : public QDialog, public Ui::LandEditDialog +{ + Q_OBJECT +public: + LandEditDialog( QWidget *parent = NULL ); + ~LandEditDialog(); + + void getSelectedTileSets( QStringList &l ) const; + void setSelectedTileSets( QStringList &l ); + + void setTileSets( const QStringList &l ); + +private: + void setupConnections(); + + +private Q_SLOTS: + void onOkClicked(); + void onCancelClicked(); + void onAddClicked(); + void onRemoveClicked(); + +}; + + +#endif + diff --git a/code/studio/src/plugins/tile_editor/land_edit_dialog.ui b/code/studio/src/plugins/tile_editor/land_edit_dialog.ui new file mode 100644 index 000000000..7eb707528 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/land_edit_dialog.ui @@ -0,0 +1,99 @@ + + + LandEditDialog + + + Qt::WindowModal + + + + 0 + 0 + 402 + 311 + + + + Editing land + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Add + + + + + + + + 0 + 0 + + + + Remove + + + + + + + + 0 + 0 + + + + OK + + + + + + + + 0 + 0 + + + + Cancel + + + + + + + + + + diff --git a/code/studio/src/plugins/tile_editor/studio_plugin_tile_editor.xml b/code/studio/src/plugins/tile_editor/studio_plugin_tile_editor.xml new file mode 100644 index 000000000..d69201f9b --- /dev/null +++ b/code/studio/src/plugins/tile_editor/studio_plugin_tile_editor.xml @@ -0,0 +1,10 @@ + + studio_plugin_tile_editor + TileEditor + 1.0 + Ryzom Core + Tile bank editing plugin. + + + + \ No newline at end of file diff --git a/code/studio/src/plugins/tile_editor/tile_bank.cpp b/code/studio/src/plugins/tile_editor/tile_bank.cpp new file mode 100644 index 000000000..8e4d8f511 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_bank.cpp @@ -0,0 +1,642 @@ +// Ryzom Core Studio - Tile Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "tile_bank.h" +#include "nel/3d/tile_bank.h" + +#include + +namespace{ + + bool pixmapToCBGRA( QPixmap &pixmap, std::vector< NLMISC::CBGRA >& pixels ) + { + QImage img = pixmap.toImage(); + if( img.format() != QImage::Format_ARGB32 ) + img = img.convertToFormat( QImage::Format_ARGB32 ); + + if( img.format() != QImage::Format_ARGB32 ) + return false; + + int c = img.width() * img.height(); + + const unsigned char *data = img.bits(); + const unsigned int *idata = reinterpret_cast< const unsigned int* >( data ); + + NLMISC::CBGRA bgra; + pixels.clear(); + + int i = 0; + while( i < c ) + { + bgra.A = ( idata[ i ] & 0xFF000000 ) >> 24; + bgra.R = ( idata[ i ] & 0x00FF0000 ) >> 16; + bgra.G = ( idata[ i ] & 0x0000FF00 ) >> 8; + bgra.B = ( idata[ i ] & 0x000000FF ); + pixels.push_back( bgra ); + + i++; + } + + return true; + } + + + NL3D::CTile::TBitmap channelToTBitmap( TileConstants::TTileChannel channel ) + { + return NL3D::CTile::TBitmap( int( channel ) ); + } + + +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + +class TileBankPvt +{ +public: + + bool checkSize( TileConstants::TNodeTileType type, TileConstants::TTileChannel channel, int w, int h ) + { + int width = -1; + + switch( type ) + { + case TileConstants::Tile128: + width = 128; + break; + + case TileConstants::Tile256: + width = 256; + break; + + case TileConstants::TileTransition: + { + if( channel == TileConstants::TileAlpha ) + width = 64; + else + width = 128; + + } + break; + + case TileConstants::TileDisplacement: + width = 32; + break; + } + + if( width == w ) + return true; + + return false; + } + + NL3D::CTileSet::TError checkTile( NL3D::CTileSet *set, int tile, TileConstants::TNodeTileType type, NL3D::CTileBorder &border, NL3D::CTile::TBitmap bitmap, QString &msg ) + { + NL3D::CTileSet::TError error; + + if( bitmap == NL3D::CTile::additive ) + return NL3D::CTileSet::ok; + + if( type == TileConstants::TileDisplacement ) + return NL3D::CTileSet::ok; + + int component; + int pixel; + int idx; + + switch( type ) + { + case TileConstants::Tile128: + error = set->checkTile128( bitmap, border, pixel, component ); + break; + + case TileConstants::Tile256: + error = set->checkTile256( bitmap, border, pixel, component ); + break; + + case TileConstants::TileTransition: + { + if( bitmap != NL3D::CTile::alpha ) + error = set->checkTile128( bitmap, border, pixel, component ); + else + error = set->checkTileTransition( NL3D::CTileSet::TTransition( tile ), bitmap, border, idx, pixel, component ); + + break; + } + } + + if( ( error != NL3D::CTileSet::ok ) && ( error != NL3D::CTileSet::addFirstA128128 ) ) + { + static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""}; + + msg = NL3D::CTileSet::getErrorMessage( error ); + msg += "\n"; + msg += " pixel %1 component %2"; + msg = msg.arg( pixel ); + msg = msg.arg( comp[ component ] ); + } + + return error; + } + + void setTile( NL3D::CTileSet *set, int tile, int rotation, const QString &name, NL3D::CTile::TBitmap bm, TileConstants::TNodeTileType type, NL3D::CTileBorder &border ) + { + switch( type ) + { + case TileConstants::Tile128: + set->setTile128( tile, name.toUtf8().constData(), bm, m_bank ); + break; + + case TileConstants::Tile256: + set->setTile256( tile, name.toUtf8().constData(), bm, m_bank ); + break; + + case TileConstants::TileTransition: + if( bm != NL3D::CTile::alpha ) + set->setTileTransition( NL3D::CTileSet::TTransition( tile ), name.toUtf8().constData(), bm, m_bank, border ); + else + set->setTileTransitionAlpha( NL3D::CTileSet::TTransition( tile ), name.toUtf8().constData(), m_bank, border, rotation ); + break; + + case TileConstants::TileDisplacement: + set->setDisplacement( NL3D::CTileSet::TDisplacement( tile ), name.toUtf8().constData(), m_bank ); + break; + } + + } + + void buildBorder( QPixmap &pm, NL3D::CTileBorder &border ) + { + std::vector< NLMISC::CBGRA > pixels; + pixmapToCBGRA( pm, pixels ); + border.set( pm.width(), pm.height(), pixels ); + } + + NL3D::CTileBank m_bank; +}; + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +TileBank::TileBank() +{ + m_pvt = new TileBankPvt(); + resetError(); + m_rotation = 0; +} + +TileBank::~TileBank() +{ + delete m_pvt; +} + +void TileBank::addTileSet( const QString &name ) +{ + m_pvt->m_bank.addTileSet( name.toUtf8().constData() ); + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( 0 ); +} + +void TileBank::removeTileSet( int idx ) +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( idx ); + if( set == NULL ) + return; + + int c = m_pvt->m_bank.getLandCount(); + for( int i = 0; i < c; i++ ) + { + NL3D::CTileLand *land = m_pvt->m_bank.getLand( i ); + land->removeTileSet( set->getName() ); + } + + m_pvt->m_bank.removeTileSet( idx ); +} + +void TileBank::renameTileSet( int idx, const QString &newName ) +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( idx ); + if( set == NULL ) + return; + + std::string oldName = set->getName(); + set->setName( newName.toUtf8().constData() ); + + int c = m_pvt->m_bank.getLandCount(); + for( int i = 0; i < c; i++ ) + { + NL3D::CTileLand *land = m_pvt->m_bank.getLand( i ); + land->removeTileSet( oldName ); + land->addTileSet( newName.toUtf8().constData() ); + } + +} + +void TileBank::getTileSets( QStringList &l ) +{ + int c = m_pvt->m_bank.getTileSetCount(); + for( int i = 0; i < c; i++ ) + { + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( i ); + l.push_back( set->getName().c_str() ); + } +} + +void TileBank::addLand( const QString &name ) +{ + m_pvt->m_bank.addLand( name.toUtf8().constData() ); +} + +void TileBank::removeLand( int idx ) +{ + m_pvt->m_bank.removeLand( idx ); +} + +void TileBank::getLands( QStringList &l ) +{ + l.clear(); + + int c = m_pvt->m_bank.getLandCount(); + for( int i = 0; i < c; i++ ) + { + NL3D::CTileLand *land = m_pvt->m_bank.getLand( i ); + l.push_back( land->getName().c_str() ); + } +} + +void TileBank::setLandSets( int idx, const QStringList &l ) +{ + NL3D::CTileLand *land = m_pvt->m_bank.getLand( idx ); + land->clear(); + + QStringListIterator itr( l ); + while( itr.hasNext() ) + { + land->addTileSet( itr.next().toUtf8().constData() ); + } +} + +void TileBank::getLandSets( int idx, QStringList &l ) +{ + NL3D::CTileLand *land = m_pvt->m_bank.getLand( idx ); + if( land == NULL ) + return; + + l.clear(); + + std::set< std::string> sets = land->getTileSets(); + std::set< std::string >::const_iterator itr = sets.begin(); + while( itr != sets.end() ) + { + l.push_back( itr->c_str() ); + ++itr; + } +} + +bool TileBank::addTile( int setIdx, const QString &name, const QVariant &pixmap, TileConstants::TTileChannel channel, TileConstants::TNodeTileType type ) +{ + resetError(); + + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( setIdx ); + + int tile; + switch( type ) + { + case TileConstants::Tile128: set->addTile128( tile, m_pvt->m_bank ); break; + case TileConstants::Tile256: set->addTile256( tile, m_pvt->m_bank ); break; + } + + bool b = setTile( setIdx, tile, name, pixmap, channel, type ); + if( b ) + return true; + + // There was an error, roll back + switch( type ) + { + case TileConstants::Tile128: set->removeTile128( tile, m_pvt->m_bank ); break; + case TileConstants::Tile256: set->removeTile256( tile, m_pvt->m_bank ); break; + } + + return false; +} + +void TileBank::removeTile( int ts, int type, int tile ) +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( ts ); + + switch( type ) + { + case TileConstants::Tile128: set->removeTile128( tile, m_pvt->m_bank ); break; + case TileConstants::Tile256: set->removeTile256( tile, m_pvt->m_bank ); break; + } +} + +bool TileBank::setTile( int tileset, int tile, const QString &name, const QVariant &pixmap, TileConstants::TTileChannel channel, TileConstants::TNodeTileType type ) +{ + resetError(); + + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileset ); + if( set == NULL ) + return false; + + QPixmap pm = pixmap.value< QPixmap >(); + if( pm.isNull() ) + { + m_hasError = true; + m_lastError = "Failed to load image."; + return false; + } + + if( pm.width() != pm.height() ) + { + m_hasError = true; + m_lastError = "Image isn't square."; + return false; + } + + if( !m_pvt->checkSize( type, channel, pm.width(), pm.height() ) ) + { + m_hasError = true; + m_lastError = "Invalid image size."; + return false; + } + + NL3D::CTileBorder border; + m_pvt->buildBorder( pm, border ); + + if( ( type == TileConstants::TileTransition ) && ( channel == TileConstants::TileAlpha ) ) + { + int rotBits = m_rotation; + while( rotBits > 0 ) + { + border.rotate(); + rotBits--; + } + } + + QString msg; + NL3D::CTileSet::TError error = m_pvt->checkTile( set, tile, type, border, channelToTBitmap( channel ), msg ); + + // Tile checks out fine, set it + if( ( error == NL3D::CTileSet::ok ) || ( error == NL3D::CTileSet::addFirstA128128 ) ) + { + if( error == NL3D::CTileSet::addFirstA128128 ) + set->setBorder( channelToTBitmap( channel ), border ); + + m_pvt->setTile( set, tile, m_rotation, name, channelToTBitmap( channel ), type, border ); + + return true; + } + + setError( msg ); + + return false; +} + +void TileBank::replaceImage( int ts, int type, int tile, TileConstants::TTileChannel channel, const QString &name, const QVariant &pixmap ) +{ + setTile( ts, tile, name, pixmap, channel, TileConstants::TNodeTileType( type ) ); +} + +void TileBank::clearImage( int ts, int type, int tile, TileConstants::TTileChannel channel ) +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( ts ); + + int tileId; + + NL3D::CTile::TBitmap bm = channelToTBitmap( channel ); + + switch( type ) + { + case TileConstants::Tile128: + set->clearTile128( tile, bm, m_pvt->m_bank ); + break; + + case TileConstants::Tile256: + set->clearTile256( tile, bm, m_pvt->m_bank ); + break; + + case TileConstants::TileTransition: + set->clearTransition( NL3D::CTileSet::TTransition( tile ), bm, m_pvt->m_bank ); + break; + + case TileConstants::TileDisplacement: + set->clearDisplacement( NL3D::CTileSet::TDisplacement( tile ), m_pvt->m_bank ); + break; + } + +} + +int TileBank::getTileCount( int tileSet, TileConstants::TNodeTileType type ) +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet ); + if( set == NULL ) + return -1; + + int c = 0; + + switch( type ) + { + case TileConstants::Tile128: + c = set->getNumTile128(); + break; + + case TileConstants::Tile256: + c = set->getNumTile256(); + break; + + case TileConstants::TileTransition: + c = NL3D::CTileSet::count; + break; + + case TileConstants::TileDisplacement: + c = NL3D::CTileSet::CountDisplace; + break; + } + + return c; +} + +int TileBank::getRealTileId( int tileSet, TileConstants::TNodeTileType type, int tileIdInSet ) +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet ); + if( set == NULL ) + return -1; + + int tile = -1; + + switch( type ) + { + case TileConstants::Tile128: + tile = set->getTile128( tileIdInSet ); + break; + + case TileConstants::Tile256: + tile = set->getTile256( tileIdInSet ); + break; + + case TileConstants::TileTransition: + tile = set->getTransition( tileIdInSet )->getTile(); + break; + + case TileConstants::TileDisplacement: + tile = set->getDisplacementTile( NL3D::CTileSet::TDisplacement( tileIdInSet ) ); + break; + } + + return tile; +} + +void TileBank::getTileImages( int tileSet, TileConstants::TNodeTileType type, int tileId, TileImages &images ) +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet ); + if( set == NULL ) + return; + + switch( type ) + { + case TileConstants::Tile128: + case TileConstants::Tile256: + case TileConstants::TileTransition: + { + NL3D::CTile *t = m_pvt->m_bank.getTile( tileId ); + if( t == NULL ) + return; + + images.diffuse = t->getFileName( channelToTBitmap( TileConstants::TileDiffuse ) ).c_str(); + images.additive = t->getFileName( channelToTBitmap( TileConstants::TileAdditive ) ).c_str(); + images.alpha = t->getFileName( channelToTBitmap( TileConstants::TileAlpha ) ).c_str(); + } + break; + + case TileConstants::TileDisplacement: + { + images.diffuse = m_pvt->m_bank.getDisplacementMap( tileId ); + } + break; + } + +} + +void TileBank::getTileImages( int tileSet, TileConstants::TNodeTileType type, QList< TileImages > &l ) +{ + l.clear(); + + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet ); + if( set == NULL ) + return; + + int c = getTileCount( tileSet, type ); + + TileImages images; + + for( int i = 0; i < c; i++ ) + { + images.clear(); + + int id = getRealTileId( tileSet, type, i ); + if( id < 0 ) + { + l.push_back( images ); + continue; + } + + getTileImages( tileSet, type, id, images ); + + l.push_back( images ); + } + +} + +void TileBank::setVegetation( int tileSet, const QString &vegetation ) +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet ); + if( set == NULL ) + return; + + set->setTileVegetableDescFileName( vegetation.toUtf8().constData() ); +} + + +QString TileBank::getVegetation( int tileSet ) const +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet ); + if( set == NULL ) + return ""; + + return set->getTileVegetableDescFileName().c_str(); +} + +void TileBank::setOriented( int tileSet, bool b ) +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet ); + if( set == NULL ) + return; + + set->setOriented( b ); +} + +bool TileBank::getOriented( int tileSet ) const +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet ); + if( set == NULL ) + return false; + + return set->getOriented(); +} + + +void TileBank::setSurfaceData( int tileSet, unsigned long data ) +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet ); + if( set == NULL ) + return; + + set->SurfaceData = data; +} + +unsigned long TileBank::getSurfaceData( int tileSet ) const +{ + NL3D::CTileSet *set = m_pvt->m_bank.getTileSet( tileSet ); + if( set == NULL ) + return 0; + + return set->SurfaceData; +} + +void TileBank::setTexturePath( const QString &path ) +{ + m_pvt->m_bank.setAbsPath( path.toUtf8().constData() ); +} + +QString TileBank::getTexturePath() const +{ + return m_pvt->m_bank.getAbsPath().c_str(); +} + +void TileBank::setRotation( int rotation ) +{ + m_rotation = rotation; +} + +void TileBank::serial( NLMISC::IStream &f ) +{ + m_pvt->m_bank.serial( f ); +} + + diff --git a/code/studio/src/plugins/tile_editor/tile_bank.h b/code/studio/src/plugins/tile_editor/tile_bank.h new file mode 100644 index 000000000..a4620ad41 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_bank.h @@ -0,0 +1,102 @@ +// Ryzom Core Studio - Tile Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 TILE_BANK_H +#define TILE_BANK_H + +#include +#include +#include +#include + +#include "tile_constants.h" +#include "tile_images.h" + +namespace NLMISC +{ + class IStream; +} + +class TileBankPvt; + +class TileBank +{ +public: + TileBank(); + ~TileBank(); + + void addTileSet( const QString &name ); + void removeTileSet( int idx ); + void renameTileSet( int idx, const QString &newName ); + void getTileSets( QStringList &l ); + + void addLand( const QString &name ); + void removeLand( int idx ); + void getLands( QStringList &l ); + void setLandSets( int idx, const QStringList &l ); + void getLandSets( int idx, QStringList &l ); + + bool addTile( int setIdx, const QString &name, const QVariant &pixmap, TileConstants::TTileChannel channel, TileConstants::TNodeTileType type ); + void removeTile( int ts, int type, int tile ); + bool setTile( int tileset, int tile, const QString &name, const QVariant &pixmap, TileConstants::TTileChannel channel, TileConstants::TNodeTileType type ); + void replaceImage( int ts, int type, int tile, TileConstants::TTileChannel channel, const QString &name, const QVariant &pixmap ); + void clearImage( int ts, int type, int tile, TileConstants::TTileChannel channel ); + + + int getTileCount( int tileSet, TileConstants::TNodeTileType type ); + int getRealTileId( int tileSet, TileConstants::TNodeTileType type, int tileIdInSet ); + void getTileImages( int tileSet, TileConstants::TNodeTileType type, int tileId, TileImages &images ); + void getTileImages( int tileSet, TileConstants::TNodeTileType type, QList< TileImages > &l ); + + void setVegetation( int tileSet, const QString &vegetation ); + QString getVegetation( int tileSet ) const; + + void setOriented( int tileSet, bool b ); + bool getOriented( int tileSet ) const; + + void setSurfaceData( int tileSet, unsigned long data ); + unsigned long getSurfaceData( int tileSet ) const; + + void setTexturePath( const QString &path ); + QString getTexturePath() const; + + void setRotation( int rotation ); + + void serial( NLMISC::IStream &f ); + + bool hasError() const{ return m_hasError; } + QString getLastError() const{ return m_lastError; } + void resetError(){ + m_hasError = false; + m_lastError = ""; + } + + void setError( const QString &msg ) + { + m_hasError = true; + m_lastError = msg; + } + +private: + TileBankPvt *m_pvt; + QString m_lastError; + bool m_hasError; + int m_rotation; +}; + +#endif + diff --git a/code/studio/src/plugins/tile_editor/tile_constants.h b/code/studio/src/plugins/tile_editor/tile_constants.h new file mode 100644 index 000000000..bf09f21a5 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_constants.h @@ -0,0 +1,43 @@ +// Ryzom Core Studio - Tile Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 TILE_CONSTANTS_H +#define TILE_CONSTANTS_H + + +namespace TileConstants +{ + enum TTileChannel + { + TileDiffuse = 0, + TileAdditive = 1, + TileAlpha = 2, + TileChannelCount = 3 + }; + + enum TNodeTileType + { + Tile128 = 0, + Tile256 = 1, + TileTransition = 2, + TileDisplacement = 3, + TileNodeTypeCount = 4 + }; +} + + +#endif diff --git a/code/studio/src/plugins/tile_editor/tile_editor.qrc b/code/studio/src/plugins/tile_editor/tile_editor.qrc new file mode 100644 index 000000000..55950d217 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_editor.qrc @@ -0,0 +1,29 @@ + + + images/add_tile.png + images/delete_image.png + images/delete_tile.png + images/replace_image.png + + + images/ic_nel_add_item.png + images/ic_nel_new.png + images/ic_nel_open.png + images/ic_nel_save.png + images/ic_nel_save_as.png + images/down.png + images/left.png + images/reset.png + images/right.png + images/up.png + + + images/rotation0.png + images/rotation90.png + images/rotation180.png + images/rotation270.png + + + images/empty_image.png + + diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp new file mode 100644 index 000000000..4b00fb044 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.cpp @@ -0,0 +1,957 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "tile_editor_main_window.h" + +#include "nel/misc/path.h" + +#include +#include +#include +#include +#include + +#include "../core/icore.h" +#include "../core/core_constants.h" +#include "../core/menu_manager.h" + +#include "tile_model.h" +#include "tile_item.h" +#include "tile_item_delegate.h" + +#include "tilebank_saver.h" +#include "tilebank_loader.h" + +#include "land_edit_dialog.h" + +#include + +TileEditorMainWindow::TileEditorMainWindow(QWidget *parent) + : QMainWindow(parent), + m_ui(new Ui::TileEditorMainWindow) +{ + m_ui->setupUi(this); + m_undoStack = new QUndoStack(this); + + if( !TileItemNode::loadEmptyPixmap() ) + { + QTimer::singleShot( 0, this, SLOT( onEmptyImageLoadFailed() ) ); + } + + // Retrieve the menu manager + Core::ICore *core = Core::ICore::instance(); + Core::MenuManager *menuManager = core->menuManager(); + + // Create tile rotation drop down toolbar menu. + m_rotationMenu = new QMenu(tr("Rotate Tile"), m_ui->toolBar); + m_rotationMenu->setIcon(QIcon(":/tileRotation/images/rotation0.png")); + QList rotateActions; + rotateActions.push_back(m_ui->actionRotateTile0); + rotateActions.push_back(m_ui->actionRotateTile90); + rotateActions.push_back(m_ui->actionRotateTile180); + rotateActions.push_back(m_ui->actionRotateTile270); + m_rotationMenu->addActions(rotateActions); + m_ui->toolBar->addAction(m_rotationMenu->menuAction()); + m_rotateSM = new QSignalMapper(); + m_rotateAG = new QActionGroup(this); + m_rotateAG->addAction(m_ui->actionRotateTile0); + m_rotateAG->addAction(m_ui->actionRotateTile90); + m_rotateAG->addAction(m_ui->actionRotateTile180); + m_rotateAG->addAction(m_ui->actionRotateTile270); + m_ui->actionRotateTile0->setChecked( true ); + + connect( m_ui->actionRotateTile0, SIGNAL( triggered() ), m_rotateSM, SLOT( map() ) ); + connect( m_ui->actionRotateTile90, SIGNAL( triggered() ), m_rotateSM, SLOT( map() ) ); + connect( m_ui->actionRotateTile180, SIGNAL( triggered() ), m_rotateSM, SLOT( map() ) ); + connect( m_ui->actionRotateTile270, SIGNAL( triggered() ), m_rotateSM, SLOT( map() ) ); + m_rotateSM->setMapping( m_ui->actionRotateTile0, 0 ); + m_rotateSM->setMapping( m_ui->actionRotateTile90, 1 ); + m_rotateSM->setMapping( m_ui->actionRotateTile180, 2 ); + m_rotateSM->setMapping( m_ui->actionRotateTile270, 3 ); + connect( m_rotateSM, SIGNAL( mapped( int ) ), this, SLOT( onRotate( int ) ) ); + + // Create the tile zoom menu. + m_zoomMenu = new QMenu(tr("Zoom"), m_ui->toolBar); + m_zoomActionGroup = new QActionGroup(this); + m_zoomSignalMapper = new QSignalMapper(this); + QList zoomActions; + zoomActions.push_back(m_ui->actionZoom50); + zoomActions.push_back(m_ui->actionZoom100); + zoomActions.push_back(m_ui->actionZoom200); + m_zoomActionGroup->addAction(m_ui->actionZoom50); + m_zoomActionGroup->addAction(m_ui->actionZoom100); + m_zoomActionGroup->addAction(m_ui->actionZoom200); + m_zoomMenu->addActions(zoomActions); + m_ui->toolBar->addAction(m_zoomMenu->menuAction()); + + m_tileEditorMenu = new QMenu(tr("Tile Editor"), core->menuManager()->menuBar()); + m_tileDisplayMenu = new QMenu(tr("Tile Display"), m_ui->toolBar); + QList displayActions; + displayActions.push_back(m_ui->actionTileDisplayFilename); + displayActions.push_back(m_ui->actionTileDisplayIndex); + m_ui->actionTileDisplayIndex->setChecked(true); + m_tileDisplayMenu->addActions(displayActions); + m_tileEditorMenu->addMenu(m_tileDisplayMenu); + core->menuManager()->menuBar()->addMenu(m_tileEditorMenu); + + // Set up the list views. + m_tileItemDelegate = new TileItemDelegate(); + + // Set up the tile set list view. + //m_ui->tileSetLV->setModel(m_model); + //m_ui->tileSetLV->setRootIndex(m_model->index(0,0)); + + connect(m_ui->tileSetAddTB, SIGNAL(clicked()), this, SLOT(onTileSetAdd())); + connect(m_ui->tileSetDeleteTB, SIGNAL(clicked()), this, SLOT(onTileSetDelete())); + connect(m_ui->tileSetEditTB, SIGNAL(clicked()), this, SLOT(onTileSetEdit())); + + connect(m_ui->landAddTB, SIGNAL(clicked()), this, SLOT(onLandAdd())); + connect(m_ui->landRemoveTB, SIGNAL(clicked()), this, SLOT(onLandRemove())); + connect(m_ui->landEditTB, SIGNAL(clicked()), this, SLOT(onLandEdit())); + + connect(m_ui->chooseVegetPushButton, SIGNAL(clicked()), this, SLOT(onChooseVegetation())); + connect(m_ui->resetVegetPushButton, SIGNAL(clicked()), this, SLOT(onResetVegetation())); + + connect(m_ui->tileBankTexturePathPB, SIGNAL(clicked()), this, SLOT(onChooseTexturePath())); + + m_tileModel = createTileModel(); + m_ui->tileSetLV->setModel( m_tileModel ); + + // 128x128 List View + //m_ui->listView128->setItemDelegate(m_tileItemDelegate); + m_ui->listView128->setModel( m_tileModel ); + m_ui->listView128->addAction(m_ui->actionAddTile); + m_ui->listView128->addAction(m_ui->actionDeleteTile); + m_ui->listView128->addAction(m_ui->actionReplaceImage); + m_ui->listView128->addAction(m_ui->actionDeleteImage); + + // 256x256 List View + //m_ui->listView256->setItemDelegate(m_tileItemDelegate); + m_ui->listView256->setModel( m_tileModel ); + m_ui->listView256->addAction(m_ui->actionAddTile); + m_ui->listView256->addAction(m_ui->actionDeleteTile); + m_ui->listView256->addAction(m_ui->actionReplaceImage); + m_ui->listView256->addAction(m_ui->actionDeleteImage); + + // Transition List View + //m_ui->listViewTransition->setItemDelegate(m_tileItemDelegate); + m_ui->listViewTransition->setModel( m_tileModel ); + m_ui->listViewTransition->addAction(m_ui->actionReplaceImage); + m_ui->listViewTransition->addAction(m_ui->actionDeleteImage); + + // Displacement List View + //m_ui->listViewDisplacement->setItemDelegate(m_tileItemDelegate); + m_ui->listViewDisplacement->setModel( m_tileModel ); + m_ui->listViewDisplacement->addAction(m_ui->actionReplaceImage); + m_ui->listViewDisplacement->addAction(m_ui->actionDeleteImage); + + + // Connect context menu actions up. + connect(m_ui->actionAddTile, SIGNAL(triggered(bool)), this, SLOT(onActionAddTile(bool))); + connect(m_ui->actionDeleteTile, SIGNAL(triggered(bool)), this, SLOT(onActionDeleteTile(bool))); + connect(m_ui->actionReplaceImage, SIGNAL(triggered(bool)), this, SLOT(onActionReplaceImage(bool))); + connect(m_ui->actionDeleteImage, SIGNAL(triggered(bool)), this, SLOT(onActionDeleteImage(bool))); + + //connect(m_ui->tileViewTabWidget, SIGNAL(currentChanged(int)), m_tileItemDelegate, SLOT(currentTab(int))); + connect( m_ui->tileSetLV->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), + this, SLOT( changeActiveTileSet( const QModelIndex &, const QModelIndex & ) ) ); + + // Connect the zoom buttons. + connect(m_ui->actionZoom50, SIGNAL(triggered()), m_zoomSignalMapper, SLOT(map())); + m_zoomSignalMapper->setMapping(m_ui->actionZoom50, 0); + connect(m_ui->actionZoom100, SIGNAL(triggered()), m_zoomSignalMapper, SLOT(map())); + m_zoomSignalMapper->setMapping(m_ui->actionZoom100, 1); + connect(m_ui->actionZoom200, SIGNAL(triggered()), m_zoomSignalMapper, SLOT(map())); + m_zoomSignalMapper->setMapping(m_ui->actionZoom200, 2); + connect(m_zoomSignalMapper, SIGNAL(mapped(int)), this, SLOT(onZoomFactor(int))); + + QAction *saveAction = Core::ICore::instance()->menuManager()->action( Core::Constants::SAVE ); + saveAction->setEnabled( true ); + QAction *saveAsAction = Core::ICore::instance()->menuManager()->action( Core::Constants::SAVE_AS ); + saveAsAction->setEnabled( true ); + QAction *openAction = Core::ICore::instance()->menuManager()->action( Core::Constants::OPEN ); + openAction->setEnabled( true ); + + connect( m_ui->actionSaveTileBank, SIGNAL( triggered() ), this, SLOT( save() ) ); + connect( m_ui->actionSaveTileBankAs, SIGNAL( triggered() ), this, SLOT( saveAs() ) ); + connect( m_ui->actionOpenTileBank, SIGNAL( triggered() ), this, SLOT( open() ) ); + + connect( m_ui->orientedCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onOrientedStateChanged( int ) ) ); + connect( m_ui->surfaceDataLineEdit, SIGNAL( textEdited( const QString& ) ), this, SLOT( onSurfaceDataChanged( const QString& ) ) ); + + connect( m_ui->diffuse128BT, SIGNAL( toggled( bool ) ), this, SLOT( onDiffuseToggled( bool ) ) ); + connect( m_ui->diffuse256BT, SIGNAL( toggled( bool ) ), this, SLOT( onDiffuseToggled( bool ) ) ); + connect( m_ui->diffuseTrBT, SIGNAL( toggled( bool ) ), this, SLOT( onDiffuseToggled( bool ) ) ); + connect( m_ui->additive128BT, SIGNAL( toggled( bool ) ), this, SLOT( onAdditiveToggled( bool ) ) ); + connect( m_ui->additive256BT, SIGNAL( toggled( bool ) ), this, SLOT( onAdditiveToggled( bool ) ) ); + connect( m_ui->additiveTrBT, SIGNAL( toggled( bool ) ), this, SLOT( onAdditiveToggled( bool ) ) ); + connect( m_ui->alphaTrBT, SIGNAL( toggled( bool ) ), this, SLOT( onAlphaToggled( bool ) ) ); + + connect( m_ui->tileViewTabWidget, SIGNAL( currentChanged( int ) ), this, SLOT( onTabChanged( int ) ) ); + +} + +TileEditorMainWindow::~TileEditorMainWindow() +{ + delete m_ui; + delete m_undoStack; + delete m_rotationMenu; + delete m_rotateSM; + delete m_rotateAG; + + delete m_tileDisplayMenu; + delete m_tileEditorMenu; + + delete m_zoomMenu; + delete m_zoomActionGroup; + delete m_zoomSignalMapper; + + delete m_tileModel; + m_tileModel = NULL; +} + +void TileEditorMainWindow::save() +{ + if( m_fileName.isEmpty() ) + saveAs(); + else + saveAs( m_fileName ); +} + +void TileEditorMainWindow::saveAs() +{ + QString fn = QFileDialog::getSaveFileName( this, + tr( "Save TileBank as..." ), + "", + tr( "TileBank files (*.tilebank)" ) ); + + if( fn.isEmpty() ) + return; + + saveAs( fn ); + +} + +void TileEditorMainWindow::saveAs( const QString &fn ) +{ + QList< QString > landNames; + + int c = m_ui->landLW->count(); + for( int i = 0; i < c; i++ ) + { + QListWidgetItem *item = m_ui->landLW->item( i ); + landNames.push_back( item->text() ); + } + + TileBankSaver saver; + bool ok = saver.save( fn.toUtf8().constData(), m_tileModel ); + + if( !ok ) + { + QMessageBox::critical( this, + tr( "Saving tilebank" ), + tr( "Failed to save tilebank :(" ) ); + } +} + +void TileEditorMainWindow::open() +{ + QString fn = QFileDialog::getOpenFileName( this, + tr( "Loading tilebank" ), + m_lastOpenDir, + tr( "tilebank files (*.tilebank)" ) ); + + if( fn.isEmpty() ) + return; + + TileBankLoader loader; + bool b = loader.load( fn.toUtf8().constData(), m_tileModel ); + + if( !b ) + { + QMessageBox::critical( this, + tr( "Loading tilebank" ), + tr( "Failed to load tilebank %1" ).arg( fn ) ); + } + + // Put the loaded data into the GUI + onTileBankLoaded(); + + m_fileName = fn; + + int idx = fn.lastIndexOf( '/' ); + m_lastOpenDir = fn.left( idx ); +} + +void TileEditorMainWindow::onZoomFactor(int level) +{ + int tile128Scaled=TileModel::TILE_128_BASE_SIZE; + int tile256Scaled=TileModel::TILE_256_BASE_SIZE; + int tileTransScaled=TileModel::TILE_TRANSITION_BASE_SIZE; + int tileDispScaled=TileModel::TILE_DISPLACE_BASE_SIZE; + switch(level) + { + // Zoom Level 50% + case 0: + nlinfo("zooming to 50%"); + TileModel::CurrentZoomFactor = TileModel::TileZoom50; + tile128Scaled /= 2; + tile256Scaled /= 2; + tileTransScaled /= 2; + tileDispScaled /= 2; + break; + case 1: + nlinfo("zooming to 100%"); + TileModel::CurrentZoomFactor = TileModel::TileZoom100; + break; + case 2: + nlinfo("zooming to 200%"); + TileModel::CurrentZoomFactor = TileModel::TileZoom200; + tile128Scaled *= 2; + tile256Scaled *= 2; + tileTransScaled *= 2; + tileDispScaled *= 2; + break; + default: + nlwarning("Invalid Time Zoom Factor passed."); + break; + }; + + nlinfo("resizing transition view. base size: %d factor %d to: %d", TileModel::TILE_TRANSITION_BASE_SIZE, level, tileTransScaled); + + m_ui->listView128->setIconSize(QSize(tile128Scaled, tile128Scaled)); + m_ui->listView128->setCurrentIndex(m_ui->listView128->model()->index(0, 0, m_ui->listView128->rootIndex())); + m_ui->listView256->setIconSize(QSize(tile256Scaled, tile256Scaled)); + m_ui->listView256->setCurrentIndex(m_ui->listView256->model()->index(0, 0, m_ui->listView256->rootIndex())); + m_ui->listViewTransition->setIconSize(QSize(tileTransScaled, tileTransScaled)); + m_ui->listViewTransition->setCurrentIndex(m_ui->listViewTransition->model()->index(0, 0, m_ui->listViewTransition->rootIndex())); + m_ui->listViewDisplacement->setIconSize(QSize(tileDispScaled, tileDispScaled)); + m_ui->listViewDisplacement->setCurrentIndex(m_ui->listViewDisplacement->model()->index(0, 0, m_ui->listViewDisplacement->rootIndex())); + m_ui->listViewTransition->repaint(); +} + +void TileEditorMainWindow::onRotate( int id ) +{ + m_tileModel->setAlphaRot( id ); +} + +void TileEditorMainWindow::onEmptyImageLoadFailed() +{ + QMessageBox::critical( this, + tr( "Empty image load failed" ), + tr( "Couldn't load the image for empty tiles :(" ) ); +} + +void TileEditorMainWindow::onActionAddTile(bool triggered) +{ + onActionAddTile(m_ui->tileViewTabWidget->currentIndex()); +} + +void TileEditorMainWindow::onActionDeleteTile(bool triggered) +{ + onActionDeleteTile(m_ui->tileViewTabWidget->currentIndex()); +} + +void TileEditorMainWindow::onActionReplaceImage(bool triggered) +{ + onActionReplaceImage(m_ui->tileViewTabWidget->currentIndex()); +} + +void TileEditorMainWindow::onActionDeleteImage(bool triggered) +{ + onActionDeleteImage(m_ui->tileViewTabWidget->currentIndex()); +} + +void TileEditorMainWindow::onTileSetAdd() +{ + bool ok; + QString text = QInputDialog::getText(this, tr("Add Tile Set"), tr("Enter Tile Set name:"), QLineEdit::Normal, "", &ok); + if (ok && !text.isEmpty()) + { + TileModel *model = static_cast(m_ui->tileSetLV->model()); + + if( model->hasTileSet( text ) ) + { + QMessageBox::information( this, tr("Error Adding Tile Set"), tr("This name already exists") ); + return; + } + + // Create and append the new tile set to the model. + m_tileModel->addTileSet( text ); + + // Retrieve how many rows there currently are and set the current index using that. + uint32 rows = model->rowCount(); + m_ui->tileSetLV->setCurrentIndex(model->index(rows-1, 0)); + } +} + +void TileEditorMainWindow::onTileSetDelete() +{ + QModelIndex idx = m_ui->tileSetLV->currentIndex(); + if( !idx.isValid() ) + return; + + int reply = QMessageBox::question( this, + tr( "Removing tile set" ), + tr( "Are you sure you want to remove this tile set?" ), + QMessageBox::Yes | QMessageBox::Cancel ); + + if( reply != QMessageBox::Yes ) + return; + + QString set = reinterpret_cast< TileSetNode* >( idx.internalPointer() )->getTileSetName(); + + m_tileModel->removeTileSet( idx.row() ); +} + +void TileEditorMainWindow::onTileSetEdit() +{ + QModelIndex idx = m_ui->tileSetLV->currentIndex(); + if( !idx.isValid() ) + return; + + TileSetNode *node = reinterpret_cast< TileSetNode* >( idx.internalPointer() ); + QString name = node->getTileSetName(); + + bool ok = false; + + QString newName = QInputDialog::getText( this, + tr( "Edit tileset" ), + tr( "Enter tileset name" ), + QLineEdit::Normal, + name, + &ok ); + + if( !ok ) + return; + + TileModel *model = static_cast(m_ui->tileSetLV->model()); + if( model->hasTileSet( newName ) ) + { + QMessageBox::information( this, + tr("Tileset already exists"), + tr("A tileset with that name already exists!") ); + return; + } + + QString oldName = node->getTileSetName(); + node->setTileSetName( newName ); + m_ui->tileSetLV->reset(); + + m_tileModel->renameTileSet( idx.row(), newName ); +} + +void TileEditorMainWindow::onLandAdd() +{ + QString name = QInputDialog::getText( this, + tr("Adding new land"), + tr("Please specify the new land's name") ); + + if( name.isEmpty() ) + return; + + for( int i = 0; i < m_ui->landLW->count(); i++ ) + { + QListWidgetItem *item = m_ui->landLW->item( i ); + if( item->text() == name ) + { + QMessageBox::information( this, + tr( "Error adding new land" ), + tr( "A land with that name already exists." ) ); + return; + } + } + + m_ui->landLW->addItem( name ); + + m_tileModel->addLand( name ); +} + +void TileEditorMainWindow::onLandRemove() +{ + QListWidgetItem *item = m_ui->landLW->currentItem(); + if( item == NULL ) + return; + + int idx = m_ui->landLW->currentRow(); + + int reply = QMessageBox::question( this, + tr( "Removing land" ), + tr( "Are you sure you want to remove this land?" ), + QMessageBox::Yes | QMessageBox::Cancel ); + + if( reply != QMessageBox::Yes ) + return; + + delete item; + + m_tileModel->removeLand( idx ); +} + +void TileEditorMainWindow::onLandEdit() +{ + QListWidgetItem *item = m_ui->landLW->currentItem(); + if( item == NULL ) + return; + + QStringList ts; + int c = m_tileModel->rowCount(); + for( int i = 0; i < c; i++ ) + { + QModelIndex idx = m_tileModel->index( i, 0 ); + if( !idx.isValid() ) + continue; + + TileSetNode *n = reinterpret_cast< TileSetNode* >( idx.internalPointer() ); + ts.push_back( n->getTileSetName() ); + } + + int r = m_ui->landLW->currentRow(); + + QStringList sts; + m_tileModel->getLandSets( r, sts ); + + LandEditDialog d; + d.setSelectedTileSets( sts ); + d.setTileSets( ts ); + int result = d.exec(); + + if( result != QDialog::Accepted ) + return; + + // Update the tileset of the land + sts.clear(); + d.getSelectedTileSets( sts ); + + m_tileModel->setLandSets( r, sts ); +} + +void TileEditorMainWindow::onChooseVegetation() +{ + QModelIndex idx = m_ui->tileSetLV->currentIndex(); + if( !idx.isValid() ) + { + QMessageBox::information( this, + tr("Choosing a vegetation set"), + tr("You need to select a tileset before choosing a vegetation set!") ); + return; + } + + QString vegetSet = QFileDialog::getOpenFileName( this, + tr( "Choose vegetation set" ), + "", + tr( "Nel vegetset files (*.vegetset)" ) ); + + if( vegetSet.isEmpty() ) + return; + + m_tileModel->setVegetation( idx.row(), vegetSet ); + + m_ui->chooseVegetPushButton->setText( vegetSet ); +} + +void TileEditorMainWindow::onResetVegetation() +{ + QModelIndex idx = m_ui->tileSetLV->currentIndex(); + if( !idx.isValid() ) + { + QMessageBox::information( this, + tr("Resetting a vegetation set"), + tr("You need to select a tileset before resetting a vegetation set!") ); + return; + } + m_ui->chooseVegetPushButton->setText( "..." ); + + m_tileModel->setVegetation( idx.row(), "" ); +} + +void TileEditorMainWindow::onChooseTexturePath() +{ + QString path = QFileDialog::getExistingDirectory( this, + tr("Choose tilebank absolute texture path "), + "" ); + + if( path.isEmpty() ) + return; + + int reply = QMessageBox::question( this, + tr("tilebank texture path"), + tr("Are you sure you want to make '%1' the tilebank absolute texture path?").arg( path ), + QMessageBox::Yes | QMessageBox::Cancel ); + + if( reply != QMessageBox::Yes ) + return; + + m_texturePath = path; + m_ui->tileBankTexturePathPB->setText( path ); + m_tileModel->setTexturePath( path ); +} + +void TileEditorMainWindow::onOrientedStateChanged( int state ) +{ + QModelIndex idx = m_ui->tileSetLV->currentIndex(); + if( !idx.isValid() ) + return; + + int row = idx.row(); + + if( state == Qt::Checked ) + m_tileModel->setOriented( row, true ); + else + m_tileModel->setOriented( row, false ); +} + +void TileEditorMainWindow::onSurfaceDataChanged( const QString &text ) +{ + QModelIndex idx = m_ui->tileSetLV->currentIndex(); + if( !idx.isValid() ) + return; + + bool ok = false; + unsigned long data = text.toUInt( &ok ); + if( !ok ) + return; + + m_tileModel->setSurfaceData( idx.row(), data ); +} + +void TileEditorMainWindow::onDiffuseToggled( bool b ) +{ + if( !b ) + return; + + TileItemNode::setDisplayChannel( TileConstants::TileDiffuse ); + updateTab(); +} + +void TileEditorMainWindow::onAdditiveToggled( bool b ) +{ + if( !b ) + return; + + TileItemNode::setDisplayChannel( TileConstants::TileAdditive ); + updateTab(); +} + +void TileEditorMainWindow::onAlphaToggled( bool b ) +{ + if( !b ) + return; + + TileItemNode::setDisplayChannel( TileConstants::TileAlpha ); + updateTab(); +} + +void TileEditorMainWindow::onTabChanged( int tab ) +{ + if( tab == -1 ) + return; + + m_ui->diffuse128BT->setChecked( true ); + m_ui->diffuse256BT->setChecked( true ); + m_ui->diffuseTrBT->setChecked( true ); +} + +TileConstants::TNodeTileType tabToType( int tabId ) +{ + if( tabId >= TileConstants::TileNodeTypeCount ) + return TileConstants::TileNodeTypeCount; + + return TileConstants::TNodeTileType( tabId ); +} + +void TileEditorMainWindow::onActionAddTile(int tabId) +{ + QModelIndex idx = m_ui->tileSetLV->currentIndex(); + if( !idx.isValid() ) + { + QMessageBox::information( this, + tr( "Adding new tiles" ), + tr( "You need to have a tileset selected before you can add tiles!" ) ); + return; + } + + int tileSet = idx.row(); + + idx = m_tileModel->index( tileSet, 0 ); + if( !idx.isValid() ) + return; + + int setId = idx.row(); + + TileSetNode *tsn = reinterpret_cast< TileSetNode* >( idx.internalPointer() ); + + Node *n = tsn->child( tabId ); + + QFileDialog::Options options; + QString selectedFilter; + QStringList fileNames = QFileDialog::getOpenFileNames(this, "Choose Tile Texture", m_lastTileDir , "Images (*.png);;All Files (*.*)", &selectedFilter, options); + if( fileNames.empty() ) + return; + + TileConstants::TNodeTileType type = tabToType( tabId ); + + QStringListIterator itr( fileNames ); + QString error; + + while( itr.hasNext() ) + { + bool b = m_tileModel->addTile( setId, type, itr.next(), TileConstants::TileDiffuse ); + + if( !b ) + { + if( m_tileModel->hasError() ) + error = m_tileModel->getLastError(); + + int reply = QMessageBox::question( this, + tr( "Error adding tile" ), + error + "\nContinue?", + QMessageBox::Yes, QMessageBox::No ); + if( reply != QMessageBox::Yes ) + break; + else + continue; + } + + } + + QModelIndex rootIdx = m_tileModel->index( tabId, 0, m_ui->tileSetLV->currentIndex()); + + QListView *lv = getListViewByTab( tabId ); + + lv->reset(); + lv->setRootIndex( rootIdx ); + lv->setCurrentIndex( lv->model()->index( 0, 0, rootIdx ) ); + + QString fn = fileNames[ 0 ].replace( '\\', '/' ); + int slashIdx = fn.lastIndexOf( '/' ); + m_lastTileDir = fn.left( slashIdx ); +} + +void TileEditorMainWindow::onActionDeleteTile( int tabId ) +{ + QListView *lv = getListViewByTab( tabId ); + + QModelIndex idx = lv->currentIndex(); + if( !idx.isValid() ) + { + QMessageBox::information( this, + tr( "Deleting a tile" ), + tr( "You need to select a tile to delete is!" ) ); + return; + } + + QModelIndex tsidx = m_ui->tileSetLV->currentIndex(); + if( !tsidx.isValid() ) + return; + int ts = tsidx.row(); + int tile = idx.row(); + + m_tileModel->removeTile( ts, tabId, tile ); +} + +void TileEditorMainWindow::onActionDeleteImage( int tabId ) +{ + QListView *lv = getListViewByTab( tabId ); + + QModelIndex idx = lv->currentIndex(); + if( !idx.isValid() ) + { + QMessageBox::information( this, + tr( "Deleting tile image" ), + tr( "No tile selected!" ) ); + return; + } + + QModelIndex tsidx = m_ui->tileSetLV->currentIndex(); + if( !tsidx.isValid() ) + return; + int ts = tsidx.row(); + + TileItemNode *n = reinterpret_cast< TileItemNode* >( idx.internalPointer() ); + int tile = n->id(); + + m_tileModel->clearImage( ts, tabId, tile, TileItemNode::displayChannel() ); +} + +void TileEditorMainWindow::onActionReplaceImage( int tabId ) +{ + QListView *lv = getListViewByTab( tabId ); + + QModelIndex tsidx = m_ui->tileSetLV->currentIndex(); + if( !tsidx.isValid() ) + return; + int set = tsidx.row(); + + QModelIndex idx = lv->currentIndex(); + if( !idx.isValid() ) + { + QMessageBox::information( this, + tr( "Replacing tile image" ), + tr( "No tile selected!" ) ); + return; + } + + QString fileName = QFileDialog::getOpenFileName( this, + tr( "Select tile image" ), + m_lastTileDir, + tr( "PNG files (*.png)" ) ); + if( fileName.isEmpty() ) + return; + + TileItemNode *n = reinterpret_cast< TileItemNode* >( idx.internalPointer() ); + int tile = n->id(); + + m_tileModel->replaceImage( set, tabId, tile, TileItemNode::displayChannel(), fileName ); + if( m_tileModel->hasError() ) + { + QString error = m_tileModel->getLastError(); + QMessageBox::information( this, + tr( "Error replacing tile image" ), + error ); + } + + QString fn = fileName.replace( '\\', '/' ); + int slashIdx = fn.lastIndexOf( '/' ); + m_lastTileDir = fn.left( slashIdx ); + + updateTab(); +} + +void TileEditorMainWindow::onTileBankLoaded() +{ + m_ui->landLW->clear(); + QStringList lands; + m_tileModel->getLands( lands ); + QStringListIterator itr( lands ); + while( itr.hasNext() ) + { + m_ui->landLW->addItem( itr.next() ); + } + + m_tileModel->onTBLoaded(); + + m_ui->listView128->reset(); + m_ui->listView256->reset(); + m_ui->listViewTransition->reset(); + + QString path = m_tileModel->getTexturePath(); + if( path.isEmpty() ) + m_ui->tileBankTexturePathPB->setText( "..." ); + else + m_ui->tileBankTexturePathPB->setText( path ); + + QModelIndex idx = m_tileModel->index( 0, 0 ); + if( idx.isValid() ) + m_ui->tileSetLV->setCurrentIndex( idx ); + + if( m_ui->landLW->count() > 0 ) + m_ui->landLW->setCurrentRow( 0 ); +} + +void TileEditorMainWindow::updateTab() +{ + int idx = m_ui->tileViewTabWidget->currentIndex(); + + switch( idx ) + { + case 0: m_ui->listView128->viewport()->repaint(); break; + case 1: m_ui->listView256->viewport()->repaint(); break; + case 2: m_ui->listViewTransition->viewport()->repaint(); break; + case 3: m_ui->listViewDisplacement->viewport()->repaint(); break; + } +} + +TileModel* TileEditorMainWindow::createTileModel() +{ + QStringList headers; + headers << "Tile Set"; + TileModel *m = new TileModel( headers ); + + connect( m_ui->actionTileDisplayFilename, SIGNAL( toggled( bool )), m, SLOT( selectFilenameDisplay( bool ) ) ); + connect( m_ui->actionTileDisplayIndex, SIGNAL( toggled( bool )), m, SLOT( selectIndexDisplay( bool ) ) ); + + return m; +} + +void TileEditorMainWindow::changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex) +{ + TileModel *model = static_cast(m_ui->tileSetLV->model()); + + QModelIndex tile128Idx = model->index(0, 0, newIndex); + QModelIndex tile256Idx = model->index(1, 0, newIndex); + QModelIndex tileTransIdx = model->index(2, 0, newIndex); + QModelIndex tileDispIdx = model->index(3, 0, newIndex); + + m_ui->listView128->setRootIndex(tile128Idx); + m_ui->listView128->setCurrentIndex(m_ui->listView128->model()->index(0, 0, m_ui->listView128->rootIndex())); + m_ui->listView256->setRootIndex(tile256Idx); + m_ui->listView256->setCurrentIndex(m_ui->listView256->model()->index(0, 0, m_ui->listView256->rootIndex())); + m_ui->listViewTransition->setRootIndex(tileTransIdx); + m_ui->listViewTransition->setCurrentIndex(m_ui->listViewTransition->model()->index(0, 0, m_ui->listViewTransition->rootIndex())); + m_ui->listViewDisplacement->setRootIndex(tileDispIdx); + m_ui->listViewDisplacement->setCurrentIndex(m_ui->listViewDisplacement->model()->index(0, 0, m_ui->listViewDisplacement->rootIndex())); + + TileSetNode *oldNode = NULL; + TileSetNode *newNode = NULL; + + if( oldIndex.isValid() ) + oldNode = reinterpret_cast< TileSetNode* >( oldIndex.internalPointer() ); + if( newIndex.isValid() ) + newNode = reinterpret_cast< TileSetNode* >( newIndex.internalPointer() ); + + if( newIndex.isValid() ) + { + QString vegetSet = m_tileModel->getVegetation( newIndex.row() ); + + if( !vegetSet.isEmpty() ) + m_ui->chooseVegetPushButton->setText( vegetSet ); + else + m_ui->chooseVegetPushButton->setText( "..." ); + + m_ui->orientedCheckBox->setChecked( m_tileModel->getOriented( newIndex.row() ) ); + m_ui->surfaceDataLineEdit->setText( QString::number( m_tileModel->getSurfaceData( newIndex.row() ) ) ); + } + else + { + m_ui->chooseVegetPushButton->setText( "..." ); + } + + //nlinfo("number of rows in displacement: %d", tileDispIdx.model()->rowCount(tileDispIdx)); + + //m_ui->listView128->reset(); + //m_ui->listView256->reset(); + //m_ui->listViewTransition->reset(); + //m_ui->listViewDisplacement->reset(); +} + + +QListView* TileEditorMainWindow::getListViewByTab( int tab ) const +{ + QListView *lv = NULL; + + switch( tab ) + { + case TAB_128: lv = m_ui->listView128; break; + case TAB_256: lv = m_ui->listView256; break; + case TAB_TRANSITION: lv = m_ui->listViewTransition; break; + case TAB_DISPLACEMENT: lv = m_ui->listViewDisplacement; break; + } + + return lv; +} + + diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.h b/code/studio/src/plugins/tile_editor/tile_editor_main_window.h new file mode 100644 index 000000000..d06d6deca --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.h @@ -0,0 +1,131 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 TILE_EDITOR_MAIN_WINDOW_H +#define TILE_EDITOR_MAIN_WINDOW_H + +#include "ui_tile_editor_main_window.h" + +#include "nel/misc/types_nl.h" +#include "nel/misc/sheet_id.h" + +#include +#include + +namespace Ui { + class TileEditorMainWindow; +} + +class TileModel; +class TileItemDelegate; + +class TileEditorMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit TileEditorMainWindow(QWidget *parent = 0); + ~TileEditorMainWindow(); + + QUndoStack *getUndoStack() { return m_undoStack; } + +public Q_SLOTS: + void save(); + void saveAs(); + void saveAs( const QString &fn ); + void open(); + +private Q_SLOTS: + void onActionAddTile(bool triggered); + void onActionDeleteTile(bool triggered); + void onActionReplaceImage(bool triggered); + void onActionDeleteImage(bool triggered); + + void onTileSetAdd(); + void onTileSetDelete(); + void onTileSetEdit(); + + void onLandAdd(); + void onLandRemove(); + void onLandEdit(); + + void onResetVegetation(); + void onChooseVegetation(); + + void onChooseTexturePath(); + + void onOrientedStateChanged( int state ); + void onSurfaceDataChanged( const QString &text ); + + void onDiffuseToggled( bool b ); + void onAdditiveToggled( bool b ); + void onAlphaToggled( bool b ); + + void onTabChanged( int tab ); + + void changeActiveTileSet(const QModelIndex &newIndex, const QModelIndex &oldIndex); + void onZoomFactor(int level); + void onRotate(int id); + + void onEmptyImageLoadFailed(); + +private: + void onActionAddTile(int tabId); + void onActionDeleteTile(int tabId); + void onActionDeleteImage(int tabId); + void onActionReplaceImage(int tabId); + + void onTileBankLoaded(); + + void updateTab(); + + TileModel* createTileModel(); + QListView* getListViewByTab( int tab ) const; + + Ui::TileEditorMainWindow *m_ui; + QUndoStack *m_undoStack; + QMenu *m_rotationMenu; + + QMenu *m_tileDisplayMenu; + QMenu *m_tileEditorMenu; + + QMenu *m_zoomMenu; + QActionGroup *m_zoomActionGroup; + QSignalMapper *m_zoomSignalMapper; + QActionGroup *m_rotateAG; + QSignalMapper *m_rotateSM; + + TileItemDelegate *m_tileItemDelegate; + + TileModel *m_tileModel; + + QString m_texturePath; + + enum Tabs + { + TAB_128 = 0, + TAB_256 = 1, + TAB_TRANSITION = 2, + TAB_DISPLACEMENT = 3, + TAB_DETAILS = 4 + }; + + QString m_fileName; + QString m_lastOpenDir; + QString m_lastTileDir; +}; + +#endif // TILE_EDITOR_MAIN_WINDOW_H diff --git a/code/studio/src/plugins/tile_editor/tile_editor_main_window.ui b/code/studio/src/plugins/tile_editor/tile_editor_main_window.ui new file mode 100644 index 000000000..08d14ca79 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_editor_main_window.ui @@ -0,0 +1,748 @@ + + + TileEditorMainWindow + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + + 0 + + + + 128x128 + + + + + + Qt::ActionsContextMenu + + + + 128 + 128 + + + + QListView::LeftToRight + + + true + + + QListView::IconMode + + + true + + + + + + + Edit Channel + + + + + + Diffuse + + + true + + + + + + + Additive + + + + + + + + + + + 256x256 + + + + + + Qt::ActionsContextMenu + + + + 256 + 256 + + + + QListView::LeftToRight + + + true + + + QListView::IconMode + + + true + + + + + + + Edit Channel + + + + + + Diffuse + + + true + + + true + + + + + + + Additive + + + + + + + + + + + Transition + + + + + + Qt::ActionsContextMenu + + + + 64 + 64 + + + + QListView::Static + + + QListView::LeftToRight + + + true + + + QListView::Adjust + + + QListView::SinglePass + + + QListView::IconMode + + + true + + + + + + + Edit Channel + + + + + + Diffuse + + + true + + + + + + + Additive + + + + + + + Alpha + + + + + + + + + + + Displacement + + + + + + Qt::ActionsContextMenu + + + + 32 + 32 + + + + QListView::Static + + + QListView::LeftToRight + + + true + + + QListView::Fixed + + + QListView::IconMode + + + false + + + + + + + + Tile Set Details + + + + + + Qt::LeftToRight + + + Oriented + + + + + + + + + + Surface Data: + + + + + + + Vegetation Set: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + ... + + + + + + + Reset + + + + :/newPrefix/reset.png:/newPrefix/reset.png + + + + + + + + + + + + + Tile Editor Tool Bar + + + TopToolBarArea + + + false + + + + + + + + + Tile Bank + + + 1 + + + + + + + Lands + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + ... + + + + :/movementIcons/images/ic_nel_add_item.png:/movementIcons/images/ic_nel_add_item.png + + + + + + + ... + + + + :/movementIcons/images/reset.png:/movementIcons/images/reset.png + + + + + + + ... + + + + :/movementIcons/images/ic_nel_open.png:/movementIcons/images/ic_nel_open.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Tile Sets + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + ... + + + + :/movementIcons/images/ic_nel_add_item.png:/movementIcons/images/ic_nel_add_item.png + + + + + + + ... + + + + :/movementIcons/images/reset.png:/movementIcons/images/reset.png + + + + + + + ... + + + + :/movementIcons/images/ic_nel_open.png:/movementIcons/images/ic_nel_open.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Tile Bank Texture Path + + + + + + + + + + + + ... + + + + + + + + + + + + + + + :/movementIcons/images/ic_nel_open.png:/movementIcons/images/ic_nel_open.png + + + Open Tile Bank + + + Open Tile Bank + + + + + true + + + + :/tileRotation/images/rotation0.png:/tileRotation/images/rotation0.png + + + 0 + + + Rotate Tile 0 Degrees + + + + + + :/movementIcons/images/ic_nel_save.png:/movementIcons/images/ic_nel_save.png + + + Save Tile Bank + + + Save Tile Bank + + + + + + :/movementIcons/images/ic_nel_save_as.png:/movementIcons/images/ic_nel_save_as.png + + + Save Tile Bank As... + + + Save Tile Bank As... + + + + + true + + + + :/tileRotation/images/rotation90.png:/tileRotation/images/rotation90.png + + + 90 + + + Rotate Tile 90 Degrees + + + + + true + + + + :/tileRotation/images/rotation180.png:/tileRotation/images/rotation180.png + + + 180 + + + Rotate Tile180 Degrees + + + + + true + + + + :/tileRotation/images/rotation270.png:/tileRotation/images/rotation270.png + + + 270 + + + Rotate Tile 270 Degrees + + + + + Batch Load + + + Batch Load + + + + + Import Border + + + Import Border + + + + + Export Border + + + Export Border + + + + + true + + + true + + + Index + + + Display Tile Index + + + + + true + + + true + + + Filename + + + Display Tile Filename + + + + + + :/tileTools/images/add_tile.png:/tileTools/images/add_tile.png + + + Add Tile + + + Add Tile + + + + + + :/tileTools/images/delete_tile.png:/tileTools/images/delete_tile.png + + + Delete Tile + + + Delete Tile + + + + + + :/tileTools/images/replace_image.png:/tileTools/images/replace_image.png + + + Replace Image + + + Replace Image + + + + + + :/tileTools/images/delete_image.png:/tileTools/images/delete_image.png + + + Delete Image + + + Delete Image + + + + + true + + + Zoom 50% + + + + + true + + + true + + + Zoom 100% + + + + + true + + + Zoom 200% + + + + + + + + + diff --git a/code/studio/src/plugins/tile_editor/tile_editor_plugin.cpp b/code/studio/src/plugins/tile_editor/tile_editor_plugin.cpp new file mode 100644 index 000000000..33a617cc1 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_editor_plugin.cpp @@ -0,0 +1,78 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "tile_editor_plugin.h" +#include "tile_editor_main_window.h" +#include "../core/icore.h" +#include "../core/menu_manager.h" +#include "../core/core_constants.h" + +// Qt includes +#include +#include +#include +#include +#include +#include + +// NeL includes +#include "nel/misc/debug.h" + +using namespace TileEditorPluginQt; + +TileEditorPlugin::~TileEditorPlugin() +{ + Q_FOREACH(QObject *obj, m_autoReleaseObjects) + { + m_plugMan->removeObject(obj); + } + qDeleteAll(m_autoReleaseObjects); + m_autoReleaseObjects.clear(); + + delete m_LibContext; + m_LibContext = NULL; +} + +bool TileEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) +{ + Q_UNUSED(errorString); + m_plugMan = pluginManager; + addAutoReleasedObject(new TileEditorContext()); + return true; +} + +void TileEditorPlugin::extensionsInitialized() +{ +} + +void TileEditorPlugin::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 TileEditorPlugin::addAutoReleasedObject(QObject *obj) +{ + m_plugMan->addObject(obj); + m_autoReleaseObjects.prepend(obj); +} + +Q_EXPORT_PLUGIN(TileEditorPlugin) diff --git a/code/studio/src/plugins/tile_editor/tile_editor_plugin.h b/code/studio/src/plugins/tile_editor/tile_editor_plugin.h new file mode 100644 index 000000000..70fb38e77 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_editor_plugin.h @@ -0,0 +1,120 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 TILE_EDITOR_PLUGIN_H +#define TILE_EDITOR_PLUGIN_H + +#include "../../extension_system/iplugin.h" +#include "../core/icontext.h" + +#include "nel/misc/app_context.h" + +#include "tile_editor_main_window.h" + +#include + +namespace NLMISC +{ +class CLibraryContext; +} + +namespace TileEditorPluginQt +{ + +class TileEditorPlugin : public QObject, public ExtensionSystem::IPlugin +{ + Q_OBJECT + Q_INTERFACES(ExtensionSystem::IPlugin) +public: + + ~TileEditorPlugin(); + + bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); + void extensionsInitialized(); + void setNelContext(NLMISC::INelContext *nelContext); + + void addAutoReleasedObject(QObject *obj); + +protected: + NLMISC::CLibraryContext *m_LibContext; + +private: + ExtensionSystem::IPluginManager *m_plugMan; + QList m_autoReleaseObjects; + +}; + +class TileEditorContext: public Core::IContext +{ + Q_OBJECT +public: + TileEditorContext(QObject *parent = 0) : IContext(parent) + { + m_tileEditorMainWindow = new TileEditorMainWindow(); + } + + virtual ~TileEditorContext() + { + m_tileEditorMainWindow = NULL; + } + + virtual QString id() const + { + return QLatin1String("TileEditor"); + } + + virtual QString trName() const + { + return tr("Tile Editor"); + } + + virtual QIcon icon() const + { + return QIcon(":/tileRotation/images/rotation0.png"); + } + + virtual QUndoStack *undoStack() + { + return m_tileEditorMainWindow->getUndoStack(); + } + + virtual void open() + { + m_tileEditorMainWindow->open(); + } + + void save() + { + m_tileEditorMainWindow->save(); + } + + void saveAs() + { + m_tileEditorMainWindow->saveAs(); + } + + virtual QWidget *widget() + { + return m_tileEditorMainWindow; + } + +private: + TileEditorMainWindow *m_tileEditorMainWindow; +}; + +} // namespace TileEditorPluginQt + +#endif // TILE_EDITOR_PLUGIN_H diff --git a/code/studio/src/plugins/tile_editor/tile_images.h b/code/studio/src/plugins/tile_editor/tile_images.h new file mode 100644 index 000000000..e17267001 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_images.h @@ -0,0 +1,40 @@ +// Ryzom Core Studio - Tile Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 TILE_IMAGES_H +#define TILE_IMAGES_H + +#include + +struct TileImages +{ + QString diffuse; + QString additive; + QString alpha; + + void clear() + { + diffuse.clear(); + additive.clear(); + alpha.clear(); + } +}; + + + +#endif + diff --git a/code/studio/src/plugins/tile_editor/tile_item.cpp b/code/studio/src/plugins/tile_editor/tile_item.cpp new file mode 100644 index 000000000..71fe336a2 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_item.cpp @@ -0,0 +1,422 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 + +#include "tile_item.h" + +#include + +Node::Node() : m_parentItem(0) +{ +} + +Node::Node(const QVector &data, Node *parent) +{ + m_parentItem = parent; + m_itemData = data; +} + +Node::~Node() +{ + qDeleteAll(m_childItems); + m_childItems.clear(); +} + +void Node::appendChild(Node *item) +{ + item->setParent( this ); + m_childItems.append(item); +} + +Node *Node::child(int row) +{ + //nlinfo("row %d and size %d", row, childItems.size()); + return m_childItems.value(row); +} + +int Node::childCount() const +{ + return m_childItems.count(); +} + +int Node::childNumber() const +{ + if(m_parentItem) + return m_parentItem->m_childItems.indexOf(const_cast(this)); + return 0; +} + +bool Node::insertChildren(int position, int count, int columns) +{ + if(position<0 || position>m_childItems.size()) + return false; + + for(int row = 0; row < count; row++) + { + QVector data(columns); + Node *item = new Node(data, this); + m_childItems.insert(position, item); + } + + return true; +} + +bool Node::removeChildren(int position, int count) +{ + if(position<0 || position+count>m_childItems.size()) + return false; + + for(int row=0; row m_itemData.size()) + return false; + + for(int column=0; columninsertColumns(position, columns); + + return true; +} + +int Node::row() const +{ + if(m_parentItem) + return m_parentItem->m_childItems.indexOf(const_cast(this)); + + return 0; +} + +int Node::columnCount() const +{ + return m_itemData.count(); +} + +QVariant Node::data(int column, int role) const +{ + if(role == Qt::DisplayRole || + role == TileModel::TileFilenameIndexRole || + role == TileModel::TileFilenameRole || + role == TileModel::TileIndexRole) + return m_itemData.value(column); + return QVariant(); +} + +bool Node::setData(int column, const QVariant &value) +{ + if(column < 0 || column >= m_itemData.size()) + return false; + + m_itemData[column] = value; + return true; +} + +Node *Node::parent() +{ + return m_parentItem; +} + +void Node::setParent(Node *parent) +{ + m_parentItem = parent; +} + +void Node::appendRow(const QList &items) +{ + Q_FOREACH(Node *item, items) + appendRow(item); +} + +void Node::appendRow(Node *item) +{ + item->setParent(this); + m_childItems.append(item); +} + +void Node::swapRows( int a, int b ) +{ + Node *temp = m_childItems[ a ]; + m_childItems[ a ] = m_childItems[ b ]; + m_childItems[ b ] = temp; +} + +void Node::clear() +{ + qDeleteAll( m_childItems ); + m_childItems.clear(); + m_itemData.clear(); +} + +/////////////////////////////////////////////////// + +TileSetNode::TileSetNode(QString tileSetName, Node *parent) : m_tileSetName(tileSetName) +{ + m_parentItem = parent; +} + +TileSetNode::~TileSetNode() +{ + qDeleteAll(m_childItems); + m_childItems.clear(); +} + +QVariant TileSetNode::data(int column, int role) const +{ + if(role == Qt::DisplayRole || + role == TileModel::TileFilenameIndexRole || + role == TileModel::TileFilenameRole || + role == TileModel::TileIndexRole) + return QVariant(m_tileSetName); + return QVariant(); +} + +int TileSetNode::columnCount() const +{ + return 1; +} + +/////////////////////////////////////////////////// + +TileTypeNode::TileTypeNode(TileConstants::TNodeTileType type, Node *parent) : m_nodeTileType(type) +{ + m_parentItem = parent; +} + +TileTypeNode::~TileTypeNode() +{ + qDeleteAll(m_childItems); + m_childItems.clear(); +} + +QVariant TileTypeNode::data(int column, int role) const +{ + if(role == Qt::DisplayRole || + role == TileModel::TileFilenameIndexRole || + role == TileModel::TileFilenameRole || + role == TileModel::TileIndexRole) + return QVariant(TileModel::getTileTypeName(m_nodeTileType)); + return QVariant(); + +} + +int TileTypeNode::columnCount() const +{ + return 1; +} + +TileConstants::TNodeTileType TileTypeNode::getTileType() +{ + return m_nodeTileType; +} + +bool TileTypeNode::removeChildren( int position, int count ) +{ + bool ok = Node::removeChildren( position, count ); + if( !ok ) + return false; + + reindex(); + + return true; +} + +void TileTypeNode::reindex() +{ + int i = 0; + + QListIterator< Node* > itr( m_childItems ); + while( itr.hasNext() ) + { + TileItemNode *n = dynamic_cast< TileItemNode* >( itr.next() ); + if( n == NULL ) + continue; + + n->setId( i ); + + i++; + } +} + + +/////////////////////////////////////////////////// + +class TileItemNodePvt +{ +public: + + TileItemNodePvt() + { + } + + bool loadImage( TileConstants::TTileChannel channel, const QString &fn ) + { + if( fn.isEmpty() ) + { + pixmaps[ channel ] = TileItemNodePvt::emptyPm(); + return true; + } + + QPixmap temp; + bool b = temp.load( fn ); + + if( !b ) + { + return false; + } + + pixmaps[ channel ] = temp; + + return true; + } + + static bool loadEmptyImage() + { + bool b = empty.load( ":/placeHolder/images/empty_image.png" ); + if( !b ) + { + empty = QPixmap(); + } + + return b; + } + + void clearImage( TileConstants::TTileChannel channel ) + { + pixmaps[ channel ] = QPixmap(); + } + + const QPixmap& pixMap( TileConstants::TTileChannel channel ) const{ + return pixmaps[ channel ]; + } + + static QPixmap& emptyPm(){ return empty; } + +private: + QPixmap pixmaps[ TileConstants::TileChannelCount ]; + static QPixmap empty; + +}; + +QPixmap TileItemNodePvt::empty = QPixmap(); +TileConstants::TTileChannel TileItemNode::s_displayChannel = TileConstants::TileDiffuse; + +TileItemNode::TileItemNode( TileConstants::TNodeTileType type, int tileId, Node *parent ) +{ + m_id = tileId; + m_parentItem = parent; + pvt = new TileItemNodePvt(); + + for( int i = 0; i < TileConstants::TileChannelCount; i++ ) + { + setTileFilename( TileConstants::TTileChannel( i ), "" ); + } +} + +TileItemNode::~TileItemNode() +{ + delete pvt; + pvt = NULL; + + qDeleteAll(m_childItems); +} + +bool TileItemNode::setTileFilename(TileConstants::TTileChannel channel, QString filename) +{ + bool b = pvt->loadImage( channel, filename ); + if( !b ) + return false; + + m_tileFilename[channel] = filename; + return true; +} + +QString TileItemNode::getTileFilename(TileConstants::TTileChannel channel) +{ + QMap< TileConstants::TTileChannel, QString >::const_iterator itr + = m_tileFilename.find( channel ); + if( itr == m_tileFilename.end() ) + return ""; + + return itr.value(); +} + +bool TileItemNode::loadEmptyPixmap() +{ + return TileItemNodePvt::loadEmptyImage(); +} + +QVariant TileItemNode::data(int column, int role) const +{ + QString tileFilename = m_tileFilename[ TileItemNode::s_displayChannel ]; + + if(role == TileModel::TilePixmapRole || role == Qt::DecorationRole) + { + TileTypeNode *parent = dynamic_cast(m_parentItem); + if(parent == NULL) + return QVariant(); + + // Retrieve the target tile size. + uint32 tileSize = TileModel::getTileTypeSize(parent->getTileType()); + + if(TileModel::CurrentZoomFactor == TileModel::TileZoom200) + tileSize *= 2; + else if(TileModel::CurrentZoomFactor == TileModel::TileZoom50) + tileSize /= 2; + + QPixmap pixmap = pvt->pixMap( TileItemNode::s_displayChannel ); + + pixmap = pixmap.scaled(tileSize, tileSize); + + return pixmap; + } + else if(role == Qt::DisplayRole) + { + return QVariant(tileFilename); + } + else if(role == TileModel::TileFilenameRole) + { + return QVariant(tileFilename); + } + else if(role == TileModel::TileIndexRole) + { + return QVariant("("+QString::number(m_id)+")"); + } + else if(role == TileModel::TileFilenameIndexRole) + { + return QVariant(tileFilename + " ("+QString::number(m_id)+")"); + } + + return QVariant(); +} + +int TileItemNode::columnCount() const +{ + return 1; +} + +QVariant TileItemNode::pixmap( TileConstants::TTileChannel channel ) const +{ + return pvt->pixMap( channel ); +} + diff --git a/code/studio/src/plugins/tile_editor/tile_item.h b/code/studio/src/plugins/tile_editor/tile_item.h new file mode 100644 index 000000000..5387a710d --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_item.h @@ -0,0 +1,136 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 TILE_ITEM_H +#define TILE_ITEM_H + +#include "nel/misc/types_nl.h" + +#include +#include + +#include "tile_model.h" + +namespace NL3D +{ + class CTileBorder; +} + +class TileWidget; + +class Node +{ +public: + Node(); + Node(const QVector &data, Node *parent=0); + virtual ~Node(); + + void appendChild(Node *child); + + Node *child(int row); + int childCount() const; + int childNumber() const; + virtual int columnCount() const; + bool setData(int column, const QVariant &value); + virtual QVariant data(int column, int role) const; + + bool insertChildren(int position, int count, int columns); + virtual bool removeChildren(int position, int count); + bool insertColumns(int position, int columns); + + int row() const; + Node *parent(); + void setParent(Node *parent); + + void appendRow(const QList &items); + void appendRow(Node *item); + + void swapRows( int a, int b ); + + void clear(); + +protected: + QList m_childItems; + QVector m_itemData; + Node *m_parentItem; +}; + +class TileSetNode : public Node +{ +public: + TileSetNode(QString tileSetName, Node *parent=0); + virtual ~TileSetNode(); + QVariant data(int column, int role) const; + int columnCount() const; + + const QString &getTileSetName(){ return m_tileSetName; } + void setTileSetName( const QString &name ){ m_tileSetName = name; } + +private: + QString m_tileSetName; +}; + +class TileTypeNode : public Node +{ +public: + + TileTypeNode(TileConstants::TNodeTileType type, Node *parent=0); + virtual ~TileTypeNode(); + QVariant data(int column, int role) const; + int columnCount() const; + + TileConstants::TNodeTileType getTileType(); + + bool removeChildren( int position, int count ); + +private: + void reindex(); + TileConstants::TNodeTileType m_nodeTileType; +}; + +class TileItemNodePvt; + +class TileItemNode : public Node +{ +public: + TileItemNode( TileConstants::TNodeTileType type, int tileId, Node *parent=0); + virtual ~TileItemNode(); + QVariant data(int column, int role) const; + int columnCount() const; + bool setTileFilename(TileConstants::TTileChannel channel, QString filename); + QString getTileFilename(TileConstants::TTileChannel channel); + void setId( int id ){ m_id = id; } + int id() const{ return m_id; } + + static void setDisplayChannel( TileConstants::TTileChannel channel ){ s_displayChannel = channel; } + static TileConstants::TTileChannel displayChannel(){ return s_displayChannel; } + static bool loadEmptyPixmap(); + + QVariant pixmap( TileConstants::TTileChannel channel ) const; + +private: + QMap m_tileFilename; + QMap m_tileWidget; + + static TileConstants::TTileChannel s_displayChannel; + + int m_id; + + TileItemNodePvt *pvt; + +}; + +#endif // TILE_ITEM_H diff --git a/code/studio/src/plugins/tile_editor/tile_item_delegate.cpp b/code/studio/src/plugins/tile_editor/tile_item_delegate.cpp new file mode 100644 index 000000000..43751d612 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_item_delegate.cpp @@ -0,0 +1,122 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 + +#include + +#include "tile_item_delegate.h" + +#include "tile_model.h" + +TileItemDelegate::TileItemDelegate() +{ + m_zoomFactor = ZoomNormal; + m_imageHint = 128; +} + +TileItemDelegate::~TileItemDelegate() +{ +} + +void TileItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + QStyledItemDelegate::paint(painter,option,index); + + painter->save(); + + QFont font = QApplication::font(); + + //font.setBold(true); + //SubFont.setWeight(SubFont.weight()-2); + QFontMetrics fm(font); + + QPixmap tile = qvariant_cast(index.data(TileModel::TilePixmapRole)); + QString tileFileText = qvariant_cast(index.data(TileModel::TileFilenameRole)); + QString tileIdText = qvariant_cast(index.data(TileModel::TileIndexRole)); + + QSize tileSize = tile.size(); + + //QRect headerRect = option.rect; + QRect rect(option.rect); + //QRect tileRect(option.rect); + int textHeight = fm.height(); + int iconPosModX = PIXMAP_MARGIN + (tile.width() / 2); + int iconPosModY = (option.rect.height() - tile.height()) / 2; + + painter->drawPixmap(rect.adjusted(iconPosModX, iconPosModY, iconPosModX, iconPosModY).topLeft(), tile); + + + + //tileRect.setRight(tileSize.width()+30); + //tileRect.setTop(tileRect.top()+5); + //headerRect.setLeft(tileRect.right()); + //subheaderRect.setLeft(tileRect.right()); + //headerRect.setTop(headerRect.top()+5); + //headerRect.setBottom(headerRect.top()+fm.height()); + + //subheaderRect.setTop(headerRect.bottom()+2); + + //painter->drawPixmap(targetrect, pixmap, sourcerect) + + //painter->drawPixmap(QPoint(iconRect.right()/2,iconRect.top()/2),icon.pixmap(iconsize.width(),iconsize.height())); + //painter->drawPixmap(QPoint(tileRect.left()+tileSize.width()/2+2,tileRect.top()+tileSize.height()/2+3),tile); + + //painter->setFont(font); + //painter->drawText(headerRect,headerText); + + + //painter->setFont(SubFont); + //painter->drawText(subheaderRect.left(),subheaderRect.top()+17,subText); + + painter->restore(); +} + +QSize TileItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index ) const +{ + QPixmap tile = qvariant_cast(index.data(TileModel::TilePixmapRole)); + QSize tileSize = tile.size(); + QFont font = QApplication::font(); + QFontMetrics fm(font); + + return(QSize(tileSize.width()+(2*PIXMAP_MARGIN), tileSize.height()+fm.height()+(2*PIXMAP_MARGIN))); +} + +TileItemDelegate::TZoomFactor TileItemDelegate::getZoomFactor() +{ + return m_zoomFactor; +} + +void TileItemDelegate::setZoomFactor(TileItemDelegate::TZoomFactor zoomFactor) +{ + m_zoomFactor = zoomFactor; +} + +// SLOTS + +void TileItemDelegate::currentTab(int index) +{ + if(index == 1) + { + nlinfo("switching delegate to 1 or 256"); + m_imageHint = 256; + } + else + { + nlinfo("switching delegate to 0,2,3 or 128"); + m_imageHint = 128; + } +} \ No newline at end of file diff --git a/code/studio/src/plugins/tile_editor/tile_item_delegate.h b/code/studio/src/plugins/tile_editor/tile_item_delegate.h new file mode 100644 index 000000000..015f32021 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_item_delegate.h @@ -0,0 +1,55 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 TILE_ITEM_DELEGATE_H +#define TILE_ITEM_DELEGATE_H + +#include +#include +#include + +#include + +class TileItemDelegate : public QStyledItemDelegate + { + public: + + enum TZoomFactor + { + ZoomSmall = 0, + ZoomNormal = 1, + ZoomLarge = 2 + }; + + static const int PIXMAP_MARGIN = 5; + + TileItemDelegate(); + virtual ~TileItemDelegate(); + + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index ) const; + + TZoomFactor getZoomFactor(); + void setZoomFactor(TZoomFactor zoomFactor); + +public Q_SLOTS: + void currentTab(int index); + + private: + TZoomFactor m_zoomFactor; + int m_imageHint; + }; + +#endif // TILE_ITEM_DELEGATE_H diff --git a/code/studio/src/plugins/tile_editor/tile_model.cpp b/code/studio/src/plugins/tile_editor/tile_model.cpp new file mode 100644 index 000000000..2af4c6a84 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_model.cpp @@ -0,0 +1,564 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "tile_model.h" +#include "tile_item.h" +#include "tile_bank.h" + +#include + +#include + +// Initialize the static members +TileModel::TTileZoomFactor TileModel::CurrentZoomFactor; + +TileModel::TileModel(const QStringList &headers, QObject *parent) : QAbstractItemModel(parent) +{ + QVector rootData; + Q_FOREACH(QString header, headers) + rootData << header; + + rootItem = new Node(rootData); + + TileModel::CurrentZoomFactor = TileModel::TileZoom100; + m_indexDisplay = true; + m_fileDisplay = true; + + m_tileBank = new TileBank(); +} + +TileModel::~TileModel() +{ + delete rootItem; +} + +Node *TileModel::getItem(const QModelIndex &index) const +{ + if(index.isValid()) + { + Node *item = static_cast(index.internalPointer()); + if(item) return item; + } + return rootItem; +} + +QModelIndex TileModel::index(int row, int column, const QModelIndex &parent) const +{ + if(parent.isValid() && parent.column() != 0) + return QModelIndex(); + + Node *parentItem = getItem(parent); + + Node *childItem = parentItem->child(row); + if(childItem) + return createIndex(row, column, childItem); + else + return QModelIndex(); +} + +QModelIndex TileModel::parent(const QModelIndex &index) const +{ + if(!index.isValid()) + return QModelIndex(); + + Node *childItem = getItem(index); + Node *parentItem = childItem->parent(); + + if(parentItem == rootItem) + return QModelIndex(); + + return createIndex(parentItem->childNumber(), 0, parentItem); +} + +int TileModel::rowCount(const QModelIndex &parent) const +{ + Node *parentItem = getItem(parent); + return parentItem->childCount(); +} + +int TileModel::columnCount(const QModelIndex &parent) const +{ + Node *parentItem = getItem(parent); + return parentItem->columnCount(); +} + +QVariant TileModel::data(const QModelIndex &index, int role) const +{ + if(!index.isValid()) + return QVariant(); + + Node *item = static_cast(index.internalPointer()); + + // Translate the display role to the settings-specific role. + + if(role == Qt::DisplayRole) + { + if(m_indexDisplay && m_fileDisplay) + role = TileFilenameIndexRole; + else if(m_fileDisplay) + role = TileFilenameRole; + else if(m_indexDisplay) + role = TileIndexRole; + } + return item->data(index.column(), role); +} + +Qt::ItemFlags TileModel::flags(const QModelIndex &index) const +{ + if(!index.isValid()) + return Qt::ItemIsEnabled; + + return Qt::ItemIsEnabled|Qt::ItemIsSelectable; +} + +QVariant TileModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if(orientation == Qt::Horizontal && role == Qt::DisplayRole) + return rootItem->data(section,role); + + return QVariant(); +} + +void TileModel::appendRow(const QList &items) +{ + rootItem->appendRow(items); +} + + +void TileModel::appendRow(Node *item) +{ + int c = rootItem->childCount(); + + beginInsertRows( QModelIndex(), c, c ); + + rootItem->appendRow(item); + + endInsertRows(); +} + +bool TileModel::removeRows( int row, int count, const QModelIndex &parent ) +{ + Node *parentNode = NULL; + + if( !parent.isValid() ) + parentNode = rootItem; + else + parentNode = getItem( parent ); + + if( parentNode == NULL ) + return false; + + int c = parentNode->childCount(); + if( row + count > c ) + return false; + + beginRemoveRows( parent, row, row + count - 1 ); + + bool ok = parentNode->removeChildren( row, count ); + + endRemoveRows(); + + return ok; +} + +void TileModel::swapRows( int a, int b ) +{ + rootItem->swapRows( a, b ); +} + +TileSetNode *TileModel::createTileSetNode(QString tileSetName) +{ + // Create the new tile set. + TileSetNode *tileSet = new TileSetNode(tileSetName); + + // child for 128x128 tiles + TileTypeNode *tile128= new TileTypeNode( TileConstants::Tile128); + tileSet->appendRow(tile128); + + // child for 256x256 tiles + TileTypeNode *tile256= new TileTypeNode( TileConstants::Tile256); + tileSet->appendRow(tile256); + + // child for transition tiles. + TileTypeNode *tileTrans= new TileTypeNode( TileConstants::TileTransition); + tileSet->appendRow(tileTrans); + + // Add the default transition tiles. + // TODO tie this to CTileSet::count from NeL + for(int transPos=0; transPos<48; transPos++) + { + TileItemNode *transTile= new TileItemNode( TileConstants::TileTransition, transPos ); + tileTrans->appendRow(transTile); + } + + // child for displacement tiles + TileTypeNode *tileDisp= new TileTypeNode( TileConstants::TileDisplacement); + tileSet->appendRow(tileDisp); + + // Add the default displacement tiles. + // TODO tie this to CTileSet::CountDisplace from NeL + for(int dispPos=0; dispPos<16; dispPos++) + { + TileItemNode *dispTile= new TileItemNode( TileConstants::TileDisplacement, dispPos ); + tileDisp->appendRow(dispTile); + } + + // Append them in the correct order to the tile set. + this->appendRow(tileSet); + + return tileSet; +} + +const char *TileModel::getTileTypeName(TileConstants::TNodeTileType type) +{ + switch(type) + { + case TileConstants::Tile128: + return "128"; + case TileConstants::Tile256: + return "256"; + case TileConstants::TileTransition: + return "Transition"; + case TileConstants::TileDisplacement: + return "Displacement"; + default: + break; + } + return "UNKNOWN"; +} + +uint32 TileModel::getTileTypeSize(TileConstants::TNodeTileType type) +{ + switch(type) + { + case TileConstants::Tile128: + return 128; + case TileConstants::Tile256: + return 256; + case TileConstants::TileTransition: + return 64; + case TileConstants::TileDisplacement: + return 32; + default: + break; + } + return 0; +} + +bool TileModel::hasTileSet( const QString &name ) +{ + for( int i = 0; i < rowCount(); i++ ) + { + QModelIndex idx = index( i, 0 ); + if( !idx.isValid() ) + { + continue; + } + + TileSetNode *n = reinterpret_cast< TileSetNode* >( idx.internalPointer() ); + if( n->getTileSetName() == name ) + return true; + } + + return false; +} + +void TileModel::clear() +{ + int c = rootItem->childCount(); + if( c == 0 ) + return; + + removeRows( 0, c ); +} + +void TileModel::onTBLoaded() +{ + clear(); + loadTileSets(); +} + + +void TileModel::addLand( const QString &name ) +{ + m_tileBank->addLand( name ); +} + +void TileModel::removeLand( int idx ) +{ + m_tileBank->removeLand( idx ); +} + +void TileModel::getLands( QStringList &l ) +{ + m_tileBank->getLands( l ); +} + +void TileModel::setLandSets( int idx, const QStringList &l ) +{ + m_tileBank->setLandSets( idx, l ); +} + +void TileModel::getLandSets( int idx, QStringList &l ) +{ + m_tileBank->getLandSets( idx, l ); +} + + +bool TileModel::addTileSet( const QString &name ) +{ + m_tileBank->addTileSet( name ); + TileSetNode *tsn = createTileSetNode( name ); + + return false; +} + +void TileModel::removeTileSet( int idx ) +{ + TileSetNode *set = static_cast< TileSetNode* >( rootItem->child( idx ) ); + if( set == NULL ) + return; + + removeRow( idx ); + + m_tileBank->removeTileSet( idx ); +} + +void TileModel::renameTileSet( int idx, const QString &newName ) +{ + m_tileBank->renameTileSet( idx, newName ); +} + +bool TileModel::addTile( int ts, int type, const QString &fileName, TileConstants::TTileChannel channel ) +{ + TileSetNode *tsn = static_cast< TileSetNode* >( rootItem->child( ts ) ); + if( tsn == NULL ) + return false; + + TileTypeNode *ttn = static_cast< TileTypeNode* >( tsn->child( type ) ); + if( ttn == NULL ) + return false; + + int tile = ttn->childCount(); + + TileConstants::TNodeTileType t = TileConstants::TNodeTileType( type ); + + TileItemNode *item = new TileItemNode( t, tile ); + item->setTileFilename( channel, fileName ); + + bool b = m_tileBank->addTile( ts, fileName, item->pixmap( channel ), channel, t ); + if( !b ) + { + delete item; + return false; + } + + item->setParent( ttn ); + ttn->appendRow( item ); + + return true; +} + +void TileModel::removeTile( int ts, int type, int tile ) +{ + TileSetNode *set = static_cast< TileSetNode* >( rootItem->child( ts ) ); + if( set == NULL ) + return; + + TileTypeNode *typeNode = static_cast< TileTypeNode* >( set->child( type ) ); + if( typeNode == NULL ) + return; + + TileItemNode *tileNode = static_cast< TileItemNode* >( typeNode->child( tile ) ); + if( tileNode == NULL ) + return; + + QModelIndex tileIdx = createIndex( tile, 0, tileNode ); + removeRow( tile, tileIdx.parent() ); + + m_tileBank->removeTile( ts, type, tile ); +} + +bool TileModel::replaceImage( int ts, int type, int tile, TileConstants::TTileChannel channel, const QString &name ) +{ + Node *set = rootItem->child( ts ); + Node *tn = set->child( type ); + Node *n = tn->child( tile ); + + TileItemNode *tin = static_cast< TileItemNode* >( n ); + QString old = tin->getTileFilename( channel ); + + bool b = tin->setTileFilename( channel, name ); + if( !b ) + return false; + + m_tileBank->replaceImage( ts, type, tile, channel, name, tin->pixmap( channel ) ); + if( m_tileBank->hasError() ) + { + tin->setTileFilename( channel, old ); + return false; + } + + return true; +} + +void TileModel::clearImage( int ts, int type, int tile, TileConstants::TTileChannel channel ) +{ + Node *set = rootItem->child( ts ); + Node *tn = set->child( type ); + Node *n = tn->child( tile ); + + TileItemNode *tin = static_cast< TileItemNode* >( n ); + tin->setTileFilename( channel, "" ); + + m_tileBank->clearImage( ts, type, tile, channel ); +} + +void TileModel::setVegetation( int tileSet, const QString &vegetation ) +{ + m_tileBank->setVegetation( tileSet, vegetation ); +} + +QString TileModel::getVegetation( int tileSet ) const +{ + return m_tileBank->getVegetation( tileSet ); +} + +void TileModel::setOriented( int tileSet, bool b ) +{ + m_tileBank->setOriented( tileSet, b ); +} + +bool TileModel::getOriented( int tileSet ) const +{ + return m_tileBank->getOriented( tileSet ); +} + +void TileModel::setSurfaceData( int tileSet, unsigned long data ) +{ + m_tileBank->setSurfaceData( tileSet, data ); +} + +unsigned long TileModel::getSurfaceData( int tileSet ) const +{ + return m_tileBank->getSurfaceData( tileSet ); +} + +void TileModel::setTexturePath( const QString &path ) +{ + m_tileBank->setTexturePath( path ); +} + +void TileModel::serial( NLMISC::IStream &f ) +{ + m_tileBank->serial( f ); +} + +QString TileModel::getTexturePath() const +{ + return m_tileBank->getTexturePath(); +} + +void TileModel::setAlphaRot( int rotation ) +{ + m_tileBank->setRotation( rotation ); +} + +QString TileModel::getLastError() const{ + return m_tileBank->getLastError(); +} + +bool TileModel::hasError() const +{ + return m_tileBank->hasError(); +} + +void TileModel::selectFilenameDisplay(bool selected) +{ + m_fileDisplay = selected; +} + +void TileModel::selectIndexDisplay(bool selected) +{ + m_indexDisplay = selected; +} + +void TileModel::loadTileSets() +{ + QStringList l; + m_tileBank->getTileSets( l ); + + // Create tile sets + QStringListIterator itr( l ); + while( itr.hasNext() ) + { + createTileSetNode( itr.next() ); + } + + // Loads sets + int c = rootItem->childCount(); + for( int i = 0; i < c; i++ ) + { + loadTileSet( i ); + } +} + + +void TileModel::loadTileSet( int tileSet ) +{ + TileSetNode *set = static_cast< TileSetNode* >( rootItem->child( tileSet ) ); + + QList< TileImages > l; + for( int i = TileConstants::Tile128; i < TileConstants::TileNodeTypeCount; i++ ) + { + TileConstants::TNodeTileType type = TileConstants::TNodeTileType( i ); + l.clear(); + m_tileBank->getTileImages( tileSet, type, l ); + + loadTileTypeNode( tileSet, type, l ); + } +} + +void TileModel::loadTileTypeNode( int tileSet, int type, const QList< TileImages > &l ) +{ + TileSetNode *set = static_cast< TileSetNode* >( rootItem->child( tileSet ) ); + TileTypeNode *ttn = static_cast< TileTypeNode* >( set->child( type ) ); + + int tile = 0; + + QList< TileImages >::const_iterator itr = l.begin(); + while( itr != l.end() ) + { + const TileImages &images = *itr; + + TileItemNode *item = NULL; + + if( ( type == TileConstants::Tile128 ) || ( type == TileConstants::Tile256 ) ) + item = new TileItemNode( TileConstants::TNodeTileType( type ), tile, ttn ); + else + item = static_cast< TileItemNode* >( ttn->child( tile ) ); + + item->setTileFilename( TileConstants::TileDiffuse, images.diffuse ); + item->setTileFilename( TileConstants::TileAdditive, images.additive ); + item->setTileFilename( TileConstants::TileAlpha, images.alpha ); + + if( ( type == TileConstants::Tile128 ) || ( type == TileConstants::Tile256 ) ) + ttn->appendRow( item ); + + ++itr; + tile++; + } +} diff --git a/code/studio/src/plugins/tile_editor/tile_model.h b/code/studio/src/plugins/tile_editor/tile_model.h new file mode 100644 index 000000000..c6bfc8788 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tile_model.h @@ -0,0 +1,150 @@ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 TILE_MODEL_H +#define TILE_MODEL_H + +#include "nel/misc/types_nl.h" + +#include + +#include "tile_constants.h" +#include "tile_images.h" + +namespace NLMISC +{ + class IStream; +} + +class Node; +class TileSetNode; +class TileItemNode; +class TileBank; +class TileModelPvt; + +class TileModel : public QAbstractItemModel +{ + Q_OBJECT + +public: + enum TTileItemRole + { + TilePixmapRole = Qt::UserRole+1, + TileFilenameRole = Qt::UserRole+2, + TileIndexRole = Qt::UserRole+3, + TileFilenameIndexRole = Qt::UserRole+4 + }; + + enum TTileZoomFactor + { + TileZoom50 = 0, + TileZoom100 = 1, + TileZoom200 = 2 + }; + + static const int TILE_DISPLACE_BASE_SIZE = 32; + static const int TILE_TRANSITION_BASE_SIZE = 64; + static const int TILE_128_BASE_SIZE = 128; + static const int TILE_256_BASE_SIZE = 256; + + TileModel(const QStringList &headers, QObject *parent = NULL); + ~TileModel(); + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + QModelIndex index(int row, int column, const QModelIndex &parent= QModelIndex()) const; + QModelIndex parent(const QModelIndex &index) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + + // Tile Model specific functions + void appendRow(const QList &items); + void appendRow(Node *item); + + bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() ); + + void swapRows( int a, int b ); + + static const char *getTileTypeName(TileConstants::TNodeTileType type); + static uint32 getTileTypeSize(TileConstants::TNodeTileType type); + + static TTileZoomFactor CurrentZoomFactor; + + bool hasTileSet( const QString &name ); + + void clear(); + void onTBLoaded(); + + void addLand( const QString &name ); + void removeLand( int idx ); + void getLands( QStringList &l ); + + bool addTileSet( const QString &name ); + + void removeTileSet( int idx ); + void renameTileSet( int idx, const QString &newName ); + void setLandSets( int idx, const QStringList &l ); + void getLandSets( int idx, QStringList &l ); + + bool addTile( int ts, int type, const QString &fileName, TileConstants::TTileChannel channel ); + void removeTile( int ts, int type, int tile ); + bool replaceImage( int ts, int type, int tile, TileConstants::TTileChannel channel, const QString &name ); + void clearImage( int ts, int type, int tile, TileConstants::TTileChannel channel ); + + void setVegetation( int tileSet, const QString &vegetation ); + QString getVegetation( int tileSet ) const; + + void setOriented( int tileSet, bool b ); + bool getOriented( int tileSet ) const; + + void setSurfaceData( int tileSet, unsigned long data ); + unsigned long getSurfaceData( int tileSet ) const; + + void setTexturePath( const QString &path ); + QString getTexturePath() const; + + void setAlphaRot( int rotation ); + + void serial( NLMISC::IStream &f ); + + QString getLastError() const; + bool hasError() const; + +public Q_SLOTS: + void selectFilenameDisplay(bool selected); + void selectIndexDisplay(bool selected); + +private: + TileSetNode *createTileSetNode(QString tileSetName); + Node *getItem(const QModelIndex &index) const; + void loadTileSets(); + void loadTileSet( int tileSet ); + void loadTileTypeNode( int tileSet, int type, const QList< TileImages > &l ); + + bool m_fileDisplay; + bool m_indexDisplay; + //TTileZoomFactor m_tileZoomFactor; + + //QList m_tiles; + //int m_activeEditChannel; + Node *rootItem; + + TileBank *m_tileBank; + TileModelPvt *pvt; +}; + +#endif // TILE_MODEL_H diff --git a/code/studio/src/plugins/tile_editor/tilebank_loader.cpp b/code/studio/src/plugins/tile_editor/tilebank_loader.cpp new file mode 100644 index 000000000..1aaa055f0 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tilebank_loader.cpp @@ -0,0 +1,42 @@ +// Ryzom Core Studio - Tile Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "tilebank_loader.h" + +#include "tile_model.h" +#include "nel/misc/file.h" + +TileBankLoader::TileBankLoader() +{ +} + +TileBankLoader::~TileBankLoader() +{ +} + +bool TileBankLoader::load( const char *filename, TileModel *model ) +{ + NLMISC::CIFile file; + if( !file.open( filename, false ) ) + return false; + + model->serial( file ); + + file.close(); + + return true; +} diff --git a/code/studio/src/plugins/tile_editor/tilebank_loader.h b/code/studio/src/plugins/tile_editor/tilebank_loader.h new file mode 100644 index 000000000..643cab67f --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tilebank_loader.h @@ -0,0 +1,35 @@ +// Ryzom Core Studio - Tile Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 TILEBANK_LOADER_H +#define TILEBANK_LOADER_H + +class TileModel; + +class TileBankLoader +{ +public: + TileBankLoader(); + ~TileBankLoader(); + + bool load( const char *filename, TileModel *model ); + +private: +}; + + +#endif + diff --git a/code/studio/src/plugins/tile_editor/tilebank_saver.cpp b/code/studio/src/plugins/tile_editor/tilebank_saver.cpp new file mode 100644 index 000000000..3f087c979 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tilebank_saver.cpp @@ -0,0 +1,48 @@ +// Ryzom Core Studio - Tile Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "tilebank_saver.h" +#include "tile_model.h" +#include "tile_item.h" + +#include "nel/3d/tile_bank.h" +#include "nel/misc/file.h" + +TileBankSaver::TileBankSaver() +{ +} + +TileBankSaver::~TileBankSaver() +{ +} + +bool TileBankSaver::save( const char *fileName, TileModel* model ) +{ + // Save to file + NLMISC::COFile f; + bool b = f.open( fileName, false, false, false ); + if( !b ) + return false; + + model->serial( f ); + + f.flush(); + f.close(); + + return true; +} + diff --git a/code/studio/src/plugins/tile_editor/tilebank_saver.h b/code/studio/src/plugins/tile_editor/tilebank_saver.h new file mode 100644 index 000000000..0f8983157 --- /dev/null +++ b/code/studio/src/plugins/tile_editor/tilebank_saver.h @@ -0,0 +1,39 @@ +// Ryzom Core Studio - Tile Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 TILEBANK_SAVER_H +#define TILEBANK_SAVER_H + +#include +#include + +class TileModel; + +class TileBankSaver +{ +public: + TileBankSaver(); + ~TileBankSaver(); + + bool save( const char *filename, TileModel* model ); + +private: + +}; + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/CMakeLists.txt b/code/studio/src/plugins/translation_manager/CMakeLists.txt similarity index 57% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/CMakeLists.txt rename to code/studio/src/plugins/translation_manager/CMakeLists.txt index 1d96ebc77..b35c64735 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/CMakeLists.txt +++ b/code/studio/src/plugins/translation_manager/CMakeLists.txt @@ -17,6 +17,7 @@ SET(OVQT_PLUG_TRANSLATION_MANAGER_HDR translation_manager_plugin.h ftp_selection.h editor_worksheet.h editor_phrase.h + uxt_editor.h ) SET(OVQT_PLUG_TRANSLATION_MANAGER_UIS translation_manager_settings_page.ui @@ -38,29 +39,29 @@ SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC}) SOURCE_GROUP("Translation Manager Plugin" FILES ${SRC}) SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) -ADD_LIBRARY(ovqt_plugin_translation_manager MODULE ${SRC} ${OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_TRANSLATION_MANAGER_UI_HDRS}) +ADD_LIBRARY(studio_plugin_translation_manager MODULE ${SRC} ${OVQT_PLUG_TRANSLATION_MANAGER_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_TRANSLATION_MANAGER_UI_HDRS}) -TARGET_LINK_LIBRARIES(ovqt_plugin_translation_manager ovqt_plugin_core nelmisc nelligo nelgeorges ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${QT_QTNETWORK_LIBRARY} ) +TARGET_LINK_LIBRARIES(studio_plugin_translation_manager studio_plugin_core nelmisc nelligo nelgeorges ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${QT_QTNETWORK_LIBRARY} ) -NL_DEFAULT_PROPS(ovqt_plugin_translation_manager "NeL, Tools, 3D: Object Viewer Qt Plugin: Translation Manager") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_translation_manager) -NL_ADD_LIB_SUFFIX(ovqt_plugin_translation_manager) +NL_DEFAULT_PROPS(studio_plugin_translation_manager "Tools: Studio Plugin: Translation Manager") +NL_ADD_RUNTIME_FLAGS(studio_plugin_translation_manager) +NL_ADD_LIB_SUFFIX(studio_plugin_translation_manager) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) IF(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ELSE(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_translation_manager LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ENDIF(WIN32) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_translation_manager.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_translation_manager.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/README b/code/studio/src/plugins/translation_manager/README similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/README rename to code/studio/src/plugins/translation_manager/README diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.cpp b/code/studio/src/plugins/translation_manager/editor_phrase.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.cpp rename to code/studio/src/plugins/translation_manager/editor_phrase.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.h b/code/studio/src/plugins/translation_manager/editor_phrase.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_phrase.h rename to code/studio/src/plugins/translation_manager/editor_phrase.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_worksheet.cpp b/code/studio/src/plugins/translation_manager/editor_worksheet.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_worksheet.cpp rename to code/studio/src/plugins/translation_manager/editor_worksheet.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_worksheet.h b/code/studio/src/plugins/translation_manager/editor_worksheet.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/editor_worksheet.h rename to code/studio/src/plugins/translation_manager/editor_worksheet.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/extract_bot_names.cpp b/code/studio/src/plugins/translation_manager/extract_bot_names.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/extract_bot_names.cpp rename to code/studio/src/plugins/translation_manager/extract_bot_names.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/extract_bot_names.h b/code/studio/src/plugins/translation_manager/extract_bot_names.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/extract_bot_names.h rename to code/studio/src/plugins/translation_manager/extract_bot_names.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/extract_new_sheet_names.cpp b/code/studio/src/plugins/translation_manager/extract_new_sheet_names.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/extract_new_sheet_names.cpp rename to code/studio/src/plugins/translation_manager/extract_new_sheet_names.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/extract_new_sheet_names.h b/code/studio/src/plugins/translation_manager/extract_new_sheet_names.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/extract_new_sheet_names.h rename to code/studio/src/plugins/translation_manager/extract_new_sheet_names.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.cpp b/code/studio/src/plugins/translation_manager/ftp_selection.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.cpp rename to code/studio/src/plugins/translation_manager/ftp_selection.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.h b/code/studio/src/plugins/translation_manager/ftp_selection.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.h rename to code/studio/src/plugins/translation_manager/ftp_selection.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.qrc b/code/studio/src/plugins/translation_manager/ftp_selection.qrc similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.qrc rename to code/studio/src/plugins/translation_manager/ftp_selection.qrc diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.ui b/code/studio/src/plugins/translation_manager/ftp_selection.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ftp_selection.ui rename to code/studio/src/plugins/translation_manager/ftp_selection.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/images/cdtoparent.png b/code/studio/src/plugins/translation_manager/images/cdtoparent.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/images/cdtoparent.png rename to code/studio/src/plugins/translation_manager/images/cdtoparent.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/images/dir.png b/code/studio/src/plugins/translation_manager/images/dir.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/images/dir.png rename to code/studio/src/plugins/translation_manager/images/dir.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/images/file.png b/code/studio/src/plugins/translation_manager/images/file.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/images/file.png rename to code/studio/src/plugins/translation_manager/images/file.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.cpp b/code/studio/src/plugins/translation_manager/source_selection.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.cpp rename to code/studio/src/plugins/translation_manager/source_selection.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.h b/code/studio/src/plugins/translation_manager/source_selection.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.h rename to code/studio/src/plugins/translation_manager/source_selection.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.ui b/code/studio/src/plugins/translation_manager/source_selection.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/source_selection.ui rename to code/studio/src/plugins/translation_manager/source_selection.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ovqt_plugin_translation_manager.xml b/code/studio/src/plugins/translation_manager/studio_plugin_translation_manager.xml similarity index 76% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ovqt_plugin_translation_manager.xml rename to code/studio/src/plugins/translation_manager/studio_plugin_translation_manager.xml index c5574777a..261fbe65a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/ovqt_plugin_translation_manager.xml +++ b/code/studio/src/plugins/translation_manager/studio_plugin_translation_manager.xml @@ -1,5 +1,5 @@ - ovqt_plugin_translation_manager + studio_plugin_translation_manager TranslationManager 0.8 Ryzom Core diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_constants.h b/code/studio/src/plugins/translation_manager/translation_manager_constants.h similarity index 94% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_constants.h rename to code/studio/src/plugins/translation_manager/translation_manager_constants.h index d72a2b223..7ff813d40 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_constants.h +++ b/code/studio/src/plugins/translation_manager/translation_manager_constants.h @@ -21,8 +21,9 @@ namespace TranslationManager { namespace Constants { -const int ED_SHEET = 1; +const int ED_SHEET = 1; const int ED_PHRASE = 2; +const int ED_UXT = 3; const char *const WK_BOTNAMES = "bot_names_wk.txt"; const char *const WK_ITEM = "item_words_wk.txt"; @@ -32,6 +33,7 @@ const char *const WK_SPHRASE = "sphrase_words_wk.txt"; const char *const WK_PLACE = "place_words_wk.txt"; const char *const WK_CONTINENT = "place_words_wk.txt"; const char *const WK_STABLE = "place_words_wk.txt"; +const char *const WK_UXT = "wk.uxt"; } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_editor.h b/code/studio/src/plugins/translation_manager/translation_manager_editor.h similarity index 91% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_editor.h rename to code/studio/src/plugins/translation_manager/translation_manager_editor.h index fd53ba863..3ded2c3af 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_editor.h +++ b/code/studio/src/plugins/translation_manager/translation_manager_editor.h @@ -32,8 +32,8 @@ class CEditor : public QMdiSubWindow Q_OBJECT public: - CEditor(QMdiArea *parent) : QMdiSubWindow(parent) {} - CEditor() : QMdiSubWindow() {} + CEditor(QMdiArea *parent) : QMdiSubWindow(parent) { current_stack = NULL; } + CEditor() : QMdiSubWindow() { current_stack = NULL; } virtual void open(QString filename) =0; virtual void save() =0; virtual void saveAs(QString filename) =0; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp b/code/studio/src/plugins/translation_manager/translation_manager_main_window.cpp similarity index 93% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp rename to code/studio/src/plugins/translation_manager/translation_manager_main_window.cpp index 9fcb9626a..c5228fae6 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.cpp +++ b/code/studio/src/plugins/translation_manager/translation_manager_main_window.cpp @@ -41,16 +41,20 @@ #include #include +#include "uxt_editor.h" + namespace TranslationManager { CMainWindow::CMainWindow(QWidget *parent) : QMainWindow(parent) { + menu = NULL; _ui.setupUi(this); _ui.mdiArea->closeAllSubWindows(); windowMapper = new QSignalMapper(this); + m_UXTMapper = new QSignalMapper(this); connect(windowMapper, SIGNAL(mapped(QWidget *)), this, SLOT(setActiveSubWindow(QWidget *))); initialize_settings["georges"] = false; @@ -59,10 +63,53 @@ CMainWindow::CMainWindow(QWidget *parent) connect(Core::ICore::instance(), SIGNAL(changeSettings()), this, SLOT(readSettings())); readSettings(); createToolbar(); + createMenus(); m_undoStack = new QUndoStack(this); } +CMainWindow::~CMainWindow() +{ + removeMenus(); +} + +void CMainWindow::removeMenus() +{ + delete menu; + menu = NULL; +} + +void CMainWindow::createMenus() +{ + // Windows menu + Core::MenuManager *menuManager = Core::ICore::instance()->menuManager(); + QMenu *m = menuManager->menuBar()->addMenu( "Translation Manager" ); + if( m != NULL ) + { + windowMenu = m->addMenu("Window"); + + QMenu *mm = m->addMenu( "UI translation" ); + if( mm != NULL ) + { + QStringListIterator itr( languages ); + while( itr.hasNext() ) + { + QString lang = itr.next(); + QAction *a = mm->addAction( lang ); + connect( a, SIGNAL( triggered() ), m_UXTMapper, SLOT( map() ) ); + m_UXTMapper->setMapping( a, lang ); + } + + connect( m_UXTMapper, SIGNAL( mapped( QString ) ), this, SLOT( onUxtMapped( QString ) ) ); + } + + menu = m; + } + + updateWindowsList(); + connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(updateWindowsList())); +} + // Functions that will insert the plugin buttons void CMainWindow::createToolbar() { @@ -126,12 +173,8 @@ void CMainWindow::createToolbar() mergeSingleFileAct->setStatusTip(tr("Merge worksheet file from local or remote directory")); connect(mergeSingleFileAct, SIGNAL(triggered()), this, SLOT(mergeSingleFile())); - // Windows menu Core::ICore *core = Core::ICore::instance(); Core::MenuManager *menuManager = core->menuManager(); - windowMenu = menuManager->menuBar()->addMenu("Window"); - updateWindowsList(); - connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(updateWindowsList())); // Undo, Redo actions QAction *undoAction = menuManager->action(Core::Constants::UNDO); @@ -256,6 +299,7 @@ void CMainWindow::openWorkFile(QString file) if(isWorksheetEditor(file_path->filePath())) { CEditorWorksheet *new_window = new CEditorWorksheet(_ui.mdiArea); + new_window->setUndoStack( m_undoStack ); new_window->open(file_path->filePath()); new_window->activateWindow(); } @@ -519,6 +563,20 @@ void CMainWindow::mergeSingleFile() } } +void CMainWindow::onUxtMapped( QString lang ) +{ + QString path = translation_path + "/" + lang + ".uxt"; + path.replace( "\\", "/" ); + + if( getEditorByWindowFilePath( path ) != NULL ) + return; + + UXTEditor *e = new UXTEditor(); + e->open( path ); + _ui.mdiArea->addSubWindow( e ); + e->activateWindow(); +} + // Read the settings from QSettings void CMainWindow::readSettings() { @@ -533,7 +591,7 @@ void CMainWindow::readSettings() // core settings settings->beginGroup(Core::Constants::DATA_PATH_SECTION); level_design_path = settings->value(Core::Constants::LEVELDESIGN_PATH).toString(); - primitives_path = QString(Core::Constants::PRIMITIVES_PATH); //TODO + primitives_path = settings->value( Core::Constants::PRIMITIVES_PATH ).toString(); settings->endGroup(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.h b/code/studio/src/plugins/translation_manager/translation_manager_main_window.h similarity index 96% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.h rename to code/studio/src/plugins/translation_manager/translation_manager_main_window.h index c67f282e0..34f60ff19 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.h +++ b/code/studio/src/plugins/translation_manager/translation_manager_main_window.h @@ -58,7 +58,7 @@ class CMainWindow : public QMainWindow public: CMainWindow(QWidget *parent = 0); - virtual ~CMainWindow() {} + ~CMainWindow(); QUndoStack *m_undoStack; public: @@ -71,6 +71,7 @@ private: QAction *saveAsAct; QMenu *windowMenu; QSignalMapper *windowMapper; + QSignalMapper *m_UXTMapper; // config QMap initialize_settings; QList filters; @@ -90,12 +91,14 @@ private Q_SLOTS: void setActiveSubWindow(QWidget *window); void updateWindowsList(); void mergeSingleFile(); + void onUxtMapped( QString lang ); private: void openWorkFile(QString file); void updateToolbar(QMdiSubWindow *window); bool verifySettings(); void readSettings(); + void removeMenus(); void createMenus(); void createToolbar(); void initializeSettings(bool georges); @@ -105,6 +108,9 @@ private: CEditorWorksheet *getEditorByWorksheetType(const QString &type); bool isWorksheetEditor(QString filename); bool isPhraseEditor(QString filename); + + + QMenu *menu; }; class CCoreListener : public Core::ICoreListener diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.ui b/code/studio/src/plugins/translation_manager/translation_manager_main_window.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_main_window.ui rename to code/studio/src/plugins/translation_manager/translation_manager_main_window.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_plugin.cpp b/code/studio/src/plugins/translation_manager/translation_manager_plugin.cpp similarity index 96% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_plugin.cpp rename to code/studio/src/plugins/translation_manager/translation_manager_plugin.cpp index 20359ccbd..3fafc7510 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_plugin.cpp +++ b/code/studio/src/plugins/translation_manager/translation_manager_plugin.cpp @@ -48,6 +48,9 @@ TranslationManagerPlugin::~TranslationManagerPlugin() } qDeleteAll(_autoReleaseObjects); _autoReleaseObjects.clear(); + + delete _LibContext; + _LibContext = NULL; } bool TranslationManagerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_plugin.h b/code/studio/src/plugins/translation_manager/translation_manager_plugin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_plugin.h rename to code/studio/src/plugins/translation_manager/translation_manager_plugin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_settings_page.cpp b/code/studio/src/plugins/translation_manager/translation_manager_settings_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_settings_page.cpp rename to code/studio/src/plugins/translation_manager/translation_manager_settings_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_settings_page.h b/code/studio/src/plugins/translation_manager/translation_manager_settings_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_settings_page.h rename to code/studio/src/plugins/translation_manager/translation_manager_settings_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_settings_page.ui b/code/studio/src/plugins/translation_manager/translation_manager_settings_page.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/translation_manager/translation_manager_settings_page.ui rename to code/studio/src/plugins/translation_manager/translation_manager_settings_page.ui diff --git a/code/studio/src/plugins/translation_manager/uxt_editor.cpp b/code/studio/src/plugins/translation_manager/uxt_editor.cpp new file mode 100644 index 000000000..99b0b200c --- /dev/null +++ b/code/studio/src/plugins/translation_manager/uxt_editor.cpp @@ -0,0 +1,472 @@ +// Ryzom Core Studio - Translation Manager Plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "translation_manager_constants.h" +#include "uxt_editor.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "nel/misc/diff_tool.h" +#include "nel/misc/i18n.h" + +namespace +{ + +QString getLang( const QString &fn ) +{ + QString lang = fn; + int idx = lang.lastIndexOf( '/' ); + if( idx == -1 ) + return ""; + + lang = lang.mid( idx + 1 ); + idx = lang.lastIndexOf( '.' ); + if( idx == -1 ) + return ""; + + lang = lang.left( idx ); + return lang; +} + +} + +namespace TranslationManager +{ + +void markItemTranslated( QTableWidgetItem *item ) +{ + item->setBackground( QColor::fromRgb( 126, 247, 134 ) ); +} + +void markItemUntranslated( QTableWidgetItem *item ) +{ + item->setBackground( QColor::fromRgb( 247, 126, 126 ) ); +} + +class UXTEditorPvt +{ +public: + + UXTEditorPvt() + { + t = new QTableWidget(); + loadedFromWK = false; + } + + QTableWidget *t; + std::vector< STRING_MANAGER::TStringInfo > infos; + bool loadedFromWK; +}; + + +UXTEditor::UXTEditor( QMdiArea *parent ) : +CEditor( parent ) +{ + editor_type = Constants::ED_UXT; + setAttribute( Qt::WA_DeleteOnClose ); + + d_ptr = new UXTEditorPvt(); + + blockTableSignals( false ); +} + +UXTEditor::~UXTEditor() +{ + delete d_ptr; + d_ptr = NULL; +} + +void UXTEditor::open( QString filename ) +{ + std::vector< STRING_MANAGER::TStringInfo > &infos = d_ptr->infos; + QString lang = getLang( filename ); + + infos.clear(); + STRING_MANAGER::loadStringFile( filename.toUtf8().constData(), infos, false ); + + if( d_ptr->infos.size() == 0 ) + { + // The work file cannot be found, cannot proceed + if( filename.endsWith( "wk.uxt" ) ) + { + QMessageBox::critical( this, + tr( "Error opening file.." ), + tr( "There was an error opening wk.uxt" ) ); + return; + } + + int l = filename.lastIndexOf( "/" ); + if( l == -1 ) + return; + + QString fn = filename.left( l ); + fn += "/wk.uxt"; + + // The work file cannot be found, cannot proceed + STRING_MANAGER::loadStringFile( fn.toUtf8().constData(), infos, true ); + if( d_ptr->infos.size() == 0 ) + { + QMessageBox::critical( this, + tr( "Error opening Uxt file" ), + tr( "Neither the specified file nor wk.uxt could be opened." ) ); + return; + } + + d_ptr->loadedFromWK = true; + } + + blockTableSignals( true ); + + d_ptr->t->clear(); + d_ptr->t->setColumnCount( 2 ); + d_ptr->t->setRowCount( infos.size() ); + + setHeaderText( "Id", lang.toUpper() + " Text" ); + + int i = 0; + + std::vector< STRING_MANAGER::TStringInfo >::const_iterator itr = infos.begin(); + while( itr != infos.end() ) + { + const STRING_MANAGER::TStringInfo &info = *itr; + + QTableWidgetItem *name = new QTableWidgetItem( info.Identifier.c_str() ); + QTableWidgetItem *text1 = new QTableWidgetItem( info.Text.toUtf8().c_str() ); + + d_ptr->t->setItem( i, 0, name ); + d_ptr->t->setItem( i, 1, text1 ); + + if( ( info.HashValue != 0 ) && !d_ptr->loadedFromWK ) + { + markItemTranslated( name ); + markItemTranslated( text1 ); + } + else + { + markItemUntranslated( name ); + markItemUntranslated( text1 ); + } + + ++itr; + i++; + } + + d_ptr->t->resizeColumnsToContents(); + + blockTableSignals( false ); + + setWidget( d_ptr->t ); + + current_file = filename; + setWindowTitle( filename + "[*]" ); + setWindowFilePath( filename ); +} + +void UXTEditor::save() +{ + saveAs( current_file ); +} + +void UXTEditor::saveAs( QString filename ) +{ + QFile f( filename ); + if( !f.open( QIODevice::WriteOnly ) ) + return; + + QTextStream out( &f ); + + int idx = 0; + std::vector< STRING_MANAGER::TStringInfo >::const_iterator itr = d_ptr->infos.begin(); + while( itr != d_ptr->infos.end() ) + { + uint64 hash = 0; + + // If text2 is not empty we can assume the string was translated, so we store with the correct hash + // If text2 is empty, it wasn't translated so we can just use the old hash. + // Additionally, if the strings were loaded from the wk.uxt file, we use a hash of 0 so we know it was not translated + if( itr->Text2.empty() ) + { + if( d_ptr->loadedFromWK ) + hash = 0; + else + hash = itr->HashValue; + } + else + { + hash = NLMISC::CI18N::makeHash( itr->Text2 ); + } + + QString hashLine = "// HASH_VALUE "; + hashLine += QString( NLMISC::CI18N::hashToString( hash ).c_str() ).toUpper(); + hashLine += "\r\n"; + + QString idxLine = "// INDEX "; + idxLine += QString::number( idx ); + idxLine += "\r\n"; + + + QString trLine = ""; + trLine += itr->Identifier.c_str(); + trLine += "\t"; + trLine += "["; + + if( itr->Text2.empty() ) + trLine += itr->Text.toUtf8().c_str(); + else + trLine += itr->Text2.toUtf8().c_str(); + + trLine += "]"; + trLine += "\r\n"; + + QString newLine = "\r\n"; + + out << hashLine; + out << idxLine; + out << trLine; + out << newLine; + + ++itr; + idx++; + } + + f.close(); + + setWindowModified( false ); +} + +void UXTEditor::activateWindow() +{ + showMaximized(); +} + + +void UXTEditor::insertRow() +{ + blockTableSignals( true ); + + d_ptr->infos.push_back( STRING_MANAGER::TStringInfo() ); + d_ptr->t->setRowCount( d_ptr->t->rowCount() + 1 ); + int row = d_ptr->t->rowCount() - 1; + + QTableWidgetItem *item1 = new QTableWidgetItem(); + QTableWidgetItem *item2 = new QTableWidgetItem(); + d_ptr->t->setItem( row, 0, item1 ); + d_ptr->t->setItem( row, 1, item2 ); + + markRowUntranslated( row ); + + setWindowModified( true ); + + blockTableSignals( false ); +} + + +void UXTEditor::deleteRow() +{ + int r = d_ptr->t->currentRow(); + if( r < 0 ) + return; + + int answer = QMessageBox::question( this, + tr( "Deleting a row" ), + tr( "Are you sure you want to delete this row?" ), + QMessageBox::Yes, + QMessageBox::Cancel ); + if( QMessageBox::Yes != answer ) + return; + + std::vector< STRING_MANAGER::TStringInfo >::iterator itr = d_ptr->infos.begin(); + itr += r; + d_ptr->infos.erase( itr ); + + d_ptr->t->removeRow( r ); + + setWindowModified( true ); +} + +void UXTEditor::closeEvent( QCloseEvent *e ) +{ + if( isWindowModified() ) + { + int reply = QMessageBox::question( this, + tr( "Table changed" ), + tr( "The table has changed. Would you like to save your changes?" ), + QMessageBox::Yes, + QMessageBox::No + ); + + if( reply == QMessageBox::Yes ) + save(); + + } + + e->accept(); + close(); +} + +void UXTEditor::contextMenuEvent( QContextMenuEvent *e ) +{ + QMenu *menu = new QMenu( this ); + QAction *insertAction = new QAction( "Insert row", menu ); + QAction *deleteAction = new QAction( "Delete row", menu ); + QAction *markAction = new QAction( "Mark translated", menu ); + QAction *unmarkAction = new QAction( "Mark not-translated", menu ); + QAction *saveAction = new QAction( "Save", menu ); + QAction *saveAsAction = new QAction( "Save as..", menu ); + + connect( insertAction, SIGNAL( triggered( bool ) ), this, SLOT( insertRow() ) ); + connect( deleteAction, SIGNAL( triggered( bool ) ), this, SLOT( deleteRow() ) ); + connect( markAction, SIGNAL( triggered( bool ) ), this, SLOT( markTranslated() ) ); + connect( unmarkAction, SIGNAL( triggered( bool ) ), this, SLOT( markUntranslated() ) ); + connect( saveAction, SIGNAL( triggered( bool ) ), this, SLOT( onSaveClicked() ) ); + connect( saveAsAction, SIGNAL( triggered( bool ) ), this, SLOT( onSaveAsClicked() ) ); + + menu->addAction( insertAction ); + menu->addAction( deleteAction ); + menu->addAction( markAction ); + menu->addAction( unmarkAction ); + menu->addAction( saveAction ); + menu->addAction( saveAsAction ); + menu->exec( e->globalPos() ); +} + +void UXTEditor::onCellChanged( int row, int column ) +{ + QTableWidgetItem *item = d_ptr->t->item( row, column ); + STRING_MANAGER::TStringInfo &info = d_ptr->infos[ row ]; + + if( column == 0 ) + info.Identifier = item->text().toUtf8().constData(); + else + if( column == 1 ) + info.Text2 = item->text().toUtf8().constData(); + + setWindowModified( true ); + + markRowTranslated( row ); +} + +void UXTEditor::markTranslated() +{ + int r = d_ptr->t->currentRow(); + if( r < 0 ) + return; + + STRING_MANAGER::TStringInfo &info = d_ptr->infos[ r ]; + if( !info.Text2.empty() ) + return; + + info.Text2 = info.Text; + + setWindowModified( true ); + + markRowTranslated( r ); +} + +void UXTEditor::markUntranslated() +{ + int r = d_ptr->t->currentRow(); + if( r < 0 ) + return; + + STRING_MANAGER::TStringInfo &info = d_ptr->infos[ r ]; + + info.Text2.clear(); + info.HashValue = 0; + + setWindowModified( true ); + + markRowUntranslated( r ); +} + +void UXTEditor::onSaveClicked() +{ + save(); +} + +void UXTEditor::onSaveAsClicked() +{ + QString path = current_file; + int idx = path.lastIndexOf( '/' ); + if( idx < 0 ) + path = ""; + else + path = path.left( idx + 1 ); + + QString file = QFileDialog::getSaveFileName( this, + tr( "Save Uxt as.." ), + path, + tr( "Uxt files ( *.uxt)" ) ); + + if( file.isEmpty() ) + return; + + saveAs( file ); +} + +void UXTEditor::setHeaderText( const QString &id, const QString &text ) +{ + QTableWidgetItem *h1 = new QTableWidgetItem( id ); + QTableWidgetItem *h2 = new QTableWidgetItem( text ); + h1->setTextAlignment( Qt::AlignLeft ); + h2->setTextAlignment( Qt::AlignLeft ); + d_ptr->t->setHorizontalHeaderItem( 0, h1 ); + d_ptr->t->setHorizontalHeaderItem( 1, h2 ); +} + +void UXTEditor::blockTableSignals( bool block ) +{ + if( block ) + disconnect( d_ptr->t, SIGNAL( cellChanged( int, int ) ), this, SLOT( onCellChanged( int, int ) ) ); + else + connect( d_ptr->t, SIGNAL( cellChanged( int, int ) ), this, SLOT( onCellChanged( int, int ) ) ); +} + +void UXTEditor::markRowTranslated( int row ) +{ + blockTableSignals( true ); + + QTableWidgetItem *item1 = d_ptr->t->item( row, 0 ); + QTableWidgetItem *item2 = d_ptr->t->item( row, 1 ); + markItemTranslated( item1 ); + markItemTranslated( item2 ); + + blockTableSignals( false ); +} + +void UXTEditor::markRowUntranslated( int row ) +{ + blockTableSignals( true ); + + QTableWidgetItem *item1 = d_ptr->t->item( row, 0 ); + QTableWidgetItem *item2 = d_ptr->t->item( row, 1 ); + markItemUntranslated( item1 ); + markItemUntranslated( item2 ); + + blockTableSignals( false ); +} + +} diff --git a/code/studio/src/plugins/translation_manager/uxt_editor.h b/code/studio/src/plugins/translation_manager/uxt_editor.h new file mode 100644 index 000000000..b749e65e3 --- /dev/null +++ b/code/studio/src/plugins/translation_manager/uxt_editor.h @@ -0,0 +1,67 @@ +// Ryzom Core Studio - Translation Manager Plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 UXT_EDITOR_H +#define UXT_EDITOR_H + +#include "translation_manager_editor.h" + +namespace TranslationManager +{ + +class UXTEditorPvt; + +class UXTEditor : public CEditor +{ + Q_OBJECT +public: + UXTEditor( QMdiArea *parent = NULL ); + ~UXTEditor(); + + void open( QString filename ); + void save(); + void saveAs( QString filename ); + void activateWindow(); + +public Q_SLOTS: + void insertRow(); + void deleteRow(); + +protected: + void closeEvent( QCloseEvent *e ); + void contextMenuEvent( QContextMenuEvent *e ); + +private Q_SLOTS: + void onCellChanged( int row, int column ); + void markTranslated(); + void markUntranslated(); + void onSaveClicked(); + void onSaveAsClicked(); + +private: + void setHeaderText( const QString &id, const QString &text ); + void blockTableSignals( bool block = false ); + void markRowTranslated( int row ); + void markRowUntranslated( int row ); + + UXTEditorPvt *d_ptr; +}; + +} + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/CMakeLists.txt b/code/studio/src/plugins/world_editor/CMakeLists.txt similarity index 64% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/CMakeLists.txt rename to code/studio/src/plugins/world_editor/CMakeLists.txt index 150cc4c4f..441ff5d02 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/CMakeLists.txt +++ b/code/studio/src/plugins/world_editor/CMakeLists.txt @@ -20,12 +20,15 @@ SET(OVQT_PLUGIN_WORLD_EDITOR_HDR world_editor_plugin.h project_settings_dialog.h property_editor_widget.h world_editor_settings_page.h + const_string_array_property.h + const_string_array_editor.h ) SET(OVQT_PLUGIN_WORLD_EDITOR_UIS world_editor_window.ui project_settings_dialog.ui property_editor_widget.ui world_editor_settings_page.ui + const_string_array_editor.ui ) SET(OVQT_PLUGIN_WORLD_EDITOR_RCS world_editor.qrc) @@ -43,41 +46,42 @@ SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${OVQT_PLUGIN_WORLD_EDITOR_MOC_SRC} OVQT SOURCE_GROUP("World Editor Plugin" FILES ${SRC}) SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) -ADD_LIBRARY(ovqt_plugin_world_editor MODULE ${SRC} +ADD_LIBRARY(studio_plugin_world_editor MODULE ${SRC} ${OVQT_PLUGIN_WORLD_EDITOR_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUGIN_WORLD_EDITOR_UI_HDRS} ${OVQT_PLUGIN_WORLD_EDITOR_RC_SRCS}) -TARGET_LINK_LIBRARIES( ovqt_plugin_world_editor - ovqt_plugin_core - ovqt_plugin_landscape_editor +TARGET_LINK_LIBRARIES( studio_plugin_world_editor + studio_plugin_core + studio_plugin_landscape_editor nelmisc nel3d qt_property_browser ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} + ${LIBXML2_LIBRARIES} ) -NL_DEFAULT_PROPS(ovqt_plugin_world_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: World Editor") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_world_editor) -NL_ADD_LIB_SUFFIX(ovqt_plugin_world_editor) +NL_DEFAULT_PROPS(studio_plugin_world_editor "Tools: Studio Plugin: World Editor") +NL_ADD_RUNTIME_FLAGS(studio_plugin_world_editor) +NL_ADD_LIB_SUFFIX(studio_plugin_world_editor) ADD_DEFINITIONS(-DWORLD_EDITOR_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) IF(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ELSE(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_world_editor LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ENDIF(WIN32) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_world_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_world_editor.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/studio/src/plugins/world_editor/const_string_array_editor.cpp b/code/studio/src/plugins/world_editor/const_string_array_editor.cpp new file mode 100644 index 000000000..1f9907646 --- /dev/null +++ b/code/studio/src/plugins/world_editor/const_string_array_editor.cpp @@ -0,0 +1,106 @@ +// Ryzom Core Studio World Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "const_string_array_editor.h" + +ConstStrArrEditDialog::ConstStrArrEditDialog( QDialog *parent ) : +QDialog( parent ) +{ + setupUi( this ); + setupConnections(); +} + +ConstStrArrEditDialog::~ConstStrArrEditDialog() +{ +} + +void ConstStrArrEditDialog::setStrings( const QStringList &strings ) +{ + cb->clear(); + + QStringListIterator itr( strings ); + while( itr.hasNext() ) + { + cb->addItem( itr.next() ); + } + + cb->setCurrentIndex( 0 ); +} + +void ConstStrArrEditDialog::setValue( const QString &value ) +{ + listWidget->clear(); + + if( value.isEmpty() ) + return; + + QStringList l = value.split( '\n' ); + + QStringListIterator itr( l ); + while( itr.hasNext() ) + { + listWidget->addItem( itr.next() ); + } +} + +QString ConstStrArrEditDialog::getValue() const +{ + QString value; + + for( int i = 0; i < listWidget->count(); i++ ) + { + QListWidgetItem *item = listWidget->item( i ); + value += item->text(); + + if( i < ( listWidget->count() - 1 ) ) + value += '\n'; + } + + return value; +} + +void ConstStrArrEditDialog::accept() +{ + QDialog::accept(); +} + +void ConstStrArrEditDialog::reject() +{ + QDialog::reject(); +} + +void ConstStrArrEditDialog::onAddClicked() +{ + listWidget->addItem( cb->currentText() ); +} + +void ConstStrArrEditDialog::onRemoveClicked() +{ + QListWidgetItem *item = listWidget->currentItem(); + if( item == NULL ) + return; + + delete item; +} + +void ConstStrArrEditDialog::setupConnections() +{ + connect( addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) ); + connect( removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) ); +} + + diff --git a/code/studio/src/plugins/world_editor/const_string_array_editor.h b/code/studio/src/plugins/world_editor/const_string_array_editor.h new file mode 100644 index 000000000..a2c458e7c --- /dev/null +++ b/code/studio/src/plugins/world_editor/const_string_array_editor.h @@ -0,0 +1,50 @@ +// Ryzom Core Studio World Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 CONST_STR_ARR_EDIT_DLG +#define CONST_STR_ARR_EDIT_DLG + +#include "ui_const_string_array_editor.h" +#include + +class ConstStrArrEditDialog : public QDialog, public Ui::ConstStrArrEditorDialog +{ + Q_OBJECT +public: + ConstStrArrEditDialog( QDialog *parent = NULL ); + ~ConstStrArrEditDialog(); + + void setStrings( const QStringList &strings ); + void setValue( const QString &value ); + QString getValue() const; + +public Q_SLOTS: + void accept(); + void reject(); + +private Q_SLOTS: + void onAddClicked(); + void onRemoveClicked(); + +private: + void setupConnections(); +}; + + +#endif + + diff --git a/code/studio/src/plugins/world_editor/const_string_array_editor.ui b/code/studio/src/plugins/world_editor/const_string_array_editor.ui new file mode 100644 index 000000000..6aec02352 --- /dev/null +++ b/code/studio/src/plugins/world_editor/const_string_array_editor.ui @@ -0,0 +1,130 @@ + + + ConstStrArrEditorDialog + + + + 0 + 0 + 392 + 293 + + + + Dialog + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + Add + + + + + + + + 0 + 0 + + + + Remove + + + + + + + + + + 6 + + + 0 + + + + + Qt::Horizontal + + + + 131 + 31 + + + + + + + + OK + + + + + + + Cancel + + + + + + + + + + + okButton + clicked() + ConstStrArrEditorDialog + accept() + + + 278 + 253 + + + 96 + 254 + + + + + cancelButton + clicked() + ConstStrArrEditorDialog + reject() + + + 369 + 253 + + + 179 + 282 + + + + + diff --git a/code/studio/src/plugins/world_editor/const_string_array_property.cpp b/code/studio/src/plugins/world_editor/const_string_array_property.cpp new file mode 100644 index 000000000..5ef7566d8 --- /dev/null +++ b/code/studio/src/plugins/world_editor/const_string_array_property.cpp @@ -0,0 +1,363 @@ +// Ryzom Core Studio World Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "const_string_array_property.h" +#include "const_string_array_editor.h" +#include +#include +#include +#include +#include + + +////////////////////////////////////////////////////////////////// Manager /////////////////////////////////////////////////////////////////////////// + + +struct ConstStrArrPropMgrPriv +{ + QMap< const QtProperty*, QString > values; +}; + +ConstStrArrPropMgr::ConstStrArrPropMgr( QObject *parent ) : +QtAbstractPropertyManager( parent ) +{ + d_ptr = new ConstStrArrPropMgrPriv(); +} + +ConstStrArrPropMgr::~ConstStrArrPropMgr() +{ + delete d_ptr; + d_ptr = NULL; +} + +QString ConstStrArrPropMgr::value( const QtProperty *p ) const +{ + return valueText( p ); +} + +void ConstStrArrPropMgr::setValue( QtProperty *p, const QString &value ) +{ + if( !d_ptr->values.contains( p ) ) + return; + + if( d_ptr->values[ p ] == value ) + return; + + d_ptr->values[ p ] = value; + + Q_EMIT propertyChanged( p ); + Q_EMIT valueChanged( p, value ); +} + +void ConstStrArrPropMgr::setStrings( QtProperty *p, const QStringList &strings ) +{ + Q_EMIT stringsChanged( p, strings ); +} + +bool ConstStrArrPropMgr::hasValue( const QtProperty *p ) const +{ + return d_ptr->values.contains( p ); +} + +QString ConstStrArrPropMgr::valueText( const QtProperty *p ) const +{ + if( !d_ptr->values.contains( p ) ) + return ""; + + return d_ptr->values[ p ]; +} + +void ConstStrArrPropMgr::initializeProperty( QtProperty *p ) +{ + if( d_ptr->values.contains( p ) ) + return; + + d_ptr->values[ p ] = ""; +} + +void ConstStrArrPropMgr::uninitializeProperty( QtProperty *p ) +{ + d_ptr->values.remove( p ); +} + + + +//////////////////////////////////////////////////////////////////// Factory /////////////////////////////////////////////////////////////////////// + + + +struct ConstStrArrEditorFactoryPriv +{ + QMap< QtProperty*, QList< ConstStrArrEditor* > > createdEditors; + QMap< ConstStrArrEditor*, QtProperty* > editorToProperty; + QMap< QtProperty*, QStringList > strings; + + ~ConstStrArrEditorFactoryPriv() + { + createdEditors.clear(); + + QMap< ConstStrArrEditor*, QtProperty* >::iterator itr = editorToProperty.begin(); + while( itr != editorToProperty.end() ) + { + delete itr.key(); + ++itr; + } + editorToProperty.clear(); + } + + void addEditor( QtProperty *p, ConstStrArrEditor *editor ) + { + QMap< QtProperty*, QList< ConstStrArrEditor* > >::iterator itr = createdEditors.find( p ); + + if( itr != createdEditors.end() ) + { + itr->push_back( editor ); + } + else + { + QList< ConstStrArrEditor* > l; + l.push_back( editor ); + createdEditors.insert( p, l ); + } + + editorToProperty.insert( editor, p ); + } + + void removeEditor( QObject *o ) + { + // Remove from editorToProperty first + QMap< ConstStrArrEditor*, QtProperty* >::iterator itr1 = editorToProperty.begin(); + while( itr1 != editorToProperty.end() ) + { + if( itr1.key() == o ) + break; + + ++itr1; + } + if( itr1 != editorToProperty.end() ) + editorToProperty.erase( itr1 ); + + // Then from createdEditors + QMap< QtProperty*, QList< ConstStrArrEditor* > >::iterator itr2 = createdEditors.begin(); + while( itr2 != createdEditors.end() ) + { + QList< ConstStrArrEditor* > &l = *itr2; + QList< ConstStrArrEditor* >::iterator itr = l.begin(); + while( itr != l.end() ) + { + if( *itr == o ) + { + QList< ConstStrArrEditor* >::iterator d = itr; + ++itr; + l.erase( d ); + continue; + } + + ++itr; + } + + ++itr2; + } + } + +}; + +ConstStrArrEditorFactory::ConstStrArrEditorFactory( QObject *parent ) : +QtAbstractEditorFactory( parent ) +{ + d_ptr = new ConstStrArrEditorFactoryPriv(); +} + +ConstStrArrEditorFactory::~ConstStrArrEditorFactory() +{ + delete d_ptr; + d_ptr = NULL; +} + +void ConstStrArrEditorFactory::connectPropertyManager( ConstStrArrPropMgr *manager ) +{ + connect( manager, SIGNAL( valueChanged( QtProperty*, const QString& ) ), this, SLOT( onPropertyChanged( QtProperty*, const QString& ) ) ); + connect( manager, SIGNAL( stringsChanged( QtProperty*, const QStringList& ) ), this, SLOT( onStringsChanged( QtProperty*, const QStringList & ) ) ); +} + +void ConstStrArrEditorFactory::disconnectPropertyManager( ConstStrArrPropMgr *manager ) +{ + disconnect( manager, SIGNAL( valueChanged( QtProperty*, const QString& ) ), this, SLOT( onPropertyChanged( QtProperty*, const QString& ) ) ); + disconnect( manager, SIGNAL( stringsChanged( const QStringList& ) ), this, SLOT( onStringsChanged( const QStringList & ) ) ); +} + +QWidget* ConstStrArrEditorFactory::createEditor( ConstStrArrPropMgr *manager, QtProperty *p, QWidget *parent ) +{ + ConstStrArrEditor *editor = new ConstStrArrEditor( parent ); + editor->setValue( manager->value( p ) ); + + QMap< QtProperty*, QStringList >::iterator itr = d_ptr->strings.find( p ); + if( itr != d_ptr->strings.end() ) + { + editor->setStrings( *itr ); + } + + connect( editor, SIGNAL( valueChanged( const QString& ) ), this, SLOT( onSetValue( const QString& ) ) ); + connect( editor, SIGNAL( destroyed( QObject* ) ), this, SLOT( onEditorDestroyed( QObject* ) ) ); + + d_ptr->addEditor( p, editor ); + + return editor; +} + +void ConstStrArrEditorFactory::onPropertyChanged( QtProperty *p, const QString &value ) +{ + QMap< QtProperty*, QList< ConstStrArrEditor* > >::iterator itr = d_ptr->createdEditors.find( p ); + if( itr == d_ptr->createdEditors.end() ) + return; + + QList< ConstStrArrEditor* > &l = *itr; + QList< ConstStrArrEditor* >::iterator i = l.begin(); + while( i != l.end() ) + { + ConstStrArrEditor *editor = *i; + + editor->blockSignals( true ); + editor->setValue( value ); + editor->blockSignals( false ); + + ++i; + } +} + +void ConstStrArrEditorFactory::onStringsChanged( QtProperty *p, const QStringList &strings ) +{ + if( p == NULL ) + return; + + d_ptr->strings[ p ] = strings; +} + +void ConstStrArrEditorFactory::onSetValue( const QString &value ) +{ + QObject *s = sender(); + ConstStrArrEditor *editor = qobject_cast< ConstStrArrEditor* >( s ); + if( editor == NULL ) + return; + + QMap< ConstStrArrEditor*, QtProperty* >::iterator itr = d_ptr->editorToProperty.find( editor ); + if( itr == d_ptr->editorToProperty.end() ) + return; + + QtProperty *p = *itr; + + ConstStrArrPropMgr *manager = qobject_cast< ConstStrArrPropMgr* >( p->propertyManager() ); + if( manager == NULL ) + return; + + blockSignals( true ); + manager->setValue( p, value ); + blockSignals( false ); +} + +void ConstStrArrEditorFactory::onEditorDestroyed( QObject *editor ) +{ + d_ptr->removeEditor( editor ); +} + + + +//////////////////////////////////////////////////////////////////////// Editor ////////////////////////////////////////////////////////////////// + +ConstStrArrEditor::ConstStrArrEditor( QWidget *parent ) : +QWidget( parent ) +{ + setupUi(); + setupConnections(); +} + +ConstStrArrEditor::~ConstStrArrEditor() +{ +} + +void ConstStrArrEditor::setStrings( const QStringList &strings ) +{ + this->strings.clear(); + + QStringListIterator itr( strings ); + while( itr.hasNext() ) + { + this->strings.push_back( itr.next() ); + } +} + +void ConstStrArrEditor::setValue( const QString &value ) +{ + if( lineEdit->text() == value ) + return; + + disableConnections(); + lineEdit->setText( value ); + setupConnections(); +} + +void ConstStrArrEditor::showEvent( QShowEvent *e ) +{ + QWidget::showEvent( e ); +} + +void ConstStrArrEditor::onToolButtonClicked() +{ + ConstStrArrEditDialog d; + d.setStrings( strings ); + d.setValue( lineEdit->text() ); + int result = d.exec(); + if( QDialog::Accepted != result ) + return; + lineEdit->setText( d.getValue() ); +} + +void ConstStrArrEditor::onTextChanged( const QString &text ) +{ + Q_EMIT valueChanged( text ); +} + +void ConstStrArrEditor::setupConnections() +{ + connect( toolButton, SIGNAL( clicked( bool ) ), this, SLOT( onToolButtonClicked() ) ); + connect( lineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) ); +} + +void ConstStrArrEditor::disableConnections() +{ + disconnect( toolButton, SIGNAL( clicked( bool ) ), this, SLOT( onToolButtonClicked() ) ); + disconnect( lineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) ); +} + +void ConstStrArrEditor::setupUi() +{ + lineEdit = new QLineEdit(); + toolButton = new QToolButton(); + toolButton->setText( "..." ); + + QHBoxLayout *lt = new QHBoxLayout( this ); + lt->setContentsMargins( 0, 0, 0, 0 ); + lt->setSpacing( 0 ); + lt->addWidget( lineEdit ); + lt->addWidget( toolButton ); + + setFocusProxy( lineEdit ); + setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Fixed ); + +} + + diff --git a/code/studio/src/plugins/world_editor/const_string_array_property.h b/code/studio/src/plugins/world_editor/const_string_array_property.h new file mode 100644 index 000000000..a079f4802 --- /dev/null +++ b/code/studio/src/plugins/world_editor/const_string_array_property.h @@ -0,0 +1,131 @@ +// Ryzom Core Studio World Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 CONST_STR_ARR_PROP_H +#define CONST_STR_ARR_PROP_H + +#define QT_QTPROPERTYBROWSER_IMPORT + +#include "3rdparty/qtpropertybrowser/qtpropertybrowser.h" +#include +#include + +/////////////////////////////////////////////////////// Manager /////////////////////////////////////////////////////////////////////////// + +struct ConstStrArrPropMgrPriv; + +class ConstStrArrPropMgr : public QtAbstractPropertyManager +{ + Q_OBJECT + +public: + ConstStrArrPropMgr( QObject *parent = NULL ); + ~ConstStrArrPropMgr(); + + QString value( const QtProperty *p ) const; + +public Q_SLOTS: + void setValue( QtProperty *p, const QString &value ); + void setStrings( QtProperty *p, const QStringList &strings ); + +Q_SIGNALS: + void valueChanged( QtProperty *p, const QString &value ); + void stringsChanged( QtProperty *p, const QStringList &strings ); + +protected: + bool hasValue( const QtProperty *p ) const; + QString valueText( const QtProperty *p ) const; + void initializeProperty( QtProperty *p ); + void uninitializeProperty( QtProperty *p ); + +private: + ConstStrArrPropMgrPriv *d_ptr; + + Q_DISABLE_COPY( ConstStrArrPropMgr ); +}; + + +////////////////////////////////////////////////////////////////// Factory ///////////////////////////////////////////////////////////////////////// + +struct ConstStrArrEditorFactoryPriv; + +class ConstStrArrEditorFactory : public QtAbstractEditorFactory< ConstStrArrPropMgr > +{ + Q_OBJECT + +public: + ConstStrArrEditorFactory( QObject *parent = NULL ); + ~ConstStrArrEditorFactory(); + +protected: + void connectPropertyManager( ConstStrArrPropMgr *manager ); + void disconnectPropertyManager( ConstStrArrPropMgr *manager ); + + QWidget* createEditor( ConstStrArrPropMgr *manager, QtProperty *p, QWidget *parent ); + +private Q_SLOTS: + void onPropertyChanged( QtProperty *p, const QString &value ); + void onStringsChanged( QtProperty *p, const QStringList &strings ); + void onSetValue( const QString &value ); + void onEditorDestroyed( QObject *editor ); + +private: + ConstStrArrEditorFactoryPriv *d_ptr; + + Q_DISABLE_COPY( ConstStrArrEditorFactory ); +}; + + +///////////////////////////////////////////////////////////////// Editor /////////////////////////////////////////////////////////////////////////// + +class QLineEdit; +class QToolButton; + +class ConstStrArrEditor : public QWidget +{ + Q_OBJECT +public: + ConstStrArrEditor( QWidget *parent = NULL ); + ~ConstStrArrEditor(); + void setStrings( const QStringList &strings ); + +public Q_SLOTS: + void setValue( const QString &value ); + +protected: + void showEvent( QShowEvent *e ); + +private Q_SLOTS: + void onToolButtonClicked(); + void onTextChanged( const QString &text ); + +Q_SIGNALS: + void valueChanged( const QString &value ); + +private: + void setupUi(); + void setupConnections(); + void disableConnections(); + + + QLineEdit *lineEdit; + QToolButton *toolButton; + QStringList strings; +}; + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/icons/ic_nel_move.png b/code/studio/src/plugins/world_editor/icons/ic_nel_move.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/icons/ic_nel_move.png rename to code/studio/src/plugins/world_editor/icons/ic_nel_move.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/icons/ic_nel_rotate.png b/code/studio/src/plugins/world_editor/icons/ic_nel_rotate.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/icons/ic_nel_rotate.png rename to code/studio/src/plugins/world_editor/icons/ic_nel_rotate.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/icons/ic_nel_scale.png b/code/studio/src/plugins/world_editor/icons/ic_nel_scale.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/icons/ic_nel_scale.png rename to code/studio/src/plugins/world_editor/icons/ic_nel_scale.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/icons/ic_nel_select.png b/code/studio/src/plugins/world_editor/icons/ic_nel_select.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/icons/ic_nel_select.png rename to code/studio/src/plugins/world_editor/icons/ic_nel_select.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/icons/ic_nel_turn.png b/code/studio/src/plugins/world_editor/icons/ic_nel_turn.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/icons/ic_nel_turn.png rename to code/studio/src/plugins/world_editor/icons/ic_nel_turn.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/icons/ic_nel_world_editor.png b/code/studio/src/plugins/world_editor/icons/ic_nel_world_editor.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/icons/ic_nel_world_editor.png rename to code/studio/src/plugins/world_editor/icons/ic_nel_world_editor.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitive_item.cpp b/code/studio/src/plugins/world_editor/primitive_item.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitive_item.cpp rename to code/studio/src/plugins/world_editor/primitive_item.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitive_item.h b/code/studio/src/plugins/world_editor/primitive_item.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitive_item.h rename to code/studio/src/plugins/world_editor/primitive_item.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_model.cpp b/code/studio/src/plugins/world_editor/primitives_model.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_model.cpp rename to code/studio/src/plugins/world_editor/primitives_model.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_model.h b/code/studio/src/plugins/world_editor/primitives_model.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_model.h rename to code/studio/src/plugins/world_editor/primitives_model.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_view.cpp b/code/studio/src/plugins/world_editor/primitives_view.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_view.cpp rename to code/studio/src/plugins/world_editor/primitives_view.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_view.h b/code/studio/src/plugins/world_editor/primitives_view.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/primitives_view.h rename to code/studio/src/plugins/world_editor/primitives_view.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/project_settings_dialog.cpp b/code/studio/src/plugins/world_editor/project_settings_dialog.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/project_settings_dialog.cpp rename to code/studio/src/plugins/world_editor/project_settings_dialog.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/project_settings_dialog.h b/code/studio/src/plugins/world_editor/project_settings_dialog.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/project_settings_dialog.h rename to code/studio/src/plugins/world_editor/project_settings_dialog.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/project_settings_dialog.ui b/code/studio/src/plugins/world_editor/project_settings_dialog.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/project_settings_dialog.ui rename to code/studio/src/plugins/world_editor/project_settings_dialog.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/property_editor_widget.cpp b/code/studio/src/plugins/world_editor/property_editor_widget.cpp similarity index 65% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/property_editor_widget.cpp rename to code/studio/src/plugins/world_editor/property_editor_widget.cpp index 6d3fdaec1..9c24c8452 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/property_editor_widget.cpp +++ b/code/studio/src/plugins/world_editor/property_editor_widget.cpp @@ -28,10 +28,48 @@ // Qt includes #include +#include + +#include "const_string_array_property.h" namespace WorldEditor { +struct PropertyEditorWidgetPrivate +{ + QMap< QtProperty*, NLLIGO::IPrimitive* > propToPrim; + + void clearPrimitives() + { + propToPrim.clear(); + } + + void addPrimitive( QtProperty *p, NLLIGO::IPrimitive *prim ) + { + QMap< QtProperty*, NLLIGO::IPrimitive* >::const_iterator itr + = propToPrim.find( p ); + if( itr != propToPrim.end() ) + return; + + propToPrim[ p ] = prim; + } + + NLLIGO::IPrimitive* getPrimitive( QtProperty *p ) + { + NLLIGO::IPrimitive *prim = NULL; + + QMap< QtProperty*, NLLIGO::IPrimitive* >::const_iterator itr + = propToPrim.find( p ); + + if( itr != propToPrim.end() ) + { + prim = itr.value(); + } + + return prim; + } +}; + PropertyEditorWidget::PropertyEditorWidget(QWidget *parent) : QWidget(parent) { @@ -42,6 +80,9 @@ PropertyEditorWidget::PropertyEditorWidget(QWidget *parent) m_enumManager = new QtEnumPropertyManager(this); m_stringArrayManager = new QtTextPropertyManager(this); + m_constStrArrPropMgr = new ConstStrArrPropMgr(this); + m_constStrArrEditorFactory = new ConstStrArrEditorFactory(this); + QtLineEditFactory *lineEditFactory = new QtLineEditFactory(this); QtCheckBoxFactory *boolFactory = new QtCheckBoxFactory(this); QtEnumEditorFactory *enumFactory = new QtEnumEditorFactory(this); @@ -51,13 +92,17 @@ PropertyEditorWidget::PropertyEditorWidget(QWidget *parent) m_ui.treePropertyBrowser->setFactoryForManager(m_boolManager, boolFactory); m_ui.treePropertyBrowser->setFactoryForManager(m_enumManager, enumFactory); m_ui.treePropertyBrowser->setFactoryForManager(m_stringArrayManager, textFactory); + m_ui.treePropertyBrowser->setFactoryForManager(m_constStrArrPropMgr, m_constStrArrEditorFactory); m_groupManager = new QtGroupPropertyManager(this); + d_ptr = new PropertyEditorWidgetPrivate(); + connect(m_stringManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); connect(m_boolManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); connect(m_enumManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); connect(m_stringArrayManager, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); + connect(m_constStrArrPropMgr, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); connect(m_boolManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); connect(m_stringManager, SIGNAL(resetProperty(QtProperty *)), this, SLOT(resetProperty(QtProperty *))); @@ -67,10 +112,13 @@ PropertyEditorWidget::PropertyEditorWidget(QWidget *parent) PropertyEditorWidget::~PropertyEditorWidget() { + delete d_ptr; + d_ptr = NULL; } void PropertyEditorWidget::clearProperties() { + d_ptr->clearPrimitives(); m_ui.treePropertyBrowser->clear(); } @@ -163,6 +211,8 @@ void PropertyEditorWidget::updateSelection(Node *node) else prop = addBoolProperty(ligoProperty, parameter, primitive); + d_ptr->addPrimitive( prop, const_cast< NLLIGO::IPrimitive* >( primitive ) ); + // Default value ? if ((ligoProperty == NULL) || (ligoProperty->Default)) prop->setModified(false); @@ -188,9 +238,9 @@ void PropertyEditorWidget::updateSelection(Node *node) blockSignalsOfProperties(false); } -void PropertyEditorWidget::propertyChanged(QtProperty *property) +void PropertyEditorWidget::propertyChanged(QtProperty *p) { - nlinfo(QString("property %1 changed").arg(property->propertyName()).toUtf8().constData()); + nlinfo(QString("property %1 changed").arg(p->propertyName()).toUtf8().constData()); } void PropertyEditorWidget::resetProperty(QtProperty *property) @@ -198,6 +248,115 @@ void PropertyEditorWidget::resetProperty(QtProperty *property) nlinfo(QString("property %1 reset").arg(property->propertyName()).toUtf8().constData()); } +NLLIGO::IProperty* PropertyEditorWidget::getLigoProperty( QtProperty *p ) +{ + NLLIGO::IPrimitive *prim = d_ptr->getPrimitive( p ); + if( prim == NULL ) + { + return NULL; + } + + NLLIGO::IProperty *prop = NULL; + prim->getPropertyByName( p->propertyName().toUtf8().constData(), prop ); + if( prop == NULL ) + { + return NULL; + } + + return prop; +} + +void PropertyEditorWidget::onBoolValueChanged( QtProperty *p, bool v ) +{ + NLLIGO::IProperty *prop = getLigoProperty( p ); + if( prop == NULL ) + return; + + NLLIGO::CPropertyString *pp = dynamic_cast< NLLIGO::CPropertyString* >( prop ); + if( pp == NULL ) + return; + + if( v ) + pp->String = "true"; + else + pp->String = "false"; + + pp->Default = false; +} + +void PropertyEditorWidget::onStringValueChanged( QtProperty *p, const QString &v ) +{ + NLLIGO::IProperty *prop = getLigoProperty( p ); + if( prop == NULL ) + return; + + NLLIGO::CPropertyString *pp = dynamic_cast< NLLIGO::CPropertyString* >( prop ); + if( pp == NULL ) + return; + + pp->String = v.toUtf8().constData(); + pp->Default = false; +} + +void PropertyEditorWidget::onEnumValueChanged( QtProperty *p, int v ) +{ + NLLIGO::IProperty *prop = getLigoProperty( p ); + if( prop == NULL ) + return; + + NLLIGO::CPropertyString *pp = dynamic_cast< NLLIGO::CPropertyString* >( prop ); + if( pp == NULL ) + return; + + pp->String = p->valueText().toUtf8().constData(); + pp->Default = false; +} + +void PropertyEditorWidget::onStrArrValueChanged( QtProperty *p, const QString &v ) +{ + NLLIGO::IProperty *prop = getLigoProperty( p ); + if( prop == NULL ) + return; + + NLLIGO::CPropertyStringArray *pp = dynamic_cast< NLLIGO::CPropertyStringArray* >( prop ); + if( pp == NULL ) + return; + + pp->StringArray.clear(); + + QStringList l = v.split( '\n' ); + QStringListIterator itr( l ); + while( itr.hasNext() ) + { + pp->StringArray.push_back( itr.next().toUtf8().constData() ); + } + + pp->Default = false; +} + +void PropertyEditorWidget::onConstStrArrValueChanged( QtProperty *p, const QString &v ) +{ + NLLIGO::IProperty *prop = getLigoProperty( p ); + if( prop == NULL ) + return; + + NLLIGO::CPropertyStringArray *pp = dynamic_cast< NLLIGO::CPropertyStringArray* >( prop ); + if( pp == NULL ) + return; + + pp->StringArray.clear(); + + QStringList l = v.split( '\n' ); + QStringListIterator itr( l ); + while( itr.hasNext() ) + { + pp->StringArray.push_back( itr.next().toUtf8().constData() ); + } + + pp->Default = false; +} + + QtProperty *PropertyEditorWidget::addBoolProperty(const NLLIGO::IProperty *property, const NLLIGO::CPrimitiveClass::CParameter ¶meter, const NLLIGO::IPrimitive *primitive) @@ -326,62 +485,47 @@ QtProperty *PropertyEditorWidget::addConstStringArrayProperty(const NLLIGO::IPro primitive->getPropertyByName(name.c_str(), value); // Create qt property -// QtProperty *prop = m_enumManager->addProperty(parameter.Name.c_str()); - QtProperty *prop = m_stringArrayManager->addProperty(parameter.Name.c_str()); + QtProperty *prop = m_constStrArrPropMgr->addProperty(parameter.Name.c_str()); QStringList listEnums = getComboValues(parameter); if (listEnums.isEmpty()) { -// listEnums << QString(value.c_str()) + tr(" (WRN: Check leveldesign!)"); -// m_enumManager->setEnumNames(prop, listEnums); -// m_enumManager->setValue(prop, 0); prop->setEnabled(false); } else { // Fill qt property - m_enumManager->setEnumNames(prop, listEnums); + m_constStrArrPropMgr->setStrings(prop, listEnums); - // Find index of current value - //for (int i = 0; i < listEnums.size(); i++) - //{ - // if (value == std::string(listEnums[i].toUtf8().constData())) - // { - // m_enumManager->setValue(prop, i); - // break; - // } - //} + const NLLIGO::IProperty *ligoProperty; + std::vector vectString; - const NLLIGO::IProperty *ligoProperty; - std::vector vectString; - - if (primitive->getPropertyByName (parameter.Name.c_str(), ligoProperty)) - { - const NLLIGO::CPropertyStringArray *const propStringArray = dynamic_cast (ligoProperty); - if (propStringArray) + if (primitive->getPropertyByName (parameter.Name.c_str(), ligoProperty)) { - const std::vector &vectString = propStringArray->StringArray; - if (!vectString.empty()) + const NLLIGO::CPropertyStringArray *const propStringArray = dynamic_cast (ligoProperty); + if (propStringArray) { - std::string temp; - for (size_t i = 0; i < vectString.size(); i++) + const std::vector &vectString = propStringArray->StringArray; + if (!vectString.empty()) { - temp += vectString[i]; - if (i != (vectString.size() - 1)) - temp += '\n'; + std::string temp; + for (size_t i = 0; i < vectString.size(); i++) + { + temp += vectString[i]; + if (i != (vectString.size() - 1)) + temp += '\n'; + } + m_constStrArrPropMgr->setValue(prop, temp.c_str()); + prop->setToolTip(temp.c_str()); } - m_stringArrayManager->setValue(prop, temp.c_str()); - prop->setToolTip(temp.c_str()); + } + else + { + m_constStrArrPropMgr->setValue(prop, "StringArray :("); } } - else - { - m_stringArrayManager->setValue(prop, "StringArray :("); - } - } - m_enumManager->setValue(prop, 0); } return prop; @@ -430,5 +574,44 @@ void PropertyEditorWidget::blockSignalsOfProperties(bool block) m_boolManager->blockSignals(block); m_enumManager->blockSignals(block); m_stringArrayManager->blockSignals(block); + + if( block ) + { + disconnect(m_constStrArrPropMgr, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); + + disconnect(m_boolManager, SIGNAL( valueChanged( QtProperty*, bool ) ), + this, SLOT( onBoolValueChanged( QtProperty*, bool ) ) ); + + disconnect(m_stringManager, SIGNAL( valueChanged( QtProperty*, const QString& ) ), + this, SLOT( onStringValueChanged( QtProperty*, const QString& ) ) ); + + disconnect(m_enumManager, SIGNAL( valueChanged( QtProperty*, int ) ), + this, SLOT( onEnumValueChanged( QtProperty*, int ) ) ); + + disconnect(m_stringArrayManager, SIGNAL( valueChanged( QtProperty*, const QString& ) ), + this, SLOT( onStrArrValueChanged( QtProperty*, const QString& ) ) ); + + disconnect(m_constStrArrPropMgr, SIGNAL( valueChanged( QtProperty*, const QString& ) ), + this, SLOT( onConstStrArrValueChanged( QtProperty*, const QString& ) ) ); + } + else + { + connect(m_constStrArrPropMgr, SIGNAL(propertyChanged(QtProperty *)), this, SLOT(propertyChanged(QtProperty *))); + + connect(m_boolManager, SIGNAL( valueChanged( QtProperty*, bool ) ), + this, SLOT( onBoolValueChanged( QtProperty*, bool ) ) ); + + connect(m_stringManager, SIGNAL( valueChanged( QtProperty*, const QString& ) ), + this, SLOT( onStringValueChanged( QtProperty*, const QString& ) ) ); + + connect(m_enumManager, SIGNAL( valueChanged( QtProperty*, int ) ), + this, SLOT( onEnumValueChanged( QtProperty*, int ) ) ); + + connect(m_stringArrayManager, SIGNAL( valueChanged( QtProperty*, const QString& ) ), + this, SLOT( onStrArrValueChanged( QtProperty*, const QString& ) ) ); + + connect(m_constStrArrPropMgr, SIGNAL( valueChanged( QtProperty*, const QString& ) ), + this, SLOT( onConstStrArrValueChanged( QtProperty*, const QString& ) ) ); + } } } /* namespace WorldEditor */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/property_editor_widget.h b/code/studio/src/plugins/world_editor/property_editor_widget.h similarity index 82% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/property_editor_widget.h rename to code/studio/src/plugins/world_editor/property_editor_widget.h index 85935cccd..dae7ad13e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/property_editor_widget.h +++ b/code/studio/src/plugins/world_editor/property_editor_widget.h @@ -33,8 +33,14 @@ // Qt includes +class ConstStrArrPropMgr; +class ConstStrArrEditorFactory; + namespace WorldEditor { + +struct PropertyEditorWidgetPrivate; + /** @class PropertyEditorWidget @brief PropertyEditorWidget @@ -54,9 +60,18 @@ public Q_SLOTS: /// Update of selections void updateSelection(Node *node); - void propertyChanged(QtProperty *property); + void propertyChanged(QtProperty *p); void resetProperty(QtProperty *property); + NLLIGO::IProperty* getLigoProperty( QtProperty *p ); + + void onBoolValueChanged( QtProperty *p, bool v ); + void onStringValueChanged( QtProperty *p, const QString &v ); + void onEnumValueChanged( QtProperty *p, int v ); + void onStrArrValueChanged( QtProperty *p, const QString &v ); + void onConstStrArrValueChanged( QtProperty *p, const QString &v ); + + private: QtProperty *addBoolProperty(const NLLIGO::IProperty *property, const NLLIGO::CPrimitiveClass::CParameter ¶meter, @@ -84,7 +99,12 @@ private: QtGroupPropertyManager *m_groupManager; QtTextPropertyManager *m_stringArrayManager; + ConstStrArrPropMgr *m_constStrArrPropMgr; + ConstStrArrEditorFactory *m_constStrArrEditorFactory; + Ui::PropertyEditorWidget m_ui; + + PropertyEditorWidgetPrivate *d_ptr; }; /* PropertyEditorWidget */ } /* namespace WorldEditor */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/property_editor_widget.ui b/code/studio/src/plugins/world_editor/property_editor_widget.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/property_editor_widget.ui rename to code/studio/src/plugins/world_editor/property_editor_widget.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/ovqt_plugin_world_editor.xml b/code/studio/src/plugins/world_editor/studio_plugin_world_editor.xml similarity index 81% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/ovqt_plugin_world_editor.xml rename to code/studio/src/plugins/world_editor/studio_plugin_world_editor.xml index 13a157a7e..1b15af6a0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/ovqt_plugin_world_editor.xml +++ b/code/studio/src/plugins/world_editor/studio_plugin_world_editor.xml @@ -1,5 +1,5 @@ - ovqt_plugin_world_editor + studio_plugin_world_editor WorldEditor 0.6 GSoC2011_dnk-88 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor.qrc b/code/studio/src/plugins/world_editor/world_editor.qrc similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor.qrc rename to code/studio/src/plugins/world_editor/world_editor.qrc diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp b/code/studio/src/plugins/world_editor/world_editor_actions.cpp similarity index 83% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp rename to code/studio/src/plugins/world_editor/world_editor_actions.cpp index e10e15745..5255e976f 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.cpp +++ b/code/studio/src/plugins/world_editor/world_editor_actions.cpp @@ -209,6 +209,178 @@ void CreateWorldCommand::redo() m_model->createWorldEditNode(m_fileName); } + +WorldSaver::WorldSaver( PrimitivesTreeModel *model, LandscapeEditor::ZoneBuilderBase *zoneBuilder, const std::string &dataDir, const std::string &context ) +{ + m_model = model; + m_zoneBuilder = zoneBuilder; + m_dataDir = dataDir; + m_context = context; +} + +bool WorldSaver::save() +{ + QModelIndex pidx = m_model->index( 0, 0 ); + if( !pidx.isValid() ) + { + lastError = "No root node."; + return false; + } + + int rows = m_model->rowCount( pidx ); + bool ok = false; + + for( int i = 0; i < rows; i++ ) + { + QModelIndex idx = m_model->index( i, 0, pidx ); + + Node *node = reinterpret_cast< Node* >( idx.internalPointer() ); + Node::NodeType t = node->type(); + + switch( t ) + { + case Node::LandscapeNodeType: ok = saveLandscapeNode( node ); break; + case Node::RootPrimitiveNodeType: ok = savePrimitiveNode( node ); break; + } + + if( !ok ) + return false; + } + + ok = saveWorldEditFile(); + return ok; +} + +bool WorldSaver::saveLandscapeNode( Node *node ) +{ + LandscapeNode *n = dynamic_cast< LandscapeNode* >( node ); + if( n == NULL ) + { + lastError = "Trying to save a non-landscape node as landscape."; + return false; + } + + LandscapeEditor::ZoneRegionObject *z = m_zoneBuilder->zoneRegion( n->id() ); + if( z == NULL ) + { + lastError = "The specified zoneregion doesn't exist."; + return false; + } + + z->setFileName( n->fileName().toUtf8().constData() ); + bool ok = z->save(); + + if( ok ) + { + std::pair< std::string, std::string > p; + p.first = "landscape"; + p.second = n->fileName().toUtf8().constData(); + + m_data.push_back( p ); + } + else + { + lastError = "Couldn't save landscape file " + std::string( n->fileName().toUtf8().constData() ); + } + + return ok; +} + +bool WorldSaver::savePrimitiveNode( Node *node ) +{ + RootPrimitiveNode *n = dynamic_cast< RootPrimitiveNode* >( node ); + if( n == NULL ) + { + lastError = "Trying to save a non-primitive node as primitive."; + return false; + } + + bool ok = NLLIGO::saveXmlPrimitiveFile( *(n->primitives()), n->fileName().toUtf8().constData() ); + + if( ok ) + { + std::pair< std::string, std::string > p; + p.first = "primitive"; + p.second = n->fileName().toUtf8().constData(); + + m_data.push_back( p ); + } + else + { + lastError = "Couldn't save primitive file " + std::string( n->fileName().toUtf8().constData() ); + } + + return ok; +} + +bool WorldSaver::saveWorldEditFile() +{ + QModelIndex idx = m_model->index( 0, 0 ); + Node *node = reinterpret_cast< Node* >( idx.internalPointer() ); + Node::NodeType t = node->type(); + + WorldEditNode *n = dynamic_cast< WorldEditNode* >( node ); + if( n == NULL ) + { + lastError = "Not a worldedit node."; + return false; + } + + std::string fn = n->data( 0 ).toString().toUtf8().constData(); + bool ok = writeWorldEditFile( fn ); + + return ok; +} + +bool WorldSaver::writeWorldEditFile( const std::string &fn ) +{ + if( fn.empty() ) + return false; + + NLMISC::COFile of; + if( !of.open( fn, false, true, false ) ) + { + lastError = "Couldn't open file " + fn + " for writing."; + return false; + } + + NLMISC::COXml xml; + xml.init( &of ); + + xmlNodePtr rootNode = xmlNewDocNode (xml.getDocument (), NULL, (const xmlChar*)"NEL_WORLD_EDITOR_PROJECT", NULL); + xmlDocSetRootElement (xml.getDocument (), rootNode); + xmlNodePtr node = xmlNewChild ( rootNode, NULL, (const xmlChar*)"VERSION", NULL); + xmlNodePtr text = xmlNewText ((const xmlChar *) NLMISC::toString( WORLD_EDITOR_FILE_VERSION ).c_str ()); + xmlAddChild( node, text ); + node = xmlNewChild ( rootNode, NULL, (const xmlChar*)"DATA_DIRECTORY", NULL); + xmlSetProp (node, (const xmlChar*)"VALUE", (const xmlChar*)m_dataDir.c_str ()); + node = xmlNewChild ( rootNode, NULL, (const xmlChar*)"CONTEXT", NULL); + xmlSetProp (node, (const xmlChar*)"VALUE", (const xmlChar*)m_context.c_str ()); + + std::vector< std::pair< std::string, std::string > >::const_iterator itr = m_data.begin(); + while( itr != m_data.end() ) + { + const std::pair< std::string, std::string > &p = *itr; + + node = xmlNewChild ( rootNode, NULL, (const xmlChar*)"DATABASE_ELEMENT", NULL); + xmlSetProp (node, (const xmlChar*)"FILENAME", (const xmlChar*)p.second.c_str ()); + + if( p.first == "landscape" ) + xmlSetProp (node, (const xmlChar*)"TYPE", (const xmlChar*)("landscape")); + else + xmlSetProp (node, (const xmlChar*)"TYPE", (const xmlChar*)("primitive")); + + ++itr; + } + + xml.flush(); + + of.close(); + + + return true; +} + LoadLandscapeCommand::LoadLandscapeCommand(const QString &fileName, PrimitivesTreeModel *model, LandscapeEditor::ZoneBuilderBase *zoneBuilder, QUndoCommand *parent) : QUndoCommand(parent), diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.h b/code/studio/src/plugins/world_editor/world_editor_actions.h similarity index 93% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.h rename to code/studio/src/plugins/world_editor/world_editor_actions.h index 89de14e9a..95ce093e2 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_actions.h +++ b/code/studio/src/plugins/world_editor/world_editor_actions.h @@ -72,6 +72,31 @@ private: PrimitivesTreeModel *const m_model; }; + +class WorldSaver +{ +public: + WorldSaver( PrimitivesTreeModel *model, LandscapeEditor::ZoneBuilderBase *zoneBuilder, const std::string &dataDir, const std::string &context ); + bool save(); + + std::string getLastError() const{ return lastError; } + +private: + bool saveLandscapeNode( Node *node ); + bool savePrimitiveNode( Node *node ); + bool saveWorldEditFile(); + bool writeWorldEditFile( const std::string &fn ); + + std::string m_dataDir; + std::string m_context; + PrimitivesTreeModel *m_model; + LandscapeEditor::ZoneBuilderBase *m_zoneBuilder; + + std::vector< std::pair< std::string, std::string > > m_data; + + std::string lastError; +}; + /** @class LoadLandscapeCommand @brief diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_constants.h b/code/studio/src/plugins/world_editor/world_editor_constants.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_constants.h rename to code/studio/src/plugins/world_editor/world_editor_constants.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_global.h b/code/studio/src/plugins/world_editor/world_editor_global.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_global.h rename to code/studio/src/plugins/world_editor/world_editor_global.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_misc.cpp b/code/studio/src/plugins/world_editor/world_editor_misc.cpp similarity index 90% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_misc.cpp rename to code/studio/src/plugins/world_editor/world_editor_misc.cpp index 7401f49fb..5d6b7f94e 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_misc.cpp +++ b/code/studio/src/plugins/world_editor/world_editor_misc.cpp @@ -34,35 +34,11 @@ namespace WorldEditor namespace Utils { -void syntaxError(const char *filename, xmlNodePtr xmlNode, const char *format, ...) +std::string lastError; + +std::string getLastError() { - char buffer[1024]; - - if (format) - { - va_list args; - va_start( args, format ); - sint ret = vsnprintf( buffer, 1024, format, args ); - va_end( args ); - } - else - { - strcpy(buffer, "Unknown error"); - } - - nlerror("(%s), node (%s), line (%s) :\n%s", filename, xmlNode->name, xmlNode->content, buffer); -} - -bool getPropertyString(std::string &result, const char *filename, xmlNodePtr xmlNode, const char *propName) -{ - // Call the CIXml version - if (!NLMISC::CIXml::getPropertyString(result, xmlNode, propName)) - { - // Output a formated error - syntaxError(filename, xmlNode, "Missing XML node property (%s)", propName); - return false; - } - return true; + return lastError; } uint32 getUniqueId() @@ -81,6 +57,8 @@ bool loadWorldEditFile(const std::string &fileName, WorldEditList &worldEditList { bool result = false; + lastError = ""; + // Load the document NLMISC::CIFile file; if (file.open(fileName)) @@ -110,20 +88,31 @@ bool loadWorldEditFile(const std::string &fileName, WorldEditList &worldEditList } if (version == -1) - syntaxError(fileName.c_str(), rootNode, "No version node"); + { + std::string error = "No version node in file " + fileName; + lastError = error; + nlinfo( "%s", error.c_str() ); + return false; + } else { // Old format, if (version <= 1) { - syntaxError(fileName.c_str(), rootNode, "Old version node"); + std::string error = "Old version node in file " + fileName; + lastError = error; + nlinfo( "%s", error.c_str() ); + return false; } else { // Read it if (version > WORLD_EDITOR_FILE_VERSION) { - syntaxError(fileName.c_str(), node, "Unknown file version"); + std::string error = "Unknown file version in file " + fileName; + lastError = error; + nlinfo( "%s", error.c_str() ); + return false; } else { @@ -153,11 +142,12 @@ bool loadWorldEditFile(const std::string &fileName, WorldEditList &worldEditList { // Get the type std::string type; - if (getPropertyString(type, fileName.c_str(), node, "TYPE")) + + if ( NLMISC::CIXml::getPropertyString(type, node, "TYPE")) { // Read the filename std::string filenameChild; - if (getPropertyString(filenameChild, fileName.c_str(), node, "FILENAME")) + if ( NLMISC::CIXml::getPropertyString(filenameChild, node, "FILENAME")) { // Is it a landscape ? if (type == "landscape") @@ -179,11 +169,34 @@ bool loadWorldEditFile(const std::string &fileName, WorldEditList &worldEditList } } else + if ( type == "primitive" ) { worldEditList.push_back(WorldEditItem(PrimitiveType, filenameChild)); } + else + if( type.empty() ) + { + std::string error = "Empty type node property in file " + fileName; + lastError = error; + nlinfo( "%s", error.c_str() ); + return false; + } } + else + { + std::string error = "Missing filename node property in file " + fileName; + lastError = error; + nlinfo( "%s", error.c_str() ); + return false; + } + } + else + { + std::string error = "Missing type node property in file " + fileName; + lastError = error; + nlinfo( "%s", error.c_str() ); + return false; } } while (node = NLMISC::CIXml::getNextChildNode(node, "DATABASE_ELEMENT")); @@ -197,18 +210,26 @@ bool loadWorldEditFile(const std::string &fileName, WorldEditList &worldEditList } else { - // Error - syntaxError(fileName.c_str(), rootNode, "Unknown file header : %s", rootNode->name); + std::string error = "Unknown file header in file " + fileName; + lastError = error; + nlinfo( "%s", error.c_str() ); + return false; } } } catch (NLMISC::Exception &e) { - nlerror("Error reading file %s : %s", fileName.c_str(), e.what()); + std::string error = "Error reading file " + fileName + " : " + std::string( e.what() ); + lastError = error; + nlinfo( "%s", error.c_str() ); } } else - nlerror("Can't open the file %s for reading.", fileName.c_str()); + { + std::string error = "Can't open the file " + fileName + " for reading."; + lastError = error; + nlinfo( "%s", error.c_str() ); + } return result; } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_misc.h b/code/studio/src/plugins/world_editor/world_editor_misc.h similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_misc.h rename to code/studio/src/plugins/world_editor/world_editor_misc.h index d29b2553b..36c7b1a6a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_misc.h +++ b/code/studio/src/plugins/world_editor/world_editor_misc.h @@ -49,6 +49,8 @@ typedef std::vector WorldEditList; // Generate unique identificator uint32 getUniqueId(); +std::string getLastError(); + // Load *.worldedit file and return list primitives and landscapes. bool loadWorldEditFile(const std::string &fileName, WorldEditList &worldEditList); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp b/code/studio/src/plugins/world_editor/world_editor_plugin.cpp similarity index 97% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp rename to code/studio/src/plugins/world_editor/world_editor_plugin.cpp index 301939cb6..3170bce60 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.cpp +++ b/code/studio/src/plugins/world_editor/world_editor_plugin.cpp @@ -43,6 +43,9 @@ WorldEditorPlugin::~WorldEditorPlugin() } qDeleteAll(m_autoReleaseObjects); m_autoReleaseObjects.clear(); + + delete m_libContext; + m_libContext = NULL; } bool WorldEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.h b/code/studio/src/plugins/world_editor/world_editor_plugin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_plugin.h rename to code/studio/src/plugins/world_editor/world_editor_plugin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.cpp b/code/studio/src/plugins/world_editor/world_editor_scene.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.cpp rename to code/studio/src/plugins/world_editor/world_editor_scene.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.h b/code/studio/src/plugins/world_editor/world_editor_scene.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene.h rename to code/studio/src/plugins/world_editor/world_editor_scene.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.cpp b/code/studio/src/plugins/world_editor/world_editor_scene_item.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.cpp rename to code/studio/src/plugins/world_editor/world_editor_scene_item.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.h b/code/studio/src/plugins/world_editor/world_editor_scene_item.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_scene_item.h rename to code/studio/src/plugins/world_editor/world_editor_scene_item.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_settings_page.cpp b/code/studio/src/plugins/world_editor/world_editor_settings_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_settings_page.cpp rename to code/studio/src/plugins/world_editor/world_editor_settings_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_settings_page.h b/code/studio/src/plugins/world_editor/world_editor_settings_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_settings_page.h rename to code/studio/src/plugins/world_editor/world_editor_settings_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_settings_page.ui b/code/studio/src/plugins/world_editor/world_editor_settings_page.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_settings_page.ui rename to code/studio/src/plugins/world_editor/world_editor_settings_page.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp b/code/studio/src/plugins/world_editor/world_editor_window.cpp similarity index 94% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp rename to code/studio/src/plugins/world_editor/world_editor_window.cpp index b23e62063..cec3baee1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.cpp +++ b/code/studio/src/plugins/world_editor/world_editor_window.cpp @@ -121,6 +121,10 @@ WorldEditorWindow::~WorldEditorWindow() writeSettings(); delete m_zoneBuilderBase; + + Core::ICore::instance()->mainWindow()->statusBar()->removeWidget( m_statusInfo ); + delete m_statusInfo; + m_statusInfo = NULL; } QUndoStack *WorldEditorWindow::undoStack() const @@ -170,7 +174,12 @@ void WorldEditorWindow::loadWorldEditFile(const QString &fileName) Utils::WorldEditList worldEditList; if (!Utils::loadWorldEditFile(fileName.toUtf8().constData(), worldEditList)) { - // TODO: add the message box + std::string error = Utils::getLastError(); + + QMessageBox::critical( this, + tr( "Error opening world editor file" ), + tr( error.c_str() ) ); + return; } @@ -185,8 +194,10 @@ void WorldEditorWindow::loadWorldEditFile(const QString &fileName) { case Utils::DataDirectoryType: m_zoneBuilderBase->init(QString(worldEditList[i].second.c_str()), true); + m_dataDir = worldEditList[i].second.c_str(); break; case Utils::ContextType: + m_context = worldEditList[i].second.c_str(); break; case Utils::LandscapeType: m_undoStack->push(new LoadLandscapeCommand(QString(worldEditList[i].second.c_str()), m_primitivesModel, m_zoneBuilderBase)); @@ -212,6 +223,16 @@ void WorldEditorWindow::newWorldEditFile() void WorldEditorWindow::saveWorldEditFile() { + WorldSaver saver( m_primitivesModel, m_zoneBuilderBase, m_dataDir.toUtf8().constData(), m_context.toUtf8().constData() ); + bool ok = saver.save(); + QString error = saver.getLastError().c_str(); + + if( !ok ) + { + QMessageBox::critical( this, + tr( "Failed to save world editor files" ), + tr( "Failed to save world editor files.\nError:\n " ) + error ); + } } void WorldEditorWindow::openProjectSettings() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.h b/code/studio/src/plugins/world_editor/world_editor_window.h similarity index 98% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.h rename to code/studio/src/plugins/world_editor/world_editor_window.h index f289e6c2a..60a6a988a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.h +++ b/code/studio/src/plugins/world_editor/world_editor_window.h @@ -76,6 +76,9 @@ private: void loadWorldEditFile(const QString &fileName); void checkCurrentWorld(); + QString m_context; + QString m_dataDir; + QString m_lastDir; QLabel *m_statusInfo; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.ui b/code/studio/src/plugins/world_editor/world_editor_window.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/world_editor/world_editor_window.ui rename to code/studio/src/plugins/world_editor/world_editor_window.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/CMakeLists.txt b/code/studio/src/plugins/zone_painter/CMakeLists.txt similarity index 58% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/CMakeLists.txt rename to code/studio/src/plugins/zone_painter/CMakeLists.txt index 729658ab4..94f5e85f7 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/CMakeLists.txt +++ b/code/studio/src/plugins/zone_painter/CMakeLists.txt @@ -32,30 +32,30 @@ SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_ZONE_PAINTER_MOC_SRC} ${OVQT_PL SOURCE_GROUP("Zone Painter Plugin" FILES ${SRC}) SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC}) -ADD_LIBRARY(ovqt_plugin_zone_painter MODULE ${SRC} ${OVQT_PLUG_ZONE_PAINTER_MOC_SRC} ${OVQT_PLUG_ZONE_PAINTER_RC_SRCS} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_ZONE_PAINTER_UI_HDRS}) +ADD_LIBRARY(studio_plugin_zone_painter MODULE ${SRC} ${OVQT_PLUG_ZONE_PAINTER_MOC_SRC} ${OVQT_PLUG_ZONE_PAINTER_RC_SRCS} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_ZONE_PAINTER_UI_HDRS}) -TARGET_LINK_LIBRARIES(ovqt_plugin_zone_painter ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) +TARGET_LINK_LIBRARIES(studio_plugin_zone_painter studio_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY}) -NL_DEFAULT_PROPS(ovqt_plugin_zone_painter "NeL, Tools, 3D: Object Viewer Qt Plugin: Zone Painter") -NL_ADD_RUNTIME_FLAGS(ovqt_plugin_zone_painter) -NL_ADD_LIB_SUFFIX(ovqt_plugin_zone_painter) +NL_DEFAULT_PROPS(studio_plugin_zone_painter "Tools: Studio Plugin: Zone Painter") +NL_ADD_RUNTIME_FLAGS(studio_plugin_zone_painter) +NL_ADD_LIB_SUFFIX(studio_plugin_zone_painter) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) IF(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${OVQT_PLUGIN_DIR} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ELSE(WIN32) IF(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} ARCHIVE DESTINATION ${NL_LIB_PREFIX} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ELSE(WITH_INSTALL_LIBRARIES) - INSTALL(TARGETS ovqt_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) + INSTALL(TARGETS studio_plugin_zone_painter LIBRARY DESTINATION ${OVQT_PLUGIN_DIR} RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) ENDIF(WITH_INSTALL_LIBRARIES) ENDIF(WIN32) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ovqt_plugin_zone_painter.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/studio_plugin_zone_painter.xml DESTINATION ${OVQT_PLUGIN_SPECS_DIR} COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/color-fill.png b/code/studio/src/plugins/zone_painter/images/color-fill.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/color-fill.png rename to code/studio/src/plugins/zone_painter/images/color-fill.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/color-picker-black.png b/code/studio/src/plugins/zone_painter/images/color-picker-black.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/color-picker-black.png rename to code/studio/src/plugins/zone_painter/images/color-picker-black.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/colorize.png b/code/studio/src/plugins/zone_painter/images/colorize.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/colorize.png rename to code/studio/src/plugins/zone_painter/images/colorize.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/draw-brush.png b/code/studio/src/plugins/zone_painter/images/draw-brush.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/draw-brush.png rename to code/studio/src/plugins/zone_painter/images/draw-brush.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/go-down-7.png b/code/studio/src/plugins/zone_painter/images/go-down-7.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/go-down-7.png rename to code/studio/src/plugins/zone_painter/images/go-down-7.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/go-jump-4.png b/code/studio/src/plugins/zone_painter/images/go-jump-4.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/go-jump-4.png rename to code/studio/src/plugins/zone_painter/images/go-jump-4.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/lock-6.png b/code/studio/src/plugins/zone_painter/images/lock-6.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/lock-6.png rename to code/studio/src/plugins/zone_painter/images/lock-6.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/lock-silver.png b/code/studio/src/plugins/zone_painter/images/lock-silver.png similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/images/lock-silver.png rename to code/studio/src/plugins/zone_painter/images/lock-silver.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.cpp b/code/studio/src/plugins/zone_painter/painter_dock_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.cpp rename to code/studio/src/plugins/zone_painter/painter_dock_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.h b/code/studio/src/plugins/zone_painter/painter_dock_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.h rename to code/studio/src/plugins/zone_painter/painter_dock_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.ui b/code/studio/src/plugins/zone_painter/painter_dock_widget.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.ui rename to code/studio/src/plugins/zone_painter/painter_dock_widget.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/qnel_widget.cpp b/code/studio/src/plugins/zone_painter/qnel_widget.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/qnel_widget.cpp rename to code/studio/src/plugins/zone_painter/qnel_widget.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/qnel_widget.h b/code/studio/src/plugins/zone_painter/qnel_widget.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/qnel_widget.h rename to code/studio/src/plugins/zone_painter/qnel_widget.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/ovqt_plugin_zone_painter.xml b/code/studio/src/plugins/zone_painter/studio_plugin_zone_painter.xml similarity index 76% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/ovqt_plugin_zone_painter.xml rename to code/studio/src/plugins/zone_painter/studio_plugin_zone_painter.xml index 9a07a6be6..eb796aa42 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/ovqt_plugin_zone_painter.xml +++ b/code/studio/src/plugins/zone_painter/studio_plugin_zone_painter.xml @@ -1,5 +1,5 @@ - ovqt_plugin_zone_painter + studio_plugin_zone_painter ZonePainter 0.0 Ryzom Core diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter.qrc b/code/studio/src/plugins/zone_painter/zone_painter.qrc similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter.qrc rename to code/studio/src/plugins/zone_painter/zone_painter.qrc diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp b/code/studio/src/plugins/zone_painter/zone_painter_main_window.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp rename to code/studio/src/plugins/zone_painter/zone_painter_main_window.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h b/code/studio/src/plugins/zone_painter/zone_painter_main_window.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h rename to code/studio/src/plugins/zone_painter/zone_painter_main_window.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.ui b/code/studio/src/plugins/zone_painter/zone_painter_main_window.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.ui rename to code/studio/src/plugins/zone_painter/zone_painter_main_window.ui diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_model.cpp b/code/studio/src/plugins/zone_painter/zone_painter_model.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_model.cpp rename to code/studio/src/plugins/zone_painter/zone_painter_model.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_model.h b/code/studio/src/plugins/zone_painter/zone_painter_model.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_model.h rename to code/studio/src/plugins/zone_painter/zone_painter_model.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_plugin.cpp b/code/studio/src/plugins/zone_painter/zone_painter_plugin.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_plugin.cpp rename to code/studio/src/plugins/zone_painter/zone_painter_plugin.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_plugin.h b/code/studio/src/plugins/zone_painter/zone_painter_plugin.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_plugin.h rename to code/studio/src/plugins/zone_painter/zone_painter_plugin.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_settings_page.cpp b/code/studio/src/plugins/zone_painter/zone_painter_settings_page.cpp similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_settings_page.cpp rename to code/studio/src/plugins/zone_painter/zone_painter_settings_page.cpp diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_settings_page.h b/code/studio/src/plugins/zone_painter/zone_painter_settings_page.h similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_settings_page.h rename to code/studio/src/plugins/zone_painter/zone_painter_settings_page.h diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_settings_page.ui b/code/studio/src/plugins/zone_painter/zone_painter_settings_page.ui similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_settings_page.ui rename to code/studio/src/plugins/zone_painter/zone_painter_settings_page.ui diff --git a/code/studio/src/pm_watcher.cpp b/code/studio/src/pm_watcher.cpp new file mode 100644 index 000000000..0bbd28ca1 --- /dev/null +++ b/code/studio/src/pm_watcher.cpp @@ -0,0 +1,103 @@ +// Ryzom Core - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "pm_watcher.h" +#include "extension_system/iplugin_manager.h" +#include "splash_screen.h" + +namespace +{ + enum Progress + { + PLUGINS_LOADED = 10, + PLUGINS_INITIALIZED = 90, + PLUGINS_STARTED = 100 + }; +} + +void PluginManagerWatcher::connect() +{ + QObject::connect( pm, SIGNAL( pluginLoading( const char * ) ), this, SLOT( onPluginLoading( const char * ) ) ); + QObject::connect( pm, SIGNAL( pluginInitializing( const char * ) ), this, SLOT( onPluginInitializing( const char * ) ) ); + QObject::connect( pm, SIGNAL( pluginStarting( const char * ) ), this, SLOT( onPluginStarting( const char * ) ) ); + QObject::connect( pm, SIGNAL( pluginsLoaded() ), this, SLOT( onPluginsLoaded() ) ); + QObject::connect( pm, SIGNAL( pluginsInitialized() ), this, SLOT( onPluginsInitialized() ) ); + QObject::connect( pm, SIGNAL( pluginsStarted() ), this, SLOT( onPluginsStarted() ) ); + QObject::connect( pm, SIGNAL( pluginCount( int ) ), this, SLOT( onPluginCount( int ) ) ); +} + +void PluginManagerWatcher::disconnect() +{ + QObject::disconnect( pm, SIGNAL( pluginLoading( const char * ) ), this, SLOT( onPluginLoading( const char * ) ) ); + QObject::disconnect( pm, SIGNAL( pluginInitializing( const char * ) ), this, SLOT( onPluginInitializing( const char * ) ) ); + QObject::disconnect( pm, SIGNAL( pluginStarting( const char * ) ), this, SLOT( onPluginStarting( const char * ) ) ); + QObject::disconnect( pm, SIGNAL( pluginsLoaded() ), this, SLOT( onPluginsLoaded() ) ); + QObject::disconnect( pm, SIGNAL( pluginsInitialized() ), this, SLOT( onPluginsInitialized() ) ); + QObject::disconnect( pm, SIGNAL( pluginsStarted() ), this, SLOT( onPluginsStarted() ) ); + QObject::disconnect( pm, SIGNAL( pluginCount( int ) ), this, SLOT( onPluginCount( int ) ) ); +} + +void PluginManagerWatcher::onPluginLoading( const char *plugin ) +{ + QString s = "Loading plugin "; + s += plugin; + s += "..."; + sp->setText( s ); + + sp->advanceProgress( PLUGINS_LOADED / pluginCount ); +} + +void PluginManagerWatcher::onPluginInitializing( const char *plugin ) +{ + QString s = "Initializing plugin "; + s += plugin; + s += "..."; + sp->setText( s ); + + sp->advanceProgress( ( PLUGINS_INITIALIZED - PLUGINS_LOADED ) / pluginCount ); +} + +void PluginManagerWatcher::onPluginStarting( const char *plugin ) +{ + QString s = "Starting plugin "; + s += plugin; + s += "..."; + sp->setText( s ); + + sp->advanceProgress( ( PLUGINS_STARTED - PLUGINS_INITIALIZED ) / pluginCount ); +} + + +void PluginManagerWatcher::onPluginsLoaded() +{ + sp->setProgress( PLUGINS_LOADED ); +} + +void PluginManagerWatcher::onPluginsInitialized() +{ + sp->setProgress( PLUGINS_INITIALIZED ); +} + +void PluginManagerWatcher::onPluginsStarted() +{ + sp->setProgress( PLUGINS_STARTED ); +} + +void PluginManagerWatcher::onPluginCount( int count ) +{ + pluginCount = count; +} \ No newline at end of file diff --git a/code/studio/src/pm_watcher.h b/code/studio/src/pm_watcher.h new file mode 100644 index 000000000..e37e81401 --- /dev/null +++ b/code/studio/src/pm_watcher.h @@ -0,0 +1,72 @@ +// Ryzom Core - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 PM_WATCHER_H +#define PM_WATCHER_H + +#include + +namespace ExtensionSystem +{ + class IPluginManager; +} + +class SplashScreen; +class PluginManager; + +class PluginManagerWatcher : public QObject +{ + Q_OBJECT +public: + + PluginManagerWatcher(){ + sp = NULL; + pm = NULL; + pluginCount = 0; + } + + ~PluginManagerWatcher(){ + sp = NULL; + pm = NULL; + } + + void setSplashScreen( SplashScreen *s ){ sp = s; } + void setPluginManager( ExtensionSystem::IPluginManager *m ){ pm = m; } + + void connect(); + void disconnect(); + +private Q_SLOTS: + void onPluginLoading( const char *plugin ); + void onPluginInitializing( const char *plugin ); + void onPluginStarting( const char *plugin ); + + void onPluginsLoaded(); + void onPluginsInitialized(); + void onPluginsStarted(); + + void onPluginCount( int count ); + +private: + SplashScreen *sp; + ExtensionSystem::IPluginManager *pm; + int pluginCount; +}; + + +#endif + diff --git a/code/studio/src/settings_dialog.cpp b/code/studio/src/settings_dialog.cpp new file mode 100644 index 000000000..6824b0f56 --- /dev/null +++ b/code/studio/src/settings_dialog.cpp @@ -0,0 +1,236 @@ +// Ryzom Core - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "settings_dialog.h" +#include +#include +#include + +int findListItem( QListWidget *l, const QString &s ) +{ + for( int i = 0; i < l->count(); i++ ) + { + QListWidgetItem *item = l->item( i ); + if( item->text() == s ) + return i; + } + + return -1; +} + +SettingsDialog::SettingsDialog( QDialog *parent ) : +QDialog( parent ) +{ + setupUi( this ); + setupConnections(); + settings = NULL; +} + +SettingsDialog::~SettingsDialog() +{ +} + +void SettingsDialog::load() +{ + pluginsLE->setText( settings->value( "PluginPath" ).toString() ); + + settings->beginGroup( "DataPath" ); + + sheetsLE->setText( settings->value( "LevelDesignPath" ).toString() ); + assetsLE->setText( settings->value( "AssetsPath" ).toString() ); + primitivesLE->setText( settings->value( "PrimitivesPath" ).toString() ); + ligoLE->setText( settings->value( "LigoConfigFile" ).toString() ); + + QStringList l = settings->value( "SearchPaths" ).toStringList(); + { + QStringListIterator itr( l ); + while( itr.hasNext() ) + { + QString p = itr.next(); + if( findListItem( searchLW, p ) == -1 ) + searchLW->addItem( p ); + } + } + + l.clear(); + + l = settings->value( "RecursiveSearchPathes" ).toStringList(); + { + QStringListIterator itr( l ); + while( itr.hasNext() ) + { + QString p = itr.next(); + if( findListItem( recursiveLW, p ) == -1 ) + recursiveLW->addItem( p ); + } + } + + settings->endGroup(); +} + +void SettingsDialog::saveSearchPaths() +{ + QStringList l; + for( int i = 0; i < searchLW->count(); i++ ) + { + l.push_back( searchLW->item( i )->text() ); + } + + settings->setValue( "SearchPaths", l ); +} + +void SettingsDialog::saveRecursivePaths() +{ + QStringList l; + for( int i = 0; i < recursiveLW->count(); i++ ) + { + l.push_back( recursiveLW->item( i )->text() ); + } + + settings->setValue( "RecursiveSearchPathes", l ); +} + +void SettingsDialog::save() +{ + settings->setValue( "PluginPath", pluginsLE->text() ); + + settings->beginGroup( "DataPath" ); + + settings->setValue( "LevelDesignPath", sheetsLE->text() ); + settings->setValue( "AssetsPath", assetsLE->text() ); + settings->setValue( "PrimitivesPath", primitivesLE->text() ); + settings->setValue( "LigoConfigFile", ligoLE->text() ); + + saveSearchPaths(); + saveRecursivePaths(); + + settings->endGroup(); + + settings->sync(); +} + +void SettingsDialog::accept() +{ + save(); + QDialog::accept(); +} + +void SettingsDialog::reject() +{ + QDialog::reject(); +} + +void SettingsDialog::onOKClicked() +{ + accept(); +} + +void SettingsDialog::onCancelClicked() +{ + reject(); +} + +void SettingsDialog::onPluginBClicked() +{ + QString p = QFileDialog::getExistingDirectory( this, tr( "Plugins directory" ), "" ); + pluginsLE->setText( p ); +} + +void SettingsDialog::onSheetsBClicked() +{ + QString p = QFileDialog::getExistingDirectory( this, tr( "Sheets directory" ), "" ); + sheetsLE->setText( p ); +} + +void SettingsDialog::onAssetsBClicked() +{ + QString p = QFileDialog::getExistingDirectory( this, tr( "Assets directory" ), "" ); + assetsLE->setText( p ); +} + +void SettingsDialog::onPrimitivesBClicked() +{ + QString p = QFileDialog::getExistingDirectory( this, tr( "Primitives directory" ), "" ); + primitivesLE->setText( p ); +} + +void SettingsDialog::onLigoBClicked() +{ + QString p = QFileDialog::getExistingDirectory( this, tr( "LIGO directory" ), "" ); + ligoLE->setText( p ); +} + +void SettingsDialog::onPathAddClicked() +{ + QString p = QFileDialog::getExistingDirectory( this, tr( "Search path" ), "" ); + if( p.isEmpty() ) + return; + + if( findListItem( searchLW, p ) != -1 ) + return; + + searchLW->addItem( p ); +} + +void SettingsDialog::onPathRemoveClicked() +{ + QListWidgetItem *i = searchLW->currentItem(); + if( i == NULL ) + return; + + delete i; +} + +void SettingsDialog::onRecursiveAddClicked() +{ + QString p = QFileDialog::getExistingDirectory( this, tr( "Recursive search path" ), "" ); + if( p.isEmpty() ) + return; + + if( findListItem( recursiveLW, p ) != -1 ) + return; + + recursiveLW->addItem( p ); +} + +void SettingsDialog::onRecursiveRemoveClicked() +{ + QListWidgetItem *i = recursiveLW->currentItem(); + if( i == NULL ) + return; + + delete i; +} + + +void SettingsDialog::setupConnections() +{ + connect( bb, SIGNAL( accepted() ), this, SLOT( onOKClicked() ) ); + connect( bb, SIGNAL( rejected() ), this, SLOT( onCancelClicked() ) ); + + connect( pluginsB, SIGNAL( clicked( bool ) ), this, SLOT( onPluginBClicked() ) ); + connect( sheetsB, SIGNAL( clicked( bool ) ), this, SLOT( onSheetsBClicked() ) ); + connect( assetsB, SIGNAL( clicked( bool ) ), this, SLOT( onAssetsBClicked() ) ); + connect( primitivesB, SIGNAL( clicked( bool ) ), this, SLOT( onPrimitivesBClicked() ) ); + connect( ligoB, SIGNAL( clicked( bool ) ), this, SLOT( onLigoBClicked() ) ); + + connect( pathAddB, SIGNAL( clicked( bool ) ), this, SLOT( onPathAddClicked() ) ); + connect( pathRemoveB, SIGNAL( clicked( bool ) ), this, SLOT( onPathRemoveClicked() ) ); + connect( recAddB, SIGNAL( clicked( bool ) ), this, SLOT( onRecursiveAddClicked() ) ); + connect( recRemoveB, SIGNAL( clicked( bool ) ), this, SLOT( onRecursiveRemoveClicked() ) ); +} + diff --git a/code/studio/src/settings_dialog.h b/code/studio/src/settings_dialog.h new file mode 100644 index 000000000..c6e7cc93a --- /dev/null +++ b/code/studio/src/settings_dialog.h @@ -0,0 +1,62 @@ +// Ryzom Core - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 SETTINGS_DIALOG_H +#define SETTINGS_DIALOG_H + +#include "ui_settings_dialog.h" + +class QSettings; + +class SettingsDialog : public QDialog, public Ui::SettingsDialog +{ + Q_OBJECT +public: + SettingsDialog( QDialog *parent = NULL ); + ~SettingsDialog(); + + void setSettings( QSettings *s ){ settings = s; } + + void load(); + +public Q_SLOTS: + void accept(); + void reject(); + + void onOKClicked(); + void onCancelClicked(); + + void onPluginBClicked(); + void onSheetsBClicked(); + void onAssetsBClicked(); + void onPrimitivesBClicked(); + void onLigoBClicked(); + + void onPathAddClicked(); + void onPathRemoveClicked(); + void onRecursiveAddClicked(); + void onRecursiveRemoveClicked(); + +private: + void setupConnections(); + void save(); + void saveSearchPaths(); + void saveRecursivePaths(); + + QSettings *settings; +}; + +#endif diff --git a/code/studio/src/settings_dialog.ui b/code/studio/src/settings_dialog.ui new file mode 100644 index 000000000..2fb6151d3 --- /dev/null +++ b/code/studio/src/settings_dialog.ui @@ -0,0 +1,255 @@ + + + SettingsDialog + + + Qt::ApplicationModal + + + + 0 + 0 + 451 + 539 + + + + Ryzom Core Studio settings + + + + + + Paths + + + + + + Plugins + + + + + + + + + + ... + + + + + + + Sheets + + + + + + + + + + ... + + + + + + + Assets database + + + + + + + + + + ... + + + + + + + Primitives + + + + + + + + + + ... + + + + + + + LIGO config file + + + + + + + + + + ... + + + + + + + + + + Search paths + + + + + + + + + + 0 + 0 + + + + Add + + + Qt::ToolButtonTextOnly + + + + + + + + 0 + 0 + + + + Remove + + + Qt::ToolButtonTextOnly + + + + + + + Qt::Vertical + + + + 20 + 75 + + + + + + + + + + + Recursive search paths + + + + + + + + + + 0 + 0 + + + + Add + + + Qt::ToolButtonTextOnly + + + + + + + + 0 + 0 + + + + Remove + + + Qt::ToolButtonTextOnly + + + + + + + Qt::Vertical + + + + 20 + 76 + + + + + + + + + + + Qt::Horizontal + + + + 120 + 20 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + diff --git a/code/studio/src/splash_screen.cpp b/code/studio/src/splash_screen.cpp new file mode 100644 index 000000000..252472e8d --- /dev/null +++ b/code/studio/src/splash_screen.cpp @@ -0,0 +1,109 @@ +// Ryzom Core - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 "splash_screen.h" +#include +#include +#include +#include + +SplashScreen::SplashScreen() : +QSplashScreen() +{ + progress = 0; + textX = 5; + textY = 20; + pbLeft = 2; + pbTop = 0; + pbWidth = 100; + pbHeight = 20; +} + +SplashScreen::~SplashScreen() +{ +} + +void SplashScreen::setPixmap( const QPixmap &pixmap ) +{ + QSplashScreen::setPixmap( pixmap ); + + if( this->pixmap().width() > 0 ) + pbWidth = this->pixmap().width() - 4; + + if( this->pixmap().height() > 0 ) + pbTop = this->pixmap().height() - pbHeight - 2; + + textY = pbTop - pbHeight / 2; +} + +void SplashScreen::setText( const QString &text ) +{ + this->text = text; + repaint(); + QCoreApplication::instance()->processEvents(); +} + +void SplashScreen::clearText() +{ + setText( "" ); +} + +void SplashScreen::setProgress( int percent ) +{ + progress = percent; + repaint(); + QCoreApplication::instance()->processEvents(); +} + +void SplashScreen::advanceProgress( int percent ) +{ + progress += percent; + repaint(); + QCoreApplication::instance()->processEvents(); +} + +void SplashScreen::drawContents( QPainter *painter ) +{ + QSplashScreen::drawContents( painter ); + + if( progressBarEnabled ) + { + QStyleOptionProgressBarV2 pbStyle; + pbStyle.initFrom( this ); + pbStyle.state = QStyle::State_Enabled; + pbStyle.textVisible = false; + pbStyle.minimum = 0; + pbStyle.maximum = 100; + pbStyle.progress = progress; + pbStyle.invertedAppearance = false; + pbStyle.rect = QRect( pbLeft, pbTop, pbWidth, pbHeight ); + + style()->drawControl( QStyle::CE_ProgressBar, &pbStyle, painter, this ); + } + + if( !text.isEmpty() ) + { + QPen oldPen = painter->pen(); + QPen pen; + pen.setColor( Qt::white ); + painter->setPen( pen ); + painter->drawText( textX, textY, text ); + painter->setPen( oldPen ); + } +} + + diff --git a/code/studio/src/splash_screen.h b/code/studio/src/splash_screen.h new file mode 100644 index 000000000..ec6cd3da8 --- /dev/null +++ b/code/studio/src/splash_screen.h @@ -0,0 +1,60 @@ +// Ryzom Core - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// 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 SPLASH_SCREEN_H +#define SPLASH_SCREEN_H + + +#include + +class SplashScreen : public QSplashScreen +{ + Q_OBJECT +public: + SplashScreen(); + ~SplashScreen(); + + void setPixmap( const QPixmap &pixmap ); + + void setText( const QString &text ); + void clearText(); + void setTextXY( int x, int y ){ textX = x; textY = y; } + void setProgress( int percent ); + void advanceProgress( int percent ); + + void setProgressBarEnabled( bool b ){ progressBarEnabled = b; } + void setProgressBarRect( int left, int top, int width, int height ){} + +protected: + void drawContents( QPainter *painter ); + +private: + int progress; + int pbLeft; + int pbTop; + int pbWidth; + int pbHeight; + + QString text; + int textX; + int textY; + + bool progressBarEnabled; +}; + +#endif + diff --git a/code/nel/tools/3d/object_viewer_qt/src/ic_nel_pill.ico b/code/studio/src/studio.ico similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/ic_nel_pill.ico rename to code/studio/src/studio.ico diff --git a/code/nel/tools/3d/object_viewer_qt/src/object_viewer_qt.qrc b/code/studio/src/studio.qrc similarity index 56% rename from code/nel/tools/3d/object_viewer_qt/src/object_viewer_qt.qrc rename to code/studio/src/studio.qrc index 13d47d75b..17306e2cc 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/object_viewer_qt.qrc +++ b/code/studio/src/studio.qrc @@ -1,5 +1,5 @@ - images/nel_ide_load.png + images/studio_splash.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/object_viewer_qt.rc b/code/studio/src/studio.rc similarity index 83% rename from code/nel/tools/3d/object_viewer_qt/src/object_viewer_qt.rc rename to code/studio/src/studio.rc index a0f0e7099..05ade2766 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/object_viewer_qt.rc +++ b/code/studio/src/studio.rc @@ -28,12 +28,12 @@ BEGIN VALUE "CompanyName", "Ryzom Core\0" VALUE "FileDescription", "\0" VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "Object_Viewer_Qt\0" + VALUE "InternalName", "Ryzom Core Studio\0" VALUE "LegalCopyright", "Copyright (C) 2011\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "\0" VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Object Viewer Qt\0" + VALUE "ProductName", "Ryzom Core Studio\0" VALUE "ProductVersion", "1, 0, 0, 1\0" VALUE "SpecialBuild", "\0" END @@ -51,4 +51,4 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDR_MAINFRAME ICON DISCARDABLE "ic_nel_pill.ico" +IDR_MAINFRAME ICON DISCARDABLE "studio.ico" diff --git a/code/nel/tools/3d/object_viewer_qt/src/translations/object_viewer_qt_de.ts b/code/studio/src/translations/object_viewer_qt_de.ts similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/translations/object_viewer_qt_de.ts rename to code/studio/src/translations/object_viewer_qt_de.ts diff --git a/code/nel/tools/3d/object_viewer_qt/src/translations/object_viewer_qt_en.ts b/code/studio/src/translations/object_viewer_qt_en.ts similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/translations/object_viewer_qt_en.ts rename to code/studio/src/translations/object_viewer_qt_en.ts diff --git a/code/nel/tools/3d/object_viewer_qt/src/translations/object_viewer_qt_fr.ts b/code/studio/src/translations/object_viewer_qt_fr.ts similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/translations/object_viewer_qt_fr.ts rename to code/studio/src/translations/object_viewer_qt_fr.ts diff --git a/code/nel/tools/3d/object_viewer_qt/src/translations/object_viewer_qt_ru.ts b/code/studio/src/translations/object_viewer_qt_ru.ts similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/translations/object_viewer_qt_ru.ts rename to code/studio/src/translations/object_viewer_qt_ru.ts diff --git a/code/nel/tools/3d/object_viewer_qt/src/translations/translations.qrc b/code/studio/src/translations/translations.qrc similarity index 100% rename from code/nel/tools/3d/object_viewer_qt/src/translations/translations.qrc rename to code/studio/src/translations/translations.qrc