mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Cleanup: callbacks->lambdas
This commit is contained in:
parent
ca40de852a
commit
2b7fe0d729
2 changed files with 12 additions and 23 deletions
|
@ -243,16 +243,24 @@ void ControlMappingScreen::CreateViews() {
|
|||
root_ = new LinearLayout(ORIENT_HORIZONTAL);
|
||||
|
||||
LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT, Margins(10, 0, 0, 10)));
|
||||
leftColumn->Add(new Choice(km->T("Clear All")))->OnClick.Handle(this, &ControlMappingScreen::OnClearMapping);
|
||||
leftColumn->Add(new Choice(km->T("Default All")))->OnClick.Handle(this, &ControlMappingScreen::OnDefaultMapping);
|
||||
|
||||
leftColumn->Add(new Choice(km->T("Clear All")))->OnClick.Add([](UI::EventParams &) {
|
||||
KeyMap::ClearAllMappings();
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
leftColumn->Add(new Choice(km->T("Default All")))->OnClick.Add([](UI::EventParams &) {
|
||||
KeyMap::RestoreDefault();
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
std::string sysName = System_GetProperty(SYSPROP_NAME);
|
||||
// If there's a builtin controller, restore to default should suffice. No need to conf the controller on top.
|
||||
if (!KeyMap::HasBuiltinController(sysName) && KeyMap::GetSeenPads().size()) {
|
||||
leftColumn->Add(new Choice(km->T("Autoconfigure")))->OnClick.Handle(this, &ControlMappingScreen::OnAutoConfigure);
|
||||
}
|
||||
|
||||
leftColumn->Add(new Choice(km->T("Show PSP")))->OnClick.Handle(this, &ControlMappingScreen::OnVisualizeMapping);
|
||||
leftColumn->Add(new Choice(km->T("Show PSP")))->OnClick.Add([=](UI::EventParams &) {
|
||||
screenManager()->push(new VisualMappingScreen(gamePath_));
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
leftColumn->Add(new CheckBox(&g_Config.bAllowMappingCombos, km->T("Allow combo mappings")));
|
||||
|
||||
leftColumn->Add(new Spacer(new LinearLayoutParams(1.0f)));
|
||||
|
@ -287,16 +295,6 @@ void ControlMappingScreen::update() {
|
|||
SetVRAppMode(VRAppMode::VR_MENU_MODE);
|
||||
}
|
||||
|
||||
UI::EventReturn ControlMappingScreen::OnClearMapping(UI::EventParams ¶ms) {
|
||||
KeyMap::ClearAllMappings();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn ControlMappingScreen::OnDefaultMapping(UI::EventParams ¶ms) {
|
||||
KeyMap::RestoreDefault();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn ControlMappingScreen::OnAutoConfigure(UI::EventParams ¶ms) {
|
||||
std::vector<std::string> items;
|
||||
const auto seenPads = KeyMap::GetSeenPads();
|
||||
|
@ -311,12 +309,6 @@ UI::EventReturn ControlMappingScreen::OnAutoConfigure(UI::EventParams ¶ms) {
|
|||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn ControlMappingScreen::OnVisualizeMapping(UI::EventParams ¶ms) {
|
||||
VisualMappingScreen *visualMapping = new VisualMappingScreen(gamePath_);
|
||||
screenManager()->push(visualMapping);
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
void ControlMappingScreen::dialogFinished(const Screen *dialog, DialogResult result) {
|
||||
if (result == DR_OK && std::string(dialog->tag()) == "listpopup") {
|
||||
UI::ListPopupScreen *popup = (UI::ListPopupScreen *)dialog;
|
||||
|
|
|
@ -44,10 +44,7 @@ protected:
|
|||
void update() override;
|
||||
|
||||
private:
|
||||
UI::EventReturn OnDefaultMapping(UI::EventParams ¶ms);
|
||||
UI::EventReturn OnClearMapping(UI::EventParams ¶ms);
|
||||
UI::EventReturn OnAutoConfigure(UI::EventParams ¶ms);
|
||||
UI::EventReturn OnVisualizeMapping(UI::EventParams ¶ms);
|
||||
|
||||
void dialogFinished(const Screen *dialog, DialogResult result) override;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue