Changed: #1193 Removed nel configuration module, is used only QSettings.
parent
f4040f6c1b
commit
3e00576cc0
@ -1,29 +0,0 @@
|
||||
RootConfigFilename = "object_viewer_default.cfg";
|
||||
SearchPaths = {
|
||||
"/mnt/disk_d/NEL3D/texture", "/mnt/disk_d/NEL3D/SFX/maps", "/mnt/disk_d/NEL3D/Database_proto/Stuff/fyros/agent/actors/_textures"
|
||||
};
|
||||
GraphicsEnabled = 1;
|
||||
SoundEnabled = 1;
|
||||
GraphicsDriver = "OpenGL";
|
||||
SoundDriver = "OpenAL";
|
||||
SoundDevice = "";
|
||||
LanguageCode = "en";
|
||||
QtStyle = "";
|
||||
FontName = "andbasr.ttf";
|
||||
FontShadow = 1;
|
||||
BackgroundColor = {
|
||||
98, 98, 98
|
||||
};
|
||||
FogStart = 0.0000000000;
|
||||
FogEnd = 10.0000000000;
|
||||
FogColor = {
|
||||
88, 88, 88
|
||||
};
|
||||
SoundAutoLoadSample = 1;
|
||||
SoundMaxTrack = 48;
|
||||
SoundEnableOccludeObstruct = 1;
|
||||
SoundEnableReverb = 1;
|
||||
SoundManualRolloff = 1;
|
||||
SoundUseADPCM = 0;
|
||||
SoundForceSoftware = 0;
|
||||
CameraFocal = 75.0000000000;
|
@ -1,156 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Config file for Object Viewer Qt ////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// This file is used to setup the Object Viewer tool.
|
||||
//
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// NeL Qt ////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Root directory where we can find the client datas (zones, tiles, maps, ...)
|
||||
// You must uncomment this line on GNU/Linux and comment the next one
|
||||
//SearchPaths = { "/usr/local/share/games/nel_qt/" };
|
||||
SearchPaths = { "data" };
|
||||
|
||||
// Which extensions to remap to what if needed (pairs of 2)
|
||||
RemapExtensions = { "png", "tga", "dds", "tga"};
|
||||
|
||||
|
||||
// The language code of the client
|
||||
LanguageCode = "en";
|
||||
|
||||
// If changes to the config should be saved on exit
|
||||
SaveConfig = 1;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Qt ////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
QtStyle = "Cleanlooks";
|
||||
QtPalette = 0;
|
||||
QtWindowState = "";
|
||||
QtWindowGeometry = "";
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Graphics //////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Use OpenGL or Direct3D (Windows)
|
||||
GraphicsEnabled = 1;
|
||||
GraphicsDrivers = { "OpenGL", "Direct3D" };
|
||||
GraphicsDriver = "OpenGL";
|
||||
|
||||
// Resolution of the screen
|
||||
// ScreenWidth = 1360;
|
||||
// ScreenHeight = 768;
|
||||
// ScreenDepth = 32;
|
||||
|
||||
// If 1, run in fullscreen mode, 0 for windowed
|
||||
// Fullscreen = 0;
|
||||
|
||||
// Font name used for all text in the client (it can be a .ttf, .fon, .pfb)
|
||||
FontName = "andbasr.ttf";
|
||||
FontShadow = 1;
|
||||
|
||||
// Background color
|
||||
BackgroundColor = { 151, 156, 182 };
|
||||
|
||||
// Bloom effect
|
||||
BloomEffect = 1;
|
||||
BloomSquare = 1;
|
||||
BloomDensity = 120;
|
||||
|
||||
// Path where screenshots are saved
|
||||
ScreenshotName = "nel_qt";
|
||||
ScreenshotJPG = 1;
|
||||
ScreenshotPNG = 1;
|
||||
ScreenshotTGA = 0;
|
||||
ScreenshotPath = "screenshots";
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Environment ///////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CameraFocal = 75.0;
|
||||
|
||||
SunDirection = { -2.935, +0.107, -1.22 };
|
||||
SunAmbient = { 190, 170, 150 };
|
||||
SunDiffuse = { 255, 248, 255 };
|
||||
SunSpecular = { 255, 255, 255};
|
||||
|
||||
// 1 if you want to see the fog
|
||||
FogEnable = 1;
|
||||
FogStart = 100.0; // in meter
|
||||
FogEnd = 250.0; // in meter
|
||||
FogColor = { 129, 136, 205 }; // { 147, 125, 114 };
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
//// Vegetable Landscape Setup (for vegetable edition) //////
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
VegetTileBank = ""; // this is optional, but obligatory for Vegetable Edit to work properly
|
||||
VegetTileFarBank = ""; // this is optional, but obligatory for Vegetable Edit to work properly
|
||||
VegetLandscapeZones = // this is optional, but obligatory for Vegetable Edit to work properly
|
||||
{
|
||||
"WARNING: Delete this string" // NOT DELETE
|
||||
};
|
||||
|
||||
VegetLandscapeThreshold = 0.01; // this is optional
|
||||
VegetLandscapeTileNear = 50.0; // this is optional
|
||||
VegetLandscapeAmbient = {17, 54, 100, 255} ; // this is optional
|
||||
VegetLandscapeDiffuse = {241, 226, 244, 255} ; // this is optional
|
||||
VegetLandscapeSnapHeight = 1.70; // this is optional
|
||||
VegetLandscapeMultiply = 1.5;
|
||||
|
||||
// veget setup
|
||||
VegetTexture = ""; // this is optional, but important for Vegetable Edit to behave properly
|
||||
VegetAmbient = {80, 80, 80}; // this is optional
|
||||
VegetDiffuse = {255, 255, 255}; // this is optional. NB: works like veget_landscape_diffuse (ie maxLightFactor possible)
|
||||
VegetLightDir = {0.0, 1.0, -1.0}; // this is optional
|
||||
VegetWindDir = {1.0, 1.0, 0.0}; // this is optional
|
||||
VegetWindFreq = 0.5; // this is optional
|
||||
VegetWindPower = 5.0; // this is optional
|
||||
VegetWindBendMin = 0.5; // this is optional
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Time //////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FpsSmoothing = 64;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Sound /////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// The sound driver, choose between "Auto", "FMod", "DSound" and "OpenAl"
|
||||
SoundEnabled = 1;
|
||||
SoundDrivers = { "Auto", "OpenAL", "XAudio2", "FMod", "DSound" };
|
||||
SoundDriver = "OpenAL";
|
||||
SoundDevice = "";
|
||||
SoundMaxTrack = 48;
|
||||
SoundEnableOccludeObstruct = 1;
|
||||
SoundEnableReverb = 1;
|
||||
SoundManualRolloff = 1;
|
||||
SoundUseADPCM = 0;
|
||||
SoundForceSoftware = 0;
|
||||
SoundAutoLoadSample = 1;
|
||||
|
||||
SoundPackedSheetPath = "/home/timon/sound";
|
||||
SoundSamplePath = "/home/timon/sound";
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Interface /////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Debug HUD /////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// end of file
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 by authors
|
||||
*
|
||||
* This file is part of NEL QT.
|
||||
* NEL QT is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* NEL QT is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with NEL QT; see the file COPYING. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "stdpch.h"
|
||||
#include "callback.h"
|
||||
|
||||
namespace NLQT
|
||||
{
|
||||
|
||||
} /* namespace NLQT */
|
||||
|
||||
/* end of file */
|
@ -1,327 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 by authors
|
||||
*
|
||||
* This file is part of NEL QT.
|
||||
* NEL QT is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* NEL QT is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with NEL QT; see the file COPYING. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef NLQT_CALLBACK_H
|
||||
#define NLQT_CALLBACK_H
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
// STL includes
|
||||
|
||||
// NeL includes
|
||||
#ifdef NL_COMP_GCC
|
||||
// temporary fix for GCC 4.4 segmentation fault
|
||||
# undef nlassert
|
||||
# define nlassert(x)
|
||||
#else
|
||||
# include <nel/misc/debug.h>
|
||||
#endif // NL_COMP_GCC
|
||||
|
||||
// Project includes
|
||||
|
||||
namespace NLQT
|
||||
{
|
||||
|
||||
#define NLQT_CALLBACK_TEMPLATE \
|
||||
/** \
|
||||
* \brief NLQT_CALLBACK_ARGS_CLASS \
|
||||
* \date 2009-03-03 18:09GMT \
|
||||
* \author Jan Boon (Kaetemi) \
|
||||
* Awesome callback template \
|
||||
*/ \
|
||||
template<typename TReturn NLQT_CALLBACK_ARGS_TYPENAME> \
|
||||
class NLQT_CALLBACK_ARGS_CLASS \
|
||||
{ \
|
||||
/* Very simple reference counting callback base */ \
|
||||
class CCallbackBase \
|
||||
{ \
|
||||
public: \
|
||||
CCallbackBase() : m_RefCount(0) \
|
||||
{ \
|
||||
\
|
||||
} \
|
||||
\
|
||||
virtual ~CCallbackBase() \
|
||||
{ \
|
||||
nlassert(!m_RefCount); \
|
||||
} \
|
||||
\
|
||||
void refAdd() \
|
||||
{ \
|
||||
++m_RefCount; \
|
||||
} \
|
||||
\
|
||||
void refRemove() \
|
||||
{ \
|
||||
--m_RefCount; \
|
||||
if (!m_RefCount) \
|
||||
delete this; \
|
||||
} \
|
||||
\
|
||||
virtual TReturn callback(NLQT_CALLBACK_ARGS_DECL) = 0; \
|
||||
\
|
||||
virtual bool equals(const CCallbackBase *callbackBase) = 0; \
|
||||
\
|
||||
/* disable copy */ \
|
||||
CCallbackBase(const CCallbackBase &); \
|
||||
CCallbackBase &operator=(const CCallbackBase &); \
|
||||
\
|
||||
private: \
|
||||
uint m_RefCount; \
|
||||
}; \
|
||||
\
|
||||
typedef TReturn TCallbackFunction(NLQT_CALLBACK_ARGS_DECL); \
|
||||
class CCallbackFunction : public CCallbackBase \
|
||||
{ \
|
||||
public: \
|
||||
CCallbackFunction(TCallbackFunction *callbackFunction) : m_CallbackFunction(callbackFunction) \
|
||||
{ \
|
||||
nlassert(m_CallbackFunction); \
|
||||
} \
|
||||
\
|
||||
virtual ~CCallbackFunction() \
|
||||
{ \
|
||||
m_CallbackFunction = NULL; \
|
||||
} \
|
||||
\
|
||||
virtual TReturn callback(NLQT_CALLBACK_ARGS_DECL) \
|
||||
{ \
|
||||
return m_CallbackFunction(NLQT_CALLBACK_ARGS_IMPL); \
|
||||
} \
|
||||
\
|
||||
virtual bool equals(const CCallbackBase *callbackBase) \
|
||||
{ \
|
||||
const CCallbackFunction *callbackFunction = \
|
||||
dynamic_cast<const CCallbackFunction *>(callbackBase); \
|
||||
if (!callbackFunction) return false; \
|
||||
return m_CallbackFunction == callbackFunction->m_CallbackFunction; \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
TCallbackFunction *m_CallbackFunction; \
|
||||
}; \
|
||||
\
|
||||
template<typename TClass> \
|
||||
class CCallbackMethod : public CCallbackBase \
|
||||
{ \
|
||||
typedef TReturn (TClass::*TCallbackMethod)(NLQT_CALLBACK_ARGS_DECL); \
|
||||
public: \
|
||||
CCallbackMethod(TClass *callbackObject, TCallbackMethod callbackMethod) : m_CallbackObject(callbackObject), m_CallbackMethod(callbackMethod) \
|
||||
{ \
|
||||
nlassert(m_CallbackObject); \
|
||||
nlassert(m_CallbackMethod); \
|
||||
} \
|
||||
\
|
||||
virtual ~CCallbackMethod() \
|
||||
{ \
|
||||
m_CallbackObject = NULL; \
|
||||
m_CallbackMethod = NULL; \
|
||||
} \
|
||||
\
|
||||
virtual TReturn callback(NLQT_CALLBACK_ARGS_DECL) \
|
||||
{ \
|
||||
return (m_CallbackObject->*m_CallbackMethod)(NLQT_CALLBACK_ARGS_IMPL); \
|
||||
} \
|
||||
\
|
||||
virtual bool equals(const CCallbackBase *callbackBase) \
|
||||
{ \
|
||||
const CCallbackMethod *callbackMethod = \
|
||||
dynamic_cast<const CCallbackMethod *>(callbackBase); \
|
||||
if (!callbackMethod) return false; \
|
||||
return m_CallbackObject == callbackMethod->m_CallbackObject \
|
||||
&& m_CallbackMethod == callbackMethod->m_CallbackMethod; \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
TClass *m_CallbackObject; \
|
||||
TCallbackMethod m_CallbackMethod; \
|
||||
}; \
|
||||
\
|
||||
public: \
|
||||
CCallback() : m_CallbackBase(NULL) \
|
||||
{ \
|
||||
\
|
||||
} \
|
||||
\
|
||||
CCallback(TCallbackFunction *callbackFunction) : m_CallbackBase(new CCallbackFunction(callbackFunction)) \
|
||||
{ \
|
||||
nlassert(m_CallbackBase); \
|
||||
m_CallbackBase->refAdd(); \
|
||||
} \
|
||||
\
|
||||
template<typename TClass> \
|
||||
CCallback(TClass *callbackObject, TReturn (TClass::*callbackMethod)(NLQT_CALLBACK_ARGS_DECL)) : m_CallbackBase(new CCallbackMethod<TClass>(callbackObject, callbackMethod)) \
|
||||
{ \
|
||||
nlassert(m_CallbackBase); \
|
||||
m_CallbackBase->refAdd(); \
|
||||
} \
|
||||
\
|
||||
CCallback(const CCallback &callback) \
|
||||
{ \
|
||||
m_CallbackBase = callback.m_CallbackBase; \
|
||||
if (m_CallbackBase) \
|
||||
m_CallbackBase->refAdd(); \
|
||||
} \
|
||||
\
|
||||
CCallback &operator=(const CCallback &callback) \
|
||||
{ \
|
||||
if (m_CallbackBase != callback.m_CallbackBase) \
|
||||
{ \
|
||||
if (m_CallbackBase) \
|
||||
m_CallbackBase->refRemove(); \
|
||||
m_CallbackBase = callback.m_CallbackBase; \
|
||||
if (m_CallbackBase) \
|
||||
m_CallbackBase->refAdd(); \
|
||||
} \
|
||||
return *this; \
|
||||
} \
|
||||
\
|
||||
~CCallback() \
|
||||
{ \
|
||||
if (m_CallbackBase) \
|
||||
{ \
|
||||
m_CallbackBase->refRemove(); \
|
||||
m_CallbackBase = NULL; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
TReturn callback(NLQT_CALLBACK_ARGS_DECL) \
|
||||
{ \
|
||||
nlassert(m_CallbackBase); \
|
||||
return m_CallbackBase->callback(NLQT_CALLBACK_ARGS_IMPL); \
|
||||
} \
|
||||
\
|
||||
TReturn operator()(NLQT_CALLBACK_ARGS_DECL) \
|
||||
{ \
|
||||
nlassert(m_CallbackBase); \
|
||||
return m_CallbackBase->callback(NLQT_CALLBACK_ARGS_IMPL); \
|
||||
} \
|
||||
\
|
||||
bool valid() const \
|
||||
{ \
|
||||
return m_CallbackBase != NULL; \
|
||||
} \
|
||||
\
|
||||
operator bool() const \
|
||||
{ \
|
||||
return m_CallbackBase != NULL; \
|
||||
} \
|
||||
\
|
||||
bool operator==(const CCallback &callback) \
|
||||
{ \
|
||||
return m_CallbackBase->equals(callback.m_CallbackBase); \
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
CCallbackBase *m_CallbackBase; \
|
||||
\
|
||||
}; /* class CCallback */ \
|
||||
|
||||
template<typename TReturn, typename TArgsA = void, typename TArgsB = void, typename TArgsC = void, typename TArgsD = void, typename TArgsE = void, typename TArgsF = void, typename TArgsG = void, typename TDummy = void>
|
||||
class CCallback;
|
||||
|
||||
#define NLQT_CALLBACK_ARGS_CLASS CCallback<TReturn, void, void, void, void, void, void, void, void>
|
||||
#define NLQT_CALLBACK_ARGS_TYPENAME
|
||||
#define NLQT_CALLBACK_ARGS_DECL
|
||||
#define NLQT_CALLBACK_ARGS_IMPL
|
||||
NLQT_CALLBACK_TEMPLATE
|
||||
#undef NLQT_CALLBACK_ARGS_CLASS
|
||||
#undef NLQT_CALLBACK_ARGS_TYPENAME
|
||||
#undef NLQT_CALLBACK_ARGS_DECL
|
||||
#undef NLQT_CALLBACK_ARGS_IMPL
|
||||
|
||||
#define NLQT_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, void, void, void, void, void, void, void>
|
||||
#define NLQT_CALLBACK_ARGS_TYPENAME , typename TArgsA
|
||||
#define NLQT_CALLBACK_ARGS_DECL TArgsA argsA
|
||||
#define NLQT_CALLBACK_ARGS_IMPL argsA
|
||||
NLQT_CALLBACK_TEMPLATE
|
||||
#undef NLQT_CALLBACK_ARGS_CLASS
|
||||
#undef NLQT_CALLBACK_ARGS_TYPENAME
|
||||
#undef NLQT_CALLBACK_ARGS_DECL
|
||||
#undef NLQT_CALLBACK_ARGS_IMPL
|
||||
|
||||
#define NLQT_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, void, void, void, void, void, void>
|
||||
#define NLQT_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB
|
||||
#define NLQT_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB
|
||||
#define NLQT_CALLBACK_ARGS_IMPL argsA, argsB
|
||||
NLQT_CALLBACK_TEMPLATE
|
||||
#undef NLQT_CALLBACK_ARGS_CLASS
|
||||
#undef NLQT_CALLBACK_ARGS_TYPENAME
|
||||
#undef NLQT_CALLBACK_ARGS_DECL
|
||||
#undef NLQT_CALLBACK_ARGS_IMPL
|
||||
|
||||
#define NLQT_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, void, void, void, void, void>
|
||||
#define NLQT_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC
|
||||
#define NLQT_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC
|
||||
#define NLQT_CALLBACK_ARGS_IMPL argsA, argsB, argsC
|
||||
NLQT_CALLBACK_TEMPLATE
|
||||
#undef NLQT_CALLBACK_ARGS_CLASS
|
||||
#undef NLQT_CALLBACK_ARGS_TYPENAME
|
||||
#undef NLQT_CALLBACK_ARGS_DECL
|
||||
#undef NLQT_CALLBACK_ARGS_IMPL
|
||||
|
||||
#define NLQT_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, TArgsD, void, void, void, void>
|
||||
#define NLQT_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC, typename TArgsD
|
||||
#define NLQT_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC, TArgsD argsD
|
||||
#define NLQT_CALLBACK_ARGS_IMPL argsA, argsB, argsC, argsD
|
||||
NLQT_CALLBACK_TEMPLATE
|
||||
#undef NLQT_CALLBACK_ARGS_CLASS
|
||||
#undef NLQT_CALLBACK_ARGS_TYPENAME
|
||||
#undef NLQT_CALLBACK_ARGS_DECL
|
||||
#undef NLQT_CALLBACK_ARGS_IMPL
|
||||
|
||||
#define NLQT_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, TArgsD, TArgsE, void, void, void>
|
||||
#define NLQT_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC, typename TArgsD, typename TArgsE
|
||||
#define NLQT_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC, TArgsD argsD, TArgsE argsE
|
||||
#define NLQT_CALLBACK_ARGS_IMPL argsA, argsB, argsC, argsD, argsE
|
||||
NLQT_CALLBACK_TEMPLATE
|
||||
#undef NLQT_CALLBACK_ARGS_CLASS
|
||||
#undef NLQT_CALLBACK_ARGS_TYPENAME
|
||||
#undef NLQT_CALLBACK_ARGS_DECL
|
||||
#undef NLQT_CALLBACK_ARGS_IMPL
|
||||
|
||||
#define NLQT_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, TArgsD, TArgsE, TArgsF, void, void>
|
||||
#define NLQT_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC, typename TArgsD, typename TArgsE, typename TArgsF
|
||||
#define NLQT_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC, TArgsD argsD, TArgsE argsE, TArgsF argsF
|
||||
#define NLQT_CALLBACK_ARGS_IMPL argsA, argsB, argsC, argsD, argsE, argsF
|
||||
NLQT_CALLBACK_TEMPLATE
|
||||
#undef NLQT_CALLBACK_ARGS_CLASS
|
||||
#undef NLQT_CALLBACK_ARGS_TYPENAME
|
||||
#undef NLQT_CALLBACK_ARGS_DECL
|
||||
#undef NLQT_CALLBACK_ARGS_IMPL
|
||||
|
||||
#define NLQT_CALLBACK_ARGS_CLASS CCallback<TReturn, TArgsA, TArgsB, TArgsC, TArgsD, TArgsE, TArgsF, TArgsG, void>
|
||||
#define NLQT_CALLBACK_ARGS_TYPENAME , typename TArgsA, typename TArgsB, typename TArgsC, typename TArgsD, typename TArgsE, typename TArgsF, typename TArgsG
|
||||
#define NLQT_CALLBACK_ARGS_DECL TArgsA argsA, TArgsB argsB, TArgsC argsC, TArgsD argsD, TArgsE argsE, TArgsF argsF, TArgsG argsG
|
||||
#define NLQT_CALLBACK_ARGS_IMPL argsA, argsB, argsC, argsD, argsE, argsF, argsG
|
||||
NLQT_CALLBACK_TEMPLATE
|
||||
#undef NLQT_CALLBACK_ARGS_CLASS
|
||||
#undef NLQT_CALLBACK_ARGS_TYPENAME
|
||||
#undef NLQT_CALLBACK_ARGS_DECL
|
||||
#undef NLQT_CALLBACK_ARGS_IMPL
|
||||
#undef NLQT_CALLBACK_ARGS_CLASSNAME
|
||||
|
||||
#undef NLQT_CALLBACK_TEMPLATE
|
||||
|
||||
typedef CCallback<void> CEmptyCallback;
|
||||
|
||||
} /* namespace NLQT */
|
||||
|
||||
#endif /* #ifndef NLQT_CALLBACK_H */
|
||||
|
||||
/* end of file */
|
@ -1,224 +0,0 @@
|
||||
/*
|
||||
Object Viewer Qt
|
||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#include "stdpch.h"
|
||||
#include "configuration.h"
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/debug.h>
|
||||
#include <nel/misc/hierarchical_timer.h>
|
||||
#include <nel/misc/config_file.h>
|
||||
#include <nel/misc/path.h>
|
||||
|
||||
#include "modules.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
||||
namespace NLQT
|
||||
{
|
||||
|
||||
CConfiguration::CConfiguration()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CConfiguration::~CConfiguration()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CConfiguration::init()
|
||||
{
|
||||
nldebug("CConfiguration::init");
|
||||
|
||||
// verify data
|
||||
nlassert(!ConfigCallbacks.size());
|
||||
|
||||
// load config
|
||||
try
|
||||
{
|
||||
ConfigFile.load(NLQT_CONFIG_FILE);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
nlerror("Error opening files object_viewer.cfg or object_viewer_default.cfg. Check this files");
|
||||
}
|
||||
// setup config file callback
|
||||
Modules::config().setCallback("SearchPaths", CConfigCallback(this, &CConfiguration::cfcbSearchPaths));
|
||||
|
||||
}
|
||||
|
||||
void CConfiguration::release()
|
||||
{
|
||||
nldebug("CConfiguration::release");
|
||||
|
||||
Modules::config().dropCallback("SearchPaths");
|
||||
|
||||
// save and release the config file
|
||||
if (ConfigFile.exists("SaveConfig") && ConfigFile.getVarPtr("SaveConfig")->asBool())
|
||||
{
|
||||
ConfigFile.save();
|
||||
}
|
||||
ConfigFile.clear();
|
||||
|
||||
// release the search paths etc
|
||||
CPath::releaseInstance();
|
||||
|
||||
// verify data
|
||||
nlassert(!ConfigCallbacks.size());
|
||||
}
|
||||
|
||||
void CConfiguration::updateUtilities()
|
||||
{
|
||||
//H_AUTO2
|
||||
CConfigFile::checkConfigFiles();
|
||||
}
|
||||
|
||||
void CConfiguration::configSearchPaths()
|
||||
{
|
||||
cfcbSearchPaths(Modules::config().getConfigFile().getVar("SearchPaths"));
|
||||
}
|
||||
|
||||
void CConfiguration::configRemapExtensions()
|
||||
{
|
||||
CConfigFile::CVar *var;
|
||||
var = ConfigFile.getVarPtr("RemapExtensions");
|
||||
uint varsize = var->size();
|
||||
for (uint i = 0; i < varsize; i += 2)
|
||||
CPath::remapExtension(var->asString(i), var->asString(i + 1), true);
|
||||
}
|
||||
|
||||
void CConfiguration::setAndCallback(const std::string &varName, CConfigCallback configCallback)
|
||||
{
|
||||
ConfigCallbacks[varName] = configCallback;
|
||||
ConfigFile.setCallback(varName, cbConfigCallback);
|
||||
configCallback(*ConfigFile.getVarPtr(varName));
|
||||
}
|
||||
|
||||
void CConfiguration::setCallback(const std::string &varName, CConfigCallback configCallback)
|
||||
{
|
||||
ConfigCallbacks[varName] = configCallback;
|
||||
ConfigFile.setCallback(varName, cbConfigCallback);
|
||||
}
|
||||
|
||||
void CConfiguration::dropCallback(const std::string &varName)
|
||||
{
|
||||
ConfigFile.setCallback(varName, NULL);
|
||||
ConfigCallbacks.erase(varName);
|
||||
}
|
||||
|
||||
float CConfiguration::getValue(const string &varName, float defaultValue)
|
||||
{
|
||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asFloat();
|
||||
CConfigFile::CVar varToCopy;
|
||||
varToCopy.forceAsDouble((double)defaultValue);
|
||||
ConfigFile.insertVar(varName, varToCopy);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
double CConfiguration::getValue(const string &varName, double defaultValue)
|
||||
{
|
||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asDouble();
|
||||
CConfigFile::CVar varToCopy;
|
||||
varToCopy.forceAsDouble(defaultValue);
|
||||
ConfigFile.insertVar(varName, varToCopy);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
int CConfiguration::getValue(const string &varName, int defaultValue)
|
||||
{
|
||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asInt();
|
||||
CConfigFile::CVar varToCopy;
|
||||
varToCopy.forceAsInt(defaultValue);
|
||||
ConfigFile.insertVar(varName, varToCopy);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
string CConfiguration::getValue(const string &varName, const string &defaultValue)
|
||||
{
|
||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asString();
|
||||
CConfigFile::CVar varToCopy;
|
||||
varToCopy.forceAsString(defaultValue);
|
||||
ConfigFile.insertVar(varName, varToCopy);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
ucstring CConfiguration::getValue(const string &varName, const ucstring &defaultValue)
|
||||
{
|
||||
if (ConfigFile.exists(varName)) return ucstring::makeFromUtf8(ConfigFile.getVar(varName).asString());
|
||||
CConfigFile::CVar varToCopy;
|
||||
varToCopy.forceAsString(defaultValue.toUtf8());
|
||||
ConfigFile.insertVar(varName, varToCopy);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
bool CConfiguration::getValue(const string &varName, bool defaultValue)
|
||||
{
|
||||
if (ConfigFile.exists(varName)) return ConfigFile.getVar(varName).asBool();
|
||||
CConfigFile::CVar varToCopy;
|
||||
varToCopy.forceAsInt(defaultValue ? 1 : 0);
|
||||
ConfigFile.insertVar(varName, varToCopy);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
CRGBA CConfiguration::getValue(const string &varName, const CRGBA &defaultValue)
|
||||
{
|
||||
if (ConfigFile.exists(varName))
|
||||
{
|
||||
return getValue(ConfigFile.getVar(varName), defaultValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
// create a new value only if one doesn't exist
|
||||
CConfigFile::CVar varToCopy;
|
||||
varToCopy.forceAsInt(defaultValue.R);
|
||||
varToCopy.setAsInt(defaultValue.G, 1);
|
||||
varToCopy.setAsInt(defaultValue.B, 2);
|
||||
varToCopy.setAsInt(defaultValue.A, 3);
|
||||
ConfigFile.insertVar(varName, varToCopy);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
CRGBA CConfiguration::getValue(const CConfigFile::CVar &var, const CRGBA &defaultValue)
|
||||
{
|
||||
if (var.size() >= 3)
|
||||
{
|
||||
if (var.size() > 4)
|
||||
nlwarning("RGBA value in config value '%s' is too long, ignoring unused values");
|
||||
return CRGBA((uint8)var.asInt(0), (uint8)var.asInt(1), (uint8)var.asInt(2), var.size() >= 4 ? (uint8)var.asInt(3) : 255);
|
||||
}
|
||||
nlwarning("Invalid RGBA value in config value '%s', reverting to default { %i, %i, %i, %i }", var.Name.c_str(), (sint)defaultValue.R, (sint)defaultValue.G, (sint)defaultValue.B, (sint)defaultValue.A);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
void CConfiguration::cbConfigCallback(NLMISC::CConfigFile::CVar &var)
|
||||
{
|
||||
Modules::config().ConfigCallbacks[var.Name](var);
|
||||
}
|
||||
|
||||
void CConfiguration::cfcbSearchPaths(NLMISC::CConfigFile::CVar &var)
|
||||
{
|
||||
uint varsize = var.size();
|
||||
for (uint i = 0; i < varsize; ++i)
|
||||
CPath::addSearchPath(var.asString(i), false, false);
|
||||
}
|
||||
|
||||
} /* namespace NLQT */
|
@ -1,97 +0,0 @@
|
||||
/*
|
||||
Object Viewer Qt
|
||||
Copyright (C) 2010 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CONFIGURATION_H
|
||||
#define CONFIGURATION_H
|
||||
|
||||
#include <nel/misc/types_nl.h>
|
||||
|
||||
// STL includes
|
||||
#include <map>
|
||||
|
||||
// NeL includes
|
||||
#include <nel/misc/config_file.h>
|
||||
#include <nel/misc/rgba.h>
|
||||
#include <nel/misc/ucstring.h>
|
||||
|
||||
// Project includes
|
||||
#include "callback.h"
|
||||
|
||||
#define NLQT_CONFIG_FILE "object_viewer.cfg"
|
||||
|
||||
namespace NLQT
|
||||
{
|
||||
|
||||
typedef CCallback<void, NLMISC::CConfigFile::CVar &> CConfigCallback;
|
||||
|
||||
/**
|
||||
@class CConfiguration
|
||||
@date 2010-02-05 15:44GMT
|
||||
@author Jan Boon (Kaetemi)
|
||||
@brief Read / write settings from the configuration file
|
||||
@details Load the configuration file, and then read/write settings.
|
||||
As well as automatic reading of the search paths and their sets.
|
||||
*/
|
||||
class CConfiguration
|
||||
{
|
||||
public:
|
||||
CConfiguration();
|
||||
virtual ~CConfiguration();
|
||||
|
||||
void init();
|
||||
void release();
|
||||
|
||||
void updateUtilities();
|
||||
void configSearchPaths();
|
||||
void configRemapExtensions();
|
||||
|
||||
void setAndCallback(const std::string &varName, CConfigCallback configCallback);
|
||||
void setCallback(const std::string &varName, CConfigCallback configCallback);
|
||||
void dropCallback(const std::string &varName);
|
||||
|
||||
float getValue(const std::string &varName, float defaultValue);
|
||||
double getValue(const std::string &varName, double defaultValue);
|
||||
int getValue(const std::string &varName, int defaultValue);
|
||||
std::string getValue(const std::string &varName, const std::string &defaultValue);
|
||||
ucstring getValue(const std::string &varName, const ucstring &defaultValue);
|
||||
bool getValue(const std::string &varName, bool defaultValue);
|
||||
NLMISC::CRGBA getValue(const std::string &varName, const NLMISC::CRGBA &defaultValue);
|
||||
NLMISC::CRGBA getValue(const NLMISC::CConfigFile::CVar &var, const NLMISC::CRGBA &defaultValue);
|
||||
|
||||
inline NLMISC::CConfigFile &getConfigFile()
|
||||
{
|
||||
return ConfigFile;
|
||||
}
|
||||
|
||||
private:
|
||||
static void cbConfigCallback(NLMISC::CConfigFile::CVar &var);
|
||||
|
||||
void cfcbSearchPaths(NLMISC::CConfigFile::CVar &var);
|
||||
|
||||
CConfiguration(const CConfiguration &);
|
||||
CConfiguration &operator=(const CConfiguration &);
|
||||
|
||||
NLMISC::CConfigFile ConfigFile;
|
||||
std::map<std::string, CConfigCallback> ConfigCallbacks;
|
||||
|
||||
};/* class CConfiguration */
|
||||
|
||||
} /* namespace NLQT */
|
||||
|
||||
#endif // CONFIGURATION_H
|
@ -0,0 +1,62 @@
|
||||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef OBJECT_VIEWER_CONSTANTS_H
|
||||
#define OBJECT_VIEWER_CONSTANTS_H
|
||||
|
||||
namespace NLQT
|
||||
{
|
||||
namespace Constants
|
||||
{
|
||||
const char * const OBJECT_VIEWER_PLUGIN = "ObjectViewer";
|
||||
|
||||
//mainwindow
|
||||
const char * const MAIN_WINDOW = "ObjectViewer.MainWindow";
|
||||
|
||||
//settings
|
||||
const char * const OBJECT_VIEWER_SECTION = "ObjectViewer";
|
||||
const char * const GRAPHICS_DRIVER = "GraphicsDriver";
|
||||
const char * const ENABLE_BLOOM = "EnableBloom";
|
||||
const char * const ENABLE_SQUARE_BLOOM = "EnableSquareBloom";
|
||||
const char * const BLOOM_DENSITY = "BloomDensity";
|
||||
const char * const QT_STYLE = "QtStyle";
|
||||
const char * const QT_PALETTE = "QtPalette";
|
||||
const char * const FONT = "Font";
|
||||
|
||||
const char * const SOUND_ENABLE = "SoundEnable";
|
||||
const char * const SOUND_DRIVER = "SoundDriver";
|
||||
const char * const SOUND_DEVICE = "SoundDevice";
|
||||
const char * const SOUND_AUTO_LOAD_SAMPLE = "SoundAutoLoadSample";
|
||||
const char * const SOUND_ENABLE_OCCLUDE_OBSTRUCT = "SoundEnableOccludeObstruct";
|
||||
const char * const SOUND_ENABLE_REVERB = "SoundEnableReverb";
|
||||
const char * const SOUND_MANUAL_ROLL_OFF = "SoundManualRolloff";
|
||||
const char * const SOUND_FORCE_SOFTWARE = "SoundForceSoftware";
|
||||
const char * const SOUND_USE_ADCPM = "SoundUseADPCM";
|
||||
const char * const SOUND_MAX_TRACK = "SoundMaxTrack";
|
||||
const char * const SOUND_PACKED_SHEET_PATH = "SoundPackedSheetPath";
|
||||
const char * const SOUND_SAMPLE_PATH = "SoundSamplePath";
|
||||
|
||||
const char * const VEGET_TILE_BANK = "VegetTileBank";
|
||||
const char * const VEGET_TILE_FAR_BANK = "VegetTileFarBank";
|
||||
const char * const VEGET_TEXTURE = "VegetTexture";
|
||||
const char * const VEGET_LANDSCAPE_ZONES = "VegetLandscapeZones";
|
||||
const char * const COARSE_MESH_TEXTURE = "CoarseMeshTexture";
|
||||
|
||||
} // namespace Constants
|
||||
} // namespace NLQT
|
||||
|
||||
#endif // OBJECT_VIEWER_CONSTANTS_H
|
Loading…
Reference in New Issue