Skip to content
Snippets Groups Projects
Commit 9a3b410b authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Add a simple signal updated static setting value cache

parent fb86ad3d
No related branches found
No related tags found
No related merge requests found
......@@ -112,6 +112,7 @@ include_directories(SYSTEM
set(viewer_SOURCE_FILES
alavataractions.cpp
alchatcommand.cpp
alcontrolcache.cpp
alfloaterparticleeditor.cpp
alfloaterregiontracker.cpp
alunzip.cpp
......@@ -752,6 +753,7 @@ set(viewer_HEADER_FILES
ViewerInstall.cmake
alavataractions.h
alchatcommand.h
alcontrolcache.h
alfloaterparticleeditor.h
alfloaterregiontracker.h
alunzip.h
......
#include "llviewerprecompiledheaders.h"
#include "alcontrolcache.h"
#include "llviewercontrol.h"
bool ALControlCache::EditLinkedParts = false;
F32 ALControlCache::GridDrawSize;
F32 ALControlCache::GridOpacity;
F32 ALControlCache::GridResolution;
bool ALControlCache::LimitSelectDistance = true;
bool ALControlCache::MapShowInfohubs;
bool ALControlCache::MapShowEvents;
bool ALControlCache::MapShowLandForSale;
bool ALControlCache::MapShowPeople;
bool ALControlCache::MapShowTelehubs;
bool ALControlCache::NavBarShowParcelProperties = true;
U32 ALControlCache::PreferredMaturity;
bool ALControlCache::SnapEnabled;
S32 ALControlCache::ToastGap;
#define DECLARE_CTRL(ctrl, type, ctrl_type) \
{ \
LLControlVariable* cntrl_ptr = gSavedSettings.getControl(#ctrl); \
if (!cntrl_ptr) \
{ \
LL_WARNS() << "Global setting name not found:" << #ctrl << LL_ENDL; \
} \
else \
{ \
cntrl_ptr->getSignal()->connect(0, [&](LLControlVariable* control, const LLSD& new_val, const LLSD&) \
{ \
ctrl = convert_from_llsd<type>(new_val, ctrl_type, #ctrl); \
}); \
ctrl = convert_from_llsd<type>(cntrl_ptr->getValue(), ctrl_type, #ctrl); \
LL_INFOS() << "Global cached setting: " << #ctrl << " initialized with value: " << ctrl << LL_ENDL; \
} \
} \
#define DECLARE_CTRL_BOOL(ctrl) DECLARE_CTRL(ctrl, bool, TYPE_BOOLEAN);
#define DECLARE_CTRL_F32(ctrl) DECLARE_CTRL(ctrl, F32, TYPE_F32);
#define DECLARE_CTRL_U32(ctrl) DECLARE_CTRL(ctrl, U32, TYPE_U32);
#define DECLARE_CTRL_S32(ctrl) DECLARE_CTRL(ctrl, S32, TYPE_S32);
// static
void ALControlCache::initControls()
{
// Keep this list alphabatized.
DECLARE_CTRL_BOOL(EditLinkedParts);
DECLARE_CTRL_F32(GridDrawSize);
DECLARE_CTRL_F32(GridOpacity);
DECLARE_CTRL_F32(GridResolution);
DECLARE_CTRL_BOOL(LimitSelectDistance);
DECLARE_CTRL_BOOL(MapShowInfohubs);
DECLARE_CTRL_BOOL(MapShowEvents);
DECLARE_CTRL_BOOL(MapShowLandForSale);
DECLARE_CTRL_BOOL(MapShowPeople);
DECLARE_CTRL_BOOL(MapShowTelehubs);
DECLARE_CTRL_BOOL(NavBarShowParcelProperties);
DECLARE_CTRL_U32(PreferredMaturity);
DECLARE_CTRL_BOOL(SnapEnabled);
DECLARE_CTRL_S32(ToastGap);
}
#ifndef AL_ALCONTROLCACHE_H
#define AL_ALCONTROLCACHE_H
struct ALControlCache
{
static void initControls();
static bool EditLinkedParts;
static F32 GridDrawSize;
static F32 GridOpacity;
static F32 GridResolution;
static bool LimitSelectDistance;
static bool MapShowInfohubs;
static bool MapShowEvents;
static bool MapShowLandForSale;
static bool MapShowPeople;
static bool MapShowTelehubs;
static bool NavBarShowParcelProperties;
static U32 PreferredMaturity;
static bool SnapEnabled;
static S32 ToastGap;
};
#endif
\ No newline at end of file
......@@ -29,6 +29,7 @@
#include <map>
#include "llcontrol.h"
#include "alcontrolcache.h"
// Enabled this definition to compile a 'hacked' viewer that
// allows a hacked godmode to be toggled on and off.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment