Display an error message if no version control systems are available
This removes the need for a dedicated placeholder entry. This closes #32135.
This commit is contained in:
parent
24e1039eb6
commit
6df03fe61f
|
@ -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();
|
||||
|
||||
set_up_dialog->popup_centered_clamped(popup_size * EDSCALE);
|
||||
} else {
|
||||
|
||||
EditorNode::get_singleton()->show_warning(TTR("No VCS addons are available."), TTR("Error"));
|
||||
}
|
||||
|
||||
_populate_available_vcs_names();
|
||||
|
||||
set_up_dialog->popup_centered_clamped(popup_size * EDSCALE);
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -427,7 +419,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);
|
||||
|
@ -454,7 +445,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);
|
||||
|
|
Loading…
Reference in New Issue