本文整理汇总了C++中ConfirmationDialog::popup_centered方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfirmationDialog::popup_centered方法的具体用法?C++ ConfirmationDialog::popup_centered怎么用?C++ ConfirmationDialog::popup_centered使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfirmationDialog
的用法示例。
在下文中一共展示了ConfirmationDialog::popup_centered方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _import
void _import() {
if (source->get_line_edit()->get_text()=="") {
error_dialog->set_text("No source font file!");
error_dialog->popup_centered(Size2(200,100));
return;
}
if (dest->get_line_edit()->get_text()=="") {
error_dialog->set_text("No target font resource!");
error_dialog->popup_centered(Size2(200,100));
return;
}
Ref<ResourceImportMetadata> rimd = get_rimd();
if (rimd.is_null()) {
error_dialog->set_text("Can't load/process source font");
error_dialog->popup_centered(Size2(200,100));
return;
}
Error err = plugin->import(dest->get_line_edit()->get_text(),rimd);
if (err!=OK) {
error_dialog->set_text("Could't save font.");
error_dialog->popup_centered(Size2(200,100));
return;
}
//_import_inc(dest->get_line_edit()->get_text());
hide();
}
示例2: _import
void _import() {
Vector<String> samples = import_path->get_text().split(",");
if (samples.size()==0) {
error_dialog->set_text(TTR("No samples to import!"));
error_dialog->popup_centered(Size2(200,100));
}
if (save_path->get_text().strip_edges()=="") {
error_dialog->set_text(TTR("Target path is empty."));
error_dialog->popup_centered_minsize();
return;
}
if (!save_path->get_text().begins_with("res://")) {
error_dialog->set_text(TTR("Target path must be full resource path."));
error_dialog->popup_centered_minsize();
return;
}
if (!DirAccess::exists(save_path->get_text())) {
error_dialog->set_text(TTR("Target path must exist."));
error_dialog->popup_centered_minsize();
return;
}
for(int i=0;i<samples.size();i++) {
Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
List<PropertyInfo> pl;
options->_get_property_list(&pl);
for(List<PropertyInfo>::Element *E=pl.front();E;E=E->next()) {
Variant v;
String opt=E->get().name;
options->_get(opt,v);
imd->set_option(opt,v);
}
imd->add_source(EditorImportPlugin::validate_source_path(samples[i]));
String dst = save_path->get_text();
if (dst=="") {
error_dialog->set_text(TTR("Save path is empty!"));
error_dialog->popup_centered(Size2(200,100));
}
dst = dst.plus_file(samples[i].get_file().basename()+".smp");
Error err = plugin->import(dst,imd);
}
hide();
}
示例3: _import_confirm
void EditorSceneImportDialog::_import_confirm() {
wip_blocked=true;
print_line("import confirm!");
Error err = plugin->import2(wip_import,wip_save_file,wip_rimd);
wip_blocked=false;
wip_import=NULL;
wip_rimd=Ref<ResourceImportMetadata>();
confirm_import->hide();
if (err) {
wip_save_file="";
error_dialog->set_text("Error importing scene.");
error_dialog->popup_centered(Size2(200,100));
return;
}
if (wip_open)
EditorNode::get_singleton()->load_scene(wip_save_file);
wip_open=false;
wip_save_file="";
hide();
}
示例4: _import
void _import() {
Vector<String> bitmasks = import_path->get_text().split(",");
if (bitmasks.size() == 0) {
error_dialog->set_text(TTR("No bit masks to import!"));
error_dialog->popup_centered(Size2(200, 100)*EDSCALE);
}
if (save_path->get_text().strip_edges() == "") {
error_dialog->set_text(TTR("Target path is empty."));
error_dialog->popup_centered_minsize();
return;
}
if (!save_path->get_text().begins_with("res://")) {
error_dialog->set_text(TTR("Target path must be a complete resource path."));
error_dialog->popup_centered_minsize();
return;
}
if (!DirAccess::exists(save_path->get_text())) {
error_dialog->set_text(TTR("Target path must exist."));
error_dialog->popup_centered_minsize();
return;
}
for (int i = 0; i<bitmasks.size(); i++) {
Ref<ResourceImportMetadata> imd = memnew(ResourceImportMetadata);
imd->add_source(EditorImportPlugin::validate_source_path(bitmasks[i]));
String dst = save_path->get_text();
if (dst == "") {
error_dialog->set_text(TTR("Save path is empty!"));
error_dialog->popup_centered(Size2(200, 100)*EDSCALE);
}
dst = dst.plus_file(bitmasks[i].get_file().get_basename() + ".pbm");
plugin->import(dst, imd);
}
hide();
}
示例5: _import
void _import() {
if (items.size()==0) {
error_dialog->set_text(TTR("No items to import!"));
error_dialog->popup_centered(Size2(200,100));
}
if (!save_path->get_text().begins_with("res://")) {
error_dialog->set_text(TTR("No target path!"));
error_dialog->popup_centered(Size2(200,100));
}
EditorProgress progress("import_xl",TTR("Import Translations"),items.size());
for(int i=0;i<items.size();i++) {
progress.step(items[i]->get_metadata(1),i);
if (!items[i]->is_checked(0))
continue;
String locale = TranslationServer::get_all_locales()[items[i]->get_range(1)];
Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
imd->add_source(EditorImportPlugin::validate_source_path(import_path->get_text()));
imd->set_option("locale",locale);
imd->set_option("index",i);
imd->set_option("skip_first",ignore_first->is_pressed());
imd->set_option("compress",compress->is_pressed());
String savefile = save_path->get_text().plus_file(import_path->get_text().get_file().basename()+"."+locale+".xl");
Error err = plugin->import(savefile,imd);
if (err!=OK) {
error_dialog->set_text(TTR("Couldn't import!"));
error_dialog->popup_centered(Size2(200,100));
} else if (add_to_project->is_pressed()) {
ProjectSettings::get_singleton()->add_translation(savefile);
}
}
hide();
}
示例6: _choose_file
void _choose_file(const String& p_path) {
import_path->set_text(p_path);
FileAccess *f = FileAccess::open(p_path,FileAccess::READ);
if (!f) {
error_dialog->set_text(TTR("Invalid source!"));
error_dialog->popup_centered(Size2(200,100));
return;
}
Vector<String> csvh = f->get_csv_line();
memdelete(f);
if (csvh.size()<2) {
error_dialog->set_text(TTR("Invalid translation source!"));
error_dialog->popup_centered(Size2(200,100));
return;
}
columns->clear();
columns->set_columns(2);
TreeItem *root = columns->create_item();
columns->set_hide_root(true);
columns->set_column_titles_visible(true);
columns->set_column_title(0,TTR("Column"));
columns->set_column_title(1,TTR("Language"));
Vector<String> langs = TranslationServer::get_all_locales();
Vector<String> names = TranslationServer::get_all_locale_names();
if (csvh[0]=="")
ignore_first->set_pressed(true);
items.clear();
for(int i=1;i<csvh.size();i++) {
TreeItem *ti = columns->create_item(root);
ti->set_editable(0,true);
ti->set_selectable(0,false);
ti->set_cell_mode(0,TreeItem::CELL_MODE_CHECK);
ti->set_checked(0,true);
ti->set_text(0,itos(i));
items.push_back(ti);
String lname = csvh[i].to_lower().strip_edges();
int idx=-1;
String hint;
for(int j=0;j<langs.size();j++) {
if (langs[j]==lname.substr(0,langs[j].length()).to_lower()) {
idx=j;
}
if (j>0) {
hint+=",";
}
hint+=names[j].replace(","," ");
}
ti->set_cell_mode(1,TreeItem::CELL_MODE_RANGE);
ti->set_text(1,hint);
ti->set_editable(1,true);
if (idx!=-1) {
ignore_first->set_pressed(true);
ti->set_range(1,idx);
} else {
//not found, maybe used stupid name
if (lname.begins_with("br")) //brazilian
ti->set_range(1,langs.find("pt"));
else if (lname.begins_with("ch")) //chinese
ti->set_range(1,langs.find("zh"));
else if (lname.begins_with("sp")) //spanish
ti->set_range(1,langs.find("es"));
else if (lname.begins_with("kr"))// kprean
ti->set_range(1,langs.find("ko"));
else if (i==0)
ti->set_range(1,langs.find("en"));
else
ti->set_range(1,langs.find("es"));
}
ti->set_metadata(1,names[ti->get_range(1)]);
}
}
示例7: _import
void EditorSceneImportDialog::_import(bool p_and_open) {
wip_open=p_and_open;
//' ImportMonitorBlock imb;
if (import_path->get_text()=="") {
error_dialog->set_text("Source path is empty.");
error_dialog->popup_centered(Size2(200,100));
return;
}
if (save_path->get_text()=="") {
error_dialog->set_text("Target path is empty.");
error_dialog->popup_centered(Size2(200,100));
return;
}
String dst_path;
if (texture_action->get_selected()==0)
dst_path=save_path->get_text();//.get_base_dir();
else
dst_path=Globals::get_singleton()->get("import/shared_textures");
uint32_t flags=0;
for(int i=0;i<scene_flags.size();i++) {
if (scene_flags[i]->is_checked(0)) {
int md = scene_flags[i]->get_metadata(0);
flags|=md;
}
}
Ref<EditorScenePostImport> pi;
if (script_path->get_text()!="") {
Ref<Script> scr = ResourceLoader::load(script_path->get_text());
if (!scr.is_valid()) {
error_dialog->set_text("Couldn't load Post-Import Script.");
error_dialog->popup_centered(Size2(200,100));
return;
}
pi = Ref<EditorScenePostImport>( memnew( EditorScenePostImport ) );
pi->set_script(scr.get_ref_ptr());
if (!pi->get_script_instance()) {
error_dialog->set_text("Invalid/Broken Script for Post-Import.");
error_dialog->popup_centered(Size2(200,100));
return;
}
}
String save_file = save_path->get_text().plus_file(import_path->get_text().get_file().basename()+".scn");
print_line("Saving to: "+save_file);
Node *scene=NULL;
Ref<ResourceImportMetadata> rim = memnew( ResourceImportMetadata );
rim->add_source(EditorImportPlugin::validate_source_path(import_path->get_text()));
rim->set_option("flags",flags);
rim->set_option("texture_flags",texture_options->get_flags());
rim->set_option("texture_format",texture_options->get_format());
rim->set_option("texture_quality",texture_options->get_quality());
rim->set_option("animation_flags",animation_options->get_flags());
rim->set_option("post_import_script",script_path->get_text()!=String()?EditorImportPlugin::validate_source_path(script_path->get_text()):String());
rim->set_option("reimport",true);
List<String> missing;
Error err = plugin->import1(rim,&scene,&missing);
if (err) {
error_dialog->set_text("Error importing scene.");
error_dialog->popup_centered(Size2(200,100));
return;
}
if (missing.size()) {
missing_files->clear();
for(List<String>::Element *E=missing.front();E;E=E->next()) {
missing_files->add_text(E->get());
missing_files->add_newline();
}
wip_import=scene;
wip_rimd=rim;
wip_save_file=save_file;
confirm_import->popup_centered_ratio();
return;
//.........这里部分代码省略.........
示例8: _import
void EditorTextureImportDialog::_import() {
// ImportMonitorBlock imb;
Vector<String> files=import_path->get_text().split(",");
if (!files.size()) {
error_dialog->set_text("Please specify some files!");
error_dialog->popup_centered(Size2(200,100));
return;
}
String dst_path=save_path->get_text();
if (save_path->get_text().strip_edges()=="") {
error_dialog->set_text("Target path is empty.");
error_dialog->popup_centered_minsize();
return;
}
if (!save_path->get_text().begins_with("res://")) {
error_dialog->set_text("Target path must be full resource path.");
error_dialog->popup_centered_minsize();
return;
}
if (!atlas && !large && !DirAccess::exists(save_path->get_text())) {
error_dialog->set_text("Target path must exist.");
error_dialog->popup_centered_minsize();
return;
}
if (atlas) { //atlas
if (files.size()==0) {
error_dialog->set_text("At least one file needed for Atlas.");
error_dialog->popup_centered(Size2(200,100));
return;
}
String dst_file = dst_path;
//dst_file=dst_file.basename()+".tex";
Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
//imd->set_editor();
for(int i=0;i<files.size();i++) {
imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
}
imd->set_option("format",texture_options->get_format());
imd->set_option("flags",texture_options->get_flags());
imd->set_option("quality",texture_options->get_quality());
imd->set_option("atlas",true);
imd->set_option("atlas_size",int(size->get_val()));
imd->set_option("large",false);
imd->set_option("crop",crop_source->is_pressed());
Error err = plugin->import(dst_file,imd);
if (err) {
error_dialog->set_text("Error importing: "+dst_file.get_file());
error_dialog->popup_centered(Size2(200,100));
return;
}
} else if (large) { //atlas
if (files.size()!=1) {
error_dialog->set_text("Only one file is required for large texture");
error_dialog->popup_centered(Size2(200,100));
return;
}
String dst_file = dst_path;
//dst_file=dst_file.basename()+".tex";
Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
//imd->set_editor();
for(int i=0;i<files.size();i++) {
imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
}
imd->set_option("format",texture_options->get_format());
imd->set_option("flags",texture_options->get_flags());
imd->set_option("quality",texture_options->get_quality());
imd->set_option("atlas",false);
imd->set_option("large",true);
imd->set_option("large_cell_size",int(size->get_val()));
imd->set_option("crop",crop_source->is_pressed());
Error err = plugin->import(dst_file,imd);
if (err) {
error_dialog->set_text("Error importing: "+dst_file.get_file());
error_dialog->popup_centered(Size2(200,100));
return;
}
} else {
//.........这里部分代码省略.........
示例9: _import
void EditorTextureImportDialog::_import() {
// ImportMonitorBlock imb;
Vector<String> files=import_path->get_text().split(",");
if (!files.size()) {
error_dialog->set_text("Please specify some files!");
error_dialog->popup_centered(Size2(200,100));
return;
}
String dst_path=save_path->get_text();
if (dst_path.empty()) {
error_dialog->set_text("Please specify a valid target import path!");
error_dialog->popup_centered(Size2(200,100));
return;
}
if (atlas) { //atlas
if (files.size()==0) {
error_dialog->set_text("At least one file needed for Atlas.");
error_dialog->popup_centered(Size2(200,100));
return;
}
String dst_file = dst_path;
//dst_file=dst_file.basename()+".tex";
Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
//imd->set_editor();
for(int i=0;i<files.size();i++) {
imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
}
imd->set_option("format",texture_options->get_format());
imd->set_option("flags",texture_options->get_flags());
imd->set_option("quality",texture_options->get_quality());
imd->set_option("atlas",true);
imd->set_option("crop",crop_source->is_pressed());
Error err = plugin->import(dst_file,imd);
if (err) {
error_dialog->set_text("Error importing: "+dst_file.get_file());
error_dialog->popup_centered(Size2(200,100));
return;
}
} else {
for(int i=0;i<files.size();i++) {
String dst_file = dst_path.plus_file(files[i].get_file());
dst_file=dst_file.basename()+".tex";
Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
//imd->set_editor();
imd->add_source(EditorImportPlugin::validate_source_path(files[i]));
imd->set_option("format",texture_options->get_format());
imd->set_option("flags",texture_options->get_flags());
imd->set_option("quality",texture_options->get_quality());
imd->set_option("atlas",false);
Error err = plugin->import(dst_file,imd);
if (err) {
error_dialog->set_text("Error importing: "+dst_file.get_file());
error_dialog->popup_centered(Size2(200,100));
return;
}
}
}
hide();
}