diff options
author | Pawel Kowal <pkowal1982@gmail.com> | 2016-11-08 20:08:07 +0100 |
---|---|---|
committer | Pawel Kowal <pkowal1982@gmail.com> | 2016-11-08 20:08:07 +0100 |
commit | 938f9388ddc5b3def60e4aefbeb1beed09599493 (patch) | |
tree | 7ffcb30db4608e8dd9fcfba0d27fadccaa8cddf0 | |
parent | cdc4664226cdc397d054b7390d0f75028d40412c (diff) |
Export immediately if only one device present
-rw-r--r-- | tools/editor/editor_run_native.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tools/editor/editor_run_native.cpp b/tools/editor/editor_run_native.cpp index edbcc71284..330103923d 100644 --- a/tools/editor/editor_run_native.cpp +++ b/tools/editor/editor_run_native.cpp @@ -55,6 +55,7 @@ void EditorRunNative::_notification(int p_what) { small_icon->create_from_image(im); MenuButton *mb = memnew( MenuButton ); mb->get_popup()->connect("item_pressed",this,"_run_native",varray(E->get())); + mb->connect("pressed",this,"_run_native",varray(-1, E->get())); mb->set_icon(small_icon); add_child(mb); menus[E->get()]=mb; @@ -79,13 +80,16 @@ void EditorRunNative::_notification(int p_what) { if (dc==0) { mb->hide(); } else { - mb->get_popup()->clear(); mb->show(); - 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)); + if (dc == 1) { + mb->set_tooltip(eep->get_device_name(0) + "\n\n" + eep->get_device_info(0).strip_edges()); + } else { + 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()); + } } } } @@ -96,11 +100,18 @@ void EditorRunNative::_notification(int p_what) { } - void EditorRunNative::_run_native(int p_idx,const String& p_platform) { Ref<EditorExportPlatform> eep = EditorImportExport::get_singleton()->get_export_platform(p_platform); ERR_FAIL_COND(eep.is_null()); + if (p_idx == -1) { + if (eep->get_device_count() == 1) { + menus[p_platform]->get_popup()->hide(); + p_idx = 0; + } else { + return; + } + } emit_signal("native_run"); int flags=0; |