summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2019-09-14 19:40:15 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2019-09-14 22:14:00 +0200
commit6df03fe61f8b25f932e0666cfd873e563e8cf1ed (patch)
treef220b8a59c8eb9c5490b37cb2e92173f96827b8f /editor/plugins
parent24e1039eb6fe32115e8d1a62a84965e9be19a2ed (diff)
Display an error message if no version control systems are available
This removes the need for a dedicated placeholder entry. This closes #32135.
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/version_control_editor_plugin.cpp36
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 c059977487..d0e742e7cc 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);
@@ -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);