project_settings_editor.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /**************************************************************************/
  2. /* project_settings_editor.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef PROJECT_SETTINGS_EDITOR_H
  31. #define PROJECT_SETTINGS_EDITOR_H
  32. #include "core/undo_redo.h"
  33. #include "editor/editor_autoload_settings.h"
  34. #include "editor/editor_data.h"
  35. #include "editor/editor_locale_dialog.h"
  36. #include "editor/editor_plugin_settings.h"
  37. #include "editor/editor_sectioned_inspector.h"
  38. #include "editor/import_defaults_editor.h"
  39. #include "scene/gui/dialogs.h"
  40. #include "scene/gui/tab_container.h"
  41. class ProjectSettingsEditor : public AcceptDialog {
  42. GDCLASS(ProjectSettingsEditor, AcceptDialog);
  43. enum InputType {
  44. INPUT_KEY_PHYSICAL,
  45. INPUT_KEY,
  46. INPUT_JOY_BUTTON,
  47. INPUT_JOY_MOTION,
  48. INPUT_MOUSE_BUTTON
  49. };
  50. TabContainer *tab_container;
  51. VBoxContainer *general_editor;
  52. Timer *timer;
  53. InputType add_type;
  54. String add_at;
  55. int edit_idx;
  56. EditorData *data;
  57. UndoRedo *undo_redo;
  58. SectionedInspector *globals_editor;
  59. HBoxContainer *search_bar;
  60. Button *search_button;
  61. LineEdit *search_box;
  62. HBoxContainer *add_prop_bar;
  63. AcceptDialog *message;
  64. LineEdit *property;
  65. OptionButton *type_box;
  66. PopupMenu *popup_add;
  67. ConfirmationDialog *press_a_key;
  68. bool press_a_key_physical;
  69. Label *press_a_key_label;
  70. ConfirmationDialog *device_input;
  71. OptionButton *device_id;
  72. OptionButton *device_index;
  73. Label *device_index_label;
  74. MenuButton *popup_copy_to_feature;
  75. LineEdit *action_name;
  76. Button *action_add;
  77. CheckButton *show_builtin_actions_checkbutton;
  78. Tree *input_editor;
  79. bool setting;
  80. bool updating_translations;
  81. bool show_builtin_actions;
  82. Ref<InputEventKey> last_wait_for_key;
  83. EditorLocaleDialog *locale_select;
  84. EditorFileDialog *translation_file_open;
  85. Tree *translation_list;
  86. Button *translation_res_option_add_button;
  87. EditorFileDialog *translation_res_file_open;
  88. EditorFileDialog *translation_res_option_file_open;
  89. Tree *translation_remap;
  90. Tree *translation_remap_options;
  91. EditorAutoloadSettings *autoload_settings;
  92. EditorPluginSettings *plugin_settings;
  93. void _item_selected(const String &);
  94. void _item_adds(String);
  95. void _item_add();
  96. void _item_del();
  97. void _update_actions();
  98. void _save();
  99. void _add_item(int p_item, Ref<InputEvent> p_exiting_event = nullptr);
  100. void _edit_item(Ref<InputEvent> p_exiting_event);
  101. void _action_check(String p_action);
  102. void _action_adds(String);
  103. void _action_add();
  104. void _device_input_add();
  105. void _set_show_builtin_actions(bool p_show);
  106. void _item_checked(const String &p_item, bool p_check);
  107. void _action_selected();
  108. void _action_edited();
  109. void _action_activated();
  110. void _action_button_pressed(Object *p_obj, int p_column, int p_id);
  111. void _wait_for_key(const Ref<InputEvent> &p_event);
  112. void _press_a_key_confirm();
  113. void _show_last_added(const Ref<InputEvent> &p_event, const String &p_name);
  114. void _settings_prop_edited(const String &p_name);
  115. void _settings_changed();
  116. void _copy_to_platform(int p_which);
  117. void _translation_file_open();
  118. void _translation_add(const PoolStringArray &p_paths);
  119. void _translation_delete(Object *p_item, int p_column, int p_button);
  120. void _update_translations();
  121. void _translation_res_file_open();
  122. void _translation_res_add(const PoolStringArray &p_paths);
  123. void _translation_res_delete(Object *p_item, int p_column, int p_button);
  124. void _translation_res_select();
  125. void _translation_res_option_file_open();
  126. void _translation_res_option_add(const PoolStringArray &p_paths);
  127. void _translation_res_option_changed();
  128. void _translation_res_option_delete(Object *p_item, int p_column, int p_button);
  129. void _translation_res_option_popup(bool p_arrow_clicked);
  130. void _translation_res_option_selected(const String &p_locale);
  131. void _toggle_search_bar(bool p_pressed);
  132. Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
  133. bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
  134. void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
  135. void _copy_to_platform_about_to_show();
  136. static ProjectSettingsEditor *singleton;
  137. Label *restart_label;
  138. TextureRect *restart_icon;
  139. PanelContainer *restart_container;
  140. ToolButton *restart_close_button;
  141. ImportDefaultsEditor *import_defaults_editor;
  142. void _editor_restart_request();
  143. void _editor_restart();
  144. void _editor_restart_close();
  145. void _update_theme();
  146. protected:
  147. void _unhandled_input(const Ref<InputEvent> &p_event);
  148. void _notification(int p_what);
  149. static void _bind_methods();
  150. int _get_current_device();
  151. void _set_current_device(int i_device);
  152. String _get_device_string(int i_device);
  153. public:
  154. void add_translation(const String &p_translation);
  155. static ProjectSettingsEditor *get_singleton() { return singleton; }
  156. void popup_project_settings();
  157. void set_plugins_page();
  158. void set_general_page(const String &p_category);
  159. void update_plugins();
  160. EditorAutoloadSettings *get_autoload_settings() { return autoload_settings; }
  161. TabContainer *get_tabs();
  162. void queue_save();
  163. ProjectSettingsEditor(EditorData *p_data);
  164. };
  165. #endif // PROJECT_SETTINGS_EDITOR_H