mirror of https://github.com/DJ2LS/FreeDATA.git
Merge pull request #1023 from erikdewildt/distance_unit_setting
commit
976c32479e
|
|
@ -32,7 +32,17 @@ function getDateTime(timestampRaw) {
|
|||
|
||||
function getMaidenheadDistance(dxGrid) {
|
||||
try {
|
||||
return parseInt(distance(settings.remote.STATION.mygrid, dxGrid));
|
||||
const distanceKm = parseInt(distance(settings.remote.STATION.mygrid, dxGrid));
|
||||
|
||||
if (settings.remote.GUI.distance_unit === "mi") {
|
||||
return Math.round(distanceKm * 0.621371)
|
||||
}
|
||||
|
||||
if (settings.remote.GUI.distance_unit === "nm") {
|
||||
return Math.round(distanceKm * 0.539957)
|
||||
}
|
||||
|
||||
return distanceKm;
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
|
|
@ -202,7 +212,7 @@ function transmitPing(callsign) {
|
|||
<td>
|
||||
<small>{{ item.gridsquare }}</small>
|
||||
</td>
|
||||
<td><small>{{ getMaidenheadDistance(item.gridsquare) }} km</small></td>
|
||||
<td><small>{{ getMaidenheadDistance(item.gridsquare) }} {{settings.remote.GUI.distance_unit}}</small></td>
|
||||
<td>
|
||||
<i
|
||||
:class="getActivityInfo(item.activity_type).iconClass"
|
||||
|
|
|
|||
|
|
@ -150,6 +150,37 @@
|
|||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Distance Unit Setting -->
|
||||
<div class="input-group input-group-sm mb-1">
|
||||
<span class="input-group-text w-50 text-wrap">
|
||||
{{ $t('settings.gui.distanceunit') }}
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-link p-0 ms-2"
|
||||
data-bs-toggle="tooltip"
|
||||
:title="$t('settings.gui.distanceunit_help')"
|
||||
>
|
||||
<i class="bi bi-question-circle" />
|
||||
</button>
|
||||
</span>
|
||||
<select
|
||||
id="distance_unit_selector"
|
||||
v-model="settings.remote.GUI.distance_unit"
|
||||
class="form-select form-select-sm w-50"
|
||||
@change="onChange"
|
||||
>
|
||||
<option value="km">
|
||||
{{ $t('settings.gui.distanceunitkilometers') }}
|
||||
</option>
|
||||
<option value="mi">
|
||||
{{ $t('settings.gui.distanceunitmiles') }}
|
||||
</option>
|
||||
<option value="nm">
|
||||
{{ $t('settings.gui.distanceunitnauticalmiles') }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -171,6 +202,10 @@ function saveSettings() {
|
|||
|
||||
export default {
|
||||
data() {
|
||||
// Ensure distance_unit has a default value
|
||||
if (settings.remote.GUI.distance_unit !== "km" || settings.remote.GUI.distance_unit !== "mi") {
|
||||
settings.remote.GUI.distance_unit = "km";
|
||||
}
|
||||
return {
|
||||
availableLanguages, // imported from i18next configuration
|
||||
settings,
|
||||
|
|
|
|||
|
|
@ -211,7 +211,12 @@
|
|||
"selectlanguage": "Zvolte jazyk",
|
||||
"selectlanguage_help": "Nastaví preferovaný jazyk pro GUI",
|
||||
"waterfalltheme": "Téma vodopádu",
|
||||
"waterfalltheme_help": "Nastaví barevné téma pro vodopád"
|
||||
"waterfalltheme_help": "Nastaví barevné téma pro vodopád",
|
||||
"distanceunit": "Jednotka vzdálenosti",
|
||||
"distanceunit_help": "Vyberte preferovanou jednotku vzdálenosti",
|
||||
"distanceunitkilometers": "Kilometry",
|
||||
"distanceunitmiles": "Míle",
|
||||
"distanceunitnauticalmiles": "Námořní míle"
|
||||
},
|
||||
"station": {
|
||||
"introduction": "Nastavení stanice, volací značka, lokátor a základní chování.\n",
|
||||
|
|
|
|||
|
|
@ -231,7 +231,12 @@
|
|||
"colormode_help": "Farbmodus der GUI einstellen",
|
||||
"colormodelight": "hell",
|
||||
"colormodedark": "dunkel",
|
||||
"colormodeauto": "auto"
|
||||
"colormodeauto": "auto",
|
||||
"distanceunit": "Entfernungseinheit",
|
||||
"distanceunit_help": "Wählen Sie die bevorzugte Entfernungseinheit aus",
|
||||
"distanceunitkilometers": "Kilometer",
|
||||
"distanceunitmiles": "Meilen",
|
||||
"distanceunitnauticalmiles": "Nautische Meilen"
|
||||
},
|
||||
"station": {
|
||||
"introduction": "Stationsbezogene Einstellungen, wie das Ändern des Rufzeichens, des Standorts und des allgemeinen Verhaltens.",
|
||||
|
|
|
|||
|
|
@ -231,7 +231,12 @@
|
|||
"colormode_help": "Set the GUI color mode",
|
||||
"colormodelight": "light",
|
||||
"colormodedark": "dark",
|
||||
"colormodeauto": "auto"
|
||||
"colormodeauto": "auto",
|
||||
"distanceunit": "Distance Unit",
|
||||
"distanceunit_help": "Select the preferred distance unit",
|
||||
"distanceunitkilometers": "Kilometers",
|
||||
"distanceunitmiles": "Miles",
|
||||
"distanceunitnauticalmiles": "Nautical Miles"
|
||||
},
|
||||
"station": {
|
||||
"introduction": "Station related settings, like changing your callsign, location and general behaviour.",
|
||||
|
|
|
|||
|
|
@ -231,7 +231,12 @@
|
|||
"colormode_help": "Definisci il colore della GUI",
|
||||
"colormodelight": "light",
|
||||
"colormodedark": "dark",
|
||||
"colormodeauto": "auto"
|
||||
"colormodeauto": "auto",
|
||||
"distanceunit": "Unità di distanza",
|
||||
"distanceunit_help": "Seleziona l'unità di distanza preferita",
|
||||
"distanceunitkilometers": "Chilometri",
|
||||
"distanceunitmiles": "Miglia",
|
||||
"distanceunitnauticalmiles": "Miglia nautiche"
|
||||
},
|
||||
"station": {
|
||||
"introduction": "Configurazione relativa alla stazione, quale nominativo, localizzazione e comportamento generale.",
|
||||
|
|
|
|||
|
|
@ -231,7 +231,12 @@
|
|||
"colormode_help": "Stel de GUI kleurmodus in",
|
||||
"colormodelight": "licht",
|
||||
"colormodedark": "donker",
|
||||
"colormodeauto": "automatisch"
|
||||
"colormodeauto": "automatisch",
|
||||
"distanceunit": "Afstandeenheid",
|
||||
"distanceunit_help": "Selecteer de voorkeurseenheid voor afstanden",
|
||||
"distanceunitkilometers": "Kilometers",
|
||||
"distanceunitmiles": "Mijlen",
|
||||
"distanceunitnauticalmiles": "Nautische Mijlen"
|
||||
},
|
||||
"station": {
|
||||
"introduction": "Station gerelateerde instellingen, zoals het wijzigen van uw roepnaam, locatie en algemeen gedrag.",
|
||||
|
|
|
|||
|
|
@ -228,7 +228,12 @@
|
|||
"colormode_help": "GUI-fargemodus",
|
||||
"colormodelight": "lys",
|
||||
"colormodedark": "mørk",
|
||||
"colormodeauto": "auto"
|
||||
"colormodeauto": "auto",
|
||||
"distanceunit": "Avstandsenhet",
|
||||
"distanceunit_help": "Velg foretrukket avstandsenhet",
|
||||
"distanceunitkilometers": "Kilometer",
|
||||
"distanceunitmiles": "Miles",
|
||||
"distanceunitnauticalmiles": "Nautiske miles"
|
||||
},
|
||||
"station": {
|
||||
"introduction": "Stasjonsrelaterte innstillinger, som å endre kallesignal, plassering og generell oppførsel.",
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ const defaultConfig = {
|
|||
|
||||
GUI: {
|
||||
auto_run_browser: true,
|
||||
distance_unit: "km",
|
||||
},
|
||||
EXP: {
|
||||
enable_ring_buffer: false,
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ adif_wavelog_api_key = API-KEY
|
|||
|
||||
[GUI]
|
||||
auto_run_browser = True
|
||||
distance_unit = km
|
||||
|
||||
[EXP]
|
||||
enable_ring_buffer = False
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ class CONFIG:
|
|||
|
||||
'GUI': {
|
||||
'auto_run_browser': bool,
|
||||
'distance_unit': str,
|
||||
},
|
||||
'EXP': {
|
||||
'enable_ring_buffer': bool,
|
||||
|
|
|
|||
Loading…
Reference in New Issue