mono_bottom_panel.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*************************************************************************/
  2. /* mono_bottom_panel.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 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 MONO_BOTTOM_PANEL_H
  31. #define MONO_BOTTOM_PANEL_H
  32. #include "editor/editor_node.h"
  33. #include "scene/gui/control.h"
  34. #include "mono_build_info.h"
  35. class MonoBuildTab;
  36. class MonoBottomPanel : public VBoxContainer {
  37. GDCLASS(MonoBottomPanel, VBoxContainer)
  38. EditorNode *editor;
  39. TabContainer *panel_tabs;
  40. VBoxContainer *panel_builds_tab;
  41. ItemList *build_tabs_list;
  42. TabContainer *build_tabs;
  43. Button *warnings_btn;
  44. Button *errors_btn;
  45. Button *view_log_btn;
  46. void _update_build_tabs_list();
  47. void _build_tabs_item_selected(int p_idx);
  48. void _build_tabs_nothing_selected();
  49. void _warnings_toggled(bool p_pressed);
  50. void _errors_toggled(bool p_pressed);
  51. void _build_project_pressed();
  52. void _view_log_pressed();
  53. static MonoBottomPanel *singleton;
  54. protected:
  55. void _notification(int p_what);
  56. static void _bind_methods();
  57. public:
  58. _FORCE_INLINE_ static MonoBottomPanel *get_singleton() { return singleton; }
  59. void add_build_tab(MonoBuildTab *p_build_tab);
  60. void raise_build_tab(MonoBuildTab *p_build_tab);
  61. void show_build_tab();
  62. MonoBottomPanel(EditorNode *p_editor = NULL);
  63. ~MonoBottomPanel();
  64. };
  65. class MonoBuildTab : public VBoxContainer {
  66. GDCLASS(MonoBuildTab, VBoxContainer)
  67. public:
  68. enum BuildResult {
  69. RESULT_ERROR,
  70. RESULT_SUCCESS
  71. };
  72. struct BuildIssue {
  73. bool warning;
  74. String file;
  75. int line;
  76. int column;
  77. String code;
  78. String message;
  79. String project_file;
  80. };
  81. private:
  82. friend class MonoBottomPanel;
  83. bool build_exited;
  84. BuildResult build_result;
  85. Vector<BuildIssue> issues;
  86. ItemList *issues_list;
  87. int error_count;
  88. int warning_count;
  89. bool errors_visible;
  90. bool warnings_visible;
  91. String logs_dir;
  92. MonoBuildInfo build_info;
  93. void _load_issues_from_file(const String &p_csv_file);
  94. void _update_issues_list();
  95. void _issue_activated(int p_idx);
  96. protected:
  97. static void _bind_methods();
  98. public:
  99. Ref<Texture> get_icon_texture() const;
  100. MonoBuildInfo get_build_info();
  101. void on_build_start();
  102. void on_build_exit(BuildResult result);
  103. void on_build_exec_failed(const String &p_cause);
  104. void restart_build();
  105. void stop_build();
  106. MonoBuildTab(const MonoBuildInfo &p_build_info, const String &p_logs_dir);
  107. };
  108. #endif // MONO_BOTTOM_PANEL_H