editor_vcs_interface.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*************************************************************************/
  2. /* editor_vcs_interface.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 EDITOR_VCS_INTERFACE_H
  31. #define EDITOR_VCS_INTERFACE_H
  32. #include "core/object/class_db.h"
  33. #include "core/string/ustring.h"
  34. #include "scene/gui/panel_container.h"
  35. class EditorVCSInterface : public Object {
  36. GDCLASS(EditorVCSInterface, Object)
  37. bool is_initialized;
  38. protected:
  39. static EditorVCSInterface *singleton;
  40. static void _bind_methods();
  41. // Implemented by addons as end points for the proxy functions
  42. bool _initialize(String p_project_root_path);
  43. bool _is_vcs_initialized();
  44. Dictionary _get_modified_files_data();
  45. void _stage_file(String p_file_path);
  46. void _unstage_file(String p_file_path);
  47. void _commit(String p_msg);
  48. Array _get_file_diff(String p_file_path);
  49. bool _shut_down();
  50. String _get_project_name();
  51. String _get_vcs_name();
  52. public:
  53. static EditorVCSInterface *get_singleton();
  54. static void set_singleton(EditorVCSInterface *p_singleton);
  55. bool is_addon_ready();
  56. // Proxy functions to the editor for use
  57. bool initialize(String p_project_root_path);
  58. bool is_vcs_initialized();
  59. Dictionary get_modified_files_data();
  60. void stage_file(String p_file_path);
  61. void unstage_file(String p_file_path);
  62. void commit(String p_msg);
  63. Array get_file_diff(String p_file_path);
  64. bool shut_down();
  65. String get_project_name();
  66. String get_vcs_name();
  67. EditorVCSInterface();
  68. virtual ~EditorVCSInterface();
  69. };
  70. #endif // !EDITOR_VCS_INTERFACE_H