Skip to content

Commit

Permalink
Online map: Double-Clicking the IBP callsign in the online map tunes …
Browse files Browse the repository at this point in the history
…the frequency
  • Loading branch information
foldynl committed Sep 17, 2023
1 parent a010115 commit 30c8783
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
TBC - 0.28.0
- [NEW] - Added ON4KST Chat Support
- [NEW] - Added Az BeamWidth and Az Offset to Antenna Profile
- [NEW] - Double-Clicking the IBP callsign in the online map tunes the frequency
- Fixed Browse button should open an expecting folder (issue #241)
- Fixed Reword QSL buttons and Settings in QSO Details and Settings (issue #242)

Expand Down
21 changes: 18 additions & 3 deletions res/map/onlinemap.html
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,13 @@
}

// Definition for IBP
const band = ["20m", "17m","15m","12m","10m"];
const band = [{band_name :"20m", freq : 14.1},
{band_name :"17m", freq : 18.11},
{band_name :"15m", freq : 21.15},
{band_name :"12m", freq : 24.93},
{band_name :"10m", freq : 28.2},
];

const beacons = [{name: '4U1UN', lat: 40.7501, lon: -73.9682, active: true},
{name: 'VE8AT', lat: 79.9949, lon: -85.8451, active: true},
{name: 'W6WX', lat: 37.1599, lon: -121.9083, active: true},
Expand All @@ -334,10 +340,15 @@
{name: 'LU4AA', lat: -34.6439, lon: -58.4138, active: true},
{name: 'OA4B', lat: -12.0940, lon: -77.0165, active: true},
{name: 'YV5B', lat: 9.0964, lon: -67.8239, active: true}]
var currentBand=""; // to control which band is displayed
var currentBand=""; // to control which band is displayed - QLog core sets it.
var IBPLayer = L.layerGroup().addTo(map);
var prevStationIndex = -1;

function IBPCallsignPressed(e) {
let currentIndex = band.findIndex(object => {return object.band_name === currentBand;});
foo.IBPCallsignClicked(this.callsign, band[currentIndex].freq);
}

// render IPB Beacon Point
function beaconPoint(beacon, color) {
let pointColor = color
Expand All @@ -352,7 +363,11 @@
}
let markerMirror = new L.marker([beacon.lat, mirrorLon], {opacity: 0.001 });
marker.bindTooltip(beacon.name, {permanent: true, direction : 'bottom', offset: [-16, 8], className: 'muf-tooltip' });
marker.on('dblclick', IBPCallsignPressed);
marker.callsign = beacon.name;
markerMirror.bindTooltip(beacon.name, {permanent: true, direction : 'bottom', offset: [-16, 8], className: 'muf-tooltip' });
markerMirror.on('dblclick', IBPCallsignPressed);
markerMirror.callsign = beacon.name;
marker.getTooltip().setContent(`<div style="background-color: ${pointColor};border-radius: 20px;padding: 5px;font-weight: bold;">${marker.getTooltip().getContent()}</div>`);
markerMirror.getTooltip().setContent(`<div style="background-color: ${pointColor};border-radius: 20px;padding: 5px;font-weight: bold;">${markerMirror.getTooltip().getContent()}</div>`);
IBPLayer.addLayer(marker);
Expand All @@ -362,7 +377,7 @@
// Update IPB Beacon Points
function updateBeacon() {

currentBandIndex = band.indexOf(currentBand);
currentBandIndex = band.findIndex(object => {return object.band_name === currentBand;});

if ( currentBandIndex == -1 ) {
IBPLayer.clearLayers();
Expand Down
7 changes: 7 additions & 0 deletions ui/MapWebChannelHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,10 @@ void MapWebChannelHandler::chatCallsignClicked(const QVariant &data)

emit chatCallsignPressed(data.toString());
}

void MapWebChannelHandler::IBPCallsignClicked(const QVariant &callsign, const QVariant &freq)
{
FCT_IDENTIFICATION;

emit IBPPressed(callsign.toString(), freq.toDouble());
}
3 changes: 3 additions & 0 deletions ui/MapWebChannelHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ class MapWebChannelHandler : public QObject

signals:
void chatCallsignPressed(QString);
void IBPPressed(QString, double);

public slots:
void handleLayerSelectionChanged(const QVariant &data,
const QVariant &state);
void chatCallsignClicked(const QVariant &data);
void IBPCallsignClicked(const QVariant &callsign,
const QVariant &freq);
private:
QString configID;

Expand Down
11 changes: 11 additions & 0 deletions ui/OnlineMapWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "data/Band.h"
#include "data/Data.h"
#include "core/Rotator.h"
#include "core/Rig.h"

MODULE_IDENTIFICATION("qlog.ui.onlinemapwidget");

Expand Down Expand Up @@ -54,6 +55,7 @@ OnlineMapWidget::OnlineMapWidget(QWidget *parent):
connect(Rotator::instance(), &Rotator::rotConnected, this, &OnlineMapWidget::rotConnected);
connect(Rotator::instance(), &Rotator::rotDisconnected, this, &OnlineMapWidget::rotDisconnected);
connect(&webChannelHandler, &MapWebChannelHandler::chatCallsignPressed, this, &OnlineMapWidget::chatCallsignTrigger);
connect(&webChannelHandler, &MapWebChannelHandler::IBPPressed, this, &OnlineMapWidget::IBPCallsignTrigger);
}

void OnlineMapWidget::setTarget(double lat, double lon)
Expand Down Expand Up @@ -287,6 +289,15 @@ void OnlineMapWidget::chatCallsignTrigger(QString callsign)
emit chatCallsignPressed(callsign);
}

void OnlineMapWidget::IBPCallsignTrigger(const QString &callsign, double freq)
{
FCT_IDENTIFICATION;

qCDebug(function_parameters) << callsign << freq;

Rig::instance()->setFrequency(MHz(freq));
}

void OnlineMapWidget::runJavaScript(QString &js)
{
FCT_IDENTIFICATION;
Expand Down
1 change: 1 addition & 0 deletions ui/OnlineMapWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public slots:
protected slots:
void finishLoading(bool);
void chatCallsignTrigger(QString);
void IBPCallsignTrigger(const QString&, double);

private:

Expand Down

0 comments on commit 30c8783

Please sign in to comment.