diff --git a/plugins/feature/map/ibpbeacon.cpp b/plugins/feature/map/ibpbeacon.cpp index 4d3cc263a..10688373d 100644 --- a/plugins/feature/map/ibpbeacon.cpp +++ b/plugins/feature/map/ibpbeacon.cpp @@ -19,24 +19,24 @@ // Beacon information from https://www.ncdxf.org/beacon/beaconlocations.html QList IBPBeacon::m_beacons = { - IBPBeacon("4U1UN", "United Nations NY", "FN30AS", 0), - IBPBeacon("VE8AT", "North Canada", "CP38GH", 10), - IBPBeacon("W6WX", "USA (CA)", "CM97BD", 20), - IBPBeacon("KH6RS", "Hawaii", "BL10TS", 30), - IBPBeacon("ZL6B", "New Zealand", "RE78TW", 40), - IBPBeacon("VK6RBP", "West Australia", "OF87AV", 50), - IBPBeacon("JA2IGY", "Japan", "PM84JK", 60), - IBPBeacon("RR9O", "Siberia", "NO14KX", 70), - IBPBeacon("VR2B", "China", "OL72BG", 80), - IBPBeacon("4S7B", "Sri Lanka", "MJ96WV", 90), - IBPBeacon("ZS6DN", "South Africa", "KG33XI", 100), - IBPBeacon("5Z4B", "Kenya", "KI88HR", 110), - IBPBeacon("4X6TU", "Israel", "KM72JB", 120), - IBPBeacon("OH2B", "Finland", "KP20EH", 130), - IBPBeacon("CS3B", "Madeira", "IM12JT", 140), - IBPBeacon("LU4AA", "Argentina", "GF05TJ", 150), - IBPBeacon("OA4B", "Peru", "FH17MW", 160), - IBPBeacon("YV5B", "Venezuela", "FJ69CC", 170) + IBPBeacon("United Nations", "4U1UN", "New York City", "FN30AS", 0), + IBPBeacon("Canada", "VE8AT", "Inuvik (NT)", "CP38GH", 10), + IBPBeacon("United States", "W6WX", "Mt. Umunhum (CA)", "CM97BD", 20), + IBPBeacon("Hawaii", "KH6RS", "Maui ", "BL10TS", 30), + IBPBeacon("New Zealand", "ZL6B", "Masterton", "RE78TW", 40), + IBPBeacon("Australia", "VK6RBP", "Rolystone (WA)", "OF87AV", 50), + IBPBeacon("Japan", "JA2IGY", "Mt. Asama", "PM84JK", 60), + IBPBeacon("Russia", "RR9O", "Novosibirsk", "NO14KX", 70), + IBPBeacon("Hong Kong", "VR2B", "Hong Kong", "OL72BG", 80), + IBPBeacon("Sri Lanka", "4S7B", "Colombo", "MJ96WV", 90), + IBPBeacon("South Africa", "ZS6DN", "Pretoria", "KG33XI", 100), + IBPBeacon("Kenya", "5Z4B", "Kikuyu", "KI88HR", 110), + IBPBeacon("Israel", "4X6TU", "Tel Aviv", "KM72JB", 120), + IBPBeacon("Finland", "OH2B", "Lohja", "KP20EH", 130), + IBPBeacon("Madeira", "CS3B", "São Jorge", "IM12JT", 140), + IBPBeacon("Argentina", "LU4AA", "Buenos Aires", "GF05TJ", 150), + IBPBeacon("Peru", "OA4B", "Lima", "FH17MW", 160), + IBPBeacon("Venezuela", "YV5B", "Caracas", "FJ69CC", 170) }; // The frequencies in MHz through which the IBP beacons rotate diff --git a/plugins/feature/map/ibpbeacon.h b/plugins/feature/map/ibpbeacon.h index bb0f97bd5..ebb39c980 100644 --- a/plugins/feature/map/ibpbeacon.h +++ b/plugins/feature/map/ibpbeacon.h @@ -28,6 +28,7 @@ struct IBPBeacon { + QString m_dxEntity; QString m_callsign; QString m_location; QString m_locator; @@ -35,7 +36,8 @@ struct IBPBeacon { float m_latitude; float m_longitude; - IBPBeacon(const QString& callsign, const QString& location, const QString& locator, int offset) : + IBPBeacon(const QString& dxEntity, const QString& callsign, const QString& location, const QString& locator, int offset) : + m_dxEntity(dxEntity), m_callsign(callsign), m_location(location), m_locator(locator), @@ -48,6 +50,7 @@ struct IBPBeacon { { QStringList list; list.append("IBP Beacon"); + list.append(QString("DX Entity: %1").arg(m_dxEntity)); list.append(QString("Callsign: %1").arg(m_callsign)); list.append(QString("Frequency: 14.1, 18.11, 21.15, 24.93, 28.2 MHz")); list.append(QString("Power: 100 Watts ERP")); diff --git a/plugins/feature/map/mapbeacondialog.cpp b/plugins/feature/map/mapbeacondialog.cpp index 454552bf0..62a896726 100644 --- a/plugins/feature/map/mapbeacondialog.cpp +++ b/plugins/feature/map/mapbeacondialog.cpp @@ -57,8 +57,10 @@ void MapBeaconDialog::updateTable() freq->setText(beacon->getFrequencyText()); freq->setData(Qt::UserRole, beacon->m_frequency); ui->beacons->setItem(row, BEACON_COL_FREQUENCY, freq); + ui->beacons->item(row, BEACON_COL_FREQUENCY)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); ui->beacons->setItem(row, BEACON_COL_LOCATION, new QTableWidgetItem(beacon->m_locator)); ui->beacons->setItem(row, BEACON_COL_POWER, new QTableWidgetItem(beacon->m_power)); + ui->beacons->item(row, BEACON_COL_POWER)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); ui->beacons->setItem(row, BEACON_COL_POLARIZATION, new QTableWidgetItem(beacon->m_polarization)); ui->beacons->setItem(row, BEACON_COL_PATTERN, new QTableWidgetItem(beacon->m_pattern)); ui->beacons->setItem(row, BEACON_COL_KEY, new QTableWidgetItem(beacon->m_key)); @@ -66,11 +68,14 @@ void MapBeaconDialog::updateTable() azEl.setTarget(beacon->m_latitude, beacon->m_longitude, beacon->m_altitude); azEl.calculate(); ui->beacons->setItem(row, BEACON_COL_AZIMUTH, new QTableWidgetItem(QString("%1").arg(round(azEl.getAzimuth())))); + ui->beacons->item(row, BEACON_COL_AZIMUTH)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); ui->beacons->setItem(row, BEACON_COL_ELEVATION, new QTableWidgetItem(QString("%1").arg(round(azEl.getElevation())))); + ui->beacons->item(row, BEACON_COL_ELEVATION)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); int km = round(azEl.getDistance()/1000); QTableWidgetItem *dist = new QTableWidgetItem(); dist->setData(Qt::DisplayRole, km); ui->beacons->setItem(row, BEACON_COL_DISTANCE, dist); + ui->beacons->item(row, BEACON_COL_DISTANCE)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); row++; } } diff --git a/plugins/feature/map/mapbeacondialog.ui b/plugins/feature/map/mapbeacondialog.ui index 4b749b039..f8523a95f 100644 --- a/plugins/feature/map/mapbeacondialog.ui +++ b/plugins/feature/map/mapbeacondialog.ui @@ -156,12 +156,12 @@ - Azimuth + Azimuth (°) - Elevation + Elevation (°) diff --git a/plugins/feature/map/mapibpbeacondialog.cpp b/plugins/feature/map/mapibpbeacondialog.cpp index be2b96ed0..ced27ea2d 100644 --- a/plugins/feature/map/mapibpbeacondialog.cpp +++ b/plugins/feature/map/mapibpbeacondialog.cpp @@ -38,9 +38,11 @@ MapIBPBeaconDialog::MapIBPBeaconDialog(MapGUI *gui, QWidget* parent) : ui->beacons->setItem(row, IBP_BEACON_COL_FREQUENCY, new QTableWidgetItem(QString::number(IBPBeacon::m_frequencies[row], 'f', 3))); ui->beacons->setItem(row, IBP_BEACON_COL_CALLSIGN, new QTableWidgetItem("")); ui->beacons->setItem(row, IBP_BEACON_COL_LOCATION, new QTableWidgetItem("")); + ui->beacons->setItem(row, IBP_BEACON_COL_DX_ENTITY, new QTableWidgetItem("")); ui->beacons->setItem(row, IBP_BEACON_COL_AZIMUTH, new QTableWidgetItem("")); ui->beacons->setItem(row, IBP_BEACON_COL_DISTANCE, new QTableWidgetItem("")); } + resizeTable(); updateTable(QTime::currentTime()); } @@ -49,6 +51,21 @@ MapIBPBeaconDialog::~MapIBPBeaconDialog() delete ui; } +// Fill table with a row of dummy data that will size the columns nicely +void MapIBPBeaconDialog::resizeTable(void) +{ + int row = ui->beacons->rowCount(); + ui->beacons->setRowCount(row + 1); + ui->beacons->setItem(row, IBP_BEACON_COL_FREQUENCY, new QTableWidgetItem("12.345")); + ui->beacons->setItem(row, IBP_BEACON_COL_CALLSIGN, new QTableWidgetItem("12345")); + ui->beacons->setItem(row, IBP_BEACON_COL_LOCATION, new QTableWidgetItem("1234567890123456")); + ui->beacons->setItem(row, IBP_BEACON_COL_DX_ENTITY, new QTableWidgetItem("1234567890123456")); + ui->beacons->setItem(row, IBP_BEACON_COL_AZIMUTH, new QTableWidgetItem("-123")); + ui->beacons->setItem(row, IBP_BEACON_COL_DISTANCE, new QTableWidgetItem("12345")); + ui->beacons->resizeColumnsToContents(); + ui->beacons->removeRow(row); +} + void MapIBPBeaconDialog::updateTable(QTime time) { AzEl azEl = *m_gui->getAzEl(); @@ -58,15 +75,19 @@ void MapIBPBeaconDialog::updateTable(QTime time) for (int row = 0; row < IBPBeacon::m_frequencies.size(); row++) { + ui->beacons->item(row, IBP_BEACON_COL_FREQUENCY)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); ui->beacons->item(row, IBP_BEACON_COL_CALLSIGN)->setText(IBPBeacon::m_beacons[index].m_callsign); ui->beacons->item(row, IBP_BEACON_COL_LOCATION)->setText(IBPBeacon::m_beacons[index].m_location); + ui->beacons->item(row, IBP_BEACON_COL_DX_ENTITY)->setText(IBPBeacon::m_beacons[index].m_dxEntity); // Calculate azimuth and distance to beacon azEl.setTarget(IBPBeacon::m_beacons[index].m_latitude, IBPBeacon::m_beacons[index].m_longitude, 0.0); azEl.calculate(); ui->beacons->item(row, IBP_BEACON_COL_AZIMUTH)->setData(Qt::DisplayRole, round(azEl.getAzimuth())); + ui->beacons->item(row, IBP_BEACON_COL_AZIMUTH)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); int km = round(azEl.getDistance()/1000); ui->beacons->item(row, IBP_BEACON_COL_DISTANCE)->setData(Qt::DisplayRole, km); + ui->beacons->item(row, IBP_BEACON_COL_DISTANCE)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); index--; if (index < 0) { diff --git a/plugins/feature/map/mapibpbeacondialog.h b/plugins/feature/map/mapibpbeacondialog.h index 4496d8d0d..5381cf22f 100644 --- a/plugins/feature/map/mapibpbeacondialog.h +++ b/plugins/feature/map/mapibpbeacondialog.h @@ -45,10 +45,13 @@ private: QTimer m_timer; Ui::MapIBPBeaconDialog* ui; + void resizeTable(void); + enum BeaconCol { IBP_BEACON_COL_FREQUENCY, IBP_BEACON_COL_CALLSIGN, IBP_BEACON_COL_LOCATION, + IBP_BEACON_COL_DX_ENTITY, IBP_BEACON_COL_AZIMUTH, IBP_BEACON_COL_DISTANCE }; diff --git a/plugins/feature/map/mapibpbeacondialog.ui b/plugins/feature/map/mapibpbeacondialog.ui index 038ab63ea..ba637a5e7 100644 --- a/plugins/feature/map/mapibpbeacondialog.ui +++ b/plugins/feature/map/mapibpbeacondialog.ui @@ -6,7 +6,7 @@ 0 0 - 584 + 590 311 @@ -89,6 +89,11 @@ Location + + + DX Entity + + Azimuth (°) diff --git a/plugins/feature/map/mapradiotimedialog.cpp b/plugins/feature/map/mapradiotimedialog.cpp index 4f2ebf478..797944783 100644 --- a/plugins/feature/map/mapradiotimedialog.cpp +++ b/plugins/feature/map/mapradiotimedialog.cpp @@ -52,16 +52,21 @@ void MapRadioTimeDialog::updateTable() 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->item(row, TRANSMITTER_COL_FREQUENCY)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); 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))); + ui->transmitters->item(row, TRANSMITTER_COL_POWER)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); 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->item(row, TRANSMITTER_COL_AZIMUTH)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); ui->transmitters->setItem(row, TRANSMITTER_COL_ELEVATION, new QTableWidgetItem(QString("%1").arg(round(azEl.getElevation())))); + ui->transmitters->item(row, TRANSMITTER_COL_ELEVATION)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); int km = round(azEl.getDistance()/1000); QTableWidgetItem *dist = new QTableWidgetItem(); dist->setData(Qt::DisplayRole, km); ui->transmitters->setItem(row, TRANSMITTER_COL_DISTANCE, dist); + ui->transmitters->item(row, TRANSMITTER_COL_DISTANCE)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); row++; } ui->transmitters->setSortingEnabled(true);