1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -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 "ui_adsbdemodgui.h"
#include "device/deviceapi.h"
#include "channel/channelwebapiutils.h"
#include "feature/featurewebapiutils.h"
#include "plugin/pluginapi.h"
@ -2827,6 +2828,8 @@ void ADSBDemodGUI::updateDeviceSetList()
{
if (m_settings.m_deviceIndex < 0) {
ui->device->setCurrentIndex(0);
} else if (m_settings.m_deviceIndex >= deviceUISets.size()) {
ui->device->setCurrentIndex(deviceUISets.size() - 1);
} else {
ui->device->setCurrentIndex(m_settings.m_deviceIndex);
}
@ -2847,13 +2850,6 @@ void ADSBDemodGUI::updateDeviceSetList()
ui->device->blockSignals(false);
}
void ADSBDemodGUI::on_devicesRefresh_clicked()
{
updateDeviceSetList();
displaySettings();
applySettings();
}
void ADSBDemodGUI::on_device_currentIndexChanged(int index)
{
if (index >= 0)
@ -3821,6 +3817,10 @@ ADSBDemodGUI::ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
connect(&m_planeSpotters, &PlaneSpotters::aircraftPhoto, this, &ADSBDemodGUI::aircraftPhoto);
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();
displaySettings();
applySettings(true);
@ -3830,6 +3830,8 @@ ADSBDemodGUI::ADSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleImportReply(QNetworkReply*)));
applyImportSettings();
connect(&m_redrawMapTimer, &QTimer::timeout, this, &ADSBDemodGUI::redrawMap);
m_redrawMapTimer.setSingleShot(true);
ui->map->installEventFilter(this);
}
@ -3845,6 +3847,8 @@ ADSBDemodGUI::~ADSBDemodGUI()
disconnect(&m_openAIP, &OpenAIP::downloadAirspaceFinished, this, &ADSBDemodGUI::downloadAirspaceFinished);
disconnect(&m_openAIP, &OpenAIP::downloadNavAidsFinished, this, &ADSBDemodGUI::downloadNavAidsFinished);
disconnect(&m_planeSpotters, &PlaneSpotters::aircraftPhoto, this, &ADSBDemodGUI::aircraftPhoto);
disconnect(&m_redrawMapTimer, &QTimer::timeout, this, &ADSBDemodGUI::redrawMap);
m_redrawMapTimer.stop();
delete ui;
qDeleteAll(m_aircraft);
if (m_airportInfo) {
@ -4393,9 +4397,7 @@ void ADSBDemodGUI::showEvent(QShowEvent *event)
{
// Workaround for https://bugreports.qt.io/browse/QTBUG-100333
// MapQuickItems can be in wrong position when window is first displayed
QTimer::singleShot(500, [this] {
redrawMap();
});
m_redrawMapTimer.start(500);
}
}

View File

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

View File

@ -728,20 +728,6 @@
</property>
</spacer>
</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>
<widget class="QLabel" name="label">
<property name="text">
@ -1334,7 +1320,6 @@
<tabstop>logFilename</tabstop>
<tabstop>logOpen</tabstop>
<tabstop>findOnMapFeature</tabstop>
<tabstop>devicesRefresh</tabstop>
<tabstop>device</tabstop>
<tabstop>adsbData</tabstop>
<tabstop>map</tabstop>