A3XX: New system for notifying about aircraft updates

This commit is contained in:
Joshua Davidson 2017-08-11 01:49:48 -04:00
parent 8f35bdf95c
commit a412682a4b
3 changed files with 137 additions and 2 deletions

View file

@ -79,6 +79,8 @@ failReset();
setprop("/systems/acconfig/autoconfig-running", 0); setprop("/systems/acconfig/autoconfig-running", 0);
setprop("/systems/acconfig/spinning", 0); setprop("/systems/acconfig/spinning", 0);
setprop("/systems/acconfig/spin", "-"); setprop("/systems/acconfig/spin", "-");
setprop("/systems/acconfig/new-revision", "");
setprop("/systems/acconfig/out-of-date", 0);
var main_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/main/dialog", "Aircraft/A320Family/AircraftConfig/main.xml"); var main_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/main/dialog", "Aircraft/A320Family/AircraftConfig/main.xml");
var welcome_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/welcome/dialog", "Aircraft/A320Family/AircraftConfig/welcome.xml"); var welcome_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/welcome/dialog", "Aircraft/A320Family/AircraftConfig/welcome.xml");
var ps_load_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/psload/dialog", "Aircraft/A320Family/AircraftConfig/psload.xml"); var ps_load_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/psload/dialog", "Aircraft/A320Family/AircraftConfig/psload.xml");
@ -88,12 +90,30 @@ var help_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/help/dialog", "Aircraft/
var fbw_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/fbw/dialog", "Aircraft/A320Family/AircraftConfig/fbw.xml"); var fbw_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/fbw/dialog", "Aircraft/A320Family/AircraftConfig/fbw.xml");
var fail_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/fail/dialog", "Aircraft/A320Family/AircraftConfig/fail.xml"); var fail_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/fail/dialog", "Aircraft/A320Family/AircraftConfig/fail.xml");
var about_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/about/dialog", "Aircraft/A320Family/AircraftConfig/about.xml"); var about_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/about/dialog", "Aircraft/A320Family/AircraftConfig/about.xml");
var update_dlg = gui.Dialog.new("sim/gui/dialogs/acconfig/update/dialog", "Aircraft/A320Family/AircraftConfig/update.xml");
spinning.start(); spinning.start();
init_dlg.open(); init_dlg.open();
http.load("https://raw.githubusercontent.com/it0uchpods/A320Family/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);
setlistener("/systems/acconfig/new-revision", func {
if (getprop("/systems/acconfig/new-revision") > current_revision) {
setprop("/systems/acconfig/out-of-date", 1);
} else {
setprop("/systems/acconfig/out-of-date", 0);
}
});
setlistener("/sim/signals/fdm-initialized", func { setlistener("/sim/signals/fdm-initialized", func {
init_dlg.close(); init_dlg.close();
welcome_dlg.open(); if (getprop("/systems/acconfig/out-of-date") == 1) {
update_dlg.open();
print("The A320Family is out of date!");
} else {
welcome_dlg.open();
}
spinning.stop(); spinning.stop();
}); });

115
AircraftConfig/update.xml Normal file
View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
#######################################
# Copyright (c) A3XX Development Team #
#######################################
-->
<!-- A3XX Aircraft Config Dialog -->
<PropertyList>
<name>aircraft-config-update</name>
<layout>vbox</layout>
<color>
<red>0.5</red>
<green>0</green>
<blue>0</blue>
<alpha>1</alpha>
</color>
<group>
<layout>hbox</layout>
<text>
<halign>left</halign>
<label>Out of Date!</label>
</text>
<button>
<color>
<red>0.7</red>
<green>0</green>
<blue>0</blue>
<alpha>1</alpha>
</color>
<halign>right</halign>
<pref-width>20</pref-width>
<pref-height>20</pref-height>
<legend>X</legend>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>vbox</layout>
<text>
<halign>center</halign>
<label>Attention: Your A320Family is out of date! This means you are missing out on bugfixes, and new features!</label>
</text>
<text>
<halign>center</halign>
<label>You can continue for now, but it is highly recommended to download the latest version by the button below.</label>
</text>
<text>
<halign>center</halign>
<label>You will need to restart FlightGear, and install the latest.zip file.</label>
</text>
</group>
<hrule/>
<group>
<layout>hbox</layout>
<button>
<color>
<red>0</red>
<green>0.5</green>
<blue>0</blue>
<alpha>1</alpha>
</color>
<halign>center</halign>
<legend>Download Update</legend>
<pref-width>220</pref-width>
<binding>
<command>open-browser</command>
<path>https://www.github.com/it0uchpods/A320Family/archive/master.zip</path>
</binding>
<binding>
<command>exit</command>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
<button>
<color>
<red>0.7</red>
<green>0</green>
<blue>0</blue>
<alpha>1</alpha>
</color>
<halign>center</halign>
<legend>Remind Me Later</legend>
<pref-width>220</pref-width>
<binding>
<command>nasal</command>
<script>
acconfig.welcome_dlg.open();
</script>
</binding>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
</PropertyList>

View file

@ -1 +1 @@
1443 1443