mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-23 00:18:37 -05:00
Add option to automatically resize columns after an aircraft is added to the table
This commit is contained in:
parent
6aa2943849
commit
27c4802a7f
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>351</width>
|
||||
<height>275</height>
|
||||
<height>289</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
@ -22,29 +22,52 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="unitsLabel">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="5" column="1">
|
||||
<widget class="QPushButton" name="font">
|
||||
<property name="toolTip">
|
||||
<string>Select a font for the table</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Units</string>
|
||||
<string>Select...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="units">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="timeoutLabel">
|
||||
<property name="text">
|
||||
<string>Aircraft timeout (s)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="airportRange">
|
||||
<property name="toolTip">
|
||||
<string>The units to use for altitude, speed and climb rate</string>
|
||||
<string>Displays airports within the specified distance in kilometres from My Position</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ft, kn, ft/min</string>
|
||||
<property name="maximum">
|
||||
<number>20000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>m, kph, m/s</string>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="heliports">
|
||||
<property name="toolTip">
|
||||
<string>When checked, heliports are displayed on the map</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Display heliports</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="timeout">
|
||||
<property name="toolTip">
|
||||
<string>How long in seconds after not receving any frames will an aircraft be removed from the table and map</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
@ -54,6 +77,43 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="airportRangeLabel">
|
||||
<property name="text">
|
||||
<string>Airport display distance (km)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="fontLabel">
|
||||
<property name="text">
|
||||
<string>Table font</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="displayStats">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Display demodulator statistics</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Display demodulator statistics</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="unitsLabel">
|
||||
<property name="text">
|
||||
<string>Units</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="airportSize">
|
||||
<property name="toolTip">
|
||||
@ -76,75 +136,31 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="heliports">
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="autoResizeTableColumns">
|
||||
<property name="toolTip">
|
||||
<string>When checked, heliports are displayed on the map</string>
|
||||
<string>Resize the columns in the table after an aircraft is added to it</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Display heliports</string>
|
||||
<string>Resize columns after adding aircraft</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="airportRangeLabel">
|
||||
<property name="text">
|
||||
<string>Airport display distance (km)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="airportRange">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="units">
|
||||
<property name="toolTip">
|
||||
<string>Displays airports within the specified distance in kilometres from My Position</string>
|
||||
<string>The units to use for altitude, speed and climb rate</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>20000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="timeoutLabel">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Aircraft timeout (s)</string>
|
||||
<string>ft, kn, ft/min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="timeout">
|
||||
<property name="toolTip">
|
||||
<string>How long in seconds after not receving any frames will an aircraft be removed from the table and map</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="fontLabel">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Table font</string>
|
||||
<string>m, kph, m/s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QPushButton" name="font">
|
||||
<property name="toolTip">
|
||||
<string>Select a font for the table</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="displayStats">
|
||||
<property name="toolTip">
|
||||
<string>Display demodulator statistics</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Display demodulator statistics</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -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"));
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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.
|
||||
|
||||
<h3>12: Display Flight Paths</h3>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user