mirror of https://github.com/godotengine/godot
Fix non-empty project folder confirmation dialog
This commit is contained in:
parent
9aed9eca40
commit
e7e3a25c1e
|
|
@ -488,12 +488,14 @@ void ProjectDialog::ok_pressed() {
|
||||||
// Before we create a project, check that the target folder is empty.
|
// Before we create a project, check that the target folder is empty.
|
||||||
// If not, we need to ask the user if they're sure they want to do this.
|
// If not, we need to ask the user if they're sure they want to do this.
|
||||||
if (!is_folder_empty) {
|
if (!is_folder_empty) {
|
||||||
ConfirmationDialog *cd = memnew(ConfirmationDialog);
|
if (!nonempty_confirmation) {
|
||||||
cd->set_title(TTR("Warning: This folder is not empty"));
|
nonempty_confirmation = memnew(ConfirmationDialog);
|
||||||
cd->set_text(TTR("You are about to create a Godot project in a non-empty folder.\nThe entire contents of this folder will be imported as project resources!\n\nAre you sure you wish to continue?"));
|
nonempty_confirmation->set_title(TTR("Warning: This folder is not empty"));
|
||||||
cd->get_ok_button()->connect(SceneStringName(pressed), callable_mp(this, &ProjectDialog::_nonempty_confirmation_ok_pressed));
|
nonempty_confirmation->set_text(TTR("You are about to create a Godot project in a non-empty folder.\nThe entire contents of this folder will be imported as project resources!\n\nAre you sure you wish to continue?"));
|
||||||
get_parent()->add_child(cd);
|
nonempty_confirmation->get_ok_button()->connect(SceneStringName(pressed), callable_mp(this, &ProjectDialog::_nonempty_confirmation_ok_pressed));
|
||||||
cd->popup_centered();
|
add_child(nonempty_confirmation);
|
||||||
|
}
|
||||||
|
nonempty_confirmation->popup_centered();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ private:
|
||||||
|
|
||||||
Mode mode = MODE_NEW;
|
Mode mode = MODE_NEW;
|
||||||
bool is_folder_empty = true;
|
bool is_folder_empty = true;
|
||||||
|
ConfirmationDialog *nonempty_confirmation = nullptr;
|
||||||
|
|
||||||
CheckButton *create_dir = nullptr;
|
CheckButton *create_dir = nullptr;
|
||||||
Button *project_browse = nullptr;
|
Button *project_browse = nullptr;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue