diff --git a/A320-main.xml b/A320-main.xml index 8b3c955c..0420862a 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -484,7 +484,7 @@ false false - 0 + 0 0 @@ -631,7 +631,6 @@ 0 0 - 0 @@ -729,7 +728,7 @@ - 0 + 0 0 0 diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 76f32e84..eca83c2f 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -81,10 +81,14 @@ failReset(); setprop("/systems/acconfig/autoconfig-running", 0); setprop("/systems/acconfig/spinning", 0); setprop("/systems/acconfig/spin", "-"); -setprop("/systems/acconfig/new-revision", ""); +setprop("/systems/acconfig/options/revision", 0); +setprop("/systems/acconfig/new-revision", 0); setprop("/systems/acconfig/out-of-date", 0); setprop("/systems/acconfig/mismatch-code", "0x000"); setprop("/systems/acconfig/mismatch-reason", "XX"); +setprop("/systems/acconfig/options/keyboard-mode", 0); +setprop("/systems/acconfig/options/adirs-skip", 0); +setprop("/systems/acconfig/options/welcome-skip", 0); var main_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/main/dialog", "Aircraft/IDG-A32X/AircraftConfig/main.xml"); var welcome_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/welcome/dialog", "Aircraft/IDG-A32X/AircraftConfig/welcome.xml"); var ps_load_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/psload/dialog", "Aircraft/IDG-A32X/AircraftConfig/psload.xml"); @@ -95,6 +99,7 @@ var fbw_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/fbw/dialog", "Aircraft/ID var fail_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/fail/dialog", "Aircraft/IDG-A32X/AircraftConfig/fail.xml"); var about_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/about/dialog", "Aircraft/IDG-A32X/AircraftConfig/about.xml"); var update_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/update/dialog", "Aircraft/IDG-A32X/AircraftConfig/update.xml"); +var updated_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/updated/dialog", "Aircraft/IDG-A32X/AircraftConfig/updated.xml"); var error_mismatch = gui.Dialog.new("sim/gui/dialogs/acconfig/error/mismatch/dialog", "Aircraft/IDG-A32X/AircraftConfig/error-mismatch.xml"); var groundservices_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/groundsrvc/dialog", "Aircraft/IDG-A32X/AircraftConfig/groundservices.xml"); spinning.start(); @@ -103,6 +108,7 @@ init_dlg.open(); http.load("https://raw.githubusercontent.com/it0uchpods/IDG-A32X/master/revision.txt").done(func(r) setprop("/systems/acconfig/new-revision", r.response)); var revisionFile = (getprop("/sim/aircraft-dir")~"/revision.txt"); var current_revision = io.readfile(revisionFile); +setprop("/systems/acconfig/revision", current_revision); setlistener("/systems/acconfig/new-revision", func { if (getprop("/systems/acconfig/new-revision") > current_revision) { @@ -144,18 +150,28 @@ setlistener("/sim/signals/fdm-initialized", func { print("System: The IDG-A32X is out of date!"); } mismatch_chk(); - if (getprop("/systems/acconfig/out-of-date") != 1 and getprop("/systems/acconfig/mismatch-code") == "0x000") { + readSettings(); + if (getprop("/systems/acconfig/options/revision") < current_revision) { + updated_dlg.open(); + } else if (getprop("/systems/acconfig/out-of-date") != 1 and getprop("/systems/acconfig/mismatch-code") == "0x000" and getprop("/systems/acconfig/options/welcome-skip") != 1) { welcome_dlg.open(); } + setprop("/systems/acconfig/options/revision", current_revision); + writeSettings(); spinning.stop(); }); -var saveSettings = func { - aircraft.data.add("/options/system/keyboard-mode", "/controls/adirs/skip", "/controls/tray/surprise"); - aircraft.data.save(); +var readSettings = func { + io.read_properties(getprop("/sim/fg-home") ~ "/Export/IDG-A32X-config.xml", "/systems/acconfig/options"); + setprop("/options/system/keyboard-mode", getprop("/systems/acconfig/options/keyboard-mode")); + setprop("/controls/adirs/skip", getprop("/systems/acconfig/options/adirs-skip")); } -saveSettings(); +var writeSettings = func { + setprop("/systems/acconfig/options/keyboard-mode", getprop("/options/system/keyboard-mode")); + setprop("/systems/acconfig/options/adirs-skip", getprop("/controls/adirs/skip")); + io.write_properties(getprop("/sim/fg-home") ~ "/Export/IDG-A32X-config.xml", "/systems/acconfig/options"); +} ################ # Panel States # diff --git a/AircraftConfig/main.xml b/AircraftConfig/main.xml index eef6d27c..a0df2ade 100644 --- a/AircraftConfig/main.xml +++ b/AircraftConfig/main.xml @@ -340,7 +340,7 @@ nasal true @@ -360,7 +360,7 @@ nasal true diff --git a/AircraftConfig/updated.xml b/AircraftConfig/updated.xml new file mode 100644 index 00000000..b3d40d0f --- /dev/null +++ b/AircraftConfig/updated.xml @@ -0,0 +1,102 @@ + + + + + + + + + aircraft-config-update + vbox + + + hbox + + left + + + + + + + + 1.0 + 1.0 + 1.0 + 0.9 + + + + + vbox + + + left + + + + + hbox + left + + + left + + + + + left + 1 + + /systems/acconfig/options/revision + 1 + + + + + + left + + + + + left + + + + + + + + hbox + + + + + diff --git a/AircraftConfig/welcome.xml b/AircraftConfig/welcome.xml index e27a5006..7e2b4c18 100644 --- a/AircraftConfig/welcome.xml +++ b/AircraftConfig/welcome.xml @@ -59,6 +59,33 @@ + + + + hbox + + + + center + /systems/acconfig/options/welcome-skip + + property-toggle + /systems/acconfig/options/welcome-skip + + + dialog-apply + + + nasal + + + true + + + + diff --git a/revision.txt b/revision.txt index 3252c4f7..0942bb84 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4330 \ No newline at end of file +4400 \ No newline at end of file