Require only one click to deploy to Android if one device is connected

This restores changes introduced by
938f9388dd, which were reverted by
efaeebab4d.
This commit is contained in:
Hugo Locurcio 2019-04-20 17:01:16 +02:00
parent 175942dcd1
commit 34a3cad8e8
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C

View File

@ -56,7 +56,7 @@ void EditorRunNative::_notification(int p_what) {
small_icon->create_from_image(im, 0); small_icon->create_from_image(im, 0);
MenuButton *mb = memnew(MenuButton); MenuButton *mb = memnew(MenuButton);
mb->get_popup()->connect("id_pressed", this, "_run_native", varray(i)); mb->get_popup()->connect("id_pressed", this, "_run_native", varray(i));
//mb->connect("pressed", this, "_run_native", varray(-1, i)); mb->connect("pressed", this, "_run_native", varray(-1, i));
mb->set_icon(small_icon); mb->set_icon(small_icon);
add_child(mb); add_child(mb);
menus[i] = mb; menus[i] = mb;
@ -82,10 +82,14 @@ void EditorRunNative::_notification(int p_what) {
} else { } else {
mb->get_popup()->clear(); mb->get_popup()->clear();
mb->show(); mb->show();
mb->set_tooltip(TTR("Select device from the list")); if (dc == 1) {
for (int i = 0; i < dc; i++) { mb->set_tooltip(eep->get_device_name(0) + "\n\n" + eep->get_device_info(0).strip_edges());
mb->get_popup()->add_icon_item(get_icon("Play", "EditorIcons"), eep->get_device_name(i)); } else {
mb->get_popup()->set_item_tooltip(mb->get_popup()->get_item_count() - 1, eep->get_device_info(i).strip_edges()); mb->set_tooltip("Select device from the list");
for (int i = 0; i < dc; i++) {
mb->get_popup()->add_icon_item(get_icon("Play", "EditorIcons"), eep->get_device_name(i));
mb->get_popup()->set_item_tooltip(mb->get_popup()->get_item_count() - 1, eep->get_device_info(i).strip_edges());
}
} }
} }
} }
@ -99,14 +103,15 @@ void EditorRunNative::_run_native(int p_idx, int p_platform) {
Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(p_platform); Ref<EditorExportPlatform> eep = EditorExport::get_singleton()->get_export_platform(p_platform);
ERR_FAIL_COND(eep.is_null()); ERR_FAIL_COND(eep.is_null());
/*if (p_idx == -1) {
if (p_idx == -1) {
if (eep->get_device_count() == 1) { if (eep->get_device_count() == 1) {
menus[p_platform]->get_popup()->hide(); menus[p_platform]->get_popup()->hide();
p_idx = 0; p_idx = 0;
} else { } else {
return; return;
} }
}*/ }
Ref<EditorExportPreset> preset; Ref<EditorExportPreset> preset;