project_settings_editor.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*************************************************************************/
  2. /* project_settings_editor.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  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_H
  31. #define PROJECT_SETTINGS_H
  32. #include "core/undo_redo.h"
  33. #include "editor/editor_autoload_settings.h"
  34. #include "editor/editor_data.h"
  35. #include "editor/editor_plugin_settings.h"
  36. #include "editor/editor_sectioned_inspector.h"
  37. #include "scene/gui/dialogs.h"
  38. #include "scene/gui/tab_container.h"
  39. class ProjectSettingsEditor : public AcceptDialog {
  40. GDCLASS(ProjectSettingsEditor, AcceptDialog);
  41. enum InputType {
  42. INPUT_KEY,
  43. INPUT_JOY_BUTTON,
  44. INPUT_JOY_MOTION,
  45. INPUT_MOUSE_BUTTON
  46. };
  47. enum LocaleFilter {
  48. SHOW_ALL_LOCALES,
  49. SHOW_ONLY_SELECTED_LOCALES,
  50. };
  51. TabContainer *tab_container;
  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 *category;
  65. LineEdit *property;
  66. OptionButton *type;
  67. PopupMenu *popup_add;
  68. ConfirmationDialog *press_a_key;
  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. Label *action_add_error;
  78. Tree *input_editor;
  79. bool setting;
  80. bool updating_translations;
  81. Ref<InputEventKey> last_wait_for_key;
  82. EditorFileDialog *translation_file_open;
  83. Tree *translation_list;
  84. Button *translation_res_option_add_button;
  85. EditorFileDialog *translation_res_file_open;
  86. EditorFileDialog *translation_res_option_file_open;
  87. Tree *translation_remap;
  88. Tree *translation_remap_options;
  89. Tree *translation_filter;
  90. bool translation_locales_list_created;
  91. OptionButton *translation_locale_filter_mode;
  92. Vector<TreeItem *> translation_filter_treeitems;
  93. Vector<int> translation_locales_idxs_remap;
  94. EditorAutoloadSettings *autoload_settings;
  95. EditorPluginSettings *plugin_settings;
  96. void _item_selected(const String &);
  97. void _item_adds(String);
  98. void _item_add();
  99. void _item_del();
  100. void _update_actions();
  101. void _save();
  102. void _add_item(int p_item, Ref<InputEvent> p_exiting_event = NULL);
  103. void _edit_item(Ref<InputEvent> p_exiting_event);
  104. void _action_check(String p_action);
  105. void _action_adds(String);
  106. void _action_add();
  107. void _device_input_add();
  108. void _item_checked(const String &p_item, bool p_check);
  109. void _action_selected();
  110. void _action_edited();
  111. void _action_activated();
  112. void _action_button_pressed(Object *p_obj, int p_column, int p_id);
  113. void _wait_for_key(const Ref<InputEvent> &p_event);
  114. void _press_a_key_confirm();
  115. void _show_last_added(const Ref<InputEvent> &p_event, const String &p_name);
  116. void _settings_prop_edited(const String &p_name);
  117. void _settings_changed();
  118. void _copy_to_platform(int p_which);
  119. void _translation_file_open();
  120. void _translation_add(const String &p_path);
  121. void _translation_delete(Object *p_item, int p_column, int p_button);
  122. void _update_translations();
  123. void _translation_res_file_open();
  124. void _translation_res_add(const String &p_path);
  125. void _translation_res_delete(Object *p_item, int p_column, int p_button);
  126. void _translation_res_select();
  127. void _translation_res_option_file_open();
  128. void _translation_res_option_add(const String &p_path);
  129. void _translation_res_option_changed();
  130. void _translation_res_option_delete(Object *p_item, int p_column, int p_button);
  131. void _translation_filter_option_changed();
  132. void _translation_filter_mode_changed(int p_mode);
  133. void _toggle_search_bar(bool p_pressed);
  134. void _copy_to_platform_about_to_show();
  135. ProjectSettingsEditor();
  136. static ProjectSettingsEditor *singleton;
  137. Label *restart_label;
  138. TextureRect *restart_icon;
  139. PanelContainer *restart_container;
  140. ToolButton *restart_close_button;
  141. void _editor_restart_request();
  142. void _editor_restart();
  143. void _editor_restart_close();
  144. protected:
  145. void _notification(int p_what);
  146. static void _bind_methods();
  147. int _get_current_device();
  148. void _set_current_device(int i_device);
  149. String _get_device_string(int i_device);
  150. public:
  151. void add_translation(const String &p_translation);
  152. static ProjectSettingsEditor *get_singleton() { return singleton; }
  153. void popup_project_settings();
  154. void set_plugins_page();
  155. void update_plugins();
  156. EditorAutoloadSettings *get_autoload_settings() { return autoload_settings; }
  157. TabContainer *get_tabs();
  158. void queue_save();
  159. ProjectSettingsEditor(EditorData *p_data);
  160. };
  161. #endif // PROJECT_SETTINGS_H