From 45980c3abe33b4e218bc138c18f1a9b6cb277ec9 Mon Sep 17 00:00:00 2001 From: portree_kid Date: Fri, 13 Mar 2020 22:45:26 +0100 Subject: [PATCH] Author name in XML --- src/renderer/components/SettingsPanel.vue | 29 +++++++++++++++++++---- src/renderer/loaders/groundnet_writer.js | 5 +++- src/renderer/store/modules/Settings.js | 5 +++- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/renderer/components/SettingsPanel.vue b/src/renderer/components/SettingsPanel.vue index 4ddb055..c67fb2d 100644 --- a/src/renderer/components/SettingsPanel.vue +++ b/src/renderer/components/SettingsPanel.vue @@ -8,37 +8,43 @@
- Airports Directory + Airports Directory {{ airports_directory }} - Flightgear Directory + Flightgear Directory {{ flightgear_directory }} - AI Directory + AI Directory {{ AI_directory }} - Traffic Directory + Traffic Directory {{ Traffic_directory }} - APT File + APT File {{ apt_file }} + + Author : + + + +
@@ -68,6 +74,16 @@ } }, computed: { + name: { + // getter + get: function () { + return this.$store.state.Settings.settings.name + }, + // setter + set: function (newValue) { + this.$store.commit('SET_USERNAME', newValue) + } + }, flightgear_directory: function () { return this.$store.state.Settings.settings.flightgearDirectory }, @@ -94,4 +110,7 @@ .el-col { border-radius: 4px; } +.label { + padding: 10px; +} diff --git a/src/renderer/loaders/groundnet_writer.js b/src/renderer/loaders/groundnet_writer.js index 36cf3be..86bb991 100644 --- a/src/renderer/loaders/groundnet_writer.js +++ b/src/renderer/loaders/groundnet_writer.js @@ -31,6 +31,9 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) { var nodes = []; var arcList = []; + var version = new Date().toUTCString() + ' by FlightgearAirports'; + var name = store.default.state.Settings.settings.name; + //Frequencies var frequencies = { 'AWOS': store.default.state.Frequencies.AWOS, @@ -99,7 +102,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) { var maxId = uniqueNodes.slice(-1)[0]['@index']; - var xmlObj = { groundnet: { version: 1, frequencies, parkingList: { Parking: parkings }, TaxiNodes: { node: uniqueNodes }, TaxiWaySegments: { arc: arcList } } }; + var xmlObj = { groundnet: { version: version, name: name, frequencies, parkingList: { Parking: parkings }, TaxiNodes: { node: uniqueNodes }, TaxiWaySegments: { arc: arcList } } }; xmlString = builder.create(xmlObj).end({ pretty: true }); fs.writeFileSync(f, xmlString); diff --git a/src/renderer/store/modules/Settings.js b/src/renderer/store/modules/Settings.js index 0c22c8d..67d495c 100644 --- a/src/renderer/store/modules/Settings.js +++ b/src/renderer/store/modules/Settings.js @@ -1,5 +1,5 @@ const state = { - settings: { flightgearDirectory: '.' }, + settings: {flightgearDirectory: '.', name: ''}, zoom: 14, center: [47.413220, -1.219482], bounds: undefined @@ -24,6 +24,9 @@ const mutations = { }, 'BOUNDS' (state, bounds) { state.bounds = bounds + }, + 'SET_USERNAME' (state, name) { + state.settings.name = name } }