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) {
|
||||
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) {
|
||||
//
|
||||
}
|
||||
|
|
@ -202,7 +208,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,34 @@
|
|||
</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>
|
||||
</select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -171,6 +199,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,
|
||||
|
|
|
|||
|
|
@ -231,7 +231,11 @@
|
|||
"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"
|
||||
},
|
||||
"station": {
|
||||
"introduction": "Station related settings, like changing your callsign, location and general behaviour.",
|
||||
|
|
|
|||
|
|
@ -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