From f9cbb4f708d88a3d7da9932796df9b02da4c046d Mon Sep 17 00:00:00 2001 From: Lars Toenning <dev@ltoenning.de> Date: Wed, 1 May 2019 13:20:44 +0200 Subject: [PATCH] Adding dialog for swift connection --- Nasal/gui.nas | 1 + Translations/default/menu.xml | 1 + gui/dialogs/swift_connection.xml | 133 +++++++++++++++++++++++++++++++ gui/menubar.xml | 8 ++ 4 files changed, 143 insertions(+) create mode 100644 gui/dialogs/swift_connection.xml diff --git a/Nasal/gui.nas b/Nasal/gui.nas index 1c03f56e4..b67524861 100644 --- a/Nasal/gui.nas +++ b/Nasal/gui.nas @@ -147,6 +147,7 @@ _setlistener("/sim/signals/nasal-dir-initialized", func { menuEnable("rembrandt-buffers-choice", getprop("/sim/rendering/rembrandt/enabled")); menuEnable("stereoscopic-options", !getprop("/sim/rendering/rembrandt/enabled")); menuEnable("sound-config", getprop("/sim/sound/working")); + menuEnable("swift_connection", getprop("/sim/swift/available")); # frame-per-second display var fps = props.globals.getNode("/sim/rendering/fps-display", 1); diff --git a/Translations/default/menu.xml b/Translations/default/menu.xml index 1001faabd..e5ee85f78 100644 --- a/Translations/default/menu.xml +++ b/Translations/default/menu.xml @@ -85,6 +85,7 @@ <mp-list>Pilot List</mp-list> <mp-carrier>MPCarrier Selection</mp-carrier> <lag-adjust>Lag Settings</lag-adjust> + <swift_connection>swift Connection</swift_connection> <!-- Debug menu --> <debug>Debug</debug> diff --git a/gui/dialogs/swift_connection.xml b/gui/dialogs/swift_connection.xml new file mode 100644 index 000000000..69c1a8adf --- /dev/null +++ b/gui/dialogs/swift_connection.xml @@ -0,0 +1,133 @@ +<?xml version="1.0"?> + + +<PropertyList> + <name>swift_connection</name> + <layout>vbox</layout> + <resizable>false</resizable> + + + <!-- titlebar --> + <group> + <layout>hbox</layout> + <empty> + <stretch>1</stretch> + </empty> + + <text> + <label>Swift Connection Settings</label> + </text> + + <empty> + <stretch>1</stretch> + </empty> + + <button> + <pref-width>16</pref-width> + <pref-height>16</pref-height> + <legend></legend> + <keynum>27</keynum> + <border>2</border> + <binding> + <command>dialog-close</command> + </binding> + </button> + </group> + <hrule/> + + <!-- main dialog area --> + <group> + <layout>hbox</layout> + <halign>center</halign> + <default-padding>10</default-padding> + + <button> + <legend>Start server</legend> + <equal>true</equal> + <enable> + <not> + <property>/sim/swift/serverRunning</property> + </not> + </enable> + <binding> + <command>nasal</command> + <script> + fgcommand("swiftStart", props.Node.new({ + "message": getprop("/controls/lighting/landing-lights")})); + </script> + </binding> + </button> + + <button> + <legend>Stop server</legend> + <equal>true</equal> + <enable> + <property>/sim/swift/serverRunning</property> + </enable> + <binding> + <command>nasal</command> + <script> + fgcommand("swiftStop", props.Node.new({ + "message": getprop("/controls/lighting/landing-lights")})); + </script> + </binding> + </button> + </group> + + + <group> + <layout>hbox</layout> + <row>4</row> + <col>1</col> + <text> + <width>2</width> + <halign>right</halign> + <label>Adress</label> + </text> + <input> + <pref-width>150</pref-width> + <halign>left</halign> + <property>/sim/swift/adress</property> + <enable> + <not> + <property>/sim/swift/serverRunning</property> + </not> + </enable> + </input> + <text> + <width>2</width> + <halign>right</halign> + <label>Port</label> + </text> + <input> + <pref-width>55</pref-width> + <halign>left</halign> + <property>/sim/swift/port</property> + <enable> + <not> + <property>/sim/swift/serverRunning</property> + </not> + </enable> + </input> + + </group> + + <group> + <layout>hbox</layout> + <halign>center</halign> + <default-padding>10</default-padding> + + <button> + <legend>Apply setting changes</legend> + <equal>true</equal> + <enable> + <not> + <property>/sim/swift/serverRunning</property> + </not> + </enable> + <binding> + <command>dialog-apply</command> + </binding> + </button> + </group> +</PropertyList> diff --git a/gui/menubar.xml b/gui/menubar.xml index 4432a9c2e..a08eb6851 100644 --- a/gui/menubar.xml +++ b/gui/menubar.xml @@ -649,6 +649,14 @@ <dialog-name>lag-adjust</dialog-name> </binding> </item> + + <item> + <name>swift_connection</name> + <binding> + <command>dialog-show</command> + <dialog-name>swift_connection</dialog-name> + </binding> + </item> </menu> <menu>