diff options
Diffstat (limited to 'tools/editor/project_manager.cpp')
-rw-r--r-- | tools/editor/project_manager.cpp | 115 |
1 files changed, 77 insertions, 38 deletions
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index abc64cd9cb..419f05f2cf 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -38,15 +38,17 @@ #include "scene/gui/line_edit.h" #include "scene/gui/panel_container.h" - +#include "scene/gui/center_container.h" +#include "io/stream_peer_ssl.h" #include "scene/gui/texture_frame.h" #include "scene/gui/margin_container.h" #include "io/resource_saver.h" #include "editor_icons.h" +#include "editor_fonts.h" - +#include "editor_scale.h" class NewProjectDialog : public ConfirmationDialog { @@ -66,7 +68,7 @@ class NewProjectDialog : public ConfirmationDialog { get_ok()->set_disabled(true); DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); if (project_path->get_text() != "" && d->change_dir(project_path->get_text())!=OK) { - error->set_text(TTR("Invalid Path for Project, Path Must Exist!")); + error->set_text(TTR("Invalid project path, the path must exist!")); memdelete(d); return false; } @@ -75,7 +77,7 @@ class NewProjectDialog : public ConfirmationDialog { if (d->file_exists("engine.cfg")) { - error->set_text(TTR("Invalid Project Path (engine.cfg must not exist).")); + error->set_text(TTR("Invalid project path, engine.cfg must not exist.")); memdelete(d); return false; } @@ -84,7 +86,7 @@ class NewProjectDialog : public ConfirmationDialog { if (project_path->get_text() != "" && !d->file_exists("engine.cfg")) { - error->set_text(TTR("Invalid Project Path (engine.cfg must exist).")); + error->set_text(TTR("Invalid project path, engine.cfg must exist.")); memdelete(d); return false; } @@ -170,7 +172,7 @@ class NewProjectDialog : public ConfirmationDialog { DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); if (d->change_dir(project_path->get_text())!=OK) { - error->set_text(TTR("Invalid Path for Project (changed anything?)")); + error->set_text(TTR("Invalid project path (changed anything?).")); memdelete(d); return; } @@ -180,7 +182,7 @@ class NewProjectDialog : public ConfirmationDialog { FileAccess *f = FileAccess::open(dir.plus_file("/engine.cfg"),FileAccess::WRITE); if (!f) { - error->set_text(TTR("Couldn't create engine.cfg in project path")); + error->set_text(TTR("Couldn't create engine.cfg in project path.")); } else { f->store_line("; Engine configuration file."); @@ -247,7 +249,7 @@ public: if (import_mode) { set_title(TTR("Import Existing Project")); get_ok()->set_text(TTR("Import")); - pp->set_text(TTR("Project Path: (Must exist)")); + pp->set_text(TTR("Project Path (Must Exist):")); pn->set_text(TTR("Project Name:")); pn->hide(); project_name->hide(); @@ -788,7 +790,7 @@ void ProjectManager::_erase_project() { return; - erase_ask->set_text(TTR("Remove project from list?? (Folder contents will not be modified)")); + erase_ask->set_text(TTR("Remove project from the list? (Folder contents will not be modified)")); erase_ask->popup_centered_minsize(); } @@ -822,13 +824,24 @@ void ProjectManager::_bind_methods() { ProjectManager::ProjectManager() { - int margin = get_constant("margin",TTR("Dialogs")); - int button_margin = get_constant("button_margin",TTR("Dialogs")); + int margin = get_constant("margin","Dialogs"); + int button_margin = get_constant("button_margin","Dialogs"); // load settings if (!EditorSettings::get_singleton()) EditorSettings::create(); + { + int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode"); + if (dpi_mode==0) { + editor_set_hidpi( OS::get_singleton()->get_screen_dpi(0) > 150 ); + } else if (dpi_mode==2) { + editor_set_hidpi(true); + } else { + editor_set_hidpi(false); + } + } + FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); set_area_as_parent_rect(); @@ -836,6 +849,7 @@ ProjectManager::ProjectManager() { Ref<Theme> theme = Ref<Theme>( memnew( Theme ) ); set_theme(theme); editor_register_icons(theme); + editor_register_fonts(theme); String global_font = EditorSettings::get_singleton()->get("global/font"); if (global_font!="") { @@ -851,26 +865,46 @@ ProjectManager::ProjectManager() { VBoxContainer *vb = memnew( VBoxContainer ); panel->add_child(vb); - vb->set_area_as_parent_rect(20); - - OS::get_singleton()->set_window_title(_MKSTR(VERSION_NAME)" - Project Manager"); + vb->set_area_as_parent_rect(20*EDSCALE); + vb->set_margin(MARGIN_TOP,4*EDSCALE); + vb->set_margin(MARGIN_BOTTOM,4*EDSCALE); + vb->add_constant_override("separation",15*EDSCALE); + String cp; + cp.push_back(0xA9); + cp.push_back(0); + OS::get_singleton()->set_window_title(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")+" - "+cp+" 2008-2016 Juan Linietsky, Ariel Manzur."); + + HBoxContainer *top_hb = memnew( HBoxContainer); + vb->add_child(top_hb); + TextureFrame *logo = memnew( TextureFrame ); + logo->set_texture(theme->get_icon("LogoSmall","EditorIcons")); + //top_hb->add_child( logo ); + CenterContainer *ccl = memnew( CenterContainer ); Label *l = memnew( Label ); - l->set_text(_MKSTR(VERSION_NAME)" - Project Manager"); - l->add_font_override("font",get_font("large","Fonts")); - l->set_align(Label::ALIGN_CENTER); - vb->add_child(l); + l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")); + l->add_font_override("font",get_font("doc","EditorFonts")); + ccl->add_child(l); + top_hb->add_child(ccl); + top_hb->add_spacer(); l = memnew( Label ); l->set_text("v" VERSION_MKSTRING); //l->add_font_override("font",get_font("bold","Fonts")); l->set_align(Label::ALIGN_CENTER); - vb->add_child(l); - vb->add_child(memnew(HSeparator)); - vb->add_margin_child("\n",memnew(Control)); + top_hb->add_child(l); + //vb->add_child(memnew(HSeparator)); + //vb->add_margin_child("\n",memnew(Control)); + tabs = memnew( TabContainer ); + vb->add_child(tabs); + tabs->set_v_size_flags(SIZE_EXPAND_FILL); HBoxContainer *tree_hb = memnew( HBoxContainer); - vb->add_margin_child(TTR("Recent Projects:"),tree_hb,true); + projects_hb = tree_hb; + + projects_hb->set_name(TTR("Project List")); + + tabs->add_child(tree_hb); VBoxContainer *search_tree_vb = memnew(VBoxContainer); search_tree_vb->set_h_size_flags(SIZE_EXPAND_FILL); @@ -951,23 +985,26 @@ ProjectManager::ProjectManager() { tree_vb->add_spacer(); - Button * cancel = memnew( Button ); - cancel->set_text(TTR("Exit")); - tree_vb->add_child(cancel); - cancel->connect("pressed", this,"_exit_dialog"); + if (StreamPeerSSL::is_available()) { - vb->add_margin_child("\n",memnew(Control)); - vb->add_child(memnew(HSeparator)); + asset_library = memnew( EditorAssetLibrary(true) ); + asset_library->set_name("Templates"); + tabs->add_child(asset_library); + } else { + WARN_PRINT("Asset Library not available, as it requires SSL to work."); + } - l = memnew( Label ); - String cp; - cp.push_back(0xA9); - cp.push_back(0); - l->set_text(cp+" 2008-2016 Juan Linietsky, Ariel Manzur."); - l->set_align(Label::ALIGN_CENTER); - vb->add_child(l); + CenterContainer *cc = memnew( CenterContainer ); + Button * cancel = memnew( Button ); + cancel->set_text(TTR("Exit")); + cancel->set_custom_minimum_size(Size2(100,1)*EDSCALE); + cc->add_child(cancel); + cancel->connect("pressed", this,"_exit_dialog"); + vb->add_child(cc); + + // erase_ask = memnew( ConfirmationDialog ); erase_ask->get_ok()->set_text(TTR("Remove")); @@ -987,6 +1024,8 @@ ProjectManager::ProjectManager() { add_child(multi_run_ask); + + OS::get_singleton()->set_low_processor_usage_mode(true); npdialog = memnew( NewProjectDialog ); @@ -999,8 +1038,8 @@ ProjectManager::ProjectManager() { _scan_begin( EditorSettings::get_singleton()->get("global/autoscan_project_path") ); } - //get_ok()->set_text(TTR("Open")); - //get_ok()->set_text(TTR("Exit")); + //get_ok()->set_text("Open"); + //get_ok()->set_text("Exit"); last_clicked = ""; } @@ -1016,7 +1055,7 @@ void ProjectListFilter::_setup_filters() { filter_option->clear(); filter_option->add_item(TTR("Name")); - filter_option->add_item("Path"); + filter_option->add_item(TTR("Path")); } void ProjectListFilter::_command(int p_command) { |