Get the codebase to compile
This commit is contained in:
parent
bf0cc9ba5f
commit
a2adff46ce
@ -72,7 +72,7 @@ void KeyboardBindingsController::NotifyKeyReleased()
|
||||
view->OnKeyReleased();
|
||||
}
|
||||
|
||||
void KeyboardBindingsController::PopBindingByFunctionId(int32_t functionId)
|
||||
void KeyboardBindingsController::PopBindingByFunctionId(int functionId)
|
||||
{
|
||||
model->PopBindingByFunctionId(functionId);
|
||||
}
|
||||
@ -82,7 +82,7 @@ void KeyboardBindingsController::ResetToDefaults()
|
||||
model->WriteDefaultPrefs(true);
|
||||
}
|
||||
|
||||
bool KeyboardBindingsController::FunctionHasShortcut(int32_t functionId)
|
||||
bool KeyboardBindingsController::FunctionHasShortcut(int functionId)
|
||||
{
|
||||
return model->FunctionHasShortcut(functionId);
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ public:
|
||||
void NotifyKeyReleased();
|
||||
void OnKeyReleased();
|
||||
void NotifyBindingsChanged();
|
||||
void PopBindingByFunctionId(int32_t functionId);
|
||||
bool FunctionHasShortcut(int32_t functionId);
|
||||
void PopBindingByFunctionId(int functionId);
|
||||
bool FunctionHasShortcut(int functionId);
|
||||
void ResetToDefaults();
|
||||
|
||||
void LoadBindingPrefs();
|
||||
|
@ -5,15 +5,15 @@
|
||||
|
||||
typedef struct KeyboardBindingMap
|
||||
{
|
||||
uint32_t id;
|
||||
int id;
|
||||
String description;
|
||||
int32_t functionId;
|
||||
int functionId;
|
||||
} KeyboardBindingMap;
|
||||
|
||||
typedef struct DefaultKeyboardBindingMap
|
||||
{
|
||||
ByteString keyCombo;
|
||||
uint32_t bindingId; // KeyboardBindingMap id
|
||||
int bindingId; // KeyboardBindingMap id
|
||||
} DefaultKeyboardBindingMap;
|
||||
|
||||
static KeyboardBindingMap keyboardBindingFunctionMap[] =
|
||||
|
@ -12,7 +12,7 @@ void KeyboardBindingsModel::WriteDefaultFuncArray(bool force)
|
||||
|
||||
for (auto defaultBinding : defaultKeyboardBindingMapArray)
|
||||
{
|
||||
int32_t functionId;
|
||||
int functionId;
|
||||
String description;
|
||||
for (auto functions : keyboardBindingFunctionMap)
|
||||
{
|
||||
@ -52,7 +52,7 @@ void KeyboardBindingsModel::WriteDefaultPrefs(bool force)
|
||||
|
||||
for (auto defaultBinding : defaultKeyboardBindingMapArray)
|
||||
{
|
||||
int32_t functionId;
|
||||
int functionId;
|
||||
String description;
|
||||
for (auto functions : keyboardBindingFunctionMap)
|
||||
{
|
||||
@ -103,7 +103,7 @@ void KeyboardBindingsModel::LoadBindingPrefs()
|
||||
if (bindings != Json::nullValue)
|
||||
{
|
||||
Json::Value::Members keyComboJson = bindings.getMemberNames();
|
||||
uint32_t index = 0;
|
||||
int index = 0;
|
||||
|
||||
for (auto& member : keyComboJson)
|
||||
{
|
||||
@ -114,7 +114,7 @@ void KeyboardBindingsModel::LoadBindingPrefs()
|
||||
if (result != Json::nullValue)
|
||||
{
|
||||
BindingModel model;
|
||||
std::pair<uint32_t, uint32_t> p = GetModifierAndScanFromString(keyCombo);
|
||||
std::pair<int, int> p = GetModifierAndScanFromString(keyCombo);
|
||||
model.modifier = p.first;
|
||||
model.scan = p.second;
|
||||
model.functionId = result["functionId"].asInt();
|
||||
@ -128,11 +128,11 @@ void KeyboardBindingsModel::LoadBindingPrefs()
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<uint32_t, uint32_t>
|
||||
std::pair<int, int>
|
||||
KeyboardBindingsModel::GetModifierAndScanFromString(ByteString str)
|
||||
{
|
||||
uint32_t modifier = 0;
|
||||
uint32_t scan = 0;
|
||||
int modifier = 0;
|
||||
int scan = 0;
|
||||
|
||||
if (str == "NULL")
|
||||
{
|
||||
@ -152,7 +152,7 @@ KeyboardBindingsModel::GetModifierAndScanFromString(ByteString str)
|
||||
return std::make_pair(modifier, scan);
|
||||
}
|
||||
|
||||
void KeyboardBindingsModel::TurnOffFunctionShortcut(int32_t functionId)
|
||||
void KeyboardBindingsModel::TurnOffFunctionShortcut(int functionId)
|
||||
{
|
||||
ByteString pref = ByteString(KEYBOARDBINDING_FUNCS_PREF) + ByteString(".") + ByteString(functionId)
|
||||
+ ByteString(".hasShortcut");
|
||||
@ -160,7 +160,7 @@ void KeyboardBindingsModel::TurnOffFunctionShortcut(int32_t functionId)
|
||||
Client::Ref().SetPref(pref, false);
|
||||
}
|
||||
|
||||
void KeyboardBindingsModel::TurnOnFunctionShortcut(int32_t functionId)
|
||||
void KeyboardBindingsModel::TurnOnFunctionShortcut(int functionId)
|
||||
{
|
||||
ByteString pref = ByteString(KEYBOARDBINDING_FUNCS_PREF) + ByteString(".") + ByteString(functionId)
|
||||
+ ByteString(".hasShortcut");
|
||||
@ -168,7 +168,7 @@ void KeyboardBindingsModel::TurnOnFunctionShortcut(int32_t functionId)
|
||||
Client::Ref().SetPref(pref, true);
|
||||
}
|
||||
|
||||
void KeyboardBindingsModel::RemoveModelByIndex(uint32_t index)
|
||||
void KeyboardBindingsModel::RemoveModelByIndex(int index)
|
||||
{
|
||||
std::vector<BindingModel>::iterator it = bindingPrefs.begin();
|
||||
|
||||
@ -210,7 +210,7 @@ void KeyboardBindingsModel::AddModel(BindingModel model)
|
||||
NotifyBindingsChanged(hasConflict);
|
||||
}
|
||||
|
||||
bool KeyboardBindingsModel::FunctionHasShortcut(int32_t functionId)
|
||||
bool KeyboardBindingsModel::FunctionHasShortcut(int functionId)
|
||||
{
|
||||
ByteString pref = ByteString(KEYBOARDBINDING_FUNCS_PREF) + ByteString(".") + ByteString(functionId)
|
||||
+ ByteString(".hasShortcut");
|
||||
@ -237,9 +237,9 @@ void KeyboardBindingsModel::Save()
|
||||
Client::Ref().WritePrefs();
|
||||
}
|
||||
|
||||
int32_t KeyboardBindingsModel::GetFunctionForBinding(int scan, bool shift, bool ctrl, bool alt)
|
||||
int KeyboardBindingsModel::GetFunctionForBinding(int scan, bool shift, bool ctrl, bool alt)
|
||||
{
|
||||
uint32_t modifier = 0;
|
||||
int modifier = 0;
|
||||
|
||||
if (ctrl)
|
||||
modifier |= BINDING_CTRL;
|
||||
@ -272,7 +272,7 @@ int32_t KeyboardBindingsModel::GetFunctionForBinding(int scan, bool shift, bool
|
||||
* then we turn off hasShortcut for the associated function
|
||||
* so it renders as *No Shortcut* on the view
|
||||
*/
|
||||
void KeyboardBindingsModel::PopBindingByFunctionId(int32_t functionId)
|
||||
void KeyboardBindingsModel::PopBindingByFunctionId(int functionId)
|
||||
{
|
||||
std::sort(bindingPrefs.begin(), bindingPrefs.end(), [](BindingModel a, BindingModel b)
|
||||
{
|
||||
@ -356,4 +356,4 @@ void KeyboardBindingsModel::NotifyBindingsChanged(bool hasConflict)
|
||||
{
|
||||
observer->OnKeyCombinationChanged(hasConflict);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,13 @@
|
||||
|
||||
struct BindingModel
|
||||
{
|
||||
uint32_t modifier;
|
||||
uint32_t scan;
|
||||
int32_t functionId;
|
||||
int modifier;
|
||||
int scan;
|
||||
int functionId;
|
||||
String description;
|
||||
uint32_t index;
|
||||
bool isNew;
|
||||
int index;
|
||||
bool noShortcut;
|
||||
bool isNew;
|
||||
|
||||
BindingModel() : noShortcut(false), isNew(false){};
|
||||
|
||||
@ -50,25 +50,25 @@ public:
|
||||
inline std::vector<BindingModel> GetBindingPrefs() const { return bindingPrefs; }
|
||||
void LoadBindingPrefs();
|
||||
void Save();
|
||||
void RemoveModelByIndex(uint32_t index);
|
||||
void RemoveModelByIndex(int index);
|
||||
void AddModel(BindingModel model);
|
||||
void CreateModel(BindingModel model);
|
||||
String GetDisplayForModel(BindingModel model);
|
||||
void AddObserver(KeyboardBindingsView* observer);
|
||||
void NotifyBindingsChanged(bool hasConflict);
|
||||
bool HasConflictingCombo();
|
||||
void PopBindingByFunctionId(int32_t functionId);
|
||||
void PopBindingByFunctionId(int functionId);
|
||||
void WriteDefaultFuncArray(bool force = false);
|
||||
bool FunctionHasShortcut(int32_t functionId);
|
||||
int32_t GetFunctionForBinding(int scan, bool shift, bool ctrl, bool alt);
|
||||
bool FunctionHasShortcut(int functionId);
|
||||
int GetFunctionForBinding(int scan, bool shift, bool ctrl, bool alt);
|
||||
|
||||
protected:
|
||||
void TurnOffFunctionShortcut(int32_t functionId);
|
||||
void TurnOnFunctionShortcut(int32_t functionId);
|
||||
void TurnOffFunctionShortcut(int functionId);
|
||||
void TurnOnFunctionShortcut(int functionId);
|
||||
|
||||
std::vector<KeyboardBindingsView*> observers;
|
||||
std::vector<BindingModel> bindingPrefs;
|
||||
std::pair<uint32_t, uint32_t> GetModifierAndScanFromString(ByteString str);
|
||||
std::pair<int, int> GetModifierAndScanFromString(ByteString str);
|
||||
};
|
||||
|
||||
#endif // KEYBOARDBINDINGSMODEL_H
|
||||
#endif // KEYBOARDBINDINGSMODEL_H
|
||||
|
@ -37,7 +37,7 @@ void KeyboardBindingsTextbox::SetTextToPrevious()
|
||||
SetText(prevKey);
|
||||
}
|
||||
|
||||
void KeyboardBindingsTextbox::SetTextFromModifierAndScan(uint32_t modifier, uint32_t scan)
|
||||
void KeyboardBindingsTextbox::SetTextFromModifierAndScan(int modifier, int scan)
|
||||
{
|
||||
ByteString modDisplay;
|
||||
|
||||
@ -67,7 +67,7 @@ void KeyboardBindingsTextbox::OnKeyRelease(int key, int scan, bool repeat, bool
|
||||
{
|
||||
ui::Textbox::OnKeyRelease(key, scan, repeat, shift, ctrl, alt);
|
||||
|
||||
uint32_t mod = 0x00;
|
||||
int mod = 0x00;
|
||||
ByteString modDisplay = "";
|
||||
|
||||
if (ctrl)
|
||||
@ -103,7 +103,7 @@ void KeyboardBindingsTextbox::OnKeyRelease(int key, int scan, bool repeat, bool
|
||||
|
||||
BindingModel newModel;
|
||||
newModel.modifier = mod;
|
||||
newModel.scan = (uint32_t) scan;
|
||||
newModel.scan = (int) scan;
|
||||
newModel.functionId = model.functionId;
|
||||
newModel.description = model.description;
|
||||
newModel.index = model.index;
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
void OnMouseClick(int x, int y, unsigned button);
|
||||
|
||||
void SetModel(BindingModel _model);
|
||||
void SetTextFromModifierAndScan(uint32_t modifier, uint32_t scan);
|
||||
void SetTextFromModifierAndScan(int modifier, int scan);
|
||||
void SetTextToPrevious();
|
||||
|
||||
void OnTextInput(String text) {}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "KeyboardBindingsController.h"
|
||||
#include "client/Client.h"
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
KeyboardBindingsView::KeyboardBindingsView() :
|
||||
ui::Window(ui::Point(-1, -1), ui::Point(320, 340)) {
|
||||
@ -86,7 +87,7 @@ void KeyboardBindingsView::ClearScrollPanel()
|
||||
|
||||
void KeyboardBindingsView::BuildKeyBindingsListView()
|
||||
{
|
||||
uint32_t currentY = 0;
|
||||
int currentY = 0;
|
||||
float scrollPos = scrollPanel->GetScrollPositionY();
|
||||
ClearScrollPanel();
|
||||
|
||||
@ -96,7 +97,7 @@ void KeyboardBindingsView::BuildKeyBindingsListView()
|
||||
std::vector<BindingModel> bindingModel = c->GetBindingPrefs();
|
||||
std::sort(bindingModel.begin(), bindingModel.end());
|
||||
|
||||
for (int i = 0; i < bindingModel.size(); i++)
|
||||
for (int i = 0; i < (int)bindingModel.size(); i++)
|
||||
{
|
||||
BindingModel& binding = bindingModel[i];
|
||||
|
||||
@ -173,10 +174,10 @@ void KeyboardBindingsView::BuildKeyBindingsListView()
|
||||
{
|
||||
public:
|
||||
KeyboardBindingsView * v;
|
||||
int32_t functionId;
|
||||
int functionId;
|
||||
String desc;
|
||||
|
||||
AddBindingAction(KeyboardBindingsView * v_, int32_t _functionId, String _desc)
|
||||
AddBindingAction(KeyboardBindingsView * v_, int _functionId, String _desc)
|
||||
{
|
||||
v = v_;
|
||||
functionId = _functionId;
|
||||
@ -210,9 +211,9 @@ void KeyboardBindingsView::BuildKeyBindingsListView()
|
||||
{
|
||||
public:
|
||||
KeyboardBindingsView * v;
|
||||
int32_t functionId;
|
||||
int functionId;
|
||||
|
||||
RemoveBindingAction(KeyboardBindingsView * v_, int32_t _functionId)
|
||||
RemoveBindingAction(KeyboardBindingsView * v_, int _functionId)
|
||||
{
|
||||
v = v_;
|
||||
functionId = _functionId;
|
||||
|
Loading…
Reference in New Issue
Block a user