summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-11-23 15:21:31 +0100
committerGitHub <noreply@github.com>2021-11-23 15:21:31 +0100
commitc5ab537617d9461964e67bb135bb0818efe21d58 (patch)
treed8dbac613f327907ae281260410b4e570e0b60bc /editor/plugins
parent3ba2d17d2f4b5d1b41c7b00f1020100f9efcc1b6 (diff)
parented9c7bf4509501af9a5482450359dcae69716097 (diff)
Merge pull request #42447 from aaronfranke/gitignore-create
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/version_control_editor_plugin.cpp33
-rw-r--r--editor/plugins/version_control_editor_plugin.h4
2 files changed, 37 insertions, 0 deletions
diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp
index b97095ef39..28352d25eb 100644
--- a/editor/plugins/version_control_editor_plugin.cpp
+++ b/editor/plugins/version_control_editor_plugin.cpp
@@ -49,6 +49,11 @@ void VersionControlEditorPlugin::_bind_methods() {
BIND_ENUM_CONSTANT(CHANGE_TYPE_TYPECHANGE);
}
+void VersionControlEditorPlugin::_create_vcs_metadata_files() {
+ String dir = "res://";
+ EditorVCSInterface::create_vcs_metadata_files(EditorVCSInterface::VCSMetadata(metadata_selection->get_selected()), dir);
+}
+
void VersionControlEditorPlugin::_selected_a_vcs(int p_id) {
List<StringName> available_addons = get_available_vcs_names();
const StringName selected_vcs = set_up_choice->get_item_text(p_id);
@@ -71,6 +76,10 @@ VersionControlEditorPlugin *VersionControlEditorPlugin::get_singleton() {
return singleton ? singleton : memnew(VersionControlEditorPlugin);
}
+void VersionControlEditorPlugin::popup_vcs_metadata_dialog() {
+ metadata_dialog->popup_centered();
+}
+
void VersionControlEditorPlugin::popup_vcs_set_up_dialog(const Control *p_gui_base) {
fetch_available_vcs_addon_names();
List<StringName> available_addons = get_available_vcs_names();
@@ -374,6 +383,30 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
version_control_actions = memnew(PopupMenu);
+ metadata_dialog = memnew(ConfirmationDialog);
+ metadata_dialog->set_title(TTR("Create Version Control Metadata"));
+ metadata_dialog->set_min_size(Size2(200, 40));
+ version_control_actions->add_child(metadata_dialog);
+
+ VBoxContainer *metadata_vb = memnew(VBoxContainer);
+ HBoxContainer *metadata_hb = memnew(HBoxContainer);
+ metadata_hb->set_custom_minimum_size(Size2(200, 20));
+ Label *l = memnew(Label);
+ l->set_text(TTR("Create VCS metadata files for:"));
+ metadata_hb->add_child(l);
+ metadata_selection = memnew(OptionButton);
+ metadata_selection->set_custom_minimum_size(Size2(100, 20));
+ metadata_selection->add_item("None", (int)EditorVCSInterface::VCSMetadata::NONE);
+ metadata_selection->add_item("Git", (int)EditorVCSInterface::VCSMetadata::GIT);
+ metadata_selection->select((int)EditorVCSInterface::VCSMetadata::GIT);
+ metadata_dialog->get_ok_button()->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_create_vcs_metadata_files));
+ metadata_hb->add_child(metadata_selection);
+ metadata_vb->add_child(metadata_hb);
+ l = memnew(Label);
+ l->set_text(TTR("Existing VCS metadata files will be overwritten."));
+ metadata_vb->add_child(l);
+ metadata_dialog->add_child(metadata_vb);
+
set_up_dialog = memnew(AcceptDialog);
set_up_dialog->set_title(TTR("Set Up Version Control"));
set_up_dialog->set_min_size(Size2(400, 100));
diff --git a/editor/plugins/version_control_editor_plugin.h b/editor/plugins/version_control_editor_plugin.h
index d2ba63c86c..2782c1d9dc 100644
--- a/editor/plugins/version_control_editor_plugin.h
+++ b/editor/plugins/version_control_editor_plugin.h
@@ -57,6 +57,8 @@ private:
List<StringName> available_addons;
PopupMenu *version_control_actions;
+ ConfirmationDialog *metadata_dialog;
+ OptionButton *metadata_selection;
AcceptDialog *set_up_dialog;
VBoxContainer *set_up_vbc;
HBoxContainer *set_up_hbc;
@@ -98,6 +100,7 @@ private:
RichTextLabel *diff;
void _populate_available_vcs_names();
+ void _create_vcs_metadata_files();
void _selected_a_vcs(int p_id);
void _initialize_vcs();
void _send_commit_msg();
@@ -121,6 +124,7 @@ protected:
public:
static VersionControlEditorPlugin *get_singleton();
+ void popup_vcs_metadata_dialog();
void popup_vcs_set_up_dialog(const Control *p_gui_base);
void set_version_control_tool_button(Button *p_button) { version_control_dock_button = p_button; }