Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

VCS: Push VCS UI into VCS plugins #70417

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6698,7 +6698,7 @@ EditorNode::EditorNode() {
project_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/project_settings", TTR("Project Settings..."), Key::NONE, TTR("Project Settings")), RUN_SETTINGS);
project_menu->connect("id_pressed", callable_mp(this, &EditorNode::_menu_option));

vcs_actions_menu = VersionControlEditorPlugin::get_singleton()->get_version_control_actions_panel();
vcs_actions_menu = memnew(PopupMenu);
vcs_actions_menu->set_name("Version Control");
vcs_actions_menu->connect("index_pressed", callable_mp(this, &EditorNode::_version_control_menu_option));
project_menu->add_separator();
Expand Down
15 changes: 15 additions & 0 deletions editor/editor_vcs_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ void EditorVCSInterface::popup_error(String p_msg) {
EditorNode::get_singleton()->show_warning(p_msg.strip_edges(), vformat(TTR("%s Error"), get_vcs_name()));
}

void EditorVCSInterface::attach_ui(EditorPlugin *p_vcs_editor_plugin) {
if (!GDVIRTUAL_CALL(_attach_ui, p_vcs_editor_plugin)) {
UNIMPLEMENTED();
}
}

void EditorVCSInterface::remove_ui(EditorPlugin *p_vcs_editor_plugin) {
if (!GDVIRTUAL_CALL(_remove_ui, p_vcs_editor_plugin)) {
UNIMPLEMENTED();
}
}

bool EditorVCSInterface::initialize(String p_project_path) {
bool result = false;
if (!GDVIRTUAL_CALL(_initialize, p_project_path, result)) {
Expand Down Expand Up @@ -351,6 +363,9 @@ EditorVCSInterface::StatusFile EditorVCSInterface::_convert_status_file(Dictiona
}

void EditorVCSInterface::_bind_methods() {
GDVIRTUAL_BIND(_attach_ui, "vcs_editor_plugin");
GDVIRTUAL_BIND(_remove_ui, "vcs_editor_plugin");

// Proxy end points that implement the VCS specific operations that the editor demands.
GDVIRTUAL_BIND(_initialize, "project_path");
GDVIRTUAL_BIND(_set_credentials, "username", "password", "ssh_public_key_path", "ssh_private_key_path", "ssh_passphrase");
Expand Down
11 changes: 10 additions & 1 deletion editor/editor_vcs_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "core/object/script_language_extension.h"
#include "core/string/ustring.h"
#include "core/variant/type_info.h"
#include "editor/editor_plugin.h"

class EditorVCSInterface : public Object {
GDCLASS(EditorVCSInterface, Object)
Expand Down Expand Up @@ -105,6 +106,10 @@ class EditorVCSInterface : public Object {
Commit _convert_commit(Dictionary p_commit);
StatusFile _convert_status_file(Dictionary p_status_file);

// UI implementations from the VCS plugins
GDVIRTUAL1(_attach_ui, EditorPlugin *);
GDVIRTUAL1(_remove_ui, EditorPlugin *);

// Proxy endpoints for extensions to implement
GDVIRTUAL1R(bool, _initialize, String);
GDVIRTUAL5(_set_credentials, String, String, String, String, String);
Expand Down Expand Up @@ -140,7 +145,11 @@ class EditorVCSInterface : public Object {
};
static void create_vcs_metadata_files(VCSMetadata p_vcs_metadata_type, String &p_dir);

// Proxies to the editor for use
// UI registrations
void attach_ui(EditorPlugin *p_vcs_editor_plugin);
void remove_ui(EditorPlugin *p_vcs_editor_plugin);

// Proxies for the editor to use
bool initialize(String p_project_path);
void set_credentials(String p_username, String p_password, String p_ssh_public_key_path, String p_ssh_private_key_path, String p_ssh_passphrase);
List<StatusFile> get_modified_files_data();
Expand Down
Loading