summaryrefslogtreecommitdiff
path: root/editor/project_settings_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/project_settings_editor.cpp')
-rw-r--r--editor/project_settings_editor.cpp102
1 files changed, 12 insertions, 90 deletions
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 019ed47e81..3352ea22de 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -29,13 +29,13 @@
/*************************************************************************/
#include "project_settings_editor.h"
-#include "editor_node.h"
-#include "global_constants.h"
-#include "os/keyboard.h"
-#include "project_settings.h"
+#include "core/global_constants.h"
+#include "core/os/keyboard.h"
+#include "core/project_settings.h"
+#include "core/translation.h"
+#include "editor/editor_node.h"
#include "scene/gui/margin_container.h"
#include "scene/gui/tab_container.h"
-#include "translation.h"
ProjectSettingsEditor *ProjectSettingsEditor::singleton = NULL;
@@ -184,8 +184,6 @@ void ProjectSettingsEditor::_device_input_add() {
int idx = edit_idx;
Variant old_val = ProjectSettings::get_singleton()->get(name);
Array arr = old_val;
- // ie.device = device_id->get_value();
- // ie.type = add_type;
switch (add_type) {
@@ -505,7 +503,7 @@ void ProjectSettingsEditor::_action_activated() {
void ProjectSettingsEditor::_action_button_pressed(Object *p_obj, int p_column, int p_id) {
- TreeItem *ti = p_obj->cast_to<TreeItem>();
+ TreeItem *ti = Object::cast_to<TreeItem>(p_obj);
ERR_FAIL_COND(!ti);
@@ -619,7 +617,6 @@ void ProjectSettingsEditor::_update_actions() {
continue;
TreeItem *item = input_editor->create_item(root);
- //item->set_cell_mode(0,TreeItem::CELL_MODE_CHECK);
item->set_text(0, name);
item->add_button(0, get_icon("Add", "EditorIcons"), 1, false, TTR("Add Event"));
if (!ProjectSettings::get_singleton()->get_input_presets().find(pi.name)) {
@@ -627,7 +624,6 @@ void ProjectSettingsEditor::_update_actions() {
item->set_editable(0, true);
}
item->set_custom_bg_color(0, get_color("prop_subsection", "Editor"));
- //item->set_checked(0,pi.usage&PROPERTY_USAGE_CHECKED);
Array actions = ProjectSettings::get_singleton()->get(pi.name);
@@ -748,22 +744,10 @@ void ProjectSettingsEditor::_item_add() {
}
String catname = category->get_text().strip_edges();
- /*if (!catname.is_valid_identifier()) {
- message->set_text("Invalid Category.\nValid characters: a-z,A-Z,0-9 or _");
- message->popup_centered(Size2(300,100));
- return;
- }*/
-
String propname = property->get_text().strip_edges();
- /*if (!propname.is_valid_identifier()) {
- message->set_text("Invalid Property.\nValid characters: a-z,A-Z,0-9 or _");
- message->popup_centered(Size2(300,100));
- return;
- }*/
-
String name = catname != "" ? catname + "/" + propname : propname;
- undo_redo->create_action("Add Global Property");
+ undo_redo->create_action(TTR("Add Global Property"));
undo_redo->add_do_property(ProjectSettings::get_singleton(), name, value);
@@ -790,7 +774,7 @@ void ProjectSettingsEditor::_item_del() {
String path = globals_editor->get_property_editor()->get_selected_path();
if (path == String()) {
- EditorNode::get_singleton()->show_warning(TTR("Select an setting item first!"));
+ EditorNode::get_singleton()->show_warning(TTR("Select a setting item first!"));
return;
}
@@ -882,13 +866,6 @@ void ProjectSettingsEditor::_save() {
message->popup_centered(Size2(300, 100) * EDSCALE);
}
-void ProjectSettingsEditor::_settings_prop_edited(const String &p_name) {
-
- String full_item = globals_editor->get_full_item_path(p_name);
-
- _settings_changed();
-}
-
void ProjectSettingsEditor::_settings_changed() {
timer->start();
@@ -1010,7 +987,7 @@ void ProjectSettingsEditor::_translation_file_open() {
void ProjectSettingsEditor::_translation_delete(Object *p_item, int p_column, int p_button) {
- TreeItem *ti = p_item->cast_to<TreeItem>();
+ TreeItem *ti = Object::cast_to<TreeItem>(p_item);
ERR_FAIL_COND(!ti);
int idx = ti->get_metadata(0);
@@ -1151,7 +1128,7 @@ void ProjectSettingsEditor::_translation_res_delete(Object *p_item, int p_column
Dictionary remaps = ProjectSettings::get_singleton()->get("locale/translation_remaps");
- TreeItem *k = p_item->cast_to<TreeItem>();
+ TreeItem *k = Object::cast_to<TreeItem>(p_item);
String key = k->get_metadata(0);
ERR_FAIL_COND(!remaps.has(key));
@@ -1180,7 +1157,7 @@ void ProjectSettingsEditor::_translation_res_option_delete(Object *p_item, int p
TreeItem *k = translation_remap->get_selected();
ERR_FAIL_COND(!k);
- TreeItem *ed = p_item->cast_to<TreeItem>();
+ TreeItem *ed = Object::cast_to<TreeItem>(p_item);
ERR_FAIL_COND(!ed);
String key = k->get_metadata(0);
@@ -1357,7 +1334,6 @@ void ProjectSettingsEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_add_item"), &ProjectSettingsEditor::_add_item, DEFVAL(Variant()));
ClassDB::bind_method(D_METHOD("_device_input_add"), &ProjectSettingsEditor::_device_input_add);
ClassDB::bind_method(D_METHOD("_press_a_key_confirm"), &ProjectSettingsEditor::_press_a_key_confirm);
- ClassDB::bind_method(D_METHOD("_settings_prop_edited"), &ProjectSettingsEditor::_settings_prop_edited);
ClassDB::bind_method(D_METHOD("_copy_to_platform"), &ProjectSettingsEditor::_copy_to_platform);
ClassDB::bind_method(D_METHOD("_update_translations"), &ProjectSettingsEditor::_update_translations);
ClassDB::bind_method(D_METHOD("_translation_delete"), &ProjectSettingsEditor::_translation_delete);
@@ -1391,12 +1367,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
tab_container = memnew(TabContainer);
tab_container->set_tab_align(TabContainer::ALIGN_LEFT);
add_child(tab_container);
- //set_child_rect(tab_container);
-
- //tab_container->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 15 );
- //tab_container->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 15 );
- //tab_container->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 15 );
- //tab_container->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 );
VBoxContainer *props_base = memnew(VBoxContainer);
props_base->set_alignment(BoxContainer::ALIGN_BEGIN);
@@ -1478,21 +1448,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
globals_editor->register_search_box(search_box);
globals_editor->get_property_editor()->get_scene_tree()->connect("cell_selected", this, "_item_selected");
globals_editor->get_property_editor()->connect("property_toggled", this, "_item_checked", varray(), CONNECT_DEFERRED);
- globals_editor->get_property_editor()->connect("property_edited", this, "_settings_prop_edited");
-
- /*
- Button *save = memnew( Button );
- props_base->add_child(save);
-
- save->set_anchor(MARGIN_LEFT,ANCHOR_END);
- save->set_anchor(MARGIN_RIGHT,ANCHOR_END);
- save->set_anchor(MARGIN_TOP,ANCHOR_END);
- save->set_anchor(MARGIN_BOTTOM,ANCHOR_END);
- save->set_begin( Point2(80,28) );
- save->set_end( Point2(10,20) );
- save->set_text("Save");
- save->connect("pressed",this,"_save");
-*/
+ globals_editor->get_property_editor()->connect("property_edited", this, "_settings_changed");
Button *del = memnew(Button);
hbc->add_child(del);
@@ -1506,16 +1462,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
popup_copy_to_feature->set_disabled(true);
add_prop_bar->add_child(popup_copy_to_feature);
- /*List<StringName> ep;
- EditorImportExport::get_singleton()->get_export_platforms(&ep);
- ep.sort_custom<StringName::AlphCompare>();
-
- for(List<StringName>::Element *E=ep.front();E;E=E->next()) {
-
- popup_copy_to_feature->get_popup()->add_item( E->get() );
-
- }*/
-
popup_copy_to_feature->get_popup()->connect("id_pressed", this, "_copy_to_platform");
popup_copy_to_feature->get_popup()->connect("about_to_show", this, "_copy_to_platform_about_to_show");
@@ -1524,7 +1470,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
message = memnew(ConfirmationDialog);
add_child(message);
- //message->get_cancel()->hide();
message->set_hide_on_ok(true);
Control *input_base = memnew(Control);
@@ -1591,7 +1536,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
hbc = memnew(HBoxContainer);
device_input->add_child(hbc);
- //device_input->set_child_rect(hbc);
VBoxContainer *vbc_left = memnew(VBoxContainer);
hbc->add_child(vbc_left);
@@ -1616,18 +1560,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
device_index = memnew(OptionButton);
vbc_right->add_child(device_index);
- /*
- save = memnew( Button );
- input_base->add_child(save);
- save->set_anchor(MARGIN_LEFT,ANCHOR_END);
- save->set_anchor(MARGIN_RIGHT,ANCHOR_END);
- save->set_anchor(MARGIN_TOP,ANCHOR_END);
- save->set_anchor(MARGIN_BOTTOM,ANCHOR_END);
- save->set_begin( Point2(80,28) );
- save->set_end( Point2(10,20) );
- save->set_text("Save");
- save->connect("pressed",this,"_save");
-*/
setting = false;
//translations
@@ -1739,14 +1671,4 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
add_child(timer);
updating_translations = false;
-
- /*
- Control * es = memnew( Control );
- es->set_name("Export");
- tab_container->add_child(es);
- export_settings = memnew( ProjectExportSettings );
- es->add_child(export_settings);
- export_settings->set_area_as_parent_rect();
- export_settings->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 );
-*/
}