diff options
Diffstat (limited to 'editor/project_manager.cpp')
-rw-r--r-- | editor/project_manager.cpp | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 6ace79df27..e042e9cc96 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ @@ -218,7 +218,7 @@ private: unzFile pkg = unzOpen2(zip_path.utf8().get_data(), &io); if (!pkg) { - dialog_error->set_text("Error opening package file, not in zip format."); + dialog_error->set_text(TTR("Error opening package file, not in zip format.")); return; } @@ -475,7 +475,7 @@ void ProjectManager::_notification(int p_what) { void ProjectManager::_panel_draw(Node *p_hb) { - HBoxContainer *hb = p_hb->cast_to<HBoxContainer>(); + HBoxContainer *hb = Object::cast_to<HBoxContainer>(p_hb); hb->draw_line(Point2(0, hb->get_size().y + 1), Point2(hb->get_size().x - 10, hb->get_size().y + 1), get_color("guide_color", "Tree")); @@ -487,7 +487,7 @@ void ProjectManager::_panel_draw(Node *p_hb) { void ProjectManager::_update_project_buttons() { for (int i = 0; i < scroll_childs->get_child_count(); i++) { - CanvasItem *item = scroll_childs->get_child(i)->cast_to<CanvasItem>(); + CanvasItem *item = Object::cast_to<CanvasItem>(scroll_childs->get_child(i)); item->update(); } @@ -509,7 +509,7 @@ void ProjectManager::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) { int clicked_id = -1; int last_clicked_id = -1; for (int i = 0; i < scroll_childs->get_child_count(); i++) { - HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>(); + HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_childs->get_child(i)); if (!hb) continue; if (hb->get_meta("name") == clicked) clicked_id = i; if (hb->get_meta("name") == last_clicked) last_clicked_id = i; @@ -519,7 +519,7 @@ void ProjectManager::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) { int min = clicked_id < last_clicked_id ? clicked_id : last_clicked_id; int max = clicked_id > last_clicked_id ? clicked_id : last_clicked_id; for (int i = 0; i < scroll_childs->get_child_count(); ++i) { - HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>(); + HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_childs->get_child(i)); if (!hb) continue; if (i != clicked_id && (i < min || i > max) && !mb->get_control()) { selected_list.erase(hb->get_meta("name")); @@ -572,7 +572,7 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) { for (int i = 0; i < scroll_childs->get_child_count(); i++) { - HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>(); + HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_childs->get_child(i)); if (hb) { selected_list.clear(); selected_list.insert(hb->get_meta("name"), hb->get_meta("main_scene")); @@ -587,7 +587,7 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) { for (int i = scroll_childs->get_child_count() - 1; i >= 0; i--) { - HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>(); + HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_childs->get_child(i)); if (hb) { selected_list.clear(); selected_list.insert(hb->get_meta("name"), hb->get_meta("main_scene")); @@ -609,7 +609,7 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) { for (int i = scroll_childs->get_child_count() - 1; i >= 0; i--) { - HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>(); + HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_childs->get_child(i)); if (!hb) continue; String current = hb->get_meta("name"); @@ -646,7 +646,7 @@ void ProjectManager::_unhandled_input(const Ref<InputEvent> &p_ev) { for (int i = 0; i < scroll_childs->get_child_count(); i++) { - HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>(); + HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_childs->get_child(i)); if (!hb) continue; String current = hb->get_meta("name"); @@ -805,7 +805,8 @@ void ProjectManager::_load_recent_projects() { Error err = img->load(appicon.replace_first("res://", path + "/")); if (err == OK) { - img->resize(64, 64); + Ref<Texture> default_icon = get_icon("DefaultProjectIcon", "EditorIcons"); + img->resize(default_icon->get_width(), default_icon->get_height()); Ref<ImageTexture> it = memnew(ImageTexture); it->create_from_image(img); icon = it; @@ -885,8 +886,8 @@ void ProjectManager::_load_recent_projects() { void ProjectManager::_on_project_created(const String &dir) { bool has_already = false; for (int i = 0; i < scroll_childs->get_child_count(); i++) { - HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>(); - Label *fpath = hb->get_node(NodePath("project/path"))->cast_to<Label>(); + HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_childs->get_child(i)); + Label *fpath = Object::cast_to<Label>(hb->get_node(NodePath("project/path"))); if (fpath->get_text() == dir) { has_already = true; break; @@ -903,8 +904,8 @@ void ProjectManager::_on_project_created(const String &dir) { void ProjectManager::_update_scroll_pos(const String &dir) { for (int i = 0; i < scroll_childs->get_child_count(); i++) { - HBoxContainer *hb = scroll_childs->get_child(i)->cast_to<HBoxContainer>(); - Label *fpath = hb->get_node(NodePath("project/path"))->cast_to<Label>(); + HBoxContainer *hb = Object::cast_to<HBoxContainer>(scroll_childs->get_child(i)); + Label *fpath = Object::cast_to<Label>(hb->get_node(NodePath("project/path"))); if (fpath->get_text() == dir) { last_clicked = hb->get_meta("name"); selected_list.clear(); @@ -1389,9 +1390,6 @@ ProjectManager::ProjectManager() { _scan_begin(EditorSettings::get_singleton()->get("filesystem/directories/autoscan_project_path")); } - //get_ok()->set_text("Open"); - //get_ok()->set_text("Exit"); - last_clicked = ""; SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped"); |