mirror of https://github.com/DJ2LS/FreeDATA.git
Add distance unit setting to choose between Kilometer or Miles.
parent
1721c83c7c
commit
64d41de67e
|
|
@ -32,7 +32,13 @@ function getDateTime(timestampRaw) {
|
||||||
|
|
||||||
function getMaidenheadDistance(dxGrid) {
|
function getMaidenheadDistance(dxGrid) {
|
||||||
try {
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
return distanceKm;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
@ -202,7 +208,7 @@ function transmitPing(callsign) {
|
||||||
<td>
|
<td>
|
||||||
<small>{{ item.gridsquare }}</small>
|
<small>{{ item.gridsquare }}</small>
|
||||||
</td>
|
</td>
|
||||||
<td><small>{{ getMaidenheadDistance(item.gridsquare) }} km</small></td>
|
<td><small>{{ getMaidenheadDistance(item.gridsquare) }} {{settings.remote.GUI.distance_unit}}</small></td>
|
||||||
<td>
|
<td>
|
||||||
<i
|
<i
|
||||||
:class="getActivityInfo(item.activity_type).iconClass"
|
:class="getActivityInfo(item.activity_type).iconClass"
|
||||||
|
|
|
||||||
|
|
@ -150,6 +150,34 @@
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</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>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -171,6 +199,10 @@ function saveSettings() {
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
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 {
|
return {
|
||||||
availableLanguages, // imported from i18next configuration
|
availableLanguages, // imported from i18next configuration
|
||||||
settings,
|
settings,
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,11 @@
|
||||||
"colormode_help": "Set the GUI color mode",
|
"colormode_help": "Set the GUI color mode",
|
||||||
"colormodelight": "light",
|
"colormodelight": "light",
|
||||||
"colormodedark": "dark",
|
"colormodedark": "dark",
|
||||||
"colormodeauto": "auto"
|
"colormodeauto": "auto",
|
||||||
|
"distanceunit": "Distance Unit",
|
||||||
|
"distanceunit_help": "Select the preferred distance unit",
|
||||||
|
"distanceunitkilometers": "Kilometers",
|
||||||
|
"distanceunitmiles": "Miles"
|
||||||
},
|
},
|
||||||
"station": {
|
"station": {
|
||||||
"introduction": "Station related settings, like changing your callsign, location and general behaviour.",
|
"introduction": "Station related settings, like changing your callsign, location and general behaviour.",
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ const defaultConfig = {
|
||||||
|
|
||||||
GUI: {
|
GUI: {
|
||||||
auto_run_browser: true,
|
auto_run_browser: true,
|
||||||
|
distance_unit: "km",
|
||||||
},
|
},
|
||||||
EXP: {
|
EXP: {
|
||||||
enable_ring_buffer: false,
|
enable_ring_buffer: false,
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ adif_wavelog_api_key = API-KEY
|
||||||
|
|
||||||
[GUI]
|
[GUI]
|
||||||
auto_run_browser = True
|
auto_run_browser = True
|
||||||
|
distance_unit = km
|
||||||
|
|
||||||
[EXP]
|
[EXP]
|
||||||
enable_ring_buffer = False
|
enable_ring_buffer = False
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ class CONFIG:
|
||||||
|
|
||||||
'GUI': {
|
'GUI': {
|
||||||
'auto_run_browser': bool,
|
'auto_run_browser': bool,
|
||||||
|
'distance_unit': str,
|
||||||
},
|
},
|
||||||
'EXP': {
|
'EXP': {
|
||||||
'enable_ring_buffer': bool,
|
'enable_ring_buffer': bool,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue