SL-443 Keybindings: Backward compatibility
parent
0814ba3322
commit
48921a6232
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<keys>
|
||||
<keys version="1">
|
||||
<first_person>
|
||||
<binding key="A" mask="NONE" command="slide_left"/>
|
||||
<binding key="D" mask="NONE" command="slide_right"/>
|
||||
|
|
|
|||
|
|
@ -376,6 +376,22 @@ bool LLKeyConflictHandler::loadFromSettings(const ESourceMode &load_mode, const
|
|||
LL_ERRS() << "Not implememted mode " << load_mode << LL_ENDL;
|
||||
break;
|
||||
}
|
||||
|
||||
// verify version
|
||||
if (keys.version < 1)
|
||||
{
|
||||
// Updating from a version that was not aware of LMouse bindings.
|
||||
// Assign defaults.
|
||||
//
|
||||
// mDefaultsMap is always going to have correct version so
|
||||
// registerControl is usable, but using 'destination' just in case.
|
||||
LLKeyConflict &type_data = (*destination)[script_mouse_handler_name];
|
||||
LLKeyData data(CLICK_LEFT, KEY_NONE, MASK_NONE, true);
|
||||
type_data.mKeyBind.replaceKeyData(data, 0);
|
||||
|
||||
// Mark this mode for an update
|
||||
mHasUnsavedChanges = true;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -416,6 +432,12 @@ void LLKeyConflictHandler::loadFromSettings(ESourceMode load_mode)
|
|||
}
|
||||
}
|
||||
mLoadMode = load_mode;
|
||||
|
||||
if (mHasUnsavedChanges)
|
||||
{
|
||||
// We ended up with some settings assigned due to changes in version, resave
|
||||
saveToSettings(false);
|
||||
}
|
||||
}
|
||||
|
||||
void LLKeyConflictHandler::saveToSettings(bool temporary)
|
||||
|
|
|
|||
|
|
@ -129,14 +129,14 @@ public:
|
|||
// resets current mode to defaults
|
||||
void resetToDefaults();
|
||||
|
||||
bool empty() { return mControlsMap.empty(); }
|
||||
bool empty() const { return mControlsMap.empty(); }
|
||||
void clear();
|
||||
|
||||
// reloads bindings from last valid user's xml or from default xml
|
||||
// to keyboard's handler
|
||||
static void resetKeyboardBindings();
|
||||
|
||||
bool hasUnsavedChanges() { return mHasUnsavedChanges; }
|
||||
bool hasUnsavedChanges() const { return mHasUnsavedChanges; }
|
||||
void setLoadMode(ESourceMode mode) { mLoadMode = mode; }
|
||||
ESourceMode getLoadMode() { return mLoadMode; }
|
||||
|
||||
|
|
|
|||
|
|
@ -1212,7 +1212,8 @@ LLViewerInput::Keys::Keys()
|
|||
: first_person("first_person"),
|
||||
third_person("third_person"),
|
||||
sitting("sitting"),
|
||||
edit_avatar("edit_avatar")
|
||||
edit_avatar("edit_avatar"),
|
||||
version("version", 0)
|
||||
{}
|
||||
|
||||
void LLViewerInput::resetBindings()
|
||||
|
|
@ -1240,6 +1241,16 @@ S32 LLViewerInput::loadBindingsXML(const std::string& filename)
|
|||
binding_count += loadBindingMode(keys.third_person, MODE_THIRD_PERSON);
|
||||
binding_count += loadBindingMode(keys.sitting, MODE_SITTING);
|
||||
binding_count += loadBindingMode(keys.edit_avatar, MODE_EDIT_AVATAR);
|
||||
|
||||
// verify version
|
||||
if (keys.version < 1)
|
||||
{
|
||||
// updating from a version that was not aware of LMouse bindings
|
||||
for (S32 i = 0; i < MODE_COUNT; i++)
|
||||
{
|
||||
mLMouseDefaultHandling[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return binding_count;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public:
|
|||
third_person,
|
||||
sitting,
|
||||
edit_avatar;
|
||||
|
||||
Optional<U32> version;
|
||||
Keys();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue