This commit is contained in:
Fabien_HENON 2011-05-30 12:01:24 +02:00
commit a059141e57
238 changed files with 10819 additions and 1103 deletions

View file

@ -41,10 +41,6 @@ INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
# Force out of source builds.
CHECK_OUT_OF_SOURCE()
# Variables which must be set before PROJECT
NL_SETUP_BUILD()
NL_SETUP_BUILD_FLAGS()
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(RyzomCore CXX C)
SET(NL_VERSION_MAJOR 0)
@ -52,6 +48,9 @@ SET(NL_VERSION_MINOR 8)
SET(NL_VERSION_PATCH 0)
SET(NL_VERSION "${NL_VERSION_MAJOR}.${NL_VERSION_MINOR}.${NL_VERSION_PATCH}")
NL_SETUP_BUILD()
NL_SETUP_BUILD_FLAGS()
#-----------------------------------------------------------------------------
# Redirect output files
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
@ -101,8 +100,15 @@ IF(WIN32)
# convert IDE fullpath to VC++ path
STRING(REGEX REPLACE "Common7/IDE/.+" "VC" VC_DIR ${CMAKE_MAKE_PROGRAM})
ELSE(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
# convert compiler fullpath to VC++ path
STRING(REGEX REPLACE "VC/bin/.+" "VC" VC_DIR ${CMAKE_CXX_COMPILER})
IF(${CMAKE_CXX_COMPILER} MATCHES "VC")
# convert compiler fullpath to VC++ path
STRING(REGEX REPLACE "VC/bin/.+" "VC" VC_DIR ${CMAKE_CXX_COMPILER})
ELSE(${CMAKE_CXX_COMPILER} MATCHES "VC")
# Hack for Visual C++ 2010
GET_FILENAME_COMPONENT(VC_ROOT_PATH "[HKEY_CURRENT_USER\\Software\\Microsoft\\VCExpress\\10.0_Config;InstallDir]" ABSOLUTE)
# convert IDE fullpath to VC++ path
STRING(REGEX REPLACE "Common7/.*" "VC" VC_DIR ${VC_ROOT_PATH})
ENDIF(${CMAKE_CXX_COMPILER} MATCHES "VC")
ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
IF(WITH_MFC)
@ -119,6 +125,12 @@ IF(WITH_STATIC)
# libxml2 could need winsock2 library
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
# on Mac OS X libxml2 requieres iconv
IF(APPLE)
FIND_PACKAGE(Iconv REQUIRED)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICONV_LIBRARIES})
ENDIF(APPLE)
ENDIF(WITH_STATIC)
IF(WITH_STLPORT)

View file

@ -40,17 +40,12 @@ ENDIF(WITH_STLPORT OR NOT MFC_FOUND)
# Only if using a custom path
IF(CUSTOM_MFC_DIR)
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
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
IF(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
ELSE(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ENDIF(TARGET_X64)
# Add MFC libraries directory to default library path
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})

View file

@ -30,16 +30,11 @@ ENDMACRO(FIND_DXSDK_LIBRARY MYLIBRARY MYLIBRARYNAME)
IF(DXSDK_DIR)
SET(DXSDK_INCLUDE_DIR "${DXSDK_DIR}/Include")
IF(NOT CMAKE_SIZEOF_VOID_P)
INCLUDE (CheckTypeSize)
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
ENDIF(NOT CMAKE_SIZEOF_VOID_P)
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
IF(TARGET_X64)
SET(DXSDK_LIBRARY_DIR "${DXSDK_DIR}/Lib/x64")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
ELSE(TARGET_X64)
SET(DXSDK_LIBRARY_DIR "${DXSDK_DIR}/Lib/x86")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ENDIF(TARGET_X64)
FIND_DXSDK_LIBRARY(DXSDK_GUID_LIBRARY dxguid)
FIND_DXSDK_LIBRARY(DXSDK_DINPUT_LIBRARY dinput8)
@ -59,7 +54,7 @@ ENDIF(DXSDK_DIR)
# all listed variables are TRUE.
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DIRECTXSDK DEFAULT_MSG DXSDK_DIR DXSDK_GUID_LIBRARY DXSDK_DINPUT_LIBRARY)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectXSDK DEFAULT_MSG DXSDK_DIR DXSDK_GUID_LIBRARY DXSDK_DINPUT_LIBRARY)
MARK_AS_ADVANCED(DXSDK_INCLUDE_DIR
DXSDK_GUID_LIBRARY

View file

@ -7,7 +7,7 @@
# EXTERNAL_FOUND - True if the external libraries are available
SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH})
SET(EXTERNAL_TEMP_FILE "include/png.h")
SET(EXTERNAL_TEMP_FILE "include/zlib.h")
SET(EXTERNAL_NAME "external")
# If using STLport preprend external_stlport
@ -17,36 +17,35 @@ IF(WITH_STLPORT)
SET(EXTERNAL_NAME "external with STLport")
ENDIF(WITH_STLPORT)
SET(EXTERNAL_FOUND FALSE)
FOREACH(ITEM ${EXTERNAL_TEMP_PATH})
IF(EXISTS "${ITEM}/${EXTERNAL_TEMP_FILE}" AND NOT EXTERNAL_FOUND)
SET(EXTERNAL_FOUND TRUE)
# Get absolute path to avoid ..
GET_FILENAME_COMPONENT(ITEM ${ITEM} ABSOLUTE)
SET(EXTERNAL_PATH ${ITEM} CACHE PATH "" FORCE)
ENDIF(EXISTS "${ITEM}/${EXTERNAL_TEMP_FILE}" AND NOT EXTERNAL_FOUND)
ENDFOREACH(ITEM ${EXTERNAL_TEMP_PATH})
FIND_PATH(EXTERNAL_PATH
${EXTERNAL_TEMP_FILE}
PATHS
$ENV{EXTERNAL_PATH}
${EXTERNAL_TEMP_PATH}
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
)
IF(EXTERNAL_FOUND)
IF(EXTERNAL_PATH)
SET(EXTERNAL_FOUND TRUE)
SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include")
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
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
IF(TARGET_X64)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
ELSE(TARGET_X64)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ENDIF(TARGET_X64)
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}")
# Stupid hack for FindOpenAL.cmake
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}")
SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}")
ENDIF(EXTERNAL_FOUND)
ENDIF(EXTERNAL_PATH)
IF(EXTERNAL_FOUND)
IF(NOT External_FIND_QUIETLY)

View file

@ -0,0 +1,83 @@
# - Try to find Iconv on Mac OS X
# Once done this will define
#
# ICONV_FOUND - system has Iconv
# ICONV_INCLUDE_DIR - the Iconv include directory
# ICONV_LIBRARIES - Link these to use Iconv
# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
#
IF(APPLE)
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
# Already in cache, be silent
SET(ICONV_FIND_QUIETLY TRUE)
ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
IF(APPLE)
FIND_PATH(ICONV_INCLUDE_DIR iconv.h
PATHS
/opt/local/include/
NO_CMAKE_SYSTEM_PATH
)
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c
PATHS
/opt/local/lib/
NO_CMAKE_SYSTEM_PATH
)
ENDIF(APPLE)
FIND_PATH(ICONV_INCLUDE_DIR iconv.h PATHS /opt/local/include /sw/include)
string(REGEX REPLACE "(.*)/include/?" "\\1" ICONV_INCLUDE_BASE_DIR "${ICONV_INCLUDE_DIR}")
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c HINTS "${ICONV_INCLUDE_BASE_DIR}/lib" PATHS /opt/local/lib)
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
SET(ICONV_FOUND TRUE)
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
IF(ICONV_FOUND)
check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
if(ICONV_HAVE_WERROR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
endif(ICONV_HAVE_WERROR)
check_c_source_compiles("
#include <iconv.h>
int main(){
iconv_t conv = 0;
const char* in = 0;
size_t ilen = 0;
char* out = 0;
size_t olen = 0;
iconv(conv, &in, &ilen, &out, &olen);
return 0;
}
" ICONV_SECOND_ARGUMENT_IS_CONST )
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
ENDIF(ICONV_FOUND)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
IF(ICONV_FOUND)
IF(NOT ICONV_FIND_QUIETLY)
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
ENDIF(NOT ICONV_FIND_QUIETLY)
ELSE(ICONV_FOUND)
IF(Iconv_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Iconv")
ENDIF(Iconv_FIND_REQUIRED)
ENDIF(ICONV_FOUND)
MARK_AS_ADVANCED(
ICONV_INCLUDE_DIR
ICONV_LIBRARIES
ICONV_SECOND_ARGUMENT_IS_CONST
)
ENDIF(APPLE)

View file

@ -6,7 +6,7 @@
IF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
# in cache already
SET(LUABIND_FIND_QUIETLY TRUE)
SET(Luabind_FIND_QUIETLY TRUE)
ENDIF(LUABIND_LIBRARIES AND LUABIND_INCLUDE_DIR)
FIND_PATH(LUABIND_INCLUDE_DIR
@ -22,7 +22,7 @@ FIND_PATH(LUABIND_INCLUDE_DIR
)
SET(LIBRARY_NAME_RELEASE luabind libluabind)
SET(LIBRARY_NAME_DEBUG luabind_d libluabind_d libluabindd)
SET(LIBRARY_NAME_DEBUG luabind_d luabindd libluabind_d libluabindd)
IF(WITH_STLPORT)
SET(LIBRARY_NAME_RELEASE luabind_stlport ${LIBRARY_NAME_RELEASE})
@ -62,30 +62,35 @@ FIND_LIBRARY(LUABIND_LIBRARY_DEBUG
FIND_PACKAGE(Boost REQUIRED)
IF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
IF(LUABIND_LIBRARY_RELEASE)
IF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
# Case where both Release and Debug versions are provided
SET(LUABIND_FOUND TRUE)
SET(LUABIND_INCLUDE_DIR ${LUABIND_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
IF(LUABIND_LIBRARY_DEBUG)
SET(LUABIND_LIBRARIES "optimized;${LUABIND_LIBRARY_RELEASE};debug;${LUABIND_LIBRARY_DEBUG}")
ELSE(LUABIND_LIBRARY_DEBUG)
SET(LUABIND_LIBRARIES "${LUABIND_LIBRARY_RELEASE}")
ENDIF(LUABIND_LIBRARY_DEBUG)
ENDIF(LUABIND_LIBRARY_RELEASE)
SET(LUABIND_LIBRARIES optimized ${LUABIND_LIBRARY_RELEASE} debug ${LUABIND_LIBRARY_DEBUG})
ELSEIF(LUABIND_LIBRARY_RELEASE)
# Normal case
SET(LUABIND_FOUND TRUE)
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_RELEASE})
ELSEIF(LUABIND_LIBRARY_DEBUG)
# Case where Luabind is compiled from sources (debug version is compiled by default)
SET(LUABIND_FOUND TRUE)
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_DEBUG})
ENDIF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
ENDIF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
IF(LUABIND_FOUND)
SET(LUABIND_INCLUDE_DIR ${LUABIND_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
# Check if luabind/version.hpp exists
FIND_FILE(LUABIND_VERSION_FILE luabind/version.hpp PATHS ${LUABIND_INCLUDE_DIR})
IF(LUABIND_VERSION_FILE)
SET(LUABIND_DEFINITIONS "-DHAVE_LUABIND_VERSION")
ENDIF(LUABIND_VERSION_FILE)
IF(NOT LUABIND_FIND_QUIETLY)
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}")
ENDIF(NOT LUABIND_FIND_QUIETLY)
ENDIF(NOT Luabind_FIND_QUIETLY)
ELSE(LUABIND_FOUND)
IF(NOT LUABIND_FIND_QUIETLY)
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Luabind!")
ENDIF(NOT LUABIND_FIND_QUIETLY)
ENDIF(NOT Luabind_FIND_QUIETLY)
ENDIF(LUABIND_FOUND)
MARK_AS_ADVANCED(LUABIND_LIBRARY_RELEASE LUABIND_LIBRARY_DEBUG Boost_LIB_DIAGNOSTIC_DEFINITIONS)

View file

@ -71,9 +71,9 @@ IF(STLPORT_INCLUDE_DIR)
IF(STLPORT_LIBRARY_RELEASE)
SET(STLPORT_FOUND TRUE)
SET(STLPORT_LIBRARIES "optimized;${STLPORT_LIBRARY_RELEASE}")
SET(STLPORT_LIBRARIES ${STLPORT_LIBRARY_RELEASE})
IF(STLPORT_LIBRARY_DEBUG)
SET(STLPORT_LIBRARIES "${STLPORT_LIBRARIES};debug;${STLPORT_LIBRARY_DEBUG}")
SET(STLPORT_LIBRARIES optimized ${STLPORT_LIBRARIES} debug ${STLPORT_LIBRARY_DEBUG})
ENDIF(STLPORT_LIBRARY_DEBUG)
ENDIF(STLPORT_LIBRARY_RELEASE)
ENDIF(STLPORT_INCLUDE_DIR)

View file

@ -9,17 +9,32 @@ IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_FIND_QUIETLY TRUE)
ENDIF(WINSDK_INCLUDE_DIR)
GET_FILENAME_COMPONENT(WINSDK71_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;InstallationFolder]" ABSOLUTE CACHE)
GET_FILENAME_COMPONENT(WINSDK71_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.1;ProductVersion]" NAME)
IF(WINSDK71_DIR)
IF(NOT WINSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows SDK ${WINSDK71_VERSION} in ${WINSDK71_DIR}")
ENDIF(NOT WINSDK_FIND_QUIETLY)
ENDIF(WINSDK71_DIR)
GET_FILENAME_COMPONENT(WINSDKCURRENT_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE)
GET_FILENAME_COMPONENT(WINSDKCURRENT_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentVersion]" NAME)
IF(WINSDKCURRENT_DIR)
IF(NOT WINSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows SDK ${WINSDKCURRENT_VERSION} in ${WINSDKCURRENT_DIR}")
ENDIF(NOT WINSDK_FIND_QUIETLY)
ENDIF(WINSDKCURRENT_DIR)
FIND_PATH(WINSDK_INCLUDE_DIR Windows.h
PATHS
"[HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]/Include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]/Include"
${WINSDK71_DIR}/Include
${WINSDKCURRENT_DIR}/Include
)
IF(WINSDK_INCLUDE_DIR)
SET(WINSDK_FOUND TRUE)
IF(NOT WINSDK_FIND_QUIETLY)
MESSAGE(STATUS "Found Windows SDK.")
ENDIF(NOT WINSDK_FIND_QUIETLY)
ELSE(WINSDK_INCLUDE_DIR)
IF(NOT WINSDK_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Windows SDK!")

View file

@ -1,39 +0,0 @@
# - Find zlib
# Find the native ZLIB includes and library
#
# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
# ZLIB_LIBRARIES - List of libraries when using zlib.
# ZLIB_FOUND - True if zlib found.
#=============================================================================
# Copyright 2001-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
IF (ZLIB_INCLUDE_DIR)
# Already in cache, be silent
SET(ZLIB_FIND_QUIETLY TRUE)
ENDIF (ZLIB_INCLUDE_DIR)
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)
SET(ZLIB_NAMES z zlib zdll)
FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} )
MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR )
# Per-recommendation
SET(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}")
SET(ZLIB_LIBRARIES "${ZLIB_LIBRARY}")
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS)

View file

@ -45,8 +45,6 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
IF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
LIST(APPEND ${_out_compile_flags} "-fPIC")
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
ELSE(CMAKE_COMPILER_IS_GNUCXX)
## TODO ... ? or does it work out of the box
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES )
@ -115,6 +113,11 @@ MACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input _output)
ENDMACRO(GET_PRECOMPILED_HEADER_OUTPUT _targetName _input)
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use )
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
IF(${oldProps} MATCHES NOTFOUND)
SET(oldProps "")
ENDIF(${oldProps} MATCHES NOTFOUND)
IF(CMAKE_COMPILER_IS_GNUCXX)
# to do: test whether compiler flags match between target _targetName
# and _pch_output_to_use
@ -123,19 +126,15 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use )
# for use with distcc and gcc >4.0.1 if preprocessed files are accessible
# on all remote machines set
# PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess
SET(_target_cflags "${PCH_ADDITIONAL_COMPILER_FLAGS}-include ${_input} -Winvalid-pch")
SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS}-include ${_input} -Winvalid-pch")
ELSE(CMAKE_COMPILER_IS_GNUCXX)
IF(MSVC)
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
IF(${oldProps} MATCHES NOTFOUND)
SET(oldProps "")
ENDIF(${oldProps} MATCHES NOTFOUND)
SET(_target_cflags "${oldProps} /Yu\"${_input}\" /FI\"${_input}\" /Fp\"${_pch_output_to_use}\"")
ENDIF(MSVC)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags})
SET_TARGET_PROPERTIES(${_targetName}_pch_dephelp PROPERTIES COMPILE_FLAGS ${_target_cflags})
ADD_CUSTOM_TARGET(pch_Generate_${_targetName} DEPENDS ${_pch_output_to_use})
ADD_DEPENDENCIES(${_targetName} pch_Generate_${_targetName})
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET)

View file

@ -37,16 +37,17 @@ ENDMACRO(NL_TARGET_DRIVER)
# Argument:
###
MACRO(NL_DEFAULT_PROPS name label)
IF(NOT MSVC10)
SET_TARGET_PROPERTIES(${name} PROPERTIES PROJECT_LABEL ${label})
ENDIF(NOT MSVC10)
GET_TARGET_PROPERTY(type ${name} TYPE)
IF(${type} STREQUAL SHARED_LIBRARY)
# Set versions only if target is a shared library
SET_TARGET_PROPERTIES(${name} PROPERTIES
VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR}
INSTALL_NAME_DIR ${NL_LIB_PREFIX}
PROJECT_LABEL ${label})
ELSE(${type} STREQUAL SHARED_LIBRARY)
SET_TARGET_PROPERTIES(${name} PROPERTIES
PROJECT_LABEL ${label})
VERSION ${NL_VERSION} SOVERSION ${NL_VERSION_MAJOR})
IF(NL_LIB_PREFIX)
SET_TARGET_PROPERTIES(${name} PROPERTIES INSTALL_NAME_DIR ${NL_LIB_PREFIX})
ENDIF(NL_LIB_PREFIX)
ENDIF(${type} STREQUAL SHARED_LIBRARY)
IF(WITH_STLPORT AND WIN32)
SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "/X")
@ -287,19 +288,56 @@ MACRO(NL_SETUP_BUILD)
ENDIF(CMAKE_BUILD_TYPE MATCHES "Release")
ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug")
# Determine target CPU
# IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
IF(NOT CMAKE_SIZEOF_VOID_P)
INCLUDE (CheckTypeSize)
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
ENDIF(NOT CMAKE_SIZEOF_VOID_P)
# Using 32 or 64 bits libraries
SET(TARGET_X86 1)
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(ARCH "x86_64")
SET(TARGET_X64 1)
ADD_DEFINITIONS(-DHAVE_X86_64)
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(ARCH "x86")
ADD_DEFINITIONS(-DHAVE_X86)
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
# ADD_DEFINITIONS(-DHAVE_IA64)
# ENDIF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86")
IF(WIN32)
# don't use a /O[012x] flag if you want custom optimizations
SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-")
# without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Ob1")
IF(MSVC10)
# /Ox is working with VC++ 2010, but custom optimizations don't exist
SET(SPEED_OPTIMIZATIONS "/Ox /GF /GS-")
# without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Od /Ob1")
ELSE(MSVC10)
# don't use a /O[012x] flag if you want custom optimizations
SET(SPEED_OPTIMIZATIONS "/Ob2 /Oi /Ot /Oy /GT /GF /GS-")
# without inlining it's unusable, use custom optimizations again
SET(MIN_OPTIMIZATIONS "/Ob1")
ENDIF(MSVC10)
SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000")
# Exceptions are only set for C++
SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa")
SET(PLATFORM_CFLAGS "/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /W3 /Zi /Zm1000 /MP /Gy-")
# Common link flags
SET(PLATFORM_LINKFLAGS "-DEBUG")
IF(TARGET_X64)
# Fix a bug with Intellisense
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} /D_WIN64")
# Fix a compilation error for some big C++ files
SET(MIN_OPTIMIZATIONS "${MIN_OPTIMIZATIONS} /bigobj")
ELSE(TARGET_X64)
# Allows 32 bits applications to use 3 GB of RAM
SET(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /LARGEADDRESSAWARE")
ENDIF(TARGET_X64)
# Exceptions are only set for C++
SET(PLATFORM_CXXFLAGS "${PLATFORM_CFLAGS} /EHa")
SET(NL_DEBUG_CFLAGS "/MDd /RTC1 /D_DEBUG ${MIN_OPTIMIZATIONS}")
SET(NL_RELEASE_CFLAGS "/MD /D NDEBUG ${SPEED_OPTIMIZATIONS}")
@ -323,33 +361,10 @@ MACRO(NL_SETUP_BUILD)
SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -D_DEBUG")
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O6")
ENDIF(WIN32)
# Determine host CPU
IF(UNIX AND NOT WIN32)
FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
IF(CMAKE_UNAME)
EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR)
SET(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL "processor type (i386 and x86_64)")
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
ADD_DEFINITIONS(-DHAVE_X86_64)
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64")
ADD_DEFINITIONS(-DHAVE_IA64)
ELSE(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
ADD_DEFINITIONS(-DHAVE_X86)
ENDIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
ELSE(CMAKE_UNAME) # Assume that if uname is not found that we're x86.
ADD_DEFINITIONS(-DHAVE_X86)
ENDIF(CMAKE_UNAME)
ENDIF(UNIX AND NOT WIN32)
ENDMACRO(NL_SETUP_BUILD)
MACRO(NL_SETUP_BUILD_FLAGS)
#SET(CMAKE_DEBUG_POSTFIX "_d")
#SET(CMAKE_RELEASE_POSTFIX "_r")
SET(CMAKE_C_FLAGS ${PLATFORM_CFLAGS} CACHE STRING "" FORCE)
SET(CMAKE_CXX_FLAGS ${PLATFORM_CXXFLAGS} CACHE STRING "" FORCE)

View file

@ -169,7 +169,7 @@ void setCrashAlreadyReported(bool state);
*\endcode
*/
#ifdef NL_NO_DEBUG
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
# define nldebug __noop
# else
# define nldebug 0&&
@ -184,7 +184,7 @@ void setCrashAlreadyReported(bool state);
* Same as nldebug but it will be display in debug and in release mode.
*/
#ifdef NL_NO_DEBUG
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
# define nlinfo __noop
# else
# define nlinfo 0&&
@ -212,7 +212,7 @@ void setCrashAlreadyReported(bool state);
*/
#ifdef NL_NO_DEBUG
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
# if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
# define nlwarning __noop
# else
# define nlwarning 0&&
@ -583,7 +583,11 @@ template<class T, class U> inline T type_cast(U o)
/** Compile time assertion
*/
#define nlctassert(cond) sizeof(uint[(cond) ? 1 : 0])
#ifdef NL_ISO_CPP0X_AVAILABLE
# define nlctassert(cond) static_assert(cond, "Compile time assert in "#cond)
#else
# define nlctassert(cond) sizeof(uint[(cond) ? 1 : 0])
#endif
/**
* Allow to verify an object was accessed before its destructor call.

View file

@ -105,4 +105,7 @@ CHashKey getSHA1(const std::string &filename, bool forcePath = false);
// This function get a buffer with size and returns his SHA hash key
CHashKey getSHA1(const uint8 *buffer, uint32 size);
// This function get a buffer and key with size and returns his HMAC-SHA1 hash key
CHashKey getHMacSHA1(const uint8 *text, uint32 text_len, const uint8 *key, uint32 key_len);
#endif // NL_SHA1_H

View file

@ -352,7 +352,7 @@ public:
}
};
#if defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
#if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
// This operator only purpose is to compare with NULL value
template <class T>

View file

@ -945,10 +945,13 @@ inline CSString operator+(const char* s0,const CSString& s1)
return CSString(s0)+s1;
}
#ifndef NL_COMP_VC10
// TODO: check if it can be disabled for other compilers too
inline CSString operator+(const std::string& s0,const CSString& s1)
{
return s0+static_cast<const std::string&>(s1);
}
#endif // NL_COMP_VC10
} // NLMISC

View file

@ -51,14 +51,10 @@
# ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0500 // Minimal OS = Windows 2000 (NeL is not supported on Windows 95/98)
# endif
# if _MSC_VER >= 1500
# if _MSC_VER >= 1600
# define NL_COMP_VC10
# elif _MSC_VER >= 1500
# define NL_COMP_VC9
# ifndef _STLPORT_VERSION // STLport doesn't depend on MS STL features
# if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack
# define NL_ISO_STDTR1_AVAILABLE
# define NL_ISO_STDTR1_HEADER(header) <header>
# endif
# endif
# elif _MSC_VER >= 1400
# define NL_COMP_VC8
# undef nl_time
@ -79,6 +75,10 @@
# define NL_COMP_VC6
# define NL_COMP_NEED_PARAM_ON_METHOD
# endif
# if defined(_HAS_TR1) && (_HAS_TR1 + 0) // VC9 TR1 feature pack or later
# define NL_ISO_STDTR1_AVAILABLE
# define NL_ISO_STDTR1_HEADER(header) <header>
# endif
# ifdef _DEBUG
# define NL_DEBUG
# elif defined (NDEBUG)
@ -117,6 +117,10 @@
# define NL_COMP_GCC
#endif
#if defined(_HAS_CPP0X) || defined(__GXX_EXPERIMENTAL_CXX0X__)
# define NL_ISO_CPP0X_AVAILABLE
#endif
// gcc 3.4 introduced ISO C++ with tough template rules
//
// NL_ISO_SYNTAX can be used using #if NL_ISO_SYNTAX or #if !NL_ISO_SYNTAX
@ -149,7 +153,7 @@
# pragma warning (disable : 4390) // don't warn in empty block "if(exp) ;"
# pragma warning (disable : 4996) // 'vsnprintf': This function or variable may be unsafe. Consider using vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
// Debug : Sept 01 2006
# if defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
# if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
# pragma warning (disable : 4005) // don't warn on redefinitions caused by xp platform sdk
# endif // NL_COMP_VC8 || NL_COMP_VC9
#endif // NL_OS_WINDOWS
@ -287,20 +291,18 @@ typedef unsigned int uint; // at least 32bits (depend of processor)
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#ifdef NL_OS_MAC
#define NL_I64 __PRI_64_LENGTH_MODIFIER__
#if defined(__PRI_64_LENGTH_MODIFIER__)
# define NL_I64 __PRI_64_LENGTH_MODIFIER__
#elif defined(__PRI64_PREFIX)
# define NL_I64 __PRI64_PREFIX
#else
#define NL_I64 __PRI64_PREFIX
# ifdef _LP64
# define NL_I64 "l"
# else
# define NL_I64 "ll"
# endif // _LP64
#endif
/*
#ifdef _LP64
# define NL_I64 "l"
#else
# define NL_I64 "ll"
#endif // _LP64
*/
#endif // NL_OS_UNIX
// CHashMap, CHashSet and CHashMultiMap definitions
@ -364,7 +366,7 @@ typedef uint16 ucchar;
// To define a 64bits constant; ie: UINT64_CONSTANT(0x123456781234)
#ifdef NL_OS_WINDOWS
# if defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
# if defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
# define INT64_CONSTANT(c) (c##LL)
# define SINT64_CONSTANT(c) (c##LL)
# define UINT64_CONSTANT(c) (c##LL)

View file

@ -42,7 +42,6 @@ using namespace std;
using namespace NL3D;
using namespace NLMISC;
#ifdef NL_OS_WINDOWS
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
@ -139,7 +138,7 @@ int main(int argc, char **argv)
tc.setScaleX (scale);
tc.setScaleZ (scale);
tc.printAt (0.1f, 0.3f, string("printAt Scale String"));
// display the same string with no scale
tc.setHotSpot (CComputedString::TopLeft);
tc.setScaleX (1.0f);

View file

@ -318,7 +318,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
if (!mat._MatDrvInfo)
{
// Insert into driver list. (so it is deleted when driver is deleted).
ItMatDrvInfoPtrList it= _MatDrvInfos.insert(_MatDrvInfos.end(), NULL);
ItMatDrvInfoPtrList it= _MatDrvInfos.insert(_MatDrvInfos.end(), (NL3D::IMaterialDrvInfos*)NULL);
*it = mat._MatDrvInfo = new CMaterialDrvInfosD3D(this, it);

View file

@ -347,7 +347,7 @@ bool CDriverD3D::activeShader(CShader *shd)
if ( !shd->_DrvInfo )
{
// insert into driver list. (so it is deleted when driver is deleted).
ItShaderDrvInfoPtrList it= _ShaderDrvInfos.insert(_ShaderDrvInfos.end(), NULL);
ItShaderDrvInfoPtrList it= _ShaderDrvInfos.insert(_ShaderDrvInfos.end(), (NL3D::IShaderDrvInfos*)NULL);
// create and set iterator, for future deletion.
shaderInfo = new CShaderDrvInfosD3D(this, it);
*it= shd->_DrvInfo = shaderInfo;

View file

@ -514,7 +514,7 @@ bool CDriverD3D::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded
if ( !tex.TextureDrvShare )
{
// insert into driver list. (so it is deleted when driver is deleted).
ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), NULL);
ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), (NL3D::CTextureDrvShare*)NULL);
// create and set iterator, for future deletion.
*it= tex.TextureDrvShare= new CTextureDrvShare(this, it, &tex);

View file

@ -35,10 +35,18 @@ static void convBlend(CMaterial::TBlend blend, GLenum& glenum)
case CMaterial::srccolor: glenum=GL_SRC_COLOR; break;
case CMaterial::invsrccolor:glenum=GL_ONE_MINUS_SRC_COLOR; break;
// Extended Blend modes.
#ifdef USE_OPENGLES
case CMaterial::blendConstantColor: glenum=GL_CONSTANT_COLOR; break;
case CMaterial::blendConstantInvColor: glenum=GL_ONE_MINUS_CONSTANT_COLOR; break;
case CMaterial::blendConstantAlpha: glenum=GL_CONSTANT_ALPHA; break;
case CMaterial::blendConstantInvAlpha: glenum=GL_ONE_MINUS_CONSTANT_ALPHA; break;
#else
case CMaterial::blendConstantColor: glenum=GL_CONSTANT_COLOR_EXT; break;
case CMaterial::blendConstantInvColor: glenum=GL_ONE_MINUS_CONSTANT_COLOR_EXT; break;
case CMaterial::blendConstantAlpha: glenum=GL_CONSTANT_ALPHA_EXT; break;
case CMaterial::blendConstantInvAlpha: glenum=GL_ONE_MINUS_CONSTANT_ALPHA_EXT; break;
#endif
default: nlstop;
}
}
@ -242,7 +250,9 @@ void CDriverGL::setTextureShaders(const uint8 *addressingModes, const CSmartPtr<
if (glAddrMode != _CurrentTexAddrMode[stage]) // addressing mode different from the one in the device?
{
_DriverGLStates.activeTextureARB(stage);
#ifndef USE_OPENGLES
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, glAddrMode);
#endif
_CurrentTexAddrMode[stage] = glAddrMode;
}
}
@ -266,7 +276,7 @@ bool CDriverGL::setupMaterial(CMaterial& mat)
if (!mat._MatDrvInfo)
{
// insert into driver list. (so it is deleted when driver is deleted).
ItMatDrvInfoPtrList it= _MatDrvInfos.insert(_MatDrvInfos.end(), NULL);
ItMatDrvInfoPtrList it= _MatDrvInfos.insert(_MatDrvInfos.end(), (NL3D::IMaterialDrvInfos*)NULL);
// create and set iterator, for future deletion.
*it= mat._MatDrvInfo= new CShaderGL(this, it);
@ -1971,7 +1981,9 @@ void CDriverGL::endCloudMultiPass()
nlassert(_CurrentMaterial->getShader() == CMaterial::Cloud);
if (ATICloudShaderHandle)
{
#ifndef USE_OPENGLES
glDisable(GL_FRAGMENT_SHADER_ATI);
#endif
}
}
@ -1989,7 +2001,9 @@ sint CDriverGL::beginWaterMultiPass()
*/
void CDriverGL::setupWaterPassR200(const CMaterial &mat)
{
H_AUTO_OGL(CDriverGL_setupWaterPassR200)
H_AUTO_OGL(CDriverGL_setupWaterPassR200);
#ifndef USE_OPENGLES
uint k;
ITexture *tex = mat.getTexture(0);
if (tex)
@ -2061,6 +2075,7 @@ void CDriverGL::setupWaterPassR200(const CMaterial &mat)
float cst[4] = { 1.f, 1.f, 1.f, 0.f };
nglSetFragmentShaderConstantATI(GL_CON_0_ATI, cst);
}
#endif
}
// ***************************************************************************
@ -2068,7 +2083,9 @@ void CDriverGL::setupWaterPassR200(const CMaterial &mat)
*/
void CDriverGL::setupWaterPassARB(const CMaterial &mat)
{
H_AUTO_OGL(CDriverGL_setupWaterPassARB)
H_AUTO_OGL(CDriverGL_setupWaterPassARB);
#ifndef USE_OPENGLES
uint k;
ITexture *tex = mat.getTexture(0);
if (tex)
@ -2147,6 +2164,7 @@ void CDriverGL::setupWaterPassARB(const CMaterial &mat)
}
}
}
#endif
}
// ***************************************************************************
@ -2175,6 +2193,7 @@ void CDriverGL::setupWaterPassNV20(const CMaterial &mat)
{
H_AUTO_OGL(CDriverGL_setupWaterPassNV20)
#ifndef USE_OPENGLES
static bool setupDone = false;
static CMaterial::CTexEnv texEnvReplace;
static CMaterial::CTexEnv texEnvModulate;
@ -2259,6 +2278,7 @@ void CDriverGL::setupWaterPassNV20(const CMaterial &mat)
activateTexEnvMode(2, texEnvReplace);
activateTexEnvMode(3, texEnvModulate);
}
#endif
}
// ***************************************************************************
@ -2286,7 +2306,9 @@ void CDriverGL::setupWaterPass(uint /* pass */)
// ***************************************************************************
void CDriverGL::endWaterMultiPass()
{
H_AUTO_OGL(CDriverGL_endWaterMultiPass)
H_AUTO_OGL(CDriverGL_endWaterMultiPass);
#ifndef USE_OPENGLES
nlassert(_CurrentMaterial->getShader() == CMaterial::Water);
// NB : as fragment shaders / programs bypass the texture envs, no special env enum is added (c.f CTexEnvSpecial)
if (_Extensions.NVTextureShader) return;
@ -2298,6 +2320,7 @@ void CDriverGL::endWaterMultiPass()
{
glDisable(GL_FRAGMENT_SHADER_ATI);
}
#endif
}
} // NL3D

View file

@ -20,11 +20,15 @@
#include "nel/misc/types_nl.h"
#include "nel/3d/vertex_buffer.h"
#ifdef NL_OS_MAC
# define GL_GLEXT_LEGACY
# include <OpenGL/gl.h>
#ifdef USE_OPENGLES
# include <GLES/gl.h>
#else
# include <GL/gl.h>
# ifdef NL_OS_MAC
# define GL_GLEXT_LEGACY
# include <OpenGL/gl.h>
# else
# include <GL/gl.h>
# endif
#endif
@ -41,7 +45,7 @@ namespace NL3D
- GL_ALPHA_TEST
- GL_LIGHTING
- GL_LIGHT0 + i .....
- GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP_ARB.
- GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP_ARB/OES.
- GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_R
- GL_COLOR_MATERIAL
- GL_FOG

View file

@ -155,7 +155,11 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex)
// check status
GLenum status;
#ifdef USE_OPENGLES
status = (GLenum) nglCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES);
#else
status = (GLenum) nglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
#endif
switch(status) {
case GL_FRAMEBUFFER_COMPLETE_EXT:
InitFBO = true;
@ -204,12 +208,24 @@ bool CTextureDrvInfosGL::initFrameBufferObject(ITexture * tex)
// clean up resources if allocation failed
if (!InitFBO)
{
#ifdef USE_OPENGLES
nglDeleteFramebuffersOES(1, &FBOId);
#else
nglDeleteFramebuffersEXT(1, &FBOId);
#endif
if (AttachDepthStencil)
{
#ifdef USE_OPENGLES
nglDeleteRenderbuffersOES(1, &DepthFBOId);
#else
nglDeleteRenderbuffersEXT(1, &DepthFBOId);
#endif
if(!UsePackedDepthStencil)
#ifdef USE_OPENGLES
nglDeleteRenderbuffersOES(1, &StencilFBOId);
#else
nglDeleteRenderbuffersEXT(1, &StencilFBOId);
#endif
}
}
@ -226,14 +242,22 @@ bool CTextureDrvInfosGL::activeFrameBufferObject(ITexture * tex)
if(initFrameBufferObject(tex))
{
glBindTexture(TextureMode, 0);
#ifdef USE_OPENGLES
nglBindFramebufferOES(GL_FRAMEBUFFER_OES, FBOId);
#else
nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBOId);
#endif
}
else
return false;
}
else
{
#ifdef USE_OPENGLES
nglBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);
#else
nglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
#endif
}
return true;
@ -602,7 +626,7 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded,
{
//nldebug("3D: creating CTextureDrvShare()");
// insert into driver list. (so it is deleted when driver is deleted).
ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), NULL);
ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), (NL3D::CTextureDrvShare*)NULL);
// create and set iterator, for future deletion.
*it= tex.TextureDrvShare= new CTextureDrvShare(this, it, &tex);
@ -840,8 +864,13 @@ bool CDriverGL::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded,
sint size= tex.getPixels(i).size();
if (bUpload)
{
#ifdef USE_OPENGLES
glCompressedTexImage2D (GL_TEXTURE_2D, i-decalMipMapResize, glfmt,
tex.getWidth(i),tex.getHeight(i), 0, size, ptr);
#else
nglCompressedTexImage2DARB (GL_TEXTURE_2D, i-decalMipMapResize, glfmt,
tex.getWidth(i),tex.getHeight(i), 0, size, ptr);
#endif
bAllUploaded = true;
}
else

View file

@ -140,7 +140,7 @@ bool CDriverGL::setupVertexBuffer(CVertexBuffer& VB)
// 1. Retrieve/Create driver shader.
//==================================
// insert into driver list. (so it is deleted when driver is deleted).
ItVBDrvInfoPtrList it= _VBDrvInfos.insert(_VBDrvInfos.end(), NULL);
ItVBDrvInfoPtrList it= _VBDrvInfos.insert(_VBDrvInfos.end(), (NL3D::IVBDrvInfos*)NULL);
// create and set iterator, for future deletion.
CVBDrvInfosGL *info = new CVBDrvInfosGL(this, it, &VB);
*it= VB.DrvInfos = info;

View file

@ -69,7 +69,7 @@ IVertexBufferHardGL::~IVertexBufferHardGL()
H_AUTO_OGL(IVertexBufferHardGL_IVertexBufferHardGLDtor)
}
#ifndef USE_OPENGLES
// ***************************************************************************
// ***************************************************************************
@ -1133,7 +1133,7 @@ void CVertexArrayRangeMapObjectATI::updateLostBuffers()
}
#endif
#endif // USE_OPENGLES
// ***************************************************************************
@ -1328,6 +1328,12 @@ CVertexBufferHardARB::CVertexBufferHardARB(CDriverGL *drv, CVertexBuffer *vb) :
#ifdef NL_DEBUG
_Unmapping = false;
#endif
#ifdef USE_OPENGLES
_Buffer = NULL;
_BufferSize = 0;
_LastBufferSize = 0;
#endif
}
// ***************************************************************************
@ -1369,6 +1375,14 @@ CVertexBufferHardARB::~CVertexBufferHardARB()
_VertexArrayRange->_MappedVBList.erase(_IteratorInMappedVBList);
}
#endif
#ifdef USE_OPENGLES
if (_Buffer)
{
delete [] _Buffer;
_Buffer = NULL;
}
#endif
}
// ***************************************************************************
@ -1450,6 +1464,39 @@ void *CVertexBufferHardARB::lock()
beforeLock= CTime::getPerformanceTime();
}
_Driver->_DriverGLStates.bindARBVertexBuffer(_VertexObjectId);
#ifdef USE_OPENGLES
if (_Driver->_Extensions.OESMapBuffer)
{
_VertexPtr = nglMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES);
if (!_VertexPtr)
{
nglUnmapBufferOES(GL_ARRAY_BUFFER);
nlassert(glIsBuffer(_VertexObjectId));
invalidate();
return &_DummyVB[0];
}
}
else
{
const uint size = VB->getNumVertices() * VB->getVertexSize();
if (size > _BufferSize)
{
if (_Buffer) delete [] _Buffer;
_Buffer = new uint8[size+3];
_BufferSize = size;
}
uint8 offset = (size_t)_Buffer % 4;
if (offset > 0) offset = 4 - offset;
_VertexPtr = _Buffer + offset;
_LastBufferSize = size;
}
#else
_VertexPtr = nglMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
if (!_VertexPtr)
{
@ -1458,6 +1505,8 @@ void *CVertexBufferHardARB::lock()
invalidate();
return &_DummyVB[0];
}
#endif
#ifdef NL_DEBUG
_VertexArrayRange->_MappedVBList.push_front(this);
_IteratorInMappedVBList = _VertexArrayRange->_MappedVBList.begin();

View file

@ -111,7 +111,7 @@ bool CDriverGL::activeNVVertexProgram (CVertexProgram *program)
}
// Insert into driver list. (so it is deleted when driver is deleted).
ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), NULL);
ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), (NL3D::IVertexProgramDrvInfos*)NULL);
// Create a driver info
*it = drvInfo = new CVertexProgamDrvInfosGL (this, it);
@ -1472,7 +1472,7 @@ bool CDriverGL::activeARBVertexProgram (CVertexProgram *program)
return false;
}
// Insert into driver list. (so it is deleted when driver is deleted).
ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), NULL);
ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), (NL3D::IVertexProgramDrvInfos*)NULL);
// Create a driver info
*it = drvInfo = new CVertexProgamDrvInfosGL (this, it);
@ -1554,7 +1554,7 @@ bool CDriverGL::activeEXTVertexShader (CVertexProgram *program)
*/
// Insert into driver list. (so it is deleted when driver is deleted).
ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), NULL);
ItVtxPrgDrvInfoPtrList it= _VtxPrgDrvInfos.insert(_VtxPrgDrvInfos.end(), (NL3D::IVertexProgramDrvInfos*)NULL);
// Create a driver info
*it = drvInfo = new CVertexProgamDrvInfosGL (this, it);

View file

@ -2376,11 +2376,15 @@ void CDriverGL::getWindowSize(uint32 &width, uint32 &height)
if (_CurrentMode.OffScreen)
{
#ifdef NL_OS_WINDOWS
#ifndef USE_OPENGLES
if (_PBuffer)
{
nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_WIDTH_ARB, (int*)&width );
nwglQueryPbufferARB( _PBuffer, WGL_PBUFFER_HEIGHT_ARB, (int*)&height );
}
#endif
#endif
}
else

View file

@ -109,7 +109,7 @@ CRGBA CFastHLSModifier::convert(uint H, uint L, uint S)
return col;
}
#if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
#if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
# pragma warning( push )
# pragma warning( disable : 4799 )
#endif
@ -262,7 +262,7 @@ uint16 CFastHLSModifier::applyHLSMod(uint16 colorIn, uint8 dHue, uint dLum, uin
#pragma managed(pop)
#endif
#if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
#if defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9) || defined(NL_COMP_VC10)
# pragma warning( pop )
#endif

View file

@ -1867,7 +1867,7 @@ void CMeshMRMSkinnedGeom::updateRawSkinNormal(bool enabled, CMeshMRMSkinnedInst
CIndexBufferReadWrite ibaWrite;
skinLod.RdrPass[i].lock (ibaWrite);
#ifndef NL_SKINNED_MESH_MRM_INDEX16
nlassert(ibaWrite.getFormat() == CIndexBuffer::Indices32)
nlassert(ibaWrite.getFormat() == CIndexBuffer::Indices32);
uint32 *dstTriPtr= (uint32 *) ibaWrite.getPtr();
uint32 numIndices= lod.RdrPass[i].PBlock.size();
for(uint j=0;j<numIndices;j++, srcTriPtr++, dstTriPtr++)

View file

@ -29,6 +29,7 @@
#include "nel/misc/bit_mem_stream.h"
//
#include <limits>
#include <iterator>
//

View file

@ -2083,8 +2083,9 @@ static void DuplicatePrimitiveBlock(const CIndexBuffer &srcBlock, CIndexBuffer &
CIndexBufferReadWrite ibaWrite;
destBlock.lock (ibaWrite);
#ifdef NL_FORCE_INDEX_BUFFER_16
nlassert(destBlock.getFormat() == CIndexBuffer::Indices16);
#endif
// TMP TMP TMP
if (ibaRead.getFormat() == CIndexBuffer::Indices16)

View file

@ -233,6 +233,7 @@ const CType* CFormElm::getType ()
warning (false, "getType", "This node is not an atom.");
return 0;
}
// ***************************************************************************
bool CFormElm::getValue (string &/* result */, TEval /* evaluate */) const

View file

@ -969,14 +969,12 @@ void force_exception_frame(...) {std::cout.flush();}
static void exceptionTranslator(unsigned, EXCEPTION_POINTERS *pexp)
{
#ifndef NL_NO_DEBUG_FILES
FILE *file = fopen ("exception_catched", "wb");
fclose (file);
CFile::createEmptyFile(getLogDirectory() + "exception_catched");
#endif
if (pexp->ExceptionRecord->ExceptionCode == EXCEPTION_BREAKPOINT)
{
#ifndef NL_NO_DEBUG_FILES
FILE *file2 = fopen ("breakpointed", "wb");
fclose (file2);
CFile::createEmptyFile(getLogDirectory() + "breakpointed");
#endif
return;
}
@ -1683,12 +1681,18 @@ NLMISC_CATEGORISED_COMMAND(nel, writeaccess, "write a uint8 value in an invalid
uint8 val = 123;
uint8 *adr = (uint8*)0;
if(args.size() >= 1)
{
#ifdef HAVE_X86_64
adr = (uint8*)(uint64)atoi(args[0].c_str());
uint64 addr64;
NLMISC::fromString(args[0], addr64);
adr = (uint8*)addr64;
#else
adr = (uint8*)atoi(args[0].c_str());
uint32 addr32;
NLMISC::fromString(args[0], addr32);
adr = (uint8*)addr32;
#endif
if(args.size() >= 2) val = (uint8)atoi(args[1].c_str());
}
if(args.size() >= 2) NLMISC::fromString(args[1], val);
*adr = val;
return true;
}
@ -1698,11 +1702,17 @@ NLMISC_CATEGORISED_COMMAND(nel, readaccess, "read a uint8 value in an invalid ad
uint8 val;
uint8 *adr = (uint8*)0;
if(args.size() == 1)
{
#ifdef HAVE_X86_64
adr = (uint8*)(uint64)atoi(args[0].c_str());
uint64 addr64;
NLMISC::fromString(args[0], addr64);
adr = (uint8*)addr64;
#else
adr = (uint8*)atoi(args[0].c_str());
uint32 addr32;
NLMISC::fromString(args[0], addr32);
adr = (uint8*)addr32;
#endif
}
val = *adr;
log.displayNL("value is %hu", (uint16)val);
return true;

View file

@ -187,6 +187,77 @@ CHashKey getSHA1(const string &filename, bool forcePath)
return hk;
}
/*
*
* HMAC = hash( (Key ^ 0x5c) .. hash( (Key ^0x36) .. Message ) )
*
*/
CHashKey getHMacSHA1(const uint8 *text, uint32 text_len, const uint8 *key, uint32 key_len)
{
SHA1Context sha;
uint8_t SHA1_Key[64];
uint8_t SHA1_Key1[20];
uint8_t SHA1_Key2[20];
string buffer1;
string buffer2;
// Init some vars
for (uint i = 0; i < 64; i++)
SHA1_Key[i] = 0;
// If lenght of key > 64 use sha1 hash
if (key_len > 64) {
uint8_t SHA1_Key0[20];
SHA1Reset(&sha);
SHA1Input(&sha, (const uint8_t*)key, key_len);
SHA1Result(&sha, SHA1_Key0);
CHashKey hk0 (SHA1_Key0);
for (uint i = 0; i < 20; i++)
SHA1_Key[i] = hk0.HashKeyString[i];
} else {
for (uint i = 0; i < key_len; i++)
SHA1_Key[i] = key[i];
}
// Do 0x36 XOR Key
for (uint i = 0; i < 64; i++)
buffer1 += 0x36 ^ SHA1_Key[i];
// Append text
for (uint i = 0; i < text_len; i++)
buffer1 += text[i];
// Get hash
SHA1Reset(&sha);
SHA1Input(&sha, (const uint8_t*)buffer1.c_str(), (uint)buffer1.size());
SHA1Result(&sha, SHA1_Key1);
CHashKey hk1 (SHA1_Key1);
// Do 0x5c XOR Key
for (uint i = 0; i < 64; i++)
buffer2 += 0x5c ^ SHA1_Key[i];
// Append previous hash
for (uint i = 0; i < 20; i++)
buffer2 += hk1.HashKeyString[i];
// Get new hash
SHA1Reset(&sha);
SHA1Input(&sha, (const uint8_t*)buffer2.c_str(), (uint)buffer2.size());
SHA1Result(&sha, SHA1_Key2);
CHashKey hk (SHA1_Key2);
return hk;
}
#ifdef _MFC_VER
#pragma runtime_checks( "", off )
#endif
/*
* Define the SHA1 circular left shift macro
*/

View file

@ -36,8 +36,8 @@ namespace NLMISC {
// Storage for file handles, necessary to close the handles
map<void*,HANDLE> AccessAddressesToHandles;
#else
// Storage for shmid, necessary to destroy the segments
map<TSharedMemId, int> SharedMemIdsToShmids;
// Storage for shmid, necessary to destroy the segments
map<TSharedMemId, sint> SharedMemIdsToShmids;
#endif
@ -71,7 +71,7 @@ void *CSharedMemory::createSharedMemory( TSharedMemId sharedMemId, uint32 size
#else
// Create a shared memory segment
int shmid = shmget( sharedMemId, size, IPC_CREAT | IPC_EXCL | 0666 );
sint shmid = shmget( sharedMemId, size, IPC_CREAT | IPC_EXCL | 0666 );
if ( shmid == -1 )
return NULL;
SharedMemIdsToShmids.insert( make_pair( sharedMemId, shmid ) );
@ -82,6 +82,7 @@ void *CSharedMemory::createSharedMemory( TSharedMemId sharedMemId, uint32 size
return NULL;
else
return accessAddress;
#endif
}

View file

@ -22,10 +22,8 @@
#include "nel/misc/hierarchical_timer.h"
#ifdef NL_OS_WINDOWS
# if defined(NL_COMP_VC7) || defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
# include <winsock2.h>
# endif
# define NOMINMAX
# include <winsock2.h>
# include <windows.h>
# define socklen_t int
# define ERROR_NUM WSAGetLastError()

View file

@ -20,9 +20,7 @@
#include "nel/net/net_log.h"
#ifdef NL_OS_WINDOWS
# if defined(NL_COMP_VC7) || defined(NL_COMP_VC71) || defined(NL_COMP_VC8) || defined(NL_COMP_VC9)
# include <winsock2.h>
# endif
# include <winsock2.h>
# define NOMINMAX
# include <windows.h>
# define socklen_t int

View file

@ -836,7 +836,7 @@ void CAudioMixerUser::buildSampleBankList()
nlinfo("Compiling sample bank [%s]", bankname.c_str());
std::string filename = buildSampleBank(bankDir[i], sbp, bankname);
if (bankFile.size() < i + 1) bankFile.resize(i + 1);
else bankFile.insert(bankFile.begin() + i, NULL);
else bankFile.insert(bankFile.begin() + i, std::string());
bankFile[i] = filename;
}
else if (bankname < CFile::getFilenameWithoutExtension(bankDir[i]))

View file

@ -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.
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));
}

View file

@ -36,6 +36,7 @@
#include <limits>
#include <numeric>
#include <iomanip>
#include <iterator>
#include "nel/misc/vector.h"
#include "nel/misc/path.h"

View file

@ -8,6 +8,10 @@
# This tells the application(s) where to fidn the installed data.
ADD_DEFINITIONS(-DDATA_DIR="\\"${NL_SHARE_PREFIX}/object_viewer_qt/\\"")
IF(UNIX AND WITH_STATIC)
MESSAGE(FATAL_ERROR "OVQT does not work with static NeL builds on Unix atm.")
ENDIF()
ADD_SUBDIRECTORY(src)
INSTALL(DIRECTORY data/

View file

@ -31,7 +31,7 @@ PROJECT_NAME = "Object Viewer Qt"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = r90
PROJECT_NUMBER =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
@ -643,7 +643,7 @@ FILE_PATTERNS = *.c \
# should be searched for input files as well. Possible values are YES and NO.
# If left blank NO is used.
RECURSIVE = NO
RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should
# excluded from the INPUT source files. This way you can easily exclude a

View file

@ -1,6 +1,6 @@
/**
@mainpage Object Viewer Qt
@author Dzmitry Kamiahin <dnk-88@tut.by>, (C) 2010
@author Dzmitry Kamiahin <dnk-88@tut.by>, (C) 2011
@section introduce Introduce
@details
@ -15,130 +15,22 @@ The tool can be used in different tasks:
- Create and modify micro-vegetation material (.vegetset files)
- Viewing landscape (.zonel files)
- Dialog allows to specify graphical, sound, search path and landscape settings.
@section project_structure Overview of the Object Viewer Qt Project Structure
@details
OVQT - consists of several major subsystems. Each subsystem performs its defined part of the task.
Through Modules:: provides access to all other program subsystems.
Program has the following subsystems:
- @ref Modules - Main modules aggregated all parts of the program.
- @ref NLQT::CConfiguration - is responsible for loading and saving settings from the configuration file. As well as search path of data.
- @ref NLQT::CObjectViewer - main subsystem of the program, which initializes the driver, creates a scene and other supporting elements.
It is a container for loaded models, which can further be viewed and animated.
- @ref NLQT::CMainWindow - is responsible for the GUI.
- @ref NLQT::CParticleEditor - is responsible for the particle systems and provides access to a container that keeps all the loaded particle systems.
And also allows you to view an animation of particle systems, with the ability to control its parameters.
- @ref NLQT::CVegetableEditor - is responsible for the landscape zones and the editor of vegetation.
Allows you to load and view the landscape. Also has the ability to create and edit the parameters of the micro-vegetation.
- @ref NLQT::CSoundSystem - is responsible for the sound in the program.
<b>
The structure of the GUI in the editor of the particles.
</b><br>
This can be useful for new developers who want to add more new dialogs or to improve the functionality of existing dialogues.
<img src="gui_struct.png" alt="Particle Workspace">
ParticleWorkspace dialogue uses the technique of model-view.
Using the signal/slot link QTreeView with QStackWidget, Editor properties dialog.
When you select an item in QTreeView, QStackWidget displays the necessary page(PageWidget) where you can edit the element of the particles system.
Each page is made in the designer and has a separate forms(.ui).
In accordance with the recommendations of dialogues design, with a large number of items,every page uses QTabWidget.
In case when there is a great number of controls, and not everything you want to display,
it's used the dynamic creation of tabs. Moreover, each tab uses a separate forms(.ui).
@section for_new_developer Guide for new developers of the Object Viewer Qt.
@details
First of all, to begin developing dialogues that add new features ovqt,
it is needed to read the documentation Qt libs (http://doc.qt.nokia.com/) and NeL documentation.
In order to have convenient using of the tool and its further development,
it is expected to make a unified interface that is why all dialogs should adhere to a standard design,
which will be written further. For this goals program provides some additional widgets,
which are recommended to use. As in the development Qt Designer is actively used.
To get access to founded here widgets from the designer,the technique promotion is used,
which can be found <a href="http://doc.qt.nokia.com/4.5/designer-using-custom-widgets.html"> here </a>.
<ol>
<li><b>
CEditRangeUIntWidget / CEditRangeIntWidget / CEditRangeFloatWidget
</b><br>
Widgets provides a slider that allows you to specify an integer (or float, depending on which widget used) number within a set range.
The range is also can be set by the user, or for a more accurate selection of numbers, either for receiving large values.
As there may be situations when the range that a user requests,has to be restricted, and widget provides methods that allow you to do so.
<br><br>
<img src="cedit_range_int_widget.png" alt="CEditRangeIntWidget">
<br>
<img src="cedit_range_float_widget.png" alt="CEditRangeFloatWidget">
@see
@ref NLQT::CEditRangeUIntWidget, @ref NLQT::CEditRangeIntWidget, @ref NLQT::CEditRangeFloatWidget
<li><b>
CColorEditWidget
</b><br>
Using this widget you can set the color(RGBA) using the four sliders or through the color selection dialog.
<br><br>
<img src="cedit_color_widget.png" alt="CColorEditWidget">
@see
@ref NLQT::CColorEditWidget
<li><b>
CDirectionWidget
</b><br>
This widget helps to choose from several preset directions, or to choose a custom one.
<br><br>
<img src="cdirection_widget.png" alt="CDirectionWidget">
@see
@ref NLQT::CDirectionWidget
</ol><br><br>
To further convinience of instrument using dialogues interface is recommended to make as follows.
The most sophisticated tools of the program, should take the form of three dock windows (example shown in the screenshot).
<img src="object_viewer_qt_window.png" alt="Object Viewer Qt">
<ol>
<li>
The first dock window - is a control dock window, it should focus all of the control functions of general purpose
(for example: start/stop/pause animations or particles system).
It is recommended to perform of the horizontal type window and placed in the bottom of the main window.
<li>
The second dock window - is a list or a tree of items. In which selecting of the current element,
which assumes to modify or viewis possible.Operations "add/remove/insert or other" items are recommended to make as a popur menu.
It is recommended to perform of the vertical type window and placed in the left of the main window.
<li>
The third dock - is an editor for properties of the element that was selected in the list or in the tree of elements.
As all the controls occupy much space or do not fit at all, you have to use tabs QTabWidget,
which in total can contains quite a lot of elements.
For a small number of tabs it is allowed to use both horizontal and vertical location.
But with a large number of tabs, it is necessary to apply the vertical arrangement.
It is recommended to perform of the vertical type of window and placed in the right of the main window.
</ol>
In the simple dialogues do not necessary to use all three windows, but user has to adhere to the recommendations given above as well.
Also, <b>all dialogs must use the qt layout manager</b>. And if you do not use the designer,
make sure you use the qt tools internationalization applications.
<br><br>
In ovqt for most dialogs their owner is NLQT::CMainWindow and in its methods creating and initializing all dependent dialogs occur.
For the convenience of the program using, most dialogues are created in the form of docking windows.
Creating all the dialogues are carried out in a private method NLQT::CMainWindow::createDialogs().
Hence, it is necessary to add operations in this method to create new dialogues.
But we must take into account that at this moment is fully available only one component of the program CConfiguration,
to read the settings from the configuration file. The remaining components of the program are available only after the main window stays visible.
Calling the dialogues going through the menu or the toolbar, usually it is a checkable item.
Adding of the new menu items or items toolbars is need in methods NLQT::CMainWindow::createMenus(), NLQT::CMainWindow::createToolBars().
- OVQT supports loading third-party plug-ins.
@section license_ovqt License Object Viewer Qt
@details
Object Viewer Qt
Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom>
<br>
Copyright (C) 2010 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.
<br><br>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
<br><br>
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
<br><br>
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
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/>.
*/

View file

@ -40,7 +40,6 @@ class IPluginSpec;
class IPluginManager: public QObject
{
Q_OBJECT
public:
IPluginManager(QObject *parent = 0): QObject(parent) {}
virtual ~IPluginManager() {}

View file

@ -151,9 +151,9 @@ void CPluginManager::readPluginPaths()
{
const QDir dir(searchPaths.takeFirst());
#ifdef Q_OS_WIN
const QFileInfoList files = dir.entryInfoList(QStringList() << QString("*.dll"), QDir::Files);
const QFileInfoList files = dir.entryInfoList(QStringList() << QString("ovqt_plugin_*.dll"), QDir::Files);
#else
const QFileInfoList files = dir.entryInfoList(QStringList() << QString("*.so"), QDir::Files);
const QFileInfoList files = dir.entryInfoList(QStringList() << QString("libovqt_plugin_*.so"), QDir::Files);
#endif
Q_FOREACH (const QFileInfo &file, files)
pluginsList << file.absoluteFilePath();
@ -292,4 +292,4 @@ void CPluginManager::deleteAll()
}
}
}; // namespace NLQT
}; // namespace ExtensionSystem

View file

@ -74,6 +74,6 @@ private:
}; // class CPluginManager
} // namespace NLQT
} // namespace ExtensionSystem
#endif // PLUGINMANAGER_H

View file

@ -266,4 +266,4 @@ bool CPluginSpec::reportError(const QString &err)
return false;
}
} // namespace NLQT
} // namespace ExtensionSystem

View file

@ -79,7 +79,7 @@ private:
friend class CPluginManager;
};
} // namespace NLQT
} // namespace ExtensionSystem
#endif // PLUGINSPEC_H

View file

@ -38,6 +38,8 @@
#include <QtGui/QMessageBox>
#include <QtGui/QApplication>
#include <QtGui/QSplashScreen>
#include <QtGui/QFileDialog>
#include <QtGui/QInputDialog>
static const char *appNameC = "ObjectViewerQt";
@ -135,7 +137,7 @@ sint main(int argc, char **argv)
QTranslator qtTranslator;
QString locale = settings->value("Language", QLocale::system().name()).toString();
QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
translator.load("object_viewer_qt_" + locale, ":/");
// translator.load("object_viewer_qt_" + locale, ":/");
qtTranslator.load("qt_" + locale, qtTrPath);
app.installTranslator(&translator);
app.installTranslator(&qtTranslator);
@ -149,9 +151,9 @@ sint main(int argc, char **argv)
pluginManager.setSettings(settings);
QStringList pluginPaths;
#if !defined(NL_OS_MAC)
pluginPaths << QString("./plugins");
pluginPaths << settings->value("PluginPath", "./plugins").toString();
#else
pluginPaths << qApp->applicationDirPath() + QString("/../PlugIns/ovqt");
pluginPaths << settings->value("PluginPath", qApp->applicationDirPath() + QString("/../PlugIns/ovqt")).toString();
#endif
pluginManager.setPluginPaths(pluginPaths);
@ -176,6 +178,15 @@ sint main(int argc, char **argv)
QString absolutePaths = absolutePluginPaths.absolutePath();
const QString reason = QCoreApplication::translate("Application", "Could not find ovqt_plugin_core in %1").arg(absolutePaths);
displayError(msgCoreLoadFailure(reason));
QString newPath = QFileDialog::getExistingDirectory(0, QCoreApplication::translate("Application", "Change the plugins path"), QDir::homePath());
bool ok;
QString text = QInputDialog::getText(0, QCoreApplication::translate("Application", "Enter the plugins path"),
QCoreApplication::translate("Application", "Plugin path:"), QLineEdit::Normal,
newPath, &ok);
if (ok && !text.isEmpty())
settings->setValue("PluginPath", text);
settings->sync();
return 1;
}
if (corePlugin->hasError())

View file

@ -1,7 +1,9 @@
ADD_SUBDIRECTORY(core)
ADD_SUBDIRECTORY(example)
ADD_SUBDIRECTORY(ovqt_sheet_builder)
ADD_SUBDIRECTORY(landscape_editor)
ADD_SUBDIRECTORY(log)
ADD_SUBDIRECTORY(disp_sheet_id)
ADD_SUBDIRECTORY(object_viewer)
ADD_SUBDIRECTORY(zone_painter)
ADD_SUBDIRECTORY(zone_painter)
ADD_SUBDIRECTORY(georges_editor)

View file

@ -18,13 +18,18 @@ SET(OVQT_CORE_PLUGIN_HDR
core.h
main_window.h
menu_manager.h
context_manager.h
settings_dialog.h
search_paths_settings_page.h
plugin_view_dialog.h)
general_settings_page.h
plugin_view_dialog.h
)
SET(OVQT_CORE_PLUGIN_UIS settings_dialog.ui
plugin_view_dialog.ui
search_paths_settings_page.ui)
general_settings_page.ui
search_paths_settings_page.ui
)
SET(OVQT_CORE_PLUGIN_RCS core.qrc)

View file

@ -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 */

View file

@ -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

View file

@ -18,6 +18,7 @@
#include "core.h"
#include "imenu_manager.h"
#include "context_manager.h"
#include "main_window.h"
#include "../../extension_system/iplugin_manager.h"
@ -54,6 +55,11 @@ IMenuManager *CoreImpl::menuManager() const
return m_mainWindow->menuManager();
}
ContextManager *CoreImpl::contextManager() const
{
return m_mainWindow->contextManager();
}
QSettings *CoreImpl::settings() const
{
return m_mainWindow->settings();

View file

@ -38,6 +38,7 @@ public:
QWidget *parent = 0);
virtual IMenuManager *menuManager() const;
virtual ContextManager *contextManager() const;
virtual QSettings *settings() const;
virtual QMainWindow *mainWindow() const;

View file

@ -6,6 +6,9 @@
<file>icons/ic_nel_down_item.png</file>
<file>icons/ic_nel_generic_settings.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_pill.png</file>
<file>icons/ic_nel_reset_all.png</file>

View file

@ -1,80 +1,103 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2010 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 CORE_CONSTANTS_H
#define CORE_CONSTANTS_H
namespace Core
{
namespace Constants
{
const char * const OVQT_VERSION_LONG = "0.0.1";
const char * const OVQT_VENDOR = "Dzmitry Kamiahin";
const char * const OVQT_YEAR = "2010, 2011";
const char * const OVQT_CORE_PLUGIN = "Core";
//mainwindow
const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow";
//menubar
const char * const MENU_BAR = "ObjectViewerQt.MenuBar";
//menus
const char * const M_FILE = "ObjectViewerQt.Menu.File";
const char * const M_EDIT = "ObjectViewerQt.Menu.Edit";
const char * const M_VIEW = "ObjectViewerQt.Menu.View";
const char * const M_SCENE = "ObjectViewerQt.Menu.Scene";
const char * const M_TOOLS = "ObjectViewerQt.Menu.Tools";
const char * const M_WINDOW = "ObjectViewerQt.Menu.Window";
const char * const M_HELP = "ObjectViewerQt.Menu.Help";
const char * const M_SHEET = "ObjectViewerQt.Menu.Sheet";
//actions
const char * const NEW = "ObjectViewerQt.New";
const char * const OPEN = "ObjectViewerQt.Open";
const char * const EXIT = "ObjectViewerQt.Exit";
const char * const SETTINGS = "ObjectViewerQt.Settings";
const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen";
const char * const CLOSE = "ObjectViewerQt.Close";
const char * const CLOSEALL = "ObjectViewerQt.CloseAll";
const char * const CLOSEOTHERS = "ObjectViewerQt.CloseOthers";
const char * const ABOUT = "ObjectViewerQt.About";
const char * const ABOUT_PLUGINS = "ObjectViewerQt.AboutPlugins";
const char * const ABOUT_QT = "ObjectViewerQt.AboutQt";
//settings
const char * const DATA_PATH_SECTION = "DataPath";
const char * const SEARCH_PATHS = "SearchPaths";
const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes";
const char * const LEVELDESIGN_PATH = "LevelDesignPath";
const char * const ASSETS_PATH = "LevelDesignPath";
//resources
const char * const ICON_NEL = ":/core/images/nel.png";
const char * const ICON_SETTINGS = ":/core/images/preferences.png";
const char * const ICON_PILL = ":/core/icons/ic_nel_pill.png";
const char * const ICON_OPEN = ":/core/icons/ic_nel_open.png";
const char * const ICON_CRASH = ":/core/icons/ic_nel_crash.png";
} // namespace Constants
} // namespace Core
#endif // CORE_CONSTANTS_H
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2010 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 CORE_CONSTANTS_H
#define CORE_CONSTANTS_H
namespace Core
{
namespace Constants
{
const char * const OVQT_VERSION_LONG = "0.0.1";
const char * const OVQT_VENDOR = "Ryzom Core";
const char * const OVQT_YEAR = "2010, 2011";
const char * const OVQT_CORE_PLUGIN = "Core";
//mainwindow
const char * const MAIN_WINDOW = "ObjectViewerQt.MainWindow";
//menubar
const char * const MENU_BAR = "ObjectViewerQt.MenuBar";
//menus
const char * const M_FILE = "ObjectViewerQt.Menu.File";
const char * const M_EDIT = "ObjectViewerQt.Menu.Edit";
const char * const M_VIEW = "ObjectViewerQt.Menu.View";
const char * const M_SCENE = "ObjectViewerQt.Menu.Scene";
const char * const M_TOOLS = "ObjectViewerQt.Menu.Tools";
const char * const M_WINDOW = "ObjectViewerQt.Menu.Window";
const char * const M_HELP = "ObjectViewerQt.Menu.Help";
const char * const M_SHEET = "ObjectViewerQt.Menu.Sheet";
//actions
const char * const NEW = "ObjectViewerQt.New";
const char * const OPEN = "ObjectViewerQt.Open";
const char * const EXIT = "ObjectViewerQt.Exit";
const char * const SETTINGS = "ObjectViewerQt.Settings";
const char * const TOGGLE_FULLSCREEN = "ObjectViewerQt.ToggleFullScreen";
const char * const CLOSE = "ObjectViewerQt.Close";
const char * const CLOSEALL = "ObjectViewerQt.CloseAll";
const char * const CLOSEOTHERS = "ObjectViewerQt.CloseOthers";
const char * const ABOUT = "ObjectViewerQt.About";
const char * const ABOUT_PLUGINS = "ObjectViewerQt.AboutPlugins";
const char * const ABOUT_QT = "ObjectViewerQt.AboutQt";
//settings
const char * const SETTINGS_CATEGORY_GENERAL = "general";
const char * const SETTINGS_CATEGORY_GENERAL_ICON = ":/icons/ic_nel_generic_settings.png";
const char * const SETTINGS_TR_CATEGORY_GENERAL = QT_TR_NOOP("General");
const char * const MAIN_WINDOW_SECTION = "MainWindow";
const char * const MAIN_WINDOW_STATE = "WindowState";
const char * const MAIN_WINDOW_GEOMETRY = "WindowGeometry";
const char * const QT_STYLE = "QtStyle";
const char * const QT_PALETTE = "QtPalette";
const char * const LANGUAGE = "Language";
const char * const PLUGINS_PATH = "PluginPath";
const char * const DATA_PATH_SECTION = "DataPath";
const char * const SEARCH_PATHS = "SearchPaths";
const char * const RECURSIVE_SEARCH_PATHS = "RecursiveSearchPathes";
const char * const LEVELDESIGN_PATH = "LevelDesignPath";
const char * const ASSETS_PATH = "AssetsPath";
const char * const REMAP_EXTENSIONS = "RemapExtensions";
const char * const LOG_SECTION = "LogSettings";
const char * const LOG_ERROR = "LogError";
const char * const LOG_WARNING = "LogWarning";
const char * const LOG_DEBUG = "LogDebug";
const char * const LOG_ASSERT = "LogAssert";
const char * const LOG_INFO = "LogInfo";
//resources
const char * const ICON_NEL = ":/core/images/nel.png";
const char * const ICON_SETTINGS = ":/core/images/preferences.png";
const char * const ICON_PILL = ":/core/icons/ic_nel_pill.png";
const char * const ICON_OPEN = ":/core/icons/ic_nel_open.png";
const char * const ICON_NEW = ":/core/icons/ic_nel_new.png";
const char * const ICON_SAVE = ":/core/icons/ic_nel_save.png";
const char * const ICON_SAVE_AS = ":/core/icons/ic_nel_save_as.png";
const char * const ICON_CRASH = ":/core/icons/ic_nel_crash.png";
} // namespace Constants
} // namespace Core
#endif // CORE_CONSTANTS_H

View file

@ -20,8 +20,8 @@
#include "settings_dialog.h"
#include "core_constants.h"
#include "search_paths_settings_page.h"
#include "general_settings_page.h"
#include "../../extension_system/iplugin_spec.h"
#include "qtwin.h"
// NeL includes
#include "nel/misc/debug.h"
@ -42,37 +42,40 @@ CorePlugin::CorePlugin()
CorePlugin::~CorePlugin()
{
Q_FOREACH(QObject *obj, _autoReleaseObjects)
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{
_plugMan->removeObject(obj);
m_plugMan->removeObject(obj);
}
qDeleteAll(_autoReleaseObjects);
_autoReleaseObjects.clear();
qDeleteAll(m_autoReleaseObjects);
m_autoReleaseObjects.clear();
delete _mainWindow;
delete m_mainWindow;
}
bool CorePlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
_plugMan = pluginManager;
m_plugMan = pluginManager;
_mainWindow = new MainWindow(pluginManager);
/*if (QtWin::isCompositionEnabled())
{
QtWin::extendFrameIntoClientArea(_mainWindow);
_mainWindow->setContentsMargins(0, 0, 0, 0);
}*/
bool success = _mainWindow->initialize(errorString);
CSearchPathsSettingsPage *serchPathPage = new CSearchPathsSettingsPage(this);
serchPathPage->applySearchPaths();
addAutoReleasedObject(serchPathPage);
m_mainWindow = new MainWindow(pluginManager);
bool success = m_mainWindow->initialize(errorString);
GeneralSettingsPage *generalSettings = new GeneralSettingsPage(this);
CSearchPathsSettingsPage *searchPathPage = new CSearchPathsSettingsPage(false, this);
CSearchPathsSettingsPage *recureseSearchPathPage = new CSearchPathsSettingsPage(true, this);
generalSettings->applyGeneralSettings();
searchPathPage->applySearchPaths();
recureseSearchPathPage->applySearchPaths();
addAutoReleasedObject(generalSettings);
addAutoReleasedObject(searchPathPage);
addAutoReleasedObject(recureseSearchPathPage);
return success;
}
void CorePlugin::extensionsInitialized()
{
_mainWindow->extensionsInitialized();
m_mainWindow->extensionsInitialized();
}
void CorePlugin::shutdown()
@ -86,7 +89,7 @@ void CorePlugin::setNelContext(NLMISC::INelContext *nelContext)
// This only applies to platforms without PIC, e.g. Windows.
nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // NL_OS_WINDOWS
_LibContext = new NLMISC::CLibraryContext(*nelContext);
m_libContext = new NLMISC::CLibraryContext(*nelContext);
}
QString CorePlugin::name() const
@ -116,8 +119,8 @@ QStringList CorePlugin::dependencies() const
void CorePlugin::addAutoReleasedObject(QObject *obj)
{
_plugMan->addObject(obj);
_autoReleaseObjects.prepend(obj);
m_plugMan->addObject(obj);
m_autoReleaseObjects.prepend(obj);
}
Q_EXPORT_PLUGIN(CorePlugin)

View file

@ -63,16 +63,16 @@ public:
ExtensionSystem::IPluginManager *pluginManager() const
{
return _plugMan;
return m_plugMan;
}
protected:
NLMISC::CLibraryContext *_LibContext;
NLMISC::CLibraryContext *m_libContext;
private:
ExtensionSystem::IPluginManager *_plugMan;
MainWindow *_mainWindow;
QList<QObject *> _autoReleaseObjects;
ExtensionSystem::IPluginManager *m_plugMan;
MainWindow *m_mainWindow;
QList<QObject *> m_autoReleaseObjects;
};
} // namespace Core

View file

@ -0,0 +1,192 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// 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 "general_settings_page.h"
#include "core_constants.h"
#include "icore.h"
// NeL includes
#include <nel/misc/path.h>
// Qt includes
#include <QtCore/QSettings>
#include <QtGui/QWidget>
#include <QtGui/QMessageBox>
#include <QtGui/QFileDialog>
#include <QtGui/QStyleFactory>
#include <QtGui/QStyle>
namespace Core
{
GeneralSettingsPage::GeneralSettingsPage(QObject *parent)
: IOptionsPage(parent),
m_page(0)
{
m_originalPalette = QApplication::palette();
}
GeneralSettingsPage::~GeneralSettingsPage()
{
}
QString GeneralSettingsPage::id() const
{
return QLatin1String("general_settings");
}
QString GeneralSettingsPage::trName() const
{
return tr("General");
}
QString GeneralSettingsPage::category() const
{
return QLatin1String(Constants::SETTINGS_CATEGORY_GENERAL);
}
QString GeneralSettingsPage::trCategory() const
{
return tr(Constants::SETTINGS_TR_CATEGORY_GENERAL);
}
QIcon GeneralSettingsPage::categoryIcon() const
{
return QIcon();
}
void GeneralSettingsPage::applyGeneralSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::MAIN_WINDOW_SECTION);
QApplication::setStyle(QStyleFactory::create(settings->value(Constants::QT_STYLE, "").toString()));
if (settings->value(Constants::QT_PALETTE, true).toBool())
QApplication::setPalette(QApplication::style()->standardPalette());
else
QApplication::setPalette(m_originalPalette);
settings->endGroup();
}
QWidget *GeneralSettingsPage::createPage(QWidget *parent)
{
m_page = new QWidget(parent);
m_ui.setupUi(m_page);
readSettings();
connect(m_ui.languageComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeLanguage(QString)));
connect(m_ui.pluginsPathButton, SIGNAL(clicked()), this, SLOT(setPluginsPath()));
connect(m_ui.leveldesignPathButton, SIGNAL(clicked()), this, SLOT(setLevelDesignPath()));
connect(m_ui.assetsPathButton, SIGNAL(clicked()), this, SLOT(setAssetsPath()));
return m_page;
}
void GeneralSettingsPage::apply()
{
writeSettings();
applyGeneralSettings();
}
void GeneralSettingsPage::finish()
{
delete m_page;
m_page = 0;
}
void GeneralSettingsPage::changeLanguage(const QString &lang)
{
QMessageBox::information(0, tr("Restart required"),
tr("The language change will take effect after a restart of Object Viewer Qt."));
}
void GeneralSettingsPage::setPluginsPath()
{
QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the plugins path"),
m_ui.pluginsPathLineEdit->text());
if (!newPath.isEmpty())
{
m_ui.pluginsPathLineEdit->setText(newPath);
}
}
void GeneralSettingsPage::setLevelDesignPath()
{
QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the level design path"),
m_ui.leveldesignPathLineEdit->text());
if (!newPath.isEmpty())
{
m_ui.leveldesignPathLineEdit->setText(newPath);
}
}
void GeneralSettingsPage::setAssetsPath()
{
QString newPath = QFileDialog::getExistingDirectory(0, tr("Set the assets path"),
m_ui.assetsPathLineEdit->text());
if (!newPath.isEmpty())
{
m_ui.assetsPathLineEdit->setText(newPath);
}
}
void GeneralSettingsPage::readSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
m_ui.pluginsPathLineEdit->setText(settings->value(Core::Constants::PLUGINS_PATH, "./plugins").toString());
settings->beginGroup(Constants::MAIN_WINDOW_SECTION);
m_ui.styleComboBox->addItems(QStyleFactory::keys());
QString style = settings->value(Constants::QT_STYLE, "").toString();
if (style == "")
m_ui.styleComboBox->setCurrentIndex(0);
else
m_ui.styleComboBox->setCurrentIndex(m_ui.styleComboBox->findText(style));
m_ui.paletteCheckBox->setChecked(settings->value(Constants::QT_PALETTE, true).toBool());
settings->endGroup();
QStringList paths;
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
m_ui.leveldesignPathLineEdit->setText(settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString());
m_ui.assetsPathLineEdit->setText(settings->value(Core::Constants::ASSETS_PATH, "w:/database").toString());
settings->endGroup();
}
void GeneralSettingsPage::writeSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->setValue(Core::Constants::PLUGINS_PATH, m_ui.pluginsPathLineEdit->text());
settings->beginGroup(Constants::MAIN_WINDOW_SECTION);
if (m_ui.styleComboBox->currentIndex() == 0)
settings->setValue(Constants::QT_STYLE, "");
else
settings->setValue(Constants::QT_STYLE, m_ui.styleComboBox->currentText());
settings->setValue(Constants::QT_PALETTE, m_ui.paletteCheckBox->isChecked());
settings->endGroup();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
settings->setValue(Core::Constants::LEVELDESIGN_PATH, m_ui.leveldesignPathLineEdit->text());
settings->setValue(Core::Constants::ASSETS_PATH, m_ui.assetsPathLineEdit->text());
settings->endGroup();
settings->sync();
}
} /* namespace Core */

View file

@ -0,0 +1,72 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// 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 GENERAL_SETTINGS_PAGE_H
#define GENERAL_SETTINGS_PAGE_H
#include <QtCore/QObject>
#include "ioptions_page.h"
#include "ui_general_settings_page.h"
class QWidget;
namespace Core
{
/**
@class GeneralSettingsPage
*/
class GeneralSettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
GeneralSettingsPage(QObject *parent = 0);
~GeneralSettingsPage();
QString id() const;
QString trName() const;
QString category() const;
QString trCategory() const;
QIcon categoryIcon() const;
QWidget *createPage(QWidget *parent);
void apply();
void finish();
void applyGeneralSettings();
private Q_SLOTS:
void changeLanguage(const QString &lang);
void setPluginsPath();
void setLevelDesignPath();
void setAssetsPath();
private:
void readSettings();
void writeSettings();
QPalette m_originalPalette;
QWidget *m_page;
Ui::GeneralSettingsPage m_ui;
};
} // namespace Core
#endif // GENERAL_SETTINGS_H

View file

@ -0,0 +1,199 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GeneralSettingsPage</class>
<widget class="QWidget" name="GeneralSettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>267</width>
<height>282</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QGroupBox" name="qtStyleGroupBox">
<property name="title">
<string>Qt Style</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QComboBox" name="styleComboBox">
<item>
<property name="text">
<string>default</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QCheckBox" name="paletteCheckBox">
<property name="text">
<string>Use style's standard palette</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="languageGroupBox">
<property name="title">
<string>Language</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>6</number>
</property>
<item>
<widget class="QComboBox" name="languageComboBox">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>English</string>
</property>
</item>
<item>
<property name="text">
<string>German</string>
</property>
</item>
<item>
<property name="text">
<string>French</string>
</property>
</item>
<item>
<property name="text">
<string>Russian</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="pathsGroupBox">
<property name="title">
<string>Paths</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="pluginsPathLabel">
<property name="text">
<string>Plugins path:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="pluginsPathLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="pluginsPathButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="leveldesignPathLabel">
<property name="text">
<string>Level design path:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="leveldesignPathLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="leveldesignPathButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="assetsPathLabel">
<property name="text">
<string>Assets path:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="assetsPathLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="assetsPathButton">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="core.qrc"/>
</resources>
<connections/>
</ui>

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View file

@ -28,6 +28,7 @@
QT_BEGIN_NAMESPACE
class QWidget;
class QUndoStack;
QT_END_NAMESPACE
namespace Core
@ -56,6 +57,10 @@ public:
/// The widget will be destroyed by the widget hierarchy when the main window closes
virtual QWidget *widget() = 0;
virtual QUndoStack *undoStack() = 0;
virtual void open() = 0;
};
} // namespace Core

View file

@ -36,6 +36,7 @@ class IPluginManager;
namespace Core
{
class IMenuManager;
class ContextManager;
class CORE_EXPORT ICore : public QObject
{
@ -52,6 +53,7 @@ public:
QWidget *parent = 0) = 0;
virtual IMenuManager *menuManager() const = 0;
virtual ContextManager *contextManager() const = 0;
virtual QSettings *settings() const = 0;
virtual QMainWindow *mainWindow() const = 0;
@ -59,6 +61,7 @@ public:
virtual ExtensionSystem::IPluginManager *pluginManager() const = 0;
Q_SIGNALS:
void changeSettings();
void closeMainWindow();
};

View file

@ -27,6 +27,7 @@
QT_BEGIN_NAMESPACE
class QWidget;
class QIcon;
QT_END_NAMESPACE
namespace Core
@ -56,6 +57,8 @@ public:
/// trCategory() is the translated category
virtual QString trCategory() const = 0;
virtual QIcon categoryIcon() const = 0;
/// 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
virtual QWidget *createPage(QWidget *parent) = 0;

View file

@ -20,6 +20,7 @@
#include "icontext.h"
#include "icore_listener.h"
#include "menu_manager.h"
#include "context_manager.h"
#include "core.h"
#include "core_constants.h"
#include "settings_dialog.h"
@ -38,8 +39,10 @@ MainWindow::MainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *
: QMainWindow(parent),
m_pluginManager(0),
m_menuManager(0),
m_contextManager(0),
m_coreImpl(0),
m_lastDir("."),
m_undoGroup(0),
m_settings(0)
{
QCoreApplication::setApplicationName(QLatin1String("ObjectViewerQt"));
@ -59,11 +62,15 @@ MainWindow::MainWindow(ExtensionSystem::IPluginManager *pluginManager, QWidget *
m_tabWidget = new QTabWidget(this);
m_tabWidget->setTabPosition(QTabWidget::South);
m_tabWidget->setMovable(true);
m_tabWidget->setMovable(false);
m_tabWidget->setDocumentMode(true);
setCentralWidget(m_tabWidget);
m_contextManager = new ContextManager(this, m_tabWidget);
setDockNestingEnabled(true);
m_originalPalette = QApplication::palette();
m_undoGroup = new QUndoGroup(this);
createDialogs();
createActions();
@ -91,15 +98,11 @@ bool MainWindow::initialize(QString *errorString)
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();
}
@ -108,6 +111,11 @@ IMenuManager *MainWindow::menuManager() const
return m_menuManager;
}
ContextManager *MainWindow::contextManager() const
{
return m_contextManager;
}
QSettings *MainWindow::settings() const
{
return m_settings;
@ -118,11 +126,19 @@ ExtensionSystem::IPluginManager *MainWindow::pluginManager() const
return m_pluginManager;
}
void MainWindow::checkObject(QObject *obj)
void MainWindow::addContextObject(IContext *context)
{
IContext *context = qobject_cast<IContext *>(obj);
if (context)
addContextObject(context);
m_undoGroup->addStack(context->undoStack());
}
void MainWindow::removeContextObject(IContext *context)
{
m_undoGroup->removeStack(context->undoStack());
}
void MainWindow::open()
{
m_contextManager->currentContext()->open();
}
bool MainWindow::showOptionsDialog(const QString &group,
@ -133,7 +149,10 @@ bool MainWindow::showOptionsDialog(const QString &group,
parent = this;
CSettingsDialog settingsDialog(m_pluginManager, group, page, parent);
settingsDialog.show();
return settingsDialog.execDialog();
bool ok = settingsDialog.execDialog();
if (ok)
Q_EMIT m_coreImpl->changeSettings();
return ok;
}
void MainWindow::about()
@ -143,6 +162,11 @@ void MainWindow::about()
"<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)
{
QList<ICoreListener *> listeners = m_pluginManager->getObjects<ICoreListener>();
@ -160,16 +184,6 @@ void MainWindow::closeEvent(QCloseEvent *event)
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()
{
m_openAction = new QAction(tr("&Open..."), this);
@ -177,7 +191,7 @@ void MainWindow::createActions()
m_openAction->setShortcut(QKeySequence::Open);
m_openAction->setStatusTip(tr("Open an existing file"));
menuManager()->registerAction(m_openAction, Constants::OPEN);
// connect(m_openAction, SIGNAL(triggered()), this, SLOT(open()));
connect(m_openAction, SIGNAL(triggered()), this, SLOT(open()));
m_exitAction = new QAction(tr("E&xit"), this);
m_exitAction->setShortcut(QKeySequence(tr("Ctrl+Q")));
@ -220,10 +234,14 @@ void MainWindow::createMenus()
{
m_fileMenu = menuBar()->addMenu(tr("&File"));
menuManager()->registerMenu(m_fileMenu, Constants::M_FILE);
m_fileMenu->addAction(m_openAction);
m_fileMenu->addSeparator();
m_fileMenu->addAction(m_exitAction);
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);
m_viewMenu = menuBar()->addMenu(tr("&View"));
@ -260,17 +278,17 @@ void MainWindow::createDialogs()
void MainWindow::readSettings()
{
m_settings->beginGroup("MainWindow");
restoreState(m_settings->value("WindowState").toByteArray());
restoreGeometry(m_settings->value("WindowGeometry").toByteArray());
m_settings->beginGroup(Constants::MAIN_WINDOW_SECTION);
restoreState(m_settings->value(Constants::MAIN_WINDOW_STATE).toByteArray());
restoreGeometry(m_settings->value(Constants::MAIN_WINDOW_GEOMETRY).toByteArray());
m_settings->endGroup();
}
void MainWindow::writeSettings()
{
m_settings->beginGroup("MainWindow");
m_settings->setValue("WindowState", saveState());
m_settings->setValue("WindowGeometry", saveGeometry());
m_settings->beginGroup(Constants::MAIN_WINDOW_SECTION);
m_settings->setValue(Constants::MAIN_WINDOW_STATE, saveState());
m_settings->setValue(Constants::MAIN_WINDOW_GEOMETRY, saveGeometry());
m_settings->endGroup();
}

View file

@ -26,6 +26,7 @@
// Qt includes
#include <QtGui/QMainWindow>
#include <QtGui/QUndoGroup>
#include <QtCore/QSettings>
namespace Core
@ -35,6 +36,7 @@ class CorePlugin;
class IContext;
class IMenuManager;
class MenuManager;
class ContextManager;
class CoreImpl;
class MainWindow : public QMainWindow
@ -49,25 +51,28 @@ public:
void extensionsInitialized();
IMenuManager *menuManager() const;
ContextManager *contextManager() const;
QSettings *settings() const;
ExtensionSystem::IPluginManager *pluginManager() const;
void addContextObject(IContext *context);
void removeContextObject(IContext *context);
public Q_SLOTS:
bool showOptionsDialog(const QString &group = QString(),
const QString &page = QString(),
QWidget *parent = 0);
private Q_SLOTS:
void checkObject(QObject *obj);
void open();
void about();
void updateContext(Core::IContext *context);
protected:
virtual void closeEvent(QCloseEvent *event);
private:
void addContextObject(IContext *appPage);
void createActions();
void createMenus();
void createStatusBar();
@ -79,11 +84,13 @@ private:
ExtensionSystem::IPluginManager *m_pluginManager;
ExtensionSystem::CPluginView *m_pluginView;
MenuManager *m_menuManager;
ContextManager *m_contextManager;
CoreImpl *m_coreImpl;
QPalette m_originalPalette;
QString m_lastDir;
QUndoGroup *m_undoGroup;
QSettings *m_settings;
QTimer *m_mainTimer;

View file

@ -33,8 +33,9 @@ namespace Core
QString lastDir = ".";
CSearchPathsSettingsPage::CSearchPathsSettingsPage(QObject *parent)
CSearchPathsSettingsPage::CSearchPathsSettingsPage(bool recurse, QObject *parent)
: IOptionsPage(parent),
m_recurse(recurse),
m_page(0)
{
}
@ -45,22 +46,33 @@ CSearchPathsSettingsPage::~CSearchPathsSettingsPage()
QString CSearchPathsSettingsPage::id() const
{
return QLatin1String("SearchPaths");
if (m_recurse)
return QLatin1String("search_recurse_paths");
else
return QLatin1String("search_paths");
}
QString CSearchPathsSettingsPage::trName() const
{
return tr("Search Paths");
if (m_recurse)
return tr("Search Recurse Paths");
else
return tr("Search Paths");
}
QString CSearchPathsSettingsPage::category() const
{
return QLatin1String("General");
return QLatin1String(Constants::SETTINGS_CATEGORY_GENERAL);
}
QString CSearchPathsSettingsPage::trCategory() const
{
return tr("General");
return tr(Constants::SETTINGS_TR_CATEGORY_GENERAL);
}
QIcon CSearchPathsSettingsPage::categoryIcon() const
{
return QIcon();
}
QWidget *CSearchPathsSettingsPage::createPage(QWidget *parent)
@ -92,17 +104,24 @@ void CSearchPathsSettingsPage::finish()
void CSearchPathsSettingsPage::applySearchPaths()
{
QStringList paths;
QStringList paths, remapExt;
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
if (m_recurse)
paths = settings->value(Core::Constants::RECURSIVE_SEARCH_PATHS).toStringList();
else
paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
remapExt = settings->value(Core::Constants::REMAP_EXTENSIONS).toStringList();
settings->endGroup();
for (int i = 1; i < remapExt.size(); i += 2)
NLMISC::CPath::remapExtension(remapExt.at(i - 1).toStdString(), remapExt.at(i).toStdString(), true);
Q_FOREACH(QString path, paths)
{
NLMISC::CPath::addSearchPath(path.toStdString(), false, false);
NLMISC::CPath::addSearchPath(path.toStdString(), m_recurse, false);
}
NLMISC::CPath::remapExtension("png", "tga", true);
NLMISC::CPath::remapExtension("png", "dds", true);
}
void CSearchPathsSettingsPage::addPath()
@ -156,7 +175,10 @@ void CSearchPathsSettingsPage::readSettings()
QStringList paths;
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
if (m_recurse)
paths = settings->value(Core::Constants::RECURSIVE_SEARCH_PATHS).toStringList();
else
paths = settings->value(Core::Constants::SEARCH_PATHS).toStringList();
settings->endGroup();
Q_FOREACH(QString path, paths)
{
@ -175,8 +197,12 @@ void CSearchPathsSettingsPage::writeSettings()
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
settings->setValue(Core::Constants::SEARCH_PATHS, paths);
if (m_recurse)
settings->setValue(Core::Constants::RECURSIVE_SEARCH_PATHS, paths);
else
settings->setValue(Core::Constants::SEARCH_PATHS, paths);
settings->endGroup();
settings->sync();
}
void CSearchPathsSettingsPage::checkEnabledButton()

View file

@ -37,18 +37,20 @@ class CSearchPathsSettingsPage : public Core::IOptionsPage
Q_OBJECT
public:
CSearchPathsSettingsPage(QObject *parent = 0);
explicit CSearchPathsSettingsPage(bool recurse, QObject *parent = 0);
~CSearchPathsSettingsPage();
QString id() const;
QString trName() const;
QString category() const;
QString trCategory() const;
QIcon categoryIcon() const;
QWidget *createPage(QWidget *parent);
void apply();
void finish();
// Set of the search paths(not recursive) and the remap extensions (loading from settings file)
void applySearchPaths();
private Q_SLOTS:
@ -62,6 +64,7 @@ private:
void writeSettings();
void checkEnabledButton();
bool m_recurse;
QWidget *m_page;
Ui::CSearchPathsSettingsPage m_ui;
};

View file

@ -53,6 +53,11 @@ QString CExampleSettingsPage::trCategory() const
return tr("General");
}
QIcon CExampleSettingsPage::categoryIcon() const
{
return QIcon();
}
QWidget *CExampleSettingsPage::createPage(QWidget *parent)
{
_currentPage = new QWidget(parent);

View file

@ -43,6 +43,7 @@ public:
virtual QString trName() const;
virtual QString category() const;
virtual QString trCategory() const;
QIcon categoryIcon() const;
virtual QWidget *createPage(QWidget *parent);
virtual void apply();

View file

@ -86,6 +86,15 @@ public:
return m_simpleViewer;
}
virtual QUndoStack *undoStack()
{
return m_simpleViewer->m_undoStack;
}
virtual void open()
{
}
CSimpleViewer *m_simpleViewer;
};

View file

@ -38,6 +38,9 @@ QNLWidget::QNLWidget(QWidget *parent)
m_initialized(false),
m_interval(25)
{
setAttribute(Qt::WA_OpaquePaintEvent);
setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_PaintOnScreen);
setMouseTracking(true);
setFocusPolicy(Qt::StrongFocus);

View file

@ -37,6 +37,8 @@ CSimpleViewer::CSimpleViewer(QWidget *parent)
gridLayout->setContentsMargins(0, 0, 0, 0);
NLQT::QNLWidget *_nelWidget = new NLQT::QNLWidget(this);
gridLayout->addWidget(_nelWidget, 0, 0, 1, 1);
m_undoStack = new QUndoStack(this);
}
bool CCoreListener::closeMainWindow() const

View file

@ -25,7 +25,7 @@
// Qt includes
#include <QtCore/QObject>
#include <QtGui/QUndoStack>
class QWidget;
namespace Plugin
@ -37,6 +37,8 @@ class CSimpleViewer : public QWidget
public:
CSimpleViewer(QWidget *parent = 0);
virtual ~CSimpleViewer() {}
QUndoStack *m_undoStack;
};
class CCoreListener : public Core::ICoreListener

View file

@ -0,0 +1,43 @@
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${LIBXML2_INCLUDE_DIR}
${QT_INCLUDES})
FILE(GLOB SRC *.cpp *.h)
SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
SET(OVQT_PLUG_GEORGES_EDITOR_HDR georges_editor_plugin.h
georges_editor_form.h
georges_dirtree_dialog.h)
SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui
georges_dirtree_form.ui)
SET(OVQT_PLUGIN_GEORGES_EDITOR_RCS georges_editor.qrc)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE)
QT4_ADD_RESOURCES(OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS ${OVQT_PLUGIN_GEORGES_EDITOR_RCS})
QT4_WRAP_CPP(OVQT_PLUG_GEORGES_EDITOR_MOC_SRC ${OVQT_PLUG_GEORGES_EDITOR_HDR})
QT4_WRAP_UI( OVQT_PLUG_GEORGES_EDITOR_UI_HDRS ${OVQT_PLUG_GEORGES_EDITOR_UIS} )
SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_GEORGES_EDITOR_UIS} ${OVQT_PLUGIN_GEORGES_EDITOR_RCS})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS})
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC})
SOURCE_GROUP("Georges Editor Plugin" FILES ${SRC})
SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
ADD_LIBRARY(ovqt_plugin_georges_editor MODULE ${SRC} ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS} ${OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS})
TARGET_LINK_LIBRARIES(ovqt_plugin_georges_editor ovqt_plugin_core nelmisc ${QT_LIBRARIES})
NL_DEFAULT_PROPS(ovqt_plugin_georges_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Georges Editor")
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_georges_editor)
NL_ADD_LIB_SUFFIX(ovqt_plugin_georges_editor)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)

View file

@ -0,0 +1,99 @@
// 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_dirtree_dialog.h"
// Qt includes
#include <QtGui/QWidget>
#include <QSettings>
// NeL includes
//using namespace NLMISC;
namespace Plugin
{
CGeorgesDirTreeDialog::CGeorgesDirTreeDialog(QString ldPath, QWidget *parent)
:QDockWidget(parent), m_ldPath(ldPath)
{
m_ui.setupUi(this);
m_dirModel = new CGeorgesFileSystemModel(m_ldPath);
m_ui.dirTree->setModel(m_dirModel);
if (m_dirModel->isCorrectLDPath())
{
m_dirModel->setRootPath(m_ldPath);
m_ui.dirTree->setRootIndex(m_dirModel->index(m_ldPath));
}
else
{
m_dirModel->setRootPath(QDir::currentPath());
}
m_ui.dirTree->setAnimated(false);
m_ui.dirTree->setIndentation(20);
connect(m_ui.dirTree, SIGNAL(activated(QModelIndex)),
this, SLOT(fileSelected(QModelIndex)));
}
CGeorgesDirTreeDialog::~CGeorgesDirTreeDialog()
{
delete m_dirModel;
}
void CGeorgesDirTreeDialog::fileSelected(QModelIndex index)
{
QString name;
if (index.isValid() && !m_dirModel->isDir(index))
{
Q_EMIT selectedForm(m_dirModel->fileName(index));
}
}
void CGeorgesDirTreeDialog::changeFile(QString file)
{
QModelIndex index = m_dirModel->index(file);
m_ui.dirTree->selectionModel()->select(index,QItemSelectionModel::ClearAndSelect);
m_ui.dirTree->scrollTo(index,QAbstractItemView::PositionAtCenter);
fileSelected(index);
}
void CGeorgesDirTreeDialog::ldPathChanged(QString path)
{
m_ldPath = path;
delete m_dirModel;
m_dirModel = new CGeorgesFileSystemModel(m_ldPath);
m_ui.dirTree->setModel(m_dirModel);
if (m_dirModel->isCorrectLDPath())
{
m_dirModel->setRootPath(m_ldPath);
m_ui.dirTree->setRootIndex(m_dirModel->index(m_ldPath));
}
else
{
m_dirModel->setRootPath(QDir::currentPath());
}
}
} /* namespace NLQT */

View file

@ -0,0 +1,62 @@
// 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_DIRTREE_DIALOG_H
#define GEORGES_DIRTREE_DIALOG_H
// Qt includes
#include <QtGui/QWidget>
// STL includes
// NeL includes
// Project includes
#include "ui_georges_dirtree_form.h"
#include "georges_filesystem_model.h"
namespace Plugin
{
class CGeorgesDirTreeDialog: public QDockWidget
{
Q_OBJECT
public:
CGeorgesDirTreeDialog(QString ldPath, QWidget *parent = 0);
~CGeorgesDirTreeDialog();
void ldPathChanged(QString);
private:
Ui::CGeorgesDirTreeDialog m_ui;
CGeorgesFileSystemModel *m_dirModel;
QString m_ldPath;
Q_SIGNALS:
void selectedForm(const QString);
private Q_SLOTS:
void fileSelected(QModelIndex index);
void changeFile(QString file);
friend class CMainWindow;
}; /* CGEorgesDirTreeDialog */
} /* namespace NLQT */
#endif // GEORGES_DIRTREE_DIALOG_H

View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CGeorgesDirTreeDialog</class>
<widget class="QDockWidget" name="CGeorgesDirTreeDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>111</height>
</size>
</property>
<property name="features">
<set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
</property>
<property name="windowTitle">
<string>Leveldesign Path</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTreeView" name="dirTree">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -0,0 +1,5 @@
<RCC>
<qresource>
<file>images/ic_nel_georges_editor.png</file>
</qresource>
</RCC>

View file

@ -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

View file

@ -0,0 +1,139 @@
// 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 "georges_dirtree_dialog.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_georgesDirTreeDialog(0)
{
m_ui.setupUi(this);
m_undoStack = new QUndoStack(this);
_openAction = new QAction(tr("&Open..."), this);
_openAction->setIcon(QIcon(Core::Constants::ICON_OPEN));
_openAction->setShortcut(QKeySequence::Open);
_openAction->setStatusTip(tr("Open an existing file"));
connect(_openAction, SIGNAL(triggered()), this, SLOT(open()));
_newAction = new QAction(tr("&New..."), this);
_newAction->setIcon(QIcon(Core::Constants::ICON_NEW));
_newAction->setShortcut(QKeySequence::New);
_newAction->setStatusTip(tr("Create a new file"));
connect(_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
_saveAction = new QAction(tr("&Save..."), this);
_saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
_saveAction->setShortcut(QKeySequence::Save);
_saveAction->setStatusTip(tr("Save the current file"));
connect(_saveAction, SIGNAL(triggered()), this, SLOT(save()));
_fileToolBar = addToolBar(tr("&File"));
_fileToolBar->addAction(_openAction);
_fileToolBar->addAction(_newAction);
_fileToolBar->addAction(_saveAction);
readSettings();
// create leveldesign directory tree dockwidget
m_georgesDirTreeDialog = new CGeorgesDirTreeDialog(m_leveldesignPath, this);
addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog);
//m_georgesDirTreeDialog->setVisible(false);
connect(Core::ICore::instance(), SIGNAL(changeSettings()),
this, SLOT(settingsChanged()));
}
GeorgesEditorForm::~GeorgesEditorForm()
{
writeSettings();
}
QUndoStack *GeorgesEditorForm::undoStack() const
{
return m_undoStack;
}
void GeorgesEditorForm::open()
{
// TODO: FileDialog & loadFile();
//QString fileName = QFileDialog::getOpenFileName();
//loadFile(fileName);
}
void GeorgesEditorForm::newFile()
{
}
void GeorgesEditorForm::save()
{
}
void GeorgesEditorForm::readSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
settings->endGroup();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
settings->endGroup();
}
void GeorgesEditorForm::writeSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
settings->endGroup();
settings->sync();
}
void GeorgesEditorForm::settingsChanged()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
QString oldLDPath = m_leveldesignPath;
m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
settings->endGroup();
if (oldLDPath != m_leveldesignPath)
{
m_georgesDirTreeDialog->ldPathChanged(m_leveldesignPath);
}
}
} /* namespace Plugin */

View file

@ -0,0 +1,64 @@
// 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 CGeorgesDirTreeDialog;
class GeorgesEditorForm: public QMainWindow
{
Q_OBJECT
public:
GeorgesEditorForm(QWidget *parent = 0);
~GeorgesEditorForm();
QUndoStack *undoStack() const;
public Q_SLOTS:
void open();
void newFile();
void save();
void settingsChanged();
private:
void readSettings();
void writeSettings();
QUndoStack *m_undoStack;
Ui::GeorgesEditorForm m_ui;
CGeorgesDirTreeDialog *m_georgesDirTreeDialog;
QToolBar *_fileToolBar;
QAction *_openAction;
QAction *_newAction;
QAction *_saveAction;
QString m_leveldesignPath;
}; /* class GeorgesEditorForm */
} /* namespace Plugin */
#endif // GEORGES_EDITOR_FORM_H

View file

@ -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>

View file

@ -0,0 +1,128 @@
// 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("Georges Editor");
}
QString GeorgesEditorPlugin::version() const
{
return "0.2";
}
QString GeorgesEditorPlugin::vendor() const
{
return "aquiles";
}
QString GeorgesEditorPlugin::description() const
{
return tr("Tool to create & edit sheets or forms.");
}
QStringList GeorgesEditorPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
list.append("ObjectViewer"); // TODO
return list;
}
void GeorgesEditorPlugin::addAutoReleasedObject(QObject *obj)
{
m_plugMan->addObject(obj);
m_autoReleaseObjects.prepend(obj);
}
GeorgesEditorContext::GeorgesEditorContext(QObject *parent)
: IContext(parent),
m_georgesEditorForm(0)
{
m_georgesEditorForm = new GeorgesEditorForm();
}
QUndoStack *GeorgesEditorContext::undoStack()
{
return m_georgesEditorForm->undoStack();
}
void GeorgesEditorContext::open()
{
m_georgesEditorForm->open();
}
QWidget *GeorgesEditorContext::widget()
{
return m_georgesEditorForm;
}
}
Q_EXPORT_PLUGIN(Plugin::GeorgesEditorPlugin)

View file

@ -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

View file

@ -0,0 +1,95 @@
// 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/>.
#include "georges_filesystem_model.h"
#include <QApplication>
#include <QStyle>
namespace Plugin
{
CGeorgesFileSystemModel::CGeorgesFileSystemModel(QString ldPath, QObject *parent)
: QFileSystemModel(parent),
m_ldPath(ldPath),
m_correct(false)
{
checkLDPath();
}
CGeorgesFileSystemModel::~CGeorgesFileSystemModel()
{
}
QVariant CGeorgesFileSystemModel::data(const QModelIndex& index, int role) const
{
if (role == Qt::DecorationRole)
{
if (!m_correct)
return QVariant();
if (isDir(index))
return QApplication::style()->standardIcon(QStyle::SP_DirIcon);
}
if (!m_correct && role == Qt::DisplayRole)
{
if (index.parent().isValid())
return QVariant();
return tr("Set a correct leveldesign path ...");
}
return QFileSystemModel::data(index, role);
}
int CGeorgesFileSystemModel::columnCount(const QModelIndex &/*parent*/) const
{
return 1;
}
int CGeorgesFileSystemModel::rowCount(const QModelIndex &parent) const
{
if (!m_correct)
{
if(parent.isValid())
{
return 0;
}
else
{
return qMin(QFileSystemModel::rowCount(parent),1);
}
}
return QFileSystemModel::rowCount(parent);
}
void CGeorgesFileSystemModel::checkLDPath()
{
QFileInfo check1(QString("%1/game_element").arg(m_ldPath));
QFileInfo check2(QString("%1/DFN").arg(m_ldPath));
if (check1.exists() && check2.exists())
{
m_correct = true;
}
else
{
m_correct = false;
}
}
} /* namespace NLQT */
/* end of file */

View file

@ -0,0 +1,50 @@
// 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_FILESYSTEM_MODEL_H
#define GEORGES_FILESYSTEM_MODEL_H
#include <QtGui/QFileSystemModel>
namespace Plugin
{
class CGeorgesFileSystemModel : public QFileSystemModel
{
QString m_ldPath;
public:
CGeorgesFileSystemModel(QString ldPath, QObject *parent = 0);
~CGeorgesFileSystemModel();
int columnCount(const QModelIndex &/*parent*/) const;
int rowCount(const QModelIndex &/*parent*/) const;
QVariant data(const QModelIndex& index, int role) const ;
bool isCorrectLDPath()
{
return m_correct;
}
void checkLDPath();
private:
bool m_correct;
};/* class CGeorgesFileSystemModel */
} /* namespace NLQT */
#endif // GEORGES_FILESYSTEM_MODEL_H

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View file

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View file

@ -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>

View file

@ -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

Some files were not shown because too many files have changed in this diff Show more