From 230c461204d23dc1e675ca114320bbdad707a0ae Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Mon, 7 Aug 2023 22:36:24 +0200 Subject: [PATCH 1/5] Update the IPB beacons table only when the dialog is visible --- plugins/feature/map/mapibpbeacondialog.cpp | 16 ++++++++++++++-- plugins/feature/map/mapibpbeacondialog.h | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/feature/map/mapibpbeacondialog.cpp b/plugins/feature/map/mapibpbeacondialog.cpp index 132f240a89..942a887afb 100644 --- a/plugins/feature/map/mapibpbeacondialog.cpp +++ b/plugins/feature/map/mapibpbeacondialog.cpp @@ -32,7 +32,6 @@ MapIBPBeaconDialog::MapIBPBeaconDialog(MapGUI *gui, QWidget* parent) : ui->setupUi(this); connect(&m_timer, &QTimer::timeout, this, &MapIBPBeaconDialog::updateTime); m_timer.setInterval(1000); - m_timer.start(); ui->beacons->setRowCount(IBPBeacon::m_frequencies.size()); for (int row = 0; row < IBPBeacon::m_frequencies.size(); row++) { @@ -44,7 +43,6 @@ MapIBPBeaconDialog::MapIBPBeaconDialog(MapGUI *gui, QWidget* parent) : ui->beacons->setItem(row, IBP_BEACON_COL_DISTANCE, new QTableWidgetItem("")); } resizeTable(); - updateTable(QTime::currentTime()); } MapIBPBeaconDialog::~MapIBPBeaconDialog() @@ -126,3 +124,17 @@ void MapIBPBeaconDialog::updateTime() updateTable(t); } } + +void MapIBPBeaconDialog::showEvent(QShowEvent *event) +{ + (void) event; + updateTable(QTime::currentTime()); + updateTime(); + m_timer.start(); +} + +void MapIBPBeaconDialog::hideEvent(QHideEvent *event) +{ + (void) event; + m_timer.stop(); +} diff --git a/plugins/feature/map/mapibpbeacondialog.h b/plugins/feature/map/mapibpbeacondialog.h index 8712b2d043..f4d5b59459 100644 --- a/plugins/feature/map/mapibpbeacondialog.h +++ b/plugins/feature/map/mapibpbeacondialog.h @@ -43,6 +43,8 @@ private slots: void accept(); void on_beacons_cellDoubleClicked(int row, int column); void updateTime(); + void showEvent(QShowEvent *event); + void hideEvent(QHideEvent *event); private: MapGUI *m_gui; From f72574d1ad9d63470eac5cffdb123c34b47e1896 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sun, 14 Apr 2024 16:41:58 +0200 Subject: [PATCH 2/5] Prevent the dialogs to be hidden behind the main window This also menas that when the main window is closed, the dialogs get closed automatically, and not only when the map window is closed. --- plugins/feature/map/mapgui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/feature/map/mapgui.cpp b/plugins/feature/map/mapgui.cpp index 8bd3d6a0ba..a5056e6009 100644 --- a/plugins/feature/map/mapgui.cpp +++ b/plugins/feature/map/mapgui.cpp @@ -198,9 +198,9 @@ MapGUI::MapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *featur m_polygonMapModel(this), m_polylineMapModel(this), m_beacons(nullptr), - m_beaconDialog(this), - m_ibpBeaconDialog(this), - m_radioTimeDialog(this), + m_beaconDialog(this, this), + m_ibpBeaconDialog(this, this), + m_radioTimeDialog(this, this), m_cesium(nullptr), m_legend(nullptr), m_nasaWidget(nullptr), From f4b2dfc0a96a37f5b764b97d04c1791a927f8782 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Mon, 22 Apr 2024 22:42:00 +0200 Subject: [PATCH 3/5] Revert "Prevent the dialogs to be hidden behind the main window" This reverts commit f72574d1ad9d63470eac5cffdb123c34b47e1896. --- plugins/feature/map/mapgui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/feature/map/mapgui.cpp b/plugins/feature/map/mapgui.cpp index a5056e6009..8bd3d6a0ba 100644 --- a/plugins/feature/map/mapgui.cpp +++ b/plugins/feature/map/mapgui.cpp @@ -198,9 +198,9 @@ MapGUI::MapGUI(PluginAPI* pluginAPI, FeatureUISet *featureUISet, Feature *featur m_polygonMapModel(this), m_polylineMapModel(this), m_beacons(nullptr), - m_beaconDialog(this, this), - m_ibpBeaconDialog(this, this), - m_radioTimeDialog(this, this), + m_beaconDialog(this), + m_ibpBeaconDialog(this), + m_radioTimeDialog(this), m_cesium(nullptr), m_legend(nullptr), m_nasaWidget(nullptr), From b4ec43e4aae7471c5762bdc927a9f4a8143e1ce5 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Mon, 22 Apr 2024 23:02:59 +0200 Subject: [PATCH 4/5] Raise the Beacon, IBP Beacons an Radio Time dialogs Make the dialogs visible again if they are open but are hidden behind the main window or another application's window. --- plugins/feature/map/mapgui.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/feature/map/mapgui.cpp b/plugins/feature/map/mapgui.cpp index 8bd3d6a0ba..8714b48846 100644 --- a/plugins/feature/map/mapgui.cpp +++ b/plugins/feature/map/mapgui.cpp @@ -2507,17 +2507,20 @@ void MapGUI::on_displaySettings_clicked() void MapGUI::on_beacons_clicked() { m_beaconDialog.show(); + m_beaconDialog.raise(); } void MapGUI::on_ibpBeacons_clicked() { m_ibpBeaconDialog.show(); + m_ibpBeaconDialog.raise(); } void MapGUI::on_radiotime_clicked() { m_radioTimeDialog.updateTable(); m_radioTimeDialog.show(); + m_radioTimeDialog.raise(); } QString MapGUI::getDataDir() From 991ccddb6635dbea29e675e8b461d7ad75b2008d Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Tue, 23 Apr 2024 20:23:07 +0200 Subject: [PATCH 5/5] Close any open dialog when sdrangel quits --- plugins/feature/map/mapbeacondialog.cpp | 1 + plugins/feature/map/mapibpbeacondialog.cpp | 1 + plugins/feature/map/mapradiotimedialog.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/plugins/feature/map/mapbeacondialog.cpp b/plugins/feature/map/mapbeacondialog.cpp index 7b50157590..bf7d84ac3a 100644 --- a/plugins/feature/map/mapbeacondialog.cpp +++ b/plugins/feature/map/mapbeacondialog.cpp @@ -31,6 +31,7 @@ MapBeaconDialog::MapBeaconDialog(MapGUI *gui, QWidget* parent) : ui(new Ui::MapBeaconDialog) { ui->setupUi(this); + setAttribute(Qt::WA_QuitOnClose, false); connect(&m_dlm, &HttpDownloadManager::downloadComplete, this, &MapBeaconDialog::downloadFinished); } diff --git a/plugins/feature/map/mapibpbeacondialog.cpp b/plugins/feature/map/mapibpbeacondialog.cpp index 942a887afb..01bc0d9cd6 100644 --- a/plugins/feature/map/mapibpbeacondialog.cpp +++ b/plugins/feature/map/mapibpbeacondialog.cpp @@ -30,6 +30,7 @@ MapIBPBeaconDialog::MapIBPBeaconDialog(MapGUI *gui, QWidget* parent) : ui(new Ui::MapIBPBeaconDialog) { ui->setupUi(this); + setAttribute(Qt::WA_QuitOnClose, false); connect(&m_timer, &QTimer::timeout, this, &MapIBPBeaconDialog::updateTime); m_timer.setInterval(1000); ui->beacons->setRowCount(IBPBeacon::m_frequencies.size()); diff --git a/plugins/feature/map/mapradiotimedialog.cpp b/plugins/feature/map/mapradiotimedialog.cpp index 0df4bc2a5e..13eead4ce7 100644 --- a/plugins/feature/map/mapradiotimedialog.cpp +++ b/plugins/feature/map/mapradiotimedialog.cpp @@ -29,6 +29,7 @@ MapRadioTimeDialog::MapRadioTimeDialog(MapGUI *gui, QWidget* parent) : ui(new Ui::MapRadioTimeDialog) { ui->setupUi(this); + setAttribute(Qt::WA_QuitOnClose, false); // Don't call updateTable until m_gui->getAzEl() will return valid location }