project_manager.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /**************************************************************************/
  2. /* project_manager.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_MANAGER_H
  31. #define PROJECT_MANAGER_H
  32. #include "editor/editor_about.h"
  33. #include "editor/plugins/asset_library_editor_plugin.h"
  34. #include "scene/gui/dialogs.h"
  35. #include "scene/gui/file_dialog.h"
  36. #include "scene/gui/scroll_container.h"
  37. #include "scene/gui/tree.h"
  38. class CheckBox;
  39. class ProjectDialog;
  40. class ProjectList;
  41. enum FilterOption {
  42. EDIT_DATE,
  43. NAME,
  44. PATH,
  45. };
  46. class ProjectManager : public Control {
  47. GDCLASS(ProjectManager, Control);
  48. HashMap<String, Ref<Texture2D>> icon_type_cache;
  49. void _build_icon_type_cache(Ref<Theme> p_theme);
  50. static ProjectManager *singleton;
  51. TabContainer *tabs = nullptr;
  52. ProjectList *_project_list = nullptr;
  53. LineEdit *search_box = nullptr;
  54. Label *loading_label = nullptr;
  55. OptionButton *filter_option = nullptr;
  56. Button *create_btn = nullptr;
  57. Button *import_btn = nullptr;
  58. Button *scan_btn = nullptr;
  59. Button *open_btn = nullptr;
  60. Button *run_btn = nullptr;
  61. Button *rename_btn = nullptr;
  62. Button *erase_btn = nullptr;
  63. Button *erase_missing_btn = nullptr;
  64. Button *about_btn = nullptr;
  65. HBoxContainer *local_projects_hb = nullptr;
  66. EditorAssetLibrary *asset_library = nullptr;
  67. EditorFileDialog *scan_dir = nullptr;
  68. ConfirmationDialog *language_restart_ask = nullptr;
  69. ConfirmationDialog *erase_ask = nullptr;
  70. Label *erase_ask_label = nullptr;
  71. CheckBox *delete_project_contents = nullptr;
  72. ConfirmationDialog *erase_missing_ask = nullptr;
  73. ConfirmationDialog *multi_open_ask = nullptr;
  74. ConfirmationDialog *multi_run_ask = nullptr;
  75. ConfirmationDialog *multi_scan_ask = nullptr;
  76. ConfirmationDialog *ask_full_convert_dialog = nullptr;
  77. ConfirmationDialog *ask_update_settings = nullptr;
  78. ConfirmationDialog *open_templates = nullptr;
  79. EditorAbout *about = nullptr;
  80. HBoxContainer *settings_hb = nullptr;
  81. AcceptDialog *run_error_diag = nullptr;
  82. AcceptDialog *dialog_error = nullptr;
  83. ProjectDialog *npdialog = nullptr;
  84. Button *full_convert_button = nullptr;
  85. OptionButton *language_btn = nullptr;
  86. LinkButton *version_btn = nullptr;
  87. void _open_asset_library();
  88. void _scan_projects();
  89. void _run_project();
  90. void _run_project_confirm();
  91. void _open_selected_projects();
  92. void _open_selected_projects_ask();
  93. void _full_convert_button_pressed();
  94. void _perform_full_project_conversion();
  95. void _import_project();
  96. void _new_project();
  97. void _rename_project();
  98. void _erase_project();
  99. void _erase_missing_projects();
  100. void _erase_project_confirm();
  101. void _erase_missing_projects_confirm();
  102. void _show_about();
  103. void _update_project_buttons();
  104. void _language_selected(int p_id);
  105. void _restart_confirm();
  106. void _confirm_update_settings();
  107. void _nonempty_confirmation_ok_pressed();
  108. void _load_recent_projects();
  109. void _on_project_created(const String &dir);
  110. void _on_projects_updated();
  111. void _scan_multiple_folders(PackedStringArray p_files);
  112. void _scan_begin(const String &p_base);
  113. void _scan_dir(const String &path);
  114. void _install_project(const String &p_zip_path, const String &p_title);
  115. void _dim_window();
  116. virtual void shortcut_input(const Ref<InputEvent> &p_ev) override;
  117. void _files_dropped(PackedStringArray p_files);
  118. void _version_button_pressed();
  119. void _on_order_option_changed(int p_idx);
  120. void _on_tab_changed(int p_tab);
  121. void _on_search_term_changed(const String &p_term);
  122. static Ref<Texture2D> _file_dialog_get_icon(const String &p_path);
  123. static Ref<Texture2D> _file_dialog_get_thumbnail(const String &p_path);
  124. protected:
  125. void _notification(int p_what);
  126. static void _bind_methods();
  127. public:
  128. static ProjectManager *get_singleton() { return singleton; }
  129. ProjectManager();
  130. ~ProjectManager();
  131. };
  132. #endif // PROJECT_MANAGER_H