diff options
Diffstat (limited to 'editor/editor_feature_profile.cpp')
-rw-r--r-- | editor/editor_feature_profile.cpp | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index 714df44e25..c6646eb28b 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -1,3 +1,33 @@ +/*************************************************************************/ +/* editor_feature_profile.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + #include "editor_feature_profile.h" #include "core/io/json.h" #include "core/os/dir_access.h" @@ -12,7 +42,7 @@ const char *EditorFeatureProfile::feature_names[FEATURE_MAX] = { TTRC("Scene Tree Editing"), TTRC("Import Dock"), TTRC("Node Dock"), - TTRC("Filesystem Dock") + TTRC("FileSystem and Import Docks") }; const char *EditorFeatureProfile::feature_identifiers[FEATURE_MAX] = { @@ -348,18 +378,21 @@ void EditorFeatureProfileManager::_profile_action(int p_action) { switch (p_action) { case PROFILE_CLEAR: { + EditorSettings::get_singleton()->set("_default_feature_profile", ""); EditorSettings::get_singleton()->save(); current_profile = ""; current.unref(); + _update_profile_list(); + _emit_current_profile_changed(); } break; case PROFILE_SET: { String selected = _get_selected_profile(); ERR_FAIL_COND(selected == String()); if (selected == current_profile) { - return; //nothing to do here + return; // Nothing to do here. } EditorSettings::get_singleton()->set("_default_feature_profile", selected); EditorSettings::get_singleton()->save(); @@ -367,7 +400,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) { current = edited; _update_profile_list(); - + _emit_current_profile_changed(); } break; case PROFILE_IMPORT: { @@ -385,6 +418,7 @@ void EditorFeatureProfileManager::_profile_action(int p_action) { new_profile_name->grab_focus(); } break; case PROFILE_ERASE: { + String selected = _get_selected_profile(); ERR_FAIL_COND(selected == String()); @@ -691,7 +725,7 @@ void EditorFeatureProfileManager::_import_profiles(const Vector<String> &p_paths String dst_file = EditorSettings::get_singleton()->get_feature_profiles_dir().plus_file(basefile); if (FileAccess::exists(dst_file)) { - EditorNode::get_singleton()->show_warning(vformat(TTR("Profile '%s' already exists. Remote it first before importing, import aborted."), basefile.get_basename())); + EditorNode::get_singleton()->show_warning(vformat(TTR("Profile '%s' already exists. Remove it first before importing, import aborted."), basefile.get_basename())); return; } } @@ -779,7 +813,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { profile_actions[PROFILE_CLEAR]->set_disabled(true); profile_actions[PROFILE_CLEAR]->connect("pressed", this, "_profile_action", varray(PROFILE_CLEAR)); - main_vbc->add_margin_child(TTR("Current Profile"), name_hbc); + main_vbc->add_margin_child(TTR("Current Profile:"), name_hbc); HBoxContainer *profiles_hbc = memnew(HBoxContainer); profile_list = memnew(OptionButton); @@ -814,7 +848,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { profile_actions[PROFILE_EXPORT]->set_disabled(true); profile_actions[PROFILE_EXPORT]->connect("pressed", this, "_profile_action", varray(PROFILE_EXPORT)); - main_vbc->add_margin_child(TTR("Available Profiles"), profiles_hbc); + main_vbc->add_margin_child(TTR("Available Profiles:"), profiles_hbc); h_split = memnew(HSplitContainer); h_split->set_v_size_flags(SIZE_EXPAND_FILL); @@ -825,9 +859,8 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { class_list_vbc->set_h_size_flags(SIZE_EXPAND_FILL); class_list = memnew(Tree); - class_list_vbc->add_margin_child(TTR("Enabled Classes"), class_list, true); + class_list_vbc->add_margin_child(TTR("Enabled Classes:"), class_list, true); class_list->set_hide_root(true); - class_list->set_hide_folding(true); class_list->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true); class_list->connect("cell_selected", this, "_class_list_item_selected"); class_list->connect("item_edited", this, "_class_list_item_edited", varray(), CONNECT_DEFERRED); |