1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 08:28:36 -05:00

ADS-B: Remove device set refresh button, as now automatic. Fix possible crash on close.

This commit is contained in:
Jon Beniston 2022-03-23 09:03:42 +00:00
parent 8a3f15ba45
commit 625104c181
3 changed files with 13 additions and 26 deletions

View File

@ -38,6 +38,7 @@
#include <QtGui/private/qzipreader_p.h> #include <QtGui/private/qzipreader_p.h>
#include "ui_adsbdemodgui.h" #include "ui_adsbdemodgui.h"
#include "device/deviceapi.h"
#include "channel/channelwebapiutils.h" #include "channel/channelwebapiutils.h"
#include "feature/featurewebapiutils.h" #include "feature/featurewebapiutils.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
@ -2827,6 +2828,8 @@ void ADSBDemodGUI::updateDeviceSetList()
{ {
if (m_settings.m_deviceIndex < 0) { if (m_settings.m_deviceIndex < 0) {
ui->device->setCurrentIndex(0); ui->device->setCurrentIndex(0);
} else if (m_settings.m_deviceIndex >= deviceUISets.size()) {
ui->device->setCurrentIndex(deviceUISets.size() - 1);
} else { } else {
ui->device->setCurrentIndex(m_settings.m_deviceIndex); ui->device->setCurrentIndex(m_settings.m_deviceIndex);
} }
@ -2847,13 +2850,6 @@ void ADSBDemodGUI::updateDeviceSetList()
ui->device->blockSignals(false); ui->device->blockSignals(false);
} }
void ADSBDemodGUI::on_devicesRefresh_clicked()
{
updateDeviceSetList();
displaySettings();
applySettings();
}
void ADSBDemodGUI::on_device_currentIndexChanged(int index) void ADSBDemodGUI::on_device_currentIndexChanged(int index)
{ {
if (index >= 0) if (index >= 0)
@ -3821,6 +3817,10 @@ ADSBDemodGUI::ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
connect(&m_planeSpotters, &PlaneSpotters::aircraftPhoto, this, &ADSBDemodGUI::aircraftPhoto); connect(&m_planeSpotters, &PlaneSpotters::aircraftPhoto, this, &ADSBDemodGUI::aircraftPhoto);
connect(ui->photo, &ClickableLabel::clicked, this, &ADSBDemodGUI::photoClicked); connect(ui->photo, &ClickableLabel::clicked, this, &ADSBDemodGUI::photoClicked);
// Update device list when devices are added or removed
connect(MainCore::instance(), &MainCore::deviceSetAdded, this, &ADSBDemodGUI::updateDeviceSetList);
connect(MainCore::instance(), &MainCore::deviceSetRemoved, this, &ADSBDemodGUI::updateDeviceSetList);
updateDeviceSetList(); updateDeviceSetList();
displaySettings(); displaySettings();
applySettings(true); applySettings(true);
@ -3830,6 +3830,8 @@ ADSBDemodGUI::ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleImportReply(QNetworkReply*))); connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleImportReply(QNetworkReply*)));
applyImportSettings(); applyImportSettings();
connect(&m_redrawMapTimer, &QTimer::timeout, this, &ADSBDemodGUI::redrawMap);
m_redrawMapTimer.setSingleShot(true);
ui->map->installEventFilter(this); ui->map->installEventFilter(this);
} }
@ -3845,6 +3847,8 @@ ADSBDemodGUI::~ADSBDemodGUI()
disconnect(&m_openAIP, &OpenAIP::downloadAirspaceFinished, this, &ADSBDemodGUI::downloadAirspaceFinished); disconnect(&m_openAIP, &OpenAIP::downloadAirspaceFinished, this, &ADSBDemodGUI::downloadAirspaceFinished);
disconnect(&m_openAIP, &OpenAIP::downloadNavAidsFinished, this, &ADSBDemodGUI::downloadNavAidsFinished); disconnect(&m_openAIP, &OpenAIP::downloadNavAidsFinished, this, &ADSBDemodGUI::downloadNavAidsFinished);
disconnect(&m_planeSpotters, &PlaneSpotters::aircraftPhoto, this, &ADSBDemodGUI::aircraftPhoto); disconnect(&m_planeSpotters, &PlaneSpotters::aircraftPhoto, this, &ADSBDemodGUI::aircraftPhoto);
disconnect(&m_redrawMapTimer, &QTimer::timeout, this, &ADSBDemodGUI::redrawMap);
m_redrawMapTimer.stop();
delete ui; delete ui;
qDeleteAll(m_aircraft); qDeleteAll(m_aircraft);
if (m_airportInfo) { if (m_airportInfo) {
@ -4393,9 +4397,7 @@ void ADSBDemodGUI::showEvent(QShowEvent *event)
{ {
// Workaround for https://bugreports.qt.io/browse/QTBUG-100333 // Workaround for https://bugreports.qt.io/browse/QTBUG-100333
// MapQuickItems can be in wrong position when window is first displayed // MapQuickItems can be in wrong position when window is first displayed
QTimer::singleShot(500, [this] { m_redrawMapTimer.start(500);
redrawMap();
});
} }
} }

View File

@ -827,6 +827,7 @@ private:
QHash<QString, float> m_labelAltitudeOffset; QHash<QString, float> m_labelAltitudeOffset;
QTimer m_importTimer; QTimer m_importTimer;
QTimer m_redrawMapTimer;
QNetworkAccessManager *m_networkManager; QNetworkAccessManager *m_networkManager;
explicit ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0); explicit ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0);
@ -926,7 +927,6 @@ private slots:
void tick(); void tick();
void updateDownloadProgress(qint64 bytesRead, qint64 totalBytes); void updateDownloadProgress(qint64 bytesRead, qint64 totalBytes);
void downloadFinished(const QString& filename, bool success); void downloadFinished(const QString& filename, bool success);
void on_devicesRefresh_clicked();
void on_device_currentIndexChanged(int index); void on_device_currentIndexChanged(int index);
void feedSelect(); void feedSelect();
void on_displaySettings_clicked(); void on_displaySettings_clicked();

View File

@ -728,20 +728,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QToolButton" name="devicesRefresh">
<property name="toolTip">
<string>Refresh device list</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/recycle.png</normaloff>:/recycle.png</iconset>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
@ -1334,7 +1320,6 @@
<tabstop>logFilename</tabstop> <tabstop>logFilename</tabstop>
<tabstop>logOpen</tabstop> <tabstop>logOpen</tabstop>
<tabstop>findOnMapFeature</tabstop> <tabstop>findOnMapFeature</tabstop>
<tabstop>devicesRefresh</tabstop>
<tabstop>device</tabstop> <tabstop>device</tabstop>
<tabstop>adsbData</tabstop> <tabstop>adsbData</tabstop>
<tabstop>map</tabstop> <tabstop>map</tabstop>