summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2016-11-11 10:52:00 +0100
committerGitHub <noreply@github.com>2016-11-11 10:52:00 +0100
commit02fba9e3963030d4cc4b60aa6b69071825cdc1e0 (patch)
treecf43c0cc16b8554d9850aa801116b4351c6e255d
parentf0f04d5082c5640ec28399bdb5456433b3350438 (diff)
parent938f9388ddc5b3def60e4aefbeb1beed09599493 (diff)
Merge pull request #7078 from pkowal1982/export_button
Export immediately if only one device present
-rw-r--r--tools/editor/editor_run_native.cpp23
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;