1/**************************************************************************/
2/* project_settings_editor.h */
3/**************************************************************************/
4/* This file is part of: */
5/* GODOT ENGINE */
6/* https://godotengine.org */
7/**************************************************************************/
8/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#ifndef PROJECT_SETTINGS_EDITOR_H
32#define PROJECT_SETTINGS_EDITOR_H
33
34#include "core/config/project_settings.h"
35#include "editor/action_map_editor.h"
36#include "editor/editor_autoload_settings.h"
37#include "editor/editor_data.h"
38#include "editor/editor_plugin_settings.h"
39#include "editor/editor_sectioned_inspector.h"
40#include "editor/import_defaults_editor.h"
41#include "editor/localization_editor.h"
42#include "editor/shader_globals_editor.h"
43#include "scene/gui/tab_container.h"
44
45class FileSystemDock;
46
47class ProjectSettingsEditor : public AcceptDialog {
48 GDCLASS(ProjectSettingsEditor, AcceptDialog);
49
50 static ProjectSettingsEditor *singleton;
51 ProjectSettings *ps = nullptr;
52 Timer *timer = nullptr;
53
54 TabContainer *tab_container = nullptr;
55 VBoxContainer *general_editor = nullptr;
56 SectionedInspector *general_settings_inspector = nullptr;
57 ActionMapEditor *action_map_editor = nullptr;
58 LocalizationEditor *localization_editor = nullptr;
59 EditorAutoloadSettings *autoload_settings = nullptr;
60 ShaderGlobalsEditor *shaders_global_shader_uniforms_editor = nullptr;
61 EditorPluginSettings *plugin_settings = nullptr;
62
63 LineEdit *search_box = nullptr;
64 CheckButton *advanced = nullptr;
65
66 HBoxContainer *custom_properties = nullptr;
67 LineEdit *property_box = nullptr;
68 OptionButton *feature_box = nullptr;
69 OptionButton *type_box = nullptr;
70 Button *add_button = nullptr;
71 Button *del_button = nullptr;
72
73 Label *restart_label = nullptr;
74 TextureRect *restart_icon = nullptr;
75 PanelContainer *restart_container = nullptr;
76 Button *restart_close_button = nullptr;
77
78 ImportDefaultsEditor *import_defaults_editor = nullptr;
79 EditorData *data = nullptr;
80
81 void _advanced_toggled(bool p_button_pressed);
82 void _update_advanced(bool p_is_advanced);
83 void _property_box_changed(const String &p_text);
84 void _update_property_box();
85 void _feature_selected(int p_index);
86 void _select_type(Variant::Type p_type);
87
88 virtual void shortcut_input(const Ref<InputEvent> &p_event) override;
89
90 String _get_setting_name() const;
91 void _setting_edited(const String &p_name);
92 void _setting_selected(const String &p_path);
93 void _add_setting();
94 void _delete_setting();
95
96 void _editor_restart_request();
97 void _editor_restart();
98 void _editor_restart_close();
99
100 void _add_feature_overrides();
101
102 void _action_added(const String &p_name);
103 void _action_edited(const String &p_name, const Dictionary &p_action);
104 void _action_removed(const String &p_name);
105 void _action_renamed(const String &p_old_name, const String &p_new_name);
106 void _action_reordered(const String &p_action_name, const String &p_relative_to, bool p_before);
107 void _update_action_map_editor();
108 void _update_theme();
109
110 void _input_filter_focused();
111 void _input_filter_unfocused();
112
113protected:
114 void _notification(int p_what);
115 static void _bind_methods();
116
117public:
118 static ProjectSettingsEditor *get_singleton() { return singleton; }
119 void popup_project_settings(bool p_clear_filter = false);
120 void set_plugins_page();
121 void set_general_page(const String &p_category);
122 void update_plugins();
123
124 EditorAutoloadSettings *get_autoload_settings() { return autoload_settings; }
125 TabContainer *get_tabs() { return tab_container; }
126
127 void queue_save();
128 void connect_filesystem_dock_signals(FileSystemDock *p_fs_dock);
129
130 ProjectSettingsEditor(EditorData *p_data);
131};
132
133#endif // PROJECT_SETTINGS_EDITOR_H
134