localization_editor.h 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*************************************************************************/
  2. /* localization_editor.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2022 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 LOCALIZATION_EDITOR_H
  31. #define LOCALIZATION_EDITOR_H
  32. #include "core/object/undo_redo.h"
  33. #include "editor/editor_locale_dialog.h"
  34. #include "scene/gui/tree.h"
  35. class EditorFileDialog;
  36. class LocalizationEditor : public VBoxContainer {
  37. GDCLASS(LocalizationEditor, VBoxContainer);
  38. Tree *translation_list = nullptr;
  39. EditorLocaleDialog *locale_select = nullptr;
  40. EditorFileDialog *translation_file_open = nullptr;
  41. Button *translation_res_option_add_button = nullptr;
  42. EditorFileDialog *translation_res_file_open_dialog = nullptr;
  43. EditorFileDialog *translation_res_option_file_open_dialog = nullptr;
  44. Tree *translation_remap = nullptr;
  45. Tree *translation_remap_options = nullptr;
  46. Tree *translation_pot_list = nullptr;
  47. EditorFileDialog *pot_file_open_dialog = nullptr;
  48. EditorFileDialog *pot_generate_dialog = nullptr;
  49. UndoRedo *undo_redo = nullptr;
  50. bool updating_translations = false;
  51. String localization_changed;
  52. void _translation_file_open();
  53. void _translation_add(const PackedStringArray &p_paths);
  54. void _translation_delete(Object *p_item, int p_column, int p_button);
  55. void _translation_res_file_open();
  56. void _translation_res_add(const PackedStringArray &p_paths);
  57. void _translation_res_delete(Object *p_item, int p_column, int p_button);
  58. void _translation_res_select();
  59. void _translation_res_option_file_open();
  60. void _translation_res_option_add(const PackedStringArray &p_paths);
  61. void _translation_res_option_changed();
  62. void _translation_res_option_delete(Object *p_item, int p_column, int p_button);
  63. void _translation_res_option_popup(bool p_arrow_clicked);
  64. void _translation_res_option_selected(const String &p_locale);
  65. void _pot_add(const PackedStringArray &p_paths);
  66. void _pot_delete(Object *p_item, int p_column, int p_button);
  67. void _pot_file_open();
  68. void _pot_generate_open();
  69. void _pot_generate(const String &p_file);
  70. void _update_pot_file_extensions();
  71. protected:
  72. void _notification(int p_what);
  73. static void _bind_methods();
  74. public:
  75. void add_translation(const String &p_translation);
  76. void update_translations();
  77. LocalizationEditor();
  78. };
  79. #endif // LOCALIZATION_EDITOR_H