diff --git a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp index b43a13c53..2bad39b47 100644 --- a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp +++ b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.cpp @@ -20,9 +20,10 @@ #include "adsbdemoddisplaydialog.h" -ADSBDemodDisplayDialog::ADSBDemodDisplayDialog -(int removeTimeout, float airportRange, ADSBDemodSettings::AirportType airportMinimumSize, - bool displayHeliports, bool siUnits, QString fontName, int fontSize, bool displayDemodStats, QWidget* parent) : +ADSBDemodDisplayDialog::ADSBDemodDisplayDialog( + int removeTimeout, float airportRange, ADSBDemodSettings::AirportType airportMinimumSize, + bool displayHeliports, bool siUnits, QString fontName, int fontSize, bool displayDemodStats, + bool autoResizeTableColumns, QWidget* parent) : QDialog(parent), ui(new Ui::ADSBDemodDisplayDialog), m_fontName(fontName), @@ -35,6 +36,7 @@ ADSBDemodDisplayDialog::ADSBDemodDisplayDialog ui->heliports->setChecked(displayHeliports); ui->units->setCurrentIndex((int)siUnits); ui->displayStats->setChecked(displayDemodStats); + ui->autoResizeTableColumns->setChecked(autoResizeTableColumns); } ADSBDemodDisplayDialog::~ADSBDemodDisplayDialog() @@ -50,6 +52,7 @@ void ADSBDemodDisplayDialog::accept() m_displayHeliports = ui->heliports->isChecked(); m_siUnits = ui->units->currentIndex() == 0 ? false : true; m_displayDemodStats = ui->displayStats->isChecked(); + m_autoResizeTableColumns = ui->autoResizeTableColumns->isChecked(); QDialog::accept(); } diff --git a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.h b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.h index a8c3099c7..6ee9fb9c9 100644 --- a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.h +++ b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.h @@ -26,8 +26,8 @@ class ADSBDemodDisplayDialog : public QDialog { public: explicit ADSBDemodDisplayDialog(int removeTimeout, float airportRange, ADSBDemodSettings::AirportType airportMinimumSize, - bool displayHeliports, bool siUnits, QString fontName, int fontSize, bool displayDemodStats -, QWidget* parent = 0); + bool displayHeliports, bool siUnits, QString fontName, int fontSize, bool displayDemodStats, + bool autoResizeTableColumns, QWidget* parent = 0); ~ADSBDemodDisplayDialog(); int m_removeTimeout; @@ -38,6 +38,7 @@ public: QString m_fontName; int m_fontSize; bool m_displayDemodStats; + bool m_autoResizeTableColumns; private slots: void accept(); diff --git a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.ui b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.ui index 1f91fc2da..db428c060 100644 --- a/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.ui +++ b/plugins/channelrx/demodadsb/adsbdemoddisplaydialog.ui @@ -7,7 +7,7 @@ 0 0 351 - 275 + 289 @@ -22,29 +22,52 @@ - - - + + + + + Select a font for the table + - Units + Select... - - - - The units to use for altitude, speed and climb rate + + + + Aircraft timeout (s) + + + + + + + Displays airports within the specified distance in kilometres from My Position + + + 20000 + + + + + + + When checked, heliports are displayed on the map + + + Display heliports + + + + + + + How long in seconds after not receving any frames will an aircraft be removed from the table and map + + + 1000000 - - - ft, kn, ft/min - - - - - m, kph, m/s - - @@ -54,6 +77,43 @@ + + + + Airport display distance (km) + + + + + + + Table font + + + + + + + + 0 + 0 + + + + Display demodulator statistics + + + Display demodulator statistics + + + + + + + Units + + + @@ -76,75 +136,31 @@ - - + + - When checked, heliports are displayed on the map + Resize the columns in the table after an aircraft is added to it - Display heliports + Resize columns after adding aircraft - - - - Airport display distance (km) - - - - - + + - Displays airports within the specified distance in kilometres from My Position - - - 20000 - - - - - - - Aircraft timeout (s) - - - - - - - How long in seconds after not receving any frames will an aircraft be removed from the table and map - - - 1000000 - - - - - - - Table font - - - - - - - Select a font for the table - - - Select... - - - - - - - Display demodulator statistics - - - Display demodulator statistics + The units to use for altitude, speed and climb rate + + + ft, kn, ft/min + + + + + m, kph, m/s + + diff --git a/plugins/channelrx/demodadsb/adsbdemodgui.cpp b/plugins/channelrx/demodadsb/adsbdemodgui.cpp index f19599682..7f2c43c44 100644 --- a/plugins/channelrx/demodadsb/adsbdemodgui.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodgui.cpp @@ -703,6 +703,8 @@ void ADSBDemodGUI::handleADSB( } } } + if (m_settings.m_autoResizeTableColumns) + ui->adsbData->resizeColumnsToContents(); ui->adsbData->setSortingEnabled(true); } aircraft->m_time = dateTime; @@ -1604,7 +1606,7 @@ void ADSBDemodGUI::on_displaySettings_clicked(bool checked) ADSBDemodDisplayDialog dialog(m_settings.m_removeTimeout, m_settings.m_airportRange, m_settings.m_airportMinimumSize, m_settings.m_displayHeliports, m_settings.m_siUnits, m_settings.m_tableFontName, m_settings.m_tableFontSize, - m_settings.m_displayDemodStats); + m_settings.m_displayDemodStats, m_settings.m_autoResizeTableColumns); if (dialog.exec() == QDialog::Accepted) { bool unitsChanged = m_settings.m_siUnits != dialog.m_siUnits; @@ -1617,6 +1619,7 @@ void ADSBDemodGUI::on_displaySettings_clicked(bool checked) m_settings.m_tableFontName = dialog.m_fontName; m_settings.m_tableFontSize = dialog.m_fontSize; m_settings.m_displayDemodStats = dialog.m_displayDemodStats; + m_settings.m_autoResizeTableColumns = dialog.m_autoResizeTableColumns; if (unitsChanged) m_aircraftModel.allAircraftUpdated(); @@ -1947,7 +1950,7 @@ void ADSBDemodGUI::resizeTable() ui->adsbData->setItem(row, ADSB_COL_RANGE, new QTableWidgetItem("D (km)")); ui->adsbData->setItem(row, ADSB_COL_AZEL, new QTableWidgetItem("Az/El (o)")); ui->adsbData->setItem(row, ADSB_COL_LATITUDE, new QTableWidgetItem("-90.00000")); - ui->adsbData->setItem(row, ADSB_COL_LONGITUDE, new QTableWidgetItem("-180.00000")); + ui->adsbData->setItem(row, ADSB_COL_LONGITUDE, new QTableWidgetItem("-180.000000")); ui->adsbData->setItem(row, ADSB_COL_CATEGORY, new QTableWidgetItem("Heavy")); ui->adsbData->setItem(row, ADSB_COL_STATUS, new QTableWidgetItem("No emergency")); ui->adsbData->setItem(row, ADSB_COL_SQUAWK, new QTableWidgetItem("Squawk")); diff --git a/plugins/channelrx/demodadsb/adsbdemodsettings.cpp b/plugins/channelrx/demodadsb/adsbdemodsettings.cpp index a41153b89..464db1aa7 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsettings.cpp +++ b/plugins/channelrx/demodadsb/adsbdemodsettings.cpp @@ -60,6 +60,7 @@ void ADSBDemodSettings::resetToDefaults() m_correlateFullPreamble = true; m_demodModeS = false; m_deviceIndex = -1; + m_autoResizeTableColumns = false; for (int i = 0; i < ADSBDEMOD_COLUMNS; i++) { m_columnIndexes[i] = i; @@ -103,6 +104,7 @@ QByteArray ADSBDemodSettings::serialize() const s.writeBool(27, m_displayDemodStats); s.writeBool(28, m_correlateFullPreamble); s.writeBool(29, m_demodModeS); + s.writeBool(30, m_autoResizeTableColumns); for (int i = 0; i < ADSBDEMOD_COLUMNS; i++) s.writeS32(100 + i, m_columnIndexes[i]); @@ -179,6 +181,7 @@ bool ADSBDemodSettings::deserialize(const QByteArray& data) d.readBool(27, &m_displayDemodStats, false); d.readBool(28, &m_correlateFullPreamble, true); d.readBool(29, &m_demodModeS, false); + d.readBool(30, &m_autoResizeTableColumns, false); for (int i = 0; i < ADSBDEMOD_COLUMNS; i++) d.readS32(100 + i, &m_columnIndexes[i], i); diff --git a/plugins/channelrx/demodadsb/adsbdemodsettings.h b/plugins/channelrx/demodadsb/adsbdemodsettings.h index 3aeb13c89..c8d1d621d 100644 --- a/plugins/channelrx/demodadsb/adsbdemodsettings.h +++ b/plugins/channelrx/demodadsb/adsbdemodsettings.h @@ -73,6 +73,7 @@ struct ADSBDemodSettings bool m_correlateFullPreamble; bool m_demodModeS; //!< Demodulate all Mode-S frames, not just ADS-B int m_deviceIndex; //!< Device to set to ATC frequencies + bool m_autoResizeTableColumns; ADSBDemodSettings(); void resetToDefaults(); diff --git a/plugins/channelrx/demodadsb/readme.md b/plugins/channelrx/demodadsb/readme.md index ce04ea0c4..364e32fbb 100644 --- a/plugins/channelrx/demodadsb/readme.md +++ b/plugins/channelrx/demodadsb/readme.md @@ -64,6 +64,8 @@ Clicking the Display Settings button will open the Display Settings dialog, whic * The distance (in kilometres), from the location set under Preferences > My Position, at which airports will be displayed on the map. * The timeout, in seconds, after which an aircraft will be removed from the table and map, if an ADS-B frame has not been received from it. * The font used for the table. +* Whether demodulator statistics are displayed (primarily an option for developers). +* Whether the columns in the table are automatically resized after an aircraft is added to it. If unchecked, columns can be resized manually and should be saved with presets.

12: Display Flight Paths