merge release@82383 viewer-cleanup2-7-merge@82828

QAR-369
master
Steven Bennetts 2008-03-20 21:41:26 +00:00
parent b502c86f30
commit e3b97ac65b
58 changed files with 12855 additions and 2522 deletions

View File

@ -339,7 +339,7 @@ const U32 MAP_ITEM_LAND_FOR_SALE = 0x07;
const U32 MAP_ITEM_CLASSIFIED = 0x08;
// Crash reporter behavior
const char* const CRASH_SETTINGS_FILE = "crash_settings.xml";
const char* const CRASH_SETTINGS_FILE = "settings_crash_behavior.xml";
const char* const CRASH_BEHAVIOR_SETTING = "CrashSubmitBehavior";
const S32 CRASH_BEHAVIOR_ASK = 0;
const S32 CRASH_BEHAVIOR_ALWAYS_SEND = 1;

View File

@ -185,13 +185,6 @@ protected:
LLPointer<LLEventDispatcher> mDispatcher;
};
// Utility mixer class which fires & handles events
class LLSimpleListenerObservable : public LLObservable, public LLSimpleListener
{
public:
virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) = 0;
};
class LLValueChangedEvent : public LLEvent
{
public:

View File

@ -271,9 +271,11 @@ void llofstream::open(const char* _Filename, /* Flawfinder: ignore */
void llofstream::close()
{ // close the C stream
llassert(_Filebuffer);
if (_Filebuffer->close() == 0)
_Myios::setstate(ios_base::failbit); /*Flawfinder: ignore*/
if(is_open())
{
if (_Filebuffer->close() == 0)
_Myios::setstate(ios_base::failbit); /*Flawfinder: ignore*/
}
}
llofstream::llofstream(const char *_Filename,
@ -285,7 +287,8 @@ llofstream::llofstream(const char *_Filename,
}
llofstream::~llofstream()
{ // destroy the object
{
// destroy the object
close();
delete _Filebuffer;
}

View File

@ -778,9 +778,8 @@ void LLButton::setToggleState(BOOL b)
{
if( b != mToggleState )
{
mToggleState = b;
LLValueChangedEvent *evt = new LLValueChangedEvent(this, mToggleState);
fireEvent(evt, "");
setControlValue(b); // will fire LLControlVariable callbacks (if any)
mToggleState = b; // may or may not be redundant
}
}

View File

@ -827,59 +827,35 @@ void LLMenuItemCallGL::setEnabledControl(LLString enabled_control, LLView *conte
// Register new listener
if (!enabled_control.empty())
{
LLControlBase *control = context->findControl(enabled_control);
if (control)
{
LLSD state = control->registerListener(this, "ENABLED");
setEnabled(state);
}
else
LLControlVariable *control = context->findControl(enabled_control);
if (!control)
{
context->addBoolControl(enabled_control, getEnabled());
control = context->findControl(enabled_control);
control->registerListener(this, "ENABLED");
llassert_always(control);
}
control->getSignal()->connect(boost::bind(&LLView::controlListener, _1, getHandle(), std::string("enabled")));
setEnabled(control->getValue());
}
}
void LLMenuItemCallGL::setVisibleControl(LLString enabled_control, LLView *context)
void LLMenuItemCallGL::setVisibleControl(LLString visible_control, LLView *context)
{
// Register new listener
if (!enabled_control.empty())
if (!visible_control.empty())
{
LLControlBase *control = context->findControl(enabled_control);
if (control)
LLControlVariable *control = context->findControl(visible_control);
if (!control)
{
LLSD state = control->registerListener(this, "VISIBLE");
setVisible(state);
}
else
{
context->addBoolControl(enabled_control, getEnabled());
control = context->findControl(enabled_control);
control->registerListener(this, "VISIBLE");
context->addBoolControl(visible_control, getVisible());
control = context->findControl(visible_control);
llassert_always(control);
}
control->getSignal()->connect(boost::bind(&LLView::controlListener, _1, getHandle(), std::string("visible")));
setVisible(control->getValue());
}
}
// virtual
bool LLMenuItemCallGL::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
if (userdata.asString() == "ENABLED" && event->desc() == "value_changed")
{
LLSD state = event->getValue();
setEnabled(state);
return TRUE;
}
if (userdata.asString() == "VISIBLE" && event->desc() == "value_changed")
{
LLSD state = event->getValue();
setVisible(state);
return TRUE;
}
return LLMenuItemGL::handleEvent(event, userdata);
}
// virtual
LLXMLNodePtr LLMenuItemCallGL::getXML(bool save_children) const
{
@ -1000,46 +976,37 @@ LLMenuItemCheckGL::LLMenuItemCheckGL ( const LLString& name,
setControlName(control_name, context);
}
//virtual
void LLMenuItemCheckGL::setValue(const LLSD& value)
{
mChecked = value.asBoolean();
if(mChecked)
{
mDrawBoolLabel = BOOLEAN_TRUE_PREFIX;
}
else
{
mDrawBoolLabel.clear();
}
}
void LLMenuItemCheckGL::setCheckedControl(LLString checked_control, LLView *context)
{
// Register new listener
if (!checked_control.empty())
{
LLControlBase *control = context->findControl(checked_control);
if (control)
{
LLSD state = control->registerListener(this, "CHECKED");
mChecked = state;
}
else
LLControlVariable *control = context->findControl(checked_control);
if (!control)
{
context->addBoolControl(checked_control, mChecked);
control = context->findControl(checked_control);
control->registerListener(this, "CHECKED");
llassert_always(control);
}
control->getSignal()->connect(boost::bind(&LLView::controlListener, _1, getHandle(), std::string("value")));
mChecked = control->getValue();
}
}
// virtual
bool LLMenuItemCheckGL::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
if (userdata.asString() == "CHECKED" && event->desc() == "value_changed")
{
LLSD state = event->getValue();
mChecked = state;
if(mChecked)
{
mDrawBoolLabel = BOOLEAN_TRUE_PREFIX;
}
else
{
mDrawBoolLabel.clear();
}
return TRUE;
}
return LLMenuItemCallGL::handleEvent(event, userdata);
}
// virtual
LLXMLNodePtr LLMenuItemCheckGL::getXML(bool save_children) const
{
@ -1946,7 +1913,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
{
continue;
}
LLControlBase *control = parent->findControl(control_name);
LLControlVariable *control = parent->findControl(control_name);
if (!control)
{
parent->addBoolControl(control_name, FALSE);

View File

@ -225,7 +225,7 @@ private:
// calls a user defined callback.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLMenuItemCallGL : public LLMenuItemGL
class LLMenuItemCallGL : public LLMenuItemGL, public LLObservable
{
public:
// normal constructor
@ -291,7 +291,6 @@ public:
//virtual void draw();
virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
private:
menu_callback mCallback;
@ -341,7 +340,7 @@ public:
void setCheckedControl(LLString checked_control, LLView *context);
virtual void setValue(const LLSD& value) { mChecked = value.asBoolean(); }
virtual void setValue(const LLSD& value);
virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MENU_ITEM_CHECK; }
virtual LLString getWidgetTag() const { return LL_MENU_ITEM_CHECK_GL_TAG; }
@ -350,8 +349,6 @@ public:
// called to rebuild the draw label
virtual void buildDrawLabel( void );
virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
private:
check_callback mCheckCallback;
BOOL mChecked;

View File

@ -1555,16 +1555,11 @@ void gl_segmented_rect_3d_tex_top(const LLVector2& border_scale, const LLVector3
gl_segmented_rect_3d_tex(border_scale, border_width, border_height, width_vec, height_vec, ROUNDED_RECT_TOP);
}
class LLShowXUINamesListener: public LLSimpleListener
bool handleShowXUINamesChanged(const LLSD& newvalue)
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLUI::sShowXUINames = (BOOL) event->getValue().asBoolean();
return true;
}
};
static LLShowXUINamesListener show_xui_names_listener;
LLUI::sShowXUINames = newvalue.asBoolean();
return true;
}
void LLUI::initClass(LLControlGroup* config,
LLControlGroup* colors,
@ -1584,7 +1579,7 @@ void LLUI::initClass(LLControlGroup* config,
LLFontGL::sShadowColor = colors->getColor("ColorDropShadow");
LLUI::sShowXUINames = LLUI::sConfigGroup->getBOOL("ShowXUINames");
LLUI::sConfigGroup->getControl("ShowXUINames")->addListener(&show_xui_names_listener);
LLUI::sConfigGroup->getControl("ShowXUINames")->getSignal()->connect(boost::bind(&handleShowXUINamesChanged, _1));
}
void LLUI::cleanupClass()

View File

@ -2426,16 +2426,7 @@ LLSimpleListener* LLView::getListenerByName(const LLString& callback_name)
return callback;
}
void LLView::addListenerToControl(LLEventDispatcher *dispatcher, const LLString& name, LLSD filter, LLSD userdata)
{
LLSimpleListener* listener = getListenerByName(name);
if (listener)
{
dispatcher->addListener(listener, filter, userdata);
}
}
LLControlBase *LLView::findControl(LLString name)
LLControlVariable *LLView::findControl(LLString name)
{
control_map_t::iterator itor = mFloaterControls.find(name);
if (itor != mFloaterControls.end())
@ -2791,9 +2782,15 @@ LLFontGL::StyleFlags LLView::selectFontStyle(LLXMLNodePtr node)
return gl_font_style;
}
void LLView::setControlValue(const LLSD& value)
bool LLView::setControlValue(const LLSD& value)
{
LLUI::sConfigGroup->setValue(getControlName(), value);
LLString ctrlname = getControlName();
if (!ctrlname.empty())
{
LLUI::sConfigGroup->setValue(ctrlname, value);
return true;
}
return false;
}
//virtual
@ -2804,43 +2801,57 @@ void LLView::setControlName(const LLString& control_name, LLView *context)
context = this;
}
// Unregister from existing listeners
if (!mControlName.empty())
{
clearDispatchers();
llwarns << "setControlName called twice on same control!" << llendl;
mControlConnection.disconnect(); // disconnect current signal
mControlName.clear();
}
// Register new listener
if (!control_name.empty())
{
LLControlBase *control = context->findControl(control_name);
LLControlVariable *control = context->findControl(control_name);
if (control)
{
mControlName = control_name;
LLSD state = control->registerListener(this, "DEFAULT");
setValue(state);
mControlConnection = control->getSignal()->connect(boost::bind(&controlListener, _1, getHandle(), std::string("value")));
setValue(control->getValue());
}
}
}
// virtual
bool LLView::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
// static
bool LLView::controlListener(const LLSD& newvalue, LLHandle<LLView> handle, std::string type)
{
if (userdata.asString() == "DEFAULT" && event->desc() == "value_changed")
LLView* view = handle.get();
if (view)
{
LLSD state = event->getValue();
setValue(state);
return TRUE;
if (type == "value")
{
view->setValue(newvalue);
return true;
}
else if (type == "enabled")
{
view->setEnabled(newvalue.asBoolean());
return true;
}
else if (type == "visible")
{
view->setVisible(newvalue.asBoolean());
return true;
}
}
return FALSE;
return false;
}
void LLView::addBoolControl(LLString name, bool initial_value)
{
mFloaterControls[name] = new LLControl(name, TYPE_BOOLEAN, initial_value, "Internal floater control");
mFloaterControls[name] = new LLControlVariable(name, TYPE_BOOLEAN, initial_value, "Internal floater control");
}
LLControlBase *LLView::getControl(LLString name)
LLControlVariable *LLView::getControl(LLString name)
{
control_map_t::iterator itor = mFloaterControls.find(name);
if (itor != mFloaterControls.end())

View File

@ -65,7 +65,6 @@ const BOOL NOT_MOUSE_OPAQUE = FALSE;
const U32 GL_NAME_UI_RESERVED = 2;
/*
// virtual functions defined in LLView:
@ -150,7 +149,7 @@ virtual BOOL handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent);
*
*/
class LLView : public LLMouseHandler, public LLMortician, public LLSimpleListenerObservable
class LLView : public LLMouseHandler, public LLMortician
{
public:
@ -294,7 +293,6 @@ public:
LLHandle<LLView> getHandle() { mHandle.bind(this); return mHandle; }
U32 getFollows() const { return mReshapeFlags; }
BOOL followsLeft() const { return mReshapeFlags & FOLLOWS_LEFT; }
BOOL followsRight() const { return mReshapeFlags & FOLLOWS_RIGHT; }
@ -393,13 +391,13 @@ public:
void addListenerToControl(LLEventDispatcher *observer, const LLString& name, LLSD filter, LLSD userdata);
void addBoolControl(LLString name, bool initial_value);
LLControlBase *getControl(LLString name);
LLControlBase *findControl(LLString name);
LLControlVariable *getControl(LLString name);
LLControlVariable *findControl(LLString name);
void setControlValue(const LLSD& value);
bool setControlValue(const LLSD& value);
virtual void setControlName(const LLString& control, LLView *context);
virtual LLString getControlName() const { return mControlName; }
virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
// virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
virtual void setValue(const LLSD& value);
virtual LLSD getValue() const;
@ -494,11 +492,12 @@ protected:
LLView* childrenHandleRightMouseDown(S32 x, S32 y, MASK mask);
LLView* childrenHandleRightMouseUp(S32 x, S32 y, MASK mask);
typedef std::map<LLString, LLControlBase*> control_map_t;
static bool controlListener(const LLSD& newvalue, LLHandle<LLView> handle, std::string type);
typedef std::map<LLString, LLControlVariable*> control_map_t;
control_map_t mFloaterControls;
virtual LLView* getChildByName(const LLString& name, BOOL recurse = FALSE) const;
private:
LLView* mParentView;
child_list_t mChildList;
@ -537,9 +536,8 @@ private:
dispatch_list_t mDispatchList;
LLString mControlName;
// Just debugging stuff? We should try to hide anything that's not. -MG
boost::signals::connection mControlConnection;
public:
static BOOL sDebugRects; // Draw debug rects behind everything.
static BOOL sDebugKeys;

View File

@ -45,7 +45,6 @@ const S32 LLVFile::APPEND = 0x00000006; // 0x00000004 & LLVFile::WRITE
//----------------------------------------------------------------------------
LLVFSThread* LLVFile::sVFSThread = NULL;
BOOL LLVFile::sAllocdVFSThread = FALSE;
BOOL LLVFile::ALLOW_ASYNC = TRUE;
//----------------------------------------------------------------------------
//============================================================================

View File

@ -78,8 +78,6 @@ public:
static const S32 WRITE;
static const S32 READ_WRITE;
static const S32 APPEND;
static BOOL ALLOW_ASYNC;
protected:
LLAssetType::EType mFileType;

File diff suppressed because it is too large Load Diff

View File

@ -38,6 +38,26 @@
#include "llstring.h"
#include "llrect.h"
#include <vector>
// *NOTE: boost::visit_each<> generates warning 4675 on .net 2003
// Disable the warning for the boost includes.
#if LL_WINDOWS
# if (_MSC_VER >= 1300 && _MSC_VER < 1400)
# pragma warning(push)
# pragma warning( disable : 4675 )
# endif
#endif
#include <boost/bind.hpp>
#include <boost/signal.hpp>
#if LL_WINDOWS
# if (_MSC_VER >= 1300 && _MSC_VER < 1400)
# pragma warning(pop)
# endif
#endif
class LLVector3;
class LLVector3d;
class LLColor4;
@ -48,7 +68,7 @@ const BOOL NO_PERSIST = FALSE;
typedef enum e_control_type
{
TYPE_U32,
TYPE_U32 = 0,
TYPE_S32,
TYPE_F32,
TYPE_BOOLEAN,
@ -58,159 +78,82 @@ typedef enum e_control_type
TYPE_RECT,
TYPE_COL4,
TYPE_COL3,
TYPE_COL4U
TYPE_COL4U,
TYPE_LLSD,
TYPE_COUNT
} eControlType;
class LLControlBase : public LLSimpleListenerObservable
class LLControlVariable
{
friend class LLControlGroup;
protected:
friend class LLControlGroup;
typedef boost::signal<void(const LLSD&)> signal_t;
private:
LLString mName;
LLString mComment;
eControlType mType;
BOOL mHasRange;
BOOL mPersist;
BOOL mIsDefault;
static std::set<LLControlBase*> mChangedControls;
static std::list<S32> mFreeIDs;//These lists are used to store the ID's of registered event listeners.
static std::list<S32> mUsedIDs;
static S32 mTopID;//This is the index of the highest ID event listener ID. When the free pool is exhausted, new IDs are allocated from here.
std::vector<LLSD> mValues;
signal_t mSignal;
public:
static void releaseListenerID(S32 id);
static S32 allocateListenerID();
static void updateAllListeners();
virtual void updateListeners() = 0;
LLControlBase(const LLString& name, eControlType type, const LLString& comment, BOOL persist)
: mName(name),
mComment(comment),
mType(type),
mHasRange(FALSE),
mPersist(persist),
mIsDefault(TRUE)
{
if (mPersist && mComment.empty())
{
llerrs << "Must supply a comment for control " << mName << llendl;
}
sMaxControlNameLength = llmax((U32)mName.size(), sMaxControlNameLength);
}
virtual ~LLControlBase();
LLControlVariable(const LLString& name, eControlType type,
LLSD initial, const LLString& comment,
BOOL persist = TRUE);
virtual ~LLControlVariable();
const LLString& getName() const { return mName; }
const LLString& getComment() const { return mComment; }
eControlType type() { return mType; }
BOOL isType(eControlType tp) { return tp == mType; }
BOOL isType(eControlType tp) { return tp == mType; }
// Defaults to no-op
virtual void resetToDefault();
void resetToDefault(bool fire_signal = TRUE);
LLSD registerListener(LLSimpleListenerObservable *listener, LLSD userdata = "");
signal_t* getSignal() { return &mSignal; }
virtual LLSD get() const = 0;
virtual LLSD getValue() const = 0;
virtual void setValue(LLSD value) = 0;
virtual void set(LLSD value) = 0;
// From LLSimpleListener
virtual bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
void firePropertyChanged();
static U32 sMaxControlNameLength;
protected:
const char* name() { return mName.c_str(); }
const char* comment() { return mComment.c_str(); }
};
class LLControl
: public LLControlBase
{
friend class LLControlGroup;
protected:
LLSD mCurrent;
LLSD mDefault;
public:
typedef void tListenerCallback(const LLSD& newValue,S32 listenerID, LLControl& control);
typedef struct{
S32 mID;
LLSD mNewValue;
tListenerCallback* mCBFN;
}tPropertyChangedEvent;
typedef std::list<tPropertyChangedEvent>::iterator tPropertyChangedListIter;
std::list<tPropertyChangedEvent> mChangeEvents;
std::list< tListenerCallback* > mListeners;
std::list< S32 > mListenerIDs;
virtual void updateListeners();
S32 addListener(tListenerCallback* cbfn);
LLControl(
const LLString& name,
eControlType type,
LLSD initial, const
LLString& comment,
BOOL persist = TRUE);
void set(LLSD val) { setValue(val); }
LLSD get() const { return getValue(); }
LLSD getdefault() const { return mDefault; }
LLSD getValue() const { return mCurrent; }
BOOL llsd_compare(const LLSD& a, const LLSD& b);
void setValue(LLSD value)
{
if (llsd_compare(mCurrent, value) == FALSE)
{
mCurrent = value;
mIsDefault = llsd_compare(mCurrent, mDefault);
firePropertyChanged();
}
}
/*virtual*/ void resetToDefault()
{
setValue(mDefault);
}
virtual ~LLControl()
bool isDefault() { return (mValues.size() == 1); }
bool isSaveValueDefault();
bool isPersisted() { return mPersist; }
void set(const LLSD& val) { setValue(val); }
LLSD get() const { return getValue(); }
LLSD getDefault() const { return mValues.front(); }
LLSD getValue() const { return mValues.back(); }
LLSD getSaveValue() const;
void setValue(const LLSD& value, bool saved_value = TRUE);
void firePropertyChanged()
{
//Remove and deregister all listeners..
while(mListenerIDs.size())
{
S32 id = mListenerIDs.front();
mListenerIDs.pop_front();
releaseListenerID(id);
}
mSignal(mValues.back());
}
BOOL llsd_compare(const LLSD& a, const LLSD& b);
};
//const U32 STRING_CACHE_SIZE = 10000;
class LLControlGroup
{
public:
typedef std::map<LLString, LLPointer<LLControlBase> > ctrl_name_table_t;
protected:
typedef std::map<LLString, LLControlVariable* > ctrl_name_table_t;
ctrl_name_table_t mNameTable;
std::set<LLString> mWarnings;
std::set<LLString> mLoadedSettings; // Filled in with names loaded from settings.xml
LLString mTypeString[TYPE_COUNT];
eControlType typeStringToEnum(const LLString& typestr);
LLString typeEnumToString(eControlType typeenum);
public:
LLControlGroup();
~LLControlGroup();
void cleanup();
bool hasLoaded(const LLString& name) { return mLoadedSettings.find(name) != mLoadedSettings.end(); }
void clearLoaded() { mLoadedSettings.clear(); } // Call once we've done any settings tweaks which may need this data
LLControlBase* getControl(const LLString& name);
LLSD registerListener(const LLString& name, LLSimpleListenerObservable *listener);
LLControlVariable* getControl(const LLString& name);
struct ApplyFunctor
{
virtual ~ApplyFunctor() {};
virtual void apply(const LLString& name, LLControlVariable* control) = 0;
};
void applyToAll(ApplyFunctor* func);
BOOL declareControl(const LLString& name, eControlType type, const LLSD initial_val, const LLString& comment, BOOL persist);
BOOL declareU32(const LLString& name, U32 initial_val, const LLString& comment, BOOL persist = TRUE);
@ -224,6 +167,7 @@ public:
BOOL declareColor4U(const LLString& name, const LLColor4U &initial_val, const LLString& comment, BOOL persist = TRUE);
BOOL declareColor4(const LLString& name, const LLColor4 &initial_val, const LLString& comment, BOOL persist = TRUE);
BOOL declareColor3(const LLString& name, const LLColor3 &initial_val, const LLString& comment, BOOL persist = TRUE);
BOOL declareLLSD(const LLString& name, const LLSD &initial_val, const LLString& comment, BOOL persist = TRUE);
LLString findString(const LLString& name);
@ -237,7 +181,7 @@ public:
S32 getS32(const LLString& name);
F32 getF32(const LLString& name);
U32 getU32(const LLString& name);
LLSD getValue(const LLString& name);
LLSD getLLSD(const LLString& name);
// Note: If an LLColor4U control exists, it will cast it to the correct
@ -258,19 +202,21 @@ public:
void setColor4U(const LLString& name, const LLColor4U &val);
void setColor4(const LLString& name, const LLColor4 &val);
void setColor3(const LLString& name, const LLColor3 &val);
void setLLSD(const LLString& name, const LLSD& val);
void setValue(const LLString& name, const LLSD& val);
BOOL controlExists(const LLString& name);
// Returns number of controls loaded, 0 if failed
// If require_declaration is false, will auto-declare controls it finds
// as the given type.
U32 loadFromFileLegacy(const LLString& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING);
U32 loadFromFile(const LLString& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING);
U32 saveToFile(const LLString& filename, BOOL skip_if_default);
void applyOverrides(const std::map<std::string, std::string>& overrides);
U32 loadFromFileLegacy(const LLString& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING);
U32 saveToFile(const LLString& filename, BOOL nondefault_only);
U32 loadFromFile(const LLString& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING);
void resetToDefaults();
// Ignorable Warnings
// Add a config variable to be reset on resetWarnings()

View File

@ -0,0 +1,323 @@
<?xml version="1.0"?>
<llsd>
<map>
<key>help</key>
<map>
<key>desc</key>
<string>display this help message</string>
<key>short</key>
<string>h</string>
</map>
<key>port</key>
<map>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>UserConnectionPort</string>
</map>
<key>drop</key>
<map>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>PacketDropPercentage</string>
</map>
<key>inbw</key>
<map>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>InBandwidth</string>
</map>
<key>outbw</key>
<map>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>OutBandwidth</string>
</map>
<key>grid</key>
<map>
<key>desc</key>
<string>Specify the name of the grid, local, or an IP address to connect to.</string>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>GridChoice</string>
</map>
<key>loginuri</key>
<map>
<key>desc</key>
<string>login server and CGI script to use</string>
<key>count</key>
<integer>1</integer>
<key>compose</key>
<boolean>true</boolean>
<key>map-to</key>
<string>LoginURI</string>
</map>
<key>helperuri</key>
<map>
<key>desc</key>
<string>helper web CGI prefix to use</string>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>HelperURI</string>
</map>
<key>debugviews</key>
<map>
<key>map-to</key>
<string>DebugViews</string>
</map>
<key>skin</key>
<map>
<key>desc</key>
<string>ui/branding skin folder to use</string>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>SkinFolder</string>
</map>
<key>autologin</key>
<map>
<key>desc</key>
<string>log in as last saved user</string>
<key>map-to</key>
<string>AutoLogin</string>
</map>
<key>quitafter</key>
<map>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>QuitAfterSeconds</string>
</map>
<key>rotate</key>
<map>
<key>map-to</key>
<string>RotateRight</string>
</map>
<key>noaudio</key>
<map>
<key>map-to</key>
<string>NoAudio</string>
</map>
<key>nosound</key>
<map>
<key>map-to</key>
<string>NoAudio</string>
</map>
<key>noprobe</key>
<map>
<key>map-to</key>
<string>NoHardwareProbe</string>
</map>
<key>noquicktime</key>
<map>
<key>map-to</key>
<string>NoQuickTime</string>
</map>
<key>nopreload</key>
<map>
<key>map-to</key>
<string>NoPreload</string>
</map>
<key>purge</key>
<map>
<key>desc</key>
<string>Delete files in the cache.</string>
<key>map-to</key>
<string>PurgeCacheOnNextStartup</string>
</map>
<key>noinvlib</key>
<map>
<key>desc</key>
<string>Do not request the inventory library.</string>
<key>map-to</key>
<string>NoInventoryLibrary</string>
</map>
<key>logfile</key>
<map>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>UserLogFile</string>
</map>
<key>setdefault</key>
<map>
<key>desc</key>
<string>
"specify the value of a particular\n
configuration variable which can be\n
overridden by settings.xml\n"
</string>
<key>count</key>
<integer>2</integer>
<!-- Special case. Mapped to settings procedurally. -->
</map>
<key>set</key>
<map>
<key>desc</key>
<string>
"specify the value of a particular\n
configuration variable that\n
overrides all other settings\n"
</string>
<key>count</key>
<integer>2</integer>
<!-- Special case. Mapped to settings procedurally. -->
</map>
<key>settings</key>
<map>
<key>desc</key>
<string>Specify the filename of a configuration file.</string>
<key>count</key>
<integer>1</integer>
<!-- Special case. Mapped to settings procedurally. -->
</map>
<key>login</key>
<map>
<key>desc</key>
<string>3 tokens: first, last and password</string>
<key>count</key>
<integer>3</integer>
<key>map-to</key>
<string>UserLoginInfo</string>
</map>
<key>god</key>
<map>
<key>desc</key>
<string>Log in a god if you have god access.</string>
<key>map-to</key>
<string>ConnectAsGod</string>
</map>
<key>console</key>
<map>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>ShowConsoleWindow</string>
</map>
<key>safe</key>
<map>
<key>desc</key>
<string>Reset preferences, run in safe mode.</string>
<key>map-to</key>
<string>SafeMode</string>
</map>
<key>multiple</key>
<map>
<key>desc</key>
<string>Allow multple viewers.</string>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>AllowMultipleViewers</string>
</map>
<key>novoice</key>
<map>
<key>desc</key>
<string>Disable voice.</string>
<key>map-to</key>
<string>CmdLineDisableVoice</string>
</map>
<key>url</key>
<map>
<key>desc</key>
<string>Startup location</string>
<key>count</key>
<integer>1</integer>
<key>last_option</key>
<boolean>true</boolean>
<!-- Special case. Not mapped to a setting. -->
</map>
<key>slurl</key>
<map>
<key>desc</key>
<string>Startup SLurl</string>
<key>count</key>
<integer>1</integer>
<key>positional</key>
<boolean>true</boolean>
<key>last_option</key>
<boolean>true</boolean>
<!-- Special case. Not mapped to a setting. -->
</map>
<key>ignorepixeldepth</key>
<map>
<key>desc</key>
<string>Ignore pixel depth settings.</string>
<key>map-to</key>
<string>IgnorePixelDepth</string>
</map>
<key>cooperative</key>
<map>
<key>desc</key>
<string>Yield some idle time to local host.</string>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>YieldTime</string>
</map>
<key>no-verify-ssl-cert</key>
<map>
<key>map-to</key>
<string>NoVerifySSLCert</string>
</map>
<key>channel</key>
<map>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>VersionChannelName</string>
</map>
<key>loginpage</key>
<map>
<key>desc</key>
<string>Login authentication page to use.</string>
<key>count</key>
<integer>1</integer>
<key>map-to</key>
<string>LoginPage</string>
</map>
</map>
</llsd>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
<llsd>
<map>
<key>CrashSubmitBehavior</key>
<map>
<key>Comment</key>
<string>Controls behavior when viewer crashes (0 = ask before sending crash report, 1 = always send crash report, 2 = never send crash report)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>0</integer>
</map>
</map>
</llsd>

View File

@ -0,0 +1,22 @@
<llsd>
<map>
<key>Files</key>
<map>
<key>Comment</key>
<string>List of settings files to load. Key is the identifier, value is the filename</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>LLSD</string>
<key>Value</key>
<map>
<key>Global</key>
<string>settings.xml</string>
<key>PerAccount</key>
<string>settings_per_account.xml</string>
<key>CrashSettings</key>
<string>settings_crash_behavior.xml</string>
</map>
</map>
</map>
</llsd>

View File

@ -0,0 +1,114 @@
<llsd>
<map>
<key>BusyModeResponse</key>
<map>
<key>Comment</key>
<string>Auto response to instant messages while in busy mode.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>The Resident you messaged is in &apos;busy mode&apos; which means they have requested not to be disturbed. Your message will still be shown in their IM panel for later viewing.</string>
</map>
<key>IMLogTimestamp</key>
<map>
<key>Comment</key>
<string>Log Timestamp of Instant Messages</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>InstantMessageLogPath</key>
<map>
<key>Comment</key>
<string>Path to your log files.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string />
</map>
<key>LastLogoff</key>
<map>
<key>Comment</key>
<string>Last logoff</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>LogChat</key>
<map>
<key>Comment</key>
<string>Log Chat</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>LogChatIM</key>
<map>
<key>Comment</key>
<string>Log Incoming Instant Messages with Chat</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>LogChatTimestamp</key>
<map>
<key>Comment</key>
<string>Log Timestamp of Chat</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>LogInstantMessages</key>
<map>
<key>Comment</key>
<string>Log Instant Messages</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>LogShowHistory</key>
<map>
<key>Comment</key>
<string>Log Show History</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>LogTimestampDate</key>
<map>
<key>Comment</key>
<string>Include Date with Timestamp</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
</map>
</llsd>

View File

@ -917,19 +917,19 @@ Function .onInit
; generate language ID that will be used as a command line arg
StrCmp $LANGUAGE "1042" 0 +3
StrCpy $LANGFLAGS " -set SystemLanguage ko"
StrCpy $LANGFLAGS " --set SystemLanguage ko"
Goto EndOfFunc
StrCmp $LANGUAGE "1041" 0 +3
StrCpy $LANGFLAGS " -set SystemLanguage ja"
StrCpy $LANGFLAGS " --set SystemLanguage ja"
Goto EndOfFunc
StrCmp $LANGUAGE "1031" 0 +3
StrCpy $LANGFLAGS " -set SystemLanguage de"
StrCpy $LANGFLAGS " --set SystemLanguage de"
Goto EndOfFunc
StrCmp $LANGUAGE "1033" 0 +3
StrCpy $LANGFLAGS " -set SystemLanguage en-us"
StrCpy $LANGFLAGS " --set SystemLanguage en-us"
Goto EndOfFunc
EndOfFunc:

View File

@ -273,8 +273,7 @@ void LLAgentFriendObserver::changed(U32 mask)
// LLAgent()
//-----------------------------------------------------------------------------
LLAgent::LLAgent()
: mViewerPort(NET_USE_OS_ASSIGNED_PORT),
mDrawDistance( DEFAULT_FAR_PLANE ),
: mDrawDistance( DEFAULT_FAR_PLANE ),
mDoubleTapRunTimer(),
mDoubleTapRunMode(DOUBLETAP_NONE),
@ -455,8 +454,6 @@ void LLAgent::init()
mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject");
// LLDebugVarMessageBox::show("Camera Lag", &CAMERA_FOCUS_HALF_LIFE, 0.5f, 0.01f);
gSavedSettings.getControl("RenderHideGroupTitle")->addListener(&mHideGroupTitleListener);
gSavedSettings.getControl("EffectColor")->addListener(&mEffectColorListener);
mEffectColor = gSavedSettings.getColor4("EffectColor");
@ -7466,19 +7463,6 @@ void LLAgent::userRemoveAllAttachments( void* userdata )
gMessageSystem->sendReliable( gAgent.getRegionHost() );
}
bool LLAgent::LLHideGroupTitleListener::handleEvent(LLPointer<LLEvent> event, const LLSD &userdata)
{
gAgent.setHideGroupTitle(event->getValue());
return true;
}
bool LLAgent::LLEffectColorListener::handleEvent(LLPointer<LLEvent> event, const LLSD &userdata)
{
gAgent.setEffectColor(LLColor4(event->getValue()));
return true;
}
void LLAgent::observeFriends()
{
if(!mFriendObserver)

View File

@ -36,6 +36,7 @@
#include "indra_constants.h"
#include "llmath.h"
#include "llcontrol.h"
#include "llcoordframe.h"
#include "llevent.h"
#include "llagentconstants.h"
@ -225,8 +226,8 @@ public:
// update internal datastructures and update the server with the
// new contribution level. Returns true if the group id was found
// and contribution could be set.
BOOL setGroupContribution(const LLUUID& group_id, S32 contribution);
BOOL setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile);
BOOL setGroupContribution(const LLUUID& group_id, S32 contribution);
BOOL setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile);
void setHideGroupTitle(BOOL hide) { mHideGroupTitle = hide; }
//
@ -686,7 +687,6 @@ protected:
BOOL notify = TRUE);
public:
// TODO: Make these private!
U32 mViewerPort; // Port this agent transmits on.
LLUUID mSecureSessionID; // secure token for this login session
F32 mDrawDistance;
@ -932,21 +932,6 @@ private:
LLPointer<LLRefCount> mCB;
};
//control listeners
class LLHideGroupTitleListener: public LLSimpleListener
{
public:
bool handleEvent(LLPointer<LLEvent> event, const LLSD &userdata);
};
class LLEffectColorListener: public LLSimpleListener
{
public:
bool handleEvent(LLPointer<LLEvent> event, const LLSD &userdata);
};
LLHideGroupTitleListener mHideGroupTitleListener;
LLEffectColorListener mEffectColorListener;
LLFriendObserver* mFriendObserver;
};

File diff suppressed because it is too large Load Diff

View File

@ -36,15 +36,21 @@ class LLTextureCache;
class LLWorkerThread;
class LLTextureFetch;
class LLCommandLineParser;
class LLAppViewer : public LLApp
{
public:
LLAppViewer();
virtual ~LLAppViewer();
// *NOTE:Mani - Don't use this!
// Having
static LLAppViewer* instance() {return sInstance; }
/**
* @brief Access to the LLAppViewer singleton.
*
* The LLAppViewer singleton is created in main()/WinMain().
* So don't use it in pre-entry (static initialization) code.
*/
static LLAppViewer* instance() {return sInstance; }
//
// Main application logic
@ -64,10 +70,6 @@ public:
bool quitRequested() { return mQuitRequested; }
bool logoutRequestSent() { return mLogoutRequestSent; }
// *FIX: This is meant to stay only until the command line issues are hashed out with repect to LLApp::parseCommandLine
// This version stores the argc and argv for later usage, make sure the params passed in last as long as this class.
bool tempStoreCommandOptions(int argc, char** argv);
void closeDebug();
const LLOSInfo& getOSInfo() const { return mSysOSInfo; }
@ -87,9 +89,6 @@ public:
const std::string& getSerialNumber() { return mSerialNumber; }
// *FIX:Mani purgeCache was made public for parse_args().
// If that beast is gone, make it private.
void purgeCache(); // Clear the local cache.
bool getPurgeCache() const { return mPurgeCache; }
const LLString& getSecondLifeTitle() const; // The Second Life title.
@ -101,8 +100,6 @@ public:
const std::vector<std::string>& getLoginURIs() const;
const std::string& getHelperURI() const;
void resetURIs() const;
void setLoginPage(const std::string& login_page);
const std::string& getLoginPage();
void forceDisconnect(const LLString& msg); // Force disconnection, with a message to the user.
void badNetworkHandler(); // Cause a crash state due to bad network packet.
@ -125,23 +122,26 @@ public:
virtual void forceErrorInifiniteLoop();
virtual void forceErrorSoftwareException();
void loadSettingsFromDirectory(ELLPath path_index);
protected:
virtual bool initWindow(); // Initialize the viewer's window.
virtual bool initLogging(); // Initialize log files, logging system, return false on failure.
virtual void initConsole() {}; // Initialize OS level debugging console.
virtual bool initHardwareTest() { return true; } // A false result indicates the app should quit.
virtual bool initParseCommandLine(LLCommandLineParser& clp)
{ return true; } // Allow platforms to specify the command line args.
virtual std::string generateSerialNumber() = 0; // Platforms specific classes generate this.
private:
bool initEarlyConfiguration(); // Initialize setting needed by crash reporting.
bool initThreads(); // Initialize viewer threads, return false on failure.
bool initConfiguration(); // Initialize settings from the command line/config file.
bool initCache(); // Initialize local client cache.
bool doConfigFromCommandLine(); // calls parse args.
void purgeCache(); // Clear the local cache.
void cleanupSavedSettings(); // Sets some config data to current or default values during cleanup.
void removeCacheFiles(const char *filemask); // Deletes cached files the match the given wildcard.
@ -186,6 +186,8 @@ private:
bool mQuitRequested; // User wants to quit, may have modified documents open.
bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim.
S32 mYieldTime;
LLSD mSettingsFileList;
};
// consts from viewer.h
@ -196,31 +198,16 @@ const S32 AGENT_UPDATES_PER_SECOND = 10;
//
// "// llstartup" indicates that llstartup is the only client for this global.
extern bool gVerifySSLCert; // parse_args setting used by llxmlrpctransaction.cpp
extern BOOL gHandleKeysAsync; // gSavedSettings used by llviewerdisplay.cpp & llviewermenu.cpp
extern BOOL gProbeHardware;
extern LLString gDisabledMessage; // llstartup
extern BOOL gHideLinks; // used by llpanellogin, lllfloaterbuycurrency, llstartup
extern LLSD gDebugInfo;
extern BOOL gAllowIdleAFK;
extern F32 gAFKTimeout;
extern BOOL gShowObjectUpdates;
extern BOOL gLogMessages; // llstartup
extern std::string gChannelName;
extern BOOL gUseAudio; // llstartup
extern LLString gCmdLineFirstName; // llstartup
extern LLString gCmdLineLastName;
extern LLString gCmdLinePassword;
extern BOOL gAutoLogin; // llstartup
extern const char* DEFAULT_SETTINGS_FILE; // llstartup
extern BOOL gRequestInventoryLibrary; // llstartup
extern BOOL gGodConnect; // llstartup
extern BOOL gAcceptTOS;
extern BOOL gAcceptCriticalMessage;
@ -264,7 +251,6 @@ extern LLUUID gInventoryLibraryOwner;
extern LLUUID gInventoryLibraryRoot;
extern BOOL gDisconnected;
extern BOOL gDisableVoice;
// Map scale in pixels per region
extern F32 gMapScale;
@ -274,9 +260,6 @@ extern LLFrameTimer gRestoreGLTimer;
extern BOOL gRestoreGL;
extern BOOL gUseWireframe;
extern F32 gMouseSensitivity;
extern BOOL gInvertMouse;
// VFS globals - gVFS is for general use
// gStaticVFS is read-only and is shipped w/ the viewer
// it has pre-cache data like the UI .TGAs
@ -284,9 +267,6 @@ extern LLVFS *gStaticVFS;
extern LLMemoryInfo gSysMemory;
extern bool gPreloadImages;
extern bool gPreloadSounds;
extern LLString gLastVersionChannel;
extern LLVector3 gWindVec;
@ -297,10 +277,7 @@ extern BOOL gPrintMessagesThisFrame;
extern LLUUID gSunTextureID;
extern LLUUID gMoonTextureID;
extern BOOL gUseConsole;
extern BOOL gRandomizeFramerate;
extern BOOL gPeriodicSlowFrame;
extern BOOL gQAMode;
#endif // LL_LLAPPVIEWER_H

View File

@ -31,9 +31,11 @@
#include "llviewerprecompiledheaders.h"
#include "llmemtype.h"
#include "llappviewerlinux.h"
#include "llcommandlineparser.h"
#include "llmemtype.h"
#include "llviewernetwork.h"
#include "llmd5.h"
@ -54,6 +56,12 @@
# include <ucontext.h>
#endif
namespace
{
int gArgC = 0;
char **gArgV = NULL;
}
int main( int argc, char **argv )
{
LLMemType mt1(LLMemType::MTYPE_STARTUP);
@ -62,18 +70,14 @@ int main( int argc, char **argv )
asm ("ta\t6"); // NOTE: Make sure memory alignment is enforced on SPARC
#endif
gArgC = argc;
gArgV = argv;
LLAppViewer* viewer_app_ptr = new LLAppViewerLinux();
viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash);
bool ok = viewer_app_ptr->tempStoreCommandOptions(argc, argv);
if(!ok)
{
llwarns << "Unable to parse command line." << llendl;
return -1;
}
ok = viewer_app_ptr->init();
bool ok = viewer_app_ptr->init();
if(!ok)
{
llwarns << "Application init failed." << llendl;
@ -321,7 +325,7 @@ void LLAppViewerLinux::handleCrashReporting()
{(char*)cmd.c_str(),
ask_dialog,
(char*)"-user",
(char*)gGridName,
(char*)gGridName.c_str(),
(char*)"-name",
(char*)LLAppViewer::instance()->getSecondLifeTitle().c_str(),
NULL};
@ -403,6 +407,12 @@ bool LLAppViewerLinux::initLogging()
return LLAppViewer::initLogging();
}
bool LLAppViewerLinux::initParseCommandLine(LLCommandLineParser& clp)
{
clp.parseCommandLine(gArgC, gArgV);
return true;
}
std::string LLAppViewerLinux::generateSerialNumber()
{
char serial_md5[MD5HEX_STR_SIZE];

View File

@ -36,6 +36,8 @@
#include "llappviewer.h"
#endif
class LLCommandLineParser;
class LLAppViewerLinux : public LLAppViewer
{
public:
@ -54,6 +56,7 @@ protected:
virtual void handleCrashReporting();
virtual bool initLogging();
virtual bool initParseCommandLine(LLCommandLineParser& clp);
};
#endif // LL_LLAPPVIEWERLINUX_H

View File

@ -36,15 +36,25 @@
#endif
#include "llappviewermacosx.h"
#include "llcommandlineparser.h"
#include "llmemtype.h"
#include "llviewernetwork.h"
#include "llviewercontrol.h"
#include "llmd5.h"
#include "llurlsimstring.h"
#include "llfloaterworldmap.h"
#include "llurldispatcher.h"
#include <Carbon/Carbon.h>
namespace
{
// The command line args stored.
// They are not used immediately by the app.
int gArgC;
char** gArgV;
}
int main( int argc, char **argv )
{
@ -61,14 +71,11 @@ int main( int argc, char **argv )
viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash);
bool ok = viewer_app_ptr->tempStoreCommandOptions(argc, argv);
if(!ok)
{
llwarns << "Unable to parse command line." << llendl;
return -1;
}
ok = viewer_app_ptr->init();
// Store off the command line args for use later.
gArgC = argc;
gArgV = argv;
bool ok = viewer_app_ptr->init();
if(!ok)
{
llwarns << "Application init failed." << llendl;
@ -108,6 +115,51 @@ bool LLAppViewerMacOSX::init()
return LLAppViewer::init();
}
bool LLAppViewerMacOSX::initParseCommandLine(LLCommandLineParser& clp)
{
// First parse the command line, not often used on the mac.
clp.parseCommandLine(gArgC, gArgV);
// Now read in the args from arguments txt.
// Succesive calls to clp.parse... will NOT override earlier
// options.
const char* filename = "arguments.txt";
llifstream ifs(filename, llifstream::binary);
if (!ifs.is_open())
{
llwarns << "Unable to open file" << filename << llendl;
return false;
}
clp.parseCommandLineFile(ifs);
// Get the user's preferred language string based on the Mac OS localization mechanism.
// To add a new localization:
// go to the "Resources" section of the project
// get info on "language.txt"
// in the "General" tab, click the "Add Localization" button
// create a new localization for the language you're adding
// set the contents of the new localization of the file to the string corresponding to our localization
// (i.e. "en-us", "ja", etc. Use the existing ones as a guide.)
CFURLRef url = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("language"), CFSTR("txt"), NULL);
char path[MAX_PATH];
if(CFURLGetFileSystemRepresentation(url, false, (UInt8 *)path, sizeof(path)))
{
LLString lang;
if(_read_file_into_string(lang, path)) /* Flawfinder: ignore*/
{
LLControlVariable* c = gSavedSettings.getControl("SystemLanguage");
if(c)
{
c->setValue(lang, false);
}
}
}
CFRelease(url);
return true;
}
void LLAppViewerMacOSX::handleCrashReporting()
{
// Macintosh

View File

@ -51,6 +51,7 @@ public:
protected:
virtual void handleCrashReporting();
std::string generateSerialNumber();
virtual bool initParseCommandLine(LLCommandLineParser& clp);
};
#endif // LL_LLAPPVIEWERMACOSX_H

View File

@ -55,41 +55,13 @@
#include "llviewernetwork.h"
#include "llmd5.h"
void fill_args(int& argc, char** argv, const S32 max_args, LPSTR cmd_line)
{
char *token = NULL;
if( cmd_line[0] == '\"' )
{
// Exe name is enclosed in quotes
token = strtok( cmd_line, "\"" );
argv[argc++] = token;
token = strtok( NULL, " \t," );
}
else
{
// Exe name is not enclosed in quotes
token = strtok( cmd_line, " \t," );
}
#include "llcommandlineparser.h"
while( (token != NULL) && (argc < max_args) )
{
argv[argc++] = token;
/* Get next token: */
if (*(token + strlen(token) + 1) == '\"') /* Flawfinder: ignore*/
{
token = strtok( NULL, "\"");
}
else
{
token = strtok( NULL, " \t," );
}
}
}
// *NOTE:Mani - this code is stolen from LLApp, where its never actually used.
LONG WINAPI viewer_windows_exception_handler(struct _EXCEPTION_POINTERS *exception_infop)
{
// Translate the signals/exceptions into cross-platform stuff
// *NOTE:Mani - this code is stolen from LLApp, where its never actually used.
// Translate the signals/exceptions into cross-platform stuff
// Windows implementation
llinfos << "Entering Windows Exception Handler..." << llendl;
@ -144,21 +116,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
// *FIX: global
gIconResource = MAKEINTRESOURCE(IDI_LL_ICON);
// In Win32, we need to generate argc and argv ourselves...
// Note: GetCommandLine() returns a potentially return a LPTSTR
// which can resolve to a LPWSTR (unicode string).
// (That's why it's different from lpCmdLine which is a LPSTR.)
// We don't currently do unicode, so call the non-unicode version
// directly.
LPSTR cmd_line_including_exe_name = GetCommandLineA();
const S32 MAX_ARGS = 100;
int argc = 0;
char* argv[MAX_ARGS]; /* Flawfinder: ignore */
fill_args(argc, argv, MAX_ARGS, cmd_line_including_exe_name);
LLAppViewerWin32* viewer_app_ptr = new LLAppViewerWin32();
LLAppViewerWin32* viewer_app_ptr = new LLAppViewerWin32(lpCmdLine);
// *FIX:Mani This method is poorly named, since the exception
// is now handled by LLApp.
@ -180,13 +138,6 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
viewer_app_ptr->setErrorHandler(LLAppViewer::handleViewerCrash);
ok = viewer_app_ptr->tempStoreCommandOptions(argc, argv);
if(!ok)
{
llwarns << "Unable to parse command line." << llendl;
return -1;
}
ok = viewer_app_ptr->init();
if(!ok)
{
@ -308,7 +259,8 @@ void create_console()
setvbuf( stderr, NULL, _IONBF, 0 );
}
LLAppViewerWin32::LLAppViewerWin32()
LLAppViewerWin32::LLAppViewerWin32(const char* cmd_line) :
mCmdLine(cmd_line)
{
}
@ -339,15 +291,11 @@ bool LLAppViewerWin32::cleanup()
return result;
}
bool LLAppViewerWin32::initWindow()
void LLAppViewerWin32::initConsole()
{
// pop up debug console if necessary
if (gUseConsole && gSavedSettings.getBOOL("ShowConsoleWindow"))
{
create_console();
}
return LLAppViewer::initWindow();
// pop up debug console
create_console();
return LLAppViewer::initConsole();
}
void write_debug_dx(const char* str)
@ -368,7 +316,7 @@ bool LLAppViewerWin32::initHardwareTest()
// Do driver verification and initialization based on DirectX
// hardware polling and driver versions
//
if (gProbeHardware)
if (FALSE == gSavedSettings.getBOOL("NoHardwareProbe"))
{
BOOL vram_only = !gSavedSettings.getBOOL("ProbeHardwareOnStartup");
@ -431,6 +379,11 @@ bool LLAppViewerWin32::initHardwareTest()
return true;
}
bool LLAppViewerWin32::initParseCommandLine(LLCommandLineParser& clp)
{
return clp.parseCommandLineString(mCmdLine);
}
void LLAppViewerWin32::handleCrashReporting()
{
// Windows only behaivor. Spawn win crash reporter.
@ -486,4 +439,4 @@ std::string LLAppViewerWin32::generateSerialNumber()
llwarns << "GetVolumeInformation failed" << llendl;
}
return serial_md5;
}
}

View File

@ -39,7 +39,7 @@
class LLAppViewerWin32 : public LLAppViewer
{
public:
LLAppViewerWin32();
LLAppViewerWin32(const char* cmd_line);
virtual ~LLAppViewerWin32();
//
@ -49,15 +49,18 @@ public:
virtual bool cleanup();
protected:
virtual bool initWindow(); // Initialize the viewer's window.
virtual void initConsole(); // Initialize OS level debugging console.
virtual bool initHardwareTest(); // Win32 uses DX9 to test hardware.
virtual void handleCrashReporting();
virtual bool initParseCommandLine(LLCommandLineParser& clp);
virtual void handleCrashReporting();
std::string generateSerialNumber();
private:
void disableWinErrorReporting();
std::string mCmdLine;
};
#endif // LL_LLAPPVIEWERWIN32_H

View File

@ -0,0 +1,535 @@
/**
* @file llcommandlineparser.cpp
* @brief The LLCommandLineParser class definitions
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
*
* Copyright (c) 2007, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llcommandlineparser.h"
// *NOTE: The boost::lexical_cast generates
// the warning C4701(local used with out assignment) in VC7.1.
// Disable the warning for the boost includes.
#if _MSC_VER
# pragma warning(push)
# pragma warning( disable : 4701 )
#else
// NOTE: For the other platforms?
#endif
#include <boost/program_options.hpp>
#include <boost/bind.hpp>
#include<boost/tokenizer.hpp>
#if _MSC_VER
# pragma warning(pop)
#endif
#include "llsdserialize.h"
#include <iostream>
#include <sstream>
#include "llcontrol.h"
namespace po = boost::program_options;
// *NTOE:MEP - Currently the boost object reside in file scope.
// This has a couple of negatives, they are always around and
// there can be only one instance of each.
// The plus is that the boost-ly-ness of this implementation is
// hidden from the rest of the world.
// Its importatnt to realize that multiple LLCommandLineParser objects
// will all have this single repository of option escs and parsed options.
// This could be good or bad, and probably won't matter for most use cases.
namespace
{
po::options_description gOptionsDesc;
po::positional_options_description gPositionalOptions;
po::variables_map gVariableMap;
const LLCommandLineParser::token_vector_t gEmptyValue;
void read_file_into_string(std::string& str, const std::basic_istream < char >& file)
{
std::ostringstream oss;
oss << file.rdbuf();
str = oss.str();
}
bool gPastLastOption = false;
}
class LLCLPError : public std::logic_error {
public:
LLCLPError(const std::string& what) : std::logic_error(what) {}
};
class LLCLPLastOption : public std::logic_error {
public:
LLCLPLastOption(const std::string& what) : std::logic_error(what) {}
};
class LLCLPValue : public po::value_semantic_codecvt_helper<char>
{
unsigned mMinTokens;
unsigned mMaxTokens;
bool mIsComposing;
typedef boost::function1<void, const LLCommandLineParser::token_vector_t&> notify_callback_t;
notify_callback_t mNotifyCallback;
bool mLastOption;
public:
LLCLPValue() :
mMinTokens(0),
mMaxTokens(0),
mIsComposing(false),
mLastOption(false)
{}
virtual ~LLCLPValue() {};
void setMinTokens(unsigned c)
{
mMinTokens = c;
}
void setMaxTokens(unsigned c)
{
mMaxTokens = c;
}
void setComposing(bool c)
{
mIsComposing = c;
}
void setLastOption(bool c)
{
mLastOption = c;
}
void setNotifyCallback(notify_callback_t f)
{
mNotifyCallback = f;
}
// Overrides to support the value_semantic interface.
virtual std::string name() const
{
const std::string arg("arg");
const std::string args("args");
return (max_tokens() > 1) ? args : arg;
}
virtual unsigned min_tokens() const
{
return mMinTokens;
}
virtual unsigned max_tokens() const
{
return mMaxTokens;
}
virtual bool is_composing() const
{
return mIsComposing;
}
virtual bool apply_default(boost::any& value_store) const
{
return false; // No defaults.
}
virtual void notify(const boost::any& value_store) const
{
const LLCommandLineParser::token_vector_t* value =
boost::any_cast<const LLCommandLineParser::token_vector_t>(&value_store);
if(mNotifyCallback)
{
mNotifyCallback(*value);
}
}
protected:
void xparse(boost::any& value_store,
const std::vector<std::string>& new_tokens) const
{
if(gPastLastOption)
{
throw(LLCLPLastOption("Don't parse no more!"));
}
// Error checks. Needed?
if (!value_store.empty() && !is_composing())
{
throw(LLCLPError("Non composing value with multiple occurences."));
}
if (new_tokens.size() < min_tokens() || new_tokens.size() > max_tokens())
{
throw(LLCLPError("Illegal number of tokens specified."));
}
if(value_store.empty())
{
value_store = boost::any(LLCommandLineParser::token_vector_t());
}
LLCommandLineParser::token_vector_t* tv =
boost::any_cast<LLCommandLineParser::token_vector_t>(&value_store);
for(unsigned i = 0; i < new_tokens.size() && i < mMaxTokens; ++i)
{
tv->push_back(new_tokens[i]);
}
if(mLastOption)
{
gPastLastOption = true;
}
}
};
//----------------------------------------------------------------------------
// LLCommandLineParser defintions
//----------------------------------------------------------------------------
void LLCommandLineParser::addOptionDesc(const LLString& option_name,
boost::function1<void, const token_vector_t&> notify_callback,
unsigned int token_count,
const LLString& description,
const LLString& short_name,
bool composing,
bool positional,
bool last_option)
{
// Compose the name for boost::po.
// It takes the format "long_name, short name"
const LLString comma(",");
LLString boost_option_name = option_name;
if(short_name != LLString::null)
{
boost_option_name += comma;
boost_option_name += short_name;
}
LLCLPValue* value_desc = new LLCLPValue();
value_desc->setMinTokens(token_count);
value_desc->setMaxTokens(token_count);
value_desc->setComposing(composing);
value_desc->setLastOption(last_option);
boost::shared_ptr<po::option_description> d(
new po::option_description(boost_option_name.c_str(),
value_desc,
description.c_str()));
if(!notify_callback.empty())
{
value_desc->setNotifyCallback(notify_callback);
}
gOptionsDesc.add(d);
if(positional)
{
gPositionalOptions.add(boost_option_name.c_str(), token_count);
}
}
bool parseAndStoreResults(po::command_line_parser& clp)
{
try
{
clp.options(gOptionsDesc);
clp.positional(gPositionalOptions);
clp.style(po::command_line_style::default_style
| po::command_line_style::allow_long_disguise);
po::basic_parsed_options<char> opts = clp.run();
po::store(opts, gVariableMap);
}
catch(po::error& e)
{
llwarns << "Caught Error:" << e.what() << llendl;
return false;
}
catch(LLCLPError& e)
{
llwarns << "Caught Error:" << e.what() << llendl;
return false;
}
catch(LLCLPLastOption&)
{
// Continue without parsing.
llwarns << "Found tokens past last option. Ignoring." << llendl;
// boost::po will have stored a mal-formed option.
// All such options will be removed below.
for(po::variables_map::iterator i = gVariableMap.begin(); i != gVariableMap.end();)
{
po::variables_map::iterator tempI = i++;
if(tempI->second.empty())
{
gVariableMap.erase(tempI);
}
}
}
return true;
}
bool LLCommandLineParser::parseCommandLine(int argc, char **argv)
{
po::command_line_parser clp(argc, argv);
return parseAndStoreResults(clp);
}
bool LLCommandLineParser::parseCommandLineString(const std::string& str)
{
// Split the string content into tokens
boost::escaped_list_separator<char> sep("\\", "\r\n ", "\"'");
boost::tokenizer< boost::escaped_list_separator<char> > tok(str, sep);
std::vector<std::string> tokens;
// std::copy(tok.begin(), tok.end(), std::back_inserter(tokens));
for(boost::tokenizer< boost::escaped_list_separator<char> >::iterator i = tok.begin();
i != tok.end();
++i)
{
if(0 != i->size())
{
tokens.push_back(*i);
}
}
po::command_line_parser clp(tokens);
return parseAndStoreResults(clp);
}
bool LLCommandLineParser::parseCommandLineFile(const std::basic_istream < char >& file)
{
std::string args;
read_file_into_string(args, file);
return parseCommandLineString(args);
}
void LLCommandLineParser::notify()
{
po::notify(gVariableMap);
}
void LLCommandLineParser::printOptions() const
{
for(po::variables_map::iterator i = gVariableMap.begin(); i != gVariableMap.end(); ++i)
{
std::string name = i->first;
token_vector_t values = i->second.as<token_vector_t>();
std::ostringstream oss;
oss << name << ": ";
for(token_vector_t::iterator t_itr = values.begin(); t_itr != values.end(); ++t_itr)
{
oss << t_itr->c_str() << " ";
}
llinfos << oss.str() << llendl;
}
}
std::ostream& LLCommandLineParser::printOptionsDesc(std::ostream& os) const
{
return os << gOptionsDesc;
}
bool LLCommandLineParser::hasOption(const std::string& name) const
{
return gVariableMap.count(name) > 0;
}
const LLCommandLineParser::token_vector_t& LLCommandLineParser::getOption(const std::string& name) const
{
if(hasOption(name))
{
return gVariableMap[name].as<token_vector_t>();
}
return gEmptyValue;
}
//----------------------------------------------------------------------------
// LLControlGroupCLP defintions
//----------------------------------------------------------------------------
void setControlValueCB(const LLCommandLineParser::token_vector_t& value,
const LLString& opt_name,
LLControlGroup* ctrlGroup)
{
if(value.size() > 1)
{
llwarns << "Ignoring extra tokens mapped to the setting: " << opt_name << "." << llendl;
}
// *FIX: Do sematic conversion here.
// LLSD (ImplString) Is no good for doing string to type conversion for...
// booleans
// compound types
// ?...
LLControlVariable* ctrl = ctrlGroup->getControl(opt_name);
if(NULL != ctrl)
{
switch(ctrl->type())
{
case TYPE_BOOLEAN:
if(value.size() > 1)
{
llwarns << "Ignoring extra tokens." << llendl;
}
if(value.size() > 0)
{
// There's a token. check the string for true/false/1/0 etc.
BOOL result = false;
BOOL gotSet = LLString::convertToBOOL(value[0], result);
if(gotSet)
{
ctrl->setValue(LLSD(result), false);
}
}
else
{
ctrl->setValue(LLSD(true), false);
}
break;
default:
{
// For the default types, let llsd do the conversion.
if(value.size() > 1)
{
// Assume its an array...
LLSD llsdArray;
for(unsigned int i = 0; i < value.size(); ++i)
{
LLSD llsdValue;
llsdValue.assign(LLSD::String(value[i]));
llsdArray.set(i, llsdValue);
}
ctrl->setValue(llsdArray, false);
}
else if(value.size() > 0)
{
LLSD llsdValue;
llsdValue.assign(LLSD::String(value[0]));
ctrl->setValue(llsdValue, false);
}
}
break;
}
}
else
{
llwarns << "Command Line option mapping '"
<< opt_name
<< "' not found! Ignoring."
<< llendl;
}
}
void LLControlGroupCLP::configure(const LLString& config_filename, LLControlGroup* controlGroup)
{
// This method reads the llsd based config file, and uses it to set
// members of a control group.
LLSD clpConfigLLSD;
llifstream input_stream;
input_stream.open(config_filename.c_str(), std::ios::in | std::ios::binary);
if(input_stream.is_open())
{
LLSDSerialize::fromXML(clpConfigLLSD, input_stream);
for(LLSD::map_iterator option_itr = clpConfigLLSD.beginMap();
option_itr != clpConfigLLSD.endMap();
++option_itr)
{
LLSD::String long_name = option_itr->first;
LLSD option_params = option_itr->second;
LLString desc("n/a");
if(option_params.has("desc"))
{
desc = option_params["desc"].asString();
}
LLString short_name = LLString::null;
if(option_params.has("short"))
{
short_name = option_params["short"].asString();
}
unsigned int token_count = 0;
if(option_params.has("count"))
{
token_count = option_params["count"].asInteger();
}
bool composing = false;
if(option_params.has("compose"))
{
composing = option_params["compose"].asBoolean();
}
bool positional = false;
if(option_params.has("positional"))
{
positional = option_params["positional"].asBoolean();
}
bool last_option = false;
if(option_params.has("last_option"))
{
last_option = option_params["last_option"].asBoolean();
}
boost::function1<void, const token_vector_t&> callback;
if(option_params.has("map-to") && (NULL != controlGroup))
{
LLString controlName = option_params["map-to"].asString();
callback = boost::bind(setControlValueCB, _1,
controlName, controlGroup);
}
this->addOptionDesc(
long_name,
callback,
token_count,
desc,
short_name,
composing,
positional,
last_option);
}
}
}

View File

@ -0,0 +1,131 @@
/**
* @file llcommandlineparser.h
* @brief LLCommandLineParser class declaration
*
* $LicenseInfo:firstyear=2007&license=viewergpl$
*
* Copyright (c) 2007, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#ifndef LL_LLCOMMANDLINEPARSER_H
#define LL_LLCOMMANDLINEPARSER_H
#include <boost/function/function1.hpp>
/**
* @class LLCommandLineParser
* @brief Handle defining and parsing the command line.
*/
class LLCommandLineParser
{
public:
typedef std::vector< std::string > token_vector_t;
/**
* @brief Add a value-less option to the command line description.
* @param option_name The long name of the cmd-line option.
* @param description The text description of the option usage.
*/
void addOptionDesc(
const LLString& option_name,
boost::function1<void, const token_vector_t&> notify_callback = 0,
unsigned int num_tokens = 0,
const LLString& description = LLString::null,
const LLString& short_name = LLString::null,
bool composing = false,
bool positional = false,
bool last_option = false);
/**
* @brief Parse the command line given by argc/argv.
*/
bool parseCommandLine(int argc, char **argv);
/**
* @brief Parse the command line contained by the given file.
*/
bool parseCommandLineString(const std::string& str);
/**
* @brief Parse the command line contained by the given file.
*/
bool parseCommandLineFile(const std::basic_istream< char >& file);
/**
* @brief Call callbacks associated with option descriptions.
*
* Use this to handle the results of parsing.
*/
void notify();
/** @brief Print a description of the configured options.
*
* Use this to print a description of options to the
* given ostream. Useful for displaying usage info.
*/
std::ostream& printOptionsDesc(std::ostream& os) const;
/** @brief Manual option setting accessors.
*
* Use these to retrieve get the values set for an option.
* getOption will return an empty value if the option isn't
* set.
*/
bool hasOption(const std::string& name) const;
const token_vector_t& getOption(const std::string& name) const;
void printOptions() const;
};
inline std::ostream& operator<<(std::ostream& out, const LLCommandLineParser& clp)
{
return clp.printOptionsDesc(out);
}
class LLControlGroup;
/**
* @class LLControlGroupCLP
* @brief Uses the CLP to configure an LLControlGroup
*
*
*/
class LLControlGroupCLP : public LLCommandLineParser
{
public:
/**
* @brief Configure the command line parser according the given config file.
*
* @param config_filename The name of the XML based LLSD config file.
* @param clp A reference to the command line parser object to configure.
*
* *FIX:Mani Specify config file format.
*/
void configure(const LLString& config_filename,
LLControlGroup* controlGroup);
};
#endif // LL_LLCOMMANDLINEPARSER_H

View File

@ -483,7 +483,7 @@ void LLFeatureManager::applyFeatures(bool skipFeatures)
}
// get the control setting
LLControlBase* ctrl = gSavedSettings.getControl(mIt->first);
LLControlVariable* ctrl = gSavedSettings.getControl(mIt->first);
if(ctrl == NULL)
{
llwarns << "AHHH! Control setting " << mIt->first << " does not exist!" << llendl;

View File

@ -49,7 +49,8 @@ std::set<LLString> LLFirstUse::sConfigVariables;
// static
void LLFirstUse::addConfigVariable(const LLString& var)
{
gSavedSettings.addWarning(var);
//Don't add the warning, now that we're storing the default in the settings_default.xml file
//gSavedSettings.addWarning(var);
sConfigVariables.insert(var);
}
@ -256,13 +257,15 @@ void LLFirstUse::useSculptedPrim()
// static
void LLFirstUse::useVoice()
{
if (gDisableVoice) return;
if (gSavedSettings.getWarning("FirstVoice"))
{
gSavedSettings.setWarning("FirstVoice", FALSE);
if (!gSavedSettings.getBOOL("CmdLineDisableVoice"))
{
if (gSavedSettings.getWarning("FirstVoice"))
{
gSavedSettings.setWarning("FirstVoice", FALSE);
LLFloaterVoiceWizard::showInstance();
}
LLFloaterVoiceWizard::showInstance();
}
}
}
// static

View File

@ -84,7 +84,7 @@ LLFloaterAbout::LLFloaterAbout()
+ llformat(" %d.%d.%d (%d) %s %s (%s)",
LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD,
__DATE__, __TIME__,
gChannelName.c_str());
gSavedSettings.getString("VersionChannelName").c_str());
support.append(version);
support.append("\n\n");

View File

@ -173,8 +173,7 @@ bool LLPanelGroups::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
reset();
return true;
}
return LLView::handleEvent(event, userdata);
return false;
}
// Default constructor

View File

@ -83,7 +83,7 @@ protected:
static instance_map_t sInstances;
};
class LLPanelGroups : public LLPanel
class LLPanelGroups : public LLPanel, public LLSimpleListener
{
public:
LLPanelGroups();

View File

@ -446,7 +446,7 @@ void LLFloaterPreference::onBtnOK( void* userdata )
fp->apply();
fp->close(false);
gSavedSettings.saveToFile( gSettingsFileName, TRUE );
gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE);
// save all settings, even if equals defaults

View File

@ -0,0 +1,490 @@
/**
* @file llfloatersettingsdebug.cpp
* @brief floater for debugging internal viewer settings
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2007, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llfloatersettingsdebug.h"
#include "llfloater.h"
#include "llvieweruictrlfactory.h"
#include "llfirstuse.h"
#include "llcombobox.h"
#include "llspinctrl.h"
#include "llcolorswatch.h"
#include "llviewercontrol.h"
LLFloaterSettingsDebug* LLFloaterSettingsDebug::sInstance = NULL;
LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater("Configuration Editor")
{
}
LLFloaterSettingsDebug::~LLFloaterSettingsDebug()
{
sInstance = NULL;
}
BOOL LLFloaterSettingsDebug::postBuild()
{
LLComboBox* settings_combo = LLUICtrlFactory::getComboBoxByName(this, "settings_combo");
struct f : public LLControlGroup::ApplyFunctor
{
LLComboBox* combo;
f(LLComboBox* c) : combo(c) {}
virtual void apply(const LLString& name, LLControlVariable* control)
{
combo->add(name, (void*)control);
}
} func(settings_combo);
gSavedSettings.applyToAll(&func);
gSavedPerAccountSettings.applyToAll(&func);
gColors.applyToAll(&func);
settings_combo->sortByName();
settings_combo->setCommitCallback(onSettingSelect);
settings_combo->setCallbackUserData(this);
settings_combo->updateSelection();
childSetCommitCallback("val_spinner_1", onCommitSettings);
childSetUserData("val_spinner_1", this);
childSetCommitCallback("val_spinner_2", onCommitSettings);
childSetUserData("val_spinner_2", this);
childSetCommitCallback("val_spinner_3", onCommitSettings);
childSetUserData("val_spinner_3", this);
childSetCommitCallback("val_spinner_4", onCommitSettings);
childSetUserData("val_spinner_4", this);
childSetCommitCallback("val_text", onCommitSettings);
childSetUserData("val_text", this);
childSetCommitCallback("boolean_combo", onCommitSettings);
childSetUserData("boolean_combo", this);
childSetCommitCallback("color_swatch", onCommitSettings);
childSetUserData("color_swatch", this);
childSetAction("default_btn", onClickDefault, this);
mComment = getChild<LLTextEditor>("comment_text");
return TRUE;
}
void LLFloaterSettingsDebug::draw()
{
LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo");
LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata();
updateControl(controlp);
LLFloater::draw();
}
//static
void LLFloaterSettingsDebug::show(void*)
{
if (sInstance == NULL)
{
sInstance = new LLFloaterSettingsDebug();
gUICtrlFactory->buildFloater(sInstance, "floater_settings_debug.xml");
}
sInstance->open(); /* Flawfinder: ignore */
}
//static
void LLFloaterSettingsDebug::onSettingSelect(LLUICtrl* ctrl, void* user_data)
{
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data;
LLComboBox* combo_box = (LLComboBox*)ctrl;
LLControlVariable* controlp = (LLControlVariable*)combo_box->getCurrentUserdata();
floaterp->updateControl(controlp);
}
//static
void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data)
{
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data;
LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo");
LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata();
LLVector3 vector;
LLVector3d vectord;
LLRect rect;
LLColor4 col4;
LLColor3 col3;
LLColor4U col4U;
LLColor4 color_with_alpha;
switch(controlp->type())
{
case TYPE_U32:
controlp->set(floaterp->childGetValue("val_spinner_1"));
break;
case TYPE_S32:
controlp->set(floaterp->childGetValue("val_spinner_1"));
break;
case TYPE_F32:
controlp->set(LLSD(floaterp->childGetValue("val_spinner_1").asReal()));
break;
case TYPE_BOOLEAN:
controlp->set(floaterp->childGetValue("boolean_combo"));
break;
case TYPE_STRING:
controlp->set(LLSD(floaterp->childGetValue("val_text").asString()));
break;
case TYPE_VEC3:
vector.mV[VX] = (F32)floaterp->childGetValue("val_spinner_1").asReal();
vector.mV[VY] = (F32)floaterp->childGetValue("val_spinner_2").asReal();
vector.mV[VZ] = (F32)floaterp->childGetValue("val_spinner_3").asReal();
controlp->set(vector.getValue());
break;
case TYPE_VEC3D:
vectord.mdV[VX] = floaterp->childGetValue("val_spinner_1").asReal();
vectord.mdV[VY] = floaterp->childGetValue("val_spinner_2").asReal();
vectord.mdV[VZ] = floaterp->childGetValue("val_spinner_3").asReal();
controlp->set(vectord.getValue());
break;
case TYPE_RECT:
rect.mLeft = floaterp->childGetValue("val_spinner_1").asInteger();
rect.mRight = floaterp->childGetValue("val_spinner_2").asInteger();
rect.mBottom = floaterp->childGetValue("val_spinner_3").asInteger();
rect.mTop = floaterp->childGetValue("val_spinner_4").asInteger();
controlp->set(rect.getValue());
break;
case TYPE_COL4:
col3.setValue(floaterp->childGetValue("color_swatch"));
col4 = LLColor4(col3, (F32)floaterp->childGetValue("val_spinner_4").asReal());
controlp->set(col4.getValue());
break;
case TYPE_COL3:
controlp->set(floaterp->childGetValue("color_swatch"));
//col3.mV[VRED] = (F32)floaterp->childGetValue("val_spinner_1").asC();
//col3.mV[VGREEN] = (F32)floaterp->childGetValue("val_spinner_2").asReal();
//col3.mV[VBLUE] = (F32)floaterp->childGetValue("val_spinner_3").asReal();
//controlp->set(col3.getValue());
break;
case TYPE_COL4U:
col3.setValue(floaterp->childGetValue("color_swatch"));
col4U.setVecScaleClamp(col3);
col4U.mV[VALPHA] = floaterp->childGetValue("val_spinner_4").asInteger();
controlp->set(col4U.getValue());
break;
default:
break;
}
}
// static
void LLFloaterSettingsDebug::onClickDefault(void* user_data)
{
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data;
LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo");
LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata();
if (controlp)
{
controlp->resetToDefault();
floaterp->updateControl(controlp);
}
}
// we've switched controls, or doing per-frame update, so update spinners, etc.
void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp)
{
LLSpinCtrl* spinner1 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_1");
LLSpinCtrl* spinner2 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_2");
LLSpinCtrl* spinner3 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_3");
LLSpinCtrl* spinner4 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_4");
LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("color_swatch");
if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch)
{
llwarns << "Could not find all desired controls by name"
<< llendl;
return;
}
spinner1->setVisible(FALSE);
spinner2->setVisible(FALSE);
spinner3->setVisible(FALSE);
spinner4->setVisible(FALSE);
color_swatch->setVisible(FALSE);
childSetVisible("val_text", FALSE);
childSetVisible("boolean_combo", FALSE);
mComment->setText(LLString::null);
if (controlp)
{
eControlType type = controlp->type();
mComment->setText(controlp->getComment());
spinner1->setMaxValue(F32_MAX);
spinner2->setMaxValue(F32_MAX);
spinner3->setMaxValue(F32_MAX);
spinner4->setMaxValue(F32_MAX);
spinner1->setMinValue(-F32_MAX);
spinner2->setMinValue(-F32_MAX);
spinner3->setMinValue(-F32_MAX);
spinner4->setMinValue(-F32_MAX);
if (!spinner1->hasFocus())
{
spinner1->setIncrement(0.1f);
}
if (!spinner2->hasFocus())
{
spinner2->setIncrement(0.1f);
}
if (!spinner3->hasFocus())
{
spinner3->setIncrement(0.1f);
}
if (!spinner4->hasFocus())
{
spinner4->setIncrement(0.1f);
}
LLSD sd = controlp->get();
switch(type)
{
case TYPE_U32:
spinner1->setVisible(TRUE);
spinner1->setLabel(LLString("value")); // Debug, don't translate
if (!spinner1->hasFocus())
{
spinner1->setValue(sd);
spinner1->setMinValue((F32)U32_MIN);
spinner1->setMaxValue((F32)U32_MAX);
spinner1->setIncrement(1.f);
spinner1->setPrecision(0);
}
break;
case TYPE_S32:
spinner1->setVisible(TRUE);
spinner1->setLabel(LLString("value")); // Debug, don't translate
if (!spinner1->hasFocus())
{
spinner1->setValue(sd);
spinner1->setMinValue((F32)S32_MIN);
spinner1->setMaxValue((F32)S32_MAX);
spinner1->setIncrement(1.f);
spinner1->setPrecision(0);
}
break;
case TYPE_F32:
spinner1->setVisible(TRUE);
spinner1->setLabel(LLString("value")); // Debug, don't translate
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(sd);
}
break;
case TYPE_BOOLEAN:
childSetVisible("boolean_combo", TRUE);
if (!childHasFocus("boolean_combo"))
{
if (sd.asBoolean())
{
childSetValue("boolean_combo", LLSD("true"));
}
else
{
childSetValue("boolean_combo", LLSD(""));
}
}
break;
case TYPE_STRING:
childSetVisible("val_text", TRUE);
if (!childHasFocus("val_text"))
{
childSetValue("val_text", sd);
}
break;
case TYPE_VEC3:
{
LLVector3 v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(LLString("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(LLString("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(LLString("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_VEC3D:
{
LLVector3d v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(LLString("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(LLString("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(LLString("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_RECT:
{
LLRect r;
r.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(LLString("Left"));
spinner2->setVisible(TRUE);
spinner2->setLabel(LLString("Right"));
spinner3->setVisible(TRUE);
spinner3->setLabel(LLString("Bottom"));
spinner4->setVisible(TRUE);
spinner4->setLabel(LLString("Top"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(0);
spinner1->setValue(r.mLeft);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(0);
spinner2->setValue(r.mRight);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(0);
spinner3->setValue(r.mBottom);
}
if (!spinner4->hasFocus())
{
spinner4->setPrecision(0);
spinner4->setValue(r.mTop);
}
spinner1->setMinValue((F32)S32_MIN);
spinner1->setMaxValue((F32)S32_MAX);
spinner1->setIncrement(1.f);
spinner2->setMinValue((F32)S32_MIN);
spinner2->setMaxValue((F32)S32_MAX);
spinner2->setIncrement(1.f);
spinner3->setMinValue((F32)S32_MIN);
spinner3->setMaxValue((F32)S32_MAX);
spinner3->setIncrement(1.f);
spinner4->setMinValue((F32)S32_MIN);
spinner4->setMaxValue((F32)S32_MAX);
spinner4->setIncrement(1.f);
break;
}
case TYPE_COL4:
{
LLColor4 clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
// only set if changed so color picker doesn't update
if(clr != LLColor4(color_swatch->getValue()))
{
color_swatch->set(LLColor4(sd), TRUE, FALSE);
}
spinner4->setVisible(TRUE);
spinner4->setLabel(LLString("Alpha"));
if (!spinner4->hasFocus())
{
spinner4->setPrecision(3);
spinner4->setMinValue(0.0);
spinner4->setMaxValue(1.f);
spinner4->setValue(clr.mV[VALPHA]);
}
break;
}
case TYPE_COL3:
{
LLColor3 clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
color_swatch->setValue(sd);
break;
}
case TYPE_COL4U:
{
LLColor4U clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
if(LLColor4(clr) != LLColor4(color_swatch->getValue()))
{
color_swatch->set(LLColor4(clr), TRUE, FALSE);
}
spinner4->setVisible(TRUE);
spinner4->setLabel(LLString("Alpha"));
if(!spinner4->hasFocus())
{
spinner4->setPrecision(0);
spinner4->setValue(clr.mV[VALPHA]);
}
spinner4->setMinValue(0);
spinner4->setMaxValue(255);
spinner4->setIncrement(1.f);
break;
}
default:
mComment->setText(LLString("unknown"));
break;
}
}
}

View File

@ -0,0 +1,61 @@
/**
* @file llfloatersettingsdebug.h
* @brief floater for debugging internal viewer settings
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
* Copyright (c) 2001-2007, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlife.com/developers/opensource/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at http://secondlife.com/developers/opensource/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#ifndef LLFLOATERDEBUGSETTINGS_H
#define LLFLOATERDEBUGSETTINGS_H
#include "llcontrol.h"
#include "llfloater.h"
#include "lltexteditor.h"
class LLFloaterSettingsDebug : public LLFloater
{
public:
LLFloaterSettingsDebug();
virtual ~LLFloaterSettingsDebug();
virtual BOOL postBuild();
virtual void draw();
void updateControl(LLControlVariable* control);
static void show(void*);
static void onSettingSelect(LLUICtrl* ctrl, void* user_data);
static void onCommitSettings(LLUICtrl* ctrl, void* user_data);
static void onClickDefault(void* user_data);
protected:
static LLFloaterSettingsDebug* sInstance;
LLTextEditor* mComment;
};
#endif //LLFLOATERDEBUGSETTINGS_H

View File

@ -163,8 +163,6 @@ LLNetMap::LLNetMap(
mPopupMenuHandle = menu->getHandle();
sInstance = this;
gSavedSettings.getControl("MiniMapRotate")->addListener(&mNetMapListener);
}
LLNetMap::~LLNetMap()
@ -828,9 +826,3 @@ void LLNetMap::handleZoomLevel(void* which)
break;
}
}
bool LLRotateNetMapListener::handleEvent(LLPointer<LLEvent> event, const LLSD& user_data)
{
LLNetMap::setRotateMap(event->getValue().asBoolean());
return true;
}

View File

@ -45,12 +45,6 @@ class LLCoordGL;
class LLTextBox;
class LLMenuGL;
class LLRotateNetMapListener : public LLSimpleListener
{
public:
bool handleEvent(LLPointer<LLEvent>, const LLSD& user_data);
};
class LLNetMap : public LLUICtrl
{
public:
@ -117,8 +111,6 @@ public:
LLTextBox* mTextBoxNorthWest;
LLTextBox* mTextBoxSouthWest;
LLRotateNetMapListener mNetMapListener;
static BOOL sRotateMap;
static LLNetMap* sInstance;
};

View File

@ -206,7 +206,7 @@ void LLLoginHandler::parse(const LLSD& queryMap)
if (LLAppViewer::instance()->getLoginURIs().size() == 0)
{
snprintf(gGridName, MAX_STRING, "%s", gGridInfo[gGridChoice].mName); /* Flawfinder: ignore */
gGridName = gGridInfo[gGridChoice].mName; /* Flawfinder: ignore */
LLAppViewer::instance()->resetURIs();
}
@ -429,7 +429,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
LLTextBox* channel_text = LLUICtrlFactory::getTextBoxByName(this, "channel_text");
if (channel_text)
{
channel_text->setText(gChannelName);
channel_text->setText(gSavedSettings.getString("VersionChannelName"));
channel_text->setClickedCallback(onClickVersion);
channel_text->setCallbackUserData(this);
}
@ -471,7 +471,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
// kick off a request to grab the url manually
gResponsePtr = LLIamHereLogin::build( this );
std::string login_page = LLAppViewer::instance()->getLoginPage();
std::string login_page = gSavedSettings.getString("LoginPage");
if (login_page.empty())
{
login_page = getString( "real_url" );
@ -927,7 +927,7 @@ void LLPanelLogin::loadLoginPage()
std::ostringstream oStr;
std::string login_page = LLAppViewer::instance()->getLoginPage();
std::string login_page = gSavedSettings.getString("LoginPage");
if (login_page.empty())
{
login_page = sInstance->getString( "real_url" );
@ -984,24 +984,24 @@ void LLPanelLogin::loadLoginPage()
}
LLString firstname, lastname;
if (gCmdLineFirstName.empty())
if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
{
LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
firstname = cmd_line_login[0].asString();
lastname = cmd_line_login[1].asString();
password = cmd_line_login[2].asString();
}
if (firstname.empty())
{
firstname = gSavedSettings.getString("FirstName");
}
else
{
firstname = gCmdLineFirstName;
}
if (gCmdLineLastName.empty())
if (lastname.empty())
{
lastname = gSavedSettings.getString("LastName");
}
else
{
lastname = gCmdLineLastName;
}
LLString version = llformat("%d.%d.%d (%d)",
LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VIEWER_BUILD);
@ -1020,9 +1020,9 @@ void LLPanelLogin::loadLoginPage()
curl_free(curl_version);
if (!gCmdLinePassword.empty())
if (!password.empty())
{
oStr << "&password=" << gCmdLinePassword;
oStr << "&password=" << password;
}
else if (!(password = load_password_from_disk()).empty())
{

View File

@ -447,7 +447,7 @@ BOOL idle_startup()
{
fclose(found_template);
U32 port = gAgent.mViewerPort;
U32 port = gSavedSettings.getU32("UserConnectionPort");
if ((NET_USE_OS_ASSIGNED_PORT == port) && // if nothing specified on command line (-port)
(gSavedSettings.getBOOL("ConnectionPortEnabled")))
@ -497,7 +497,7 @@ BOOL idle_startup()
invalid_message_callback,
NULL);
if (gSavedSettings.getBOOL("LogMessages") || gLogMessages)
if (gSavedSettings.getBOOL("LogMessages"))
{
llinfos << "Message logging activated!" << llendl;
msg->startLogging();
@ -516,18 +516,23 @@ BOOL idle_startup()
}
gAssetStorage = new LLViewerAssetStorage(msg, gXferManager, gVFS);
msg->mPacketRing.setDropPercentage(gPacketDropPercentage);
if (gInBandwidth != 0.f)
F32 dropPercent = gSavedSettings.getF32("PacketDropPercentage");
msg->mPacketRing.setDropPercentage(dropPercent);
F32 inBandwidth = gSavedSettings.getF32("InBandwidth");
F32 outBandwidth = gSavedSettings.getF32("OutBandwidth");
if (inBandwidth != 0.f)
{
llinfos << "Setting packetring incoming bandwidth to " << gInBandwidth << llendl;
llinfos << "Setting packetring incoming bandwidth to " << inBandwidth << llendl;
msg->mPacketRing.setUseInThrottle(TRUE);
msg->mPacketRing.setInBandwidth(gInBandwidth);
msg->mPacketRing.setInBandwidth(inBandwidth);
}
if (gOutBandwidth != 0.f)
if (outBandwidth != 0.f)
{
llinfos << "Setting packetring outgoing bandwidth to " << gOutBandwidth << llendl;
llinfos << "Setting packetring outgoing bandwidth to " << outBandwidth << llendl;
msg->mPacketRing.setUseOutThrottle(TRUE);
msg->mPacketRing.setOutBandwidth(gOutBandwidth);
msg->mPacketRing.setOutBandwidth(outBandwidth);
}
}
@ -541,7 +546,7 @@ BOOL idle_startup()
// or audio cues in connection UI.
//-------------------------------------------------
if (gUseAudio)
if (FALSE == gSavedSettings.getBOOL("NoAudio"))
{
#if LL_FMOD
gAudiop = (LLAudioEngine *) new LLAudioEngine_FMOD();
@ -586,14 +591,13 @@ BOOL idle_startup()
show_connect_box = FALSE;
}
else if( !gCmdLineFirstName.empty()
&& !gCmdLineLastName.empty()
&& !gCmdLinePassword.empty())
{
firstname = gCmdLineFirstName;
lastname = gCmdLineLastName;
else if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
{
LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
firstname = cmd_line_login[0].asString();
lastname = cmd_line_login[1].asString();
LLMD5 pass((unsigned char*)gCmdLinePassword.c_str());
LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
char md5pass[33]; /* Flawfinder: ignore */
pass.hex_digest(md5pass);
password = md5pass;
@ -604,9 +608,9 @@ BOOL idle_startup()
#else
show_connect_box = FALSE;
#endif
gAutoLogin = TRUE;
}
else if (gAutoLogin || gSavedSettings.getBOOL("AutoLogin"))
gSavedSettings.setBOOL("AutoLogin", TRUE);
}
else if (gSavedSettings.getBOOL("AutoLogin"))
{
firstname = gSavedSettings.getString("FirstName");
lastname = gSavedSettings.getString("LastName");
@ -781,19 +785,14 @@ BOOL idle_startup()
// create necessary directories
// *FIX: these mkdir's should error check
gDirUtilp->setLindenUserDir(firstname.c_str(), lastname.c_str());
LLFile::mkdir(gDirUtilp->getLindenUserDir().c_str());
// Set UserSettingsFile to the default value.
gSavedSettings.setString("UserSettingsFile",
gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, DEFAULT_SETTINGS_FILE));
LLFile::mkdir(gDirUtilp->getLindenUserDir().c_str());
// the mute list is loaded in the llmutelist class.
gSavedSettings.loadFromFile(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,"overrides.xml"));
// handle the per account settings setup
gPerAccountSettingsFileName = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, DEFAULT_SETTINGS_FILE);
// per account settings. Set defaults here if not found. If we get a bunch of these, eventually move to a function.
gSavedPerAccountSettings.loadFromFile(gPerAccountSettingsFileName);
// Overwrite default user settings with user settings
LLAppViewer::instance()->loadSettingsFromDirectory(LL_PATH_PER_SL_ACCOUNT);
// Need to set the LastLogoff time here if we don't have one. LastLogoff is used for "Recent Items" calculation
// and startup time is close enough if we don't have a real value.
@ -828,7 +827,7 @@ BOOL idle_startup()
gSavedSettings.setS32("ServerChoice", gGridChoice);
if (gGridChoice == GRID_INFO_OTHER)
{
snprintf(gGridName, MAX_STRING, "%s", server_label.c_str());/* Flawfinder: ignore */
gGridName = server_label;/* Flawfinder: ignore */
}
if ( user_picked_server )
@ -932,7 +931,7 @@ BOOL idle_startup()
//requested_options.push_back("inventory-meat");
//requested_options.push_back("inventory-skel-targets");
#if (!defined LL_MINIMIAL_REQUESTED_OPTIONS)
if(gRequestInventoryLibrary)
if(FALSE == gSavedSettings.getBOOL("NoInventoryLibrary"))
{
requested_options.push_back("inventory-lib-root");
requested_options.push_back("inventory-lib-owner");
@ -952,7 +951,7 @@ BOOL idle_startup()
requested_options.push_back("tutorial_setting");
requested_options.push_back("login-flags");
requested_options.push_back("global-textures");
if(gGodConnect)
if(gSavedSettings.getBOOL("ConnectAsGod"))
{
gSavedSettings.setBOOL("UseDebugMenus", TRUE);
requested_options.push_back("god-connect");
@ -1239,7 +1238,6 @@ BOOL idle_startup()
<< (sAuthUriNum + 1) << ". ";
auth_desc = s.str();
LLStartUp::setStartupState( STATE_LOGIN_AUTHENTICATE );
sAuthUriNum++;
return do_normal_idle;
}
break;
@ -1489,7 +1487,7 @@ BOOL idle_startup()
args["[ERROR_MESSAGE]"] = emsg.str();
gViewerWindow->alertXml("ErrorMessage", args, login_alert_done);
reset_login();
gAutoLogin = FALSE;
gSavedSettings.setBOOL("AutoLogin", FALSE);
show_connect_box = TRUE;
}
@ -1509,7 +1507,7 @@ BOOL idle_startup()
args["[ERROR_MESSAGE]"] = emsg.str();
gViewerWindow->alertXml("ErrorMessage", args, login_alert_done);
reset_login();
gAutoLogin = FALSE;
gSavedSettings.setBOOL("AutoLogin", FALSE);
show_connect_box = TRUE;
// Don't save an incorrect password to disk.
save_password_to_disk(NULL);
@ -1533,7 +1531,7 @@ BOOL idle_startup()
// Since we connected, save off the settings so the user doesn't have to
// type the name/password again if we crash.
gSavedSettings.saveToFile(gSettingsFileName, TRUE);
gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
//
// Initialize classes w/graphics stuff.
@ -2100,7 +2098,7 @@ BOOL idle_startup()
gSavedSettings.setString( "NextLoginLocation", "" );
// and make sure it's saved
gSavedSettings.saveToFile( gSettingsFileName, TRUE );
gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE );
};
if (!gNoRender)
@ -2392,7 +2390,7 @@ void login_show()
if( GRID_INFO_OTHER == gGridChoice )
{
LLPanelLogin::addServer( gGridName, GRID_INFO_OTHER );
LLPanelLogin::addServer( gGridName.c_str(), GRID_INFO_OTHER );
}
else
{
@ -2440,7 +2438,7 @@ void login_callback(S32 option, void *userdata)
{
// turn off the setting and write out to disk
gSavedSettings.setBOOL("RememberPassword", FALSE);
gSavedSettings.saveToFile(gSettingsFileName, TRUE);
gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE );
// stomp the saved password on disk
save_password_to_disk(NULL);
@ -2634,7 +2632,7 @@ void login_alert_status(S32 option, void* user_data)
void update_app(BOOL mandatory, const std::string& auth_msg)
{
// store off config state, as we might quit soon
gSavedSettings.saveToFile(gSettingsFileName, TRUE);
gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
std::ostringstream message;
@ -2734,7 +2732,7 @@ void update_dialog_callback(S32 option, void *userdata)
// *TODO change userserver to be grid on both viewer and sim, since
// userserver no longer exists.
query_map["userserver"] = gGridName;
query_map["channel"] = gChannelName;
query_map["channel"] = gSavedSettings.getString("VersionChannelName");
// *TODO constantize this guy
LLURI update_url = LLURI::buildHTTP("secondlife.com", 80, "update.php", query_map);

View File

@ -80,14 +80,10 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask)
{
if( gAgent.cameraMouselook() )
{
#if 1 //LL_WINDOWS || LL_DARWIN
const F32 NOMINAL_MOUSE_SENSITIVITY = 0.0025f;
#else
const F32 NOMINAL_MOUSE_SENSITIVITY = 0.025f;
#endif
const F32 NOMINAL_MOUSE_SENSITIVITY = 0.0025f;
F32 mouse_sensitivity = clamp_rescale(gMouseSensitivity, 0.f, 15.f, 0.5f, 2.75f) * NOMINAL_MOUSE_SENSITIVITY;
F32 mouse_sensitivity = gSavedSettings.getF32("MouseSensitivity");
mouse_sensitivity = clamp_rescale(mouse_sensitivity, 0.f, 15.f, 0.5f, 2.75f) * NOMINAL_MOUSE_SENSITIVITY;
// ...move the view with the mouse
@ -98,7 +94,7 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask)
if (dx != 0 || dy != 0)
{
// ...actually moved off center
if (gInvertMouse)
if (gSavedSettings.getBOOL("InvertMouse"))
{
gAgent.pitch(mouse_sensitivity * -dy);
}

View File

@ -31,101 +31,4 @@
#include "llviewerprecompiledheaders.h"
#include "llvectorperfoptions.h"
#include "llviewerjointmesh.h"
#include "llviewercontrol.h"
// Initially, we test the performance of the vectorization code, then
// turn it off if it ends up being slower. JC
BOOL gVectorizePerfTest = TRUE;
BOOL gVectorizeEnable = FALSE;
U32 gVectorizeProcessor = 0;
BOOL gVectorizeSkin = FALSE;
void update_vector_performances(void)
{
char *vp;
switch(gVectorizeProcessor)
{
case 2: vp = "SSE2"; break; // *TODO: replace the magic #s
case 1: vp = "SSE"; break;
default: vp = "COMPILER DEFAULT"; break;
}
llinfos << "Vectorization : " << ( gVectorizeEnable ? "ENABLED" : "DISABLED" ) << llendl ;
llinfos << "Vector Processor : " << vp << llendl ;
llinfos << "Vectorized Skinning : " << ( gVectorizeSkin ? "ENABLED" : "DISABLED" ) << llendl ;
if(gVectorizeEnable && gVectorizeSkin)
{
switch(gVectorizeProcessor)
{
case 2:
LLViewerJointMesh::sUpdateGeometryFunc = &LLViewerJointMesh::updateGeometrySSE2;
break;
case 1:
LLViewerJointMesh::sUpdateGeometryFunc = &LLViewerJointMesh::updateGeometrySSE;
break;
default:
LLViewerJointMesh::sUpdateGeometryFunc = &LLViewerJointMesh::updateGeometryVectorized;
break;
}
}
else
{
LLViewerJointMesh::sUpdateGeometryFunc = &LLViewerJointMesh::updateGeometryOriginal;
}
}
class LLVectorizationEnableListener: public LLSimpleListener
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
gVectorizeEnable = event->getValue().asBoolean();
update_vector_performances();
return true;
}
};
static LLVectorizationEnableListener vectorization_enable_listener;
class LLVectorizeSkinListener: public LLSimpleListener
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
gVectorizeSkin = event->getValue().asBoolean();
update_vector_performances();
return true;
}
};
static LLVectorizeSkinListener vectorize_skin_listener;
class LLVectorProcessorListener: public LLSimpleListener
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
gVectorizeProcessor = event->getValue().asInteger();
update_vector_performances();
return true;
}
};
static LLVectorProcessorListener vector_processor_listener;
void LLVectorPerformanceOptions::initClass()
{
gVectorizePerfTest = gSavedSettings.getBOOL("VectorizePerfTest");
gVectorizeEnable = gSavedSettings.getBOOL("VectorizeEnable");
gVectorizeProcessor = gSavedSettings.getU32("VectorizeProcessor");
gVectorizeSkin = gSavedSettings.getBOOL("VectorizeSkin");
update_vector_performances();
// these are currently static in this file, so they can't move to settings_setup_listeners
gSavedSettings.getControl("VectorizeEnable")->addListener(&vectorization_enable_listener);
gSavedSettings.getControl("VectorizeProcessor")->addListener(&vector_processor_listener);
gSavedSettings.getControl("VectorizeSkin")->addListener(&vectorize_skin_listener);
}
void LLVectorPerformanceOptions::cleanupClass()
{
}
// Deprecated - moved into llviewerjointmesh

View File

@ -32,10 +32,6 @@
#ifndef LL_VECTORPERFOPTIONS_H
#define LL_VECTORPERFOPTIONS_H
namespace LLVectorPerformanceOptions
{
void initClass(); // Run after configuration files are read.
void cleanupClass();
};
// Deprecated - moved into llviewerjointmesh
#endif

View File

@ -65,7 +65,7 @@ void init_audio()
BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio");
if (!mute_audio && gPreloadSounds)
if (!mute_audio && FALSE == gSavedSettings.getBOOL("NoPreload"))
{
gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndAlert")));
gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndBadKeystroke")));

View File

@ -36,26 +36,47 @@
#include "indra_constants.h"
#include "v3math.h"
#include "v3dmath.h"
#include "llrect.h"
#include "v4color.h"
#include "v4coloru.h"
#include "v3color.h"
#include "llfloater.h"
#include "llvieweruictrlfactory.h"
#include "llfirstuse.h"
#include "llcombobox.h"
#include "llspinctrl.h"
#include "llcolorswatch.h"
// For Listeners
#include "audioengine.h"
#include "llagent.h"
#include "llconsole.h"
#include "lldrawpoolterrain.h"
#include "llflexibleobject.h"
#include "llfeaturemanager.h"
#include "llglslshader.h"
#include "llnetmap.h"
#include "llpanelgeneral.h"
#include "llpanelinput.h"
#include "llsky.h"
#include "llvieweraudio.h"
#include "llviewerimagelist.h"
#include "llviewerthrottle.h"
#include "llviewerwindow.h"
#include "llvoavatar.h"
#include "llvoiceclient.h"
#include "llvosky.h"
#include "llvotree.h"
#include "llvovolume.h"
#include "llworld.h"
#include "pipeline.h"
#include "llviewerjoystick.h"
#include "llviewerparcelmgr.h"
#include "llparcel.h"
#include "llnotify.h"
#include "llkeyboard.h"
#include "llerrorcontrol.h"
#include "llversionviewer.h"
#include "llappviewer.h"
#include "llvosurfacepatch.h"
#include "llvowlsky.h"
#include "llglimmediate.h"
#ifdef TOGGLE_HACKED_GODLIKE_VIEWER
BOOL gHackGodmode = FALSE;
#endif
LLFloaterSettingsDebug* LLFloaterSettingsDebug::sInstance = NULL;
std::map<LLString, LLControlGroup*> gSettings;
LLControlGroup gSavedSettings; // saved at end of session
LLControlGroup gSavedPerAccountSettings; // saved at end of session
LLControlGroup gViewerArt; // read-only
@ -65,461 +86,440 @@ LLControlGroup gCrashSettings; // saved at end of session
LLString gLastRunVersion;
LLString gCurrentVersion;
LLString gSettingsFileName;
LLString gPerAccountSettingsFileName;
extern BOOL gResizeScreenTexture;
LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater("Configuration Editor")
////////////////////////////////////////////////////////////////////////////
// Listeners
static bool handleRenderAvatarMouselookChanged(const LLSD& newvalue)
{
LLVOAvatar::sVisibleInFirstPerson = newvalue.asBoolean();
return true;
}
LLFloaterSettingsDebug::~LLFloaterSettingsDebug()
static bool handleRenderFarClipChanged(const LLSD& newvalue)
{
sInstance = NULL;
}
BOOL LLFloaterSettingsDebug::postBuild()
{
LLComboBox* settings_combo = LLUICtrlFactory::getComboBoxByName(this, "settings_combo");
LLControlGroup::ctrl_name_table_t::iterator name_it;
for(name_it = gSavedSettings.mNameTable.begin(); name_it != gSavedSettings.mNameTable.end(); ++name_it)
F32 draw_distance = (F32) newvalue.asReal();
gAgent.mDrawDistance = draw_distance;
if (gWorldPointer)
{
settings_combo->add(name_it->first, (void*)name_it->second);
gWorldPointer->setLandFarClip(draw_distance);
}
for(name_it = gSavedPerAccountSettings.mNameTable.begin(); name_it != gSavedPerAccountSettings.mNameTable.end(); ++name_it)
{
settings_combo->add(name_it->first, (void*)name_it->second);
}
for(name_it = gColors.mNameTable.begin(); name_it != gColors.mNameTable.end(); ++name_it)
{
settings_combo->add(name_it->first, (void*)name_it->second);
}
settings_combo->sortByName();
settings_combo->setCommitCallback(onSettingSelect);
settings_combo->setCallbackUserData(this);
settings_combo->updateSelection();
childSetCommitCallback("val_spinner_1", onCommitSettings);
childSetUserData("val_spinner_1", this);
childSetCommitCallback("val_spinner_2", onCommitSettings);
childSetUserData("val_spinner_2", this);
childSetCommitCallback("val_spinner_3", onCommitSettings);
childSetUserData("val_spinner_3", this);
childSetCommitCallback("val_spinner_4", onCommitSettings);
childSetUserData("val_spinner_4", this);
childSetCommitCallback("val_text", onCommitSettings);
childSetUserData("val_text", this);
childSetCommitCallback("boolean_combo", onCommitSettings);
childSetUserData("boolean_combo", this);
childSetCommitCallback("color_swatch", onCommitSettings);
childSetUserData("color_swatch", this);
childSetAction("default_btn", onClickDefault, this);
mComment = getChild<LLTextEditor>("comment_text");
return TRUE;
return true;
}
void LLFloaterSettingsDebug::draw()
static bool handleTerrainDetailChanged(const LLSD& newvalue)
{
LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo");
LLControlBase* controlp = (LLControlBase*)settings_combo->getCurrentUserdata();
updateControl(controlp);
LLFloater::draw();
LLDrawPoolTerrain::sDetailMode = newvalue.asInteger();
return true;
}
//static
void LLFloaterSettingsDebug::show(void*)
static bool handleSetShaderChanged(const LLSD& newvalue)
{
if (sInstance == NULL)
LLShaderMgr::setShaders();
return true;
}
static bool handleReleaseGLBufferChanged(const LLSD& newvalue)
{
if (gPipeline.isInit())
{
sInstance = new LLFloaterSettingsDebug();
gUICtrlFactory->buildFloater(sInstance, "floater_settings_debug.xml");
gPipeline.releaseGLBuffers();
gPipeline.createGLBuffers();
}
sInstance->open(); /* Flawfinder: ignore */
return true;
}
//static
void LLFloaterSettingsDebug::onSettingSelect(LLUICtrl* ctrl, void* user_data)
static bool handleVolumeLODChanged(const LLSD& newvalue)
{
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data;
LLComboBox* combo_box = (LLComboBox*)ctrl;
LLControlBase* controlp = (LLControlBase*)combo_box->getCurrentUserdata();
floaterp->updateControl(controlp);
LLVOVolume::sLODFactor = (F32) newvalue.asReal();
LLVOVolume::sDistanceFactor = 1.f-LLVOVolume::sLODFactor * 0.1f;
return true;
}
//static
void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data)
static bool handleAvatarLODChanged(const LLSD& newvalue)
{
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data;
LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo");
LLControlBase* controlp = (LLControlBase*)settings_combo->getCurrentUserdata();
LLVector3 vector;
LLVector3d vectord;
LLRect rect;
LLColor4 col4;
LLColor3 col3;
LLColor4U col4U;
LLColor4 color_with_alpha;
switch(controlp->type())
{
case TYPE_U32:
controlp->set(floaterp->childGetValue("val_spinner_1"));
break;
case TYPE_S32:
controlp->set(floaterp->childGetValue("val_spinner_1"));
break;
case TYPE_F32:
controlp->set(LLSD(floaterp->childGetValue("val_spinner_1").asReal()));
break;
case TYPE_BOOLEAN:
controlp->set(floaterp->childGetValue("boolean_combo"));
break;
case TYPE_STRING:
controlp->set(LLSD(floaterp->childGetValue("val_text").asString()));
break;
case TYPE_VEC3:
vector.mV[VX] = (F32)floaterp->childGetValue("val_spinner_1").asReal();
vector.mV[VY] = (F32)floaterp->childGetValue("val_spinner_2").asReal();
vector.mV[VZ] = (F32)floaterp->childGetValue("val_spinner_3").asReal();
controlp->set(vector.getValue());
break;
case TYPE_VEC3D:
vectord.mdV[VX] = floaterp->childGetValue("val_spinner_1").asReal();
vectord.mdV[VY] = floaterp->childGetValue("val_spinner_2").asReal();
vectord.mdV[VZ] = floaterp->childGetValue("val_spinner_3").asReal();
controlp->set(vectord.getValue());
break;
case TYPE_RECT:
rect.mLeft = floaterp->childGetValue("val_spinner_1").asInteger();
rect.mRight = floaterp->childGetValue("val_spinner_2").asInteger();
rect.mBottom = floaterp->childGetValue("val_spinner_3").asInteger();
rect.mTop = floaterp->childGetValue("val_spinner_4").asInteger();
controlp->set(rect.getValue());
break;
case TYPE_COL4:
col3.setValue(floaterp->childGetValue("color_swatch"));
col4 = LLColor4(col3, (F32)floaterp->childGetValue("val_spinner_4").asReal());
controlp->set(col4.getValue());
break;
case TYPE_COL3:
controlp->set(floaterp->childGetValue("color_swatch"));
//col3.mV[VRED] = (F32)floaterp->childGetValue("val_spinner_1").asC();
//col3.mV[VGREEN] = (F32)floaterp->childGetValue("val_spinner_2").asReal();
//col3.mV[VBLUE] = (F32)floaterp->childGetValue("val_spinner_3").asReal();
//controlp->set(col3.getValue());
break;
case TYPE_COL4U:
col3.setValue(floaterp->childGetValue("color_swatch"));
col4U.setVecScaleClamp(col3);
col4U.mV[VALPHA] = floaterp->childGetValue("val_spinner_4").asInteger();
controlp->set(col4U.getValue());
break;
default:
break;
}
LLVOAvatar::sLODFactor = (F32) newvalue.asReal();
return true;
}
// static
void LLFloaterSettingsDebug::onClickDefault(void* user_data)
static bool handleTerrainLODChanged(const LLSD& newvalue)
{
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data;
LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo");
LLControlBase* controlp = (LLControlBase*)settings_combo->getCurrentUserdata();
LLVOSurfacePatch::sLODFactor = (F32)newvalue.asReal();
//sqaure lod factor to get exponential range of [0,4] and keep
//a value of 1 in the middle of the detail slider for consistency
//with other detail sliders (see panel_preferences_graphics1.xml)
LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor;
return true;
}
if (controlp)
static bool handleTreeLODChanged(const LLSD& newvalue)
{
LLVOTree::sTreeFactor = (F32) newvalue.asReal();
return true;
}
static bool handleFlexLODChanged(const LLSD& newvalue)
{
LLVolumeImplFlexible::sUpdateFactor = (F32) newvalue.asReal();
return true;
}
static bool handleGammaChanged(const LLSD& newvalue)
{
F32 gamma = (F32) newvalue.asReal();
if (gamma == 0.0f)
{
controlp->resetToDefault();
floaterp->updateControl(controlp);
gamma = 1.0f; // restore normal gamma
}
}
// we've switched controls, or doing per-frame update, so update spinners, etc.
void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
{
LLSpinCtrl* spinner1 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_1");
LLSpinCtrl* spinner2 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_2");
LLSpinCtrl* spinner3 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_3");
LLSpinCtrl* spinner4 = LLUICtrlFactory::getSpinnerByName(this, "val_spinner_4");
LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("color_swatch");
if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch)
if (gViewerWindow && gViewerWindow->getWindow() && gamma != gViewerWindow->getWindow()->getGamma())
{
llwarns << "Could not find all desired controls by name"
<< llendl;
return;
}
spinner1->setVisible(FALSE);
spinner2->setVisible(FALSE);
spinner3->setVisible(FALSE);
spinner4->setVisible(FALSE);
color_swatch->setVisible(FALSE);
childSetVisible("val_text", FALSE);
mComment->setText(LLString::null);
if (controlp)
{
eControlType type = controlp->type();
mComment->setText(controlp->getComment());
spinner1->setMaxValue(F32_MAX);
spinner2->setMaxValue(F32_MAX);
spinner3->setMaxValue(F32_MAX);
spinner4->setMaxValue(F32_MAX);
spinner1->setMinValue(-F32_MAX);
spinner2->setMinValue(-F32_MAX);
spinner3->setMinValue(-F32_MAX);
spinner4->setMinValue(-F32_MAX);
if (!spinner1->hasFocus())
// Only save it if it's changed
if (!gViewerWindow->getWindow()->setGamma(gamma))
{
spinner1->setIncrement(0.1f);
}
if (!spinner2->hasFocus())
{
spinner2->setIncrement(0.1f);
}
if (!spinner3->hasFocus())
{
spinner3->setIncrement(0.1f);
}
if (!spinner4->hasFocus())
{
spinner4->setIncrement(0.1f);
llwarns << "setGamma failed!" << llendl;
}
}
LLSD sd = controlp->get();
switch(type)
return true;
}
const F32 MAX_USER_FOG_RATIO = 10.f;
const F32 MIN_USER_FOG_RATIO = 0.5f;
static bool handleFogRatioChanged(const LLSD& newvalue)
{
F32 fog_ratio = llmax(MIN_USER_FOG_RATIO, llmin((F32) newvalue.asReal(), MAX_USER_FOG_RATIO));
gSky.setFogRatio(fog_ratio);
return true;
}
static bool handleMaxPartCountChanged(const LLSD& newvalue)
{
LLViewerPartSim::setMaxPartCount(newvalue.asInteger());
return true;
}
const S32 MAX_USER_COMPOSITE_LIMIT = 100;
const S32 MIN_USER_COMPOSITE_LIMIT = 0;
static bool handleCompositeLimitChanged(const LLSD& newvalue)
{
S32 composite_limit = llmax(MIN_USER_COMPOSITE_LIMIT, llmin((S32)newvalue.asInteger(), MAX_USER_COMPOSITE_LIMIT));
LLVOAvatar::sMaxOtherAvatarsToComposite = composite_limit;
return true;
}
static bool handleVideoMemoryChanged(const LLSD& newvalue)
{
gImageList.updateMaxResidentTexMem(newvalue.asInteger());
return true;
}
static bool handleBandwidthChanged(const LLSD& newvalue)
{
gViewerThrottle.setMaxBandwidth((F32) newvalue.asReal());
return true;
}
static bool handleChatFontSizeChanged(const LLSD& newvalue)
{
if(gConsole)
{
gConsole->setFontSize(newvalue.asInteger());
}
return true;
}
static bool handleChatPersistTimeChanged(const LLSD& newvalue)
{
if(gConsole)
{
gConsole->setLinePersistTime((F32) newvalue.asReal());
}
return true;
}
static bool handleConsoleMaxLinesChanged(const LLSD& newvalue)
{
if(gConsole)
{
gConsole->setMaxLines(newvalue.asInteger());
}
return true;
}
static void handleAudioVolumeChanged(const LLSD& newvalue)
{
audio_update_volume(true);
}
static bool handleJoystickChanged(const LLSD& newvalue)
{
LLViewerJoystick::updateCamera(TRUE);
return true;
}
static bool handleAudioStreamMusicChanged(const LLSD& newvalue)
{
if (gAudiop)
{
if ( newvalue.asBoolean() )
{
case TYPE_U32:
spinner1->setVisible(TRUE);
spinner1->setLabel(LLString("value")); // Debug, don't translate
childSetVisible("boolean_combo", FALSE);
if (!spinner1->hasFocus())
if (gParcelMgr
&& gParcelMgr->getAgentParcel()
&& !gParcelMgr->getAgentParcel()->getMusicURL().empty())
{
spinner1->setValue(sd);
spinner1->setMinValue((F32)U32_MIN);
spinner1->setMaxValue((F32)U32_MAX);
spinner1->setIncrement(1.f);
spinner1->setPrecision(0);
}
break;
case TYPE_S32:
spinner1->setVisible(TRUE);
spinner1->setLabel(LLString("value")); // Debug, don't translate
childSetVisible("boolean_combo", FALSE);
if (!spinner1->hasFocus())
{
spinner1->setValue(sd);
spinner1->setMinValue((F32)S32_MIN);
spinner1->setMaxValue((F32)S32_MAX);
spinner1->setIncrement(1.f);
spinner1->setPrecision(0);
}
break;
case TYPE_F32:
spinner1->setVisible(TRUE);
spinner1->setLabel(LLString("value")); // Debug, don't translate
childSetVisible("boolean_combo", FALSE);
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(sd);
}
break;
case TYPE_BOOLEAN:
childSetVisible("boolean_combo", TRUE);
if (!childHasFocus("boolean_combo"))
{
if (sd.asBoolean())
// if stream is already playing, don't call this
// otherwise music will briefly stop
if ( ! gAudiop->isInternetStreamPlaying() )
{
childSetValue("boolean_combo", LLSD("true"));
}
else
{
childSetValue("boolean_combo", LLSD(""));
gAudiop->startInternetStream(gParcelMgr->getAgentParcel()->getMusicURL().c_str());
}
}
break;
case TYPE_STRING:
childSetVisible("val_text", TRUE);
childSetVisible("boolean_combo", FALSE);
if (!childHasFocus("val_text"))
{
childSetValue("val_text", sd);
}
break;
case TYPE_VEC3:
{
childSetVisible("boolean_combo", FALSE);
LLVector3 v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(LLString("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(LLString("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(LLString("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_VEC3D:
{
childSetVisible("boolean_combo", FALSE);
LLVector3d v;
v.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(LLString("X"));
spinner2->setVisible(TRUE);
spinner2->setLabel(LLString("Y"));
spinner3->setVisible(TRUE);
spinner3->setLabel(LLString("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
spinner1->setValue(v[VX]);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(3);
spinner2->setValue(v[VY]);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(3);
spinner3->setValue(v[VZ]);
}
break;
}
case TYPE_RECT:
{
childSetVisible("boolean_combo", FALSE);
LLRect r;
r.setValue(sd);
spinner1->setVisible(TRUE);
spinner1->setLabel(LLString("Left"));
spinner2->setVisible(TRUE);
spinner2->setLabel(LLString("Right"));
spinner3->setVisible(TRUE);
spinner3->setLabel(LLString("Bottom"));
spinner4->setVisible(TRUE);
spinner4->setLabel(LLString("Top"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(0);
spinner1->setValue(r.mLeft);
}
if (!spinner2->hasFocus())
{
spinner2->setPrecision(0);
spinner2->setValue(r.mRight);
}
if (!spinner3->hasFocus())
{
spinner3->setPrecision(0);
spinner3->setValue(r.mBottom);
}
if (!spinner4->hasFocus())
{
spinner4->setPrecision(0);
spinner4->setValue(r.mTop);
}
spinner1->setMinValue((F32)S32_MIN);
spinner1->setMaxValue((F32)S32_MAX);
spinner1->setIncrement(1.f);
spinner2->setMinValue((F32)S32_MIN);
spinner2->setMaxValue((F32)S32_MAX);
spinner2->setIncrement(1.f);
spinner3->setMinValue((F32)S32_MIN);
spinner3->setMaxValue((F32)S32_MAX);
spinner3->setIncrement(1.f);
spinner4->setMinValue((F32)S32_MIN);
spinner4->setMaxValue((F32)S32_MAX);
spinner4->setIncrement(1.f);
break;
}
case TYPE_COL4:
{
childSetVisible("boolean_combo", FALSE);
LLColor4 clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
// only set if changed so color picker doesn't update
if(clr != LLColor4(color_swatch->getValue()))
{
color_swatch->set(LLColor4(sd), TRUE, FALSE);
}
spinner4->setVisible(TRUE);
spinner4->setLabel(LLString("Alpha"));
if (!spinner4->hasFocus())
{
spinner4->setPrecision(3);
spinner4->setMinValue(0.0);
spinner4->setMaxValue(1.f);
spinner4->setValue(clr.mV[VALPHA]);
}
break;
}
case TYPE_COL3:
{
childSetVisible("boolean_combo", FALSE);
LLColor3 clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
color_swatch->setValue(sd);
break;
}
case TYPE_COL4U:
{
childSetVisible("boolean_combo", FALSE);
LLColor4U clr;
clr.setValue(sd);
color_swatch->setVisible(TRUE);
if(LLColor4(clr) != LLColor4(color_swatch->getValue()))
{
color_swatch->set(LLColor4(clr), TRUE, FALSE);
}
spinner4->setVisible(TRUE);
spinner4->setLabel(LLString("Alpha"));
if(!spinner4->hasFocus())
{
spinner4->setPrecision(0);
spinner4->setValue(clr.mV[VALPHA]);
}
spinner4->setMinValue(0);
spinner4->setMaxValue(255);
spinner4->setIncrement(1.f);
break;
}
default:
mComment->setText(LLString("unknown"));
break;
}
else
{
gAudiop->stopInternetStream();
}
}
return true;
}
static bool handleUseOcclusionChanged(const LLSD& newvalue)
{
LLPipeline::sUseOcclusion = (newvalue.asBoolean() && gGLManager.mHasOcclusionQuery
&& gFeatureManagerp->isFeatureAvailable("UseOcclusion") && !gUseWireframe) ? 2 : 0;
return true;
}
static bool handleNumpadControlChanged(const LLSD& newvalue)
{
if (gKeyboard)
{
gKeyboard->setNumpadDistinct(static_cast<LLKeyboard::e_numpad_distinct>(newvalue.asInteger()));
}
return true;
}
static bool handleRenderUseVBOChanged(const LLSD& newvalue)
{
if (gPipeline.isInit())
{
gPipeline.setUseVBO(newvalue.asBoolean());
}
return true;
}
static bool handleWLSkyDetailChanged(const LLSD&)
{
if (gSky.mVOWLSkyp.notNull())
{
gSky.mVOWLSkyp->updateGeometry(gSky.mVOWLSkyp->mDrawable);
}
return true;
}
static bool handleRenderLightingDetailChanged(const LLSD& newvalue)
{
if (gPipeline.isInit())
{
gPipeline.setLightingDetail(newvalue.asInteger());
}
return true;
}
static bool handleResetVertexBuffersChanged(const LLSD&)
{
if (gPipeline.isInit())
{
gPipeline.resetVertexBuffers();
}
return true;
}
static bool handleRenderDynamicLODChanged(const LLSD& newvalue)
{
LLPipeline::sDynamicLOD = newvalue.asBoolean();
return true;
}
static bool handleRenderUseFBOChanged(const LLSD& newvalue)
{
LLRenderTarget::sUseFBO = newvalue.asBoolean();
if (gPipeline.isInit())
{
gPipeline.releaseGLBuffers();
gPipeline.createGLBuffers();
}
return true;
}
static bool handleRenderUseImpostorsChanged(const LLSD& newvalue)
{
LLVOAvatar::sUseImpostors = newvalue.asBoolean();
return true;
}
static bool handleRenderUseCleverUIChanged(const LLSD& newvalue)
{
gGL.setClever(newvalue.asBoolean());
return true;
}
static bool handleRenderResolutionDivisorChanged(const LLSD&)
{
gResizeScreenTexture = TRUE;
return true;
}
static bool handleDebugViewsChanged(const LLSD& newvalue)
{
LLView::sDebugRects = newvalue.asBoolean();
return true;
}
static bool handleLogFileChanged(const LLSD& newvalue)
{
std::string log_filename = newvalue.asString();
LLFile::remove(log_filename.c_str());
LLError::logToFile(log_filename);
return true;
}
bool handleHideGroupTitleChanged(const LLSD& newvalue)
{
gAgent.setHideGroupTitle(newvalue);
return true;
}
bool handleEffectColorChanged(const LLSD& newvalue)
{
gAgent.setEffectColor(LLColor4(newvalue));
return true;
}
bool handleRotateNetMapChanged(const LLSD& newvalue)
{
LLNetMap::setRotateMap(newvalue.asBoolean());
return true;
}
bool handleVectorizeChanged(const LLSD& newvalue)
{
LLViewerJointMesh::updateVectorize();
return true;
}
bool handleVoiceClientPrefsChanged(const LLSD& newvalue)
{
if(gVoiceClient)
{
// Note: Ignore the specific event value, look up the ones we want
gVoiceClient->setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat"));
gVoiceClient->setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
std::string keyString = gSavedSettings.getString("PushToTalkButton");
gVoiceClient->setPTTKey(keyString);
gVoiceClient->setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle"));
gVoiceClient->setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
std::string serverName = gSavedSettings.getString("VivoxDebugServerName");
gVoiceClient->setVivoxDebugServerName(serverName);
std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
gVoiceClient->setCaptureDevice(inputDevice);
std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
gVoiceClient->setRenderDevice(outputDevice);
}
return true;
}
////////////////////////////////////////////////////////////////////////////
void settings_setup_listeners()
{
gSavedSettings.getControl("FirstPersonAvatarVisible")->getSignal()->connect(boost::bind(&handleRenderAvatarMouselookChanged, _1));
gSavedSettings.getControl("RenderFarClip")->getSignal()->connect(boost::bind(&handleRenderFarClipChanged, _1));
gSavedSettings.getControl("RenderTerrainDetail")->getSignal()->connect(boost::bind(&handleTerrainDetailChanged, _1));
gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
gSavedSettings.getControl("RenderDynamicReflections")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1));
gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
gSavedSettings.getControl("EnableRippleWater")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
gSavedSettings.getControl("RenderGlowResolutionPow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1));
gSavedSettings.getControl("RenderAvatarCloth")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
gSavedSettings.getControl("RenderGammaFull")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));
gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _1));
gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _1));
gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _1));
gSavedSettings.getControl("RenderTreeLODFactor")->getSignal()->connect(boost::bind(&handleTreeLODChanged, _1));
gSavedSettings.getControl("RenderFlexTimeFactor")->getSignal()->connect(boost::bind(&handleFlexLODChanged, _1));
gSavedSettings.getControl("ThrottleBandwidthKBPS")->getSignal()->connect(boost::bind(&handleBandwidthChanged, _1));
gSavedSettings.getControl("RenderGamma")->getSignal()->connect(boost::bind(&handleGammaChanged, _1));
gSavedSettings.getControl("RenderFogRatio")->getSignal()->connect(boost::bind(&handleFogRatioChanged, _1));
gSavedSettings.getControl("RenderMaxPartCount")->getSignal()->connect(boost::bind(&handleMaxPartCountChanged, _1));
gSavedSettings.getControl("RenderDynamicLOD")->getSignal()->connect(boost::bind(&handleRenderDynamicLODChanged, _1));
gSavedSettings.getControl("RenderDebugTextureBind")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1));
gSavedSettings.getControl("RenderFastAlpha")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1));
gSavedSettings.getControl("RenderObjectBump")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1));
gSavedSettings.getControl("RenderMaxVBOSize")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1));
gSavedSettings.getControl("RenderUseFBO")->getSignal()->connect(boost::bind(&handleRenderUseFBOChanged, _1));
gSavedSettings.getControl("RenderUseImpostors")->getSignal()->connect(boost::bind(&handleRenderUseImpostorsChanged, _1));
gSavedSettings.getControl("RenderUseCleverUI")->getSignal()->connect(boost::bind(&handleRenderUseCleverUIChanged, _1));
gSavedSettings.getControl("RenderResolutionDivisor")->getSignal()->connect(boost::bind(&handleRenderResolutionDivisorChanged, _1));
gSavedSettings.getControl("AvatarCompositeLimit")->getSignal()->connect(boost::bind(&handleCompositeLimitChanged, _1));
gSavedSettings.getControl("TextureMemory")->getSignal()->connect(boost::bind(&handleVideoMemoryChanged, _1));
gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&handleChatFontSizeChanged, _1));
gSavedSettings.getControl("ChatPersistTime")->getSignal()->connect(boost::bind(&handleChatPersistTimeChanged, _1));
gSavedSettings.getControl("ConsoleMaxLines")->getSignal()->connect(boost::bind(&handleConsoleMaxLinesChanged, _1));
gSavedSettings.getControl("UseOcclusion")->getSignal()->connect(boost::bind(&handleUseOcclusionChanged, _1));
gSavedSettings.getControl("AudioLevelMaster")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("AudioLevelSFX")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("AudioLevelUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("AudioLevelAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("AudioLevelMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("AudioLevelMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("AudioLevelVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("AudioLevelDistance")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("AudioLevelDoppler")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("AudioLevelRolloff")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("AudioStreamingMusic")->getSignal()->connect(boost::bind(&handleAudioStreamMusicChanged, _1));
gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("MuteMusic")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("MuteMedia")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("MuteVoice")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("MuteAmbient")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("MuteUI")->getSignal()->connect(boost::bind(&handleAudioVolumeChanged, _1));
gSavedSettings.getControl("RenderVBOEnable")->getSignal()->connect(boost::bind(&handleRenderUseVBOChanged, _1));
gSavedSettings.getControl("WLSkyDetail")->getSignal()->connect(boost::bind(&handleWLSkyDetailChanged, _1));
gSavedSettings.getControl("RenderLightingDetail")->getSignal()->connect(boost::bind(&handleRenderLightingDetailChanged, _1));
gSavedSettings.getControl("NumpadControl")->getSignal()->connect(boost::bind(&handleNumpadControlChanged, _1));
gSavedSettings.getControl("FlycamAxis0")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
gSavedSettings.getControl("FlycamAxis1")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
gSavedSettings.getControl("FlycamAxis2")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
gSavedSettings.getControl("FlycamAxis3")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
gSavedSettings.getControl("FlycamAxis4")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
gSavedSettings.getControl("FlycamAxis5")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
gSavedSettings.getControl("FlycamAxis6")->getSignal()->connect(boost::bind(&handleJoystickChanged, _1));
gSavedSettings.getControl("DebugViews")->getSignal()->connect(boost::bind(&handleDebugViewsChanged, _1));
gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _1));
gSavedSettings.getControl("RenderHideGroupTitle")->getSignal()->connect(boost::bind(handleHideGroupTitleChanged, _1));
gSavedSettings.getControl("EffectColor")->getSignal()->connect(boost::bind(handleEffectColorChanged, _1));
gSavedSettings.getControl("MiniMapRotate")->getSignal()->connect(boost::bind(handleRotateNetMapChanged, _1));
gSavedSettings.getControl("VectorizePerfTest")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
gSavedSettings.getControl("VectorizeEnable")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
gSavedSettings.getControl("VectorizeProcessor")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
gSavedSettings.getControl("VectorizeSkin")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
gSavedSettings.getControl("EnableVoiceChat")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
gSavedSettings.getControl("PTTCurrentlyEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
gSavedSettings.getControl("PushToTalkButton")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
gSavedSettings.getControl("PushToTalkToggle")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
gSavedSettings.getControl("VoiceEarLocation")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
gSavedSettings.getControl("VivoxDebugServerName")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
gSavedSettings.getControl("VoiceInputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
gSavedSettings.getControl("VoiceOutputAudioDevice")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _1));
}

View File

@ -32,9 +32,8 @@
#ifndef LL_LLVIEWERCONTROL_H
#define LL_LLVIEWERCONTROL_H
#include <map>
#include "llcontrol.h"
#include "llfloater.h"
#include "lltexteditor.h"
// Enabled this definition to compile a 'hacked' viewer that
// allows a hacked godmode to be toggled on and off.
@ -43,33 +42,12 @@
extern BOOL gHackGodmode;
#endif
class LLFloaterSettingsDebug : public LLFloater
{
public:
LLFloaterSettingsDebug();
virtual ~LLFloaterSettingsDebug();
virtual BOOL postBuild();
virtual void draw();
void updateControl(LLControlBase* control);
static void show(void*);
static void onSettingSelect(LLUICtrl* ctrl, void* user_data);
static void onCommitSettings(LLUICtrl* ctrl, void* user_data);
static void onClickDefault(void* user_data);
protected:
static LLFloaterSettingsDebug* sInstance;
LLTextEditor* mComment;
};
// These functions found in llcontroldef.cpp *TODO: clean this up!
//setting variables are declared in this function
void declare_settings();
void fixup_settings();
void settings_setup_listeners();
extern std::map<LLString, LLControlGroup*> gSettings;
// for the graphics settings
void create_graphics_group(LLControlGroup& group);
@ -90,7 +68,4 @@ extern LLControlGroup gCrashSettings;
extern LLString gLastRunVersion;
extern LLString gCurrentVersion;
extern LLString gSettingsFileName;
extern LLString gPerAccountSettingsFileName;
#endif // LL_LLVIEWERCONTROL_H

View File

@ -866,13 +866,53 @@ static F64 sUpdateGeometryRunAvgOn[10];
static U32 sUpdateGeometryRunCount = 0 ;
static U32 sUpdateGeometryCalls = 0 ;
static U32 sUpdateGeometryLastProcessor = 0 ;
static BOOL sVectorizePerfTest = FALSE;
static U32 sVectorizeProcessor = 0;
//static
void (*LLViewerJointMesh::sUpdateGeometryFunc)(LLFace* face, LLPolyMesh* mesh);
//static
void LLViewerJointMesh::updateVectorize()
{
sVectorizePerfTest = gSavedSettings.getBOOL("VectorizePerfTest");
sVectorizeProcessor = gSavedSettings.getU32("VectorizeProcessor");
BOOL vectorizeEnable = gSavedSettings.getBOOL("VectorizeEnable");
BOOL vectorizeSkin = gSavedSettings.getBOOL("VectorizeSkin");
std::string vp;
switch(sVectorizeProcessor)
{
case 2: vp = "SSE2"; break; // *TODO: replace the magic #s
case 1: vp = "SSE"; break;
default: vp = "COMPILER DEFAULT"; break;
}
llinfos << "Vectorization : " << ( vectorizeEnable ? "ENABLED" : "DISABLED" ) << llendl ;
llinfos << "Vector Processor : " << vp << llendl ;
llinfos << "Vectorized Skinning : " << ( vectorizeSkin ? "ENABLED" : "DISABLED" ) << llendl ;
if(vectorizeEnable && vectorizeSkin)
{
switch(sVectorizeProcessor)
{
case 2:
sUpdateGeometryFunc = &updateGeometrySSE2;
break;
case 1:
sUpdateGeometryFunc = &updateGeometrySSE;
break;
default:
sUpdateGeometryFunc = &updateGeometryVectorized;
break;
}
}
else
{
sUpdateGeometryFunc = &updateGeometryOriginal;
}
}
void LLViewerJointMesh::updateGeometry()
{
extern BOOL gVectorizePerfTest;
extern U32 gVectorizeProcessor;
if (!(mValid
&& mMesh
&& mFace
@ -883,7 +923,7 @@ void LLViewerJointMesh::updateGeometry()
return;
}
if (!gVectorizePerfTest)
if (!sVectorizePerfTest)
{
// Once we've measured performance, just run the specified
// code version.
@ -916,13 +956,13 @@ void LLViewerJointMesh::updateGeometry()
{
F64 time_since_app_start = ug_timer.getElapsedSeconds();
if(sUpdateGeometryGlobalTime == 0.0
|| sUpdateGeometryLastProcessor != gVectorizeProcessor)
|| sUpdateGeometryLastProcessor != sVectorizeProcessor)
{
sUpdateGeometryGlobalTime = time_since_app_start;
sUpdateGeometryElapsedTime = 0;
sUpdateGeometryCalls = 0;
sUpdateGeometryRunCount = 0;
sUpdateGeometryLastProcessor = gVectorizeProcessor;
sUpdateGeometryLastProcessor = sVectorizeProcessor;
sUpdateGeometryCallPointer = false;
return;
}
@ -969,7 +1009,7 @@ void LLViewerJointMesh::updateGeometry()
F64 perf_boost = ( sUpdateGeometryElapsedTimeOff - sUpdateGeometryElapsedTimeOn ) / sUpdateGeometryElapsedTimeOn;
llinfos << "run averages (" << (F64)sUpdateGeometryRunCount
<< "/10) vectorize off " << a
<< "% : vectorize type " << gVectorizeProcessor
<< "% : vectorize type " << sVectorizeProcessor
<< " " << b
<< "% : performance boost "
<< perf_boost * 100.0
@ -983,7 +1023,6 @@ void LLViewerJointMesh::updateGeometry()
// We have data now on which version is faster. Switch to that
// code and save the data for next run.
gVectorizePerfTest = FALSE;
gSavedSettings.setBOOL("VectorizePerfTest", FALSE);
if (perf_boost > 0.0)

View File

@ -149,6 +149,9 @@ public:
/*virtual*/ BOOL isAnimatable() { return FALSE; }
static void updateVectorize(); // Update globals when settings variables change
private:
// Avatar vertex skinning is a significant performance issue on computers
// with avatar vertex programs turned off (for example, most Macs). We
// therefore have custom versions that use SIMD instructions.

View File

@ -44,9 +44,6 @@
#include "llmediamanager.h"
#include "lluuid.h"
// don't want to include llappviewer.h
extern std::string gChannelName;
// Implementation functions not exported into header file
class LLViewerMediaImpl
: public LLMediaObserver
@ -457,7 +454,7 @@ void LLViewerMedia::initClass()
// append our magic version number string to the browser user agent id
std::ostringstream codec;
codec << "[Second Life ";
codec << "(" << gChannelName << ")";
codec << "(" << gSavedSettings.getString("VersionChannelName") << ")";
codec << " - " << LL_VERSION_MAJOR << "." << LL_VERSION_MINOR << "." << LL_VERSION_PATCH << "." << LL_VERSION_BUILD;
codec << "]";
init_data->setBrowserUserAgentId( codec.str() );

View File

@ -120,6 +120,7 @@
#include "llfloaterregioninfo.h"
#include "llfloaterreporter.h"
#include "llfloaterscriptdebug.h"
#include "llfloatersettingsdebug.h"
#include "llfloaterenvsettings.h"
#include "llfloaterstats.h"
#include "llfloatertest.h"
@ -376,6 +377,11 @@ void toggle_cull_small(void *);
void toggle_show_xui_names(void *);
BOOL check_show_xui_names(void *);
void run_vectorize_perf_test(void *)
{
gSavedSettings.setBOOL("VectorizePerfTest", TRUE);
}
// Debug UI
void handle_web_search_demo(void*);
void handle_slurl_test(void*);
@ -1091,7 +1097,7 @@ void init_client_menu(LLMenuGL* menu)
&menu_check_control,
(void*)"ShowConsoleWindow"));
if(gQAMode)
if(gSavedSettings.getBOOL("QAMode"))
{
LLMenuGL* sub = NULL;
sub = new LLMenuGL("Debugging");
@ -1171,7 +1177,6 @@ extern BOOL gDebugClicks;
extern BOOL gDebugWindowProc;
extern BOOL gDebugTextEditorTips;
extern BOOL gDebugSelectMgr;
extern BOOL gVectorizePerfTest;
void init_debug_ui_menu(LLMenuGL* menu)
{
@ -1383,7 +1388,7 @@ void init_debug_rendering_menu(LLMenuGL* menu)
(void*)"ShowDepthBuffer"));
sub_menu->append(new LLMenuItemToggleGL("Show Select Buffer", &gDebugSelect));
sub_menu->append(new LLMenuItemToggleGL("Vectorize Perf Test", &gVectorizePerfTest));
sub_menu->append(new LLMenuItemCallGL("Vectorize Perf Test", &run_vectorize_perf_test));
sub_menu = new LLMenuGL("Render Tests");
@ -4850,7 +4855,7 @@ BOOL menu_check_build_tool( void* user_data )
void handle_reload_settings(void*)
{
gSavedSettings.resetToDefaults();
gSavedSettings.loadFromFile(gSettingsFileName, TRUE);
gSavedSettings.loadFromFile(gSavedSettings.getString("ClientSettingsFile"), TRUE);
llinfos << "Loading colors from colors.xml" << llendl;
std::string color_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"colors.xml");

View File

@ -114,10 +114,5 @@ LLGridData gGridInfo[GRID_INFO_COUNT] =
// Use this to figure out which domain name and login URI to use.
EGridInfo gGridChoice = GRID_INFO_NONE;
char gGridName[MAX_STRING]; /* Flawfinder: ignore */
F32 gPacketDropPercentage = 0.f;
F32 gInBandwidth = 0.f;
F32 gOutBandwidth = 0.f;
LLString gGridName; /* Flawfinder: ignore */
unsigned char gMACAddress[MAC_ADDRESS_BYTES]; /* Flawfinder: ignore */

View File

@ -55,7 +55,7 @@ enum EGridInfo
GRID_INFO_VAAK,
GRID_INFO_YAMI,
GRID_INFO_LOCAL,
GRID_INFO_OTHER, // IP address set via -user or other command line option
GRID_INFO_OTHER, // IP address set via command line option
GRID_INFO_COUNT
};
@ -68,12 +68,9 @@ struct LLGridData
const char* mHelperURI;
};
extern F32 gPacketDropPercentage;
extern F32 gInBandwidth;
extern F32 gOutBandwidth;
extern EGridInfo gGridChoice;
extern LLGridData gGridInfo[];
extern char gGridName[MAX_STRING]; /* Flawfinder: ignore */
extern LLString gGridName; /* Flawfinder: ignore */
const S32 MAC_ADDRESS_BYTES = 6;
extern unsigned char gMACAddress[MAC_ADDRESS_BYTES]; /* Flawfinder: ignore */

View File

@ -678,31 +678,6 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
///////////////////////////////////////////////////////////////////////////////////////////////
class LLVoiceClientPrefsListener: public LLSimpleListener
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
// Note: Ignore the specific event value, look up the ones we want
gVoiceClient->setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat"));
gVoiceClient->setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
std::string keyString = gSavedSettings.getString("PushToTalkButton");
gVoiceClient->setPTTKey(keyString);
gVoiceClient->setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle"));
gVoiceClient->setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
std::string serverName = gSavedSettings.getString("VivoxDebugServerName");
gVoiceClient->setVivoxDebugServerName(serverName);
std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
gVoiceClient->setCaptureDevice(inputDevice);
std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
gVoiceClient->setRenderDevice(outputDevice);
return true;
}
};
static LLVoiceClientPrefsListener voice_prefs_listener;
class LLVoiceClientMuteListObserver : public LLMuteListObserver
{
/* virtual */ void onChange() { gVoiceClient->muteListChanged();}
@ -859,16 +834,6 @@ LLVoiceClient::LLVoiceClient()
std::string renderDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
setRenderDevice(renderDevice);
// Set up our listener to get updates on all prefs values we care about.
gSavedSettings.getControl("EnableVoiceChat")->addListener(&voice_prefs_listener);
gSavedSettings.getControl("PTTCurrentlyEnabled")->addListener(&voice_prefs_listener);
gSavedSettings.getControl("PushToTalkButton")->addListener(&voice_prefs_listener);
gSavedSettings.getControl("PushToTalkToggle")->addListener(&voice_prefs_listener);
gSavedSettings.getControl("VoiceEarLocation")->addListener(&voice_prefs_listener);
gSavedSettings.getControl("VivoxDebugServerName")->addListener(&voice_prefs_listener);
gSavedSettings.getControl("VoiceInputAudioDevice")->addListener(&voice_prefs_listener);
gSavedSettings.getControl("VoiceOutputAudioDevice")->addListener(&voice_prefs_listener);
mTuningMode = false;
mTuningEnergy = 0.0f;
mTuningMicVolume = 0;
@ -1281,7 +1246,7 @@ void LLVoiceClient::stateMachine()
break;
case stateStart:
if(gDisableVoice)
if(gSavedSettings.getBOOL("CmdLineDisableVoice"))
{
// Voice is locked out, we must not launch the vivox daemon.
setState(stateJail);
@ -3644,7 +3609,7 @@ void LLVoiceClient::setVoiceEnabled(bool enabled)
bool LLVoiceClient::voiceEnabled()
{
return gSavedSettings.getBOOL("EnableVoiceChat") && !gDisableVoice;
return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
}
void LLVoiceClient::setUsePTT(bool usePTT)

View File

@ -238,8 +238,9 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
// mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // usefull for debugging
mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1);
mCurlRequest->setWriteCallback(&curlDownloadCallback, (void*)this);
mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, gVerifySSLCert);
mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, gVerifySSLCert? 2 : 0);
BOOL vefifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert");
mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, vefifySSLCert);
mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, vefifySSLCert ? 2 : 0);
// Be a little impatient about establishing connections.
mCurlRequest->setopt(CURLOPT_CONNECTTIMEOUT, 40L);

View File

@ -115,15 +115,15 @@ class ViewerManifest(LLManifest):
if not self.default_grid():
if self.default_channel():
# beta grid viewer
channel_flags = '-settings settings_beta.xml'
grid_flags = "-helperuri http://preview-%(grid)s.secondlife.com/helpers/ -loginuri https://login.%(grid)s.lindenlab.com/cgi-bin/login.cgi" % {'grid':self.args['grid']}
channel_flags = '--settings settings_beta.xml'
grid_flags = "--helperuri http://preview-%(grid)s.secondlife.com/helpers/ --loginuri https://login.%(grid)s.lindenlab.com/cgi-bin/login.cgi" % {'grid':self.args['grid']}
if not self.default_channel():
# some channel on some grid
channel_flags = '-settings settings_%s.xml -channel "%s"' % (self.channel_lowerword(), self.channel())
channel_flags = '--settings settings_%s.xml --channel "%s"' % (self.channel_lowerword(), self.channel())
elif self.login_channel():
# Report a special channel during login, but use default channel elsewhere
channel_flags = '-channel "%s"' % (self.login_channel())
channel_flags = '--channel "%s"' % (self.login_channel())
return " ".join((channel_flags, grid_flags)).strip()