15 changed files with 384 additions and 7 deletions
|
After Width: | Height: | Size: 14 KiB |
@ -1,5 +1,6 @@
@@ -1,5 +1,6 @@
|
||||
<RCC> |
||||
<qresource prefix="/map/"> |
||||
<file>icons/groundtracks.png</file> |
||||
<file>icons/clock.png</file> |
||||
</qresource> |
||||
</RCC> |
||||
|
||||
|
After Width: | Height: | Size: 440 B |
|
After Width: | Height: | Size: 6.0 KiB |
@ -0,0 +1,89 @@
@@ -0,0 +1,89 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2021 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "mapradiotimedialog.h" |
||||
|
||||
#include <QDebug> |
||||
|
||||
#include "channel/channelwebapiutils.h" |
||||
#include "mapgui.h" |
||||
|
||||
MapRadioTimeDialog::MapRadioTimeDialog(MapGUI *gui, QWidget* parent) : |
||||
QDialog(parent), |
||||
m_gui(gui), |
||||
ui(new Ui::MapRadioTimeDialog) |
||||
{ |
||||
ui->setupUi(this); |
||||
// Don't call updateTable until m_gui->getAzEl() will return valid location
|
||||
} |
||||
|
||||
MapRadioTimeDialog::~MapRadioTimeDialog() |
||||
{ |
||||
delete ui; |
||||
} |
||||
|
||||
void MapRadioTimeDialog::updateTable() |
||||
{ |
||||
AzEl azEl = *m_gui->getAzEl(); |
||||
ui->transmitters->setSortingEnabled(false); |
||||
const QList<RadioTimeTransmitter> transmitters = m_gui->getRadioTimeTransmitters(); |
||||
ui->transmitters->setRowCount(0); |
||||
ui->transmitters->setRowCount(transmitters.size()); |
||||
QListIterator<RadioTimeTransmitter> i(transmitters); |
||||
int row = 0; |
||||
for (int i = 0; i < transmitters.size(); i++) |
||||
{ |
||||
ui->transmitters->setItem(row, TRANSMITTER_COL_CALLSIGN, new QTableWidgetItem(transmitters[i].m_callsign)); |
||||
QTableWidgetItem *freq = new QTableWidgetItem(); |
||||
freq->setText(QString("%1").arg(transmitters[i].m_frequency/1000.0)); |
||||
freq->setData(Qt::UserRole, transmitters[i].m_frequency); |
||||
ui->transmitters->setItem(row, TRANSMITTER_COL_FREQUENCY, freq); |
||||
ui->transmitters->setItem(row, TRANSMITTER_COL_LOCATION, new QTableWidgetItem(QString("%1,%2").arg(transmitters[i].m_latitude).arg(transmitters[i].m_longitude))); |
||||
ui->transmitters->setItem(row, TRANSMITTER_COL_POWER, new QTableWidgetItem(QString("%1").arg(transmitters[i].m_power))); |
||||
azEl.setTarget(transmitters[i].m_latitude, transmitters[i].m_longitude, 1.0); |
||||
azEl.calculate(); |
||||
ui->transmitters->setItem(row, TRANSMITTER_COL_AZIMUTH, new QTableWidgetItem(QString("%1").arg(round(azEl.getAzimuth())))); |
||||
ui->transmitters->setItem(row, TRANSMITTER_COL_ELEVATION, new QTableWidgetItem(QString("%1").arg(round(azEl.getElevation())))); |
||||
int km = round(azEl.getDistance()/1000); |
||||
QTableWidgetItem *dist = new QTableWidgetItem(); |
||||
dist->setData(Qt::DisplayRole, km); |
||||
ui->transmitters->setItem(row, TRANSMITTER_COL_DISTANCE, dist); |
||||
row++; |
||||
} |
||||
ui->transmitters->setSortingEnabled(true); |
||||
ui->transmitters->resizeColumnsToContents(); |
||||
} |
||||
|
||||
void MapRadioTimeDialog::accept() |
||||
{ |
||||
QDialog::accept(); |
||||
} |
||||
|
||||
void MapRadioTimeDialog::on_transmitters_cellDoubleClicked(int row, int column) |
||||
{ |
||||
if ((column == TRANSMITTER_COL_CALLSIGN) || (column ==TRANSMITTER_COL_LOCATION)) |
||||
{ |
||||
// Find transmitter on map
|
||||
QString location = ui->transmitters->item(row, column)->text(); |
||||
m_gui->find(location); |
||||
} |
||||
else if (column == TRANSMITTER_COL_FREQUENCY) |
||||
{ |
||||
// Tune to transmitter freq
|
||||
ChannelWebAPIUtils::setCenterFrequency(0, ui->transmitters->item(row, column)->data(Qt::UserRole).toDouble()); |
||||
} |
||||
} |
||||
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2021 Jon Beniston, M7RCE //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation as version 3 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_FEATURE_MAPRADIOTIMEDIALOG_H |
||||
#define INCLUDE_FEATURE_MAPRADIOTIMEDIALOG_H |
||||
|
||||
#include "ui_mapradiotimedialog.h" |
||||
|
||||
class MapGUI; |
||||
|
||||
class MapRadioTimeDialog : public QDialog { |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
explicit MapRadioTimeDialog(MapGUI *gui, QWidget* parent = 0); |
||||
~MapRadioTimeDialog(); |
||||
void updateTable(); |
||||
|
||||
private slots: |
||||
void accept(); |
||||
void on_transmitters_cellDoubleClicked(int row, int column); |
||||
|
||||
private: |
||||
MapGUI *m_gui; |
||||
Ui::MapRadioTimeDialog* ui; |
||||
|
||||
enum TransmitterCol { |
||||
TRANSMITTER_COL_CALLSIGN, |
||||
TRANSMITTER_COL_FREQUENCY, |
||||
TRANSMITTER_COL_LOCATION, |
||||
TRANSMITTER_COL_POWER, |
||||
TRANSMITTER_COL_AZIMUTH, |
||||
TRANSMITTER_COL_ELEVATION, |
||||
TRANSMITTER_COL_DISTANCE |
||||
}; |
||||
}; |
||||
|
||||
#endif // INCLUDE_FEATURE_MAPRADIOTIMEDIALOG_H
|
||||
@ -0,0 +1,140 @@
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<ui version="4.0"> |
||||
<class>MapRadioTimeDialog</class> |
||||
<widget class="QDialog" name="MapRadioTimeDialog"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>773</width> |
||||
<height>279</height> |
||||
</rect> |
||||
</property> |
||||
<property name="font"> |
||||
<font> |
||||
<family>Liberation Sans</family> |
||||
<pointsize>9</pointsize> |
||||
</font> |
||||
</property> |
||||
<property name="windowTitle"> |
||||
<string>Radio Time Transmitters</string> |
||||
</property> |
||||
<layout class="QVBoxLayout" name="verticalLayout"> |
||||
<item> |
||||
<widget class="QGroupBox" name="groupBox"> |
||||
<layout class="QVBoxLayout" name="verticalLayout_2"> |
||||
<property name="topMargin"> |
||||
<number>0</number> |
||||
</property> |
||||
<item> |
||||
<layout class="QHBoxLayout" name="horizontalLayout"> |
||||
<item> |
||||
<spacer name="horizontalSpacer"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="sizeHint" stdset="0"> |
||||
<size> |
||||
<width>40</width> |
||||
<height>20</height> |
||||
</size> |
||||
</property> |
||||
</spacer> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
<item> |
||||
<widget class="QTableWidget" name="transmitters"> |
||||
<property name="toolTip"> |
||||
<string/> |
||||
</property> |
||||
<column> |
||||
<property name="text"> |
||||
<string>Callsign</string> |
||||
</property> |
||||
</column> |
||||
<column> |
||||
<property name="text"> |
||||
<string>Frequency (kHz)</string> |
||||
</property> |
||||
</column> |
||||
<column> |
||||
<property name="text"> |
||||
<string>Location (°)</string> |
||||
</property> |
||||
</column> |
||||
<column> |
||||
<property name="text"> |
||||
<string>Power (kW)</string> |
||||
</property> |
||||
</column> |
||||
<column> |
||||
<property name="text"> |
||||
<string>Azimuth (°)</string> |
||||
</property> |
||||
</column> |
||||
<column> |
||||
<property name="text"> |
||||
<string>Elevation (°)</string> |
||||
</property> |
||||
</column> |
||||
<column> |
||||
<property name="text"> |
||||
<string>Distance (km)</string> |
||||
</property> |
||||
</column> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QDialogButtonBox" name="buttonBox"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Horizontal</enum> |
||||
</property> |
||||
<property name="standardButtons"> |
||||
<set>QDialogButtonBox::Close</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
<resources> |
||||
<include location="../../../sdrgui/resources/res.qrc"/> |
||||
</resources> |
||||
<connections> |
||||
<connection> |
||||
<sender>buttonBox</sender> |
||||
<signal>accepted()</signal> |
||||
<receiver>MapRadioTimeDialog</receiver> |
||||
<slot>accept()</slot> |
||||
<hints> |
||||
<hint type="sourcelabel"> |
||||
<x>248</x> |
||||
<y>254</y> |
||||
</hint> |
||||
<hint type="destinationlabel"> |
||||
<x>157</x> |
||||
<y>274</y> |
||||
</hint> |
||||
</hints> |
||||
</connection> |
||||
<connection> |
||||
<sender>buttonBox</sender> |
||||
<signal>rejected()</signal> |
||||
<receiver>MapRadioTimeDialog</receiver> |
||||
<slot>reject()</slot> |
||||
<hints> |
||||
<hint type="sourcelabel"> |
||||
<x>316</x> |
||||
<y>260</y> |
||||
</hint> |
||||
<hint type="destinationlabel"> |
||||
<x>286</x> |
||||
<y>274</y> |
||||
</hint> |
||||
</hints> |
||||
</connection> |
||||
</connections> |
||||
</ui> |
||||
Loading…
Reference in new issue