mirror of
https://github.com/godotengine/godot.git
synced 2024-11-27 09:16:35 +08:00
Merge pull request #12538 from akien-mga/editorsettings
Code quality refactoring in EditorSettings
This commit is contained in:
commit
58889102b6
File diff suppressed because it is too large
Load Diff
@ -80,44 +80,37 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
HashMap<String, PropertyInfo> hints;
|
||||
int last_order;
|
||||
HashMap<String, VariantContainer> props;
|
||||
String resource_path;
|
||||
|
||||
bool _set(const StringName &p_name, const Variant &p_value, bool p_emit_signal = true);
|
||||
bool _get(const StringName &p_name, Variant &r_ret) const;
|
||||
void _get_property_list(List<PropertyInfo> *p_list) const;
|
||||
|
||||
void _initial_set(const StringName &p_name, const Variant &p_value);
|
||||
|
||||
static Ref<EditorSettings> singleton;
|
||||
|
||||
String config_file_path;
|
||||
String settings_path;
|
||||
HashMap<String, PropertyInfo> hints;
|
||||
HashMap<String, VariantContainer> props;
|
||||
int last_order;
|
||||
|
||||
Ref<Resource> clipboard;
|
||||
Vector<Ref<Translation> > translations;
|
||||
Map<String, Ref<ShortCut> > shortcuts;
|
||||
|
||||
bool save_changed_setting;
|
||||
|
||||
bool optimize_save; //do not save stuff that came from config but was not set from engine
|
||||
|
||||
void _load_defaults(Ref<ConfigFile> p_extra_config = NULL);
|
||||
void _load_default_text_editor_theme();
|
||||
|
||||
bool _save_text_editor_theme(String p_file);
|
||||
|
||||
String resource_path;
|
||||
String config_file_path;
|
||||
String settings_path;
|
||||
String project_config_path;
|
||||
|
||||
Vector<String> favorite_dirs;
|
||||
Vector<String> recent_dirs;
|
||||
|
||||
Vector<Ref<Translation> > translations;
|
||||
|
||||
Map<String, Ref<ShortCut> > shortcuts;
|
||||
bool save_changed_setting;
|
||||
bool optimize_save; //do not save stuff that came from config but was not set from engine
|
||||
|
||||
bool _set(const StringName &p_name, const Variant &p_value, bool p_emit_signal = true);
|
||||
bool _get(const StringName &p_name, Variant &r_ret) const;
|
||||
void _initial_set(const StringName &p_name, const Variant &p_value);
|
||||
void _get_property_list(List<PropertyInfo> *p_list) const;
|
||||
void _add_property_info_bind(const Dictionary &p_info);
|
||||
|
||||
void _load_defaults(Ref<ConfigFile> p_extra_config = NULL);
|
||||
void _load_default_text_editor_theme();
|
||||
bool _save_text_editor_theme(String p_file);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
@ -126,41 +119,41 @@ public:
|
||||
NOTIFICATION_EDITOR_SETTINGS_CHANGED = 10000
|
||||
};
|
||||
|
||||
void set_manually(const StringName &p_name, const Variant &p_value, bool p_emit_signal = false) {
|
||||
_set(p_name, p_value, p_emit_signal);
|
||||
}
|
||||
static EditorSettings *get_singleton();
|
||||
|
||||
static void create();
|
||||
void setup_language();
|
||||
void setup_network();
|
||||
static void save();
|
||||
static void destroy();
|
||||
void set_optimize_save(bool p_optimize);
|
||||
|
||||
void set_setting(const String &p_setting, const Variant &p_value);
|
||||
Variant get_setting(const String &p_setting) const;
|
||||
|
||||
bool has_setting(String p_var) const;
|
||||
static EditorSettings *get_singleton();
|
||||
void erase(String p_var);
|
||||
String get_settings_path() const;
|
||||
//String get_global_settings_path() const;
|
||||
String get_project_settings_path() const;
|
||||
|
||||
void setup_language();
|
||||
void setup_network();
|
||||
|
||||
void raise_order(const String &p_name);
|
||||
static void create();
|
||||
static void save();
|
||||
static void destroy();
|
||||
|
||||
void notify_changes();
|
||||
bool has_setting(const String &p_setting) const;
|
||||
void erase(const String &p_setting);
|
||||
void raise_order(const String &p_setting);
|
||||
void set_initial_value(const StringName &p_setting, const Variant &p_value);
|
||||
void set_manually(const StringName &p_setting, const Variant &p_value, bool p_emit_signal = false) {
|
||||
_set(p_setting, p_value, p_emit_signal);
|
||||
}
|
||||
bool property_can_revert(const String &p_setting);
|
||||
Variant property_get_revert(const String &p_setting);
|
||||
void add_property_hint(const PropertyInfo &p_hint);
|
||||
|
||||
void set_resource_clipboard(const Ref<Resource> &p_resource) { clipboard = p_resource; }
|
||||
Ref<Resource> get_resource_clipboard() const { return clipboard; }
|
||||
|
||||
void add_property_hint(const PropertyInfo &p_hint);
|
||||
String get_settings_path() const;
|
||||
String get_project_settings_path() const;
|
||||
|
||||
void set_project_metadata(const String &p_section, const String &p_key, Variant p_data);
|
||||
Variant get_project_metadata(const String &p_section, const String &p_key, Variant p_default);
|
||||
|
||||
void set_favorite_dirs(const Vector<String> &p_favorites_dirs);
|
||||
Vector<String> get_favorite_dirs() const;
|
||||
|
||||
void set_recent_dirs(const Vector<String> &p_recent_dirs);
|
||||
Vector<String> get_recent_dirs() const;
|
||||
|
||||
void load_favorites();
|
||||
|
||||
void list_text_editor_themes();
|
||||
@ -176,15 +169,7 @@ public:
|
||||
Ref<ShortCut> get_shortcut(const String &p_name) const;
|
||||
void get_shortcut_list(List<String> *r_shortcuts);
|
||||
|
||||
void set_optimize_save(bool p_optimize);
|
||||
|
||||
Variant get_project_metadata(const String &p_section, const String &p_key, Variant p_default);
|
||||
void set_project_metadata(const String &p_section, const String &p_key, Variant p_data);
|
||||
|
||||
bool property_can_revert(const String &p_name);
|
||||
Variant property_get_revert(const String &p_name);
|
||||
|
||||
void set_initial_value(const StringName &p_name, const Variant &p_value);
|
||||
void notify_changes();
|
||||
|
||||
EditorSettings();
|
||||
~EditorSettings();
|
||||
@ -193,10 +178,10 @@ public:
|
||||
//not a macro any longer
|
||||
|
||||
#define EDITOR_DEF(m_var, m_val) _EDITOR_DEF(m_var, Variant(m_val))
|
||||
Variant _EDITOR_DEF(const String &p_var, const Variant &p_default);
|
||||
Variant _EDITOR_DEF(const String &p_setting, const Variant &p_default);
|
||||
|
||||
#define EDITOR_GET(m_var) _EDITOR_GET(m_var)
|
||||
Variant _EDITOR_GET(const String &p_var);
|
||||
Variant _EDITOR_GET(const String &p_setting);
|
||||
|
||||
#define ED_IS_SHORTCUT(p_name, p_ev) (EditorSettings::get_singleton()->is_shortcut(p_name, p_ev))
|
||||
Ref<ShortCut> ED_SHORTCUT(const String &p_path, const String &p_name, uint32_t p_keycode = 0);
|
||||
|
Loading…
Reference in New Issue
Block a user