| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "scene/gui/dialogs.h" |
| 34 |
|
| 35 |
class Button; |
| 36 |
class CheckBox; |
| 37 |
class CheckButton; |
| 38 |
class EditorFileDialog; |
| 39 |
class LineEdit; |
| 40 |
class OptionButton; |
| 41 |
class TextureRect; |
| 42 |
|
| 43 |
class ProjectDialog : public ConfirmationDialog { |
| 44 |
GDCLASS(ProjectDialog, ConfirmationDialog); |
| 45 |
|
| 46 |
public: |
| 47 |
enum Mode { |
| 48 |
MODE_NEW, |
| 49 |
MODE_IMPORT, |
| 50 |
MODE_INSTALL, |
| 51 |
MODE_RENAME, |
| 52 |
MODE_DUPLICATE, |
| 53 |
}; |
| 54 |
|
| 55 |
private: |
| 56 |
enum MessageType { |
| 57 |
MESSAGE_ERROR, |
| 58 |
MESSAGE_WARNING, |
| 59 |
MESSAGE_SUCCESS, |
| 60 |
}; |
| 61 |
|
| 62 |
enum InputType { |
| 63 |
PROJECT_PATH, |
| 64 |
INSTALL_PATH, |
| 65 |
}; |
| 66 |
|
| 67 |
enum InvalidStateFlag { |
| 68 |
INVALID_STATE_FLAG_NONE = 0, |
| 69 |
INVALID_STATE_FLAG_PATH_INPUT = 1 << 0, |
| 70 |
INVALID_STATE_FLAG_RENDERER_SELECT = 1 << 1, |
| 71 |
}; |
| 72 |
|
| 73 |
Mode mode = MODE_NEW; |
| 74 |
bool is_folder_empty = true; |
| 75 |
ConfirmationDialog *nonempty_confirmation = nullptr; |
| 76 |
|
| 77 |
CheckButton *create_dir = nullptr; |
| 78 |
Button *project_browse = nullptr; |
| 79 |
Button *install_browse = nullptr; |
| 80 |
VBoxContainer *name_container = nullptr; |
| 81 |
VBoxContainer *project_path_container = nullptr; |
| 82 |
VBoxContainer *install_path_container = nullptr; |
| 83 |
|
| 84 |
VBoxContainer *renderer_container = nullptr; |
| 85 |
Label *renderer_info = nullptr; |
| 86 |
HBoxContainer *default_files_container = nullptr; |
| 87 |
Ref<ButtonGroup> renderer_button_group; |
| 88 |
bool rendering_device_supported = false; |
| 89 |
bool rendering_device_checked = false; |
| 90 |
Label *rd_not_supported = nullptr; |
| 91 |
|
| 92 |
Label *msg = nullptr; |
| 93 |
LineEdit *project_name = nullptr; |
| 94 |
LineEdit *project_path = nullptr; |
| 95 |
LineEdit *install_path = nullptr; |
| 96 |
TextureRect *project_status_rect = nullptr; |
| 97 |
TextureRect *install_status_rect = nullptr; |
| 98 |
|
| 99 |
OptionButton *vcs_metadata_selection = nullptr; |
| 100 |
|
| 101 |
CheckBox *edit_check_box = nullptr; |
| 102 |
|
| 103 |
EditorFileDialog *fdialog_project = nullptr; |
| 104 |
EditorFileDialog *fdialog_install = nullptr; |
| 105 |
AcceptDialog *dialog_error = nullptr; |
| 106 |
|
| 107 |
String zip_path; |
| 108 |
String zip_title; |
| 109 |
|
| 110 |
String original_project_path; |
| 111 |
bool duplicate_can_edit = false; |
| 112 |
|
| 113 |
BitField<InvalidStateFlag> invalid_state_flags = INVALID_STATE_FLAG_NONE; |
| 114 |
|
| 115 |
void _set_message(const String &p_msg, MessageType p_type, InputType input_type = PROJECT_PATH); |
| 116 |
void _update_ok_button(); |
| 117 |
void _validate_path(); |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
String _get_target_path(); |
| 122 |
void _set_target_path(const String &p_text); |
| 123 |
|
| 124 |
|
| 125 |
String auto_dir; |
| 126 |
|
| 127 |
|
| 128 |
void _update_target_auto_dir(); |
| 129 |
|
| 130 |
|
| 131 |
String last_custom_target_dir; |
| 132 |
void _create_dir_toggled(bool p_pressed); |
| 133 |
|
| 134 |
void _project_name_changed(); |
| 135 |
void _project_path_changed(); |
| 136 |
void _install_path_changed(); |
| 137 |
|
| 138 |
void _browse_project_path(); |
| 139 |
void _browse_install_path(); |
| 140 |
|
| 141 |
void _project_path_selected(const String &p_path); |
| 142 |
void _install_path_selected(const String &p_path); |
| 143 |
|
| 144 |
void _reset_name(); |
| 145 |
void _renderer_selected(); |
| 146 |
void _nonempty_confirmation_ok_pressed(); |
| 147 |
|
| 148 |
void ok_pressed() override; |
| 149 |
|
| 150 |
protected: |
| 151 |
static void _bind_methods(); |
| 152 |
void _notification(int p_what); |
| 153 |
|
| 154 |
public: |
| 155 |
void set_mode(Mode p_mode); |
| 156 |
void set_project_name(const String &p_name); |
| 157 |
void set_project_path(const String &p_path); |
| 158 |
void set_zip_path(const String &p_path); |
| 159 |
void set_zip_title(const String &p_title); |
| 160 |
void set_original_project_path(const String &p_path); |
| 161 |
void set_duplicate_can_edit(bool p_duplicate_can_edit); |
| 162 |
|
| 163 |
void ask_for_path_and_show(); |
| 164 |
void show_dialog(bool p_reset_name = true, bool p_is_confirmed = true); |
| 165 |
|
| 166 |
ProjectDialog(); |
| 167 |
}; |