System: options are now saved between -set files, and refine GUI
This commit is contained in:
parent
983c32b3b4
commit
144ec8ef01
6 changed files with 156 additions and 12 deletions
|
@ -484,7 +484,7 @@
|
|||
<fault type="bool">false</fault>
|
||||
</ir>
|
||||
<onbat type="bool">false</onbat>
|
||||
<skip userarchive="y" type="bool">0</skip>
|
||||
<skip type="bool">0</skip>
|
||||
</adirs>
|
||||
<APU>
|
||||
<fire-btn type="bool">0</fire-btn>
|
||||
|
@ -631,7 +631,6 @@
|
|||
<tray n="0">
|
||||
<lefttrayext type="double">0</lefttrayext>
|
||||
<righttrayext type="double">0</righttrayext>
|
||||
<suprise userarchive="y" type="bool">0</suprise>
|
||||
</tray>
|
||||
</controls>
|
||||
|
||||
|
@ -729,7 +728,7 @@
|
|||
|
||||
<options n="0">
|
||||
<system n="0">
|
||||
<keyboard-mode userarchive="y" type="bool">0</keyboard-mode>
|
||||
<keyboard-mode type="bool">0</keyboard-mode>
|
||||
</system>
|
||||
<steep-ils type="bool">0</steep-ils>
|
||||
<steep-ils-avail type="bool">0</steep-ils-avail>
|
||||
|
|
|
@ -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 #
|
||||
|
|
|
@ -340,7 +340,7 @@
|
|||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
acconfig.saveSettings();
|
||||
acconfig.writeSettings();
|
||||
</script>
|
||||
</binding>
|
||||
<live>true</live>
|
||||
|
@ -360,7 +360,7 @@
|
|||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
acconfig.saveSettings();
|
||||
acconfig.writeSettings();
|
||||
</script>
|
||||
</binding>
|
||||
<live>true</live>
|
||||
|
|
102
AircraftConfig/updated.xml
Normal file
102
AircraftConfig/updated.xml
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!--
|
||||
##############################################
|
||||
# Copyright (c) Joshua Davidson (it0uchpods) #
|
||||
##############################################
|
||||
-->
|
||||
|
||||
<!-- A3XX Aircraft Config Dialog -->
|
||||
|
||||
<PropertyList>
|
||||
|
||||
<name>aircraft-config-update</name>
|
||||
<layout>vbox</layout>
|
||||
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>Hello!</label>
|
||||
</text>
|
||||
<button>
|
||||
<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>
|
||||
<color>
|
||||
<red>1.0</red>
|
||||
<green>1.0</green>
|
||||
<blue>1.0</blue>
|
||||
<alpha>0.9</alpha>
|
||||
</color>
|
||||
</hrule>
|
||||
|
||||
<group>
|
||||
<layout>vbox</layout>
|
||||
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>IDG Aircraft Config has detected that your aircraft was installed for the first time, or updated successfully!</label>
|
||||
</text>
|
||||
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
<halign>left</halign>
|
||||
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>You are now running Revision: </label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<border>1</border>
|
||||
<label>99999</label>
|
||||
<property>/systems/acconfig/options/revision</property>
|
||||
<live>1</live>
|
||||
</text>
|
||||
|
||||
</group>
|
||||
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>Some aircraft settings may have been returned to their defaults.</label>
|
||||
</text>
|
||||
|
||||
<text>
|
||||
<halign>left</halign>
|
||||
<label>This screen will only appear after a fresh install, or update. Thank you for choosing IDG!</label>
|
||||
</text>
|
||||
</group>
|
||||
|
||||
<hrule/>
|
||||
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
|
||||
<button>
|
||||
<halign>center</halign>
|
||||
<legend>Continue</legend>
|
||||
<pref-width>350</pref-width>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
acconfig.welcome_dlg.open();
|
||||
</script>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>dialog-close</command>
|
||||
</binding>
|
||||
</button>
|
||||
</group>
|
||||
|
||||
</PropertyList>
|
|
@ -59,6 +59,33 @@
|
|||
|
||||
</group>
|
||||
|
||||
<hrule/>
|
||||
|
||||
<group>
|
||||
<layout>hbox</layout>
|
||||
|
||||
<checkbox>
|
||||
<label>Do not show this screen at FlightGear startup</label>
|
||||
<halign>center</halign>
|
||||
<property>/systems/acconfig/options/welcome-skip</property>
|
||||
<binding>
|
||||
<command>property-toggle</command>
|
||||
<property>/systems/acconfig/options/welcome-skip</property>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>dialog-apply</command>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
acconfig.writeSettings();
|
||||
</script>
|
||||
</binding>
|
||||
<live>true</live>
|
||||
</checkbox>
|
||||
|
||||
</group>
|
||||
|
||||
<hrule/>
|
||||
|
||||
<group>
|
||||
|
|
|
@ -1 +1 @@
|
|||
4330
|
||||
4400
|
Reference in a new issue