project_manager.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*************************************************************************/
  2. /* project_manager.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2021 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_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 ProjectDialog;
  39. class ProjectList;
  40. enum FilterOption {
  41. NAME,
  42. PATH,
  43. EDIT_DATE,
  44. };
  45. class ProjectManager : public Control {
  46. GDCLASS(ProjectManager, Control);
  47. TabContainer *tabs;
  48. ProjectList *_project_list;
  49. LineEdit *search_box;
  50. Label *loading_label;
  51. OptionButton *filter_option;
  52. Button *run_btn;
  53. Button *open_btn;
  54. Button *rename_btn;
  55. Button *erase_btn;
  56. Button *erase_missing_btn;
  57. Button *about_btn;
  58. EditorAssetLibrary *asset_library;
  59. FileDialog *scan_dir;
  60. ConfirmationDialog *language_restart_ask;
  61. ConfirmationDialog *erase_ask;
  62. Label *erase_ask_label;
  63. CheckBox *delete_project_contents;
  64. ConfirmationDialog *erase_missing_ask;
  65. ConfirmationDialog *multi_open_ask;
  66. ConfirmationDialog *multi_run_ask;
  67. ConfirmationDialog *multi_scan_ask;
  68. ConfirmationDialog *ask_update_settings;
  69. ConfirmationDialog *open_templates;
  70. EditorAbout *about;
  71. HBoxContainer *settings_hb;
  72. AcceptDialog *run_error_diag;
  73. AcceptDialog *dialog_error;
  74. ProjectDialog *npdialog;
  75. OptionButton *language_btn;
  76. LinkButton *version_btn;
  77. void _open_asset_library();
  78. void _scan_projects();
  79. void _run_project();
  80. void _run_project_confirm();
  81. void _open_selected_projects();
  82. void _open_selected_projects_ask();
  83. void _import_project();
  84. void _new_project();
  85. void _rename_project();
  86. void _erase_project();
  87. void _erase_missing_projects();
  88. void _erase_project_confirm();
  89. void _erase_missing_projects_confirm();
  90. void _show_about();
  91. void _update_project_buttons();
  92. void _language_selected(int p_id);
  93. void _restart_confirm();
  94. void _confirm_update_settings();
  95. void _nonempty_confirmation_ok_pressed();
  96. void _load_recent_projects();
  97. void _on_project_created(const String &dir);
  98. void _on_projects_updated();
  99. void _scan_multiple_folders(PackedStringArray p_files);
  100. void _scan_begin(const String &p_base);
  101. void _scan_dir(const String &path, List<String> *r_projects);
  102. void _install_project(const String &p_zip_path, const String &p_title);
  103. void _dim_window();
  104. virtual void unhandled_key_input(const Ref<InputEvent> &p_ev) override;
  105. void _files_dropped(PackedStringArray p_files, int p_screen);
  106. void _version_button_pressed();
  107. void _on_order_option_changed(int p_idx);
  108. void _on_tab_changed(int p_tab);
  109. void _on_search_term_changed(const String &p_term);
  110. protected:
  111. void _notification(int p_what);
  112. static void _bind_methods();
  113. public:
  114. ProjectManager();
  115. ~ProjectManager();
  116. };
  117. #endif // PROJECT_MANAGER_H