diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-09-20 20:20:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-20 20:20:34 +0200 |
commit | ae3c685042fba134eaa22b4ce27c1b1c6702f274 (patch) | |
tree | d2d71f3db255018870c86a619d27716d30741230 | |
parent | a34b77e271da5f3d550acfac1e5557f2467c6266 (diff) | |
parent | 6df03fe61f8b25f932e0666cfd873e563e8cf1ed (diff) |
Merge pull request #32137 from Calinou/vcs-error-if-none-available
Display an error message if no version control systems are available
-rw-r--r-- | editor/plugins/version_control_editor_plugin.cpp | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index c41f51d387..e8cd7692b6 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -59,14 +59,6 @@ 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); - - if (available_addons.find(selected_vcs) != NULL) { - - set_up_init_button->set_disabled(false); - } else { - - set_up_init_button->set_disabled(true); - } } void VersionControlEditorPlugin::_populate_available_vcs_names() { @@ -75,9 +67,6 @@ void VersionControlEditorPlugin::_populate_available_vcs_names() { if (!called) { - set_up_choice->add_item("Select an available VCS"); - - fetch_available_vcs_addon_names(); List<StringName> available_addons = get_available_vcs_names(); for (int i = 0; i < available_addons.size(); i++) { @@ -95,19 +84,22 @@ VersionControlEditorPlugin *VersionControlEditorPlugin::get_singleton() { void VersionControlEditorPlugin::popup_vcs_set_up_dialog(const Control *p_gui_base) { - Size2 popup_size = Size2(400, 100); - Size2 window_size = p_gui_base->get_viewport_rect().size; - popup_size.x = MIN(window_size.x * 0.5, popup_size.x); - popup_size.y = MIN(window_size.y * 0.5, popup_size.y); + fetch_available_vcs_addon_names(); + List<StringName> available_addons = get_available_vcs_names(); + if (available_addons.size() >= 1) { - if (get_is_vcs_intialized()) { + Size2 popup_size = Size2(400, 100); + Size2 window_size = p_gui_base->get_viewport_rect().size; + popup_size.x = MIN(window_size.x * 0.5, popup_size.x); + popup_size.y = MIN(window_size.y * 0.5, popup_size.y); - set_up_init_button->set_disabled(true); - } + _populate_available_vcs_names(); - _populate_available_vcs_names(); + set_up_dialog->popup_centered_clamped(popup_size * EDSCALE); + } else { - set_up_dialog->popup_centered_clamped(popup_size * EDSCALE); + EditorNode::get_singleton()->show_warning(TTR("No VCS addons are available."), TTR("Error")); + } } void VersionControlEditorPlugin::_initialize_vcs() { @@ -120,7 +112,7 @@ void VersionControlEditorPlugin::_initialize_vcs() { return; } - int id = set_up_choice->get_selected_id(); + const int id = set_up_choice->get_selected_id(); String selected_addon = set_up_choice->get_item_text(id); String path = ScriptServer::get_global_class_path(selected_addon); @@ -439,7 +431,6 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { version_control_actions->add_child(set_up_dialog); set_up_ok_button = set_up_dialog->get_ok(); - set_up_ok_button->set_disabled(false); set_up_ok_button->set_text(TTR("Close")); set_up_vbc = memnew(VBoxContainer); @@ -466,7 +457,6 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { set_up_init_settings = NULL; set_up_init_button = memnew(Button); - set_up_init_button->set_disabled(true); set_up_init_button->set_text(TTR("Initialize")); set_up_init_button->connect("pressed", this, "_initialize_vcs"); set_up_vbc->add_child(set_up_init_button); |