Merging default.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 11 years ago
commit 3ff8613205

@ -146,6 +146,7 @@ external_stlport
.svn .svn
thumbs.db thumbs.db
Thumbs.db Thumbs.db
.Sync*
# build # build
code/nel/build/* code/nel/build/*

@ -111,9 +111,11 @@ FIND_PACKAGE(LibXml2 REQUIRED)
FIND_PACKAGE(PNG REQUIRED) FIND_PACKAGE(PNG REQUIRED)
FIND_PACKAGE(Jpeg) FIND_PACKAGE(Jpeg)
IF(WITH_STATIC_LIBXML2)
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
ENDIF(WITH_STATIC_LIBXML2)
IF(WITH_STATIC) IF(WITH_STATIC)
# libxml2 could need winsock2 library # libxml2 could need winsock2 library
SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB}) SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${WINSOCK2_LIB})
# on Mac OS X libxml2 requires iconv and liblzma # on Mac OS X libxml2 requires iconv and liblzma

@ -247,6 +247,11 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
ELSE(WIN32) ELSE(WIN32)
OPTION(WITH_STATIC "With static libraries." OFF) OPTION(WITH_STATIC "With static libraries." OFF)
ENDIF(WIN32) ENDIF(WIN32)
IF (WITH_STATIC)
OPTION(WITH_STATIC_LIBXML2 "With static libxml2" ON )
ELSE(WITH_STATIC)
OPTION(WITH_STATIC_LIBXML2 "With static libxml2" OFF)
ENDIF(WITH_STATIC)
OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF) OPTION(WITH_STATIC_DRIVERS "With static drivers." OFF)
IF(WIN32) IF(WIN32)
OPTION(WITH_EXTERNAL "With provided external." ON ) OPTION(WITH_EXTERNAL "With provided external." ON )

@ -68,7 +68,11 @@ IF(WITH_NEL_SAMPLES)
ADD_SUBDIRECTORY(samples) ADD_SUBDIRECTORY(samples)
ENDIF(WITH_NEL_SAMPLES) ENDIF(WITH_NEL_SAMPLES)
IF(WITH_NEL_TOOLS) # Allow to compile only max plugins without other tools.
FIND_PACKAGE(Squish) IF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN)
IF(WITH_NEL_TOOLS)
FIND_PACKAGE(Squish)
ENDIF(WITH_NEL_TOOLS)
ADD_SUBDIRECTORY(tools) ADD_SUBDIRECTORY(tools)
ENDIF(WITH_NEL_TOOLS) ENDIF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN)

@ -217,6 +217,7 @@ namespace NLGUI
void clear() { setTop(0); } void clear() { setTop(0); }
int getTop(); int getTop();
bool empty() { return getTop() == 0; } bool empty() { return getTop() == 0; }
void pushGlobalTable();
void pushValue(int index); // copie nth element of stack to the top of the stack void pushValue(int index); // copie nth element of stack to the top of the stack
void remove(int index); // remove nth element of stack void remove(int index); // remove nth element of stack
void insert(int index); // insert last element of the stack before the given position void insert(int index); // insert last element of the stack before the given position
@ -301,7 +302,8 @@ namespace NLGUI
/** Helper : Execute a function by name. Lookup for the function is done in the table at the index 'funcTableIndex' /** Helper : Execute a function by name. Lookup for the function is done in the table at the index 'funcTableIndex'
* the behaviour is the same than with call of pcall. * the behaviour is the same than with call of pcall.
*/ */
int pcallByName(const char *functionName, int nargs, int nresults, int funcTableIndex = LUA_GLOBALSINDEX, int errfunc = 0); int pcallByNameGlobal(const char *functionName, int nargs, int nresults, int errfunc = 0);
int pcallByName(const char *functionName, int nargs, int nresults, int funcTableIndex, int errfunc = 0);
// push a C closure (pop n element from the stack and associate with the function) // push a C closure (pop n element from the stack and associate with the function)
void pushCClosure(lua_CFunction function, int n); void pushCClosure(lua_CFunction function, int n);
@ -367,6 +369,7 @@ namespace NLGUI
CLuaState &operator=(const CLuaState &/* other */) { nlassert(0); return *this; } CLuaState &operator=(const CLuaState &/* other */) { nlassert(0); return *this; }
void executeScriptInternal(const std::string &code, const std::string &dbgSrc, int numRet = 0); void executeScriptInternal(const std::string &code, const std::string &dbgSrc, int numRet = 0);
int pcallByNameInternal(const char *functionName, int nargs, int nresults, int errfunc, int initialStackSize);
}; };

@ -42,10 +42,16 @@ inline void CLuaState::checkIndex(int index)
//H_AUTO(Lua_CLuaState_checkIndex) //H_AUTO(Lua_CLuaState_checkIndex)
// NB : more restrictive test that in the documentation there, because // NB : more restrictive test that in the documentation there, because
// we don't expose the check stack function // we don't expose the check stack function
#if LUA_VERSION_NUM >= 502
nlassert( (index!=0 && abs(index) <= getTop())
|| index == LUA_REGISTRYINDEX
);
#else
nlassert( (index!=0 && abs(index) <= getTop()) nlassert( (index!=0 && abs(index) <= getTop())
|| index == LUA_REGISTRYINDEX || index == LUA_REGISTRYINDEX
|| index == LUA_GLOBALSINDEX || index == LUA_GLOBALSINDEX
); );
#endif
} }
//================================================================================ //================================================================================
@ -75,6 +81,18 @@ inline void CLuaState::setTop(int index)
lua_settop(_State, index); lua_settop(_State, index);
} }
//================================================================================
inline void CLuaState::pushGlobalTable()
{
//H_AUTO(Lua_CLuaState_pushGlobalTable)
#if LUA_VERSION_NUM >= 502
lua_pushglobaltable(_State);
#else
checkIndex(LUA_GLOBALSINDEX);
lua_pushvalue(_State, LUA_GLOBALSINDEX);
#endif
}
//================================================================================ //================================================================================
inline void CLuaState::pushValue(int index) inline void CLuaState::pushValue(int index)
{ {
@ -243,7 +261,11 @@ inline size_t CLuaState::strlen(int index)
{ {
//H_AUTO(Lua_CLuaState_strlen) //H_AUTO(Lua_CLuaState_strlen)
checkIndex(index); checkIndex(index);
#if LUA_VERSION_NUM >= 502
return lua_rawlen(_State, index);
#else
return lua_strlen(_State, index); return lua_strlen(_State, index);
#endif
} }
//================================================================================ //================================================================================
@ -342,7 +364,11 @@ inline bool CLuaState::equal(int index1, int index2)
//H_AUTO(Lua_CLuaState_equal) //H_AUTO(Lua_CLuaState_equal)
checkIndex(index1); checkIndex(index1);
checkIndex(index2); checkIndex(index2);
#if LUA_VERSION_NUM >= 502
return lua_compare(_State, index1, index2, LUA_OPEQ) != 0;
#else
return lua_equal(_State, index1, index2) != 0; return lua_equal(_State, index1, index2) != 0;
#endif
} }
//================================================================================ //================================================================================
@ -376,7 +402,11 @@ inline bool CLuaState::lessThan(int index1, int index2)
//H_AUTO(Lua_CLuaState_lessThan) //H_AUTO(Lua_CLuaState_lessThan)
checkIndex(index1); checkIndex(index1);
checkIndex(index2); checkIndex(index2);
#if LUA_VERSION_NUM >= 502
return lua_compare(_State, index1, index2, LUA_OPLT) != 0;
#else
return lua_lessthan(_State, index1, index2) != 0; return lua_lessthan(_State, index1, index2) != 0;
#endif
} }

@ -28,6 +28,21 @@ using namespace NLMISC;
namespace NLGUI namespace NLGUI
{ {
void ifexprufct_forcelink();
// Needed because otherwise GCC and co. omit the code in interface_expr_user_fct.cpp code
// causing the GUI not to work.
// It all happens because no function is called *directly* from that module.
struct LinkTrickster
{
LinkTrickster()
{
ifexprufct_forcelink();
}
};
LinkTrickster linkTrickster;
// Yoyo: Act like a singleton, else registerUserFct may crash. // Yoyo: Act like a singleton, else registerUserFct may crash.
CInterfaceExpr::TUserFctMap *CInterfaceExpr::_UserFct= NULL; CInterfaceExpr::TUserFctMap *CInterfaceExpr::_UserFct= NULL;

@ -361,7 +361,11 @@ namespace NLGUI
rd.Str = &code; rd.Str = &code;
rd.Done = false; rd.Done = false;
int result = lua_load(_State, CHelper::luaChunkReaderFromString, (void *) &rd, dbgSrc.c_str()); int result = lua_load(_State, CHelper::luaChunkReaderFromString, (void *) &rd, dbgSrc.c_str()
#if LUA_VERSION_NUM >= 502
, NULL
#endif
);
if (result !=0) if (result !=0)
{ {
// pop the error code // pop the error code
@ -569,9 +573,17 @@ namespace NLGUI
//H_AUTO(Lua_CLuaState_registerFunc) //H_AUTO(Lua_CLuaState_registerFunc)
nlassert(function); nlassert(function);
CLuaStackChecker lsc(this); CLuaStackChecker lsc(this);
#if LUA_VERSION_NUM >= 502
pushGlobalTable();
#endif
push(name); push(name);
push(function); push(function);
#if LUA_VERSION_NUM >= 502
setTable(-3); // -3 is the pushGlobalTable
pop(1); // pop the pushGlobalTable value (setTable popped the 2 pushes)
#else
setTable(LUA_GLOBALSINDEX); setTable(LUA_GLOBALSINDEX);
#endif
} }
@ -643,13 +655,31 @@ namespace NLGUI
} }
// *************************************************************************** // ***************************************************************************
int CLuaState::pcallByName(const char *functionName, int nargs, int nresults, int funcTableIndex /*=LUA_GLOBALSINDEX*/, int errfunc /*= 0*/) int CLuaState::pcallByNameGlobal(const char *functionName, int nargs, int nresults, int errfunc /*= 0*/)
{
int initialStackSize = getTop();
nlassert(functionName);
#if LUA_VERSION_NUM >= 502
pushGlobalTable();
#else
nlassert(isTable(LUA_GLOBALSINDEX));
pushValue(LUA_GLOBALSINDEX);
#endif
return pcallByNameInternal(functionName, nargs, nresults, errfunc, initialStackSize);
}
int CLuaState::pcallByName(const char *functionName, int nargs, int nresults, int funcTableIndex, int errfunc /*= 0*/)
{ {
//H_AUTO(Lua_CLuaState_pcallByName)
int initialStackSize = getTop(); int initialStackSize = getTop();
nlassert(functionName); nlassert(functionName);
nlassert(isTable(funcTableIndex)); nlassert(isTable(funcTableIndex));
pushValue(funcTableIndex); pushValue(funcTableIndex);
return pcallByNameInternal(functionName, nargs, nresults, errfunc, initialStackSize);
}
int CLuaState::pcallByNameInternal(const char *functionName, int nargs, int nresults, int errfunc /*= 0*/, int initialStackSize)
{
//H_AUTO(Lua_CLuaState_pcallByName)
push(functionName); push(functionName);
getTable(-2); getTable(-2);
remove(-2); // get rid of the table remove(-2); // get rid of the table
@ -782,7 +812,12 @@ namespace NLGUI
int CLuaState::getGCCount() int CLuaState::getGCCount()
{ {
//H_AUTO(Lua_CLuaState_getGCCount) //H_AUTO(Lua_CLuaState_getGCCount)
#if LUA_VERSION_NUM >= 502
// deprecated
return 0;
#else
return lua_getgccount(_State); return lua_getgccount(_State);
#endif
} }
//================================================================================ //================================================================================

@ -474,7 +474,11 @@ namespace NLGUI
CLuaState *luaState = table.getLuaState(); CLuaState *luaState = table.getLuaState();
CLuaStackChecker lsc(luaState); CLuaStackChecker lsc(luaState);
// get pointer to the 'next' function // get pointer to the 'next' function
#if LUA_VERSION_NUM >= 502
luaState->pushGlobalTable();
#else
luaState->pushValue(LUA_GLOBALSINDEX); luaState->pushValue(LUA_GLOBALSINDEX);
#endif
_NextFunction = CLuaObject(*luaState)["next"]; _NextFunction = CLuaObject(*luaState)["next"];
// //
nlassert(luaState); nlassert(luaState);

@ -1,61 +1,75 @@
SUBDIRS(
build_coarse_mesh
build_far_bank
build_smallbank
ig_lighter
zone_dependencies
zone_ig_lighter
zone_lighter
zone_welder
animation_set_builder
anim_builder
build_clod_bank
build_clodtex
build_interface
build_shadow_skin
cluster_viewer
file_info
get_neighbors
ig_add
ig_info
shapes_exporter
tga_cut
tga_resize
zone_check_bind
zone_dump
zviewer)
IF(WIN32)
ADD_SUBDIRECTORY(ig_elevation)
ADD_SUBDIRECTORY(lightmap_optimizer)
IF(WITH_NEL_TOOLS)
SUBDIRS(
build_coarse_mesh
build_far_bank
build_smallbank
ig_lighter
zone_dependencies
zone_ig_lighter
zone_lighter
zone_welder
animation_set_builder
anim_builder
build_clod_bank
build_clodtex
build_interface
build_shadow_skin
cluster_viewer
file_info
get_neighbors
ig_add
ig_info
shapes_exporter
tga_cut
tga_resize
shape2obj
zone_check_bind
zone_dump
zviewer)
ENDIF(WITH_NEL_TOOLS)
# For tools selection of only max plugins
IF(WIN32)
IF(MFC_FOUND) IF(MFC_FOUND)
ADD_SUBDIRECTORY(object_viewer) ADD_SUBDIRECTORY(object_viewer)
ADD_SUBDIRECTORY(object_viewer_exe) IF(WITH_NEL_MAXPLUGIN)
ADD_SUBDIRECTORY(tile_edit) IF(MAXSDK_FOUND)
ADD_SUBDIRECTORY(plugin_max)
ADD_SUBDIRECTORY(ligo)
ENDIF(MAXSDK_FOUND)
ENDIF(WITH_NEL_MAXPLUGIN)
ENDIF(MFC_FOUND) ENDIF(MFC_FOUND)
IF(WITH_NEL_MAXPLUGIN)
IF(MAXSDK_FOUND)
ADD_SUBDIRECTORY(plugin_max)
ADD_SUBDIRECTORY(ligo)
ENDIF(MAXSDK_FOUND)
ENDIF(WITH_NEL_MAXPLUGIN)
ENDIF(WIN32) ENDIF(WIN32)
IF(WITH_QT) IF(WITH_NEL_TOOLS)
ADD_SUBDIRECTORY(tile_edit_qt)
ADD_SUBDIRECTORY(object_viewer_qt)
ADD_SUBDIRECTORY(object_viewer_widget)
ENDIF(WITH_QT)
IF(SQUISH_FOUND) IF(WIN32)
ADD_SUBDIRECTORY(ig_elevation)
ADD_SUBDIRECTORY(lightmap_optimizer)
IF(MFC_FOUND)
ADD_SUBDIRECTORY(object_viewer_exe)
ADD_SUBDIRECTORY(tile_edit)
ENDIF(MFC_FOUND)
ENDIF(WIN32)
IF(WITH_QT)
ADD_SUBDIRECTORY(tile_edit_qt)
ADD_SUBDIRECTORY(object_viewer_qt)
ADD_SUBDIRECTORY(object_viewer_widget)
ENDIF(WITH_QT)
IF(SQUISH_FOUND)
ADD_SUBDIRECTORY(s3tc_compressor_lib) ADD_SUBDIRECTORY(s3tc_compressor_lib)
ADD_SUBDIRECTORY(panoply_maker) ADD_SUBDIRECTORY(panoply_maker)
ADD_SUBDIRECTORY(tga_2_dds) ADD_SUBDIRECTORY(tga_2_dds)
ADD_SUBDIRECTORY(hls_bank_maker) ADD_SUBDIRECTORY(hls_bank_maker)
ENDIF(SQUISH_FOUND) ENDIF(SQUISH_FOUND)
#crash_log_analyser
#shapes_exporter
ENDIF(WITH_NEL_TOOLS)
#crash_log_analyser
#shapes_exporter

@ -1271,7 +1271,8 @@ void CObjectViewer::go ()
// Calc FPS // Calc FPS
static sint64 lastTime=NLMISC::CTime::getPerformanceTime (); static sint64 lastTime=NLMISC::CTime::getPerformanceTime ();
sint64 newTime=NLMISC::CTime::getPerformanceTime (); sint64 newTime=NLMISC::CTime::getPerformanceTime ();
float fps = (float)(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime)); sint64 timeDiff = newTime - lastTime;
float fps = timeDiff > 0 ? (float)(1.0 / NLMISC::CTime::ticksToSecond (newTime-lastTime)) : 1000.0f;
lastTime=newTime; lastTime=newTime;
char msgBar[1024]; char msgBar[1024];
uint nbPlayingSources, nbSources; uint nbPlayingSources, nbSources;

@ -574,36 +574,6 @@ plugin material NelMaterial
CheckBox cbUseSelfIllumColor "Use Color" checked:false align:#right CheckBox cbUseSelfIllumColor "Use Color" checked:false align:#right
) )
on cbTwoSided changed bval do
updateUI false
on cpAmbient changed cval do
updateUI false
on cpDiffuse changed cval do
updateUI false
on spOpacity changed pval do
updateUI false
on cpSpecular changed cval do
updateUI false
on spSpecularLevel changed pval do
updateUI false
on spGlossiness changed pval do
updateUI false
on cpSelfIllumColor changed cval do
updateUI false
on spSelfIllumAmount changed bval do
updateUI false
on cbUseSelfIllumColor changed bval do
updateUI false
Fn updateUI update = Fn updateUI update =
( (
if (version >= 14) then if (version >= 14) then
@ -655,6 +625,36 @@ plugin material NelMaterial
) )
) )
on cbTwoSided changed bval do
updateUI false
on cpAmbient changed cval do
updateUI false
on cpDiffuse changed cval do
updateUI false
on spOpacity changed pval do
updateUI false
on cpSpecular changed cval do
updateUI false
on spSpecularLevel changed pval do
updateUI false
on spGlossiness changed pval do
updateUI false
on cpSelfIllumColor changed cval do
updateUI false
on spSelfIllumAmount changed bval do
updateUI false
on cbUseSelfIllumColor changed bval do
updateUI false
on nelBasicParameters open do on nelBasicParameters open do
( (
updateUI true updateUI true

@ -0,0 +1,9 @@
FILE(GLOB SRC *.cpp)
ADD_EXECUTABLE(shape2obj ${SRC})
TARGET_LINK_LIBRARIES(shape2obj nelmisc nel3d)
NL_DEFAULT_PROPS(shape2obj "NeL, Tools, 3D: shape2obj")
NL_ADD_RUNTIME_FLAGS(shape2obj)
INSTALL(TARGETS shape2obj RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)

@ -66,7 +66,7 @@ const CIndexBuffer *getRdrPassPrimitiveBlock(const CMeshMRMSkinnedGeom *mesh, ui
bool ProcessMeshMRMSkinned(const std::string &filename, IShape *shapeMesh); bool ProcessMeshMRMSkinned(const std::string &filename, IShape *shapeMesh);
bool ProcessMeshMRM(const std::string &filename, IShape *shapeMesh); bool ProcessMeshMRM(const std::string &filename, IShape *shapeMesh);
bool ProcessMesh(const std::string &filename, IShape *shapeMesh); //bool ProcessMesh(const std::string &filename, IShape *shapeMesh);
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
@ -110,7 +110,7 @@ int main(int argc, char* argv[])
if (ProcessMeshMRMSkinned(filename, shapeMesh)) return 0; if (ProcessMeshMRMSkinned(filename, shapeMesh)) return 0;
if (ProcessMeshMRM(filename, shapeMesh)) return 0; if (ProcessMeshMRM(filename, shapeMesh)) return 0;
if (ProcessMesh(filename, shapeMesh)) return 0; // if (ProcessMesh(filename, shapeMesh)) return 0;
return 0; return 0;
} }
@ -519,6 +519,10 @@ bool ProcessMeshMRM(const std::string &filename, IShape *shapeMesh)
return true; return true;
} }
/*
TODO: implement this
bool ProcessMesh(const std::string &filename, IShape *shapeMesh) bool ProcessMesh(const std::string &filename, IShape *shapeMesh)
{ {
CMesh *mesh = dynamic_cast<CMesh*>(shapeMesh); CMesh *mesh = dynamic_cast<CMesh*>(shapeMesh);
@ -666,3 +670,5 @@ bool ProcessMesh(const std::string &filename, IShape *shapeMesh)
return true; return true;
} }
*/

@ -1,28 +1,34 @@
ADD_SUBDIRECTORY(misc)
ADD_SUBDIRECTORY(memory)
# Don't add other subdirectories if only max plugins are selected.
IF(WITH_NEL_TOOLS)
ADD_SUBDIRECTORY(misc)
ADD_SUBDIRECTORY(memory)
ENDIF(WITH_NEL_TOOLS)
# Max plugins are under the 3d directory as well.
IF(WITH_3D) IF(WITH_3D)
ADD_SUBDIRECTORY(3d) ADD_SUBDIRECTORY(3d)
ENDIF(WITH_3D) ENDIF(WITH_3D)
IF(WITH_PACS) # Don't add other subdirectories if only max plugins are selected.
ADD_SUBDIRECTORY(pacs) IF(WITH_NEL_TOOLS)
ENDIF(WITH_PACS) IF(WITH_PACS)
ADD_SUBDIRECTORY(pacs)
IF(WITH_LOGIC) ENDIF(WITH_PACS)
ADD_SUBDIRECTORY(logic)
ENDIF(WITH_LOGIC) IF(WITH_LOGIC)
ADD_SUBDIRECTORY(logic)
IF(WITH_GEORGES) ENDIF(WITH_LOGIC)
ADD_SUBDIRECTORY(georges)
ENDIF(WITH_GEORGES) IF(WITH_GEORGES)
ADD_SUBDIRECTORY(georges)
IF(WITH_SOUND) ENDIF(WITH_GEORGES)
ADD_SUBDIRECTORY(sound)
ENDIF(WITH_SOUND) IF(WITH_SOUND)
ADD_SUBDIRECTORY(sound)
IF(WITH_NEL_TESTS) ENDIF(WITH_SOUND)
ADD_SUBDIRECTORY(nel_unit_test)
ENDIF(WITH_NEL_TESTS) IF(WITH_NEL_TESTS)
ADD_SUBDIRECTORY(nel_unit_test)
#build_gamedata ENDIF(WITH_NEL_TESTS)
ENDIF(WITH_NEL_TOOLS)

@ -46,6 +46,12 @@ IF(WITH_RYZOM_CLIENT)
ENDIF(CURL_STATIC) ENDIF(CURL_STATIC)
ADD_SUBDIRECTORY(client) ADD_SUBDIRECTORY(client)
ELSEIF(WITH_RYZOM_TOOLS)
# Need clientsheets lib for sheets packer tool
ADD_SUBDIRECTORY(client)
ENDIF(WITH_RYZOM_CLIENT) ENDIF(WITH_RYZOM_CLIENT)
IF(WITH_RYZOM_TOOLS) IF(WITH_RYZOM_TOOLS)
@ -53,6 +59,14 @@ IF(WITH_RYZOM_TOOLS)
ENDIF(WITH_RYZOM_TOOLS) ENDIF(WITH_RYZOM_TOOLS)
IF(WITH_RYZOM_SERVER) IF(WITH_RYZOM_SERVER)
FIND_PACKAGE(MySQL REQUIRED) FIND_PACKAGE(MySQL REQUIRED)
ADD_SUBDIRECTORY(server) ADD_SUBDIRECTORY(server)
ELSEIF(WITH_RYZOM_TOOLS)
# Need servershare for build packed collision tool
# Need aishare for build wmap tool
ADD_SUBDIRECTORY(server)
ENDIF(WITH_RYZOM_SERVER) ENDIF(WITH_RYZOM_SERVER)

@ -1,4 +1,9 @@
# Need clientsheets lib for sheets packer tool
ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(src)
IF(WITH_RYZOM_CLIENT)
#ADD_SUBDIRECTORY(data) #ADD_SUBDIRECTORY(data)
#ADD_SUBDIRECTORY(patcher) #ADD_SUBDIRECTORY(patcher)
@ -12,3 +17,5 @@ IF(RYZOM_ETC_PREFIX)
ELSE(RYZOM_ETC_PREFIX) ELSE(RYZOM_ETC_PREFIX)
INSTALL(FILES client_default.cfg DESTINATION etc/ryzom) INSTALL(FILES client_default.cfg DESTINATION etc/ryzom)
ENDIF(RYZOM_ETC_PREFIX) ENDIF(RYZOM_ETC_PREFIX)
ENDIF(WITH_RYZOM_CLIENT)

@ -126,24 +126,24 @@ AutoEquipTool = 1;
// *** LANDSCAPE // *** LANDSCAPE
LandscapeTileNear = 150.000000; LandscapeTileNear = 50.000000;
LandscapeTileNear_min = 20.000000; LandscapeTileNear_min = 20.000000;
LandscapeTileNear_max = 250.000000; LandscapeTileNear_max = 100.000000;
LandscapeTileNear_step = 10.0; LandscapeTileNear_step = 10.0;
LandscapeTileNear_ps0 = 20.0; LandscapeTileNear_ps0 = 20.0;
LandscapeTileNear_ps1 = 100.0; LandscapeTileNear_ps1 = 40.0;
LandscapeTileNear_ps2 = 150.0; LandscapeTileNear_ps2 = 50.0;
LandscapeTileNear_ps3 = 200.0; LandscapeTileNear_ps3 = 80.0;
// NB: threshold is inverted ULandscape::setThreshold(), to be more intelligible // NB: threshold is inverted ULandscape::setThreshold(), to be more intelligible
LandscapeThreshold = 2000.0; LandscapeThreshold = 1000.0;
LandscapeThreshold_min = 100.0; // Low quality => 0.01 threshold LandscapeThreshold_min = 100.0; // Low quality => 0.01 threshold
LandscapeThreshold_max = 4000.0; // High quality => 0.0005 threshold LandscapeThreshold_max = 2000.0; // High quality => 0.0005 threshold
LandscapeThreshold_step = 100.0; LandscapeThreshold_step = 100.0;
LandscapeThreshold_ps0 = 100.0; LandscapeThreshold_ps0 = 100.0;
LandscapeThreshold_ps1 = 1000.0; LandscapeThreshold_ps1 = 500.0;
LandscapeThreshold_ps2 = 2000.0; LandscapeThreshold_ps2 = 1000.0;
LandscapeThreshold_ps3 = 3000.0; LandscapeThreshold_ps3 = 2000.0;
Vision = 500.000000; Vision = 500.000000;
Vision_min = 200.000000; Vision_min = 200.000000;

@ -126,24 +126,24 @@ AutoEquipTool = 1;
// *** LANDSCAPE // *** LANDSCAPE
LandscapeTileNear = 150.000000; LandscapeTileNear = 50.000000;
LandscapeTileNear_min = 20.000000; LandscapeTileNear_min = 20.000000;
LandscapeTileNear_max = 250.000000; LandscapeTileNear_max = 100.000000;
LandscapeTileNear_step = 10.0; LandscapeTileNear_step = 10.0;
LandscapeTileNear_ps0 = 20.0; LandscapeTileNear_ps0 = 20.0;
LandscapeTileNear_ps1 = 100.0; LandscapeTileNear_ps1 = 40.0;
LandscapeTileNear_ps2 = 150.0; LandscapeTileNear_ps2 = 50.0;
LandscapeTileNear_ps3 = 200.0; LandscapeTileNear_ps3 = 80.0;
// NB: threshold is inverted ULandscape::setThreshold(), to be more intelligible // NB: threshold is inverted ULandscape::setThreshold(), to be more intelligible
LandscapeThreshold = 2000.0; LandscapeThreshold = 1000.0;
LandscapeThreshold_min = 100.0; // Low quality => 0.01 threshold LandscapeThreshold_min = 100.0; // Low quality => 0.01 threshold
LandscapeThreshold_max = 4000.0; // High quality => 0.0005 threshold LandscapeThreshold_max = 2000.0; // High quality => 0.0005 threshold
LandscapeThreshold_step = 100.0; LandscapeThreshold_step = 100.0;
LandscapeThreshold_ps0 = 100.0; LandscapeThreshold_ps0 = 100.0;
LandscapeThreshold_ps1 = 1000.0; LandscapeThreshold_ps1 = 500.0;
LandscapeThreshold_ps2 = 2000.0; LandscapeThreshold_ps2 = 1000.0;
LandscapeThreshold_ps3 = 3000.0; LandscapeThreshold_ps3 = 2000.0;
Vision = 500.000000; Vision = 500.000000;
Vision_min = 200.000000; Vision_min = 200.000000;

@ -84,7 +84,7 @@ function bgdownloader:setPatchProgress(progress)
self:getPrioCB().active = true self:getPrioCB().active = true
local progressPercentText = string.format("%d%%", 100 * progress) local progressPercentText = string.format("%d%%", 100 * progress)
local progressPostfix = math.mod(os.time(), 3) local progressPostfix = math.fmod(os.time(), 3)
local progressDate = nltime.getLocalTime() / 500 local progressDate = nltime.getLocalTime() / 500
local colValue = math.floor(230 + 24 * math.sin(progressDate)) local colValue = math.floor(230 + 24 * math.sin(progressDate))
local color = string.format("%d %d %d %d", colValue, colValue, colValue, 255) local color = string.format("%d %d %d %d", colValue, colValue, colValue, 255)

@ -521,7 +521,7 @@ function GameR2Loading:validateLoading()
local filename = GameR2Loading.CurrentFile local filename = GameR2Loading.CurrentFile
if string.find(filename, '\.r2', -3) == nil then if string.find(filename, '.r2', -3) == nil then
messageBox(i18n.get("uiR2EDLoadScenario_InvalidFileName")) messageBox(i18n.get("uiR2EDLoadScenario_InvalidFileName"))
return return
end end

@ -131,7 +131,7 @@ local function levelToForceRegion(level)
end end
local function levelToLevelForce(level) local function levelToLevelForce(level)
return math.floor(math.mod(level, 50) * 5 / 50) + 1 return math.floor(math.fmod(level, 50) * 5 / 50) + 1
end end

File diff suppressed because it is too large Load Diff

@ -135,7 +135,7 @@ end
--function outgame:setPatchProgress(progress) --function outgame:setPatchProgress(progress)
-- --debugInfo("*** 3 ***") -- --debugInfo("*** 3 ***")
-- local progressPercentText = string.format("%d%%", 100 * progress) -- local progressPercentText = string.format("%d%%", 100 * progress)
-- local progressPostfix = math.mod(os.time(), 3) -- local progressPostfix = math.fmod(os.time(), 3)
-- --debugInfo("Patch in progress : " .. tostring(progress)) -- --debugInfo("Patch in progress : " .. tostring(progress))
-- local progressDate = nltime.getLocalTime() / 500 -- local progressDate = nltime.getLocalTime() / 500
-- local colValue = math.floor(230 + 24 * math.sin(progressDate)) -- local colValue = math.floor(230 + 24 * math.sin(progressDate))

@ -56,7 +56,7 @@ function game:outpostAdjustHour(uiLocal, prop)
local h = runExpr(prop); local h = runExpr(prop);
-- add time zone and clamp hour -- add time zone and clamp hour
h = math.mod(h + tz + 24, 24); h = math.fmod(h + tz + 24, 24);
uiGroup[uiLocal].uc_hardtext = string.format('%02d:00', h); uiGroup[uiLocal].uc_hardtext = string.format('%02d:00', h);
end end
@ -288,8 +288,8 @@ function game:outpostActiveDefenderHourButton()
local timeRangeDef= getDbProp(path .. ':TIME_RANGE_DEF'); local timeRangeDef= getDbProp(path .. ':TIME_RANGE_DEF');
local timeRangeDefWanted= getDbProp(path .. ':TIME_RANGE_DEF_WANTED'); local timeRangeDefWanted= getDbProp(path .. ':TIME_RANGE_DEF_WANTED');
timeRangeDef= secondsSince1970ToHour( timeRangeDef ); timeRangeDef= secondsSince1970ToHour( timeRangeDef );
timeRangeDef= math.mod(timeRangeDef+24, 24); timeRangeDef= math.fmod(timeRangeDef+24, 24);
timeRangeDefWanted= math.mod(timeRangeDefWanted+24, 24); timeRangeDefWanted= math.fmod(timeRangeDefWanted+24, 24);
-- if time required is the one obtained, or if we are in peace -- if time required is the one obtained, or if we are in peace
if( timeRangeDef == timeRangeDefWanted or status<=game.OutpostEnums.Peace ) then if( timeRangeDef == timeRangeDefWanted or status<=game.OutpostEnums.Peace ) then
@ -323,8 +323,8 @@ function game:outpostActiveAttackerHourButton()
local timeRangeAtt= getDbProp('UI:TEMP:OUTPOST:DECLARE_WAR_ACK_TIME_RANGE_ATT'); local timeRangeAtt= getDbProp('UI:TEMP:OUTPOST:DECLARE_WAR_ACK_TIME_RANGE_ATT');
local timeRangeAttWanted= getDbProp('UI:TEMP:OUTPOST:DECLARE_WAR_ATTACK_PERIOD'); local timeRangeAttWanted= getDbProp('UI:TEMP:OUTPOST:DECLARE_WAR_ATTACK_PERIOD');
timeRangeAtt= secondsSince1970ToHour( timeRangeAtt ); timeRangeAtt= secondsSince1970ToHour( timeRangeAtt );
timeRangeAtt= math.mod(timeRangeAtt+24, 24); timeRangeAtt= math.fmod(timeRangeAtt+24, 24);
timeRangeAttWanted= math.mod(timeRangeAttWanted+24, 24); timeRangeAttWanted= math.fmod(timeRangeAttWanted+24, 24);
-- if time required is the one obtained -- if time required is the one obtained
if( timeRangeAtt == timeRangeAttWanted ) then if( timeRangeAtt == timeRangeAttWanted ) then

@ -803,8 +803,8 @@ end
function game:timeInSecondsToReadableTime(regenTime) function game:timeInSecondsToReadableTime(regenTime)
local seconds = math.mod(regenTime, 60) local seconds = math.fmod(regenTime, 60)
local minutes = math.mod(math.floor(regenTime / 60), 60) local minutes = math.fmod(math.floor(regenTime / 60), 60)
local hours = math.floor(regenTime / 3600) local hours = math.floor(regenTime / 3600)
local result = "" local result = ""
if seconds > 0 then result = concatUCString(tostring(seconds), i18n.get("uittSecondsShort")) end if seconds > 0 then result = concatUCString(tostring(seconds), i18n.get("uittSecondsShort")) end

@ -904,7 +904,7 @@ function RingAccessPoint:onDraw()
self.LastRefreshTime = nltime.getLocalTime() / 1000 self.LastRefreshTime = nltime.getLocalTime() / 1000
--self:getWindow():find("refreshText").active = false --self:getWindow():find("refreshText").active = false
else else
local waitText = i18n.get("uiRAP_WaitMsg" .. math.mod(os.time(), 3)) local waitText = i18n.get("uiRAP_WaitMsg" .. math.fmod(os.time(), 3))
self:setInfoMessage(waitText) self:setInfoMessage(waitText)
--local refreshText = self:getWindow():find("refreshText") --local refreshText = self:getWindow():find("refreshText")
--if not self.ListReceived then --if not self.ListReceived then

@ -1,10 +1,15 @@
# Need clientsheets lib for sheets packer tool
ADD_SUBDIRECTORY(client_sheets)
IF(WITH_RYZOM_CLIENT)
# These are Windows/MFC apps # These are Windows/MFC apps
IF(WIN32) IF(WIN32)
# ADD_SUBDIRECTORY(bug_report) # ADD_SUBDIRECTORY(bug_report)
SET(SEVENZIP_LIBRARY "ryzom_sevenzip") SET(SEVENZIP_LIBRARY "ryzom_sevenzip")
ENDIF(WIN32) ENDIF(WIN32)
ADD_SUBDIRECTORY(client_sheets)
ADD_SUBDIRECTORY(seven_zip) ADD_SUBDIRECTORY(seven_zip)
FILE(GLOB CFG ../*.cfg ../*.cfg.in) FILE(GLOB CFG ../*.cfg ../*.cfg.in)
@ -124,3 +129,5 @@ IF(WITH_PCH)
ENDIF(WITH_PCH) ENDIF(WITH_PCH)
INSTALL(TARGETS ryzom_client RUNTIME DESTINATION ${RYZOM_GAMES_PREFIX} COMPONENT client BUNDLE DESTINATION /Applications) INSTALL(TARGETS ryzom_client RUNTIME DESTINATION ${RYZOM_GAMES_PREFIX} COMPONENT client BUNDLE DESTINATION /Applications)
ENDIF(WITH_RYZOM_CLIENT)

@ -5164,7 +5164,7 @@ NLMISC_COMMAND(luaObject, "Dump the content of a lua object", "<table name> [max
CLuaIHMRyzom::debugInfo(e.what()); CLuaIHMRyzom::debugInfo(e.what());
return false; return false;
} }
luaState->pushValue(LUA_GLOBALSINDEX); luaState->pushGlobalTable();
CLuaObject env; CLuaObject env;
env.pop(*luaState); env.pop(*luaState);
uint maxDepth; uint maxDepth;

@ -108,7 +108,7 @@ ucstring CControlSheetTooltipInfoWaiter::infoValidated(CDBCtrlSheet* ctrlSheet,
CLuaStackRestorer lsr(ls, 0); CLuaStackRestorer lsr(ls, 0);
CLuaIHM::pushReflectableOnStack(*ls, (CReflectableRefPtrTarget *)ctrlSheet); CLuaIHM::pushReflectableOnStack(*ls, (CReflectableRefPtrTarget *)ctrlSheet);
ls->pushValue(LUA_GLOBALSINDEX); ls->pushGlobalTable();
CLuaObject game(*ls); CLuaObject game(*ls);
game = game["game"]; game = game["game"];
game.callMethodByNameNoThrow(luaMethodName.c_str(), 1, 1); game.callMethodByNameNoThrow(luaMethodName.c_str(), 1, 1);
@ -3170,7 +3170,7 @@ void CDBCtrlSheet::getContextHelp(ucstring &help) const
_PhraseAdapter = new CSPhraseComAdpater; _PhraseAdapter = new CSPhraseComAdpater;
_PhraseAdapter->Phrase = pPM->getPhrase(phraseId); _PhraseAdapter->Phrase = pPM->getPhrase(phraseId);
CLuaIHM::pushReflectableOnStack(*ls, _PhraseAdapter); CLuaIHM::pushReflectableOnStack(*ls, _PhraseAdapter);
ls->pushValue(LUA_GLOBALSINDEX); ls->pushGlobalTable();
CLuaObject game(*ls); CLuaObject game(*ls);
game = game["game"]; game = game["game"];
game.callMethodByNameNoThrow("updatePhraseTooltip", 1, 1); game.callMethodByNameNoThrow("updatePhraseTooltip", 1, 1);

@ -187,9 +187,11 @@ static DECLARE_INTERFACE_USER_FCT(lua)
// *** clear return value // *** clear return value
const std::string retId= "__ui_internal_ret_"; const std::string retId= "__ui_internal_ret_";
CLuaStackChecker lsc(&ls); CLuaStackChecker lsc(&ls);
ls.pushGlobalTable();
ls.push(retId); ls.push(retId);
ls.pushNil(); ls.pushNil();
ls.setTable(LUA_GLOBALSINDEX); ls.setTable(-3); //pop pop
ls.pop();
// *** execute script // *** execute script
@ -201,8 +203,10 @@ static DECLARE_INTERFACE_USER_FCT(lua)
// *** retrieve and convert return value // *** retrieve and convert return value
ls.pushGlobalTable();
ls.push(retId); ls.push(retId);
ls.getTable(LUA_GLOBALSINDEX); ls.getTable(-2);
ls.remove(-2);
bool ok= false; bool ok= false;
sint type= ls.type(); sint type= ls.type();
if (type==LUA_TBOOLEAN) if (type==LUA_TBOOLEAN)
@ -370,7 +374,7 @@ void CLuaIHMRyzom::RegisterRyzomFunctions( NLGUI::CLuaState &ls )
ls.registerFunc("SNode", CUICtor::SNode); ls.registerFunc("SNode", CUICtor::SNode);
// *** Register the metatable for access to client.cfg (nb nico this may be more general later -> access to any config file ...) // *** Register the metatable for access to client.cfg (nb nico this may be more general later -> access to any config file ...)
ls.pushValue(LUA_GLOBALSINDEX); ls.pushGlobalTable();
CLuaObject globals(ls); CLuaObject globals(ls);
CLuaObject clientCfg = globals.newTable("config"); CLuaObject clientCfg = globals.newTable("config");
CLuaObject mt = globals.newTable("__cfmt"); CLuaObject mt = globals.newTable("__cfmt");

@ -3235,7 +3235,7 @@ class CHandlerDebugUiDumpElementUnderMouse : public IActionHandler
if (!lua) return; if (!lua) return;
CLuaStackRestorer lsr(lua, 0); CLuaStackRestorer lsr(lua, 0);
CLuaIHM::pushUIOnStack(*lua, HighlightedDebugUI); CLuaIHM::pushUIOnStack(*lua, HighlightedDebugUI);
lua->pushValue(LUA_GLOBALSINDEX); lua->pushGlobalTable();
CLuaObject env(*lua); CLuaObject env(*lua);
env["inspect"].callNoThrow(1, 0); env["inspect"].callNoThrow(1, 0);
} }

@ -77,7 +77,7 @@ CComLuaModule::CComLuaModule(CDynamicMapClient* client, lua_State *luaState /*=
#ifdef LUA_NEVRAX_VERSION #ifdef LUA_NEVRAX_VERSION
_LuaState = lua_open(NULL, NULL); _LuaState = lua_open(NULL, NULL);
#else #else
_LuaState = lua_open(); _LuaState = luaL_newstate();
#endif #endif
_LuaOwnerShip = false; _LuaOwnerShip = false;
luaopen_base(_LuaState); luaopen_base(_LuaState);
@ -105,7 +105,7 @@ CComLuaModule::CComLuaModule(CDynamicMapClient* client, lua_State *luaState /*=
void CComLuaModule::initLuaLib() void CComLuaModule::initLuaLib()
{ {
//H_AUTO(R2_CComLuaModule_initLuaLib) //H_AUTO(R2_CComLuaModule_initLuaLib)
const luaL_reg methods[] = const luaL_Reg methods[] =
{ {
{"updateScenario", CComLuaModule::luaUpdateScenario}, {"updateScenario", CComLuaModule::luaUpdateScenario},
{"requestUpdateRtScenario", CComLuaModule::luaRequestUpdateRtScenario}, {"requestUpdateRtScenario", CComLuaModule::luaRequestUpdateRtScenario},
@ -237,7 +237,12 @@ void CComLuaModule::initLuaLib()
}; };
int initialStackSize = lua_gettop(_LuaState); int initialStackSize = lua_gettop(_LuaState);
#if LUA_VERSION_NUM >= 502
luaL_newlib(_LuaState, methods);
lua_setglobal(_LuaState, R2_LUA_PATH);
#else
luaL_openlib(_LuaState, R2_LUA_PATH, methods, 0); luaL_openlib(_LuaState, R2_LUA_PATH, methods, 0);
#endif
lua_settop(_LuaState, initialStackSize); lua_settop(_LuaState, initialStackSize);
} }
@ -1046,7 +1051,11 @@ void CComLuaModule::setObjectToLua(lua_State* state, CObject* object)
{ {
int initialStackSize = lua_gettop(state); int initialStackSize = lua_gettop(state);
#if LUA_VERSION_NUM >= 502
lua_pushglobaltable(state); // _G
#else
lua_pushvalue(state, LUA_GLOBALSINDEX); // _G lua_pushvalue(state, LUA_GLOBALSINDEX); // _G
#endif
lua_pushstring(state, "r2"); // _G, "r2" lua_pushstring(state, "r2"); // _G, "r2"
lua_gettable(state, -2); // G, r2 lua_gettable(state, -2); // G, r2
@ -1106,6 +1115,8 @@ void CComLuaModule::setObjectToLua(lua_State* state, CObject* object)
} }
} }
#if 0
// okay!
if (0) if (0)
{ {
@ -1128,6 +1139,7 @@ void CComLuaModule::setObjectToLua(lua_State* state, CObject* object)
} }
} }
} }
#endif
} }
else else
{ {
@ -1147,8 +1159,11 @@ CObject* CComLuaModule::getObjectFromLua(lua_State* state, sint idx)
{ {
if (lua_getmetatable(state, -1)) if (lua_getmetatable(state, -1))
{ {
#if LUA_VERSION_NUM >= 502
lua_pushglobaltable(state); // obj, mt, _G
#else
lua_pushvalue(state, LUA_GLOBALSINDEX); // obj, mt, _G lua_pushvalue(state, LUA_GLOBALSINDEX); // obj, mt, _G
#endif
lua_pushstring(state, "r2"); // obj, mt, _G, "r2" lua_pushstring(state, "r2"); // obj, mt, _G, "r2"

@ -2613,7 +2613,7 @@ void CEditor::init(TMode initialMode, TAccessMode accessMode)
} }
// //
CLuaStackChecker lsc(&getLua()); CLuaStackChecker lsc(&getLua());
getLua().pushValue(LUA_GLOBALSINDEX); getLua().pushGlobalTable();
_Globals.pop(getLua()); _Globals.pop(getLua());
getLua().pushValue(LUA_REGISTRYINDEX); getLua().pushValue(LUA_REGISTRYINDEX);
_Registry.pop(getLua()); _Registry.pop(getLua());
@ -3956,9 +3956,11 @@ void CEditor::release()
// clear the environment // clear the environment
if (CLuaManager::getInstance().getLuaState()) if (CLuaManager::getInstance().getLuaState())
{ {
getLua().pushGlobalTable();
getLua().push(R2_LUA_PATH); getLua().push(R2_LUA_PATH);
getLua().pushNil(); getLua().pushNil();
getLua().setTable(LUA_GLOBALSINDEX); getLua().setTable(-3); // pop pop
getLua().pop();
_Globals.release(); _Globals.release();
_Registry.release(); _Registry.release();
_ObjectProjectionMetatable.release(); // AJM _ObjectProjectionMetatable.release(); // AJM

@ -51,7 +51,7 @@ void CSessionBrowserImpl::init(CLuaState *ls)
{ {
nlassert(ls); nlassert(ls);
_Lua = ls; _Lua = ls;
_Lua->pushValue(LUA_GLOBALSINDEX); _Lua->pushGlobalTable();
CLuaObject game(*_Lua); CLuaObject game(*_Lua);
game = game["game"]; game = game["game"];
game.setValue("getRingSessionList", luaGetRingSessionList); game.setValue("getRingSessionList", luaGetRingSessionList);
@ -759,7 +759,7 @@ void CSessionBrowserImpl::callRingAccessPointMethod(const char *name, int numArg
nlassert(name); nlassert(name);
{ {
CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult); CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult);
_Lua->pushValue(LUA_GLOBALSINDEX); _Lua->pushGlobalTable();
CLuaObject rap(*_Lua); CLuaObject rap(*_Lua);
rap = rap["RingAccessPoint"]; rap = rap["RingAccessPoint"];
rap.callMethodByNameNoThrow(name, numArg, numResult); rap.callMethodByNameNoThrow(name, numArg, numResult);
@ -774,7 +774,7 @@ void CSessionBrowserImpl::callRingCharTrackingMethod(const char *name, int numAr
nlassert(name); nlassert(name);
{ {
CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult); CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult);
_Lua->pushValue(LUA_GLOBALSINDEX); _Lua->pushGlobalTable();
CLuaObject rap(*_Lua); CLuaObject rap(*_Lua);
rap = rap["CharTracking"]; rap = rap["CharTracking"];
rap.callMethodByNameNoThrow(name, numArg, numResult); rap.callMethodByNameNoThrow(name, numArg, numResult);
@ -789,7 +789,7 @@ void CSessionBrowserImpl::callRingPlayerInfoMethod(const char *name, int numArg,
nlassert(name); nlassert(name);
{ {
CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult); CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult);
_Lua->pushValue(LUA_GLOBALSINDEX); _Lua->pushGlobalTable();
CLuaObject rap(*_Lua); CLuaObject rap(*_Lua);
rap = rap["RingPlayerInfo"]; rap = rap["RingPlayerInfo"];
rap.callMethodByNameNoThrow(name, numArg, numResult); rap.callMethodByNameNoThrow(name, numArg, numResult);
@ -804,7 +804,7 @@ void CSessionBrowserImpl::callScenarioScoresMethod(const char *name, int numArg,
nlassert(name); nlassert(name);
{ {
CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult); CLuaStackRestorer lsr(_Lua, _Lua->getTop() + numResult);
_Lua->pushValue(LUA_GLOBALSINDEX); _Lua->pushGlobalTable();
CLuaObject rap(*_Lua); CLuaObject rap(*_Lua);
rap = rap["ScenarioScores"]; rap = rap["ScenarioScores"];
rap.callMethodByNameNoThrow(name, numArg, numResult); rap.callMethodByNameNoThrow(name, numArg, numResult);

@ -1,7 +1,14 @@
# Supporting modules and libraries. # Supporting modules and libraries.
ADD_SUBDIRECTORY(admin_modules) # Need servershare for build packed collision tool
# Need aishare for build wmap tool
ADD_SUBDIRECTORY(server_share) ADD_SUBDIRECTORY(server_share)
ADD_SUBDIRECTORY(ai_share) ADD_SUBDIRECTORY(ai_share)
IF(WITH_RYZOM_SERVER)
# Supporting modules and libraries.
ADD_SUBDIRECTORY(admin_modules)
ADD_SUBDIRECTORY(gameplay_module_lib) ADD_SUBDIRECTORY(gameplay_module_lib)
ADD_SUBDIRECTORY(pd_lib) ADD_SUBDIRECTORY(pd_lib)
@ -40,3 +47,5 @@ ADD_SUBDIRECTORY(general_utilities_service)
#sabrina #sabrina
#simulation_service #simulation_service
#testing_tool_service #testing_tool_service
ENDIF(WITH_RYZOM_SERVER)

@ -9,15 +9,13 @@ ADD_SUBDIRECTORY(leveldesign)
ADD_SUBDIRECTORY(patch_gen) ADD_SUBDIRECTORY(patch_gen)
ADD_SUBDIRECTORY(pdr_util) ADD_SUBDIRECTORY(pdr_util)
ADD_SUBDIRECTORY(stats_scan) ADD_SUBDIRECTORY(stats_scan)
ADD_SUBDIRECTORY(sheets_packer)
IF(WITH_RYZOM_CLIENT) IF(WITH_RYZOM_CLIENT)
ADD_SUBDIRECTORY(sheets_packer)
ADD_SUBDIRECTORY(client) ADD_SUBDIRECTORY(client)
ENDIF(WITH_RYZOM_CLIENT) ENDIF(WITH_RYZOM_CLIENT)
IF(WITH_RYZOM_SERVER) ADD_SUBDIRECTORY(server)
ADD_SUBDIRECTORY(server)
ENDIF(WITH_RYZOM_SERVER)
# Old stuff that doesn't compile anymore. # Old stuff that doesn't compile anymore.
#ADD_SUBDIRECTORY(occ2huff) #ADD_SUBDIRECTORY(occ2huff)

@ -1,57 +1,57 @@
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${QT_INCLUDES} ) ${QT_INCLUDES} )
FILE( GLOB SRC *.cpp *.h ) FILE( GLOB SRC *.cpp *.h )
SET( CLIENT_CONFIG_HDR SET( CLIENT_CONFIG_HDR
client_config_dialog.h client_config_dialog.h
display_settings_advanced_widget.h display_settings_advanced_widget.h
display_settings_details_widget.h display_settings_details_widget.h
display_settings_widget.h display_settings_widget.h
general_settings_widget.h general_settings_widget.h
sound_settings_widget.h sound_settings_widget.h
sys_info_d3d_widget.h sys_info_d3d_widget.h
sys_info_opengl_widget.h sys_info_opengl_widget.h
sys_info_widget.h sys_info_widget.h
widget_base.h widget_base.h
) )
SET( CLIENT_CONFIG_UIS SET( CLIENT_CONFIG_UIS
client_config_dialog.ui client_config_dialog.ui
display_settings_advanced_widget.ui display_settings_advanced_widget.ui
display_settings_details_widget.ui display_settings_details_widget.ui
display_settings_widget.ui display_settings_widget.ui
general_settings_widget.ui general_settings_widget.ui
sound_settings_widget.ui sound_settings_widget.ui
sys_info_d3d_widget.ui sys_info_d3d_widget.ui
sys_info_opengl_widget.ui sys_info_opengl_widget.ui
sys_info_widget.ui sys_info_widget.ui
) )
SET( CLIENT_CONFIG_TRANS SET( CLIENT_CONFIG_TRANS
translations/ryzom_configuration_en.ts translations/ryzom_configuration_en.ts
translations/ryzom_configuration_hu.ts translations/ryzom_configuration_hu.ts
) )
CONFIGURE_FILE( translations/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY ) CONFIGURE_FILE( translations/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY )
SET( CLIENT_CONFIG_RCS resources.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc ) SET( CLIENT_CONFIG_RCS resources.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc )
SET( QT_USE_QTGUI TRUE ) SET( QT_USE_QTGUI TRUE )
SET( QT_USE_QTOPENGL TRUE ) SET( QT_USE_QTOPENGL TRUE )
SET( QT_USE_QTCORE TRUE ) SET( QT_USE_QTCORE TRUE )
QT4_ADD_TRANSLATION( CLIENT_CONFIG_QM ${CLIENT_CONFIG_TRANS} ) QT4_ADD_TRANSLATION( CLIENT_CONFIG_QM ${CLIENT_CONFIG_TRANS} )
QT4_ADD_RESOURCES( CLIENT_CONFIG_RC_SRCS ${CLIENT_CONFIG_RCS} ) QT4_ADD_RESOURCES( CLIENT_CONFIG_RC_SRCS ${CLIENT_CONFIG_RCS} )
QT4_WRAP_CPP( CLIENT_CONFIG_MOC_SRC ${CLIENT_CONFIG_HDR} ) QT4_WRAP_CPP( CLIENT_CONFIG_MOC_SRC ${CLIENT_CONFIG_HDR} )
QT4_WRAP_UI( CLIENT_CONFIG_UI_HDRS ${CLIENT_CONFIG_UIS} ) QT4_WRAP_UI( CLIENT_CONFIG_UI_HDRS ${CLIENT_CONFIG_UIS} )
SOURCE_GROUP( "Resources" FILES ${CLIENT_CONFIG_RCS} ) SOURCE_GROUP( "Resources" FILES ${CLIENT_CONFIG_RCS} )
SOURCE_GROUP( "Forms" FILES ${CLIENT_CONFIG_UIS} ) SOURCE_GROUP( "Forms" FILES ${CLIENT_CONFIG_UIS} )
SOURCE_GROUP( "Generated Files" FILES ${CLIENT_CONFIG_UI_HDRS} ${CLIENT_CONFIG_MOC_SRC} ) SOURCE_GROUP( "Generated Files" FILES ${CLIENT_CONFIG_UI_HDRS} ${CLIENT_CONFIG_MOC_SRC} )
SOURCE_GROUP( "Translation Files" FILES ${CLIENT_CONFIG_TRANS} ) SOURCE_GROUP( "Translation Files" FILES ${CLIENT_CONFIG_TRANS} )
ADD_DEFINITIONS( ${QT_DEFINITIONS} ) ADD_DEFINITIONS( ${QT_DEFINITIONS} )
ADD_EXECUTABLE( ryzom_configuration_qt WIN32 MACOSX_BUNDLE ${SRC} ${CLIENT_CONFIG_MOC_SRC} ${CLIENT_CONFIG_UI_HDRS} ${CLIENT_CONFIG_RC_SRCS} ${CLIENT_CONFIG_TRANS} ) ADD_EXECUTABLE( ryzom_configuration_qt WIN32 MACOSX_BUNDLE ${SRC} ${CLIENT_CONFIG_MOC_SRC} ${CLIENT_CONFIG_UI_HDRS} ${CLIENT_CONFIG_RC_SRCS} ${CLIENT_CONFIG_TRANS} )
NL_DEFAULT_PROPS( ryzom_configuration_qt "Ryzom, Tools: Ryzom Configuration Qt" ) NL_DEFAULT_PROPS( ryzom_configuration_qt "Ryzom, Tools: Ryzom Configuration Qt" )
NL_ADD_RUNTIME_FLAGS( ryzom_configuration_qt ) NL_ADD_RUNTIME_FLAGS( ryzom_configuration_qt )
NL_ADD_LIB_SUFFIX( ryzom_configuration_qt ) NL_ADD_LIB_SUFFIX( ryzom_configuration_qt )
TARGET_LINK_LIBRARIES( ryzom_configuration_qt nelmisc nel3d ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY} ) TARGET_LINK_LIBRARIES( ryzom_configuration_qt nelmisc nel3d ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY} )
INSTALL( TARGETS ryzom_configuration_qt RUNTIME DESTINATION games COMPONENT client BUNDLE DESTINATION /Applications ) INSTALL( TARGETS ryzom_configuration_qt RUNTIME DESTINATION games COMPONENT client BUNDLE DESTINATION /Applications )

@ -1,259 +1,259 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "client_config_dialog.h" #include "client_config_dialog.h"
#include "general_settings_widget.h" #include "general_settings_widget.h"
#include "display_settings_widget.h" #include "display_settings_widget.h"
#include "display_settings_details_widget.h" #include "display_settings_details_widget.h"
#include "display_settings_advanced_widget.h" #include "display_settings_advanced_widget.h"
#include "sound_settings_widget.h" #include "sound_settings_widget.h"
#include "sys_info_widget.h" #include "sys_info_widget.h"
#include "sys_info_opengl_widget.h" #include "sys_info_opengl_widget.h"
#include "sys_info_d3d_widget.h" #include "sys_info_d3d_widget.h"
#include "system.h" #include "system.h"
#include <QtGui> #include <QtGui>
CClientConfigDialog::CClientConfigDialog( QWidget *parent ) : CClientConfigDialog::CClientConfigDialog( QWidget *parent ) :
QDialog( parent ) QDialog( parent )
{ {
setupUi( this ); setupUi( this );
connect( buttonBox->button( QDialogButtonBox::Cancel ), SIGNAL( clicked() ), this, SLOT( close() ) ); connect( buttonBox->button( QDialogButtonBox::Cancel ), SIGNAL( clicked() ), this, SLOT( close() ) );
connect( buttonBox->button( QDialogButtonBox::Ok ), SIGNAL( clicked() ), this, SLOT( onClickOK() ) ); connect( buttonBox->button( QDialogButtonBox::Ok ), SIGNAL( clicked() ), this, SLOT( onClickOK() ) );
connect( applyButton, SIGNAL( clicked() ), this, SLOT( onClickApply() ) ); connect( applyButton, SIGNAL( clicked() ), this, SLOT( onClickApply() ) );
connect( defaultButton, SIGNAL( clicked() ), this, SLOT( onClickDefault() ) ); connect( defaultButton, SIGNAL( clicked() ), this, SLOT( onClickDefault() ) );
connect( playButton, SIGNAL( clicked() ), this, SLOT( onClickPlay() ) ); connect( playButton, SIGNAL( clicked() ), this, SLOT( onClickPlay() ) );
connect( treeWidget, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ), connect( treeWidget, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ),
this, SLOT( onClickCategory( QTreeWidgetItem * ) ) ); this, SLOT( onClickCategory( QTreeWidgetItem * ) ) );
// General // General
QTreeWidgetItem *item = treeWidget->topLevelItem( 0 ); QTreeWidgetItem *item = treeWidget->topLevelItem( 0 );
item->setData( 0, Qt::UserRole, 0 ); item->setData( 0, Qt::UserRole, 0 );
// Display // Display
item = treeWidget->topLevelItem( 1 ); item = treeWidget->topLevelItem( 1 );
item->setData( 0, Qt::UserRole, 1 ); item->setData( 0, Qt::UserRole, 1 );
// Display details // Display details
item = treeWidget->topLevelItem( 1 )->child( 0 ); item = treeWidget->topLevelItem( 1 )->child( 0 );
item->setData( 0, Qt::UserRole, 2 ); item->setData( 0, Qt::UserRole, 2 );
// Display advanced // Display advanced
item = treeWidget->topLevelItem( 1 )->child( 1 ); item = treeWidget->topLevelItem( 1 )->child( 1 );
item->setData( 0, Qt::UserRole, 3 ); item->setData( 0, Qt::UserRole, 3 );
// Sound // Sound
item = treeWidget->topLevelItem( 2 ); item = treeWidget->topLevelItem( 2 );
item->setData( 0, Qt::UserRole, 4 ); item->setData( 0, Qt::UserRole, 4 );
// System information // System information
item = treeWidget->topLevelItem( 3 ); item = treeWidget->topLevelItem( 3 );
item->setData( 0, Qt::UserRole, 5 ); item->setData( 0, Qt::UserRole, 5 );
// OpenGL info // OpenGL info
item = treeWidget->topLevelItem( 3 )->child( 0 ); item = treeWidget->topLevelItem( 3 )->child( 0 );
item->setData( 0, Qt::UserRole, 6 ); item->setData( 0, Qt::UserRole, 6 );
// Direct3D info // Direct3D info
item = treeWidget->topLevelItem( 3 )->child( 1 ); item = treeWidget->topLevelItem( 3 )->child( 1 );
item->setData( 0, Qt::UserRole, 7 ); item->setData( 0, Qt::UserRole, 7 );
CategoryStackedWidget->addWidget( new CGeneralSettingsWidget( CategoryStackedWidget ) ); CategoryStackedWidget->addWidget( new CGeneralSettingsWidget( CategoryStackedWidget ) );
CategoryStackedWidget->addWidget( new CDisplaySettingsWidget( CategoryStackedWidget ) ); CategoryStackedWidget->addWidget( new CDisplaySettingsWidget( CategoryStackedWidget ) );
CategoryStackedWidget->addWidget( new CDisplaySettingsDetailsWidget( CategoryStackedWidget ) ); CategoryStackedWidget->addWidget( new CDisplaySettingsDetailsWidget( CategoryStackedWidget ) );
CategoryStackedWidget->addWidget( new CDisplaySettingsAdvancedWidget( CategoryStackedWidget ) ); CategoryStackedWidget->addWidget( new CDisplaySettingsAdvancedWidget( CategoryStackedWidget ) );
CategoryStackedWidget->addWidget( new CSoundSettingsWidget( CategoryStackedWidget ) ); CategoryStackedWidget->addWidget( new CSoundSettingsWidget( CategoryStackedWidget ) );
CategoryStackedWidget->addWidget( new CSysInfoWidget( CategoryStackedWidget ) ); CategoryStackedWidget->addWidget( new CSysInfoWidget( CategoryStackedWidget ) );
CategoryStackedWidget->addWidget( new CSysInfoOpenGLWidget( CategoryStackedWidget ) ); CategoryStackedWidget->addWidget( new CSysInfoOpenGLWidget( CategoryStackedWidget ) );
CategoryStackedWidget->addWidget( new CSysInfoD3DWidget( CategoryStackedWidget ) ); CategoryStackedWidget->addWidget( new CSysInfoD3DWidget( CategoryStackedWidget ) );
for( sint32 i = 0; i < CategoryStackedWidget->count(); i++ ) for( sint32 i = 0; i < CategoryStackedWidget->count(); i++ )
{ {
QWidget *w = CategoryStackedWidget->widget( i ); QWidget *w = CategoryStackedWidget->widget( i );
// The sysinfo pages are not derived from CWidgetBase, so they don't have this signal! // The sysinfo pages are not derived from CWidgetBase, so they don't have this signal!
if( qobject_cast< CWidgetBase * >( w ) == NULL ) if( qobject_cast< CWidgetBase * >( w ) == NULL )
continue; continue;
connect( w, SIGNAL( changed() ), this, SLOT( onSomethingChanged() ) ); connect( w, SIGNAL( changed() ), this, SLOT( onSomethingChanged() ) );
} }
applyButton->setEnabled( false ); applyButton->setEnabled( false );
} }
CClientConfigDialog::~CClientConfigDialog() CClientConfigDialog::~CClientConfigDialog()
{ {
} }
void CClientConfigDialog::closeEvent( QCloseEvent *event ) void CClientConfigDialog::closeEvent( QCloseEvent *event )
{ {
if( isOKToQuit() ) if( isOKToQuit() )
event->accept(); event->accept();
else else
event->ignore(); event->ignore();
} }
void CClientConfigDialog::changeEvent( QEvent *event ) void CClientConfigDialog::changeEvent( QEvent *event )
{ {
if( event->type() == QEvent::LanguageChange ) if( event->type() == QEvent::LanguageChange )
{ {
int pageIndex = CategoryStackedWidget->currentIndex(); int pageIndex = CategoryStackedWidget->currentIndex();
// Signals that are emitted on index change need to be disconnected, since retranslation cleans the widget // Signals that are emitted on index change need to be disconnected, since retranslation cleans the widget
disconnect( treeWidget, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ), disconnect( treeWidget, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ),
this, SLOT( onClickCategory( QTreeWidgetItem * ) ) ); this, SLOT( onClickCategory( QTreeWidgetItem * ) ) );
retranslateUi( this ); retranslateUi( this );
connect( treeWidget, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ), connect( treeWidget, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ),
this, SLOT( onClickCategory( QTreeWidgetItem * ) ) ); this, SLOT( onClickCategory( QTreeWidgetItem * ) ) );
CategoryStackedWidget->setCurrentIndex( pageIndex ); CategoryStackedWidget->setCurrentIndex( pageIndex );
} }
QDialog::changeEvent( event ); QDialog::changeEvent( event );
} }
void CClientConfigDialog::onClickOK() void CClientConfigDialog::onClickOK()
{ {
saveChanges(); saveChanges();
// Since we use the apply button's enabled state to check for unsaved changes on quit, we disable it // Since we use the apply button's enabled state to check for unsaved changes on quit, we disable it
applyButton->setEnabled( false ); applyButton->setEnabled( false );
close(); close();
} }
void CClientConfigDialog::onClickApply() void CClientConfigDialog::onClickApply()
{ {
saveChanges(); saveChanges();
applyButton->setEnabled( false ); applyButton->setEnabled( false );
} }
void CClientConfigDialog::onClickDefault() void CClientConfigDialog::onClickDefault()
{ {
CSystem::GetInstance().config.revertToDefault(); CSystem::GetInstance().config.revertToDefault();
CSystem::GetInstance().config.save(); CSystem::GetInstance().config.save();
reloadPages(); reloadPages();
applyButton->setEnabled( false ); applyButton->setEnabled( false );
} }
void CClientConfigDialog::onClickPlay() void CClientConfigDialog::onClickPlay()
{ {
bool started = false; bool started = false;
#ifdef WIN32 #ifdef WIN32
started = QProcess::startDetached( "ryzom_client_r.exe" ); started = QProcess::startDetached( "ryzom_client_r.exe" );
if( !started ) if( !started )
QProcess::startDetached( "ryzom_client_rd.exe" ); QProcess::startDetached( "ryzom_client_rd.exe" );
if( !started ) if( !started )
QProcess::startDetached( "ryzom_client_d.exe" ); QProcess::startDetached( "ryzom_client_d.exe" );
#else #else
started = QProcess::startDetached( "./ryzom_client_r" ); started = QProcess::startDetached( "./ryzom_client_r" );
if( !started ) if( !started )
QProcess::startDetached( "./ryzom_client_rd" ); QProcess::startDetached( "./ryzom_client_rd" );
if( !started ) if( !started )
QProcess::startDetached( "./ryzom_client_d" ); QProcess::startDetached( "./ryzom_client_d" );
#endif #endif
onClickOK(); onClickOK();
} }
void CClientConfigDialog::onClickCategory( QTreeWidgetItem *item ) void CClientConfigDialog::onClickCategory( QTreeWidgetItem *item )
{ {
if( item == NULL ) if( item == NULL )
return; return;
static const char *iconNames[] = static const char *iconNames[] =
{ {
":/resources/general_icon.bmp", ":/resources/general_icon.bmp",
":/resources/display_icon.bmp", ":/resources/display_icon.bmp",
":/resources/display_properties_icon.bmp", ":/resources/display_properties_icon.bmp",
":/resources/display_config_icon.bmp", ":/resources/display_config_icon.bmp",
":/resources/sound_icon.bmp", ":/resources/sound_icon.bmp",
":/resources/general_icon.bmp", ":/resources/general_icon.bmp",
":/resources/card_icon.bmp", ":/resources/card_icon.bmp",
":/resources/card_icon.bmp" ":/resources/card_icon.bmp"
}; };
sint32 index = item->data( 0, Qt::UserRole ).toInt(); sint32 index = item->data( 0, Qt::UserRole ).toInt();
if( ( index < 0 ) || ( index > 7 ) ) if( ( index < 0 ) || ( index > 7 ) )
return; return;
CategoryStackedWidget->setCurrentIndex( index ); CategoryStackedWidget->setCurrentIndex( index );
categoryLabel->setText( item->text( 0 ) ); categoryLabel->setText( item->text( 0 ) );
topleftIcon->setPixmap( QPixmap( QString::fromUtf8( iconNames[ index ] ) ) ); topleftIcon->setPixmap( QPixmap( QString::fromUtf8( iconNames[ index ] ) ) );
} }
void CClientConfigDialog::onSomethingChanged() void CClientConfigDialog::onSomethingChanged()
{ {
applyButton->setEnabled( true ); applyButton->setEnabled( true );
} }
void CClientConfigDialog::saveChanges() void CClientConfigDialog::saveChanges()
{ {
// First we tell the pages to save their changes into the cached config file // First we tell the pages to save their changes into the cached config file
for( sint32 i = 0; i < CategoryStackedWidget->count(); i++ ) for( sint32 i = 0; i < CategoryStackedWidget->count(); i++ )
{ {
QWidget *w = CategoryStackedWidget->widget( i ); QWidget *w = CategoryStackedWidget->widget( i );
CWidgetBase *wb = qobject_cast< CWidgetBase * >( w ); CWidgetBase *wb = qobject_cast< CWidgetBase * >( w );
// The system information pages are not derived from CWidgetBase, so they can't save! // The system information pages are not derived from CWidgetBase, so they can't save!
if( wb == NULL ) if( wb == NULL )
continue; continue;
wb->save(); wb->save();
} }
// Then we write the cache to the disk // Then we write the cache to the disk
CSystem::GetInstance().config.save(); CSystem::GetInstance().config.save();
} }
void CClientConfigDialog::reloadPages() void CClientConfigDialog::reloadPages()
{ {
for( sint32 i = 0; i < CategoryStackedWidget->count(); i++ ) for( sint32 i = 0; i < CategoryStackedWidget->count(); i++ )
{ {
QWidget *w = CategoryStackedWidget->widget( i ); QWidget *w = CategoryStackedWidget->widget( i );
CWidgetBase *wb = qobject_cast< CWidgetBase * >( w ); CWidgetBase *wb = qobject_cast< CWidgetBase * >( w );
// The system information pages are not derived from CWidgetBase, so they can't load! // The system information pages are not derived from CWidgetBase, so they can't load!
if( wb == NULL ) if( wb == NULL )
continue; continue;
wb->load(); wb->load();
} }
} }
bool CClientConfigDialog::isOKToQuit() bool CClientConfigDialog::isOKToQuit()
{ {
// If the apply button is enabled we have unsaved changes // If the apply button is enabled we have unsaved changes
if( applyButton->isEnabled() ) if( applyButton->isEnabled() )
{ {
sint32 r = QMessageBox::warning( sint32 r = QMessageBox::warning(
this, this,
tr( "Ryzom configuration" ), tr( "Ryzom configuration" ),
tr( "Are you sure you want to quit without saving the configuration?" ), tr( "Are you sure you want to quit without saving the configuration?" ),
QMessageBox::Yes | QMessageBox::No QMessageBox::Yes | QMessageBox::No
); );
if( r == QMessageBox::No ) if( r == QMessageBox::No )
return false; return false;
} }
return true; return true;
} }

@ -1,67 +1,67 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CLIENT_CONFIG_DIALOG_H #ifndef CLIENT_CONFIG_DIALOG_H
#define CLIENT_CONFIG_DIALOG_H #define CLIENT_CONFIG_DIALOG_H
#include "ui_client_config_dialog.h" #include "ui_client_config_dialog.h"
/** /**
@brief The main dialog of the configuration tool @brief The main dialog of the configuration tool
@details Sets up and controls the configuration pages, sets up navigation, @details Sets up and controls the configuration pages, sets up navigation,
sets up the ok, cancel, apply, etc buttons. sets up the ok, cancel, apply, etc buttons.
*/ */
class CClientConfigDialog : public QDialog, public Ui::client_config_dialog class CClientConfigDialog : public QDialog, public Ui::client_config_dialog
{ {
Q_OBJECT Q_OBJECT
public: public:
CClientConfigDialog( QWidget *parent = NULL ); CClientConfigDialog( QWidget *parent = NULL );
~CClientConfigDialog(); ~CClientConfigDialog();
protected: protected:
void closeEvent( QCloseEvent *event ); void closeEvent( QCloseEvent *event );
void changeEvent( QEvent *event ); void changeEvent( QEvent *event );
private slots: private slots:
//////////////////////////// Main dialog buttons ///////////////////// //////////////////////////// Main dialog buttons /////////////////////
void onClickOK(); void onClickOK();
void onClickApply(); void onClickApply();
void onClickDefault(); void onClickDefault();
void onClickPlay(); void onClickPlay();
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
void onClickCategory( QTreeWidgetItem *item ); void onClickCategory( QTreeWidgetItem *item );
void onSomethingChanged(); void onSomethingChanged();
private: private:
/** /**
@brief Tells the config pages to save their changes into the config file @brief Tells the config pages to save their changes into the config file
*/ */
void saveChanges(); void saveChanges();
/** /**
@brief Reloads the pages' contents from the config file. @brief Reloads the pages' contents from the config file.
*/ */
void reloadPages(); void reloadPages();
/** /**
@brief Checks if it's OK to quit the application, may query the user @brief Checks if it's OK to quit the application, may query the user
@return Returns true if it's OK to quit, returns false otherwise. @return Returns true if it's OK to quit, returns false otherwise.
*/ */
bool isOKToQuit(); bool isOKToQuit();
}; };
#endif // CLIENT_CONFIG_DIALOG_H #endif // CLIENT_CONFIG_DIALOG_H

@ -1,255 +1,255 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Config.h" #include "Config.h"
CConfig::CConfig() CConfig::CConfig()
{ {
} }
CConfig::~CConfig() CConfig::~CConfig()
{ {
} }
bool CConfig::load( const char *fileName ) bool CConfig::load( const char *fileName )
{ {
try try
{ {
cf.load( fileName ); cf.load( fileName );
std::string def = getString( "RootConfigFilename" ); std::string def = getString( "RootConfigFilename" );
if( def.compare( "" ) != 0 ) if( def.compare( "" ) != 0 )
dcf.load( def ); dcf.load( def );
} }
catch( NLMISC::Exception &e ) catch( NLMISC::Exception &e )
{ {
nlwarning( "%s", e.what() ); nlwarning( "%s", e.what() );
return false; return false;
} }
return true; return true;
} }
bool CConfig::reload() bool CConfig::reload()
{ {
try try
{ {
cf.clear(); cf.clear();
cf.reparse(); cf.reparse();
} }
catch( NLMISC::Exception &e ) catch( NLMISC::Exception &e )
{ {
nlwarning( "%s", e.what() ); nlwarning( "%s", e.what() );
return false; return false;
} }
return true; return true;
} }
void CConfig::revertToDefault() void CConfig::revertToDefault()
{ {
// If there's no default config, all we can do is revert the current changes // If there's no default config, all we can do is revert the current changes
if( !dcf.loaded() ) if( !dcf.loaded() )
{ {
reload(); reload();
return; return;
} }
// If there is a default config, we can however revert to the default! // If there is a default config, we can however revert to the default!
// Code taken from the original config tool // Code taken from the original config tool
uint32 count = cf.getNumVar(); uint32 count = cf.getNumVar();
uint32 i = 0; uint32 i = 0;
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
{ {
NLMISC::CConfigFile::CVar *dst = cf.getVar( i ); NLMISC::CConfigFile::CVar *dst = cf.getVar( i );
// Comment from the original // Comment from the original
// Temp: avoid changing this variable (debug: binded to the actual texture set installed) // Temp: avoid changing this variable (debug: binded to the actual texture set installed)
if( dst->Name.compare( "HDTextureInstalled" ) == 0 ) if( dst->Name.compare( "HDTextureInstalled" ) == 0 )
continue; continue;
NLMISC::CConfigFile::CVar *src = dcf.getVarPtr( dst->Name ); NLMISC::CConfigFile::CVar *src = dcf.getVarPtr( dst->Name );
if( ( src != NULL ) && !dst->Root && if( ( src != NULL ) && !dst->Root &&
( ( src->Type == NLMISC::CConfigFile::CVar::T_INT ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_INT ) || ( ( src->Type == NLMISC::CConfigFile::CVar::T_INT ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_INT ) ||
( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_INT ) || ( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_INT ) ||
( src->Type == NLMISC::CConfigFile::CVar::T_INT ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_REAL ) || ( src->Type == NLMISC::CConfigFile::CVar::T_INT ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_REAL ) ||
( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_REAL ) || ( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_REAL ) ||
( src->Type == NLMISC::CConfigFile::CVar::T_STRING ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_STRING ) ) ) ( src->Type == NLMISC::CConfigFile::CVar::T_STRING ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_STRING ) ) )
{ {
if( src->Type == NLMISC::CConfigFile::CVar::T_INT ) if( src->Type == NLMISC::CConfigFile::CVar::T_INT )
{ {
setInt( src->Name.c_str(), src->asInt() ); setInt( src->Name.c_str(), src->asInt() );
} }
else if( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) else if( src->Type == NLMISC::CConfigFile::CVar::T_REAL )
{ {
setFloat( src->Name.c_str(), src->asFloat() ); setFloat( src->Name.c_str(), src->asFloat() );
} }
else if( src->Type == NLMISC::CConfigFile::CVar::T_STRING ) else if( src->Type == NLMISC::CConfigFile::CVar::T_STRING )
{ {
setString( src->Name.c_str(), src->asString() ); setString( src->Name.c_str(), src->asString() );
} }
} }
} }
} }
bool CConfig::save() bool CConfig::save()
{ {
try try
{ {
cf.save(); cf.save();
} }
catch( NLMISC::Exception &e ) catch( NLMISC::Exception &e )
{ {
nlwarning( "%s", e.what() ); nlwarning( "%s", e.what() );
return false; return false;
} }
return true; return true;
} }
bool CConfig::getBool( const char *key ) bool CConfig::getBool( const char *key )
{ {
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key ); NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
if( var != NULL ) if( var != NULL )
{ {
return var->asBool(); return var->asBool();
} }
else else
{ {
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() ); nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
return false; return false;
} }
} }
sint32 CConfig::getInt( const char *key ) sint32 CConfig::getInt( const char *key )
{ {
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key ); NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
if( var != NULL ) if( var != NULL )
{ {
return var->asInt(); return var->asInt();
} }
else else
{ {
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() ); nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
return 0; return 0;
} }
} }
float CConfig::getFloat( const char *key ) float CConfig::getFloat( const char *key )
{ {
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key ); NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
if( var != NULL ) if( var != NULL )
{ {
return var->asFloat(); return var->asFloat();
} }
else else
{ {
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() ); nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
return 0.0f; return 0.0f;
} }
} }
std::string CConfig::getString( const char *key ) std::string CConfig::getString( const char *key )
{ {
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key ); NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
if( var != NULL ) if( var != NULL )
{ {
return var->asString(); return var->asString();
} }
else else
{ {
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() ); nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
return ""; return "";
} }
} }
void CConfig::setBool( const char *key, bool value ) void CConfig::setBool( const char *key, bool value )
{ {
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key ); NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
if( var != NULL ) if( var != NULL )
{ {
if( var->Type == NLMISC::CConfigFile::CVar::T_BOOL ) if( var->Type == NLMISC::CConfigFile::CVar::T_BOOL )
{ {
if( value ) if( value )
var->setAsString( "true" ); var->setAsString( "true" );
else else
var->setAsString( "false" ); var->setAsString( "false" );
} }
else else
{ {
nlwarning( "Key %s in %s is not a boolean.", key, cf.getFilename().c_str() ); nlwarning( "Key %s in %s is not a boolean.", key, cf.getFilename().c_str() );
} }
} }
else else
{ {
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() ); nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
} }
} }
void CConfig::setInt(const char *key, sint32 value) void CConfig::setInt(const char *key, sint32 value)
{ {
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key ); NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
if( var != NULL ) if( var != NULL )
{ {
if( var->Type == NLMISC::CConfigFile::CVar::T_INT ) if( var->Type == NLMISC::CConfigFile::CVar::T_INT )
var->setAsInt( value ); var->setAsInt( value );
else else
nlwarning( "Key %s in %s is not an integer.", key, cf.getFilename().c_str() ); nlwarning( "Key %s in %s is not an integer.", key, cf.getFilename().c_str() );
} }
else else
{ {
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() ); nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
} }
} }
void CConfig::setFloat( const char *key, float value ) void CConfig::setFloat( const char *key, float value )
{ {
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key ); NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
if( var != NULL ) if( var != NULL )
{ {
if( var->Type == NLMISC::CConfigFile::CVar::T_REAL ) if( var->Type == NLMISC::CConfigFile::CVar::T_REAL )
var->setAsFloat( value ); var->setAsFloat( value );
else else
nlwarning( "Key %s in %s is not a float.", key, cf.getFilename().c_str() ); nlwarning( "Key %s in %s is not a float.", key, cf.getFilename().c_str() );
} }
else else
{ {
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() ); nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
} }
} }
void CConfig::setString( const char *key, std::string &value ) void CConfig::setString( const char *key, std::string &value )
{ {
NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key ); NLMISC::CConfigFile::CVar *var = cf.getVarPtr( key );
if( var != NULL ) if( var != NULL )
{ {
if( var->Type == NLMISC::CConfigFile::CVar::T_STRING ) if( var->Type == NLMISC::CConfigFile::CVar::T_STRING )
var->setAsString( value ); var->setAsString( value );
else else
nlwarning( "Key %s in %s is not a string.", key, cf.getFilename().c_str() ); nlwarning( "Key %s in %s is not a string.", key, cf.getFilename().c_str() );
} }
else else
{ {
nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() ); nlwarning( "Couldn't find key %s in %s.", key, cf.getFilename().c_str() );
} }
} }

@ -1,120 +1,120 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CONFIG_H #ifndef CONFIG_H
#define CONFIG_H #define CONFIG_H
#include <nel/misc/config_file.h> #include <nel/misc/config_file.h>
/** /**
@brief Wrapper for a Ryzom config file, allows setting and querying values. @brief Wrapper for a Ryzom config file, allows setting and querying values.
*/ */
class CConfig class CConfig
{ {
public: public:
CConfig(); CConfig();
~CConfig(); ~CConfig();
/** /**
@brief Loads a config file. @brief Loads a config file.
@param fileName - The file to load @param fileName - The file to load
@return Returns true on success, returns false on failure. @return Returns true on success, returns false on failure.
*/ */
bool load( const char *fileName ); bool load( const char *fileName );
/** /**
@brief Reloads the contents of the config file @brief Reloads the contents of the config file
@return Return true on success, returns false on failure. @return Return true on success, returns false on failure.
*/ */
bool reload(); bool reload();
/** /**
@brief Reverts the config file to the default @brief Reverts the config file to the default
@details Reverts the config file to the default if possible. @details Reverts the config file to the default if possible.
If there is no default config, it reverts the current changes only. If there is no default config, it reverts the current changes only.
*/ */
void revertToDefault(); void revertToDefault();
/** /**
@brief Saves the configuration to the config file. @brief Saves the configuration to the config file.
@return Returns true on success, returns false on failure. @return Returns true on success, returns false on failure.
*/ */
bool save(); bool save();
/** /**
@brief Queries the value for the specified key. @brief Queries the value for the specified key.
@param key - The key we are interested in @param key - The key we are interested in
@return Returns the value as a bool, returns false if the key doesn't exist. @return Returns the value as a bool, returns false if the key doesn't exist.
*/ */
bool getBool( const char *key ); bool getBool( const char *key );
/** /**
@brief Queries the value for the specified key. @brief Queries the value for the specified key.
@param key - The key we are interested in @param key - The key we are interested in
@return Returns the value as an integer, returns 0 if the key doesn't exist. @return Returns the value as an integer, returns 0 if the key doesn't exist.
*/ */
sint32 getInt( const char *key ); sint32 getInt( const char *key );
/** /**
@brief Queries the value for the specified key. @brief Queries the value for the specified key.
@param key - The key we are interested in @param key - The key we are interested in
@return Returns the value as a float, returns 0.0f if the key doesn't exist. @return Returns the value as a float, returns 0.0f if the key doesn't exist.
*/ */
float getFloat( const char *key ); float getFloat( const char *key );
/** /**
@brief Queries the value for the specified key. @brief Queries the value for the specified key.
@param key - The key we are interested in @param key - The key we are interested in
@return Returns the value as a std::string, returns an empty string if the key doesn't exist. @return Returns the value as a std::string, returns an empty string if the key doesn't exist.
*/ */
std::string getString( const char *key ); std::string getString( const char *key );
/** /**
@brief Sets the specified key to the specified value. @brief Sets the specified key to the specified value.
@param key - the key we want to alter @param key - the key we want to alter
@param value - the value we want to set @param value - the value we want to set
*/ */
void setBool( const char *key, bool value ); void setBool( const char *key, bool value );
/** /**
@brief Sets the specified key to the specified value. @brief Sets the specified key to the specified value.
@param key - the key we want to alter @param key - the key we want to alter
@param value - the value we want to set @param value - the value we want to set
*/ */
void setInt( const char *key, sint32 value ); void setInt( const char *key, sint32 value );
/** /**
@brief Sets the specified key to the specified value. @brief Sets the specified key to the specified value.
@param key - the key we want to alter @param key - the key we want to alter
@param value - the value we want to set @param value - the value we want to set
*/ */
void setFloat( const char *key, float value ); void setFloat( const char *key, float value );
/** /**
@brief Sets the specified key to the specified value. @brief Sets the specified key to the specified value.
@param key - the key we want to alter @param key - the key we want to alter
@param value - the value we want to set @param value - the value we want to set
*/ */
void setString( const char *key, std::string &value ); void setString( const char *key, std::string &value );
private: private:
// config file // config file
NLMISC::CConfigFile cf; NLMISC::CConfigFile cf;
// default config file // default config file
NLMISC::CConfigFile dcf; NLMISC::CConfigFile dcf;
}; };
#endif #endif

@ -1,86 +1,86 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "display_settings_advanced_widget.h" #include "display_settings_advanced_widget.h"
#include "system.h" #include "system.h"
CDisplaySettingsAdvancedWidget::CDisplaySettingsAdvancedWidget( QWidget *parent ) : CDisplaySettingsAdvancedWidget::CDisplaySettingsAdvancedWidget( QWidget *parent ) :
CWidgetBase( parent ) CWidgetBase( parent )
{ {
setupUi( this ); setupUi( this );
load(); load();
connect( texcompressionCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( texcompressionCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
connect( vertexshaderCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( vertexshaderCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
connect( verticesagpCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( verticesagpCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
connect( pixelshadersCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( pixelshadersCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
} }
CDisplaySettingsAdvancedWidget::~CDisplaySettingsAdvancedWidget() CDisplaySettingsAdvancedWidget::~CDisplaySettingsAdvancedWidget()
{ {
} }
void CDisplaySettingsAdvancedWidget::load() void CDisplaySettingsAdvancedWidget::load()
{ {
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
if( s.config.getInt( "ForceDXTC" ) == 1 ) if( s.config.getInt( "ForceDXTC" ) == 1 )
texcompressionCheckBox->setChecked( true ); texcompressionCheckBox->setChecked( true );
if( s.config.getInt( "DisableVtxProgram" ) == 1 ) if( s.config.getInt( "DisableVtxProgram" ) == 1 )
vertexshaderCheckBox->setChecked( true ); vertexshaderCheckBox->setChecked( true );
if( s.config.getInt( "DisableVtxAGP" ) == 1 ) if( s.config.getInt( "DisableVtxAGP" ) == 1 )
verticesagpCheckBox->setChecked( true ); verticesagpCheckBox->setChecked( true );
if( s.config.getInt( "DisableTextureShdr" ) == 1 ) if( s.config.getInt( "DisableTextureShdr" ) == 1 )
pixelshadersCheckBox->setChecked( true ); pixelshadersCheckBox->setChecked( true );
} }
void CDisplaySettingsAdvancedWidget::save() void CDisplaySettingsAdvancedWidget::save()
{ {
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
if( texcompressionCheckBox->isChecked() ) if( texcompressionCheckBox->isChecked() )
s.config.setInt( "ForceDXTC", 1 ); s.config.setInt( "ForceDXTC", 1 );
else else
s.config.setInt( "ForceDXTC", 0 ); s.config.setInt( "ForceDXTC", 0 );
if( vertexshaderCheckBox->isChecked() ) if( vertexshaderCheckBox->isChecked() )
s.config.setInt( "DisableVtxProgram", 1 ); s.config.setInt( "DisableVtxProgram", 1 );
else else
s.config.setInt( "DisableVtxProgram", 0 ); s.config.setInt( "DisableVtxProgram", 0 );
if( verticesagpCheckBox->isChecked() ) if( verticesagpCheckBox->isChecked() )
s.config.setInt( "DisableVtxAGP", 1 ); s.config.setInt( "DisableVtxAGP", 1 );
else else
s.config.setInt( "DisableVtxAGP", 0 ); s.config.setInt( "DisableVtxAGP", 0 );
if( pixelshadersCheckBox->isChecked() ) if( pixelshadersCheckBox->isChecked() )
s.config.setInt( "DisableTextureShdr", 1 ); s.config.setInt( "DisableTextureShdr", 1 );
else else
s.config.setInt( "DisableTextureShdr", 0 ); s.config.setInt( "DisableTextureShdr", 0 );
} }
void CDisplaySettingsAdvancedWidget::changeEvent( QEvent *event ) void CDisplaySettingsAdvancedWidget::changeEvent( QEvent *event )
{ {
if( event->type() == QEvent::LanguageChange ) if( event->type() == QEvent::LanguageChange )
{ {
retranslateUi( this ); retranslateUi( this );
} }
QWidget::changeEvent( event ); QWidget::changeEvent( event );
} }

@ -1,41 +1,41 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef DISPLAYSETTINGSADVANCEDWIDGET_H #ifndef DISPLAYSETTINGSADVANCEDWIDGET_H
#define DISPLAYSETTINGSADVANCEDWIDGET_H #define DISPLAYSETTINGSADVANCEDWIDGET_H
#include "ui_display_settings_advanced_widget.h" #include "ui_display_settings_advanced_widget.h"
#include "widget_base.h" #include "widget_base.h"
/** /**
@brief The advanced display settings page of the configuration tool @brief The advanced display settings page of the configuration tool
*/ */
class CDisplaySettingsAdvancedWidget : public CWidgetBase, public Ui::display_settings_advanced_widget class CDisplaySettingsAdvancedWidget : public CWidgetBase, public Ui::display_settings_advanced_widget
{ {
Q_OBJECT Q_OBJECT
public: public:
CDisplaySettingsAdvancedWidget( QWidget *parent ); CDisplaySettingsAdvancedWidget( QWidget *parent );
~CDisplaySettingsAdvancedWidget(); ~CDisplaySettingsAdvancedWidget();
void load(); void load();
void save(); void save();
protected: protected:
void changeEvent( QEvent *event ); void changeEvent( QEvent *event );
}; };
#endif // DISPLAYSETTINGSADVANCEDWIDGET_H #endif // DISPLAYSETTINGSADVANCEDWIDGET_H

@ -1,268 +1,268 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "system.h" #include "system.h"
#include "display_settings_details_widget.h" #include "display_settings_details_widget.h"
CDisplaySettingsDetailsWidget::CDisplaySettingsDetailsWidget( QWidget *parent ) : CDisplaySettingsDetailsWidget::CDisplaySettingsDetailsWidget( QWidget *parent ) :
CWidgetBase( parent ) CWidgetBase( parent )
{ {
setupUi( this ); setupUi( this );
connect( landscapeSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onLandscapeSliderChange( int ) ) ); connect( landscapeSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onLandscapeSliderChange( int ) ) );
connect( charactersSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onCharactersSliderChange( int ) ) ); connect( charactersSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onCharactersSliderChange( int ) ) );
connect( fxSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onFXSliderChange( int ) ) ); connect( fxSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onFXSliderChange( int ) ) );
connect( texturesSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onTexturesSliderChange( int ) ) ); connect( texturesSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onTexturesSliderChange( int ) ) );
load(); load();
} }
CDisplaySettingsDetailsWidget::~CDisplaySettingsDetailsWidget() CDisplaySettingsDetailsWidget::~CDisplaySettingsDetailsWidget()
{ {
} }
void CDisplaySettingsDetailsWidget::load() void CDisplaySettingsDetailsWidget::load()
{ {
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
landscapeSlider->setValue( getQuality( qualityToLandscapeThreshold, s.config.getFloat( "LandscapeThreshold" ) ) ); landscapeSlider->setValue( getQuality( qualityToLandscapeThreshold, s.config.getFloat( "LandscapeThreshold" ) ) );
landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToZFar, s.config.getFloat( "Vision" ) ) ) ); landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToZFar, s.config.getFloat( "Vision" ) ) ) );
landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToLandscapeTileNear, s.config.getFloat( "LandscapeTileNear" ) ) ) ); landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToLandscapeTileNear, s.config.getFloat( "LandscapeTileNear" ) ) ) );
landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToMicrovegetDensity, s.config.getFloat( "MicroVegetDensity" ) ) ) ); landscapeSlider->setValue( std::min( landscapeSlider->value(), getQuality( qualityToMicrovegetDensity, s.config.getFloat( "MicroVegetDensity" ) ) ) );
charactersSlider->setValue( getQuality( qualityToSkinNbMaxPoly, s.config.getInt( "SkinNbMaxPoly" ) ) ); charactersSlider->setValue( getQuality( qualityToSkinNbMaxPoly, s.config.getInt( "SkinNbMaxPoly" ) ) );
charactersSlider->setValue( std::min( charactersSlider->value(), getQuality( qualityToNbMaxSkeletonNotCLod, s.config.getInt( "NbMaxSkeletonNotCLod" ) ) ) ); charactersSlider->setValue( std::min( charactersSlider->value(), getQuality( qualityToNbMaxSkeletonNotCLod, s.config.getInt( "NbMaxSkeletonNotCLod" ) ) ) );
charactersSlider->setValue( std::min( charactersSlider->value(), getQuality( qualityToCharacterFarClip, s.config.getFloat( "CharacterFarClip" ) ) ) ); charactersSlider->setValue( std::min( charactersSlider->value(), getQuality( qualityToCharacterFarClip, s.config.getFloat( "CharacterFarClip" ) ) ) );
fxSlider->setValue( getQuality( qualityToFxNbMaxPoly, s.config.getInt( "FxNbMaxPoly" ) ) ); fxSlider->setValue( getQuality( qualityToFxNbMaxPoly, s.config.getInt( "FxNbMaxPoly" ) ) );
int hdTextureInstalled = s.config.getInt( "HDTextureInstalled" ); int hdTextureInstalled = s.config.getInt( "HDTextureInstalled" );
if( hdTextureInstalled == 1 ) if( hdTextureInstalled == 1 )
texturesSlider->setMaximum( QUALITY_NORMAL ); texturesSlider->setMaximum( QUALITY_NORMAL );
else else
texturesSlider->setMaximum( QUALITY_MEDIUM ); texturesSlider->setMaximum( QUALITY_MEDIUM );
// Comment taken from the original config tool: // Comment taken from the original config tool:
// NB: if the player changes its client.cfg, mixing HDEntityTexture=1 and DivideTextureSizeBy2=1, it will // NB: if the player changes its client.cfg, mixing HDEntityTexture=1 and DivideTextureSizeBy2=1, it will
// result to a low quality! // result to a low quality!
if( s.config.getInt( "DivideTextureSizeBy2" ) ) if( s.config.getInt( "DivideTextureSizeBy2" ) )
texturesSlider->setValue( QUALITY_LOW ); texturesSlider->setValue( QUALITY_LOW );
else if( s.config.getInt( "HDEntityTexture" ) && ( hdTextureInstalled == 1 ) ) else if( s.config.getInt( "HDEntityTexture" ) && ( hdTextureInstalled == 1 ) )
texturesSlider->setValue( QUALITY_NORMAL ); texturesSlider->setValue( QUALITY_NORMAL );
else else
texturesSlider->setValue( QUALITY_MEDIUM ); texturesSlider->setValue( QUALITY_MEDIUM );
} }
void CDisplaySettingsDetailsWidget::save() void CDisplaySettingsDetailsWidget::save()
{ {
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
s.config.setFloat( "Vision", qualityToZFar[ landscapeSlider->value() ] ); s.config.setFloat( "Vision", qualityToZFar[ landscapeSlider->value() ] );
s.config.setFloat( "LandscapeTileNear", qualityToLandscapeTileNear[ landscapeSlider->value() ] ); s.config.setFloat( "LandscapeTileNear", qualityToLandscapeTileNear[ landscapeSlider->value() ] );
s.config.setFloat( "LandscapeThreshold", qualityToLandscapeThreshold[ landscapeSlider->value() ] ); s.config.setFloat( "LandscapeThreshold", qualityToLandscapeThreshold[ landscapeSlider->value() ] );
if( landscapeSlider->value() > QUALITY_LOW ) if( landscapeSlider->value() > QUALITY_LOW )
s.config.setInt( "MicroVeget", 1 ); s.config.setInt( "MicroVeget", 1 );
else else
s.config.setInt( "MicroVeget", 0 ); s.config.setInt( "MicroVeget", 0 );
s.config.setFloat( "MicroVegetDensity", qualityToMicrovegetDensity[ landscapeSlider->value() ] ); s.config.setFloat( "MicroVegetDensity", qualityToMicrovegetDensity[ landscapeSlider->value() ] );
s.config.setInt( "SkinNbMaxPoly", qualityToSkinNbMaxPoly[ charactersSlider->value() ] ); s.config.setInt( "SkinNbMaxPoly", qualityToSkinNbMaxPoly[ charactersSlider->value() ] );
s.config.setInt( "NbMaxSkeletonNotCLod", qualityToNbMaxSkeletonNotCLod[ charactersSlider->value() ] ); s.config.setInt( "NbMaxSkeletonNotCLod", qualityToNbMaxSkeletonNotCLod[ charactersSlider->value() ] );
s.config.setFloat( "CharacterFarClip", qualityToCharacterFarClip[ charactersSlider->value() ] ); s.config.setFloat( "CharacterFarClip", qualityToCharacterFarClip[ charactersSlider->value() ] );
s.config.setInt( "FxNbMaxPoly", qualityToFxNbMaxPoly[ fxSlider->value() ] ); s.config.setInt( "FxNbMaxPoly", qualityToFxNbMaxPoly[ fxSlider->value() ] );
if( fxSlider->value() > QUALITY_LOW ) if( fxSlider->value() > QUALITY_LOW )
{ {
s.config.setInt( "Shadows", 1 ); s.config.setInt( "Shadows", 1 );
s.config.setInt( "Bloom", 1 ); s.config.setInt( "Bloom", 1 );
s.config.setInt( "SquareBloom", 1 ); s.config.setInt( "SquareBloom", 1 );
} }
else else
{ {
s.config.setInt( "Shadows", 0 ); s.config.setInt( "Shadows", 0 );
s.config.setInt( "Bloom", 0 ); s.config.setInt( "Bloom", 0 );
s.config.setInt( "SquareBloom", 0 ); s.config.setInt( "SquareBloom", 0 );
} }
if( texturesSlider->value() == QUALITY_NORMAL ) if( texturesSlider->value() == QUALITY_NORMAL )
s.config.setInt( "HDEntityTexture", 1 ); s.config.setInt( "HDEntityTexture", 1 );
else if( texturesSlider->value() == QUALITY_LOW ) else if( texturesSlider->value() == QUALITY_LOW )
s.config.setInt( "DivideTextureSizeBy2", 1 ); s.config.setInt( "DivideTextureSizeBy2", 1 );
} }
void CDisplaySettingsDetailsWidget::changeEvent( QEvent *event ) void CDisplaySettingsDetailsWidget::changeEvent( QEvent *event )
{ {
if( event->type() == QEvent::LanguageChange ) if( event->type() == QEvent::LanguageChange )
{ {
retranslateUi( this ); retranslateUi( this );
landscapeLabel->setText( getQualityString( landscapeSlider->value() ) ); landscapeLabel->setText( getQualityString( landscapeSlider->value() ) );
characterLabel->setText( getQualityString( charactersSlider->value() ) ); characterLabel->setText( getQualityString( charactersSlider->value() ) );
fxLabel->setText( getQualityString( fxSlider->value() ) ); fxLabel->setText( getQualityString( fxSlider->value() ) );
textureLabel->setText( getTextureQualityString( texturesSlider->value() ) ); textureLabel->setText( getTextureQualityString( texturesSlider->value() ) );
} }
QWidget::changeEvent( event ); QWidget::changeEvent( event );
} }
void CDisplaySettingsDetailsWidget::onLandscapeSliderChange( int value ) void CDisplaySettingsDetailsWidget::onLandscapeSliderChange( int value )
{ {
if( ( value < 0 ) || ( value > 3 ) ) if( ( value < 0 ) || ( value > 3 ) )
return; return;
landscapeLabel->setText( getQualityString( value ) ); landscapeLabel->setText( getQualityString( value ) );
emit changed(); emit changed();
} }
void CDisplaySettingsDetailsWidget::onCharactersSliderChange( int value ) void CDisplaySettingsDetailsWidget::onCharactersSliderChange( int value )
{ {
if( ( value < 0 ) || ( value > 3 ) ) if( ( value < 0 ) || ( value > 3 ) )
return; return;
characterLabel->setText( getQualityString( value ) ); characterLabel->setText( getQualityString( value ) );
emit changed(); emit changed();
} }
void CDisplaySettingsDetailsWidget::onFXSliderChange( int value ) void CDisplaySettingsDetailsWidget::onFXSliderChange( int value )
{ {
if( ( value < 0 ) || ( value > 3 ) ) if( ( value < 0 ) || ( value > 3 ) )
return; return;
fxLabel->setText( getQualityString( value ) ); fxLabel->setText( getQualityString( value ) );
emit changed(); emit changed();
} }
void CDisplaySettingsDetailsWidget::onTexturesSliderChange( int value ) void CDisplaySettingsDetailsWidget::onTexturesSliderChange( int value )
{ {
if( ( value < 0 ) || ( value > 3 ) ) if( ( value < 0 ) || ( value > 3 ) )
return; return;
textureLabel->setText( getTextureQualityString( value ) ); textureLabel->setText( getTextureQualityString( value ) );
emit changed(); emit changed();
} }
const float CDisplaySettingsDetailsWidget::qualityToZFar[ QUALITY_STEP ] = const float CDisplaySettingsDetailsWidget::qualityToZFar[ QUALITY_STEP ] =
{ {
200.0f, 200.0f,
400.0f, 400.0f,
500.0f, 500.0f,
800.0f 800.0f
}; };
const float CDisplaySettingsDetailsWidget::qualityToLandscapeTileNear[ QUALITY_STEP ] = const float CDisplaySettingsDetailsWidget::qualityToLandscapeTileNear[ QUALITY_STEP ] =
{ {
20.0f, 20.0f,
100.0f, 100.0f,
150.0f, 150.0f,
200.0f 200.0f
}; };
const float CDisplaySettingsDetailsWidget::qualityToLandscapeThreshold[ QUALITY_STEP ] = const float CDisplaySettingsDetailsWidget::qualityToLandscapeThreshold[ QUALITY_STEP ] =
{ {
100.0f, 100.0f,
1000.0f, 1000.0f,
2000.0f, 2000.0f,
3000.0f 3000.0f
}; };
const float CDisplaySettingsDetailsWidget::qualityToMicrovegetDensity[ QUALITY_STEP ] = const float CDisplaySettingsDetailsWidget::qualityToMicrovegetDensity[ QUALITY_STEP ] =
{ {
10.0f, 10.0f,
30.0f, 30.0f,
80.0f, 80.0f,
100.0f 100.0f
}; };
const sint32 CDisplaySettingsDetailsWidget::qualityToSkinNbMaxPoly[ QUALITY_STEP ] = const sint32 CDisplaySettingsDetailsWidget::qualityToSkinNbMaxPoly[ QUALITY_STEP ] =
{ {
10000, 10000,
70000, 70000,
100000, 100000,
200000 200000
}; };
const sint32 CDisplaySettingsDetailsWidget::qualityToNbMaxSkeletonNotCLod[ QUALITY_STEP ] = const sint32 CDisplaySettingsDetailsWidget::qualityToNbMaxSkeletonNotCLod[ QUALITY_STEP ] =
{ {
10, 10,
50, 50,
125, 125,
255 255
}; };
const float CDisplaySettingsDetailsWidget::qualityToCharacterFarClip[ QUALITY_STEP ] = const float CDisplaySettingsDetailsWidget::qualityToCharacterFarClip[ QUALITY_STEP ] =
{ {
50.0f, 50.0f,
100.0f, 100.0f,
200.0f, 200.0f,
500.0f 500.0f
}; };
const sint32 CDisplaySettingsDetailsWidget::qualityToFxNbMaxPoly[ QUALITY_STEP ] = const sint32 CDisplaySettingsDetailsWidget::qualityToFxNbMaxPoly[ QUALITY_STEP ] =
{ {
2000, 2000,
10000, 10000,
20000, 20000,
50000 50000
}; };
QString CDisplaySettingsDetailsWidget::getQualityString( uint32 quality ) QString CDisplaySettingsDetailsWidget::getQualityString( uint32 quality )
{ {
switch( quality ) switch( quality )
{ {
case QUALITY_LOW: case QUALITY_LOW:
return tr( "Low" ); return tr( "Low" );
break; break;
case QUALITY_MEDIUM: case QUALITY_MEDIUM:
return tr( "Medium" ); return tr( "Medium" );
break; break;
case QUALITY_NORMAL: case QUALITY_NORMAL:
return tr( "Normal" ); return tr( "Normal" );
break; break;
case QUALITY_HIGH: case QUALITY_HIGH:
return tr( "High" ); return tr( "High" );
break; break;
default: default:
return ""; return "";
break; break;
} }
} }
QString CDisplaySettingsDetailsWidget::getTextureQualityString( uint32 quality ) QString CDisplaySettingsDetailsWidget::getTextureQualityString( uint32 quality )
{ {
switch( quality ) switch( quality )
{ {
case TEXQUALITY_LOW: case TEXQUALITY_LOW:
return tr( "Low (32 MB)" ); return tr( "Low (32 MB)" );
break; break;
case TEXQUALITY_NORMAL: case TEXQUALITY_NORMAL:
return tr( "Normal (64 MB)" ); return tr( "Normal (64 MB)" );
break; break;
case TEXQUALITY_HIGH: case TEXQUALITY_HIGH:
return tr( "High (128 MB)" ); return tr( "High (128 MB)" );
break; break;
default: default:
return ""; return "";
break; break;
} }
} }

@ -1,121 +1,121 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef DISPLAYSETTINGSDETAILSWIDGET_H #ifndef DISPLAYSETTINGSDETAILSWIDGET_H
#define DISPLAYSETTINGSDETAILSWIDGET_H #define DISPLAYSETTINGSDETAILSWIDGET_H
#include "ui_display_settings_details_widget.h" #include "ui_display_settings_details_widget.h"
#include "widget_base.h" #include "widget_base.h"
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
enum enum
{ {
QUALITY_LOW = 0, QUALITY_LOW = 0,
QUALITY_MEDIUM = 1, QUALITY_MEDIUM = 1,
QUALITY_NORMAL = 2, QUALITY_NORMAL = 2,
QUALITY_HIGH = 3, QUALITY_HIGH = 3,
QUALITY_STEP = 4 QUALITY_STEP = 4
}; };
enum enum
{ {
TEXQUALITY_LOW = 0, TEXQUALITY_LOW = 0,
TEXQUALITY_NORMAL = 1, TEXQUALITY_NORMAL = 1,
TEXQUALITY_HIGH = 2 TEXQUALITY_HIGH = 2
}; };
/** /**
@brief The display details page of the configuration tool @brief The display details page of the configuration tool
*/ */
class CDisplaySettingsDetailsWidget : public CWidgetBase, public Ui::display_settings_details_widget class CDisplaySettingsDetailsWidget : public CWidgetBase, public Ui::display_settings_details_widget
{ {
Q_OBJECT Q_OBJECT
public: public:
CDisplaySettingsDetailsWidget( QWidget *parent = NULL ); CDisplaySettingsDetailsWidget( QWidget *parent = NULL );
~CDisplaySettingsDetailsWidget(); ~CDisplaySettingsDetailsWidget();
void load(); void load();
void save(); void save();
protected: protected:
void changeEvent( QEvent *event ); void changeEvent( QEvent *event );
private slots: private slots:
void onLandscapeSliderChange( int value ); void onLandscapeSliderChange( int value );
void onCharactersSliderChange( int value ); void onCharactersSliderChange( int value );
void onFXSliderChange( int value ); void onFXSliderChange( int value );
void onTexturesSliderChange( int value ); void onTexturesSliderChange( int value );
private: private:
/** /**
@brief Looks up and returns the "quality" ( see the enums on the top), that belongs to the specified value. @brief Looks up and returns the "quality" ( see the enums on the top), that belongs to the specified value.
@param table - The lookup table you want to use. @param table - The lookup table you want to use.
@param value - The value that we want to look up. @param value - The value that we want to look up.
@return Returns the "quality" that best fits the specified value. @return Returns the "quality" that best fits the specified value.
*/ */
template< typename T > template< typename T >
int getQuality( const T *table, T value ) int getQuality( const T *table, T value )
{ {
if( table[ 0 ] < table[ QUALITY_STEP - 1 ] ) if( table[ 0 ] < table[ QUALITY_STEP - 1 ] )
{ {
uint32 i = 0; uint32 i = 0;
while( ( i < QUALITY_STEP ) && ( table[ i ] < value ) ) while( ( i < QUALITY_STEP ) && ( table[ i ] < value ) )
i++; i++;
return i; return i;
} }
else else
{ {
uint32 i = 0; uint32 i = 0;
while( ( i < QUALITY_STEP ) && ( table[ i ] > value ) ) while( ( i < QUALITY_STEP ) && ( table[ i ] > value ) )
i++; i++;
return i; return i;
} }
} }
/** /**
@brief Retrieves the string that belongs to the specified quality. @brief Retrieves the string that belongs to the specified quality.
@param quality - The quality value @param quality - The quality value
@return Returns a string describing the quality value, Returns an empty string if an invalid value is specified. @return Returns a string describing the quality value, Returns an empty string if an invalid value is specified.
*/ */
static QString getQualityString( uint32 quality ); static QString getQualityString( uint32 quality );
/** /**
@brief Retrieves the string that belongs to the specified texture quality. @brief Retrieves the string that belongs to the specified texture quality.
@param quality - The texture quality value @param quality - The texture quality value
@return Returns a string describing the texture quality, Returns an empty string if an invalid value is specified. @return Returns a string describing the texture quality, Returns an empty string if an invalid value is specified.
*/ */
static QString getTextureQualityString( uint32 quality ); static QString getTextureQualityString( uint32 quality );
///////////////////////// Landscape values /////////////////////// ///////////////////////// Landscape values ///////////////////////
static const float qualityToZFar[ QUALITY_STEP ]; static const float qualityToZFar[ QUALITY_STEP ];
static const float qualityToLandscapeTileNear[ QUALITY_STEP ]; static const float qualityToLandscapeTileNear[ QUALITY_STEP ];
static const float qualityToLandscapeThreshold[ QUALITY_STEP ]; static const float qualityToLandscapeThreshold[ QUALITY_STEP ];
static const float qualityToMicrovegetDensity[ QUALITY_STEP ]; static const float qualityToMicrovegetDensity[ QUALITY_STEP ];
//////////////////////// Character values //////////////////////// //////////////////////// Character values ////////////////////////
static const sint32 qualityToSkinNbMaxPoly[ QUALITY_STEP ]; static const sint32 qualityToSkinNbMaxPoly[ QUALITY_STEP ];
static const sint32 qualityToNbMaxSkeletonNotCLod[ QUALITY_STEP ]; static const sint32 qualityToNbMaxSkeletonNotCLod[ QUALITY_STEP ];
static const float qualityToCharacterFarClip[ QUALITY_STEP ]; static const float qualityToCharacterFarClip[ QUALITY_STEP ];
/////////////////////// FX values //////////////////////////////// /////////////////////// FX values ////////////////////////////////
static const sint32 qualityToFxNbMaxPoly[ QUALITY_STEP ]; static const sint32 qualityToFxNbMaxPoly[ QUALITY_STEP ];
}; };
#endif // DISPLAYSETTINGSDETAILSWIDGET_H #endif // DISPLAYSETTINGSDETAILSWIDGET_H

@ -1,227 +1,227 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <string> #include <string>
#include <sstream> #include <sstream>
#include "display_settings_widget.h" #include "display_settings_widget.h"
#include "system.h" #include "system.h"
#include <QRegExpValidator> #include <QRegExpValidator>
CDisplaySettingsWidget::CDisplaySettingsWidget( QWidget *parent ) : CDisplaySettingsWidget::CDisplaySettingsWidget( QWidget *parent ) :
CWidgetBase( parent ) CWidgetBase( parent )
{ {
setupUi( this ); setupUi( this );
widthLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), widthLineEdit ) ); widthLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), widthLineEdit ) );
heightLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), heightLineEdit ) ); heightLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), heightLineEdit ) );
xpositionLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), xpositionLineEdit ) ); xpositionLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), xpositionLineEdit ) );
ypositionLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), ypositionLineEdit ) ); ypositionLineEdit->setValidator( new QRegExpValidator( QRegExp( "[0-9]{1,6}" ), ypositionLineEdit ) );
load(); load();
connect( autoRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( autoRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
connect( openglRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( openglRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
connect( direct3dRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( direct3dRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
connect( fullscreenRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( fullscreenRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
connect( windowedRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( windowedRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
connect( widthLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) ); connect( widthLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) );
connect( heightLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) ); connect( heightLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) );
connect( xpositionLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) ); connect( xpositionLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) );
connect( ypositionLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) ); connect( ypositionLineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( onSomethingChanged() ) );
connect( videomodeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSomethingChanged() ) ); connect( videomodeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSomethingChanged() ) );
connect( autoRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( updateVideoModes() ) ); connect( autoRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( updateVideoModes() ) );
connect( openglRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( updateVideoModes() ) ); connect( openglRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( updateVideoModes() ) );
connect( direct3dRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( updateVideoModes() ) ); connect( direct3dRadioButton, SIGNAL( clicked( bool ) ), this, SLOT( updateVideoModes() ) );
} }
CDisplaySettingsWidget::~CDisplaySettingsWidget() CDisplaySettingsWidget::~CDisplaySettingsWidget()
{ {
} }
void CDisplaySettingsWidget::load() void CDisplaySettingsWidget::load()
{ {
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
std::string driver = s.config.getString( "Driver3D" ); std::string driver = s.config.getString( "Driver3D" );
switch( getDriverFromConfigString( driver ) ) switch( getDriverFromConfigString( driver ) )
{ {
case DRV_AUTO: case DRV_AUTO:
autoRadioButton->setChecked( true ); autoRadioButton->setChecked( true );
break; break;
case DRV_OPENGL: case DRV_OPENGL:
openglRadioButton->setChecked( true ); openglRadioButton->setChecked( true );
break; break;
case DRV_DIRECT3D: case DRV_DIRECT3D:
direct3dRadioButton->setChecked( true ); direct3dRadioButton->setChecked( true );
break; break;
} }
updateVideoModes(); updateVideoModes();
CVideoMode mode; CVideoMode mode;
mode.widht = s.config.getInt( "Width" ); mode.widht = s.config.getInt( "Width" );
mode.height = s.config.getInt( "Height" ); mode.height = s.config.getInt( "Height" );
mode.depth = s.config.getInt( "Depth" ); mode.depth = s.config.getInt( "Depth" );
mode.frequency = s.config.getInt( "Frequency" ); mode.frequency = s.config.getInt( "Frequency" );
if( s.config.getInt( "FullScreen" ) == 1 ) if( s.config.getInt( "FullScreen" ) == 1 )
{ {
fullscreenRadioButton->setChecked( true ); fullscreenRadioButton->setChecked( true );
videomodeComboBox->setCurrentIndex( findVideoModeIndex( &mode ) ); videomodeComboBox->setCurrentIndex( findVideoModeIndex( &mode ) );
} }
else else
{ {
windowedRadioButton->setChecked( true ); windowedRadioButton->setChecked( true );
} }
widthLineEdit->setText( QString( "%1" ).arg( mode.widht ) ); widthLineEdit->setText( QString( "%1" ).arg( mode.widht ) );
heightLineEdit->setText( QString( "%1" ).arg( mode.height ) ); heightLineEdit->setText( QString( "%1" ).arg( mode.height ) );
xpositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionX" ) ) ); xpositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionX" ) ) );
ypositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionY" ) ) ); ypositionLineEdit->setText( QString( "%1" ).arg( s.config.getInt( "PositionY" ) ) );
} }
void CDisplaySettingsWidget::save() void CDisplaySettingsWidget::save()
{ {
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
if( openglRadioButton->isChecked() ) if( openglRadioButton->isChecked() )
s.config.setString( "Driver3D", std::string( "OpenGL" ) ); s.config.setString( "Driver3D", std::string( "OpenGL" ) );
else if( direct3dRadioButton->isChecked() ) else if( direct3dRadioButton->isChecked() )
s.config.setString( "Driver3D", std::string( "Direct3D" ) ); s.config.setString( "Driver3D", std::string( "Direct3D" ) );
else else
s.config.setString( "Driver3D", std::string( "Auto" ) ); s.config.setString( "Driver3D", std::string( "Auto" ) );
if( fullscreenRadioButton->isChecked() ) if( fullscreenRadioButton->isChecked() )
{ {
s.config.setInt( "FullScreen", 1 ); s.config.setInt( "FullScreen", 1 );
sint32 index = videomodeComboBox->currentIndex(); sint32 index = videomodeComboBox->currentIndex();
CVideoMode mode; CVideoMode mode;
// OpenGL should be available everywhere! // OpenGL should be available everywhere!
if( direct3dRadioButton->isChecked() ) if( direct3dRadioButton->isChecked() )
mode = s.d3dInfo.modes[ index ]; mode = s.d3dInfo.modes[ index ];
else else
mode = s.openglInfo.modes[ index ]; mode = s.openglInfo.modes[ index ];
s.config.setInt( "Width", mode.widht ); s.config.setInt( "Width", mode.widht );
s.config.setInt( "Height", mode.height ); s.config.setInt( "Height", mode.height );
s.config.setInt( "Depth", mode.depth ); s.config.setInt( "Depth", mode.depth );
s.config.setInt( "Frequency", mode.frequency ); s.config.setInt( "Frequency", mode.frequency );
} }
else else
{ {
s.config.setInt( "FullScreen", 0 ); s.config.setInt( "FullScreen", 0 );
s.config.setInt( "Width", widthLineEdit->text().toInt() ); s.config.setInt( "Width", widthLineEdit->text().toInt() );
s.config.setInt( "Height", heightLineEdit->text().toInt() ); s.config.setInt( "Height", heightLineEdit->text().toInt() );
} }
s.config.setInt( "PositionX", xpositionLineEdit->text().toInt() ); s.config.setInt( "PositionX", xpositionLineEdit->text().toInt() );
s.config.setInt( "PositionY", ypositionLineEdit->text().toInt() ); s.config.setInt( "PositionY", ypositionLineEdit->text().toInt() );
} }
void CDisplaySettingsWidget::changeEvent( QEvent *event ) void CDisplaySettingsWidget::changeEvent( QEvent *event )
{ {
if( event->type() == QEvent::LanguageChange ) if( event->type() == QEvent::LanguageChange )
{ {
disconnect( videomodeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSomethingChanged() ) ); disconnect( videomodeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSomethingChanged() ) );
retranslateUi( this ); retranslateUi( this );
connect( videomodeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSomethingChanged() ) ); connect( videomodeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onSomethingChanged() ) );
} }
QWidget::changeEvent( event ); QWidget::changeEvent( event );
} }
void CDisplaySettingsWidget::updateVideoModes() void CDisplaySettingsWidget::updateVideoModes()
{ {
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
videomodeComboBox->clear(); videomodeComboBox->clear();
if( direct3dRadioButton->isChecked() ) if( direct3dRadioButton->isChecked() )
{ {
for( std::vector< CVideoMode >::iterator itr = s.d3dInfo.modes.begin(); itr != s.d3dInfo.modes.end(); ++itr ) for( std::vector< CVideoMode >::iterator itr = s.d3dInfo.modes.begin(); itr != s.d3dInfo.modes.end(); ++itr )
{ {
std::stringstream ss; std::stringstream ss;
ss << itr->widht << "x" << itr->height << " " << itr->depth << " bit @" << itr->frequency; ss << itr->widht << "x" << itr->height << " " << itr->depth << " bit @" << itr->frequency;
videomodeComboBox->addItem( ss.str().c_str() ); videomodeComboBox->addItem( ss.str().c_str() );
} }
} }
else else
{ {
// OpenGL should be available everywhere! // OpenGL should be available everywhere!
for( std::vector< CVideoMode >::iterator itr = s.openglInfo.modes.begin(); itr != s.openglInfo.modes.end(); ++itr ) for( std::vector< CVideoMode >::iterator itr = s.openglInfo.modes.begin(); itr != s.openglInfo.modes.end(); ++itr )
{ {
std::stringstream ss; std::stringstream ss;
ss << itr->widht << "x" << itr->height << " " << itr->depth << " bit @" << itr->frequency; ss << itr->widht << "x" << itr->height << " " << itr->depth << " bit @" << itr->frequency;
videomodeComboBox->addItem( ss.str().c_str() ); videomodeComboBox->addItem( ss.str().c_str() );
} }
} }
} }
uint32 CDisplaySettingsWidget::findVideoModeIndex( CVideoMode *mode ) uint32 CDisplaySettingsWidget::findVideoModeIndex( CVideoMode *mode )
{ {
////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////
// WARNING: // WARNING:
// This part relies on that the video mode combo box is filled as the following: // This part relies on that the video mode combo box is filled as the following:
// //
//| --------------------------------------| //| --------------------------------------|
//| Selected driver | Modes | //| Selected driver | Modes |
//| --------------------------------------| //| --------------------------------------|
//| Auto | OpenGL modes | //| Auto | OpenGL modes |
//| OpenGL | OpenGL modes | //| OpenGL | OpenGL modes |
//| Direct3D | Direct3d modes | //| Direct3D | Direct3d modes |
//| --------------------------------------| //| --------------------------------------|
// //
// //
////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////
CVideoMode &m = *mode; CVideoMode &m = *mode;
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
if( direct3dRadioButton->isChecked() ) if( direct3dRadioButton->isChecked() )
{ {
for( uint32 i = 0; i < s.d3dInfo.modes.size(); i++ ) for( uint32 i = 0; i < s.d3dInfo.modes.size(); i++ )
if( s.d3dInfo.modes[ i ] == m ) if( s.d3dInfo.modes[ i ] == m )
return i; return i;
} }
else else
{ {
// Again OpenGL should be available everywhere! // Again OpenGL should be available everywhere!
for( uint32 i = 0; i < s.openglInfo.modes.size(); i++ ) for( uint32 i = 0; i < s.openglInfo.modes.size(); i++ )
if( s.openglInfo.modes[ i ] == m ) if( s.openglInfo.modes[ i ] == m )
return i; return i;
} }
return 0; return 0;
} }
E3DDriver CDisplaySettingsWidget::getDriverFromConfigString(std::string &str) const E3DDriver CDisplaySettingsWidget::getDriverFromConfigString(std::string &str) const
{ {
if( str.compare( "0" ) == 0 ) if( str.compare( "0" ) == 0 )
return DRV_AUTO; return DRV_AUTO;
if( str.compare( "1" ) == 0 ) if( str.compare( "1" ) == 0 )
return DRV_OPENGL; return DRV_OPENGL;
if( str.compare( "2" ) == 0 ) if( str.compare( "2" ) == 0 )
return DRV_DIRECT3D; return DRV_DIRECT3D;
if( str.compare( "OpenGL" ) == 0 ) if( str.compare( "OpenGL" ) == 0 )
return DRV_OPENGL; return DRV_OPENGL;
if( str.compare( "Direct3D" ) == 0) if( str.compare( "Direct3D" ) == 0)
return DRV_DIRECT3D; return DRV_DIRECT3D;
return DRV_AUTO; return DRV_AUTO;
} }

@ -1,72 +1,72 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef DISPLAYSETTINGSWIDGET_H #ifndef DISPLAYSETTINGSWIDGET_H
#define DISPLAYSETTINGSWIDGET_H #define DISPLAYSETTINGSWIDGET_H
#include "ui_display_settings_widget.h" #include "ui_display_settings_widget.h"
#include "widget_base.h" #include "widget_base.h"
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
struct CVideoMode; struct CVideoMode;
enum E3DDriver enum E3DDriver
{ {
DRV_AUTO, DRV_AUTO,
DRV_OPENGL, DRV_OPENGL,
DRV_DIRECT3D DRV_DIRECT3D
}; };
/** /**
@brief The display settings page of the configuration tool @brief The display settings page of the configuration tool
*/ */
class CDisplaySettingsWidget : public CWidgetBase, public Ui::display_settings_widget class CDisplaySettingsWidget : public CWidgetBase, public Ui::display_settings_widget
{ {
Q_OBJECT Q_OBJECT
public: public:
CDisplaySettingsWidget( QWidget *parent = NULL ); CDisplaySettingsWidget( QWidget *parent = NULL );
~CDisplaySettingsWidget(); ~CDisplaySettingsWidget();
void load(); void load();
void save(); void save();
protected: protected:
void changeEvent( QEvent *event ); void changeEvent( QEvent *event );
private slots: private slots:
/** /**
@brief Updates the video modes combo box, based on the current driver selection. @brief Updates the video modes combo box, based on the current driver selection.
*/ */
void updateVideoModes(); void updateVideoModes();
private: private:
/** /**
@brief Finds the proper index for the video mode combobox @brief Finds the proper index for the video mode combobox
@param mode - the video mode read from config @param mode - the video mode read from config
@return Returns the proper video mode index if found, returns 0 otherwise. @return Returns the proper video mode index if found, returns 0 otherwise.
*/ */
uint32 findVideoModeIndex( CVideoMode *mode ); uint32 findVideoModeIndex( CVideoMode *mode );
/** /**
@brief Retrieves the driver type from the config string. @brief Retrieves the driver type from the config string.
@param str - Reference to the driver string. @param str - Reference to the driver string.
@return Returns the driver type on success, rReturns E3DDriver::DRV_AUTO otherwise. @return Returns the driver type on success, rReturns E3DDriver::DRV_AUTO otherwise.
*/ */
E3DDriver getDriverFromConfigString( std::string &str ) const; E3DDriver getDriverFromConfigString( std::string &str ) const;
}; };
#endif // DISPLAYSETTINGSWIDGET_H #endif // DISPLAYSETTINGSWIDGET_H

@ -1,121 +1,121 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "general_settings_widget.h" #include "general_settings_widget.h"
#include "system.h" #include "system.h"
#include <QTranslator> #include <QTranslator>
const QString CGeneralSettingsWidget::languageCodes[ NUM_LANGUAGE_CODES ] = const QString CGeneralSettingsWidget::languageCodes[ NUM_LANGUAGE_CODES ] =
{ {
"en", "en",
"fr", "fr",
"de", "de",
"hu" "hu"
}; };
CGeneralSettingsWidget::CGeneralSettingsWidget( QWidget *parent ) : CGeneralSettingsWidget::CGeneralSettingsWidget( QWidget *parent ) :
CWidgetBase( parent ) CWidgetBase( parent )
{ {
currentTranslator = NULL; currentTranslator = NULL;
setupUi( this ); setupUi( this );
load(); load();
connect( languageComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onLanguageChanged() ) ); connect( languageComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onLanguageChanged() ) );
connect( saveConfigOnQuitCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) ); connect( saveConfigOnQuitCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) );
connect( lowPriorityProcessCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) ); connect( lowPriorityProcessCheckBox, SIGNAL( stateChanged( int ) ), this, SLOT( onSomethingChanged() ) );
} }
CGeneralSettingsWidget::~CGeneralSettingsWidget() CGeneralSettingsWidget::~CGeneralSettingsWidget()
{ {
} }
void CGeneralSettingsWidget::load() void CGeneralSettingsWidget::load()
{ {
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
sint32 cbIndex = getIndexForLanguageCode( QString( s.config.getString( "LanguageCode" ).c_str() ) ); sint32 cbIndex = getIndexForLanguageCode( QString( s.config.getString( "LanguageCode" ).c_str() ) );
if( cbIndex != -1 ){ if( cbIndex != -1 ){
languageComboBox->setCurrentIndex( cbIndex ); languageComboBox->setCurrentIndex( cbIndex );
onLanguageChanged(); onLanguageChanged();
} }
if( s.config.getInt( "SaveConfig" ) ) if( s.config.getInt( "SaveConfig" ) )
saveConfigOnQuitCheckBox->setChecked( true ); saveConfigOnQuitCheckBox->setChecked( true );
if( s.config.getInt( "ProcessPriority" ) == -1 ) if( s.config.getInt( "ProcessPriority" ) == -1 )
lowPriorityProcessCheckBox->setChecked( true ); lowPriorityProcessCheckBox->setChecked( true );
else else
lowPriorityProcessCheckBox->setChecked( false ); lowPriorityProcessCheckBox->setChecked( false );
} }
void CGeneralSettingsWidget::save() void CGeneralSettingsWidget::save()
{ {
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
s.config.setString( "LanguageCode", std::string( languageCodes[ languageComboBox->currentIndex() ].toUtf8() ) ); s.config.setString( "LanguageCode", std::string( languageCodes[ languageComboBox->currentIndex() ].toUtf8() ) );
if( saveConfigOnQuitCheckBox->isChecked() ) if( saveConfigOnQuitCheckBox->isChecked() )
s.config.setInt( "SaveConfig", 1 ); s.config.setInt( "SaveConfig", 1 );
else else
s.config.setInt( "SaveConfig", 0 ); s.config.setInt( "SaveConfig", 0 );
if( lowPriorityProcessCheckBox->isChecked() ) if( lowPriorityProcessCheckBox->isChecked() )
s.config.setInt( "ProcessPriority", -1 ); s.config.setInt( "ProcessPriority", -1 );
else else
s.config.setInt( "ProcessPriority", 0 ); s.config.setInt( "ProcessPriority", 0 );
} }
void CGeneralSettingsWidget::onLanguageChanged() void CGeneralSettingsWidget::onLanguageChanged()
{ {
sint32 i = languageComboBox->currentIndex(); sint32 i = languageComboBox->currentIndex();
if( currentTranslator != NULL ) if( currentTranslator != NULL )
{ {
qApp->removeTranslator( currentTranslator ); qApp->removeTranslator( currentTranslator );
delete currentTranslator; delete currentTranslator;
currentTranslator = NULL; currentTranslator = NULL;
} }
currentTranslator = new QTranslator(); currentTranslator = new QTranslator();
if( currentTranslator->load( QString( ":/translations/ryzom_configuration_%1" ).arg( languageCodes[ i ] ) ) ) if( currentTranslator->load( QString( ":/translations/ryzom_configuration_%1" ).arg( languageCodes[ i ] ) ) )
qApp->installTranslator( currentTranslator ); qApp->installTranslator( currentTranslator );
emit changed(); emit changed();
} }
void CGeneralSettingsWidget::changeEvent( QEvent *event ) void CGeneralSettingsWidget::changeEvent( QEvent *event )
{ {
if( event->type() == QEvent::LanguageChange ) if( event->type() == QEvent::LanguageChange )
{ {
sint32 i = languageComboBox->currentIndex(); sint32 i = languageComboBox->currentIndex();
// Signals that are emitted on index change need to be disconnected, since retranslation cleans the widget // Signals that are emitted on index change need to be disconnected, since retranslation cleans the widget
disconnect( languageComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onLanguageChanged() ) ); disconnect( languageComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onLanguageChanged() ) );
retranslateUi( this ); retranslateUi( this );
languageComboBox->setCurrentIndex( i ); languageComboBox->setCurrentIndex( i );
connect( languageComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onLanguageChanged() ) ); connect( languageComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onLanguageChanged() ) );
} }
QWidget::changeEvent( event ); QWidget::changeEvent( event );
} }
int CGeneralSettingsWidget::getIndexForLanguageCode( QString &languageCode ) int CGeneralSettingsWidget::getIndexForLanguageCode( QString &languageCode )
{ {
for( sint32 i = 0; i < NUM_LANGUAGE_CODES; i++ ) for( sint32 i = 0; i < NUM_LANGUAGE_CODES; i++ )
if( languageCode.compare( languageCodes[ i ] ) == 0 ) if( languageCode.compare( languageCodes[ i ] ) == 0 )
return i; return i;
return -1; return -1;
} }

@ -1,66 +1,66 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef GENERALSETTINGWIDGET_H #ifndef GENERALSETTINGWIDGET_H
#define GENERALSETTINGWIDGET_H #define GENERALSETTINGWIDGET_H
#include "ui_general_settings_widget.h" #include "ui_general_settings_widget.h"
#include "widget_base.h" #include "widget_base.h"
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
class QTranslator; class QTranslator;
enum enum
{ {
NUM_LANGUAGE_CODES = 4 NUM_LANGUAGE_CODES = 4
}; };
/** /**
@brief The general settings page of the configuration tool @brief The general settings page of the configuration tool
*/ */
class CGeneralSettingsWidget : public CWidgetBase, public Ui::general_settings_widget class CGeneralSettingsWidget : public CWidgetBase, public Ui::general_settings_widget
{ {
Q_OBJECT Q_OBJECT
public: public:
CGeneralSettingsWidget( QWidget *parent = NULL ); CGeneralSettingsWidget( QWidget *parent = NULL );
~CGeneralSettingsWidget(); ~CGeneralSettingsWidget();
void load(); void load();
void save(); void save();
private slots: private slots:
void onLanguageChanged(); void onLanguageChanged();
protected: protected:
void changeEvent( QEvent *event ); void changeEvent( QEvent *event );
private: private:
/** /**
@brief Retrieves the language combobox index for the language code provided. @brief Retrieves the language combobox index for the language code provided.
@param languageCode - Reference to the language code, we are trying to find. @param languageCode - Reference to the language code, we are trying to find.
@return Returns the index on success, returns -1 if the language code cannot be found. @return Returns the index on success, returns -1 if the language code cannot be found.
*/ */
sint32 getIndexForLanguageCode( QString &languageCode ); sint32 getIndexForLanguageCode( QString &languageCode );
// Contains the language codes used in the config file // Contains the language codes used in the config file
// They are in the same order as the options in languageComboBox // They are in the same order as the options in languageComboBox
static const QString languageCodes[ NUM_LANGUAGE_CODES ]; static const QString languageCodes[ NUM_LANGUAGE_CODES ];
QTranslator *currentTranslator; QTranslator *currentTranslator;
}; };
#endif // GENERALSETTINGWIDGET_H #endif // GENERALSETTINGWIDGET_H

@ -1,36 +1,36 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QtGui> #include <QtGui>
#include "client_config_dialog.h" #include "client_config_dialog.h"
#include "system.h" #include "system.h"
int main( sint32 argc, char **argv ) int main( sint32 argc, char **argv )
{ {
QApplication app( argc, argv ); QApplication app( argc, argv );
QPixmap pixmap( ":/resources/splash_screen.bmp" ); QPixmap pixmap( ":/resources/splash_screen.bmp" );
QSplashScreen splash( pixmap ); QSplashScreen splash( pixmap );
splash.show(); splash.show();
CSystem::GetInstance().config.load( "client.cfg" ); CSystem::GetInstance().config.load( "client.cfg" );
CClientConfigDialog d; CClientConfigDialog d;
d.show(); d.show();
splash.finish( &d ); splash.finish( &d );
return app.exec(); return app.exec();
} }

@ -1,99 +1,99 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "sound_settings_widget.h" #include "sound_settings_widget.h"
#include "system.h" #include "system.h"
CSoundSettingsWidget::CSoundSettingsWidget( QWidget *parent ) : CSoundSettingsWidget::CSoundSettingsWidget( QWidget *parent ) :
CWidgetBase( parent ) CWidgetBase( parent )
{ {
setupUi( this ); setupUi( this );
load(); load();
connect( tracksSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onTracksSliderChange() ) ); connect( tracksSlider, SIGNAL( valueChanged( int ) ), this, SLOT( onTracksSliderChange() ) );
connect( soundCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( soundCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
connect( eaxCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( eaxCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
connect( softwareCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( softwareCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
connect( fmodCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) ); connect( fmodCheckBox, SIGNAL( clicked( bool ) ), this, SLOT( onSomethingChanged() ) );
} }
CSoundSettingsWidget::~CSoundSettingsWidget() CSoundSettingsWidget::~CSoundSettingsWidget()
{ {
} }
void CSoundSettingsWidget::onTracksSliderChange() void CSoundSettingsWidget::onTracksSliderChange()
{ {
updateTracksLabel(); updateTracksLabel();
emit changed(); emit changed();
} }
void CSoundSettingsWidget::load() void CSoundSettingsWidget::load()
{ {
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
if( s.config.getInt( "SoundOn" ) == 1 ) if( s.config.getInt( "SoundOn" ) == 1 )
soundCheckBox->setChecked( true ); soundCheckBox->setChecked( true );
if( s.config.getInt( "UseEax" ) == 1 ) if( s.config.getInt( "UseEax" ) == 1 )
eaxCheckBox->setChecked( true ); eaxCheckBox->setChecked( true );
if( s.config.getInt( "SoundForceSoftwareBuffer" ) == 1 ) if( s.config.getInt( "SoundForceSoftwareBuffer" ) == 1 )
softwareCheckBox->setChecked( true ); softwareCheckBox->setChecked( true );
sint32 tracks = s.config.getInt( "MaxTrack" ); sint32 tracks = s.config.getInt( "MaxTrack" );
if( tracks < 4 ) if( tracks < 4 )
tracks = 4; tracks = 4;
if( tracks > 32 ) if( tracks > 32 )
tracks = 32; tracks = 32;
tracksSlider->setValue( tracks / 4 ); tracksSlider->setValue( tracks / 4 );
if( s.config.getString( "DriverSound" ).compare( "FMod" ) == 0 ) if( s.config.getString( "DriverSound" ).compare( "FMod" ) == 0 )
fmodCheckBox->setChecked( true ); fmodCheckBox->setChecked( true );
} }
void CSoundSettingsWidget::save() void CSoundSettingsWidget::save()
{ {
CSystem &s = CSystem::GetInstance(); CSystem &s = CSystem::GetInstance();
if( soundCheckBox->isChecked() ) if( soundCheckBox->isChecked() )
s.config.setInt( "SoundOn", 1 ); s.config.setInt( "SoundOn", 1 );
if( eaxCheckBox->isChecked() ) if( eaxCheckBox->isChecked() )
s.config.setInt( "UseEax", 1 ); s.config.setInt( "UseEax", 1 );
if( softwareCheckBox->isChecked() ) if( softwareCheckBox->isChecked() )
s.config.setInt( "SoundForceSoftwareBuffer", 1 ); s.config.setInt( "SoundForceSoftwareBuffer", 1 );
s.config.setInt( "MaxTrack", tracksSlider->value() * 4 ); s.config.setInt( "MaxTrack", tracksSlider->value() * 4 );
if( fmodCheckBox->isChecked() ) if( fmodCheckBox->isChecked() )
s.config.setString( "DriverSound", std::string( "FMod" ) ); s.config.setString( "DriverSound", std::string( "FMod" ) );
} }
void CSoundSettingsWidget::changeEvent( QEvent *event ) void CSoundSettingsWidget::changeEvent( QEvent *event )
{ {
if( event->type() == QEvent::LanguageChange ) if( event->type() == QEvent::LanguageChange )
{ {
retranslateUi( this ); retranslateUi( this );
updateTracksLabel(); updateTracksLabel();
} }
QWidget::changeEvent( event ); QWidget::changeEvent( event );
} }
void CSoundSettingsWidget::updateTracksLabel() void CSoundSettingsWidget::updateTracksLabel()
{ {
tracksLabel->setText( tr( "%1 tracks" ).arg( tracksSlider->value() * 4 ) ); tracksLabel->setText( tr( "%1 tracks" ).arg( tracksSlider->value() * 4 ) );
} }

@ -1,50 +1,50 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SOUNDSETTINGSWIDGET_H #ifndef SOUNDSETTINGSWIDGET_H
#define SOUNDSETTINGSWIDGET_H #define SOUNDSETTINGSWIDGET_H
#include "ui_sound_settings_widget.h" #include "ui_sound_settings_widget.h"
#include "widget_base.h" #include "widget_base.h"
#include <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
/** /**
@brief The sound settings page of the configuration tool @brief The sound settings page of the configuration tool
*/ */
class CSoundSettingsWidget : public CWidgetBase, public Ui::sound_settings_widget class CSoundSettingsWidget : public CWidgetBase, public Ui::sound_settings_widget
{ {
Q_OBJECT Q_OBJECT
public: public:
CSoundSettingsWidget( QWidget *parent = NULL ); CSoundSettingsWidget( QWidget *parent = NULL );
~CSoundSettingsWidget(); ~CSoundSettingsWidget();
void load(); void load();
void save(); void save();
protected: protected:
void changeEvent( QEvent *event ); void changeEvent( QEvent *event );
private slots: private slots:
void onTracksSliderChange(); void onTracksSliderChange();
private: private:
/** /**
@brief Updates the text on the tracks label. @brief Updates the text on the tracks label.
*/ */
void updateTracksLabel(); void updateTracksLabel();
}; };
#endif // SOUNDSETTINGSWIDGET_H #endif // SOUNDSETTINGSWIDGET_H

@ -1,41 +1,41 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "sys_info_d3d_widget.h" #include "sys_info_d3d_widget.h"
#include "system.h" #include "system.h"
CSysInfoD3DWidget::CSysInfoD3DWidget( QWidget *parent ) : CSysInfoD3DWidget::CSysInfoD3DWidget( QWidget *parent ) :
QWidget( parent ) QWidget( parent )
{ {
setupUi( this ); setupUi( this );
descriptionLabel->setText( CSystem::GetInstance().d3dInfo.device.c_str() ); descriptionLabel->setText( CSystem::GetInstance().d3dInfo.device.c_str() );
driverLabel->setText( CSystem::GetInstance().d3dInfo.driver.c_str() ); driverLabel->setText( CSystem::GetInstance().d3dInfo.driver.c_str() );
versionLabel->setText( CSystem::GetInstance().d3dInfo.driverVersion.c_str() ); versionLabel->setText( CSystem::GetInstance().d3dInfo.driverVersion.c_str() );
} }
CSysInfoD3DWidget::~CSysInfoD3DWidget() CSysInfoD3DWidget::~CSysInfoD3DWidget()
{ {
} }
void CSysInfoD3DWidget::changeEvent( QEvent *event ) void CSysInfoD3DWidget::changeEvent( QEvent *event )
{ {
if( event->type() == QEvent::LanguageChange ) if( event->type() == QEvent::LanguageChange )
{ {
retranslateUi( this ); retranslateUi( this );
} }
QWidget::changeEvent( event ); QWidget::changeEvent( event );
} }

@ -1,39 +1,39 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SYSINFOD3DWIDGET_H #ifndef SYSINFOD3DWIDGET_H
#define SYSINFOD3DWIDGET_H #define SYSINFOD3DWIDGET_H
#include "ui_sys_Info_d3d_widget.h" #include "ui_sys_Info_d3d_widget.h"
/** /**
@brief The Direct3D information page of the configuration tool @brief The Direct3D information page of the configuration tool
*/ */
class CSysInfoD3DWidget : public QWidget, public Ui::sys_info_d3d_widget class CSysInfoD3DWidget : public QWidget, public Ui::sys_info_d3d_widget
{ {
Q_OBJECT Q_OBJECT
public: public:
CSysInfoD3DWidget( QWidget *parent = NULL ); CSysInfoD3DWidget( QWidget *parent = NULL );
~CSysInfoD3DWidget(); ~CSysInfoD3DWidget();
protected: protected:
void changeEvent( QEvent *event ); void changeEvent( QEvent *event );
}; };
#endif // SYSINFOD3DWIDGET_H #endif // SYSINFOD3DWIDGET_H

@ -1,42 +1,42 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "sys_info_opengl_widget.h" #include "sys_info_opengl_widget.h"
#include "system.h" #include "system.h"
CSysInfoOpenGLWidget::CSysInfoOpenGLWidget( QWidget *parent ) : CSysInfoOpenGLWidget::CSysInfoOpenGLWidget( QWidget *parent ) :
QWidget( parent ) QWidget( parent )
{ {
setupUi( this ); setupUi( this );
vendorLabel->setText( CSystem::GetInstance().openglInfo.vendor.c_str() ); vendorLabel->setText( CSystem::GetInstance().openglInfo.vendor.c_str() );
rendererLabel->setText( CSystem::GetInstance().openglInfo.renderer.c_str() ); rendererLabel->setText( CSystem::GetInstance().openglInfo.renderer.c_str() );
versionLabel->setText( CSystem::GetInstance().openglInfo.driverVersion.c_str() ); versionLabel->setText( CSystem::GetInstance().openglInfo.driverVersion.c_str() );
extensionsBox->setPlainText( CSystem::GetInstance().openglInfo.extensions.c_str() ); extensionsBox->setPlainText( CSystem::GetInstance().openglInfo.extensions.c_str() );
} }
CSysInfoOpenGLWidget::~CSysInfoOpenGLWidget() CSysInfoOpenGLWidget::~CSysInfoOpenGLWidget()
{ {
} }
void CSysInfoOpenGLWidget::changeEvent( QEvent *event ) void CSysInfoOpenGLWidget::changeEvent( QEvent *event )
{ {
if( event->type() == QEvent::LanguageChange ) if( event->type() == QEvent::LanguageChange )
{ {
retranslateUi( this ); retranslateUi( this );
} }
QWidget::changeEvent( event ); QWidget::changeEvent( event );
} }

@ -1,38 +1,38 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SYSINFOOPENGLWIDGET_H #ifndef SYSINFOOPENGLWIDGET_H
#define SYSINFOOPENGLWIDGET_H #define SYSINFOOPENGLWIDGET_H
#include "ui_sys_info_opengl_widget.h" #include "ui_sys_info_opengl_widget.h"
/** /**
@brief The OpenGL information page of the configuration tool @brief The OpenGL information page of the configuration tool
*/ */
class CSysInfoOpenGLWidget : public QWidget, public Ui::sys_info_opengl_widget class CSysInfoOpenGLWidget : public QWidget, public Ui::sys_info_opengl_widget
{ {
Q_OBJECT Q_OBJECT
public: public:
CSysInfoOpenGLWidget( QWidget *parent = NULL ); CSysInfoOpenGLWidget( QWidget *parent = NULL );
~CSysInfoOpenGLWidget(); ~CSysInfoOpenGLWidget();
protected: protected:
void changeEvent( QEvent *event ); void changeEvent( QEvent *event );
}; };
#endif // SYSINFOOPENGLWIDGET_H #endif // SYSINFOOPENGLWIDGET_H

@ -1,46 +1,46 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "sys_info_widget.h" #include "sys_info_widget.h"
#include "system.h" #include "system.h"
CSysInfoWidget::CSysInfoWidget( QWidget *parent ) : CSysInfoWidget::CSysInfoWidget( QWidget *parent ) :
QWidget( parent ) QWidget( parent )
{ {
setupUi( this ); setupUi( this );
osLabel->setText( CSystem::GetInstance().sysInfo.osName.c_str() ); osLabel->setText( CSystem::GetInstance().sysInfo.osName.c_str() );
cpuLabel->setText( CSystem::GetInstance().sysInfo.cpuName.c_str() ); cpuLabel->setText( CSystem::GetInstance().sysInfo.cpuName.c_str() );
ramLabel->setText( ramLabel->setText(
QString().setNum( CSystem::GetInstance().sysInfo.totalRAM ).append( " Mb" ) ); QString().setNum( CSystem::GetInstance().sysInfo.totalRAM ).append( " Mb" ) );
gfxcardLabel->setText( CSystem::GetInstance().sysInfo.videoDevice.c_str() ); gfxcardLabel->setText( CSystem::GetInstance().sysInfo.videoDevice.c_str() );
gfxdriverLabel->setText( CSystem::GetInstance().sysInfo.videoDriverVersion.c_str() ); gfxdriverLabel->setText( CSystem::GetInstance().sysInfo.videoDriverVersion.c_str() );
} }
CSysInfoWidget::~CSysInfoWidget() CSysInfoWidget::~CSysInfoWidget()
{ {
} }
void CSysInfoWidget::changeEvent( QEvent *event ) void CSysInfoWidget::changeEvent( QEvent *event )
{ {
if( event->type() == QEvent::LanguageChange ) if( event->type() == QEvent::LanguageChange )
{ {
retranslateUi( this ); retranslateUi( this );
} }
QWidget::changeEvent( event ); QWidget::changeEvent( event );
} }

@ -1,38 +1,38 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SYSINFOWIDGET_H #ifndef SYSINFOWIDGET_H
#define SYSINFOWIDGET_H #define SYSINFOWIDGET_H
#include "ui_sys_info_widget.h" #include "ui_sys_info_widget.h"
/** /**
@brief The system information page of the configuration tool @brief The system information page of the configuration tool
*/ */
class CSysInfoWidget : public QWidget, public Ui::sys_info_widget class CSysInfoWidget : public QWidget, public Ui::sys_info_widget
{ {
Q_OBJECT Q_OBJECT
public: public:
CSysInfoWidget( QWidget *parent = NULL ); CSysInfoWidget( QWidget *parent = NULL );
~CSysInfoWidget(); ~CSysInfoWidget();
protected: protected:
void changeEvent( QEvent *event ); void changeEvent( QEvent *event );
}; };
#endif // SYSINFOWIDGET_H #endif // SYSINFOWIDGET_H

@ -1,181 +1,181 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "system.h" #include "system.h"
#include <sstream> #include <sstream>
#include <nel/3d/driver.h> #include <nel/3d/driver.h>
#include <nel/3d/dru.h> #include <nel/3d/dru.h>
#include <QtOpenGL/QGLWidget> #include <QtOpenGL/QGLWidget>
CSystem *CSystem::instance = NULL; CSystem *CSystem::instance = NULL;
CSystem::CSystem() CSystem::CSystem()
{ {
GatherSysInfo(); GatherSysInfo();
#ifdef WIN32 #ifdef WIN32
GatherD3DInfo(); GatherD3DInfo();
#endif #endif
GatherOpenGLInfo(); GatherOpenGLInfo();
} }
CSystem::~CSystem() CSystem::~CSystem()
{ {
instance = 0; instance = 0;
} }
void CSystem::GatherSysInfo() void CSystem::GatherSysInfo()
{ {
std::string device; std::string device;
uint64 driver; uint64 driver;
if( NLMISC::CSystemInfo::getVideoInfo( device, driver ) ) if( NLMISC::CSystemInfo::getVideoInfo( device, driver ) )
{ {
sysInfo.videoDevice = device; sysInfo.videoDevice = device;
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// FIXME // FIXME
// This is taken from the original configuration tool, and // This is taken from the original configuration tool, and
// it generates the same *wrong* version number // it generates the same *wrong* version number
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
uint32 version = static_cast< uint32 >( driver & 0xffff ); uint32 version = static_cast< uint32 >( driver & 0xffff );
std::stringstream ss; std::stringstream ss;
ss << ( version / 1000 % 10 ); ss << ( version / 1000 % 10 );
ss << "."; ss << ".";
ss << ( version / 100 % 10 ); ss << ( version / 100 % 10 );
ss << "."; ss << ".";
ss << ( version / 10 % 10 ); ss << ( version / 10 % 10 );
ss << "."; ss << ".";
ss << ( version % 10 ); ss << ( version % 10 );
sysInfo.videoDriverVersion = ss.str(); sysInfo.videoDriverVersion = ss.str();
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
} }
else else
{ {
sysInfo.videoDevice = "video card"; sysInfo.videoDevice = "video card";
sysInfo.videoDriverVersion = "0.0.0.0"; sysInfo.videoDriverVersion = "0.0.0.0";
} }
sysInfo.osName = NLMISC::CSystemInfo::getOS(); sysInfo.osName = NLMISC::CSystemInfo::getOS();
sysInfo.cpuName = NLMISC::CSystemInfo::getProc(); sysInfo.cpuName = NLMISC::CSystemInfo::getProc();
sysInfo.totalRAM = NLMISC::CSystemInfo::totalPhysicalMemory(); sysInfo.totalRAM = NLMISC::CSystemInfo::totalPhysicalMemory();
sysInfo.totalRAM /= ( 1024 * 1024 ); sysInfo.totalRAM /= ( 1024 * 1024 );
} }
#ifdef WIN32 #ifdef WIN32
void CSystem::GatherD3DInfo() void CSystem::GatherD3DInfo()
{ {
NL3D::IDriver *driver = NULL; NL3D::IDriver *driver = NULL;
try try
{ {
driver = NL3D::CDRU::createD3DDriver(); driver = NL3D::CDRU::createD3DDriver();
NL3D::IDriver::CAdapter adapter; NL3D::IDriver::CAdapter adapter;
if( driver->getAdapter( 0xffffffff, adapter ) ) if( driver->getAdapter( 0xffffffff, adapter ) )
{ {
d3dInfo.device = adapter.Description; d3dInfo.device = adapter.Description;
d3dInfo.driver = adapter.Driver; d3dInfo.driver = adapter.Driver;
sint64 ver = adapter.DriverVersion; sint64 ver = adapter.DriverVersion;
std::stringstream ss; std::stringstream ss;
ss << static_cast< uint16 >( ver >> 48 ); ss << static_cast< uint16 >( ver >> 48 );
ss << "."; ss << ".";
ss << static_cast< uint16 >( ver >> 32 ); ss << static_cast< uint16 >( ver >> 32 );
ss << "."; ss << ".";
ss << static_cast< uint16 >( ver >> 16 ); ss << static_cast< uint16 >( ver >> 16 );
ss << "."; ss << ".";
ss << static_cast< uint16 >( ver & 0xFFFF ); ss << static_cast< uint16 >( ver & 0xFFFF );
d3dInfo.driverVersion = ss.str(); d3dInfo.driverVersion = ss.str();
} }
GetVideoModes( d3dInfo.modes, driver ); GetVideoModes( d3dInfo.modes, driver );
driver->release(); driver->release();
} }
catch( NLMISC::Exception &e ) catch( NLMISC::Exception &e )
{ {
nlwarning( e.what() ); nlwarning( e.what() );
} }
} }
#endif #endif
void CSystem::GatherOpenGLInfo() void CSystem::GatherOpenGLInfo()
{ {
QGLWidget *gl = new QGLWidget(); QGLWidget *gl = new QGLWidget();
gl->makeCurrent(); gl->makeCurrent();
const char *s = NULL; const char *s = NULL;
s = reinterpret_cast< const char * >( glGetString( GL_VENDOR ) ); s = reinterpret_cast< const char * >( glGetString( GL_VENDOR ) );
if( s != NULL ) if( s != NULL )
openglInfo.vendor.assign( s ); openglInfo.vendor.assign( s );
s = reinterpret_cast< const char * >( glGetString( GL_RENDERER ) ); s = reinterpret_cast< const char * >( glGetString( GL_RENDERER ) );
if( s != NULL ) if( s != NULL )
openglInfo.renderer.assign( s ); openglInfo.renderer.assign( s );
s = reinterpret_cast< const char * >( glGetString( GL_VERSION ) ); s = reinterpret_cast< const char * >( glGetString( GL_VERSION ) );
if( s != NULL ) if( s != NULL )
openglInfo.driverVersion.assign( s ); openglInfo.driverVersion.assign( s );
s = reinterpret_cast< const char * >( glGetString( GL_EXTENSIONS ) ); s = reinterpret_cast< const char * >( glGetString( GL_EXTENSIONS ) );
if( s != NULL ) if( s != NULL )
{ {
openglInfo.extensions.assign( s ); openglInfo.extensions.assign( s );
for( std::string::iterator itr = openglInfo.extensions.begin(); itr != openglInfo.extensions.end(); ++itr ) for( std::string::iterator itr = openglInfo.extensions.begin(); itr != openglInfo.extensions.end(); ++itr )
if( *itr == ' ' ) if( *itr == ' ' )
*itr = '\n'; *itr = '\n';
} }
delete gl; delete gl;
NL3D::IDriver *driver = NULL; NL3D::IDriver *driver = NULL;
try try
{ {
driver = NL3D::CDRU::createGlDriver(); driver = NL3D::CDRU::createGlDriver();
GetVideoModes( openglInfo.modes, driver ); GetVideoModes( openglInfo.modes, driver );
driver->release(); driver->release();
} }
catch( NLMISC::Exception &e ) catch( NLMISC::Exception &e )
{ {
nlwarning( e.what() ); nlwarning( e.what() );
} }
} }
void CSystem::GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driver ) const void CSystem::GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driver ) const
{ {
std::vector< NL3D::GfxMode > modes; std::vector< NL3D::GfxMode > modes;
driver->getModes( modes ); driver->getModes( modes );
for( std::vector< NL3D::GfxMode >::iterator itr = modes.begin(); itr != modes.end(); ++itr ) for( std::vector< NL3D::GfxMode >::iterator itr = modes.begin(); itr != modes.end(); ++itr )
{ {
if( ( itr->Width >= 800 ) && ( itr->Height >= 600 ) && ( itr->Depth == 32 ) && ( itr->Frequency >= 60 ) ) if( ( itr->Width >= 800 ) && ( itr->Height >= 600 ) && ( itr->Depth == 32 ) && ( itr->Frequency >= 60 ) )
{ {
CVideoMode mode; CVideoMode mode;
mode.depth = itr->Depth; mode.depth = itr->Depth;
mode.widht = itr->Width; mode.widht = itr->Width;
mode.height = itr->Height; mode.height = itr->Height;
mode.frequency = itr->Frequency; mode.frequency = itr->Frequency;
dst.push_back( mode ); dst.push_back( mode );
} }
} }
} }

@ -1,112 +1,112 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SYSTEM_H #ifndef SYSTEM_H
#define SYSTEM_H #define SYSTEM_H
#include <nel/misc/system_info.h> #include <nel/misc/system_info.h>
#include "config.h" #include "config.h"
namespace NL3D namespace NL3D
{ {
class IDriver; class IDriver;
} }
struct CVideoMode struct CVideoMode
{ {
unsigned int widht; unsigned int widht;
unsigned int height; unsigned int height;
unsigned int depth; unsigned int depth;
unsigned int frequency; unsigned int frequency;
CVideoMode() CVideoMode()
{ {
widht = 0; widht = 0;
height = 0; height = 0;
depth = 0; depth = 0;
frequency = 0; frequency = 0;
} }
bool operator==( CVideoMode &o ) bool operator==( CVideoMode &o )
{ {
if( ( o.widht == widht ) && ( o.height == height ) && ( o.depth == depth ) && ( o.frequency == frequency ) ) if( ( o.widht == widht ) && ( o.height == height ) && ( o.depth == depth ) && ( o.frequency == frequency ) )
return true; return true;
else else
return false; return false;
} }
}; };
/** /**
@brief Singleton class that holds the system information, configs, etc @brief Singleton class that holds the system information, configs, etc
*/ */
class CSystem class CSystem
{ {
public: public:
CSystem(); CSystem();
~CSystem(); ~CSystem();
static CSystem &GetInstance() static CSystem &GetInstance()
{ {
if( instance == 0 ) if( instance == 0 )
{ {
instance = new CSystem; instance = new CSystem;
} }
return *instance; return *instance;
} }
struct CSysInfo struct CSysInfo
{ {
std::string videoDevice; std::string videoDevice;
std::string videoDriverVersion; std::string videoDriverVersion;
std::string osName; std::string osName;
std::string cpuName; std::string cpuName;
uint64 totalRAM; uint64 totalRAM;
} sysInfo; } sysInfo;
#ifdef WIN32 #ifdef WIN32
struct CD3DInfo struct CD3DInfo
{ {
std::string device; std::string device;
std::string driver; std::string driver;
std::string driverVersion; std::string driverVersion;
std::vector< CVideoMode > modes; std::vector< CVideoMode > modes;
} d3dInfo; } d3dInfo;
#endif #endif
struct COpenGLInfo struct COpenGLInfo
{ {
std::string vendor; std::string vendor;
std::string renderer; std::string renderer;
std::string driverVersion; std::string driverVersion;
std::string extensions; std::string extensions;
std::vector< CVideoMode > modes; std::vector< CVideoMode > modes;
} openglInfo; } openglInfo;
CConfig config; CConfig config;
private: private:
void GatherSysInfo(); void GatherSysInfo();
#ifdef WIN32 #ifdef WIN32
void GatherD3DInfo(); void GatherD3DInfo();
#endif #endif
void GatherOpenGLInfo(); void GatherOpenGLInfo();
void GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driver ) const; void GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driver ) const;
static CSystem *instance; static CSystem *instance;
}; };
#endif // SYSTEM_H #endif // SYSTEM_H

@ -1,61 +1,61 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef WIDGETBASE_H #ifndef WIDGETBASE_H
#define WIDGETBASE_H #define WIDGETBASE_H
#include <QWidget> #include <QWidget>
/** /**
@brief Base class for the config tool's settings page widgets. @brief Base class for the config tool's settings page widgets.
*/ */
class CWidgetBase : public QWidget class CWidgetBase : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
CWidgetBase( QWidget *parent = NULL ) : QWidget( parent ) {} CWidgetBase( QWidget *parent = NULL ) : QWidget( parent ) {}
~CWidgetBase() {} ~CWidgetBase() {}
/** /**
@brief Tells the widget to load it's values from the config. @brief Tells the widget to load it's values from the config.
*/ */
virtual void load() = 0; virtual void load() = 0;
/** /**
@brief Tells the widget to save it's values into the config. @brief Tells the widget to save it's values into the config.
*/ */
virtual void save() = 0; virtual void save() = 0;
signals: signals:
/** /**
@brief Emitted when the user changes a setting. @brief Emitted when the user changes a setting.
*/ */
void changed(); void changed();
private slots: private slots:
/** /**
@brief Triggered when something changes in the widget, emits the Changed() signal. @brief Triggered when something changes in the widget, emits the Changed() signal.
*/ */
void onSomethingChanged() void onSomethingChanged()
{ {
emit changed(); emit changed();
} }
}; };
#endif #endif

@ -69,7 +69,7 @@
{ {
$nel_user = null; $nel_user = null;
nt_auth_stop_session(); nt_auth_stop_session();
nt_common_redirect('index.php'); nt_common_redirect('');
exit(); exit();
} }
elseif (isset($NELTOOL['SESSION_VARS']['nelid']) && !empty($NELTOOL['SESSION_VARS']['nelid'])) elseif (isset($NELTOOL['SESSION_VARS']['nelid']) && !empty($NELTOOL['SESSION_VARS']['nelid']))
@ -138,9 +138,12 @@
if (isset($nel_user['new_login'])) if (isset($nel_user['new_login']))
{ {
$default_user_application_id = 0; $default_user_application_id = 0;
if ($nel_user['user_default_application_id'] > 0) $default_user_application_id = $nel_user['user_default_application_id']; if (isset( $nel_user['user_default_application_id']) &&($nel_user['user_default_application_id'] > 0)) {
elseif ($nel_user['group_default_application_id'] > 0) $default_user_application_id = $nel_user['group_default_application_id']; $default_user_application_id = $nel_user['user_default_application_id'];
}elseif (isset( $nel_user['group_default_application_id']) &&($nel_user['group_default_application_id'] > 0)) {
$default_user_application_id = $nel_user['group_default_application_id'];
}
if ($default_user_application_id > 0) if ($default_user_application_id > 0)
{ {
nt_common_add_debug("default application : user:". $nel_user['user_default_application_id'] ." group:". $nel_user['group_default_application_id']); nt_common_add_debug("default application : user:". $nel_user['user_default_application_id'] ." group:". $nel_user['group_default_application_id']);

@ -9,8 +9,8 @@
define('NELTOOL_DBNAME','nel_tool'); define('NELTOOL_DBNAME','nel_tool');
// site paths definitions // site paths definitions
define('NELTOOL_SITEBASE','http://open.ryzom.com/'); define('NELTOOL_SITEBASE',$_SERVER['PHP_SELF']);
define('NELTOOL_SYSTEMBASE','/home/nevrax/hg/code/ryzom/tools/server/admin/'); define('NELTOOL_SYSTEMBASE',dirname( dirname(__FILE__) ) . '/admin/');
define('NELTOOL_LOGBASE', NELTOOL_SYSTEMBASE .'/logs/'); define('NELTOOL_LOGBASE', NELTOOL_SYSTEMBASE .'/logs/');
define('NELTOOL_IMGBASE', NELTOOL_SYSTEMBASE .'/imgs/'); define('NELTOOL_IMGBASE', NELTOOL_SYSTEMBASE .'/imgs/');

@ -114,7 +114,7 @@ class sql_db
} }
else else
{ {
return ( $transaction == END_TRANSACTION ) ? true : false; return ( $transaction == 'END_TRANSACTION' ) ? true : false;
} }
} }

@ -1,12 +1,12 @@
<?php <?php
$refresh_rates = array( /* // there values are for debug purposes only $refresh_rates = array(
array('desc' => 'Every 5 secs', array('desc' => 'Every 5 secs',
'secs' => 5, 'secs' => 5,
), ),
array('desc' => 'Every 30 secs', array('desc' => 'Every 30 secs',
'secs' => 30, 'secs' => 30,
),*/ ),
array('desc' => 'Every 1 min.', array('desc' => 'Every 1 min.',
'secs' => 60, 'secs' => 60,
), ),

@ -9,7 +9,7 @@
$tpl->assign("tool_v_login", $nel_user['user_name']); $tpl->assign("tool_v_login", $nel_user['user_name']);
$tpl->assign("tool_v_user_id", $nel_user['user_id']); $tpl->assign("tool_v_user_id", $nel_user['user_id']);
$tpl->assign("tool_v_menu", $nel_user['user_menu_style']); $tpl->assign("tool_v_menu", $nel_user['user_menu_style']);
$tpl->assign("tool_v_application", $nel_user['user_default_application_id']); $tpl->assign("tool_v_application", isset($nel_user['user_default_application_id']) ? $nel_user['user_default_application_id']:'') ;
if (isset($NELTOOL['POST_VARS']['tool_form_user_id'])) if (isset($NELTOOL['POST_VARS']['tool_form_user_id']))
{ {

@ -2,7 +2,7 @@
// This file contains all variables needed by other php scripts // This file contains all variables needed by other php scripts
$LogRelativePath = './'; $LogRelativePath = 'logs/';
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// Variables for nel database access // Variables for nel database access

Loading…
Cancel
Save