project_settings_editor.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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-2017 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2017 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/property_editor.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. SectionedPropertyEditor *globals_editor;
  59. HBoxContainer *search_bar;
  60. ToolButton *search_button;
  61. LineEdit *search_box;
  62. ToolButton *clear_button;
  63. HBoxContainer *add_prop_bar;
  64. AcceptDialog *message;
  65. LineEdit *category;
  66. LineEdit *property;
  67. OptionButton *type;
  68. PopupMenu *popup_add;
  69. ConfirmationDialog *press_a_key;
  70. Label *press_a_key_label;
  71. ConfirmationDialog *device_input;
  72. SpinBox *device_id;
  73. OptionButton *device_index;
  74. Label *device_index_label;
  75. MenuButton *popup_copy_to_feature;
  76. LineEdit *action_name;
  77. Button *action_add;
  78. Label *action_add_error;
  79. Tree *input_editor;
  80. bool setting;
  81. bool updating_translations;
  82. Ref<InputEventKey> last_wait_for_key;
  83. EditorFileDialog *translation_file_open;
  84. Tree *translation_list;
  85. Button *translation_res_option_add_button;
  86. EditorFileDialog *translation_res_file_open;
  87. EditorFileDialog *translation_res_option_file_open;
  88. Tree *translation_remap;
  89. Tree *translation_remap_options;
  90. Tree *translation_filter;
  91. bool translation_locales_list_created;
  92. OptionButton *translation_locale_filter_mode;
  93. Vector<TreeItem *> translation_filter_treeitems;
  94. Vector<int> translation_locales_idxs_remap;
  95. EditorAutoloadSettings *autoload_settings;
  96. EditorPluginSettings *plugin_settings;
  97. void _item_selected();
  98. void _item_adds(String);
  99. void _item_add();
  100. void _item_del();
  101. void _update_actions();
  102. void _save();
  103. void _add_item(int p_item, Ref<InputEvent> p_exiting_event = NULL);
  104. void _edit_item(Ref<InputEvent> p_exiting_event);
  105. void _action_check(String p_action);
  106. void _action_adds(String);
  107. void _action_add();
  108. void _device_input_add();
  109. void _item_checked(const String &p_item, bool p_check);
  110. void _action_selected();
  111. void _action_edited();
  112. void _action_activated();
  113. void _action_button_pressed(Object *p_obj, int p_column, int p_id);
  114. void _wait_for_key(const Ref<InputEvent> &p_event);
  115. void _press_a_key_confirm();
  116. void _show_last_added(const Ref<InputEvent> &p_event, const String &p_name);
  117. void _settings_prop_edited(const String &p_name);
  118. void _settings_changed();
  119. void _copy_to_platform(int p_which);
  120. void _translation_file_open();
  121. void _translation_add(const String &p_path);
  122. void _translation_delete(Object *p_item, int p_column, int p_button);
  123. void _update_translations();
  124. void _translation_res_file_open();
  125. void _translation_res_add(const String &p_path);
  126. void _translation_res_delete(Object *p_item, int p_column, int p_button);
  127. void _translation_res_select();
  128. void _translation_res_option_file_open();
  129. void _translation_res_option_add(const String &p_path);
  130. void _translation_res_option_changed();
  131. void _translation_res_option_delete(Object *p_item, int p_column, int p_button);
  132. void _translation_filter_option_changed();
  133. void _translation_filter_mode_changed(int p_mode);
  134. void _toggle_search_bar(bool p_pressed);
  135. void _clear_search_box();
  136. void _copy_to_platform_about_to_show();
  137. ProjectSettingsEditor();
  138. static ProjectSettingsEditor *singleton;
  139. protected:
  140. void _notification(int p_what);
  141. static void _bind_methods();
  142. public:
  143. void add_translation(const String &p_translation);
  144. static ProjectSettingsEditor *get_singleton() { return singleton; }
  145. void popup_project_settings();
  146. void set_plugins_page();
  147. TabContainer *get_tabs();
  148. void queue_save();
  149. ProjectSettingsEditor(EditorData *p_data);
  150. };
  151. #endif // PROJECT_SETTINGS_H