Don't invoke adb with no runnable Android preset

This commit is contained in:
kobewi 2024-02-01 16:02:39 +01:00
parent 9adb7c7d13
commit 343bfb112f
7 changed files with 88 additions and 7 deletions

View file

@ -110,8 +110,13 @@ void EditorExport::save_presets() {
save_timer->start();
}
void EditorExport::emit_presets_runnable_changed() {
emit_signal(_export_presets_runnable_updated);
}
void EditorExport::_bind_methods() {
ADD_SIGNAL(MethodInfo("export_presets_updated"));
ADD_SIGNAL(MethodInfo(_export_presets_updated));
ADD_SIGNAL(MethodInfo(_export_presets_runnable_updated));
}
void EditorExport::add_export_platform(const Ref<EditorExportPlatform> &p_platform) {
@ -135,6 +140,7 @@ void EditorExport::add_export_preset(const Ref<EditorExportPreset> &p_preset, in
} else {
export_presets.insert(p_at_pos, p_preset);
}
emit_presets_runnable_changed();
}
int EditorExport::get_export_preset_count() const {
@ -149,6 +155,7 @@ Ref<EditorExportPreset> EditorExport::get_export_preset(int p_idx) {
void EditorExport::remove_export_preset(int p_idx) {
export_presets.remove_at(p_idx);
save_presets();
emit_presets_runnable_changed();
}
void EditorExport::add_export_plugin(const Ref<EditorExportPlugin> &p_plugin) {
@ -380,6 +387,10 @@ bool EditorExport::poll_export_platforms() {
return changed;
}
void EditorExport::connect_presets_runnable_updated(const Callable &p_target) {
connect(_export_presets_runnable_updated, p_target);
}
EditorExport::EditorExport() {
save_timer = memnew(Timer);
add_child(save_timer);
@ -388,6 +399,7 @@ EditorExport::EditorExport() {
save_timer->connect("timeout", callable_mp(this, &EditorExport::_save));
_export_presets_updated = "export_presets_updated";
_export_presets_runnable_updated = "export_presets_runnable_updated";
singleton = this;
set_process(true);

View file

@ -41,7 +41,8 @@ class EditorExport : public Node {
Vector<Ref<EditorExportPreset>> export_presets;
Vector<Ref<EditorExportPlugin>> export_plugins;
StringName _export_presets_updated;
static inline StringName _export_presets_updated;
static inline StringName _export_presets_runnable_updated;
Timer *save_timer = nullptr;
bool block_save = false;
@ -54,6 +55,7 @@ class EditorExport : public Node {
protected:
friend class EditorExportPreset;
void save_presets();
void emit_presets_runnable_changed();
void _notification(int p_what);
static void _bind_methods();
@ -77,6 +79,7 @@ public:
void load_config();
void update_export_presets();
bool poll_export_platforms();
void connect_presets_runnable_updated(const Callable &p_target);
EditorExport();
~EditorExport();

View file

@ -180,6 +180,7 @@ String EditorExportPreset::get_name() const {
void EditorExportPreset::set_runnable(bool p_enable) {
runnable = p_enable;
EditorExport::singleton->emit_presets_runnable_changed();
EditorExport::singleton->save_presets();
}