diff options
Diffstat (limited to 'editor/editor_settings_dialog.cpp')
-rw-r--r-- | editor/editor_settings_dialog.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp index 285b909b66..fd578bd365 100644 --- a/editor/editor_settings_dialog.cpp +++ b/editor/editor_settings_dialog.cpp @@ -92,7 +92,7 @@ void EditorSettingsDialog::popup_edit_settings() { search_box->grab_focus(); _update_shortcuts(); - set_process_unhandled_input(true); + set_process_shortcut_input(true); // Restore valid window bounds or pop up at default size. Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "editor_settings", Rect2()); @@ -119,7 +119,7 @@ void EditorSettingsDialog::_notification(int p_what) { case NOTIFICATION_VISIBILITY_CHANGED: { if (!is_visible()) { EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "editor_settings", Rect2(get_position(), get_size())); - set_process_unhandled_input(false); + set_process_shortcut_input(false); } } break; @@ -148,7 +148,7 @@ void EditorSettingsDialog::_notification(int p_what) { } } -void EditorSettingsDialog::unhandled_input(const Ref<InputEvent> &p_event) { +void EditorSettingsDialog::shortcut_input(const Ref<InputEvent> &p_event) { ERR_FAIL_COND(p_event.is_null()); const Ref<InputEventKey> k = p_event; @@ -248,11 +248,11 @@ void EditorSettingsDialog::_update_shortcut_events(const String &p_path, const A undo_redo->commit_action(); } -Array EditorSettingsDialog::_event_list_to_array_helper(List<Ref<InputEvent>> &p_events) { +Array EditorSettingsDialog::_event_list_to_array_helper(const List<Ref<InputEvent>> &p_events) { Array events; // Convert the list to an array, and only keep key events as this is for the editor. - for (List<Ref<InputEvent>>::Element *E = p_events.front(); E; E = E->next()) { + for (const List<Ref<InputEvent>>::Element *E = p_events.front(); E; E = E->next()) { Ref<InputEventKey> k = E->get(); if (k.is_valid()) { events.append(E->get()); @@ -327,7 +327,7 @@ void EditorSettingsDialog::_create_shortcut_treeitem(TreeItem *p_parent, const S void EditorSettingsDialog::_update_shortcuts() { // Before clearing the tree, take note of which categories are collapsed so that this state can be maintained when the tree is repopulated. - Map<String, bool> collapsed; + HashMap<String, bool> collapsed; if (shortcuts->get_root() && shortcuts->get_root()->get_first_child()) { TreeItem *ti = shortcuts->get_root()->get_first_child(); @@ -359,7 +359,7 @@ void EditorSettingsDialog::_update_shortcuts() { shortcuts->clear(); TreeItem *root = shortcuts->create_item(); - Map<String, TreeItem *> sections; + HashMap<String, TreeItem *> sections; // Set up section for Common/Built-in actions TreeItem *common_section = shortcuts->create_item(root); @@ -374,10 +374,9 @@ void EditorSettingsDialog::_update_shortcuts() { common_section->set_custom_bg_color(1, shortcuts->get_theme_color(SNAME("prop_subsection"), SNAME("Editor"))); // Get the action map for the editor, and add each item to the "Common" section. - OrderedHashMap<StringName, InputMap::Action> action_map = InputMap::get_singleton()->get_action_map(); - for (OrderedHashMap<StringName, InputMap::Action>::Element E = action_map.front(); E; E = E.next()) { - String action_name = E.key(); - InputMap::Action action = E.get(); + for (const KeyValue<StringName, InputMap::Action> &E : InputMap::get_singleton()->get_action_map()) { + const String &action_name = E.key; + const InputMap::Action &action = E.value; Array events; // Need to get the list of events into an array so it can be set as metadata on the item. Vector<String> event_strings; @@ -387,10 +386,10 @@ void EditorSettingsDialog::_update_shortcuts() { continue; } - List<Ref<InputEvent>> all_default_events = InputMap::get_singleton()->get_builtins_with_feature_overrides_applied().find(action_name).value(); + const List<Ref<InputEvent>> &all_default_events = InputMap::get_singleton()->get_builtins_with_feature_overrides_applied().find(action_name)->value; List<Ref<InputEventKey>> key_default_events; // Remove all non-key events from the defaults. Only check keys, since we are in the editor. - for (List<Ref<InputEvent>>::Element *I = all_default_events.front(); I; I = I->next()) { + for (const List<Ref<InputEvent>>::Element *I = all_default_events.front(); I; I = I->next()) { Ref<InputEventKey> k = I->get(); if (k.is_valid()) { key_default_events.push_back(k); @@ -576,7 +575,7 @@ Variant EditorSettingsDialog::get_drag_data_fw(const Point2 &p_point, Control *p TreeItem *selected = shortcuts->get_selected(); // Only allow drag for events - if (!selected || !selected->has_meta("type") || selected->get_meta("type") != "event") { + if (!selected || (String)selected->get_meta("type", "") != "event") { return Variant(); } @@ -593,7 +592,7 @@ Variant EditorSettingsDialog::get_drag_data_fw(const Point2 &p_point, Control *p bool EditorSettingsDialog::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { TreeItem *selected = shortcuts->get_selected(); TreeItem *item = shortcuts->get_item_at_position(p_point); - if (!selected || !item || item == selected || !item->has_meta("type") || item->get_meta("type") != "event") { + if (!selected || !item || item == selected || (String)item->get_meta("type", "") != "event") { return false; } |