Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an Edit Now option to project dialog to allow opting out of immediately opening a project after creation/import/install #95600

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions editor/project_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,14 +711,17 @@ void ProjectManager::_on_projects_updated() {
project_list->update_dock_menu();
}

void ProjectManager::_on_project_created(const String &dir) {
void ProjectManager::_on_project_created(const String &dir, bool edit) {
project_list->add_project(dir, false);
project_list->save_config();
search_box->clear();
int i = project_list->refresh_project(dir);
project_list->select_project(i);
project_list->ensure_project_visible(i);
_open_selected_projects_ask();

if (edit) {
_open_selected_projects_ask();
}

project_list->update_dock_menu();
}
Expand Down
2 changes: 1 addition & 1 deletion editor/project_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class ProjectManager : public Control {
void _erase_missing_projects_confirm();
void _update_project_buttons();

void _on_project_created(const String &dir);
void _on_project_created(const String &dir, bool edit);
void _on_projects_updated();

void _on_order_option_changed(int p_idx);
Expand Down
20 changes: 16 additions & 4 deletions editor/project_manager/project_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ void ProjectDialog::ok_pressed() {

hide();
if (mode == MODE_NEW || mode == MODE_IMPORT || mode == MODE_INSTALL) {
emit_signal(SNAME("project_created"), path);
emit_signal(SNAME("project_created"), path, edit_check_box->is_pressed());
} else if (mode == MODE_RENAME) {
emit_signal(SNAME("projects_updated"));
}
Expand Down Expand Up @@ -713,6 +713,7 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
create_dir->hide();
project_status_rect->hide();
project_browse->hide();
edit_check_box->hide();

name_container->show();
install_path_container->hide();
Expand Down Expand Up @@ -742,10 +743,11 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
create_dir->show();
project_status_rect->show();
project_browse->show();
edit_check_box->show();

if (mode == MODE_IMPORT) {
set_title(TTR("Import Existing Project"));
set_ok_button_text(TTR("Import & Edit"));
set_ok_button_text(TTR("Import"));

name_container->hide();
install_path_container->hide();
Expand All @@ -755,7 +757,7 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
// Project path dialog is also opened; no need to change focus.
} else if (mode == MODE_NEW) {
set_title(TTR("Create New Project"));
set_ok_button_text(TTR("Create & Edit"));
set_ok_button_text(TTR("Create"));

name_container->show();
install_path_container->hide();
Expand All @@ -766,7 +768,7 @@ void ProjectDialog::show_dialog(bool p_reset_name) {
callable_mp(project_name, &LineEdit::select_all).call_deferred();
} else if (mode == MODE_INSTALL) {
set_title(TTR("Install Project:") + " " + zip_title);
set_ok_button_text(TTR("Install & Edit"));
set_ok_button_text(TTR("Install"));

project_name->set_text(zip_title);

Expand Down Expand Up @@ -993,6 +995,16 @@ ProjectDialog::ProjectDialog() {
fdialog_install->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
add_child(fdialog_install);

Control *spacer2 = memnew(Control);
spacer2->set_v_size_flags(Control::SIZE_EXPAND_FILL);
vb->add_child(spacer2);

edit_check_box = memnew(CheckBox);
edit_check_box->set_text(TTR("Edit Now"));
edit_check_box->set_h_size_flags(Control::SIZE_SHRINK_CENTER);
edit_check_box->set_pressed(true);
vb->add_child(edit_check_box);

project_name->connect(SceneStringName(text_changed), callable_mp(this, &ProjectDialog::_project_name_changed).unbind(1));
project_path->connect(SceneStringName(text_changed), callable_mp(this, &ProjectDialog::_project_path_changed).unbind(1));
install_path->connect(SceneStringName(text_changed), callable_mp(this, &ProjectDialog::_install_path_changed).unbind(1));
Expand Down
3 changes: 3 additions & 0 deletions editor/project_manager/project_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "scene/gui/dialogs.h"

class Button;
class CheckBox;
class CheckButton;
class EditorFileDialog;
class LineEdit;
Expand Down Expand Up @@ -87,6 +88,8 @@ class ProjectDialog : public ConfirmationDialog {

OptionButton *vcs_metadata_selection = nullptr;

CheckBox *edit_check_box = nullptr;

EditorFileDialog *fdialog_project = nullptr;
EditorFileDialog *fdialog_install = nullptr;
AcceptDialog *dialog_error = nullptr;
Expand Down
Loading