project_settings.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*************************************************************************/
  2. /* project_settings.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2020 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 "editor_autoload_settings.h"
  33. #include "editor_data.h"
  34. #include "editor_plugin_settings.h"
  35. #include "property_editor.h"
  36. #include "scene/gui/dialogs.h"
  37. #include "scene/gui/tab_container.h"
  38. #include "undo_redo.h"
  39. //#include "project_export_settings.h"
  40. class ProjectSettings : public AcceptDialog {
  41. OBJ_TYPE(ProjectSettings, AcceptDialog);
  42. TabContainer *tab_container;
  43. Timer *timer;
  44. InputEvent::Type add_type;
  45. String add_at;
  46. EditorData *data;
  47. UndoRedo *undo_redo;
  48. SectionedPropertyEditor *globals_editor;
  49. HBoxContainer *search_bar;
  50. ToolButton *search_button;
  51. LineEdit *search_box;
  52. ToolButton *clear_button;
  53. HBoxContainer *add_prop_bar;
  54. ConfirmationDialog *message;
  55. LineEdit *category;
  56. LineEdit *property;
  57. OptionButton *type;
  58. PopupMenu *popup_add;
  59. ConfirmationDialog *press_a_key;
  60. Label *press_a_key_label;
  61. ConfirmationDialog *device_input;
  62. SpinBox *device_id;
  63. OptionButton *device_index;
  64. Label *device_index_label;
  65. MenuButton *popup_platform;
  66. LineEdit *action_name;
  67. Tree *input_editor;
  68. bool setting;
  69. bool updating_translations;
  70. InputEvent last_wait_for_key;
  71. EditorFileDialog *translation_file_open;
  72. Tree *translation_list;
  73. Button *translation_res_option_add_button;
  74. EditorFileDialog *translation_res_file_open;
  75. EditorFileDialog *translation_res_option_file_open;
  76. Tree *translation_remap;
  77. Tree *translation_remap_options;
  78. EditorAutoloadSettings *autoload_settings;
  79. EditorPluginSettings *plugin_settings;
  80. void _item_selected();
  81. void _item_adds(String);
  82. void _item_add();
  83. void _item_del();
  84. void _update_actions();
  85. void _save();
  86. void _add_item(int p_item);
  87. void _action_adds(String);
  88. void _action_add();
  89. void _device_input_add();
  90. void _item_checked(const String &p_item, bool p_check);
  91. void _action_selected();
  92. void _action_edited();
  93. void _action_button_pressed(Object *p_obj, int p_column, int p_id);
  94. void _wait_for_key(const InputEvent &p_event);
  95. void _press_a_key_confirm();
  96. void _show_last_added(const InputEvent &p_event, const String &p_name);
  97. void _settings_prop_edited(const String &p_name);
  98. void _settings_changed();
  99. //ProjectExportSettings *export_settings;
  100. void _copy_to_platform(int p_which);
  101. void _translation_file_open();
  102. void _translation_add(const String &p_path);
  103. void _translation_delete(Object *p_item, int p_column, int p_button);
  104. void _update_translations();
  105. void _translation_res_file_open();
  106. void _translation_res_add(const String &p_path);
  107. void _translation_res_delete(Object *p_item, int p_column, int p_button);
  108. void _translation_res_select();
  109. void _translation_res_option_file_open();
  110. void _translation_res_option_add(const String &p_path);
  111. void _translation_res_option_changed();
  112. void _translation_res_option_delete(Object *p_item, int p_column, int p_button);
  113. void _toggle_search_bar(bool p_pressed);
  114. void _clear_search_box();
  115. ProjectSettings();
  116. static ProjectSettings *singleton;
  117. protected:
  118. void _notification(int p_what);
  119. static void _bind_methods();
  120. public:
  121. void add_translation(const String &p_translation);
  122. static ProjectSettings *get_singleton() { return singleton; }
  123. void popup_project_settings();
  124. void set_plugins_page();
  125. void queue_save();
  126. ProjectSettings(EditorData *p_data);
  127. };
  128. #endif // PROJECT_SETTINGS_H