Dictionary Engine::get_version_info() const { Dictionary dict; dict["major"] = VERSION_MAJOR; dict["minor"] = VERSION_MINOR; #ifdef VERSION_PATCH dict["patch"] = VERSION_PATCH; #else dict["patch"] = 0; #endif dict["status"] = _MKSTR(VERSION_STATUS); dict["revision"] = _MKSTR(VERSION_REVISION); dict["year"] = VERSION_YEAR; String hash = String(VERSION_HASH); dict["hash"] = hash.length() == 0 ? String("unknown") : hash; String stringver = String(dict["major"]) + "." + String(dict["minor"]); if ((int)dict["patch"] != 0) stringver += "." + String(dict["patch"]); stringver += "-" + String(dict["status"]) + " (" + String(dict["revision"]) + ")"; dict["string"] = stringver; return dict; }
void _browse_path() { if (mode==MODE_IMPORT) { fdialog->set_mode(FileDialog::MODE_OPEN_FILE); fdialog->clear_filters(); fdialog->add_filter("engine.cfg ; " _MKSTR(VERSION_NAME) " Project"); } else { fdialog->set_mode(FileDialog::MODE_OPEN_DIR); } fdialog->popup_centered_ratio(); }
String EditorExportPlatformAndroid::get_project_name() const { String aname; if (this->name!="") { aname=this->name; } else { aname = Globals::get_singleton()->get("application/name"); } if (aname=="") { aname=_MKSTR(VERSION_NAME); } return aname; }
void EditorExportPlatformBB10::_fix_descriptor(Vector<uint8_t>& p_descriptor) { String fpath = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp_bar-settings.xml"); { FileAccessRef f = FileAccess::open(fpath,FileAccess::WRITE); f->store_buffer(p_descriptor.ptr(),p_descriptor.size()); } Ref<XMLParser> parser = memnew( XMLParser ); Error err = parser->open(fpath); ERR_FAIL_COND(err!=OK); String txt; err = parser->read(); Vector<String> depth; while(err!=ERR_FILE_EOF) { ERR_FAIL_COND(err!=OK); switch(parser->get_node_type()) { case XMLParser::NODE_NONE: { print_line("???"); } break; case XMLParser::NODE_ELEMENT: { String e="<"; e+=parser->get_node_name(); for(int i=0;i<parser->get_attribute_count();i++) { e+=" "; e+=parser->get_attribute_name(i)+"=\""; e+=parser->get_attribute_value(i)+"\" "; } if (parser->is_empty()) { e+="/"; } else { depth.push_back(parser->get_node_name()); } e+=">"; txt+=e; } break; case XMLParser::NODE_ELEMENT_END: { txt+="</"+parser->get_node_name()+">"; if (depth.size() && depth[depth.size()-1]==parser->get_node_name()) { depth.resize(depth.size()-1); } } break; case XMLParser::NODE_TEXT: { if (depth.size()==2 && depth[0]=="qnx" && depth[1]=="id") { txt+=package; } else if (depth.size()==2 && depth[0]=="qnx" && depth[1]=="name") { String aname; if (this->name!="") { aname=this->name; } else { aname = GlobalConfig::get_singleton()->get("application/name"); } if (aname=="") { aname=_MKSTR(VERSION_NAME); } txt+=aname; } else if (depth.size()==2 && depth[0]=="qnx" && depth[1]=="versionNumber") { txt+=itos(version_code); } else if (depth.size()==2 && depth[0]=="qnx" && depth[1]=="description") { txt+=description; } else if (depth.size()==2 && depth[0]=="qnx" && depth[1]=="author") { txt+=author_name; } else if (depth.size()==2 && depth[0]=="qnx" && depth[1]=="authorId") { txt+=author_id; } else if (depth.size()==2 && depth[0]=="qnx" && depth[1]=="category") { txt+=category; } else { txt+=parser->get_node_data(); } } break; case XMLParser::NODE_COMMENT: { txt+="<!--"+parser->get_node_name()+"-->"; } break; case XMLParser::NODE_CDATA: { //ignore //print_line("cdata"); } break; case XMLParser::NODE_UNKNOWN: { //ignore txt+="<"+parser->get_node_name()+">"; } break; } err = parser->read(); } CharString cs = txt.utf8(); p_descriptor.resize(cs.length()); for(int i=0;i<cs.length();i++) p_descriptor[i]=cs[i]; }
ProjectManager::ProjectManager() { int margin = get_constant("margin","Dialogs"); int button_margin = get_constant("button_margin","Dialogs"); // load settings if (!EditorSettings::get_singleton()) EditorSettings::create(); set_area_as_parent_rect(); Panel *panel = memnew( Panel ); add_child(panel); panel->set_area_as_parent_rect(); VBoxContainer *vb = memnew( VBoxContainer ); panel->add_child(vb); vb->set_area_as_parent_rect(20); 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 = 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)); HBoxContainer *tree_hb = memnew( HBoxContainer); vb->add_margin_child("Recent Projects:",tree_hb,true); PanelContainer *pc = memnew( PanelContainer); pc->add_style_override("panel",get_stylebox("bg","Tree")); tree_hb->add_child(pc); pc->set_h_size_flags(SIZE_EXPAND_FILL); scroll = memnew( ScrollContainer ); pc->add_child(scroll); scroll->set_enable_h_scroll(false); VBoxContainer *tree_vb = memnew( VBoxContainer); tree_hb->add_child(tree_vb); scroll_childs = memnew( VBoxContainer ); scroll_childs->set_h_size_flags(SIZE_EXPAND_FILL); scroll->add_child(scroll_childs); //HBoxContainer *hb = memnew( HBoxContainer ); //vb->add_child(hb); Button *open = memnew( Button ); open->set_text("Edit"); tree_vb->add_child(open); open->connect("pressed", this,"_open_project"); open_btn=open; Button *run = memnew( Button ); run->set_text("Run"); tree_vb->add_child(run); run->connect("pressed", this,"_run_project"); run_btn=run; tree_vb->add_child(memnew( HSeparator )); Button *scan = memnew( Button ); scan->set_text("Scan"); tree_vb->add_child(scan); scan->connect("pressed", this,"_scan_projects"); tree_vb->add_child(memnew( HSeparator )); scan_dir = memnew( FileDialog ); scan_dir->set_access(FileDialog::ACCESS_FILESYSTEM); scan_dir->set_mode(FileDialog::MODE_OPEN_DIR); add_child(scan_dir); scan_dir->connect("dir_selected",this,"_scan_begin"); Button* create = memnew( Button ); create->set_text("New Project"); tree_vb->add_child(create); create->connect("pressed", this,"_new_project"); Button* import = memnew( Button ); import->set_text("Import"); tree_vb->add_child(import); import->connect("pressed", this,"_import_project"); Button* erase = memnew( Button ); erase->set_text("Erase"); tree_vb->add_child(erase); erase->connect("pressed", this,"_erase_project"); erase_btn=erase; tree_vb->add_spacer(); Button * cancel = memnew( Button ); cancel->set_text("Exit"); tree_vb->add_child(cancel); cancel->connect("pressed", this,"_exit_dialog"); vb->add_margin_child("\n",memnew(Control)); vb->add_child(memnew(HSeparator)); l = memnew( Label ); String cp; cp.push_back(0xA9); cp.push_back(0); l->set_text(cp+" 2008-2012 Juan Linietsky, Ariel Manzur."); l->set_align(Label::ALIGN_CENTER); vb->add_child(l); erase_ask = memnew( ConfirmationDialog ); erase_ask->get_ok()->set_text("Erase"); erase_ask->get_ok()->connect("pressed", this,"_erase_project_confirm"); add_child(erase_ask); OS::get_singleton()->set_low_processor_usage_mode(true); npdialog = memnew( NewProjectDialog ); add_child(npdialog); Ref<Theme> theme = memnew( Theme ); editor_register_icons(theme); set_theme(theme); npdialog->connect("project_created", this,"_load_recent_projects"); _load_recent_projects(); //get_ok()->set_text("Open"); //get_ok()->set_text("Exit"); }
void EditorExportPlatformAndroid::_fix_manifest(Vector<uint8_t>& p_manifest,bool p_give_internet) { const int CHUNK_AXML_FILE = 0x00080003; const int CHUNK_RESOURCEIDS = 0x00080180; const int CHUNK_STRINGS = 0x001C0001; const int CHUNK_XML_END_NAMESPACE = 0x00100101; const int CHUNK_XML_END_TAG = 0x00100103; const int CHUNK_XML_START_NAMESPACE = 0x00100100; const int CHUNK_XML_START_TAG = 0x00100102; const int CHUNK_XML_TEXT = 0x00100104; const int UTF8_FLAG = 0x00000100; Vector<String> string_table; uint32_t ofs=0; uint32_t header = decode_uint32(&p_manifest[ofs]); uint32_t filesize = decode_uint32(&p_manifest[ofs+4]); ofs+=8; // print_line("FILESIZE: "+itos(filesize)+" ACTUAL: "+itos(p_manifest.size())); uint32_t string_count; uint32_t styles_count; uint32_t string_flags; uint32_t string_data_offset; uint32_t styles_offset; uint32_t string_table_begins; uint32_t string_table_ends; Vector<uint8_t> stable_extra; while(ofs < p_manifest.size()) { uint32_t chunk = decode_uint32(&p_manifest[ofs]); uint32_t size = decode_uint32(&p_manifest[ofs+4]); switch(chunk) { case CHUNK_STRINGS: { int iofs=ofs+8; string_count=decode_uint32(&p_manifest[iofs]); styles_count=decode_uint32(&p_manifest[iofs+4]); uint32_t string_flags=decode_uint32(&p_manifest[iofs+8]); string_data_offset=decode_uint32(&p_manifest[iofs+12]); styles_offset=decode_uint32(&p_manifest[iofs+16]); /* printf("string count: %i\n",string_count); printf("flags: %i\n",string_flags); printf("sdata ofs: %i\n",string_data_offset); printf("styles ofs: %i\n",styles_offset); */ uint32_t st_offset=iofs+20; string_table.resize(string_count); uint32_t string_end=0; string_table_begins=st_offset; for(int i=0;i<string_count;i++) { uint32_t string_at = decode_uint32(&p_manifest[st_offset+i*4]); string_at+=st_offset+string_count*4; ERR_EXPLAIN("Unimplemented, can't read utf8 string table."); ERR_FAIL_COND(string_flags&UTF8_FLAG); if (string_flags&UTF8_FLAG) { } else { uint32_t len = decode_uint16(&p_manifest[string_at]); Vector<CharType> ucstring; ucstring.resize(len+1); for(int j=0;j<len;j++) { uint16_t c=decode_uint16(&p_manifest[string_at+2+2*j]); ucstring[j]=c; } string_end=MAX(string_at+2+2*len,string_end); ucstring[len]=0; string_table[i]=ucstring.ptr(); } // print_line("String "+itos(i)+": "+string_table[i]); } for(int i=string_end;i<(ofs+size);i++) { stable_extra.push_back(p_manifest[i]); } // printf("stable extra: %i\n",int(stable_extra.size())); string_table_ends=ofs+size; // print_line("STABLE SIZE: "+itos(size)+" ACTUAL: "+itos(string_table_ends)); } break; case CHUNK_XML_START_TAG: { int iofs=ofs+8; uint32_t line=decode_uint32(&p_manifest[iofs]); uint32_t nspace=decode_uint32(&p_manifest[iofs+8]); uint32_t name=decode_uint32(&p_manifest[iofs+12]); uint32_t check=decode_uint32(&p_manifest[iofs+16]); String tname=string_table[name]; // printf("NSPACE: %i\n",nspace); //printf("NAME: %i (%s)\n",name,tname.utf8().get_data()); //printf("CHECK: %x\n",check); uint32_t attrcount=decode_uint32(&p_manifest[iofs+20]); iofs+=28; //printf("ATTRCOUNT: %x\n",attrcount); for(int i=0;i<attrcount;i++) { uint32_t attr_nspace=decode_uint32(&p_manifest[iofs]); uint32_t attr_name=decode_uint32(&p_manifest[iofs+4]); uint32_t attr_value=decode_uint32(&p_manifest[iofs+8]); uint32_t attr_flags=decode_uint32(&p_manifest[iofs+12]); uint32_t attr_resid=decode_uint32(&p_manifest[iofs+16]); String value; if (attr_value!=0xFFFFFFFF) value=string_table[attr_value]; else value="Res #"+itos(attr_resid); String attrname = string_table[attr_name]; String nspace; if (attr_nspace!=0xFFFFFFFF) nspace=string_table[attr_nspace]; else nspace=""; printf("ATTR %i NSPACE: %i\n",i,attr_nspace); printf("ATTR %i NAME: %i (%s)\n",i,attr_name,attrname.utf8().get_data()); printf("ATTR %i VALUE: %i (%s)\n",i,attr_value,value.utf8().get_data()); printf("ATTR %i FLAGS: %x\n",i,attr_flags); printf("ATTR %i RESID: %x\n",i,attr_resid); //replace project information if (tname=="manifest" && attrname=="package") { print_line("FOUND PACKAGE"); string_table[attr_value]=get_package_name(); } //print_line("tname: "+tname); //print_line("nspace: "+nspace); //print_line("attrname: "+attrname); if (tname=="manifest" && /*nspace=="android" &&*/ attrname=="versionCode") { print_line("FOUND versioncode"); encode_uint32(version_code,&p_manifest[iofs+16]); } if (tname=="manifest" && /*nspace=="android" &&*/ attrname=="versionName") { print_line("FOUND versionname"); if (attr_value==0xFFFFFFFF) { WARN_PRINT("Version name in a resource, should be plaintext") } else string_table[attr_value]=version_name; } if (tname=="activity" && /*nspace=="android" &&*/ attrname=="screenOrientation") { encode_uint32(orientation==0?0:1,&p_manifest[iofs+16]); /* print_line("FOUND screen orientation"); if (attr_value==0xFFFFFFFF) { WARN_PRINT("Version name in a resource, should be plaintext") } else { string_table[attr_value]=(orientation==0?"landscape":"portrait"); }*/ } if (tname=="application" && /*nspace=="android" &&*/ attrname=="label") { print_line("FOUND application"); if (attr_value==0xFFFFFFFF) { WARN_PRINT("Application name in a resource, should be plaintext (but you can ignore this).") } else { String aname = get_project_name(); string_table[attr_value]=aname; } } if (tname=="activity" && /*nspace=="android" &&*/ attrname=="label") { print_line("FOUND activity name"); if (attr_value==0xFFFFFFFF) { WARN_PRINT("Activity name in a resource, should be plaintext (but you can ignore this)") } else { String aname; if (this->name!="") { aname=this->name; } else { aname = Globals::get_singleton()->get("application/name"); } if (aname=="") { aname=_MKSTR(VERSION_NAME); } print_line("APP NAME IS..."+aname); string_table[attr_value]=aname; } } if (tname=="uses-permission" && /*nspace=="android" &&*/ attrname=="name") { if (value.begins_with("godot.custom")) { int which = value.get_slice(".",2).to_int(); if (which>=0 && which<MAX_USER_PERMISSIONS && user_perms[which].strip_edges()!="") { string_table[attr_value]=user_perms[which].strip_edges(); } } else if (value.begins_with("godot.")) { String perm = value.get_slice(".",1); print_line("PERM: "+perm+" HAS: "+itos(perms.has(perm))); if (perms.has(perm) || (p_give_internet && perm=="INTERNET")) { string_table[attr_value]="android.permission."+perm; } } } if (tname=="supports-screens" ) { if (attr_value==0xFFFFFFFF) { WARN_PRINT("Screen res name in a resource, should be plaintext") } else if (attrname=="smallScreens") { encode_uint32(screen_support[SCREEN_SMALL]?0xFFFFFFFF:0,&p_manifest[iofs+16]); } else if (attrname=="mediumScreens") { encode_uint32(screen_support[SCREEN_NORMAL]?0xFFFFFFFF:0,&p_manifest[iofs+16]); } else if (attrname=="largeScreens") { encode_uint32(screen_support[SCREEN_LARGE]?0xFFFFFFFF:0,&p_manifest[iofs+16]); } else if (attrname=="xlargeScreens") { encode_uint32(screen_support[SCREEN_XLARGE]?0xFFFFFFFF:0,&p_manifest[iofs+16]); } } iofs+=20; } } break;
ProjectManager::ProjectManager() { // load settings if (!EditorSettings::get_singleton()) EditorSettings::create(); EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came { int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode"); if (dpi_mode==0) { editor_set_scale( OS::get_singleton()->get_screen_dpi(0) > 150 && OS::get_singleton()->get_screen_size(OS::get_singleton()->get_current_screen()).x>2000 ? 2.0 : 1.0 ); } else if (dpi_mode==1) { editor_set_scale(0.75); } else if (dpi_mode==2) { editor_set_scale(1.0); } else if (dpi_mode==3) { editor_set_scale(1.5); } else if (dpi_mode==4) { editor_set_scale(2.0); } } FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); set_area_as_parent_rect(); set_theme(create_editor_theme()); gui_base = memnew( Control ); add_child(gui_base); gui_base->set_area_as_parent_rect(); gui_base->set_theme(create_custom_theme()); Panel *panel = memnew( Panel ); gui_base->add_child(panel); panel->set_area_as_parent_rect(); VBoxContainer *vb = memnew( VBoxContainer ); panel->add_child(vb); 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); CenterContainer *ccl = memnew( CenterContainer ); Label *l = memnew( Label ); l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager")); l->add_font_override("font", gui_base->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); 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); 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); tree_hb->add_child(search_tree_vb); HBoxContainer *search_box = memnew(HBoxContainer); search_box->add_spacer(true); project_filter = memnew(ProjectListFilter); search_box->add_child(project_filter); project_filter->connect("filter_changed", this, "_load_recent_projects"); project_filter->set_custom_minimum_size(Size2(250,10)); search_tree_vb->add_child(search_box); PanelContainer *pc = memnew( PanelContainer); pc->add_style_override("panel", gui_base->get_stylebox("bg","Tree")); search_tree_vb->add_child(pc); pc->set_v_size_flags(SIZE_EXPAND_FILL); scroll = memnew( ScrollContainer ); pc->add_child(scroll); scroll->set_enable_h_scroll(false); VBoxContainer *tree_vb = memnew( VBoxContainer); tree_hb->add_child(tree_vb); scroll_childs = memnew( VBoxContainer ); scroll_childs->set_h_size_flags(SIZE_EXPAND_FILL); scroll->add_child(scroll_childs); //HBoxContainer *hb = memnew( HBoxContainer ); //vb->add_child(hb); Button *open = memnew( Button ); open->set_text(TTR("Edit")); tree_vb->add_child(open); open->connect("pressed", this,"_open_project"); open_btn=open; Button *run = memnew( Button ); run->set_text(TTR("Run")); tree_vb->add_child(run); run->connect("pressed", this,"_run_project"); run_btn=run; tree_vb->add_child(memnew( HSeparator )); Button *scan = memnew( Button ); scan->set_text(TTR("Scan")); tree_vb->add_child(scan); scan->connect("pressed", this,"_scan_projects"); tree_vb->add_child(memnew( HSeparator )); scan_dir = memnew( FileDialog ); scan_dir->set_access(FileDialog::ACCESS_FILESYSTEM); scan_dir->set_mode(FileDialog::MODE_OPEN_DIR); scan_dir->set_title(TTR("Select a Folder to Scan")); // must be after mode or it's overridden scan_dir->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_path") ); gui_base->add_child(scan_dir); scan_dir->connect("dir_selected",this,"_scan_begin"); Button* create = memnew( Button ); create->set_text(TTR("New Project")); tree_vb->add_child(create); create->connect("pressed", this,"_new_project"); Button* import = memnew( Button ); import->set_text(TTR("Import")); tree_vb->add_child(import); import->connect("pressed", this,"_import_project"); Button* erase = memnew( Button ); erase->set_text(TTR("Remove")); tree_vb->add_child(erase); erase->connect("pressed", this,"_erase_project"); erase_btn=erase; tree_vb->add_spacer(); if (StreamPeerSSL::is_available()) { asset_library = memnew( EditorAssetLibrary(true) ); asset_library->set_name("Templates"); tabs->add_child(asset_library); asset_library->connect("install_asset",this,"_install_project"); } else { WARN_PRINT("Asset Library not available, as it requires SSL to work."); } 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")); erase_ask->get_ok()->connect("pressed", this,"_erase_project_confirm"); gui_base->add_child(erase_ask); multi_open_ask = memnew( ConfirmationDialog ); multi_open_ask->get_ok()->set_text(TTR("Edit")); multi_open_ask->get_ok()->connect("pressed", this, "_open_project_confirm"); gui_base->add_child(multi_open_ask); multi_run_ask = memnew( ConfirmationDialog ); multi_run_ask->get_ok()->set_text(TTR("Run")); multi_run_ask->get_ok()->connect("pressed", this, "_run_project_confirm"); gui_base->add_child(multi_run_ask); multi_scan_ask = memnew( ConfirmationDialog ); multi_scan_ask->get_ok()->set_text(TTR("Scan")); gui_base->add_child(multi_scan_ask); OS::get_singleton()->set_low_processor_usage_mode(true); npdialog = memnew( NewProjectDialog ); gui_base->add_child(npdialog); npdialog->connect("project_created", this,"_load_recent_projects"); _load_recent_projects(); if ( EditorSettings::get_singleton()->get("global/autoscan_project_path") ) { _scan_begin( EditorSettings::get_singleton()->get("global/autoscan_project_path") ); } //get_ok()->set_text("Open"); //get_ok()->set_text("Exit"); last_clicked = ""; SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped"); }
#include "config.h" #include "GeoMath.h" #include <QtGui> #include <QtXml> #ifndef QK_QT5_TZONE #include <tzdata.h> #endif #ifndef _MKSTR_1 #define _MKSTR_1(x) #x #define _MKSTR(x) _MKSTR_1(x) #endif QDir CWpt::path(_MKSTR(MAPPATH) "/wpt"); const QString CWpt::html = "" "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>" "<html>" " <head>" " <title></title>" " <META HTTP-EQUIV='CACHE-CONTROL' CONTENT='NO-CACHE'>" " <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>" " <style type='text/css'>" " p, li { white-space: pre-wrap; }" " td {padding-top: 10px;}" " th {background-color: darkBlue; color: white;}" " h1 {color: #1E5E8F; font-size: 1.2em;}" " h2 {color: #226AA0; font-size: 1em;}" " body {color: #626262; font-size: 1em;}"
ProjectManager::ProjectManager() { int margin = get_constant("margin","Dialogs"); int button_margin = get_constant("button_margin","Dialogs"); // load settings if (!EditorSettings::get_singleton()) EditorSettings::create(); FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files")); set_area_as_parent_rect(); Ref<Theme> theme = Ref<Theme>( memnew( Theme ) ); set_theme(theme); editor_register_icons(theme); String global_font = EditorSettings::get_singleton()->get("global/font"); if (global_font!="") { Ref<Font> fnt = ResourceLoader::load(global_font); if (fnt.is_valid()) { theme->set_default_theme_font(fnt); } } Panel *panel = memnew( Panel ); add_child(panel); panel->set_area_as_parent_rect(); 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"); 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 = 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)); HBoxContainer *tree_hb = memnew( HBoxContainer); vb->add_margin_child("Recent Projects:",tree_hb,true); VBoxContainer *search_tree_vb = memnew(VBoxContainer); search_tree_vb->set_h_size_flags(SIZE_EXPAND_FILL); tree_hb->add_child(search_tree_vb); HBoxContainer *search_box = memnew(HBoxContainer); search_box->add_spacer(true); project_filter = memnew(ProjectListFilter); search_box->add_child(project_filter); project_filter->connect("filter_changed", this, "_load_recent_projects"); project_filter->set_custom_minimum_size(Size2(250,10)); search_tree_vb->add_child(search_box); PanelContainer *pc = memnew( PanelContainer); pc->add_style_override("panel",get_stylebox("bg","Tree")); search_tree_vb->add_child(pc); pc->set_v_size_flags(SIZE_EXPAND_FILL); scroll = memnew( ScrollContainer ); pc->add_child(scroll); scroll->set_enable_h_scroll(false); VBoxContainer *tree_vb = memnew( VBoxContainer); tree_hb->add_child(tree_vb); scroll_childs = memnew( VBoxContainer ); scroll_childs->set_h_size_flags(SIZE_EXPAND_FILL); scroll->add_child(scroll_childs); //HBoxContainer *hb = memnew( HBoxContainer ); //vb->add_child(hb); Button *open = memnew( Button ); open->set_text("Edit"); tree_vb->add_child(open); open->connect("pressed", this,"_open_project"); open_btn=open; Button *run = memnew( Button ); run->set_text("Run"); tree_vb->add_child(run); run->connect("pressed", this,"_run_project"); run_btn=run; tree_vb->add_child(memnew( HSeparator )); Button *scan = memnew( Button ); scan->set_text("Scan"); tree_vb->add_child(scan); scan->connect("pressed", this,"_scan_projects"); tree_vb->add_child(memnew( HSeparator )); scan_dir = memnew( FileDialog ); scan_dir->set_access(FileDialog::ACCESS_FILESYSTEM); scan_dir->set_mode(FileDialog::MODE_OPEN_DIR); scan_dir->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_path") ); add_child(scan_dir); scan_dir->connect("dir_selected",this,"_scan_begin"); Button* create = memnew( Button ); create->set_text("New Project"); tree_vb->add_child(create); create->connect("pressed", this,"_new_project"); Button* import = memnew( Button ); import->set_text("Import"); tree_vb->add_child(import); import->connect("pressed", this,"_import_project"); Button* erase = memnew( Button ); erase->set_text("Erase"); tree_vb->add_child(erase); erase->connect("pressed", this,"_erase_project"); erase_btn=erase; tree_vb->add_spacer(); Button * cancel = memnew( Button ); cancel->set_text("Exit"); tree_vb->add_child(cancel); cancel->connect("pressed", this,"_exit_dialog"); vb->add_margin_child("\n",memnew(Control)); vb->add_child(memnew(HSeparator)); l = memnew( Label ); String cp; cp.push_back(0xA9); cp.push_back(0); l->set_text(cp+" 2008-2015 Juan Linietsky, Ariel Manzur."); l->set_align(Label::ALIGN_CENTER); vb->add_child(l); erase_ask = memnew( ConfirmationDialog ); erase_ask->get_ok()->set_text("Erase"); erase_ask->get_ok()->connect("pressed", this,"_erase_project_confirm"); add_child(erase_ask); multi_open_ask = memnew( ConfirmationDialog ); multi_open_ask->get_ok()->set_text("Edit"); multi_open_ask->get_ok()->connect("pressed", this, "_open_project_confirm"); add_child(multi_open_ask); multi_run_ask = memnew( ConfirmationDialog ); multi_run_ask->get_ok()->set_text("Run"); multi_run_ask->get_ok()->connect("pressed", this, "_run_project_confirm"); add_child(multi_run_ask); OS::get_singleton()->set_low_processor_usage_mode(true); npdialog = memnew( NewProjectDialog ); add_child(npdialog); npdialog->connect("project_created", this,"_load_recent_projects"); _load_recent_projects(); if ( EditorSettings::get_singleton()->get("global/autoscan_project_path") ) { _scan_begin( EditorSettings::get_singleton()->get("global/autoscan_project_path") ); } //get_ok()->set_text("Open"); //get_ok()->set_text("Exit"); last_clicked = ""; }
void ExportTemplateManager::_update_template_list() { while (current_hb->get_child_count()) { memdelete(current_hb->get_child(0)); } while (installed_vb->get_child_count()) { memdelete(installed_vb->get_child(0)); } DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); Error err = d->change_dir(EditorSettings::get_singleton()->get_templates_dir()); d->list_dir_begin(); Set<String> templates; if (err == OK) { bool isdir; String c = d->get_next(&isdir); while (c != String()) { if (isdir && !c.begins_with(".")) { templates.insert(c); } c = d->get_next(&isdir); } } d->list_dir_end(); memdelete(d); String current_version = itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + _MKSTR(VERSION_STATUS) + VERSION_MODULE_CONFIG; Label *current = memnew(Label); current->set_h_size_flags(SIZE_EXPAND_FILL); current_hb->add_child(current); if (templates.has(current_version)) { current->add_color_override("font_color", get_color("success_color", "Editor")); Button *redownload = memnew(Button); redownload->set_text(TTR("Re-Download")); current_hb->add_child(redownload); redownload->connect("pressed", this, "_download_template", varray(current_version)); Button *uninstall = memnew(Button); uninstall->set_text(TTR("Uninstall")); current_hb->add_child(uninstall); current->set_text(current_version + " " + TTR("(Installed)")); uninstall->connect("pressed", this, "_uninstall_template", varray(current_version)); } else { current->add_color_override("font_color", get_color("error_color", "Editor")); Button *redownload = memnew(Button); redownload->set_text(TTR("Download")); redownload->connect("pressed", this, "_download_template", varray(current_version)); current_hb->add_child(redownload); current->set_text(current_version + " " + TTR("(Missing)")); } for (Set<String>::Element *E = templates.back(); E; E = E->prev()) { HBoxContainer *hbc = memnew(HBoxContainer); Label *version = memnew(Label); version->set_modulate(get_color("disabled_font_color", "Editor")); String text = E->get(); if (text == current_version) { text += " " + TTR("(Current)"); } version->set_text(text); version->set_h_size_flags(SIZE_EXPAND_FILL); hbc->add_child(version); Button *uninstall = memnew(Button); uninstall->set_text(TTR("Uninstall")); hbc->add_child(uninstall); uninstall->connect("pressed", this, "_uninstall_template", varray(E->get())); installed_vb->add_child(hbc); } }