1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Standardize dialog input validation as a new class

This commit is contained in:
kobewi
2023-06-26 19:18:27 +02:00
parent eca6f0eb54
commit 7f41403a6f
13 changed files with 382 additions and 341 deletions

View File

@@ -40,10 +40,17 @@
#include "scene/gui/panel_container.h"
class EditorFileDialog;
class EditorValidationPanel;
class ShaderCreateDialog : public ConfirmationDialog {
GDCLASS(ShaderCreateDialog, ConfirmationDialog);
enum {
MSG_ID_SHADER,
MSG_ID_PATH,
MSG_ID_BUILT_IN,
};
struct ShaderTypeData {
List<String> extensions;
String default_extension;
@@ -53,10 +60,7 @@ class ShaderCreateDialog : public ConfirmationDialog {
List<ShaderTypeData> type_data;
GridContainer *gc = nullptr;
Label *error_label = nullptr;
Label *path_error_label = nullptr;
Label *builtin_warning_label = nullptr;
PanelContainer *status_panel = nullptr;
EditorValidationPanel *validation_panel = nullptr;
OptionButton *type_menu = nullptr;
OptionButton *mode_menu = nullptr;
OptionButton *template_menu = nullptr;
@@ -67,6 +71,7 @@ class ShaderCreateDialog : public ConfirmationDialog {
AcceptDialog *alert = nullptr;
String initial_base_path;
String path_error;
bool is_new_shader_created = true;
bool is_path_valid = false;
bool is_built_in = false;
@@ -93,8 +98,6 @@ class ShaderCreateDialog : public ConfirmationDialog {
virtual void ok_pressed() override;
void _create_new();
void _load_exist();
void _msg_script_valid(bool valid, const String &p_msg = String());
void _msg_path_valid(bool valid, const String &p_msg = String());
void _update_dialog();
protected: