merge
|
@ -288,6 +288,26 @@ MACRO(NL_SETUP_BUILD)
|
||||||
ENDIF(CMAKE_BUILD_TYPE MATCHES "Release")
|
ENDIF(CMAKE_BUILD_TYPE MATCHES "Release")
|
||||||
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
|
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(WIN32)
|
||||||
IF(MSVC10)
|
IF(MSVC10)
|
||||||
# /Ox is working with VC++ 2010, but custom optimizations don't exist
|
# /Ox is working with VC++ 2010, but custom optimizations don't exist
|
||||||
|
@ -301,14 +321,24 @@ MACRO(NL_SETUP_BUILD)
|
||||||
SET(MIN_OPTIMIZATIONS "/Ob1")
|
SET(MIN_OPTIMIZATIONS "/Ob1")
|
||||||
ENDIF(MSVC10)
|
ENDIF(MSVC10)
|
||||||
|
|
||||||
SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP")
|
SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-")
|
||||||
|
|
||||||
# Exceptions are only set for C++
|
|
||||||
SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa")
|
|
||||||
|
|
||||||
# Common link flags
|
# Common link flags
|
||||||
SET(PLATFORM_LINKFLAGS "-DEBUG")
|
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_DEBUG_CFLAGS "/MDd /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS}")
|
||||||
SET(NL_RELEASE_CFLAGS "/MD /D NDEBUG ${SPEED_OPTIMIZATIONS}")
|
SET(NL_RELEASE_CFLAGS "/MD /D NDEBUG ${SPEED_OPTIMIZATIONS}")
|
||||||
SET(NL_DEBUG_LINKFLAGS "/NODEFAULTLIB:msvcrt /INCREMENTAL:YES")
|
SET(NL_DEBUG_LINKFLAGS "/NODEFAULTLIB:msvcrt /INCREMENTAL:YES")
|
||||||
|
@ -331,29 +361,7 @@ MACRO(NL_SETUP_BUILD)
|
||||||
|
|
||||||
SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -D_DEBUG")
|
SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -D_DEBUG")
|
||||||
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O6")
|
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O6")
|
||||||
|
|
||||||
ENDIF(WIN32)
|
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)
|
ENDMACRO(NL_SETUP_BUILD)
|
||||||
|
|
||||||
MACRO(NL_SETUP_BUILD_FLAGS)
|
MACRO(NL_SETUP_BUILD_FLAGS)
|
||||||
|
|
|
@ -945,10 +945,13 @@ inline CSString operator+(const char* s0,const CSString& s1)
|
||||||
return CSString(s0)+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)
|
inline CSString operator+(const std::string& s0,const CSString& s1)
|
||||||
{
|
{
|
||||||
return s0+static_cast<const std::string&>(s1);
|
return s0+static_cast<const std::string&>(s1);
|
||||||
}
|
}
|
||||||
|
#endif // NL_COMP_VC10
|
||||||
|
|
||||||
} // NLMISC
|
} // NLMISC
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
|
||||||
if (!mat._MatDrvInfo)
|
if (!mat._MatDrvInfo)
|
||||||
{
|
{
|
||||||
// Insert into driver list. (so it is deleted when driver is deleted).
|
// 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);
|
*it = mat._MatDrvInfo = new CMaterialDrvInfosD3D(this, it);
|
||||||
|
|
||||||
|
|
|
@ -347,7 +347,7 @@ bool CDriverD3D::activeShader(CShader *shd)
|
||||||
if ( !shd->_DrvInfo )
|
if ( !shd->_DrvInfo )
|
||||||
{
|
{
|
||||||
// insert into driver list. (so it is deleted when driver is deleted).
|
// 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.
|
// create and set iterator, for future deletion.
|
||||||
shaderInfo = new CShaderDrvInfosD3D(this, it);
|
shaderInfo = new CShaderDrvInfosD3D(this, it);
|
||||||
*it= shd->_DrvInfo = shaderInfo;
|
*it= shd->_DrvInfo = shaderInfo;
|
||||||
|
|
|
@ -514,7 +514,7 @@ bool CDriverD3D::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded
|
||||||
if ( !tex.TextureDrvShare )
|
if ( !tex.TextureDrvShare )
|
||||||
{
|
{
|
||||||
// insert into driver list. (so it is deleted when driver is deleted).
|
// 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.
|
// create and set iterator, for future deletion.
|
||||||
*it= tex.TextureDrvShare= new CTextureDrvShare(this, it, &tex);
|
*it= tex.TextureDrvShare= new CTextureDrvShare(this, it, &tex);
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
|
||||||
if (!mat._MatDrvInfo)
|
if (!mat._MatDrvInfo)
|
||||||
{
|
{
|
||||||
// insert into driver list. (so it is deleted when driver is deleted).
|
// 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.
|
// create and set iterator, for future deletion.
|
||||||
*it= mat._MatDrvInfo= new CShaderGL(this, it);
|
*it= mat._MatDrvInfo= new CShaderGL(this, it);
|
||||||
|
|
||||||
|
|
|
@ -626,7 +626,7 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded,
|
||||||
{
|
{
|
||||||
//nldebug("3D: creating CTextureDrvShare()");
|
//nldebug("3D: creating CTextureDrvShare()");
|
||||||
// insert into driver list. (so it is deleted when driver is deleted).
|
// 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.
|
// create and set iterator, for future deletion.
|
||||||
*it= tex.TextureDrvShare= new CTextureDrvShare(this, it, &tex);
|
*it= tex.TextureDrvShare= new CTextureDrvShare(this, it, &tex);
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ bool CDriverGL::setupVertexBuffer(CVertexBuffer& VB)
|
||||||
// 1. Retrieve/Create driver shader.
|
// 1. Retrieve/Create driver shader.
|
||||||
//==================================
|
//==================================
|
||||||
// insert into driver list. (so it is deleted when driver is deleted).
|
// 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.
|
// create and set iterator, for future deletion.
|
||||||
CVBDrvInfosGL *info = new CVBDrvInfosGL(this, it, &VB);
|
CVBDrvInfosGL *info = new CVBDrvInfosGL(this, it, &VB);
|
||||||
*it= VB.DrvInfos = info;
|
*it= VB.DrvInfos = info;
|
||||||
|
|
|
@ -111,7 +111,7 @@ bool CDriverGL::activeNVVertexProgram (CVertexProgram *program)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert into driver list. (so it is deleted when driver is deleted).
|
// 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
|
// Create a driver info
|
||||||
*it = drvInfo = new CVertexProgamDrvInfosGL (this, it);
|
*it = drvInfo = new CVertexProgamDrvInfosGL (this, it);
|
||||||
|
@ -1472,7 +1472,7 @@ bool CDriverGL::activeARBVertexProgram (CVertexProgram *program)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Insert into driver list. (so it is deleted when driver is deleted).
|
// 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
|
// Create a driver info
|
||||||
*it = drvInfo = new CVertexProgamDrvInfosGL (this, it);
|
*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).
|
// 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
|
// Create a driver info
|
||||||
*it = drvInfo = new CVertexProgamDrvInfosGL (this, it);
|
*it = drvInfo = new CVertexProgamDrvInfosGL (this, it);
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "nel/misc/bit_mem_stream.h"
|
#include "nel/misc/bit_mem_stream.h"
|
||||||
//
|
//
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <iterator>
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -969,14 +969,12 @@ void force_exception_frame(...) {std::cout.flush();}
|
||||||
static void exceptionTranslator(unsigned, EXCEPTION_POINTERS *pexp)
|
static void exceptionTranslator(unsigned, EXCEPTION_POINTERS *pexp)
|
||||||
{
|
{
|
||||||
#ifndef NL_NO_DEBUG_FILES
|
#ifndef NL_NO_DEBUG_FILES
|
||||||
FILE *file = fopen ("exception_catched", "wb");
|
CFile::createEmptyFile(getLogDirectory() + "exception_catched");
|
||||||
fclose (file);
|
|
||||||
#endif
|
#endif
|
||||||
if (pexp->ExceptionRecord->ExceptionCode == EXCEPTION_BREAKPOINT)
|
if (pexp->ExceptionRecord->ExceptionCode == EXCEPTION_BREAKPOINT)
|
||||||
{
|
{
|
||||||
#ifndef NL_NO_DEBUG_FILES
|
#ifndef NL_NO_DEBUG_FILES
|
||||||
FILE *file2 = fopen ("breakpointed", "wb");
|
CFile::createEmptyFile(getLogDirectory() + "breakpointed");
|
||||||
fclose (file2);
|
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1683,12 +1681,18 @@ NLMISC_CATEGORISED_COMMAND(nel, writeaccess, "write a uint8 value in an invalid
|
||||||
uint8 val = 123;
|
uint8 val = 123;
|
||||||
uint8 *adr = (uint8*)0;
|
uint8 *adr = (uint8*)0;
|
||||||
if(args.size() >= 1)
|
if(args.size() >= 1)
|
||||||
|
{
|
||||||
#ifdef HAVE_X86_64
|
#ifdef HAVE_X86_64
|
||||||
adr = (uint8*)(uint64)atoi(args[0].c_str());
|
uint64 addr64;
|
||||||
|
NLMISC::fromString(args[0], addr64);
|
||||||
|
adr = (uint8*)addr64;
|
||||||
#else
|
#else
|
||||||
adr = (uint8*)atoi(args[0].c_str());
|
uint32 addr32;
|
||||||
|
NLMISC::fromString(args[0], addr32);
|
||||||
|
adr = (uint8*)addr32;
|
||||||
#endif
|
#endif
|
||||||
if(args.size() >= 2) val = (uint8)atoi(args[1].c_str());
|
}
|
||||||
|
if(args.size() >= 2) NLMISC::fromString(args[1], val);
|
||||||
*adr = val;
|
*adr = val;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1698,11 +1702,17 @@ NLMISC_CATEGORISED_COMMAND(nel, readaccess, "read a uint8 value in an invalid ad
|
||||||
uint8 val;
|
uint8 val;
|
||||||
uint8 *adr = (uint8*)0;
|
uint8 *adr = (uint8*)0;
|
||||||
if(args.size() == 1)
|
if(args.size() == 1)
|
||||||
|
{
|
||||||
#ifdef HAVE_X86_64
|
#ifdef HAVE_X86_64
|
||||||
adr = (uint8*)(uint64)atoi(args[0].c_str());
|
uint64 addr64;
|
||||||
|
NLMISC::fromString(args[0], addr64);
|
||||||
|
adr = (uint8*)addr64;
|
||||||
#else
|
#else
|
||||||
adr = (uint8*)atoi(args[0].c_str());
|
uint32 addr32;
|
||||||
|
NLMISC::fromString(args[0], addr32);
|
||||||
|
adr = (uint8*)addr32;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
val = *adr;
|
val = *adr;
|
||||||
log.displayNL("value is %hu", (uint16)val);
|
log.displayNL("value is %hu", (uint16)val);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -836,7 +836,7 @@ void CAudioMixerUser::buildSampleBankList()
|
||||||
nlinfo("Compiling sample bank [%s]", bankname.c_str());
|
nlinfo("Compiling sample bank [%s]", bankname.c_str());
|
||||||
std::string filename = buildSampleBank(bankDir[i], sbp, bankname);
|
std::string filename = buildSampleBank(bankDir[i], sbp, bankname);
|
||||||
if (bankFile.size() < i + 1) bankFile.resize(i + 1);
|
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;
|
bankFile[i] = filename;
|
||||||
}
|
}
|
||||||
else if (bankname < CFile::getFilenameWithoutExtension(bankDir[i]))
|
else if (bankname < CFile::getFilenameWithoutExtension(bankDir[i]))
|
||||||
|
|
|
@ -77,7 +77,7 @@ void CSimpleSound::getSubSoundList(std::vector<std::pair<std::string, CSound*
|
||||||
{
|
{
|
||||||
// A little hack, we use the reference vector to tag unavailable sample.
|
// A little hack, we use the reference vector to tag unavailable sample.
|
||||||
if (!(_Buffername == CStringMapper::emptyId()) && const_cast<CSimpleSound*>(this)->getBuffer() == 0)
|
if (!(_Buffername == CStringMapper::emptyId()) && const_cast<CSimpleSound*>(this)->getBuffer() == 0)
|
||||||
subsounds.push_back(pair<string, CSound*>(CStringMapper::unmap(_Buffername)+" (sample)", 0));
|
subsounds.push_back(pair<string, CSound*>(CStringMapper::unmap(_Buffername)+" (sample)", (CSound*)NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
#include "nel/misc/vector.h"
|
#include "nel/misc/vector.h"
|
||||||
#include "nel/misc/path.h"
|
#include "nel/misc/path.h"
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
ADD_SUBDIRECTORY(core)
|
ADD_SUBDIRECTORY(core)
|
||||||
ADD_SUBDIRECTORY(example)
|
ADD_SUBDIRECTORY(example)
|
||||||
ADD_SUBDIRECTORY(ovqt_sheet_builder)
|
ADD_SUBDIRECTORY(ovqt_sheet_builder)
|
||||||
|
ADD_SUBDIRECTORY(landscape_editor)
|
||||||
ADD_SUBDIRECTORY(log)
|
ADD_SUBDIRECTORY(log)
|
||||||
ADD_SUBDIRECTORY(disp_sheet_id)
|
ADD_SUBDIRECTORY(disp_sheet_id)
|
||||||
ADD_SUBDIRECTORY(object_viewer)
|
ADD_SUBDIRECTORY(object_viewer)
|
||||||
ADD_SUBDIRECTORY(zone_painter)
|
ADD_SUBDIRECTORY(zone_painter)
|
||||||
|
ADD_SUBDIRECTORY(georges_editor)
|
||||||
|
|
|
@ -18,15 +18,18 @@ SET(OVQT_CORE_PLUGIN_HDR
|
||||||
core.h
|
core.h
|
||||||
main_window.h
|
main_window.h
|
||||||
menu_manager.h
|
menu_manager.h
|
||||||
|
context_manager.h
|
||||||
settings_dialog.h
|
settings_dialog.h
|
||||||
search_paths_settings_page.h
|
search_paths_settings_page.h
|
||||||
general_settings_page.h
|
general_settings_page.h
|
||||||
plugin_view_dialog.h)
|
plugin_view_dialog.h
|
||||||
|
)
|
||||||
|
|
||||||
SET(OVQT_CORE_PLUGIN_UIS settings_dialog.ui
|
SET(OVQT_CORE_PLUGIN_UIS settings_dialog.ui
|
||||||
plugin_view_dialog.ui
|
plugin_view_dialog.ui
|
||||||
general_settings_page.ui
|
general_settings_page.ui
|
||||||
search_paths_settings_page.ui)
|
search_paths_settings_page.ui
|
||||||
|
)
|
||||||
|
|
||||||
SET(OVQT_CORE_PLUGIN_RCS core.qrc)
|
SET(OVQT_CORE_PLUGIN_RCS core.qrc)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "context_manager.h"
|
||||||
|
#include "icontext.h"
|
||||||
|
#include "main_window.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QTabWidget>
|
||||||
|
#include <QtGui/QGridLayout>
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
|
||||||
|
struct ContextManagerPrivate
|
||||||
|
{
|
||||||
|
explicit ContextManagerPrivate(Core::MainWindow *mainWindow, QTabWidget *tabWidget);
|
||||||
|
Core::MainWindow *m_mainWindow;
|
||||||
|
QTabWidget *m_tabWidget;
|
||||||
|
QVector<IContext *> m_contexts;
|
||||||
|
int m_oldCurrent;
|
||||||
|
};
|
||||||
|
|
||||||
|
ContextManagerPrivate::ContextManagerPrivate(Core::MainWindow *mainWindow, QTabWidget *tabWidget)
|
||||||
|
: m_mainWindow(mainWindow),
|
||||||
|
m_tabWidget(tabWidget),
|
||||||
|
m_oldCurrent(-1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ContextManager::ContextManager(Core::MainWindow *mainWindow, QTabWidget *tabWidget)
|
||||||
|
: d(new ContextManagerPrivate(mainWindow, tabWidget))
|
||||||
|
{
|
||||||
|
QObject::connect(d->m_mainWindow->pluginManager(), SIGNAL(objectAdded(QObject *)),
|
||||||
|
this, SLOT(objectAdded(QObject *)));
|
||||||
|
QObject::connect(d->m_mainWindow->pluginManager(), SIGNAL(aboutToRemoveObject(QObject *)),
|
||||||
|
this, SLOT(aboutToRemoveObject(QObject *)));
|
||||||
|
|
||||||
|
QObject::connect(d->m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
ContextManager::~ContextManager()
|
||||||
|
{
|
||||||
|
delete d;
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::IContext *ContextManager::currentContext() const
|
||||||
|
{
|
||||||
|
int currentIndex = d->m_tabWidget->currentIndex();
|
||||||
|
if (currentIndex < 0)
|
||||||
|
return 0;
|
||||||
|
return d->m_contexts.at(currentIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::IContext *ContextManager::context(const QString &id) const
|
||||||
|
{
|
||||||
|
const int index = indexOf(id);
|
||||||
|
if (index >= 0)
|
||||||
|
return d->m_contexts.at(index);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::activateContext(const QString &id)
|
||||||
|
{
|
||||||
|
const int index = indexOf(id);
|
||||||
|
if (index >= 0)
|
||||||
|
d->m_tabWidget->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::objectAdded(QObject *obj)
|
||||||
|
{
|
||||||
|
IContext *context = qobject_cast<IContext *>(obj);
|
||||||
|
if (context)
|
||||||
|
addContextObject(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::aboutToRemoveObject(QObject *obj)
|
||||||
|
{
|
||||||
|
IContext *context = qobject_cast<IContext *>(obj);
|
||||||
|
if (context)
|
||||||
|
removeContextObject(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::addContextObject(IContext *context)
|
||||||
|
{
|
||||||
|
d->m_contexts.push_back(context);
|
||||||
|
d->m_mainWindow->addContextObject(context);
|
||||||
|
|
||||||
|
QWidget *tabWidget = new QWidget(d->m_tabWidget);
|
||||||
|
d->m_tabWidget->addTab(tabWidget, context->icon(), context->trName());
|
||||||
|
QGridLayout *gridLayout = new QGridLayout(tabWidget);
|
||||||
|
gridLayout->setObjectName(QString::fromUtf8("gridLayout_") + context->id());
|
||||||
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout->addWidget(context->widget(), 0, 0, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::removeContextObject(IContext *context)
|
||||||
|
{
|
||||||
|
d->m_mainWindow->removeContextObject(context);
|
||||||
|
|
||||||
|
const int index = indexOf(context->id());
|
||||||
|
QWidget *widget = d->m_tabWidget->widget(index);
|
||||||
|
d->m_tabWidget->removeTab(index);
|
||||||
|
d->m_contexts.remove(index);
|
||||||
|
delete widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContextManager::currentTabChanged(int index)
|
||||||
|
{
|
||||||
|
if (index >= 0)
|
||||||
|
{
|
||||||
|
IContext *context = d->m_contexts.at(index);
|
||||||
|
IContext *oldContext = 0;
|
||||||
|
if (d->m_oldCurrent >= 0)
|
||||||
|
oldContext = d->m_contexts.at(d->m_oldCurrent);
|
||||||
|
d->m_oldCurrent = index;
|
||||||
|
Q_EMIT currentContextChanged(context, oldContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ContextManager::indexOf(const QString &id) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < d->m_contexts.count(); ++i)
|
||||||
|
{
|
||||||
|
if (d->m_contexts.at(i)->id() == id)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
nlwarning(QString("Warning, no such context: %1").arg(id).toStdString().c_str());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace Core */
|
|
@ -0,0 +1,70 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef CONTEXT_MANAGER_H
|
||||||
|
#define CONTEXT_MANAGER_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "core_global.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QTabWidget;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace Core
|
||||||
|
{
|
||||||
|
class IContext;
|
||||||
|
class MainWindow;
|
||||||
|
struct ContextManagerPrivate;
|
||||||
|
|
||||||
|
class CORE_EXPORT ContextManager : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ContextManager(Core::MainWindow *mainWindow, QTabWidget *tabWidget);
|
||||||
|
virtual ~ContextManager();
|
||||||
|
|
||||||
|
Core::IContext *currentContext() const;
|
||||||
|
Core::IContext *context(const QString &id) const;
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
// the default argument '=0' is important for connects without the oldContext argument.
|
||||||
|
void currentContextChanged(Core::IContext *context, Core::IContext *oldContext = 0);
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void activateContext(const QString &id);
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void objectAdded(QObject *obj);
|
||||||
|
void aboutToRemoveObject(QObject *obj);
|
||||||
|
void addContextObject(IContext *context);
|
||||||
|
void removeContextObject(IContext *context);
|
||||||
|
void currentTabChanged(int index);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int indexOf(const QString &id) const;
|
||||||
|
|
||||||
|
ContextManagerPrivate *d;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
|
#endif // CONTEXT_MANAGER_H
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "imenu_manager.h"
|
#include "imenu_manager.h"
|
||||||
|
#include "context_manager.h"
|
||||||
#include "main_window.h"
|
#include "main_window.h"
|
||||||
#include "../../extension_system/iplugin_manager.h"
|
#include "../../extension_system/iplugin_manager.h"
|
||||||
|
|
||||||
|
@ -54,6 +55,11 @@ IMenuManager *CoreImpl::menuManager() const
|
||||||
return m_mainWindow->menuManager();
|
return m_mainWindow->menuManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContextManager *CoreImpl::contextManager() const
|
||||||
|
{
|
||||||
|
return m_mainWindow->contextManager();
|
||||||
|
}
|
||||||
|
|
||||||
QSettings *CoreImpl::settings() const
|
QSettings *CoreImpl::settings() const
|
||||||
{
|
{
|
||||||
return m_mainWindow->settings();
|
return m_mainWindow->settings();
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
QWidget *parent = 0);
|
QWidget *parent = 0);
|
||||||
|
|
||||||
virtual IMenuManager *menuManager() const;
|
virtual IMenuManager *menuManager() const;
|
||||||
|
virtual ContextManager *contextManager() const;
|
||||||
|
|
||||||
virtual QSettings *settings() const;
|
virtual QSettings *settings() const;
|
||||||
virtual QMainWindow *mainWindow() const;
|
virtual QMainWindow *mainWindow() const;
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
<file>icons/ic_nel_down_item.png</file>
|
<file>icons/ic_nel_down_item.png</file>
|
||||||
<file>icons/ic_nel_generic_settings.png</file>
|
<file>icons/ic_nel_generic_settings.png</file>
|
||||||
<file>icons/ic_nel_open.png</file>
|
<file>icons/ic_nel_open.png</file>
|
||||||
|
<file>icons/ic_nel_new.png</file>
|
||||||
|
<file>icons/ic_nel_save.png</file>
|
||||||
|
<file>icons/ic_nel_save_as.png</file>
|
||||||
<file>icons/ic_nel_path_settings.png</file>
|
<file>icons/ic_nel_path_settings.png</file>
|
||||||
<file>icons/ic_nel_pill.png</file>
|
<file>icons/ic_nel_pill.png</file>
|
||||||
<file>icons/ic_nel_reset_all.png</file>
|
<file>icons/ic_nel_reset_all.png</file>
|
||||||
|
|
|
@ -80,11 +80,21 @@ const char * const LEVELDESIGN_PATH = "LevelDesignPath";
|
||||||
const char * const ASSETS_PATH = "AssetsPath";
|
const char * const ASSETS_PATH = "AssetsPath";
|
||||||
const char * const REMAP_EXTENSIONS = "RemapExtensions";
|
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
|
//resources
|
||||||
const char * const ICON_NEL = ":/core/images/nel.png";
|
const char * const ICON_NEL = ":/core/images/nel.png";
|
||||||
const char * const ICON_SETTINGS = ":/core/images/preferences.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_PILL = ":/core/icons/ic_nel_pill.png";
|
||||||
const char * const ICON_OPEN = ":/core/icons/ic_nel_open.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";
|
const char * const ICON_CRASH = ":/core/icons/ic_nel_crash.png";
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
|
|
|
@ -65,6 +65,11 @@ QString GeneralSettingsPage::trCategory() const
|
||||||
return tr(Constants::SETTINGS_TR_CATEGORY_GENERAL);
|
return tr(Constants::SETTINGS_TR_CATEGORY_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon GeneralSettingsPage::categoryIcon() const
|
||||||
|
{
|
||||||
|
return QIcon();
|
||||||
|
}
|
||||||
|
|
||||||
void GeneralSettingsPage::applyGeneralSettings()
|
void GeneralSettingsPage::applyGeneralSettings()
|
||||||
{
|
{
|
||||||
QSettings *settings = Core::ICore::instance()->settings();
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
QString trName() const;
|
QString trName() const;
|
||||||
QString category() const;
|
QString category() const;
|
||||||
QString trCategory() const;
|
QString trCategory() const;
|
||||||
|
QIcon categoryIcon() const;
|
||||||
QWidget *createPage(QWidget *parent);
|
QWidget *createPage(QWidget *parent);
|
||||||
|
|
||||||
void apply();
|
void apply();
|
||||||
|
|
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 52 KiB |
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
class QUndoStack;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
|
@ -56,6 +57,10 @@ public:
|
||||||
|
|
||||||
/// The widget will be destroyed by the widget hierarchy when the main window closes
|
/// The widget will be destroyed by the widget hierarchy when the main window closes
|
||||||
virtual QWidget *widget() = 0;
|
virtual QWidget *widget() = 0;
|
||||||
|
|
||||||
|
virtual QUndoStack *undoStack() = 0;
|
||||||
|
|
||||||
|
virtual void open() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
|
@ -36,6 +36,7 @@ class IPluginManager;
|
||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
class IMenuManager;
|
class IMenuManager;
|
||||||
|
class ContextManager;
|
||||||
|
|
||||||
class CORE_EXPORT ICore : public QObject
|
class CORE_EXPORT ICore : public QObject
|
||||||
{
|
{
|
||||||
|
@ -52,6 +53,7 @@ public:
|
||||||
QWidget *parent = 0) = 0;
|
QWidget *parent = 0) = 0;
|
||||||
|
|
||||||
virtual IMenuManager *menuManager() const = 0;
|
virtual IMenuManager *menuManager() const = 0;
|
||||||
|
virtual ContextManager *contextManager() const = 0;
|
||||||
|
|
||||||
virtual QSettings *settings() const = 0;
|
virtual QSettings *settings() const = 0;
|
||||||
virtual QMainWindow *mainWindow() const = 0;
|
virtual QMainWindow *mainWindow() const = 0;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
class QIcon;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
|
@ -56,6 +57,8 @@ public:
|
||||||
/// trCategory() is the translated category
|
/// trCategory() is the translated category
|
||||||
virtual QString trCategory() const = 0;
|
virtual QString trCategory() const = 0;
|
||||||
|
|
||||||
|
virtual QIcon categoryIcon() const = 0;
|
||||||
|
|
||||||
/// createPage() is called to retrieve the widget to show in the preferences dialog
|
/// createPage() is called to retrieve the widget to show in the preferences dialog
|
||||||
/// The widget will be destroyed by the widget hierarchy when the dialog closes
|
/// The widget will be destroyed by the widget hierarchy when the dialog closes
|
||||||
virtual QWidget *createPage(QWidget *parent) = 0;
|
virtual QWidget *createPage(QWidget *parent) = 0;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "icontext.h"
|
#include "icontext.h"
|
||||||
#include "icore_listener.h"
|
#include "icore_listener.h"
|
||||||
#include "menu_manager.h"
|
#include "menu_manager.h"
|
||||||
|
#include "context_manager.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "core_constants.h"
|
#include "core_constants.h"
|
||||||
#include "settings_dialog.h"
|
#include "settings_dialog.h"
|
||||||
|
@ -38,8 +39,10 @@ MainWindow::MainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *
|
||||||
: QMainWindow(parent),
|
: QMainWindow(parent),
|
||||||
m_pluginManager(0),
|
m_pluginManager(0),
|
||||||
m_menuManager(0),
|
m_menuManager(0),
|
||||||
|
m_contextManager(0),
|
||||||
m_coreImpl(0),
|
m_coreImpl(0),
|
||||||
m_lastDir("."),
|
m_lastDir("."),
|
||||||
|
m_undoGroup(0),
|
||||||
m_settings(0)
|
m_settings(0)
|
||||||
{
|
{
|
||||||
QCoreApplication::setApplicationName(QLatin1String("ObjectViewerQt"));
|
QCoreApplication::setApplicationName(QLatin1String("ObjectViewerQt"));
|
||||||
|
@ -59,12 +62,15 @@ MainWindow::MainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *
|
||||||
|
|
||||||
m_tabWidget = new QTabWidget(this);
|
m_tabWidget = new QTabWidget(this);
|
||||||
m_tabWidget->setTabPosition(QTabWidget::South);
|
m_tabWidget->setTabPosition(QTabWidget::South);
|
||||||
m_tabWidget->setMovable(true);
|
m_tabWidget->setMovable(false);
|
||||||
m_tabWidget->setDocumentMode(true);
|
m_tabWidget->setDocumentMode(true);
|
||||||
setCentralWidget(m_tabWidget);
|
setCentralWidget(m_tabWidget);
|
||||||
|
|
||||||
|
m_contextManager = new ContextManager(this, m_tabWidget);
|
||||||
|
|
||||||
setDockNestingEnabled(true);
|
setDockNestingEnabled(true);
|
||||||
m_originalPalette = QApplication::palette();
|
m_originalPalette = QApplication::palette();
|
||||||
|
m_undoGroup = new QUndoGroup(this);
|
||||||
|
|
||||||
createDialogs();
|
createDialogs();
|
||||||
createActions();
|
createActions();
|
||||||
|
@ -92,15 +98,11 @@ bool MainWindow::initialize(QString *errorString)
|
||||||
|
|
||||||
void MainWindow::extensionsInitialized()
|
void MainWindow::extensionsInitialized()
|
||||||
{
|
{
|
||||||
QList<IContext *> listContexts = m_pluginManager->getObjects<IContext>();
|
|
||||||
|
|
||||||
Q_FOREACH(IContext *context, listContexts)
|
|
||||||
{
|
|
||||||
addContextObject(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(m_pluginManager, SIGNAL(objectAdded(QObject *)), this, SLOT(checkObject(QObject *)));
|
|
||||||
readSettings();
|
readSettings();
|
||||||
|
connect(m_contextManager, SIGNAL(currentContextChanged(Core::IContext*)),
|
||||||
|
this, SLOT(updateContext(Core::IContext*)));
|
||||||
|
if (m_contextManager->currentContext() != NULL)
|
||||||
|
updateContext(m_contextManager->currentContext());
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +111,11 @@ IMenuManager *MainWindow::menuManager() const
|
||||||
return m_menuManager;
|
return m_menuManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContextManager *MainWindow::contextManager() const
|
||||||
|
{
|
||||||
|
return m_contextManager;
|
||||||
|
}
|
||||||
|
|
||||||
QSettings *MainWindow::settings() const
|
QSettings *MainWindow::settings() const
|
||||||
{
|
{
|
||||||
return m_settings;
|
return m_settings;
|
||||||
|
@ -119,15 +126,19 @@ ExtensionSystem::IPluginManager *MainWindow::pluginManager() const
|
||||||
return m_pluginManager;
|
return m_pluginManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::open()
|
void MainWindow::addContextObject(IContext *context)
|
||||||
{
|
{
|
||||||
|
m_undoGroup->addStack(context->undoStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::checkObject(QObject *obj)
|
void MainWindow::removeContextObject(IContext *context)
|
||||||
{
|
{
|
||||||
IContext *context = qobject_cast<IContext *>(obj);
|
m_undoGroup->removeStack(context->undoStack());
|
||||||
if (context)
|
}
|
||||||
addContextObject(context);
|
|
||||||
|
void MainWindow::open()
|
||||||
|
{
|
||||||
|
m_contextManager->currentContext()->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::showOptionsDialog(const QString &group,
|
bool MainWindow::showOptionsDialog(const QString &group,
|
||||||
|
@ -151,6 +162,11 @@ void MainWindow::about()
|
||||||
"<p> Ryzom Core team <p>Compiled on %1 %2").arg(__DATE__).arg(__TIME__));
|
"<p> Ryzom Core team <p>Compiled on %1 %2").arg(__DATE__).arg(__TIME__));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateContext(Core::IContext *context)
|
||||||
|
{
|
||||||
|
m_undoGroup->setActiveStack(context->undoStack());
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *event)
|
void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
QList<ICoreListener *> listeners = m_pluginManager->getObjects<ICoreListener>();
|
QList<ICoreListener *> listeners = m_pluginManager->getObjects<ICoreListener>();
|
||||||
|
@ -168,16 +184,6 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addContextObject(IContext *context)
|
|
||||||
{
|
|
||||||
QWidget *tabWidget = new QWidget(m_tabWidget);
|
|
||||||
m_tabWidget->addTab(tabWidget, context->icon(), context->trName());
|
|
||||||
QGridLayout *gridLayout = new QGridLayout(tabWidget);
|
|
||||||
gridLayout->setObjectName(QString::fromUtf8("gridLayout_") + context->id());
|
|
||||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
gridLayout->addWidget(context->widget(), 0, 0, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::createActions()
|
void MainWindow::createActions()
|
||||||
{
|
{
|
||||||
m_openAction = new QAction(tr("&Open..."), this);
|
m_openAction = new QAction(tr("&Open..."), this);
|
||||||
|
@ -228,11 +234,14 @@ void MainWindow::createMenus()
|
||||||
{
|
{
|
||||||
m_fileMenu = menuBar()->addMenu(tr("&File"));
|
m_fileMenu = menuBar()->addMenu(tr("&File"));
|
||||||
menuManager()->registerMenu(m_fileMenu, Constants::M_FILE);
|
menuManager()->registerMenu(m_fileMenu, Constants::M_FILE);
|
||||||
// m_fileMenu->addAction(m_openAction);
|
m_fileMenu->addAction(m_openAction);
|
||||||
m_fileMenu->addSeparator();
|
m_fileMenu->addSeparator();
|
||||||
m_fileMenu->addAction(m_exitAction);
|
m_fileMenu->addAction(m_exitAction);
|
||||||
|
|
||||||
m_editMenu = menuBar()->addMenu(tr("&Edit"));
|
m_editMenu = menuBar()->addMenu(tr("&Edit"));
|
||||||
|
m_editMenu->addAction(m_undoGroup->createUndoAction(this));
|
||||||
|
m_editMenu->addAction(m_undoGroup->createRedoAction(this));
|
||||||
|
m_editMenu->addSeparator();
|
||||||
menuManager()->registerMenu(m_editMenu, Constants::M_EDIT);
|
menuManager()->registerMenu(m_editMenu, Constants::M_EDIT);
|
||||||
|
|
||||||
m_viewMenu = menuBar()->addMenu(tr("&View"));
|
m_viewMenu = menuBar()->addMenu(tr("&View"));
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
|
#include <QtGui/QUndoGroup>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
|
@ -35,6 +36,7 @@ class CorePlugin;
|
||||||
class IContext;
|
class IContext;
|
||||||
class IMenuManager;
|
class IMenuManager;
|
||||||
class MenuManager;
|
class MenuManager;
|
||||||
|
class ContextManager;
|
||||||
class CoreImpl;
|
class CoreImpl;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
|
@ -49,10 +51,14 @@ public:
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
|
||||||
IMenuManager *menuManager() const;
|
IMenuManager *menuManager() const;
|
||||||
|
ContextManager *contextManager() const;
|
||||||
QSettings *settings() const;
|
QSettings *settings() const;
|
||||||
|
|
||||||
ExtensionSystem::IPluginManager *pluginManager() const;
|
ExtensionSystem::IPluginManager *pluginManager() const;
|
||||||
|
|
||||||
|
void addContextObject(IContext *context);
|
||||||
|
void removeContextObject(IContext *context);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
bool showOptionsDialog(const QString &group = QString(),
|
bool showOptionsDialog(const QString &group = QString(),
|
||||||
const QString &page = QString(),
|
const QString &page = QString(),
|
||||||
|
@ -60,15 +66,13 @@ public Q_SLOTS:
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void open();
|
void open();
|
||||||
void checkObject(QObject *obj);
|
|
||||||
void about();
|
void about();
|
||||||
|
void updateContext(Core::IContext *context);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent *event);
|
virtual void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addContextObject(IContext *appPage);
|
|
||||||
|
|
||||||
void createActions();
|
void createActions();
|
||||||
void createMenus();
|
void createMenus();
|
||||||
void createStatusBar();
|
void createStatusBar();
|
||||||
|
@ -80,11 +84,13 @@ private:
|
||||||
ExtensionSystem::IPluginManager *m_pluginManager;
|
ExtensionSystem::IPluginManager *m_pluginManager;
|
||||||
ExtensionSystem::CPluginView *m_pluginView;
|
ExtensionSystem::CPluginView *m_pluginView;
|
||||||
MenuManager *m_menuManager;
|
MenuManager *m_menuManager;
|
||||||
|
ContextManager *m_contextManager;
|
||||||
CoreImpl *m_coreImpl;
|
CoreImpl *m_coreImpl;
|
||||||
|
|
||||||
QPalette m_originalPalette;
|
QPalette m_originalPalette;
|
||||||
QString m_lastDir;
|
QString m_lastDir;
|
||||||
|
|
||||||
|
QUndoGroup *m_undoGroup;
|
||||||
QSettings *m_settings;
|
QSettings *m_settings;
|
||||||
|
|
||||||
QTimer *m_mainTimer;
|
QTimer *m_mainTimer;
|
||||||
|
|
|
@ -70,6 +70,11 @@ QString CSearchPathsSettingsPage::trCategory() const
|
||||||
return tr(Constants::SETTINGS_TR_CATEGORY_GENERAL);
|
return tr(Constants::SETTINGS_TR_CATEGORY_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon CSearchPathsSettingsPage::categoryIcon() const
|
||||||
|
{
|
||||||
|
return QIcon();
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *CSearchPathsSettingsPage::createPage(QWidget *parent)
|
QWidget *CSearchPathsSettingsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
m_page = new QWidget(parent);
|
m_page = new QWidget(parent);
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
QString trName() const;
|
QString trName() const;
|
||||||
QString category() const;
|
QString category() const;
|
||||||
QString trCategory() const;
|
QString trCategory() const;
|
||||||
|
QIcon categoryIcon() const;
|
||||||
QWidget *createPage(QWidget *parent);
|
QWidget *createPage(QWidget *parent);
|
||||||
|
|
||||||
void apply();
|
void apply();
|
||||||
|
|
|
@ -53,6 +53,11 @@ QString CExampleSettingsPage::trCategory() const
|
||||||
return tr("General");
|
return tr("General");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon CExampleSettingsPage::categoryIcon() const
|
||||||
|
{
|
||||||
|
return QIcon();
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *CExampleSettingsPage::createPage(QWidget *parent)
|
QWidget *CExampleSettingsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
_currentPage = new QWidget(parent);
|
_currentPage = new QWidget(parent);
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
virtual QString trName() const;
|
virtual QString trName() const;
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString trCategory() const;
|
||||||
|
QIcon categoryIcon() const;
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
|
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
|
|
|
@ -86,6 +86,15 @@ public:
|
||||||
return m_simpleViewer;
|
return m_simpleViewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual QUndoStack *undoStack()
|
||||||
|
{
|
||||||
|
return m_simpleViewer->m_undoStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void open()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
CSimpleViewer *m_simpleViewer;
|
CSimpleViewer *m_simpleViewer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,8 @@ CSimpleViewer::CSimpleViewer(QWidget *parent)
|
||||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
NLQT::QNLWidget *_nelWidget = new NLQT::QNLWidget(this);
|
NLQT::QNLWidget *_nelWidget = new NLQT::QNLWidget(this);
|
||||||
gridLayout->addWidget(_nelWidget, 0, 0, 1, 1);
|
gridLayout->addWidget(_nelWidget, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
m_undoStack = new QUndoStack(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCoreListener::closeMainWindow() const
|
bool CCoreListener::closeMainWindow() const
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
#include <QtGui/QUndoStack>
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
namespace Plugin
|
namespace Plugin
|
||||||
|
@ -37,6 +37,8 @@ class CSimpleViewer : public QWidget
|
||||||
public:
|
public:
|
||||||
CSimpleViewer(QWidget *parent = 0);
|
CSimpleViewer(QWidget *parent = 0);
|
||||||
virtual ~CSimpleViewer() {}
|
virtual ~CSimpleViewer() {}
|
||||||
|
|
||||||
|
QUndoStack *m_undoStack;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCoreListener : public Core::ICoreListener
|
class CCoreListener : public Core::ICoreListener
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
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)
|
||||||
|
|
||||||
|
SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_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)
|
|
@ -0,0 +1,5 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource>
|
||||||
|
<file>images/ic_nel_georges_editor.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
|
@ -0,0 +1,31 @@
|
||||||
|
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#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
|
|
@ -0,0 +1,111 @@
|
||||||
|
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "georges_editor_form.h"
|
||||||
|
#include "georges_editor_constants.h"
|
||||||
|
|
||||||
|
#include "../core/icore.h"
|
||||||
|
#include "../core/imenu_manager.h"
|
||||||
|
#include "../core/core_constants.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QToolBar>
|
||||||
|
|
||||||
|
namespace Plugin
|
||||||
|
{
|
||||||
|
|
||||||
|
GeorgesEditorForm::GeorgesEditorForm(QWidget *parent)
|
||||||
|
: QMainWindow(parent)
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GeorgesEditorForm::writeSettings()
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
|
||||||
|
settings->endGroup();
|
||||||
|
settings->sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace Plugin */
|
|
@ -0,0 +1,61 @@
|
||||||
|
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef GEORGES_EDITOR_FORM_H
|
||||||
|
#define GEORGES_EDITOR_FORM_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "ui_georges_editor_form.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QUndoStack>
|
||||||
|
|
||||||
|
namespace Plugin
|
||||||
|
{
|
||||||
|
|
||||||
|
class GeorgesEditorForm: public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GeorgesEditorForm(QWidget *parent = 0);
|
||||||
|
~GeorgesEditorForm();
|
||||||
|
|
||||||
|
QUndoStack *undoStack() const;
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
public Q_SLOTS:
|
||||||
|
void open();
|
||||||
|
void newFile();
|
||||||
|
void save();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
private:
|
||||||
|
void readSettings();
|
||||||
|
void writeSettings();
|
||||||
|
|
||||||
|
QUndoStack *m_undoStack;
|
||||||
|
Ui::GeorgesEditorForm m_ui;
|
||||||
|
|
||||||
|
QToolBar *_fileToolBar;
|
||||||
|
QAction *_openAction;
|
||||||
|
QAction *_newAction;
|
||||||
|
QAction *_saveAction;
|
||||||
|
}; /* class GeorgesEditorForm */
|
||||||
|
|
||||||
|
} /* namespace Plugin */
|
||||||
|
|
||||||
|
#endif // GEORGES_EDITOR_FORM_H
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>GeorgesEditorForm</class>
|
||||||
|
<widget class="QMainWindow" name="GeorgesEditorForm">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>600</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Georges Editor</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QWidget#centralwidget {
|
||||||
|
image: url(:/images/ic_nel_georges_editor.png);
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="georges_editor.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -0,0 +1,127 @@
|
||||||
|
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// 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 <QtCore/QObject>
|
||||||
|
|
||||||
|
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("GeorgesEditor");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeorgesEditorPlugin::version() const
|
||||||
|
{
|
||||||
|
return "0.1";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeorgesEditorPlugin::vendor() const
|
||||||
|
{
|
||||||
|
return "aquiles";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GeorgesEditorPlugin::description() const
|
||||||
|
{
|
||||||
|
return "Tool to create & edit sheets or forms.";
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList GeorgesEditorPlugin::dependencies() const
|
||||||
|
{
|
||||||
|
QStringList list;
|
||||||
|
list.append(Core::Constants::OVQT_CORE_PLUGIN);
|
||||||
|
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)
|
|
@ -0,0 +1,105 @@
|
||||||
|
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#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 <QtCore/QObject>
|
||||||
|
#include <QtGui/QIcon>
|
||||||
|
|
||||||
|
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<QObject *> 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
|
After Width: | Height: | Size: 36 KiB |
|
@ -0,0 +1,48 @@
|
||||||
|
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${LIBXML2_INCLUDE_DIR}
|
||||||
|
${QT_INCLUDES})
|
||||||
|
|
||||||
|
FILE(GLOB SRC *.cpp *.h)
|
||||||
|
|
||||||
|
SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
|
||||||
|
|
||||||
|
SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_HDR landscape_editor_plugin.h
|
||||||
|
landscape_editor_window.h
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS landscape_editor_window.ui
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_RCS landscape_editor.qrc)
|
||||||
|
|
||||||
|
SET(QT_USE_QTGUI TRUE)
|
||||||
|
SET(QT_USE_QTOPENGL TRUE)
|
||||||
|
|
||||||
|
QT4_ADD_RESOURCES(OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS ${OVQT_PLUGIN_LANDSCAPE_EDITOR_RCS})
|
||||||
|
QT4_WRAP_CPP(OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC ${OVQT_PLUGIN_LANDSCAPE_EDITOR_HDR})
|
||||||
|
QT4_WRAP_UI(OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS})
|
||||||
|
|
||||||
|
SOURCE_GROUP(QtResources FILES ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS})
|
||||||
|
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS})
|
||||||
|
SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC} OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS)
|
||||||
|
SOURCE_GROUP("Landscape Editor Plugin" FILES ${SRC})
|
||||||
|
SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
|
||||||
|
|
||||||
|
ADD_LIBRARY(ovqt_plugin_landscape_editor MODULE ${SRC}
|
||||||
|
${OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC}
|
||||||
|
${OVQT_EXT_SYS_SRC}
|
||||||
|
${OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS}
|
||||||
|
${OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS})
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(ovqt_plugin_landscape_editor ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY})
|
||||||
|
|
||||||
|
NL_DEFAULT_PROPS(ovqt_plugin_landscape_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Landscape Editor")
|
||||||
|
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_landscape_editor)
|
||||||
|
NL_ADD_LIB_SUFFIX(ovqt_plugin_landscape_editor)
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(-DLANDSCAPE_EDITOR_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
|
||||||
|
|
||||||
|
INSTALL(TARGETS ovqt_plugin_landscape_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)
|
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 56 KiB |
|
@ -0,0 +1,9 @@
|
||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>icons/ic_nel_landscape_item.png</file>
|
||||||
|
<file>icons/ic_nel_landscape_settings.png</file>
|
||||||
|
<file>icons/ic_nel_world_editor.png</file>
|
||||||
|
<file>icons/ic_nel_zone.png</file>
|
||||||
|
<file>icons/ic_nel_zonel.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
|
@ -0,0 +1,37 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef LANDSCAPE_EDITOR_CONSTANTS_H
|
||||||
|
#define LANDSCAPE_EDITOR_CONSTANTS_H
|
||||||
|
|
||||||
|
namespace LandscapeEditor
|
||||||
|
{
|
||||||
|
namespace Constants
|
||||||
|
{
|
||||||
|
const char * const LANDSCAPE_EDITOR_PLUGIN = "LandscapeEditor";
|
||||||
|
|
||||||
|
//settings
|
||||||
|
const char * const LANDSCAPE_EDITOR_SECTION = "LandscapeEditor";
|
||||||
|
|
||||||
|
//resources
|
||||||
|
const char * const ICON_LANDSCAPE_ITEM = ":/icons/ic_nel_landscape_item.png";
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Constants
|
||||||
|
} // namespace LandscapeEditor
|
||||||
|
|
||||||
|
#endif // LANDSCAPE_EDITOR_CONSTANTS_H
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
// Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef LANDSCAPE_EDITOR_GLOBAL_H
|
||||||
|
#define LANDSCAPE_EDITOR_GLOBAL_H
|
||||||
|
|
||||||
|
#include <QtCore/qglobal.h>
|
||||||
|
|
||||||
|
#if defined(LANDSCAPE_EDITOR_LIBRARY)
|
||||||
|
# define LANDSCAPE_EDITOR_EXPORT Q_DECL_EXPORT
|
||||||
|
#else
|
||||||
|
# define LANDSCAPE_EDITOR_EXPORT Q_DECL_IMPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // LANDSCAPE_EDITOR_GLOBAL_H
|
|
@ -0,0 +1,128 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "landscape_editor_plugin.h"
|
||||||
|
#include "landscape_editor_window.h"
|
||||||
|
|
||||||
|
#include "../core/icore.h"
|
||||||
|
#include "../core/core_constants.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include "nel/misc/debug.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
namespace LandscapeEditor
|
||||||
|
{
|
||||||
|
|
||||||
|
LandscapeEditorPlugin::~LandscapeEditorPlugin()
|
||||||
|
{
|
||||||
|
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
|
||||||
|
{
|
||||||
|
m_plugMan->removeObject(obj);
|
||||||
|
}
|
||||||
|
qDeleteAll(m_autoReleaseObjects);
|
||||||
|
m_autoReleaseObjects.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LandscapeEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||||
|
{
|
||||||
|
Q_UNUSED(errorString);
|
||||||
|
m_plugMan = pluginManager;
|
||||||
|
|
||||||
|
addAutoReleasedObject(new LandscapeEditorContext(this));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandscapeEditorPlugin::extensionsInitialized()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandscapeEditorPlugin::shutdown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandscapeEditorPlugin::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 LandscapeEditorPlugin::name() const
|
||||||
|
{
|
||||||
|
return tr("LandscapeEditor");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LandscapeEditorPlugin::version() const
|
||||||
|
{
|
||||||
|
return "0.0.1";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LandscapeEditorPlugin::vendor() const
|
||||||
|
{
|
||||||
|
return "GSoC2011_dnk-88";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LandscapeEditorPlugin::description() const
|
||||||
|
{
|
||||||
|
return "Landscape editor ovqt plugin.";
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList LandscapeEditorPlugin::dependencies() const
|
||||||
|
{
|
||||||
|
QStringList list;
|
||||||
|
list.append(Core::Constants::OVQT_CORE_PLUGIN);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandscapeEditorPlugin::addAutoReleasedObject(QObject *obj)
|
||||||
|
{
|
||||||
|
m_plugMan->addObject(obj);
|
||||||
|
m_autoReleaseObjects.prepend(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
LandscapeEditorContext::LandscapeEditorContext(QObject *parent)
|
||||||
|
: IContext(parent),
|
||||||
|
m_landEditorWindow(0)
|
||||||
|
{
|
||||||
|
m_landEditorWindow = new LandscapeEditorWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
QUndoStack *LandscapeEditorContext::undoStack()
|
||||||
|
{
|
||||||
|
return m_landEditorWindow->undoStack();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandscapeEditorContext::open()
|
||||||
|
{
|
||||||
|
m_landEditorWindow->open();
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *LandscapeEditorContext::widget()
|
||||||
|
{
|
||||||
|
return m_landEditorWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_EXPORT_PLUGIN(LandscapeEditor::LandscapeEditorPlugin)
|
|
@ -0,0 +1,108 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef LANDSCAPE_EDITOR_PLUGIN_H
|
||||||
|
#define LANDSCAPE_EDITOR_PLUGIN_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "landscape_editor_constants.h"
|
||||||
|
#include "../../extension_system/iplugin.h"
|
||||||
|
#include "../core/icontext.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include "nel/misc/app_context.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtGui/QIcon>
|
||||||
|
|
||||||
|
namespace NLMISC
|
||||||
|
{
|
||||||
|
class CLibraryContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace ExtensionSystem
|
||||||
|
{
|
||||||
|
class IPluginSpec;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace LandscapeEditor
|
||||||
|
{
|
||||||
|
class LandscapeEditorWindow;
|
||||||
|
|
||||||
|
class LandscapeEditorPlugin : public QObject, public ExtensionSystem::IPlugin
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(ExtensionSystem::IPlugin)
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual ~LandscapeEditorPlugin();
|
||||||
|
|
||||||
|
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<QObject *> m_autoReleaseObjects;
|
||||||
|
};
|
||||||
|
|
||||||
|
class LandscapeEditorContext: public Core::IContext
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
LandscapeEditorContext(QObject *parent = 0);
|
||||||
|
virtual ~LandscapeEditorContext() {}
|
||||||
|
|
||||||
|
virtual QString id() const
|
||||||
|
{
|
||||||
|
return QLatin1String("LandscapeEditorContext");
|
||||||
|
}
|
||||||
|
virtual QString trName() const
|
||||||
|
{
|
||||||
|
return tr("Landscape Editor");
|
||||||
|
}
|
||||||
|
virtual QIcon icon() const
|
||||||
|
{
|
||||||
|
return QIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void open();
|
||||||
|
|
||||||
|
virtual QUndoStack *undoStack();
|
||||||
|
|
||||||
|
virtual QWidget *widget();
|
||||||
|
|
||||||
|
LandscapeEditorWindow *m_landEditorWindow;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace LandscapeEditor
|
||||||
|
|
||||||
|
#endif // LANDSCAPE_EDITOR_PLUGIN_H
|
|
@ -0,0 +1,93 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "landscape_editor_window.h"
|
||||||
|
#include "landscape_editor_constants.h"
|
||||||
|
|
||||||
|
#include "../core/icore.h"
|
||||||
|
#include "../core/imenu_manager.h"
|
||||||
|
#include "../core/core_constants.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
|
#include <nel/misc/debug.h>
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
#include <QtGui/QFileDialog>
|
||||||
|
|
||||||
|
namespace LandscapeEditor
|
||||||
|
{
|
||||||
|
QString _lastDir;
|
||||||
|
|
||||||
|
LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
|
||||||
|
: QMainWindow(parent)
|
||||||
|
{
|
||||||
|
m_ui.setupUi(this);
|
||||||
|
|
||||||
|
m_undoStack = new QUndoStack(this);
|
||||||
|
|
||||||
|
createMenus();
|
||||||
|
readSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
LandscapeEditorWindow::~LandscapeEditorWindow()
|
||||||
|
{
|
||||||
|
writeSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
QUndoStack *LandscapeEditorWindow::undoStack() const
|
||||||
|
{
|
||||||
|
return m_undoStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandscapeEditorWindow::open()
|
||||||
|
{
|
||||||
|
QStringList fileNames = QFileDialog::getOpenFileNames(this,
|
||||||
|
tr("Open NeL Ligo land file"), _lastDir,
|
||||||
|
tr("All NeL Ligo land files (*.land)"));
|
||||||
|
|
||||||
|
setCursor(Qt::WaitCursor);
|
||||||
|
if (!fileNames.isEmpty())
|
||||||
|
{
|
||||||
|
QStringList list = fileNames;
|
||||||
|
_lastDir = QFileInfo(list.front()).absolutePath();
|
||||||
|
}
|
||||||
|
setCursor(Qt::ArrowCursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandscapeEditorWindow::createMenus()
|
||||||
|
{
|
||||||
|
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandscapeEditorWindow::readSettings()
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
settings->beginGroup(Constants::LANDSCAPE_EDITOR_SECTION);
|
||||||
|
settings->endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LandscapeEditorWindow::writeSettings()
|
||||||
|
{
|
||||||
|
QSettings *settings = Core::ICore::instance()->settings();
|
||||||
|
settings->beginGroup(Constants::LANDSCAPE_EDITOR_SECTION);
|
||||||
|
settings->endGroup();
|
||||||
|
settings->sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* namespace LandscapeEditor */
|
|
@ -0,0 +1,56 @@
|
||||||
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||||
|
//
|
||||||
|
// 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#ifndef LANDSCAPE_EDITOR_WINDOW_H
|
||||||
|
#define LANDSCAPE_EDITOR_WINDOW_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "ui_landscape_editor_window.h"
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QtGui/QUndoStack>
|
||||||
|
|
||||||
|
namespace LandscapeEditor
|
||||||
|
{
|
||||||
|
|
||||||
|
class LandscapeEditorWindow: public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
LandscapeEditorWindow(QWidget *parent = 0);
|
||||||
|
~LandscapeEditorWindow();
|
||||||
|
|
||||||
|
QUndoStack *undoStack() const;
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
public Q_SLOTS:
|
||||||
|
void open();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
private:
|
||||||
|
void createMenus();
|
||||||
|
void readSettings();
|
||||||
|
void writeSettings();
|
||||||
|
|
||||||
|
QUndoStack *m_undoStack;
|
||||||
|
Ui::LandscapeEditorWindow m_ui;
|
||||||
|
}; /* class LandscapeEditorWindow */
|
||||||
|
|
||||||
|
} /* namespace LandscapeEditor */
|
||||||
|
|
||||||
|
#endif // LANDSCAPE_EDITOR_WINDOW_H
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>LandscapeEditorWindow</class>
|
||||||
|
<widget class="QMainWindow" name="LandscapeEditorWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>800</width>
|
||||||
|
<height>600</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="landscape_editor.qrc">
|
||||||
|
<normaloff>:/icons/ic_nel_landscape_item.png</normaloff>:/icons/ic_nel_landscape_item.png</iconset>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QGraphicsView" name="graphicsView"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QToolBar" name="toolBar">
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>toolBar</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="toolBarArea">
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="landscape_editor.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -1,24 +1,28 @@
|
||||||
/*
|
// Object Viewer Qt - Log Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||||
Log Plugin Qt
|
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
|
||||||
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
This program is free software: you can redistribute it and/or modify
|
// it under the terms of the GNU Affero General Public License as
|
||||||
it under the terms of the GNU General Public License as published by
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
// License, or (at your option) any later version.
|
||||||
(at your option) any later version.
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
This program is distributed in the hope that it will be useful,
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// GNU Affero General Public License for more details.
|
||||||
GNU General Public License for more details.
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
You should have received a copy of the GNU General Public License
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
// Project includes
|
||||||
#include "log_plugin.h"
|
#include "log_plugin.h"
|
||||||
#include "log_settings_page.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
|
// Qt includes
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
@ -35,53 +39,43 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
|
|
||||||
// Project includes
|
namespace Plugin
|
||||||
#include "../core/icore.h"
|
|
||||||
#include "../core/core_constants.h"
|
|
||||||
#include "../core/imenu_manager.h"
|
|
||||||
#include "qt_displayer.h"
|
|
||||||
|
|
||||||
using namespace Plugin;
|
|
||||||
|
|
||||||
namespace ExtensionSystem
|
|
||||||
{
|
{
|
||||||
class IPluginSpec;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent)
|
CLogPlugin::CLogPlugin(QWidget *parent): QDockWidget(parent)
|
||||||
{
|
{
|
||||||
_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLogPlugin::~CLogPlugin()
|
CLogPlugin::~CLogPlugin()
|
||||||
{
|
{
|
||||||
//_plugMan->removeObject(_logSettingsPage);
|
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
|
||||||
delete _logSettingsPage;
|
{
|
||||||
|
m_plugMan->removeObject(obj);
|
||||||
|
}
|
||||||
|
qDeleteAll(m_autoReleaseObjects);
|
||||||
|
m_autoReleaseObjects.clear();
|
||||||
|
|
||||||
NLMISC::ErrorLog->removeDisplayer(_displayer);
|
NLMISC::ErrorLog->removeDisplayer(m_displayer);
|
||||||
NLMISC::WarningLog->removeDisplayer(_displayer);
|
NLMISC::WarningLog->removeDisplayer(m_displayer);
|
||||||
NLMISC::DebugLog->removeDisplayer(_displayer);
|
NLMISC::DebugLog->removeDisplayer(m_displayer);
|
||||||
NLMISC::AssertLog->removeDisplayer(_displayer);
|
NLMISC::AssertLog->removeDisplayer(m_displayer);
|
||||||
NLMISC::InfoLog->removeDisplayer(_displayer);
|
NLMISC::InfoLog->removeDisplayer(m_displayer);
|
||||||
delete _displayer;
|
delete m_displayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
bool CLogPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||||
{
|
{
|
||||||
Q_UNUSED(errorString);
|
Q_UNUSED(errorString);
|
||||||
_plugMan = pluginManager;
|
m_plugMan = pluginManager;
|
||||||
_logSettingsPage = new CLogSettingsPage(this);
|
m_logSettingsPage = new CLogSettingsPage(this);
|
||||||
//_plugMan->addObject(_logSettingsPage);
|
addAutoReleasedObject(m_logSettingsPage);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLogPlugin::extensionsInitialized()
|
void CLogPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
NLMISC::ErrorLog->addDisplayer(_displayer);
|
setDisplayers();
|
||||||
NLMISC::WarningLog->addDisplayer(_displayer);
|
|
||||||
NLMISC::DebugLog->addDisplayer(_displayer);
|
|
||||||
NLMISC::AssertLog->addDisplayer(_displayer);
|
|
||||||
NLMISC::InfoLog->addDisplayer(_displayer);
|
|
||||||
|
|
||||||
Core::ICore *core = Core::ICore::instance();
|
Core::ICore *core = Core::ICore::instance();
|
||||||
Core::IMenuManager *menuManager = core->menuManager();
|
Core::IMenuManager *menuManager = core->menuManager();
|
||||||
|
@ -92,46 +86,106 @@ void CLogPlugin::extensionsInitialized()
|
||||||
hide();
|
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
|
#ifdef NL_OS_WINDOWS
|
||||||
// Ensure that a context doesn't exist yet.
|
// Ensure that a context doesn't exist yet.
|
||||||
// This only applies to platforms without PIC, e.g. Windows.
|
// This only applies to platforms without PIC, e.g. Windows.
|
||||||
nlassert(!NLMISC::INelContext::isContextInitialised());
|
nlassert(!NLMISC::INelContext::isContextInitialised());
|
||||||
#endif // fdef NL_OS_WINDOWS^M
|
#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
|
QString CLogPlugin::name() const
|
||||||
{
|
{
|
||||||
return "LogPlugin";
|
return "LogPlugin";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CLogPlugin::version() const
|
QString CLogPlugin::version() const
|
||||||
{
|
{
|
||||||
return "1.0";
|
return "1.1";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CLogPlugin::vendor() const
|
QString CLogPlugin::vendor() const
|
||||||
{
|
{
|
||||||
return "aquiles";
|
return "aquiles";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CLogPlugin::description() const
|
QString CLogPlugin::description() const
|
||||||
{
|
{
|
||||||
return "DockWidget to display all log messages from NeL.";
|
return "DockWidget to display all log messages from NeL.";
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CLogPlugin::dependencies() const
|
QStringList CLogPlugin::dependencies() const
|
||||||
{
|
{
|
||||||
QStringList list;
|
QStringList list;
|
||||||
list.append(Core::Constants::OVQT_CORE_PLUGIN);
|
list.append(Core::Constants::OVQT_CORE_PLUGIN);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN(CLogPlugin)
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Q_EXPORT_PLUGIN(Plugin::CLogPlugin)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Log Plugin Qt
|
Log Plugin Qt
|
||||||
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
|
Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -20,16 +20,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef LOG_PLUGIN_H
|
#ifndef LOG_PLUGIN_H
|
||||||
#define LOG_PLUGIN_H
|
#define LOG_PLUGIN_H
|
||||||
|
|
||||||
|
// Project includes
|
||||||
|
#include "ui_log_form.h"
|
||||||
#include "../../extension_system/iplugin.h"
|
#include "../../extension_system/iplugin.h"
|
||||||
|
|
||||||
|
// NeL includes
|
||||||
#include "nel/misc/app_context.h"
|
#include "nel/misc/app_context.h"
|
||||||
|
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
|
|
||||||
// Project includes
|
|
||||||
#include "ui_log_form.h"
|
|
||||||
|
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
{
|
{
|
||||||
class CLibraryContext;
|
class CLibraryContext;
|
||||||
|
@ -61,7 +61,7 @@ namespace Plugin
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
|
||||||
void setNelContext(NLMISC::INelContext *nelContext);
|
void setNelContext(NLMISC::INelContext *nelContext);
|
||||||
NLQT::CQtDisplayer* displayer() { return _displayer; }
|
NLQT::CQtDisplayer* displayer() { return m_displayer; }
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
QString version() const;
|
QString version() const;
|
||||||
|
@ -69,16 +69,21 @@ namespace Plugin
|
||||||
QString description() const;
|
QString description() const;
|
||||||
QStringList dependencies() const;
|
QStringList dependencies() const;
|
||||||
|
|
||||||
|
void addAutoReleasedObject(QObject *obj);
|
||||||
|
|
||||||
|
void setDisplayers();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
NLMISC::CLibraryContext *_LibContext;
|
NLMISC::CLibraryContext *m_libContext;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ExtensionSystem::IPluginManager *_plugMan;
|
ExtensionSystem::IPluginManager *m_plugMan;
|
||||||
CLogSettingsPage *_logSettingsPage;
|
QList<QObject *> m_autoReleaseObjects;
|
||||||
|
CLogSettingsPage *m_logSettingsPage;
|
||||||
|
|
||||||
Ui::CLogPlugin _ui;
|
Ui::CLogPlugin m_ui;
|
||||||
|
|
||||||
NLQT::CQtDisplayer *_displayer;
|
NLQT::CQtDisplayer *m_displayer;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
// Copyright (C) 2010 Winch Gate Property Limited
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU Affero General Public License as
|
// it under the terms of the GNU Affero General Public License as
|
||||||
|
@ -15,14 +15,19 @@
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// Project includes
|
||||||
#include "log_settings_page.h"
|
#include "log_settings_page.h"
|
||||||
|
#include "log_plugin.h"
|
||||||
// Qt includes
|
#include "../core/core_constants.h"
|
||||||
#include <QtGui/QWidget>
|
#include "../core/icore.h"
|
||||||
|
#include "../../extension_system/plugin_manager.h"
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
|
|
||||||
// Project includes
|
// Qt includes
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
namespace ExtensionSystem
|
namespace ExtensionSystem
|
||||||
{
|
{
|
||||||
class IPluginManager;
|
class IPluginManager;
|
||||||
|
@ -31,15 +36,22 @@ namespace ExtensionSystem
|
||||||
namespace Plugin
|
namespace Plugin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class CLogPlugin;
|
||||||
|
|
||||||
CLogSettingsPage::CLogSettingsPage(QObject *parent)
|
CLogSettingsPage::CLogSettingsPage(QObject *parent)
|
||||||
: IOptionsPage(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
|
QString CLogSettingsPage::id() const
|
||||||
{
|
{
|
||||||
return QLatin1String("Log");
|
return QLatin1String("log");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CLogSettingsPage::trName() const
|
QString CLogSettingsPage::trName() const
|
||||||
|
@ -49,32 +61,78 @@ namespace Plugin
|
||||||
|
|
||||||
QString CLogSettingsPage::category() const
|
QString CLogSettingsPage::category() const
|
||||||
{
|
{
|
||||||
return QLatin1String("General");
|
return QLatin1String(Core::Constants::SETTINGS_CATEGORY_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CLogSettingsPage::trCategory() const
|
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)
|
QWidget *CLogSettingsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
_currentPage = new QWidget(parent);
|
m_currentPage = new QWidget(parent);
|
||||||
_ui.setupUi(_currentPage);
|
m_ui.setupUi(m_currentPage);
|
||||||
return _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()
|
void CLogSettingsPage::apply()
|
||||||
{
|
{
|
||||||
//ExtensionSystem::IPluginSpec *spec, _plugMan->plugins()
|
m_error = m_ui.errorCheck->isChecked();
|
||||||
//ExtensionSystem::IPluginManager;
|
m_warning = m_ui.warningCheck->isChecked();
|
||||||
//if (_ui.errorCheck->isChecked()) {
|
m_debug = m_ui.debugCheck->isChecked();
|
||||||
//displayer();
|
m_assert = m_ui.assertCheck->isChecked();
|
||||||
//}
|
m_info = m_ui.infoCheck->isChecked();
|
||||||
//if (_ui.warningCheck->isChecked());
|
|
||||||
//if (_ui.debugCheck->isChecked());
|
writeSettings();
|
||||||
//if (_ui.assertCheck->isChecked());
|
ExtensionSystem::IPluginManager *p = Core::ICore::instance()->pluginManager();
|
||||||
//if (_ui.infoCheck->isChecked());
|
ExtensionSystem::IPlugin *plugin = p->pluginByName("LogPlugin")->plugin();
|
||||||
|
CLogPlugin* lp = dynamic_cast<CLogPlugin*>(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 */
|
} /* namespace Plugin */
|
|
@ -29,13 +29,13 @@ class QWidget;
|
||||||
|
|
||||||
namespace Plugin
|
namespace Plugin
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@class CLogSettingsPage
|
@class CLogSettingsPage
|
||||||
*/
|
*/
|
||||||
class CLogSettingsPage : public Core::IOptionsPage
|
class CLogSettingsPage : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CLogSettingsPage(QObject *parent = 0);
|
CLogSettingsPage(QObject *parent = 0);
|
||||||
virtual ~CLogSettingsPage() {}
|
virtual ~CLogSettingsPage() {}
|
||||||
|
|
||||||
|
@ -43,15 +43,25 @@ public:
|
||||||
virtual QString trName() const;
|
virtual QString trName() const;
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString trCategory() const;
|
||||||
|
QIcon categoryIcon() const;
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
|
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
virtual void finish() {}
|
virtual void finish() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *_currentPage;
|
void readSettings();
|
||||||
Ui::CLogSettingsPage _ui;
|
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
|
} // namespace Core
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,21 @@
|
||||||
/*
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||||
Georges Editor Qt
|
// Copyright (C) 2010 Winch Gate Property Limited
|
||||||
Copyright (C) 2010 Adrian Jaekel <aj at elane2k dot com>
|
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
|
||||||
|
//
|
||||||
This program is free software: you can redistribute it and/or modify
|
// 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
|
// it under the terms of the GNU Affero General Public License as
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
(at your option) any later version.
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Nel includes
|
// Nel includes
|
||||||
|
|
||||||
#include "qt_displayer.h"
|
#include "qt_displayer.h"
|
||||||
#include <nel/misc/common.h>
|
#include <nel/misc/common.h>
|
||||||
#include <nel/misc/file.h>
|
#include <nel/misc/file.h>
|
||||||
|
|
|
@ -58,6 +58,11 @@ QString GraphicsSettingsPage::trCategory() const
|
||||||
return tr("Object Viewer");
|
return tr("Object Viewer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon GraphicsSettingsPage::categoryIcon() const
|
||||||
|
{
|
||||||
|
return QIcon();
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *GraphicsSettingsPage::createPage(QWidget *parent)
|
QWidget *GraphicsSettingsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
m_page = new QWidget(parent);
|
m_page = new QWidget(parent);
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
virtual QString trName() const;
|
virtual QString trName() const;
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString trCategory() const;
|
||||||
|
QIcon categoryIcon() const;
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
|
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
|
|
|
@ -89,6 +89,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
||||||
_isSoundInitialized = true;
|
_isSoundInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_undoStack = new QUndoStack(this);
|
||||||
_SkeletonTreeModel = new CSkeletonTreeModel(this);
|
_SkeletonTreeModel = new CSkeletonTreeModel(this);
|
||||||
|
|
||||||
createDialogs();
|
createDialogs();
|
||||||
|
@ -272,8 +273,8 @@ void CMainWindow::createMenus()
|
||||||
// add actions in file menu
|
// add actions in file menu
|
||||||
QMenu *fileMenu = menuManager->menu(Core::Constants::M_FILE);
|
QMenu *fileMenu = menuManager->menu(Core::Constants::M_FILE);
|
||||||
QAction *exitAction = menuManager->action(Core::Constants::EXIT);
|
QAction *exitAction = menuManager->action(Core::Constants::EXIT);
|
||||||
fileMenu->insertAction(exitAction, _openAction);
|
//fileMenu->insertAction(exitAction, _openAction);
|
||||||
fileMenu->insertSeparator(exitAction);
|
//fileMenu->insertSeparator(exitAction);
|
||||||
|
|
||||||
// register actions for view menu
|
// register actions for view menu
|
||||||
menuManager->registerAction(_setBackColorAction, "ObjectViewer.View.SetBackgroundColor");
|
menuManager->registerAction(_setBackColorAction, "ObjectViewer.View.SetBackgroundColor");
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
|
#include <QtGui/QUndoStack>
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/misc/config_file.h>
|
#include <nel/misc/config_file.h>
|
||||||
|
@ -72,10 +73,17 @@ public:
|
||||||
return _SkeletonTreeModel;
|
return _SkeletonTreeModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Q_SLOTS:
|
QUndoStack *getUndoStack() const
|
||||||
|
{
|
||||||
|
return _undoStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
void open();
|
void open();
|
||||||
void resetScene();
|
void resetScene();
|
||||||
void reloadTextures();
|
void reloadTextures();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
void updateStatusBar();
|
void updateStatusBar();
|
||||||
void updateRender();
|
void updateRender();
|
||||||
void setInterval(int value);
|
void setInterval(int value);
|
||||||
|
@ -130,6 +138,7 @@ private:
|
||||||
QAction *_resetSceneAction;
|
QAction *_resetSceneAction;
|
||||||
QAction *_saveScreenshotAction;
|
QAction *_saveScreenshotAction;
|
||||||
QLabel *_statusInfo;
|
QLabel *_statusInfo;
|
||||||
|
QUndoStack *_undoStack;
|
||||||
|
|
||||||
float _fps;
|
float _fps;
|
||||||
uint _numTri;
|
uint _numTri;
|
||||||
|
|
|
@ -37,7 +37,7 @@ void Modules::init()
|
||||||
|
|
||||||
void Modules::release()
|
void Modules::release()
|
||||||
{
|
{
|
||||||
delete _mainWindow;
|
// delete _mainWindow;
|
||||||
_mainWindow = NULL;
|
_mainWindow = NULL;
|
||||||
delete _particleEditor;
|
delete _particleEditor;
|
||||||
_particleEditor = NULL;
|
_particleEditor = NULL;
|
||||||
|
|
|
@ -22,7 +22,7 @@ ObjectViewerPlugin::~ObjectViewerPlugin()
|
||||||
}
|
}
|
||||||
qDeleteAll(_autoReleaseObjects);
|
qDeleteAll(_autoReleaseObjects);
|
||||||
_autoReleaseObjects.clear();
|
_autoReleaseObjects.clear();
|
||||||
//Modules::release();
|
Modules::release();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectViewerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
bool ObjectViewerPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
|
||||||
|
@ -43,7 +43,7 @@ void ObjectViewerPlugin::extensionsInitialized()
|
||||||
|
|
||||||
void ObjectViewerPlugin::shutdown()
|
void ObjectViewerPlugin::shutdown()
|
||||||
{
|
{
|
||||||
Modules::release();
|
// Modules::release();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectViewerPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
void ObjectViewerPlugin::setNelContext(NLMISC::INelContext *nelContext)
|
||||||
|
@ -89,6 +89,16 @@ void ObjectViewerPlugin::addAutoReleasedObject(QObject *obj)
|
||||||
_autoReleaseObjects.prepend(obj);
|
_autoReleaseObjects.prepend(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CObjectViewerContext::open()
|
||||||
|
{
|
||||||
|
Modules::mainWin().open();
|
||||||
|
}
|
||||||
|
|
||||||
|
QUndoStack *CObjectViewerContext::undoStack()
|
||||||
|
{
|
||||||
|
return Modules::mainWin().getUndoStack();
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *CObjectViewerContext::widget()
|
QWidget *CObjectViewerContext::widget()
|
||||||
{
|
{
|
||||||
return &Modules::mainWin();
|
return &Modules::mainWin();
|
||||||
|
|
|
@ -66,14 +66,21 @@ public:
|
||||||
{
|
{
|
||||||
return QLatin1String("ObjectViewer");
|
return QLatin1String("ObjectViewer");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual QString trName() const
|
virtual QString trName() const
|
||||||
{
|
{
|
||||||
return tr("Object Viewer");
|
return tr("Object Viewer");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual QIcon icon() const
|
virtual QIcon icon() const
|
||||||
{
|
{
|
||||||
return QIcon();
|
return QIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual QUndoStack *undoStack();
|
||||||
|
|
||||||
|
virtual void open();
|
||||||
|
|
||||||
virtual QWidget *widget();
|
virtual QWidget *widget();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,11 @@ QString SoundSettingsPage::trCategory() const
|
||||||
return tr("Object Viewer");
|
return tr("Object Viewer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon SoundSettingsPage::categoryIcon() const
|
||||||
|
{
|
||||||
|
return QIcon();
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *SoundSettingsPage::createPage(QWidget *parent)
|
QWidget *SoundSettingsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
m_page = new QWidget(parent);
|
m_page = new QWidget(parent);
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
virtual QString trName() const;
|
virtual QString trName() const;
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString trCategory() const;
|
||||||
|
QIcon categoryIcon() const;
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
|
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
|
|
|
@ -59,6 +59,11 @@ QString VegetableSettingsPage::trCategory() const
|
||||||
return tr("Object Viewer");
|
return tr("Object Viewer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon VegetableSettingsPage::categoryIcon() const
|
||||||
|
{
|
||||||
|
return QIcon();
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *VegetableSettingsPage::createPage(QWidget *parent)
|
QWidget *VegetableSettingsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
m_page = new QWidget(parent);
|
m_page = new QWidget(parent);
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
virtual QString trName() const;
|
virtual QString trName() const;
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString trCategory() const;
|
||||||
|
QIcon categoryIcon() const;
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
|
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
|
|
|
@ -1156,7 +1156,7 @@ void CGroupSubMenu::addSeparatorAtIndex(uint index, const std::string &id)
|
||||||
tmp.CheckBox = NULL;
|
tmp.CheckBox = NULL;
|
||||||
tmp.RightArrow = NULL;
|
tmp.RightArrow = NULL;
|
||||||
_Lines.insert(_Lines.begin() + index, tmp);
|
_Lines.insert(_Lines.begin() + index, tmp);
|
||||||
_SubMenus.insert(_SubMenus.begin() + index, NULL);
|
_SubMenus.insert(_SubMenus.begin() + index, (CGroupSubMenu*)NULL);
|
||||||
_GroupMenu->invalidateCoords();
|
_GroupMenu->invalidateCoords();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1304,7 +1304,7 @@ CViewTextMenu* CGroupSubMenu::addLineAtIndex(uint index, const ucstring &name,
|
||||||
_Lines.insert(_Lines.begin() + index, tmp);
|
_Lines.insert(_Lines.begin() + index, tmp);
|
||||||
|
|
||||||
// Add an empty sub menu by default
|
// Add an empty sub menu by default
|
||||||
_SubMenus.insert(_SubMenus.begin() + index, NULL);
|
_SubMenus.insert(_SubMenus.begin() + index, (CGroupSubMenu*)NULL);
|
||||||
|
|
||||||
_GroupMenu->invalidateCoords();
|
_GroupMenu->invalidateCoords();
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ void CGroupTab::addTab(CCtrlTabButton * tabB, sint index)
|
||||||
{
|
{
|
||||||
if(i==index)
|
if(i==index)
|
||||||
{
|
{
|
||||||
tabB->setId(string("tab") + count);
|
tabB->setId("tab" + NLMISC::toString(count));
|
||||||
tabB->setParentPos(lastTab);
|
tabB->setParentPos(lastTab);
|
||||||
if(i==0)
|
if(i==0)
|
||||||
tabB->setParentPosRef(Hotspot_TL);
|
tabB->setParentPosRef(Hotspot_TL);
|
||||||
|
@ -168,7 +168,7 @@ void CGroupTab::addTab(CCtrlTabButton * tabB, sint index)
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons[i]->setId(string("tab") + count);
|
buttons[i]->setId("tab" + NLMISC::toString(count));
|
||||||
buttons[i]->setParentPos(lastTab);
|
buttons[i]->setParentPos(lastTab);
|
||||||
if(i==0 && index!=0)
|
if(i==0 && index!=0)
|
||||||
buttons[i]->setParentPosRef(Hotspot_TL);
|
buttons[i]->setParentPosRef(Hotspot_TL);
|
||||||
|
@ -297,7 +297,7 @@ void CGroupTab::removeTab(sint index)
|
||||||
{
|
{
|
||||||
if(i!=index)
|
if(i!=index)
|
||||||
{
|
{
|
||||||
buttons[i]->setId(string("tab")+count);
|
buttons[i]->setId("tab"+NLMISC::toString(count));
|
||||||
buttons[i]->setParentPos(lastTab);
|
buttons[i]->setParentPos(lastTab);
|
||||||
if((i==0) || (index==0 && i==1))
|
if((i==0) || (index==0 && i==1))
|
||||||
buttons[i]->setParentPosRef(Hotspot_TL);
|
buttons[i]->setParentPosRef(Hotspot_TL);
|
||||||
|
|
|
@ -986,7 +986,7 @@ void CDisplayerVisualEntity::updateName()
|
||||||
}
|
}
|
||||||
std::string firstPart = "";
|
std::string firstPart = "";
|
||||||
if(actNb>0)
|
if(actNb>0)
|
||||||
firstPart = CI18N::get("uiR2EDDefaultActTitle").toString() + " " + actNb;
|
firstPart = CI18N::get("uiR2EDDefaultActTitle").toString() + " " + NLMISC::toString(actNb);
|
||||||
|
|
||||||
if (act->isString("Name"))
|
if (act->isString("Name"))
|
||||||
actName = act->toString("Name");
|
actName = act->toString("Name");
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
#include <nel/misc/common.h>
|
#include <nel/misc/common.h>
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
|
|
|
@ -674,7 +674,7 @@ void md5sum_s_s(CStateInstance* entity, CScriptStack& stack)
|
||||||
{
|
{
|
||||||
std::string str = (std::string)stack.top();
|
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());
|
nlinfo(value.c_str());
|
||||||
stack.top() = value;
|
stack.top() = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "nel/misc/types_nl.h"
|
#include "nel/misc/types_nl.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
#include "nel/misc/common.h"
|
#include "nel/misc/common.h"
|
||||||
|
|
||||||
|
|
|
@ -1305,7 +1305,7 @@ void ItemNamesSave()
|
||||||
output = "i";
|
output = "i";
|
||||||
output += data.splitTo( "prospector", true );
|
output += data.splitTo( "prospector", true );
|
||||||
|
|
||||||
set<CSString, CUnsensitiveSStringLessPred>::iterator it = itemNames.begin();
|
CSortedStringSet::const_iterator it = itemNames.begin();
|
||||||
|
|
||||||
while ( it != itemNames.end() )
|
while ( it != itemNames.end() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,6 +78,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|