diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 20364b1ef..220e4132d 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -288,6 +288,26 @@ MACRO(NL_SETUP_BUILD) ENDIF(CMAKE_BUILD_TYPE MATCHES "Release") ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug") + # Determine target CPU +# IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") + IF(NOT CMAKE_SIZEOF_VOID_P) + INCLUDE (CheckTypeSize) + CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P) + ENDIF(NOT CMAKE_SIZEOF_VOID_P) + + # Using 32 or 64 bits libraries + SET(TARGET_X86 1) + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(ARCH "x86_64") + SET(TARGET_X64 1) + ADD_DEFINITIONS(-DHAVE_X86_64) + ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(ARCH "x86") + ADD_DEFINITIONS(-DHAVE_X86) + ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) +# ADD_DEFINITIONS(-DHAVE_IA64) +# ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") + IF(WIN32) IF(MSVC10) # /Ox is working with VC++ 2010, but custom optimizations don't exist @@ -301,13 +321,23 @@ MACRO(NL_SETUP_BUILD) SET(MIN_OPTIMIZATIONS "/Ob1") ENDIF(MSVC10) - SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP") - - # Exceptions are only set for C++ - SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa") + SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-") # Common link flags SET(PLATFORM_LINKFLAGS "-DEBUG") + + IF(TARGET_X64) + # Fix a bug with Intellisense + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64") + # Fix a compilation error for some big C++ files + SET(MIN_OPTIMIZATIONS "${MIN_OPTIMIZATIONS} /bigobj") + ELSE(TARGET_X64) + # Allows 32 bits applications to use 3 GB of RAM + SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE") + ENDIF(TARGET_X64) + + # Exceptions are only set for C++ + SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa") SET(NL_DEBUG_CFLAGS "/MDd /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS}") SET(NL_RELEASE_CFLAGS "/MD /D NDEBUG ${SPEED_OPTIMIZATIONS}") @@ -331,29 +361,7 @@ MACRO(NL_SETUP_BUILD) SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -D_DEBUG") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O6") - ENDIF(WIN32) - - # Determine target CPU -# IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") - IF(NOT CMAKE_SIZEOF_VOID_P) - INCLUDE (CheckTypeSize) - CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P) - ENDIF(NOT CMAKE_SIZEOF_VOID_P) - - # Using 32 or 64 bits libraries - SET(TARGET_X86 1) - IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(ARCH "x86_64") - SET(TARGET_X64 1) - ADD_DEFINITIONS(-DHAVE_X86_64) - ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(ARCH "x86") - ADD_DEFINITIONS(-DHAVE_X86) - ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) -# ADD_DEFINITIONS(-DHAVE_IA64) -# ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") - ENDMACRO(NL_SETUP_BUILD) MACRO(NL_SETUP_BUILD_FLAGS) diff --git a/code/nel/include/nel/misc/sstring.h b/code/nel/include/nel/misc/sstring.h index 7b4fa717d..513c681c9 100644 --- a/code/nel/include/nel/misc/sstring.h +++ b/code/nel/include/nel/misc/sstring.h @@ -945,10 +945,13 @@ inline CSString operator+(const char* s0,const CSString& s1) return CSString(s0)+s1; } +#ifndef NL_COMP_VC10 +// TODO: check if it can be disabled for other compilers too inline CSString operator+(const std::string& s0,const CSString& s1) { return s0+static_cast(s1); } +#endif // NL_COMP_VC10 } // NLMISC diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp index 8a9e864cc..a4ccb437a 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp @@ -318,7 +318,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) if (!mat._MatDrvInfo) { // Insert into driver list. (so it is deleted when driver is deleted). - ItMatDrvInfoPtrList it= _MatDrvInfos.insert(_MatDrvInfos.end(), NULL); + ItMatDrvInfoPtrList it= _MatDrvInfos.insert(_MatDrvInfos.end(), (NL3D::IMaterialDrvInfos*)NULL); *it = mat._MatDrvInfo = new CMaterialDrvInfosD3D(this, it); diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp index 445b52451..5f1c1bc43 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_shader.cpp @@ -347,7 +347,7 @@ bool CDriverD3D::activeShader(CShader *shd) if ( !shd->_DrvInfo ) { // insert into driver list. (so it is deleted when driver is deleted). - ItShaderDrvInfoPtrList it= _ShaderDrvInfos.insert(_ShaderDrvInfos.end(), NULL); + ItShaderDrvInfoPtrList it= _ShaderDrvInfos.insert(_ShaderDrvInfos.end(), (NL3D::IShaderDrvInfos*)NULL); // create and set iterator, for future deletion. shaderInfo = new CShaderDrvInfosD3D(this, it); *it= shd->_DrvInfo = shaderInfo; diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp index 0c10a3eb8..94615628b 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp @@ -514,7 +514,7 @@ bool CDriverD3D::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded if ( !tex.TextureDrvShare ) { // insert into driver list. (so it is deleted when driver is deleted). - ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), NULL); + ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), (NL3D::CTextureDrvShare*)NULL); // create and set iterator, for future deletion. *it= tex.TextureDrvShare= new CTextureDrvShare(this, it, &tex); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp index c7bc0d35d..9a2d6c596 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_material.cpp @@ -276,7 +276,7 @@ bool CDriverGL::setupMaterial(CMaterial& mat) if (!mat._MatDrvInfo) { // insert into driver list. (so it is deleted when driver is deleted). - ItMatDrvInfoPtrList it= _MatDrvInfos.insert(_MatDrvInfos.end(), NULL); + ItMatDrvInfoPtrList it= _MatDrvInfos.insert(_MatDrvInfos.end(), (NL3D::IMaterialDrvInfos*)NULL); // create and set iterator, for future deletion. *it= mat._MatDrvInfo= new CShaderGL(this, it); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp index f3e59c65e..43c2441d4 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_texture.cpp @@ -626,7 +626,7 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded, { //nldebug("3D: creating CTextureDrvShare()"); // insert into driver list. (so it is deleted when driver is deleted). - ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), NULL); + ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), (NL3D::CTextureDrvShare*)NULL); // create and set iterator, for future deletion. *it= tex.TextureDrvShare= new CTextureDrvShare(this, it, &tex); diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp index 09ff88748..502c971f1 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex.cpp @@ -140,7 +140,7 @@ bool CDriverGL::setupVertexBuffer(CVertexBuffer& VB) // 1. Retrieve/Create driver shader. //================================== // insert into driver list. (so it is deleted when driver is deleted). - ItVBDrvInfoPtrList it= _VBDrvInfos.insert(_VBDrvInfos.end(), NULL); + ItVBDrvInfoPtrList it= _VBDrvInfos.insert(_VBDrvInfos.end(), (NL3D::IVBDrvInfos*)NULL); // create and set iterator, for future deletion. CVBDrvInfosGL *info = new CVBDrvInfosGL(this, it, &VB); *it= VB.DrvInfos = info; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp index 4c255e1d9..45da4d218 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_vertex_program.cpp @@ -111,7 +111,7 @@ bool CDriverGL::activeNVVertexProgram (CVertexProgram *program) } // Insert into driver list. (so it is deleted when driver is deleted). - ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), NULL); + ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), (NL3D::IVertexProgramDrvInfos*)NULL); // Create a driver info *it = drvInfo = new CVertexProgamDrvInfosGL (this, it); @@ -1472,7 +1472,7 @@ bool CDriverGL::activeARBVertexProgram (CVertexProgram *program) return false; } // Insert into driver list. (so it is deleted when driver is deleted). - ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), NULL); + ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), (NL3D::IVertexProgramDrvInfos*)NULL); // Create a driver info *it = drvInfo = new CVertexProgamDrvInfosGL (this, it); @@ -1554,7 +1554,7 @@ bool CDriverGL::activeEXTVertexShader (CVertexProgram *program) */ // Insert into driver list. (so it is deleted when driver is deleted). - ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), NULL); + ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), (NL3D::IVertexProgramDrvInfos*)NULL); // Create a driver info *it = drvInfo = new CVertexProgamDrvInfosGL (this, it); diff --git a/code/nel/src/3d/packed_zone.cpp b/code/nel/src/3d/packed_zone.cpp index d56f34400..78d559f7d 100644 --- a/code/nel/src/3d/packed_zone.cpp +++ b/code/nel/src/3d/packed_zone.cpp @@ -29,6 +29,7 @@ #include "nel/misc/bit_mem_stream.h" // #include +#include // diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index 472e2cd35..17cf2fd3b 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -969,14 +969,12 @@ void force_exception_frame(...) {std::cout.flush();} static void exceptionTranslator(unsigned, EXCEPTION_POINTERS *pexp) { #ifndef NL_NO_DEBUG_FILES - FILE *file = fopen ("exception_catched", "wb"); - fclose (file); + CFile::createEmptyFile(getLogDirectory() + "exception_catched"); #endif if (pexp->ExceptionRecord->ExceptionCode == EXCEPTION_BREAKPOINT) { #ifndef NL_NO_DEBUG_FILES - FILE *file2 = fopen ("breakpointed", "wb"); - fclose (file2); + CFile::createEmptyFile(getLogDirectory() + "breakpointed"); #endif return; } @@ -1683,12 +1681,18 @@ NLMISC_CATEGORISED_COMMAND(nel, writeaccess, "write a uint8 value in an invalid uint8 val = 123; uint8 *adr = (uint8*)0; if(args.size() >= 1) + { #ifdef HAVE_X86_64 - adr = (uint8*)(uint64)atoi(args[0].c_str()); + uint64 addr64; + NLMISC::fromString(args[0], addr64); + adr = (uint8*)addr64; #else - adr = (uint8*)atoi(args[0].c_str()); + uint32 addr32; + NLMISC::fromString(args[0], addr32); + adr = (uint8*)addr32; #endif - if(args.size() >= 2) val = (uint8)atoi(args[1].c_str()); + } + if(args.size() >= 2) NLMISC::fromString(args[1], val); *adr = val; return true; } @@ -1698,11 +1702,17 @@ NLMISC_CATEGORISED_COMMAND(nel, readaccess, "read a uint8 value in an invalid ad uint8 val; uint8 *adr = (uint8*)0; if(args.size() == 1) + { #ifdef HAVE_X86_64 - adr = (uint8*)(uint64)atoi(args[0].c_str()); + uint64 addr64; + NLMISC::fromString(args[0], addr64); + adr = (uint8*)addr64; #else - adr = (uint8*)atoi(args[0].c_str()); + uint32 addr32; + NLMISC::fromString(args[0], addr32); + adr = (uint8*)addr32; #endif + } val = *adr; log.displayNL("value is %hu", (uint16)val); return true; diff --git a/code/nel/src/sound/audio_mixer_user.cpp b/code/nel/src/sound/audio_mixer_user.cpp index 7f17f9d35..a80592727 100644 --- a/code/nel/src/sound/audio_mixer_user.cpp +++ b/code/nel/src/sound/audio_mixer_user.cpp @@ -836,7 +836,7 @@ void CAudioMixerUser::buildSampleBankList() nlinfo("Compiling sample bank [%s]", bankname.c_str()); std::string filename = buildSampleBank(bankDir[i], sbp, bankname); if (bankFile.size() < i + 1) bankFile.resize(i + 1); - else bankFile.insert(bankFile.begin() + i, NULL); + else bankFile.insert(bankFile.begin() + i, std::string()); bankFile[i] = filename; } else if (bankname < CFile::getFilenameWithoutExtension(bankDir[i])) diff --git a/code/nel/src/sound/simple_sound.cpp b/code/nel/src/sound/simple_sound.cpp index dd69a19bb..405b25264 100644 --- a/code/nel/src/sound/simple_sound.cpp +++ b/code/nel/src/sound/simple_sound.cpp @@ -77,7 +77,7 @@ void CSimpleSound::getSubSoundList(std::vector(this)->getBuffer() == 0) - subsounds.push_back(pair(CStringMapper::unmap(_Buffername)+" (sample)", 0)); + subsounds.push_back(pair(CStringMapper::unmap(_Buffername)+" (sample)", (CSound*)NULL)); } diff --git a/code/nel/src/sound/stdsound.h b/code/nel/src/sound/stdsound.h index a4cc08094..a656fa387 100644 --- a/code/nel/src/sound/stdsound.h +++ b/code/nel/src/sound/stdsound.h @@ -36,6 +36,7 @@ #include #include #include +#include #include "nel/misc/vector.h" #include "nel/misc/path.h" diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt index 7da567023..bec71cf94 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt @@ -5,4 +5,5 @@ ADD_SUBDIRECTORY(landscape_editor) ADD_SUBDIRECTORY(log) ADD_SUBDIRECTORY(disp_sheet_id) ADD_SUBDIRECTORY(object_viewer) -ADD_SUBDIRECTORY(zone_painter) \ No newline at end of file +ADD_SUBDIRECTORY(zone_painter) +ADD_SUBDIRECTORY(georges_editor) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.qrc b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.qrc index 85b4702b0..a4c87d29c 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.qrc +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core.qrc @@ -6,6 +6,9 @@ icons/ic_nel_down_item.png icons/ic_nel_generic_settings.png icons/ic_nel_open.png + icons/ic_nel_new.png + icons/ic_nel_save.png + icons/ic_nel_save_as.png icons/ic_nel_path_settings.png icons/ic_nel_pill.png icons/ic_nel_reset_all.png diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h index b902b6c0f..7f0b5cd15 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/core_constants.h @@ -1,93 +1,103 @@ -// Object Viewer Qt - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// Copyright (C) 2010 Dzmitry Kamiahin -// -// 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 CORE_CONSTANTS_H -#define CORE_CONSTANTS_H - -namespace Core -{ -namespace Constants -{ - -const char * const OVQT_VERSION_LONG = "0.0.1"; -const char * const OVQT_VENDOR = "Ryzom Core"; -const char * const OVQT_YEAR = "2010, 2011"; -const char * const OVQT_CORE_PLUGIN = "Core"; - -//mainwindow -const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow"; - -//menubar -const char * const MENU_BAR = "ObjectViewerQt.MenuBar"; - -//menus -const char * const M_FILE = "ObjectViewerQt.Menu.File"; -const char * const M_EDIT = "ObjectViewerQt.Menu.Edit"; -const char * const M_VIEW = "ObjectViewerQt.Menu.View"; -const char * const M_SCENE = "ObjectViewerQt.Menu.Scene"; -const char * const M_TOOLS = "ObjectViewerQt.Menu.Tools"; -const char * const M_WINDOW = "ObjectViewerQt.Menu.Window"; -const char * const M_HELP = "ObjectViewerQt.Menu.Help"; - -const char * const M_SHEET = "ObjectViewerQt.Menu.Sheet"; - -//actions -const char * const NEW = "ObjectViewerQt.New"; -const char * const OPEN = "ObjectViewerQt.Open"; -const char * const EXIT = "ObjectViewerQt.Exit"; - -const char * const SETTINGS = "ObjectViewerQt.Settings"; -const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen"; - -const char * const CLOSE = "ObjectViewerQt.Close"; -const char * const CLOSEALL = "ObjectViewerQt.CloseAll"; -const char * const CLOSEOTHERS = "ObjectViewerQt.CloseOthers"; -const char * const ABOUT = "ObjectViewerQt.About"; -const char * const ABOUT_PLUGINS = "ObjectViewerQt.AboutPlugins"; -const char * const ABOUT_QT = "ObjectViewerQt.AboutQt"; - -//settings -const char * const SETTINGS_CATEGORY_GENERAL = "general"; -const char * const SETTINGS_CATEGORY_GENERAL_ICON = ":/icons/ic_nel_generic_settings.png"; -const char * const SETTINGS_TR_CATEGORY_GENERAL = QT_TR_NOOP("General"); - -const char * const MAIN_WINDOW_SECTION = "MainWindow"; -const char * const MAIN_WINDOW_STATE = "WindowState"; -const char * const MAIN_WINDOW_GEOMETRY = "WindowGeometry"; -const char * const QT_STYLE = "QtStyle"; -const char * const QT_PALETTE = "QtPalette"; - -const char * const LANGUAGE = "Language"; -const char * const PLUGINS_PATH = "PluginPath"; -const char * const DATA_PATH_SECTION = "DataPath"; -const char * const SEARCH_PATHS = "SearchPaths"; -const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes"; -const char * const LEVELDESIGN_PATH = "LevelDesignPath"; -const char * const ASSETS_PATH = "AssetsPath"; -const char * const REMAP_EXTENSIONS = "RemapExtensions"; - -//resources -const char * const ICON_NEL = ":/core/images/nel.png"; -const char * const ICON_SETTINGS = ":/core/images/preferences.png"; -const char * const ICON_PILL = ":/core/icons/ic_nel_pill.png"; -const char * const ICON_OPEN = ":/core/icons/ic_nel_open.png"; -const char * const ICON_CRASH = ":/core/icons/ic_nel_crash.png"; - -} // namespace Constants -} // namespace Core - -#endif // CORE_CONSTANTS_H +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// Copyright (C) 2010 Dzmitry Kamiahin +// +// 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 CORE_CONSTANTS_H +#define CORE_CONSTANTS_H + +namespace Core +{ +namespace Constants +{ + +const char * const OVQT_VERSION_LONG = "0.0.1"; +const char * const OVQT_VENDOR = "Ryzom Core"; +const char * const OVQT_YEAR = "2010, 2011"; +const char * const OVQT_CORE_PLUGIN = "Core"; + +//mainwindow +const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow"; + +//menubar +const char * const MENU_BAR = "ObjectViewerQt.MenuBar"; + +//menus +const char * const M_FILE = "ObjectViewerQt.Menu.File"; +const char * const M_EDIT = "ObjectViewerQt.Menu.Edit"; +const char * const M_VIEW = "ObjectViewerQt.Menu.View"; +const char * const M_SCENE = "ObjectViewerQt.Menu.Scene"; +const char * const M_TOOLS = "ObjectViewerQt.Menu.Tools"; +const char * const M_WINDOW = "ObjectViewerQt.Menu.Window"; +const char * const M_HELP = "ObjectViewerQt.Menu.Help"; + +const char * const M_SHEET = "ObjectViewerQt.Menu.Sheet"; + +//actions +const char * const NEW = "ObjectViewerQt.New"; +const char * const OPEN = "ObjectViewerQt.Open"; +const char * const EXIT = "ObjectViewerQt.Exit"; + +const char * const SETTINGS = "ObjectViewerQt.Settings"; +const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen"; + +const char * const CLOSE = "ObjectViewerQt.Close"; +const char * const CLOSEALL = "ObjectViewerQt.CloseAll"; +const char * const CLOSEOTHERS = "ObjectViewerQt.CloseOthers"; +const char * const ABOUT = "ObjectViewerQt.About"; +const char * const ABOUT_PLUGINS = "ObjectViewerQt.AboutPlugins"; +const char * const ABOUT_QT = "ObjectViewerQt.AboutQt"; + +//settings +const char * const SETTINGS_CATEGORY_GENERAL = "general"; +const char * const SETTINGS_CATEGORY_GENERAL_ICON = ":/icons/ic_nel_generic_settings.png"; +const char * const SETTINGS_TR_CATEGORY_GENERAL = QT_TR_NOOP("General"); + +const char * const MAIN_WINDOW_SECTION = "MainWindow"; +const char * const MAIN_WINDOW_STATE = "WindowState"; +const char * const MAIN_WINDOW_GEOMETRY = "WindowGeometry"; +const char * const QT_STYLE = "QtStyle"; +const char * const QT_PALETTE = "QtPalette"; + +const char * const LANGUAGE = "Language"; +const char * const PLUGINS_PATH = "PluginPath"; +const char * const DATA_PATH_SECTION = "DataPath"; +const char * const SEARCH_PATHS = "SearchPaths"; +const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes"; +const char * const LEVELDESIGN_PATH = "LevelDesignPath"; +const char * const ASSETS_PATH = "AssetsPath"; +const char * const REMAP_EXTENSIONS = "RemapExtensions"; + +const char * const LOG_SECTION = "LogSettings"; +const char * const LOG_ERROR = "LogError"; +const char * const LOG_WARNING = "LogWarning"; +const char * const LOG_DEBUG = "LogDebug"; +const char * const LOG_ASSERT = "LogAssert"; +const char * const LOG_INFO = "LogInfo"; + +//resources +const char * const ICON_NEL = ":/core/images/nel.png"; +const char * const ICON_SETTINGS = ":/core/images/preferences.png"; +const char * const ICON_PILL = ":/core/icons/ic_nel_pill.png"; +const char * const ICON_OPEN = ":/core/icons/ic_nel_open.png"; +const char * const ICON_NEW = ":/core/icons/ic_nel_new.png"; +const char * const ICON_SAVE = ":/core/icons/ic_nel_save.png"; +const char * const ICON_SAVE_AS = ":/core/icons/ic_nel_save_as.png"; +const char * const ICON_CRASH = ":/core/icons/ic_nel_crash.png"; + +} // namespace Constants +} // namespace Core + +#endif // CORE_CONSTANTS_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_new.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_new.png new file mode 100644 index 000000000..159e3e18e Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_new.png differ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_save.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_save.png new file mode 100644 index 000000000..5aeb3bbe9 Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_save.png differ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_save_as.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_save_as.png new file mode 100644 index 000000000..6cb71a334 Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/icons/ic_nel_save_as.png differ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp index 55d6d4579..79316424a 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/core/main_window.cpp @@ -98,10 +98,11 @@ bool MainWindow::initialize(QString *errorString) void MainWindow::extensionsInitialized() { - readSettings(); - connect(m_contextManager, SIGNAL(currentContextChanged(Core::IContext*)), - this, SLOT(updateContext(Core::IContext*))); - updateContext(m_contextManager->currentContext()); + readSettings(); + connect(m_contextManager, SIGNAL(currentContextChanged(Core::IContext*)), + this, SLOT(updateContext(Core::IContext*))); + if (m_contextManager->currentContext() != NULL) + updateContext(m_contextManager->currentContext()); show(); } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt new file mode 100644 index 000000000..d1dd346ba --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/CMakeLists.txt @@ -0,0 +1,43 @@ +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_GEORGES_EDITOR_HDR georges_editor_plugin.h + georges_editor_form.h + georges_dirtree_dialog.h) + +SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui + georges_dirtree_form.ui) + +SET(OVQT_PLUGIN_GEORGES_EDITOR_RCS georges_editor.qrc) + +SET(QT_USE_QTGUI TRUE) +SET(QT_USE_QTOPENGL TRUE) + +QT4_ADD_RESOURCES(OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS ${OVQT_PLUGIN_GEORGES_EDITOR_RCS}) +QT4_WRAP_CPP(OVQT_PLUG_GEORGES_EDITOR_MOC_SRC ${OVQT_PLUG_GEORGES_EDITOR_HDR}) +QT4_WRAP_UI( OVQT_PLUG_GEORGES_EDITOR_UI_HDRS ${OVQT_PLUG_GEORGES_EDITOR_UIS} ) + +SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_GEORGES_EDITOR_UIS} ${OVQT_PLUGIN_GEORGES_EDITOR_RCS}) +SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS}) +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}) + +TARGET_LINK_LIBRARIES(ovqt_plugin_georges_editor ovqt_plugin_core nelmisc ${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) + +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS}) + +INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp new file mode 100644 index 000000000..f7e250cce --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.cpp @@ -0,0 +1,99 @@ +// 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 "georges_dirtree_dialog.h" + +// Qt includes +#include +#include + +// NeL includes + +//using namespace NLMISC; + +namespace Plugin +{ + +CGeorgesDirTreeDialog::CGeorgesDirTreeDialog(QString ldPath, QWidget *parent) + :QDockWidget(parent), m_ldPath(ldPath) +{ + + m_ui.setupUi(this); + + m_dirModel = new CGeorgesFileSystemModel(m_ldPath); + m_ui.dirTree->setModel(m_dirModel); + + if (m_dirModel->isCorrectLDPath()) + { + m_dirModel->setRootPath(m_ldPath); + m_ui.dirTree->setRootIndex(m_dirModel->index(m_ldPath)); + } + else + { + m_dirModel->setRootPath(QDir::currentPath()); + } + + m_ui.dirTree->setAnimated(false); + m_ui.dirTree->setIndentation(20); + + connect(m_ui.dirTree, SIGNAL(activated(QModelIndex)), + this, SLOT(fileSelected(QModelIndex))); +} + +CGeorgesDirTreeDialog::~CGeorgesDirTreeDialog() +{ + delete m_dirModel; +} + +void CGeorgesDirTreeDialog::fileSelected(QModelIndex index) +{ + QString name; + if (index.isValid() && !m_dirModel->isDir(index)) + { + Q_EMIT selectedForm(m_dirModel->fileName(index)); + } +} + +void CGeorgesDirTreeDialog::changeFile(QString file) +{ + QModelIndex index = m_dirModel->index(file); + m_ui.dirTree->selectionModel()->select(index,QItemSelectionModel::ClearAndSelect); + m_ui.dirTree->scrollTo(index,QAbstractItemView::PositionAtCenter); + fileSelected(index); +} + +void CGeorgesDirTreeDialog::ldPathChanged(QString path) +{ + m_ldPath = path; + + delete m_dirModel; + + m_dirModel = new CGeorgesFileSystemModel(m_ldPath); + m_ui.dirTree->setModel(m_dirModel); + + if (m_dirModel->isCorrectLDPath()) + { + m_dirModel->setRootPath(m_ldPath); + m_ui.dirTree->setRootIndex(m_dirModel->index(m_ldPath)); + } + else + { + m_dirModel->setRootPath(QDir::currentPath()); + } +} + +} /* namespace NLQT */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h new file mode 100644 index 000000000..3079f76c2 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_dialog.h @@ -0,0 +1,62 @@ +// 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 GEORGES_DIRTREE_DIALOG_H +#define GEORGES_DIRTREE_DIALOG_H + +// Qt includes +#include + +// STL includes + +// NeL includes + +// Project includes +#include "ui_georges_dirtree_form.h" +#include "georges_filesystem_model.h" + +namespace Plugin +{ + +class CGeorgesDirTreeDialog: public QDockWidget +{ + Q_OBJECT + +public: + CGeorgesDirTreeDialog(QString ldPath, QWidget *parent = 0); + ~CGeorgesDirTreeDialog(); + + void ldPathChanged(QString); + +private: + Ui::CGeorgesDirTreeDialog m_ui; + + CGeorgesFileSystemModel *m_dirModel; + QString m_ldPath; + +Q_SIGNALS: + void selectedForm(const QString); + +private Q_SLOTS: + void fileSelected(QModelIndex index); + void changeFile(QString file); + + friend class CMainWindow; +}; /* CGEorgesDirTreeDialog */ + +} /* namespace NLQT */ + +#endif // GEORGES_DIRTREE_DIALOG_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui new file mode 100644 index 000000000..8731d1ca8 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_dirtree_form.ui @@ -0,0 +1,54 @@ + + + CGeorgesDirTreeDialog + + + + 0 + 0 + 400 + 300 + + + + + 0 + 0 + + + + + 200 + 111 + + + + QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable + + + Leveldesign Path + + + + + 50 + 0 + + + + + + + + 0 + 0 + + + + + + + + + + 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 new file mode 100644 index 000000000..3d514dbc0 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor.qrc @@ -0,0 +1,5 @@ + + + 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/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_constants.h new file mode 100644 index 000000000..bb9fe3306 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_constants.h @@ -0,0 +1,31 @@ +// 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 GEORGES_EDITOR_CONSTANTS_H +#define GEORGES_EDITOR_CONSTANTS_H + +namespace Plugin +{ +namespace Constants +{ +//settings +const char * const GEORGES_EDITOR_SECTION = "GeorgesEditor"; + + +} // namespace Constants +} // namespace Plugin + +#endif // GEORGES_EDITOR_CONSTANTS_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp new file mode 100644 index 000000000..aa614a161 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.cpp @@ -0,0 +1,139 @@ +// 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 "georges_editor_form.h" +#include "georges_editor_constants.h" +#include "georges_dirtree_dialog.h" + +#include "../core/icore.h" +#include "../core/imenu_manager.h" +#include "../core/core_constants.h" + +// NeL includes +#include + +// Qt includes +#include +#include +#include + +namespace Plugin +{ + +GeorgesEditorForm::GeorgesEditorForm(QWidget *parent) + : QMainWindow(parent), + m_georgesDirTreeDialog(0) +{ + m_ui.setupUi(this); + + m_undoStack = new QUndoStack(this); + + _openAction = new QAction(tr("&Open..."), this); + _openAction->setIcon(QIcon(Core::Constants::ICON_OPEN)); + _openAction->setShortcut(QKeySequence::Open); + _openAction->setStatusTip(tr("Open an existing file")); + connect(_openAction, SIGNAL(triggered()), this, SLOT(open())); + + _newAction = new QAction(tr("&New..."), this); + _newAction->setIcon(QIcon(Core::Constants::ICON_NEW)); + _newAction->setShortcut(QKeySequence::New); + _newAction->setStatusTip(tr("Create a new file")); + connect(_newAction, SIGNAL(triggered()), this, SLOT(newFile())); + + _saveAction = new QAction(tr("&Save..."), this); + _saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE)); + _saveAction->setShortcut(QKeySequence::Save); + _saveAction->setStatusTip(tr("Save the current file")); + connect(_saveAction, SIGNAL(triggered()), this, SLOT(save())); + + _fileToolBar = addToolBar(tr("&File")); + _fileToolBar->addAction(_openAction); + _fileToolBar->addAction(_newAction); + _fileToolBar->addAction(_saveAction); + + readSettings(); + + // create leveldesign directory tree dockwidget + m_georgesDirTreeDialog = new CGeorgesDirTreeDialog(m_leveldesignPath, this); + addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog); + //m_georgesDirTreeDialog->setVisible(false); + connect(Core::ICore::instance(), SIGNAL(changeSettings()), + this, SLOT(settingsChanged())); +} + +GeorgesEditorForm::~GeorgesEditorForm() +{ + writeSettings(); +} + +QUndoStack *GeorgesEditorForm::undoStack() const +{ + return m_undoStack; +} + +void GeorgesEditorForm::open() +{ + // TODO: FileDialog & loadFile(); + //QString fileName = QFileDialog::getOpenFileName(); + //loadFile(fileName); +} + +void GeorgesEditorForm::newFile() +{ + +} + +void GeorgesEditorForm::save() +{ + +} + +void GeorgesEditorForm::readSettings() +{ + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup(Constants::GEORGES_EDITOR_SECTION); + settings->endGroup(); + + settings->beginGroup(Core::Constants::DATA_PATH_SECTION); + m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString(); + settings->endGroup(); +} + +void GeorgesEditorForm::writeSettings() +{ + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup(Constants::GEORGES_EDITOR_SECTION); + settings->endGroup(); + settings->sync(); +} + +void GeorgesEditorForm::settingsChanged() +{ + QSettings *settings = Core::ICore::instance()->settings(); + + settings->beginGroup(Core::Constants::DATA_PATH_SECTION); + QString oldLDPath = m_leveldesignPath; + m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString(); + settings->endGroup(); + + if (oldLDPath != m_leveldesignPath) + { + m_georgesDirTreeDialog->ldPathChanged(m_leveldesignPath); + } +} + +} /* namespace Plugin */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h new file mode 100644 index 000000000..96fceb4ed --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.h @@ -0,0 +1,64 @@ +// 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 GEORGES_EDITOR_FORM_H +#define GEORGES_EDITOR_FORM_H + +// Project includes +#include "ui_georges_editor_form.h" + +// Qt includes +#include + +namespace Plugin +{ + +class CGeorgesDirTreeDialog; +class GeorgesEditorForm: public QMainWindow +{ + Q_OBJECT + +public: + GeorgesEditorForm(QWidget *parent = 0); + ~GeorgesEditorForm(); + + QUndoStack *undoStack() const; + +public Q_SLOTS: + void open(); + void newFile(); + void save(); + void settingsChanged(); + +private: + void readSettings(); + void writeSettings(); + + QUndoStack *m_undoStack; + Ui::GeorgesEditorForm m_ui; + + CGeorgesDirTreeDialog *m_georgesDirTreeDialog; + QToolBar *_fileToolBar; + QAction *_openAction; + QAction *_newAction; + QAction *_saveAction; + + QString m_leveldesignPath; +}; /* class GeorgesEditorForm */ + +} /* namespace Plugin */ + +#endif // GEORGES_EDITOR_FORM_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.ui new file mode 100644 index 000000000..905814cc7 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_form.ui @@ -0,0 +1,28 @@ + + + GeorgesEditorForm + + + + 0 + 0 + 800 + 600 + + + + Georges Editor + + + + QWidget#centralwidget { + image: url(:/images/ic_nel_georges_editor.png); + } + + + + + + + + diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp new file mode 100644 index 000000000..a97188751 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.cpp @@ -0,0 +1,128 @@ +// 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 "georges_editor_plugin.h" +#include "georges_editor_form.h" + +#include "../core/icore.h" +#include "../core/core_constants.h" + +// NeL includes +#include "nel/misc/debug.h" + +// Qt includes +#include + +namespace Plugin +{ + +GeorgesEditorPlugin::~GeorgesEditorPlugin() +{ + Q_FOREACH(QObject *obj, m_autoReleaseObjects) + { + m_plugMan->removeObject(obj); + } + qDeleteAll(m_autoReleaseObjects); + m_autoReleaseObjects.clear(); +} + +bool GeorgesEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) +{ + Q_UNUSED(errorString); + m_plugMan = pluginManager; + + addAutoReleasedObject(new GeorgesEditorContext(this)); + return true; +} + +void GeorgesEditorPlugin::extensionsInitialized() +{ +} + +void GeorgesEditorPlugin::shutdown() +{ +} + +void GeorgesEditorPlugin::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); +} + +QString GeorgesEditorPlugin::name() const +{ + return tr("Georges Editor"); +} + +QString GeorgesEditorPlugin::version() const +{ + return "0.2"; +} + +QString GeorgesEditorPlugin::vendor() const +{ + return "aquiles"; +} + +QString GeorgesEditorPlugin::description() const +{ + return tr("Tool to create & edit sheets or forms."); +} + +QStringList GeorgesEditorPlugin::dependencies() const +{ + QStringList list; + list.append(Core::Constants::OVQT_CORE_PLUGIN); + list.append("ObjectViewer"); // TODO + return list; +} + +void GeorgesEditorPlugin::addAutoReleasedObject(QObject *obj) +{ + m_plugMan->addObject(obj); + m_autoReleaseObjects.prepend(obj); +} + +GeorgesEditorContext::GeorgesEditorContext(QObject *parent) + : IContext(parent), + m_georgesEditorForm(0) +{ + m_georgesEditorForm = new GeorgesEditorForm(); +} + +QUndoStack *GeorgesEditorContext::undoStack() +{ + return m_georgesEditorForm->undoStack(); +} + +void GeorgesEditorContext::open() +{ + m_georgesEditorForm->open(); +} + +QWidget *GeorgesEditorContext::widget() +{ + return m_georgesEditorForm; +} + +} + +Q_EXPORT_PLUGIN(Plugin::GeorgesEditorPlugin) \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.h new file mode 100644 index 000000000..7cc93dfb4 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_editor_plugin.h @@ -0,0 +1,105 @@ +// 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 GEORGES_EDITOR_PLUGIN_H +#define GEORGES_EDITOR_PLUGIN_H + +// Project includes +#include "../../extension_system/iplugin.h" +#include "../core/icontext.h" + +// NeL includes +#include "nel/misc/app_context.h" + +// Qt includes +#include +#include + +namespace NLMISC +{ +class CLibraryContext; +} + +namespace ExtensionSystem +{ +class IPluginSpec; +} + +namespace Plugin +{ +class GeorgesEditorForm; +class GeorgesEditorPlugin : public QObject, public ExtensionSystem::IPlugin +{ + Q_OBJECT + Q_INTERFACES(ExtensionSystem::IPlugin) +public: + + virtual ~GeorgesEditorPlugin(); + + bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString); + void extensionsInitialized(); + void shutdown(); + + void setNelContext(NLMISC::INelContext *nelContext); + + QString name() const; + QString version() const; + QString vendor() const; + QString description() const; + QStringList dependencies() const; + + void addAutoReleasedObject(QObject *obj); + +protected: + NLMISC::CLibraryContext *m_libContext; + +private: + ExtensionSystem::IPluginManager *m_plugMan; + QList m_autoReleaseObjects; +}; + +class GeorgesEditorContext: public Core::IContext +{ + Q_OBJECT +public: + GeorgesEditorContext(QObject *parent = 0); + virtual ~GeorgesEditorContext() {} + + virtual QString id() const + { + return QLatin1String("GeorgesEditorContext"); + } + virtual QString trName() const + { + return tr("Georges Editor"); + } + virtual QIcon icon() const + { + return QIcon(":/images/ic_nel_georges_editor.png"); + } + + virtual void open(); + + virtual QUndoStack *undoStack(); + + virtual QWidget *widget(); + + GeorgesEditorForm *m_georgesEditorForm; +}; + +} // namespace Plugin + +#endif // LANDSCAPE_EDITOR_PLUGIN_H diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp new file mode 100644 index 000000000..20cb30b33 --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.cpp @@ -0,0 +1,95 @@ +// 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 "georges_filesystem_model.h" + +#include +#include + +namespace Plugin +{ + +CGeorgesFileSystemModel::CGeorgesFileSystemModel(QString ldPath, QObject *parent) + : QFileSystemModel(parent), + m_ldPath(ldPath), + m_correct(false) +{ + checkLDPath(); +} + +CGeorgesFileSystemModel::~CGeorgesFileSystemModel() +{ + +} + +QVariant CGeorgesFileSystemModel::data(const QModelIndex& index, int role) const +{ + + if (role == Qt::DecorationRole) + { + if (!m_correct) + return QVariant(); + if (isDir(index)) + return QApplication::style()->standardIcon(QStyle::SP_DirIcon); + } + if (!m_correct && role == Qt::DisplayRole) + { + if (index.parent().isValid()) + return QVariant(); + return tr("Set a correct leveldesign path ..."); + } + return QFileSystemModel::data(index, role); +} + +int CGeorgesFileSystemModel::columnCount(const QModelIndex &/*parent*/) const +{ + return 1; +} + +int CGeorgesFileSystemModel::rowCount(const QModelIndex &parent) const +{ + + if (!m_correct) + { + if(parent.isValid()) + { + return 0; + } + else + { + return qMin(QFileSystemModel::rowCount(parent),1); + } + } + return QFileSystemModel::rowCount(parent); +} + +void CGeorgesFileSystemModel::checkLDPath() +{ + QFileInfo check1(QString("%1/game_element").arg(m_ldPath)); + QFileInfo check2(QString("%1/DFN").arg(m_ldPath)); + + if (check1.exists() && check2.exists()) + { + m_correct = true; + } + else + { + m_correct = false; + } +} +} /* namespace NLQT */ + +/* end of file */ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h new file mode 100644 index 000000000..775dcb18d --- /dev/null +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/georges_filesystem_model.h @@ -0,0 +1,50 @@ +// 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 GEORGES_FILESYSTEM_MODEL_H +#define GEORGES_FILESYSTEM_MODEL_H + +#include + +namespace Plugin +{ + +class CGeorgesFileSystemModel : public QFileSystemModel +{ + QString m_ldPath; + +public: + CGeorgesFileSystemModel(QString ldPath, QObject *parent = 0); + ~CGeorgesFileSystemModel(); + + int columnCount(const QModelIndex &/*parent*/) const; + int rowCount(const QModelIndex &/*parent*/) const; + + QVariant data(const QModelIndex& index, int role) const ; + + bool isCorrectLDPath() + { + return m_correct; + } + void checkLDPath(); + +private: + bool m_correct; +};/* class CGeorgesFileSystemModel */ + +} /* namespace NLQT */ + +#endif // GEORGES_FILESYSTEM_MODEL_H \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/images/ic_nel_georges_editor.png b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/images/ic_nel_georges_editor.png new file mode 100644 index 000000000..b293fec52 Binary files /dev/null and b/code/nel/tools/3d/object_viewer_qt/src/plugins/georges_editor/images/ic_nel_georges_editor.png differ diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/CMakeLists.txt index 555eac232..b497e3332 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/CMakeLists.txt @@ -1,7 +1,7 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${LIBXML2_INCLUDE_DIR} - ${QT_INCLUDES}) + ${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 diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp index ad772f593..2f88200ec 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.cpp @@ -1,24 +1,28 @@ -/* -Log Plugin Qt -Copyright (C) 2010 Adrian Jaekel - -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 . - -*/ +// Object Viewer Qt - Log 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 "log_plugin.h" #include "log_settings_page.h" +#include "qt_displayer.h" + +#include "../core/icore.h" +#include "../core/core_constants.h" +#include "../core/imenu_manager.h" +#include "../../extension_system/iplugin_spec.h" // Qt includes #include @@ -35,103 +39,153 @@ along with this program. If not, see . // NeL includes #include -// Project includes -#include "../core/icore.h" -#include "../core/core_constants.h" -#include "../core/imenu_manager.h" -#include "qt_displayer.h" - -using namespace Plugin; - -namespace ExtensionSystem +namespace Plugin { -class IPluginSpec; -} -CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent) -{ - _ui.setupUi(this); -} + CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent) + { + m_ui.setupUi(this); + } -CLogPlugin::~CLogPlugin() -{ - //_plugMan->removeObject(_logSettingsPage); - delete _logSettingsPage; + CLogPlugin::~CLogPlugin() + { + Q_FOREACH(QObject *obj, m_autoReleaseObjects) + { + m_plugMan->removeObject(obj); + } + qDeleteAll(m_autoReleaseObjects); + m_autoReleaseObjects.clear(); - NLMISC::ErrorLog->removeDisplayer(_displayer); - NLMISC::WarningLog->removeDisplayer(_displayer); - NLMISC::DebugLog->removeDisplayer(_displayer); - NLMISC::AssertLog->removeDisplayer(_displayer); - NLMISC::InfoLog->removeDisplayer(_displayer); - delete _displayer; -} + NLMISC::ErrorLog->removeDisplayer(m_displayer); + NLMISC::WarningLog->removeDisplayer(m_displayer); + NLMISC::DebugLog->removeDisplayer(m_displayer); + NLMISC::AssertLog->removeDisplayer(m_displayer); + NLMISC::InfoLog->removeDisplayer(m_displayer); + delete m_displayer; + } -bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) -{ - Q_UNUSED(errorString); - _plugMan = pluginManager; - _logSettingsPage = new CLogSettingsPage(this); - //_plugMan->addObject(_logSettingsPage); - return true; -} + bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString) + { + Q_UNUSED(errorString); + m_plugMan = pluginManager; + m_logSettingsPage = new CLogSettingsPage(this); + addAutoReleasedObject(m_logSettingsPage); + return true; + } -void CLogPlugin::extensionsInitialized() -{ - NLMISC::ErrorLog->addDisplayer(_displayer); - NLMISC::WarningLog->addDisplayer(_displayer); - NLMISC::DebugLog->addDisplayer(_displayer); - NLMISC::AssertLog->addDisplayer(_displayer); - NLMISC::InfoLog->addDisplayer(_displayer); + void CLogPlugin::extensionsInitialized() + { + setDisplayers(); - Core::ICore *core = Core::ICore::instance(); - Core::IMenuManager *menuManager = core->menuManager(); - QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW); + Core::ICore *core = Core::ICore::instance(); + Core::IMenuManager *menuManager = core->menuManager(); + QMenu *viewMenu = menuManager->menu(Core::Constants::M_VIEW); - QMainWindow *wnd = Core::ICore::instance()->mainWindow(); - wnd->addDockWidget(Qt::RightDockWidgetArea, this); - hide(); + QMainWindow *wnd = Core::ICore::instance()->mainWindow(); + wnd->addDockWidget(Qt::RightDockWidgetArea, this); + hide(); - viewMenu->addAction(this->toggleViewAction()); -} + viewMenu->addAction(this->toggleViewAction()); + } -void CLogPlugin::setNelContext(NLMISC::INelContext *nelContext) -{ + void CLogPlugin::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()); + // Ensure that a context doesn't exist yet. + // This only applies to platforms without PIC, e.g. Windows. + nlassert(!NLMISC::INelContext::isContextInitialised()); #endif // fdef NL_OS_WINDOWS^M - _LibContext = new NLMISC::CLibraryContext(*nelContext); + m_libContext = new NLMISC::CLibraryContext(*nelContext); - _displayer = new NLQT::CQtDisplayer(_ui.plainTextEdit); + m_displayer = new NLQT::CQtDisplayer(m_ui.plainTextEdit); + } + + QString CLogPlugin::name() const + { + return "NeL Log"; + } + + QString CLogPlugin::version() const + { + return "1.1"; + } + + QString CLogPlugin::vendor() const + { + return "aquiles"; + } + + QString CLogPlugin::description() const + { + return tr("DockWidget to display all log messages from NeL."); + } + + QStringList CLogPlugin::dependencies() const + { + QStringList list; + list.append(Core::Constants::OVQT_CORE_PLUGIN); + return list; + } + + void CLogPlugin::addAutoReleasedObject(QObject *obj) + { + m_plugMan->addObject(obj); + m_autoReleaseObjects.prepend(obj); + } + + void CLogPlugin::setDisplayers() + { + QSettings *settings = Core::ICore::instance()->settings(); + + settings->beginGroup(Core::Constants::LOG_SECTION); + bool error = settings->value(Core::Constants::LOG_ERROR, true).toBool(); + bool warning = settings->value(Core::Constants::LOG_WARNING, true).toBool(); + bool debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool(); + bool assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool(); + bool info = settings->value(Core::Constants::LOG_INFO, true).toBool(); + settings->endGroup(); + + if (error) { + if (!NLMISC::ErrorLog->attached(m_displayer)) + NLMISC::ErrorLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::ErrorLog->removeDisplayer(m_displayer); + } + } + if (warning) { + if (!NLMISC::WarningLog->attached(m_displayer)) + NLMISC::WarningLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::WarningLog->removeDisplayer(m_displayer); + } + } + if (debug) { + if (!NLMISC::DebugLog->attached(m_displayer)) + NLMISC::DebugLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::DebugLog->removeDisplayer(m_displayer); + } + } + if (assert) { + if (!NLMISC::AssertLog->attached(m_displayer)) + NLMISC::AssertLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::AssertLog->removeDisplayer(m_displayer); + } + } + if (info) { + if (!NLMISC::InfoLog->attached(m_displayer)) + NLMISC::InfoLog->addDisplayer(m_displayer); + } else { + if (m_displayer) { + NLMISC::InfoLog->removeDisplayer(m_displayer); + } + } + } } - -QString CLogPlugin::name() const -{ - return "LogPlugin"; -} - -QString CLogPlugin::version() const -{ - return "1.0"; -} - -QString CLogPlugin::vendor() const -{ - return "aquiles"; -} - -QString CLogPlugin::description() const -{ - return "DockWidget to display all log messages from NeL."; -} - -QStringList CLogPlugin::dependencies() const -{ - QStringList list; - list.append(Core::Constants::OVQT_CORE_PLUGIN); - return list; -} - -Q_EXPORT_PLUGIN(CLogPlugin) +Q_EXPORT_PLUGIN(Plugin::CLogPlugin) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h index d07469541..6a2d78f79 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_plugin.h @@ -1,6 +1,6 @@ /* Log Plugin Qt -Copyright (C) 2010 Adrian Jaekel +Copyright (C) 2011 Adrian Jaekel 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 @@ -20,16 +20,16 @@ along with this program. If not, see . #ifndef LOG_PLUGIN_H #define LOG_PLUGIN_H +// Project includes +#include "ui_log_form.h" #include "../../extension_system/iplugin.h" +// NeL includes #include "nel/misc/app_context.h" // Qt includes #include -// Project includes -#include "ui_log_form.h" - namespace NLMISC { class CLibraryContext; @@ -52,7 +52,7 @@ namespace Plugin class CLogPlugin : public QDockWidget, public ExtensionSystem::IPlugin { Q_OBJECT - Q_INTERFACES(ExtensionSystem::IPlugin) + Q_INTERFACES(ExtensionSystem::IPlugin) public: CLogPlugin(QWidget *parent = 0); ~CLogPlugin(); @@ -61,7 +61,7 @@ namespace Plugin void extensionsInitialized(); void setNelContext(NLMISC::INelContext *nelContext); - NLQT::CQtDisplayer* displayer() { return _displayer; } + NLQT::CQtDisplayer* displayer() { return m_displayer; } QString name() const; QString version() const; @@ -69,16 +69,21 @@ namespace Plugin QString description() const; QStringList dependencies() const; + void addAutoReleasedObject(QObject *obj); + + void setDisplayers(); + protected: - NLMISC::CLibraryContext *_LibContext; + NLMISC::CLibraryContext *m_libContext; private: - ExtensionSystem::IPluginManager *_plugMan; - CLogSettingsPage *_logSettingsPage; + ExtensionSystem::IPluginManager *m_plugMan; + QList m_autoReleaseObjects; + CLogSettingsPage *m_logSettingsPage; - Ui::CLogPlugin _ui; + Ui::CLogPlugin m_ui; - NLQT::CQtDisplayer *_displayer; + NLQT::CQtDisplayer *m_displayer; }; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp index 83cfdc979..f75d6ab37 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.cpp @@ -1,6 +1,6 @@ // Object Viewer Qt - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited -// Copyright (C) 2011 Dzmitry Kamiahin +// 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 @@ -15,31 +15,43 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +// Project includes #include "log_settings_page.h" - -// Qt includes -#include +#include "log_plugin.h" +#include "../core/core_constants.h" +#include "../core/icore.h" +#include "../../extension_system/plugin_manager.h" // NeL includes -// Project includes +// Qt includes +#include +#include + namespace ExtensionSystem { - class IPluginManager; + class IPluginManager; } namespace Plugin { + class CLogPlugin; + CLogSettingsPage::CLogSettingsPage(QObject *parent) : IOptionsPage(parent), - _currentPage(NULL) + m_currentPage(NULL), + m_error(true), + m_warning(true), + m_debug(true), + m_assert(true), + m_info(true) { } QString CLogSettingsPage::id() const { - return QLatin1String("Log"); + return QLatin1String("log"); } QString CLogSettingsPage::trName() const @@ -49,32 +61,78 @@ namespace Plugin QString CLogSettingsPage::category() const { - return QLatin1String("General"); + return QLatin1String(Core::Constants::SETTINGS_CATEGORY_GENERAL); } QString CLogSettingsPage::trCategory() const { - return tr("General"); + return tr(Core::Constants::SETTINGS_TR_CATEGORY_GENERAL); + } + + QIcon CLogSettingsPage::categoryIcon() const + { + return QIcon(); } QWidget *CLogSettingsPage::createPage(QWidget *parent) { - _currentPage = new QWidget(parent); - _ui.setupUi(_currentPage); - return _currentPage; + m_currentPage = new QWidget(parent); + m_ui.setupUi(m_currentPage); + + readSettings(); + m_ui.errorCheck->setChecked(m_error); + m_ui.warningCheck->setChecked(m_warning); + m_ui.debugCheck->setChecked(m_debug); + m_ui.assertCheck->setChecked(m_assert); + m_ui.infoCheck->setChecked(m_info); + + return m_currentPage; } void CLogSettingsPage::apply() { - //ExtensionSystem::IPluginSpec *spec, _plugMan->plugins() - //ExtensionSystem::IPluginManager; - //if (_ui.errorCheck->isChecked()) { - //displayer(); - //} - //if (_ui.warningCheck->isChecked()); - //if (_ui.debugCheck->isChecked()); - //if (_ui.assertCheck->isChecked()); - //if (_ui.infoCheck->isChecked()); + m_error = m_ui.errorCheck->isChecked(); + m_warning = m_ui.warningCheck->isChecked(); + m_debug = m_ui.debugCheck->isChecked(); + m_assert = m_ui.assertCheck->isChecked(); + m_info = m_ui.infoCheck->isChecked(); + + writeSettings(); + ExtensionSystem::IPluginManager *p = Core::ICore::instance()->pluginManager(); + ExtensionSystem::IPlugin *plugin = p->pluginByName("LogPlugin")->plugin(); + CLogPlugin* lp = dynamic_cast(plugin); + if (lp) + { + lp->setDisplayers(); + } + } + + void CLogSettingsPage::readSettings() + { + QSettings *settings = Core::ICore::instance()->settings(); + + settings->beginGroup(Core::Constants::LOG_SECTION); + m_error = settings->value(Core::Constants::LOG_ERROR, true).toBool(); + m_warning = settings->value(Core::Constants::LOG_WARNING, true).toBool(); + m_debug = settings->value(Core::Constants::LOG_DEBUG, true).toBool(); + m_assert = settings->value(Core::Constants::LOG_ASSERT, true).toBool(); + m_info = settings->value(Core::Constants::LOG_INFO, true).toBool(); + settings->endGroup(); + } + + void CLogSettingsPage::writeSettings() + { + QSettings *settings = Core::ICore::instance()->settings(); + + settings->beginGroup(Core::Constants::LOG_SECTION); + settings->setValue(Core::Constants::LOG_ERROR, m_error); + settings->setValue(Core::Constants::LOG_WARNING, m_warning); + settings->setValue(Core::Constants::LOG_DEBUG, m_debug); + settings->setValue(Core::Constants::LOG_ASSERT, m_assert); + settings->setValue(Core::Constants::LOG_INFO, m_info); + settings->endGroup(); + + settings->sync(); } } /* namespace Plugin */ \ No newline at end of file diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.h index 396afcdd3..2c0c5ed98 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/log_settings_page.h @@ -29,29 +29,39 @@ class QWidget; namespace Plugin { -/** -@class CLogSettingsPage -*/ -class CLogSettingsPage : public Core::IOptionsPage -{ - Q_OBJECT -public: - CLogSettingsPage(QObject *parent = 0); - virtual ~CLogSettingsPage() {} + /** + @class CLogSettingsPage + */ + class CLogSettingsPage : public Core::IOptionsPage + { + Q_OBJECT + public: + CLogSettingsPage(QObject *parent = 0); + virtual ~CLogSettingsPage() {} - virtual QString id() const; - virtual QString trName() const; - virtual QString category() const; - virtual QString trCategory() const; - virtual QWidget *createPage(QWidget *parent); + virtual QString id() const; + virtual QString trName() const; + virtual QString category() const; + virtual QString trCategory() const; + QIcon categoryIcon() const; + virtual QWidget *createPage(QWidget *parent); - virtual void apply(); - virtual void finish() {} + virtual void apply(); + virtual void finish() {} -private: - QWidget *_currentPage; - Ui::CLogSettingsPage _ui; -}; + private: + void readSettings(); + void writeSettings(); + + QWidget *m_currentPage; + Ui::CLogSettingsPage m_ui; + + bool m_error; + bool m_warning; + bool m_debug; + bool m_assert; + bool m_info; + }; } // namespace Core diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/qt_displayer.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/qt_displayer.cpp index aaeae9a1a..fc694d779 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/log/qt_displayer.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/log/qt_displayer.cpp @@ -1,24 +1,21 @@ -/* -Georges Editor Qt -Copyright (C) 2010 Adrian Jaekel - -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 . - -*/ +// Object Viewer Qt - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// 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 . // Nel includes - #include "qt_displayer.h" #include #include diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.ui b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.ui index 1a2d7c988..569caa302 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.ui +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/painter_dock_widget.ui @@ -6,13 +6,13 @@ 0 0 - 361 + 206 555 - 300 + 200 83 @@ -33,21 +33,21 @@ - 0 + 2 - Paint Tiles + Tiles - Paint Colors + Colors - Paint Displacement + Displacement diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp index 02197adf1..1bd91f667 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.cpp @@ -1,9 +1,18 @@ #include "zone_painter_main_window.h" #include "ui_zone_painter_main_window.h" +#include +#include +#include +#include +#include + #include "qnel_widget.h" #include "painter_dock_widget.h" -#include + +#include "../core/icore.h" +#include "../core/imenu_manager.h" +#include "../core/core_constants.h" ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) : QMainWindow(parent), @@ -13,45 +22,141 @@ ZonePainterMainWindow::ZonePainterMainWindow(QWidget *parent) : m_nelWidget = new NLQT::QNLWidget(this); setCentralWidget(m_nelWidget); + // Load the settings. + loadConfig(); + // Set up dock widget(s) and toolbar. m_painterDockWidget = new PainterDockWidget(this); addDockWidget(Qt::RightDockWidgetArea, m_painterDockWidget); m_painterDockWidget->setVisible(true); // Insert tool modes - _toolModeMenu = new QMenu(tr("Tool Mode"), ui->painterToolBar); - _toolModeMenu->setIcon(QIcon(":/painterTools/images/draw-brush.png")); - ui->painterToolBar->addAction(_toolModeMenu->menuAction()); - //connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode())); - - //QSignalMapper *modeMapper = new QSignalMapper(this); - - _toolPaintModeAction = _toolModeMenu->addAction(tr("Paint Mode")); - _toolPaintModeAction->setIcon(QIcon(":/painterTools/images/draw-brush.png")); - _toolPaintModeAction->setStatusTip(tr("Set paint mode")); - //connect(_pointRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - //modeMapper->setMapping(_pointRenderModeAction, 0); - - _toolFillModeAction = _toolModeMenu->addAction(tr("Fill Mode")); - _toolFillModeAction->setStatusTip(tr("Set fill mode")); - _toolFillModeAction->setIcon(QIcon(":/painterTools/images/color-fill.png")); - //connect(_lineRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - //modeMapper->setMapping(_lineRenderModeAction, 1); - - _toolSelectModeAction = _toolModeMenu->addAction(tr("Select mode")); - _toolSelectModeAction->setIcon(QIcon(":/painterTools/images/go-jump-4.png")); - _toolSelectModeAction->setStatusTip(tr("Set select mode")); - //connect(_fillRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - //modeMapper->setMapping(_fillRenderModeAction, 2); - - _toolPickModeAction = _toolModeMenu->addAction(tr("Pick mode")); - _toolPickModeAction->setIcon(QIcon(":/painterTools/images/color-picker-black.png")); - _toolPickModeAction->setStatusTip(tr("Set color picking mode")); - //connect(_fillRenderModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); - //modeMapper->setMapping(_fillRenderModeAction, 2); - - //connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setRenderMode(int))); + _toolModeMenu = new QMenu(tr("Tool Mode"), ui->painterToolBar); + _toolModeMenu->setIcon(QIcon(":/painterTools/images/draw-brush.png")); + ui->painterToolBar->addAction(_toolModeMenu->menuAction()); + //connect(_renderModeMenu->menuAction(), SIGNAL(triggered()), this, SLOT(setRenderMode())); + + QSignalMapper *modeMapper = new QSignalMapper(this); + + _toolPaintModeAction = _toolModeMenu->addAction(tr("Paint Mode")); + _toolPaintModeAction->setIcon(QIcon(":/painterTools/images/draw-brush.png")); + _toolPaintModeAction->setStatusTip(tr("Set paint mode")); + connect(_toolPaintModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolPaintModeAction, 0); + + _toolFillModeAction = _toolModeMenu->addAction(tr("Fill Mode")); + _toolFillModeAction->setStatusTip(tr("Set fill mode")); + _toolFillModeAction->setIcon(QIcon(":/painterTools/images/color-fill.png")); + connect(_toolFillModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolFillModeAction, 1); + + _toolSelectModeAction = _toolModeMenu->addAction(tr("Select mode")); + _toolSelectModeAction->setIcon(QIcon(":/painterTools/images/go-jump-4.png")); + _toolSelectModeAction->setStatusTip(tr("Set select mode")); + connect(_toolSelectModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolSelectModeAction, 2); + + _toolPickModeAction = _toolModeMenu->addAction(tr("Pick mode")); + _toolPickModeAction->setIcon(QIcon(":/painterTools/images/color-picker-black.png")); + _toolPickModeAction->setStatusTip(tr("Set color picking mode")); + connect(_toolPickModeAction, SIGNAL(triggered()), modeMapper, SLOT(map())); + modeMapper->setMapping(_toolPickModeAction, 2); + + connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(setToolMode(int))); + + m_statusBarTimer = new QTimer(this); + connect(m_statusBarTimer, SIGNAL(timeout()), this, SLOT(updateStatusBar())); + m_statusInfo = new QLabel(this); + m_statusInfo->hide(); + + // Set Background Color Toolbar + + connect(ui->actionBackground_Dlg, SIGNAL(triggered()), this, SLOT(setBackgroundColor())); + + + Core::ICore::instance()->mainWindow()->statusBar()->addPermanentWidget(m_statusInfo); + + +} + +void ZonePainterMainWindow::showEvent(QShowEvent *showEvent) +{ + QMainWindow::showEvent(showEvent); + m_statusBarTimer->start(1000); + m_statusInfo->show(); +} + +void ZonePainterMainWindow::hideEvent(QHideEvent *hideEvent) +{ + m_statusBarTimer->stop(); + m_statusInfo->hide(); + QMainWindow::hideEvent(hideEvent); +} + +void ZonePainterMainWindow::updateStatusBar() +{ + m_statusInfo->setText(QString("Tool Mode: Paint Mode")); +} + +void ZonePainterMainWindow::setToolMode(int value) +{ + switch (value) + { + case 0: + //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); + break; + case 1: + //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); + break; + case 2: + //Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); + break; + } +} + +void ZonePainterMainWindow::setToolMode() +{ + //switch (Modules::objView().getDriver()->getPolygonMode()) + //{ + //case NL3D::UDriver::Filled: + // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Line); + // break; + //case NL3D::UDriver::Line: + // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Point); + // break; + //case NL3D::UDriver::Point: + // Modules::objView().getDriver()->setPolygonMode (NL3D::UDriver::Filled); + // break; + //} +} + +void ZonePainterMainWindow::setBackgroundColor() { + QColor color = QColorDialog::getColor(QColor(m_nelWidget->backgroundColor().R, + m_nelWidget->backgroundColor().G, + m_nelWidget->backgroundColor().B)); + if (color.isValid()) + m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue())); +} + +void ZonePainterMainWindow::loadConfig() { + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup("ZonePainter"); + + QColor color; + color = settings->value("BackgroundColor", QColor(80, 80, 80)).value(); + m_nelWidget->setBackgroundColor(NLMISC::CRGBA(color.red(), color.green(), color.blue(), color.alpha())); +} + +void ZonePainterMainWindow::saveConfig() { + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup("ZonePainter" ); + + QColor color(m_nelWidget->backgroundColor().R, m_nelWidget->backgroundColor().G, m_nelWidget->backgroundColor().B, m_nelWidget->backgroundColor().A); + settings->setValue("BackgroundColor", color); + + settings->endGroup(); + settings->sync(); } ZonePainterMainWindow::~ZonePainterMainWindow() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h index d4d1584ba..d55eb39e5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/zone_painter/zone_painter_main_window.h @@ -2,6 +2,9 @@ #define ZONE_PAINTER_MAIN_WINDOW_H #include +#include +#include +#include namespace NLQT { class QNLWidget; @@ -21,16 +24,33 @@ public: explicit ZonePainterMainWindow(QWidget *parent = 0); ~ZonePainterMainWindow(); + void loadConfig(); + void saveConfig(); + +public Q_SLOTS: + void setToolMode(int value); + void setToolMode(); + void updateStatusBar(); + void setBackgroundColor(); + +protected: + virtual void showEvent(QShowEvent *showEvent); + virtual void hideEvent(QHideEvent *hideEvent); + private: Ui::ZonePainterMainWindow *ui; NLQT::QNLWidget *m_nelWidget; PainterDockWidget *m_painterDockWidget; + QTimer *m_statusBarTimer; + QLabel *m_statusInfo; QAction *_toolPaintModeAction; QAction *_toolFillModeAction; QAction *_toolSelectModeAction; QAction *_toolPickModeAction; QMenu *_toolModeMenu; + + //QAction *m_setBackColorAction; }; #endif // ZONE_PAINTER_MAIN_WINDOW_H diff --git a/code/ryzom/client/src/interface_v3/group_menu.cpp b/code/ryzom/client/src/interface_v3/group_menu.cpp index 93d2ee4bb..22ff2b07c 100644 --- a/code/ryzom/client/src/interface_v3/group_menu.cpp +++ b/code/ryzom/client/src/interface_v3/group_menu.cpp @@ -1156,7 +1156,7 @@ void CGroupSubMenu::addSeparatorAtIndex(uint index, const std::string &id) tmp.CheckBox = NULL; tmp.RightArrow = NULL; _Lines.insert(_Lines.begin() + index, tmp); - _SubMenus.insert(_SubMenus.begin() + index, NULL); + _SubMenus.insert(_SubMenus.begin() + index, (CGroupSubMenu*)NULL); _GroupMenu->invalidateCoords(); } @@ -1304,7 +1304,7 @@ CViewTextMenu* CGroupSubMenu::addLineAtIndex(uint index, const ucstring &name, _Lines.insert(_Lines.begin() + index, tmp); // Add an empty sub menu by default - _SubMenus.insert(_SubMenus.begin() + index, NULL); + _SubMenus.insert(_SubMenus.begin() + index, (CGroupSubMenu*)NULL); _GroupMenu->invalidateCoords(); diff --git a/code/ryzom/client/src/interface_v3/group_tab.cpp b/code/ryzom/client/src/interface_v3/group_tab.cpp index 33588cbb9..27e6aa3a4 100644 --- a/code/ryzom/client/src/interface_v3/group_tab.cpp +++ b/code/ryzom/client/src/interface_v3/group_tab.cpp @@ -155,7 +155,7 @@ void CGroupTab::addTab(CCtrlTabButton * tabB, sint index) { if(i==index) { - tabB->setId(string("tab") + count); + tabB->setId("tab" + NLMISC::toString(count)); tabB->setParentPos(lastTab); if(i==0) tabB->setParentPosRef(Hotspot_TL); @@ -168,7 +168,7 @@ void CGroupTab::addTab(CCtrlTabButton * tabB, sint index) count++; } - buttons[i]->setId(string("tab") + count); + buttons[i]->setId("tab" + NLMISC::toString(count)); buttons[i]->setParentPos(lastTab); if(i==0 && index!=0) buttons[i]->setParentPosRef(Hotspot_TL); @@ -297,7 +297,7 @@ void CGroupTab::removeTab(sint index) { if(i!=index) { - buttons[i]->setId(string("tab")+count); + buttons[i]->setId("tab"+NLMISC::toString(count)); buttons[i]->setParentPos(lastTab); if((i==0) || (index==0 && i==1)) buttons[i]->setParentPosRef(Hotspot_TL); diff --git a/code/ryzom/client/src/r2/displayer_visual_entity.cpp b/code/ryzom/client/src/r2/displayer_visual_entity.cpp index f8f6bfd9d..20f84c90f 100644 --- a/code/ryzom/client/src/r2/displayer_visual_entity.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_entity.cpp @@ -986,7 +986,7 @@ void CDisplayerVisualEntity::updateName() } std::string firstPart = ""; if(actNb>0) - firstPart = CI18N::get("uiR2EDDefaultActTitle").toString() + " " + actNb; + firstPart = CI18N::get("uiR2EDDefaultActTitle").toString() + " " + NLMISC::toString(actNb); if (act->isString("Name")) actName = act->toString("Name"); diff --git a/code/ryzom/client/src/stdpch.h b/code/ryzom/client/src/stdpch.h index fdb16ef93..48c1a3c06 100644 --- a/code/ryzom/client/src/stdpch.h +++ b/code/ryzom/client/src/stdpch.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include diff --git a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml index be7ce1beb..1e4f9d723 100644 --- a/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml +++ b/code/ryzom/common/data_leveldesign/leveldesign/world_editor_files/world_editor_classes.xml @@ -688,12 +688,15 @@ + + + @@ -835,11 +838,20 @@ + + + + + + + + + @@ -852,6 +864,7 @@ + @@ -1007,6 +1020,7 @@ + @@ -1019,6 +1033,7 @@ + @@ -1093,6 +1108,8 @@ + + @@ -1106,6 +1123,9 @@ + + + @@ -1115,7 +1135,9 @@ - + + + @@ -1124,24 +1146,34 @@ + + + + - + + + - + + + - + + + @@ -1150,20 +1182,27 @@ + + + - + + + - + + + @@ -1173,7 +1212,9 @@ - + + + @@ -1182,7 +1223,9 @@ - + + + @@ -1190,7 +1233,9 @@ - + + + @@ -1198,26 +1243,35 @@ - + + + - + + + - + + + + + + @@ -1250,13 +1304,18 @@ + + + - + + + diff --git a/code/ryzom/server/src/ai_service/nf_static.cpp b/code/ryzom/server/src/ai_service/nf_static.cpp index 0168d80ad..fa1699b4b 100644 --- a/code/ryzom/server/src/ai_service/nf_static.cpp +++ b/code/ryzom/server/src/ai_service/nf_static.cpp @@ -674,7 +674,7 @@ void md5sum_s_s(CStateInstance* entity, CScriptStack& stack) { std::string str = (std::string)stack.top(); - std::string value = NLMISC::getMD5((uint8*)&str[0], str.size() ).toString(); + std::string value = NLMISC::getMD5((uint8*)&str[0], (uint32)str.size() ).toString(); nlinfo(value.c_str()); stack.top() = value; } diff --git a/code/ryzom/server/src/ai_service/stdpch.h b/code/ryzom/server/src/ai_service/stdpch.h index c94346568..0ff2ba7ea 100644 --- a/code/ryzom/server/src/ai_service/stdpch.h +++ b/code/ryzom/server/src/ai_service/stdpch.h @@ -52,6 +52,7 @@ #include #include #include +#include //---------------------------------------------------------------- diff --git a/code/ryzom/server/src/logger_service/log_query.h b/code/ryzom/server/src/logger_service/log_query.h index 8fab1be35..60d6206fb 100644 --- a/code/ryzom/server/src/logger_service/log_query.h +++ b/code/ryzom/server/src/logger_service/log_query.h @@ -21,6 +21,7 @@ #include "nel/misc/types_nl.h" #include +#include #include "nel/misc/common.h" diff --git a/code/ryzom/tools/leveldesign/CMakeLists.txt b/code/ryzom/tools/leveldesign/CMakeLists.txt index be22df62c..c490de731 100644 --- a/code/ryzom/tools/leveldesign/CMakeLists.txt +++ b/code/ryzom/tools/leveldesign/CMakeLists.txt @@ -10,11 +10,11 @@ ADD_SUBDIRECTORY(named_items_2_csv) IF(WIN32) ADD_SUBDIRECTORY(export) ADD_SUBDIRECTORY(world_editor) + IF(WITH_MFC) + ADD_SUBDIRECTORY(mission_compiler_fe) + ENDIF(WITH_MFC) ENDIF(WIN32) -IF(WITH_MFC) - ADD_SUBDIRECTORY(mission_compiler_fe) -ENDIF(WITH_MFC) IF(WITH_QT) ADD_SUBDIRECTORY(georges_editor_qt) diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp index bc3b21cb8..814239949 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp @@ -17,6 +17,7 @@ #include "mission_compiler.h" #include "step.h" #include "nel/misc/i18n.h" +#include "nel/ligo/primitive_utils.h" using namespace std; using namespace NLMISC; @@ -526,7 +527,12 @@ bool CMissionCompiler::compileMission(NLLIGO::IPrimitive *rootPrim, const std::s } // first, start by reading mission variables - IPrimitive *variables = getPrimitiveChild(mission, TPrimitiveClassPredicate("variables")); + IPrimitive *variables; + { + TPrimitiveClassPredicate predTmp("variables"); + variables= NLLIGO::getPrimitiveChild(mission, predTmp); + } + if (!variables) { nlwarning("Can't find variables !"); @@ -540,7 +546,12 @@ bool CMissionCompiler::compileMission(NLLIGO::IPrimitive *rootPrim, const std::s // now, we can init the mission header phrase (they need variable knwoled) md.initHeaderPhrase(rootPrim); - IPrimitive *preReq = getPrimitiveChild(mission, TPrimitiveClassPredicate("pre_requisite")); + IPrimitive *preReq; + { + TPrimitiveClassPredicate predTmp("pre_requisite"); + preReq = getPrimitiveChild(mission, predTmp); + } + if (!preReq) { nlwarning("Can't find pre requisite !"); @@ -598,7 +609,8 @@ bool CMissionCompiler::compileMissions(IPrimitive *rootPrim, const std::string & CPrimitiveSet scriptsSet; - scriptsSet.buildSet(rootPrim, TPrimitiveClassPredicate("mission_tree"), missionTrees); + TPrimitiveClassPredicate pred("mission_tree"); + scriptsSet.buildSet(rootPrim, pred, missionTrees); nlinfo("Found %u mission tree in the primitive file", missionTrees.size()); @@ -667,7 +679,8 @@ bool CMissionCompiler::installCompiledMission(NLLIGO::CLigoConfig &ligoConfig, c TPrimitiveSet scripts; CPrimitiveSet filter; - filter.buildSet(primDoc->RootNode, TPrimitiveClassPredicate("mission"), scripts); + TPrimitiveClassPredicate pred("mission"); + filter.buildSet(primDoc->RootNode, pred, scripts); // for each script, check if it was generated, and if so, check the name // of the source primitive file. @@ -732,7 +745,8 @@ bool CMissionCompiler::installCompiledMission(NLLIGO::CLigoConfig &ligoConfig, c TPrimitiveSet bots; CPrimitiveSet filter; - filter.buildSet(primDoc->RootNode, TPrimitiveClassAndNamePredicate("npc_bot", mission.getGiverName()), bots); + TPrimitiveClassAndNamePredicate pred("npc_bot", mission.getGiverName()); + filter.buildSet(primDoc->RootNode, pred, bots); if (bots.empty()) { @@ -961,7 +975,8 @@ bool CMissionCompiler::parseOneStep(CMissionData &md, IPrimitive *stepToParse, I bool CMissionCompiler::parseSteps(CMissionData &md, IPrimitive *steps, IStep *parent) { TPrimitiveSet childs; - filterPrimitiveChilds(steps, TPrimitivePropertyPredicate("step_tag", "true"), childs); + TPrimitivePropertyPredicate pred("step_tag", "true"); + filterPrimitiveChilds(steps, pred, childs); if (childs.empty()) { diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp index 10842c97c..44e6e96cc 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp @@ -55,7 +55,11 @@ IStep::IStep(CMissionData &md, NLLIGO::IPrimitive *prim) // parse the sub prim to create action & objectives; IPrimitive *child; // parse the preactions - child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("actions", "pre_actions")); + { + TPrimitiveClassAndNamePredicate pred("actions", "pre_actions"); + child = getPrimitiveChild(prim, pred); + } + if (child) { for (uint i=0; igetNumChildren(); ++i) @@ -72,7 +76,10 @@ IStep::IStep(CMissionData &md, NLLIGO::IPrimitive *prim) } } // parse the objectives - child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("mission_objectives", "objectives")); + { + TPrimitiveClassAndNamePredicate pred("mission_objectives", "objectives"); + child = getPrimitiveChild(prim, pred); + } if (child) { for (uint i=0; igetNumChildren(); ++i) @@ -89,7 +96,10 @@ IStep::IStep(CMissionData &md, NLLIGO::IPrimitive *prim) } } // parse the post actions - child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("actions", "post_actions")); + { + TPrimitiveClassAndNamePredicate pred("actions", "post_actions"); + child = getPrimitiveChild(prim, pred); + } if (child) { for (uint i=0; igetNumChildren(); ++i) @@ -447,7 +457,10 @@ public: // parse the sub prim to create action & objectives; IPrimitive *child; // parse the pre-actions - child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("actions", "actions")); + { + TPrimitiveClassAndNamePredicate pred("actions", "actions"); + child = getPrimitiveChild(prim, pred); + } if (child) { for (uint i=0; igetNumChildren(); ++i) @@ -464,7 +477,10 @@ public: } } // look for an optional jump - child = getPrimitiveChild(prim, TPrimitiveClassPredicate("jump_to")); + { + TPrimitiveClassPredicate pred("jump_to"); + child = getPrimitiveChild(prim, pred); + } if (child) { // ok, we have a jump at end of fail step @@ -515,7 +531,10 @@ public: // parse the sub prim to create action & objectives; IPrimitive *child; // parse the pre-actions - child = getPrimitiveChild(prim, TPrimitiveClassAndNamePredicate("actions", "actions")); + { + TPrimitiveClassAndNamePredicate pred("actions", "actions"); + child = getPrimitiveChild(prim, pred); + } if (child) { for (uint i=0; igetNumChildren(); ++i) @@ -546,7 +565,10 @@ public: } // look for an optional jump - child = getPrimitiveChild(prim, TPrimitiveClassPredicate("jump_to")); + { + TPrimitiveClassPredicate pred("jump_to"); + child = getPrimitiveChild(prim, pred); + } if (child) { // ok, we have a jump at end of fail step @@ -607,14 +629,20 @@ CStepPlayerReconnect::CStepPlayerReconnect(CMissionData &md, IPrimitive *prim) : IPrimitive *child; TPrimitiveSet resp; - filterPrimitiveChilds(prim, TPrimitivePropertyPredicate("step_tag", "true"), resp); + { + TPrimitivePropertyPredicate pred("step_tag", "true"); + filterPrimitiveChilds(prim, pred, resp); + } for (uint i=0; i noSteps; // Get the 'yes branch' jump point - filterPrimitiveChilds(_SubBranchs[1], TPrimitivePropertyPredicate("step_tag", "true"), childs); + { + TPrimitivePropertyPredicate pred("step_tag", "true"); + filterPrimitiveChilds(_SubBranchs[1], pred, childs); + } if (!childs.empty()) { for (i = 0; i < _SubSteps.size(); ++i) @@ -1071,7 +1115,10 @@ string CStepIf::genCode(CMissionData &md) // Get the 'no branch' jump point childs.clear(); - filterPrimitiveChilds(_SubBranchs[0], TPrimitivePropertyPredicate("step_tag", "true"), childs); + { + TPrimitivePropertyPredicate pred("step_tag", "true"); + filterPrimitiveChilds(_SubBranchs[0], pred, childs); + } if (!childs.empty()) { for (i = 0; i < _SubSteps.size(); ++i) diff --git a/code/ryzom/tools/leveldesign/mp_generator/main.cpp b/code/ryzom/tools/leveldesign/mp_generator/main.cpp index bbd7102b8..68e18172e 100644 --- a/code/ryzom/tools/leveldesign/mp_generator/main.cpp +++ b/code/ryzom/tools/leveldesign/mp_generator/main.cpp @@ -1305,7 +1305,7 @@ void ItemNamesSave() output = "i"; output += data.splitTo( "prospector", true ); - set::iterator it = itemNames.begin(); + CSortedStringSet::const_iterator it = itemNames.begin(); while ( it != itemNames.end() ) { diff --git a/code/ryzom/tools/translation_tools/main.cpp b/code/ryzom/tools/translation_tools/main.cpp index 5655442e9..7f9edf891 100644 --- a/code/ryzom/tools/translation_tools/main.cpp +++ b/code/ryzom/tools/translation_tools/main.cpp @@ -61,9 +61,11 @@ * trans_tool update_phrase_work * trans_tool inject_clause * trans_tool sort_trans_phrase - - - +* trans_tool make_worksheet_diff +* trans_tool merge_worksheet_diff +* trans_tool crop_lines +* trans_tool extract_bot_names +* trans_tool extract_new_sheet_names */ @@ -78,6 +80,7 @@ #include #include #include +#include using namespace std; using namespace NLMISC;