From b9531149de7a735ec4d73c33529ffdcbbb0785a3 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Sun, 29 May 2022 12:53:25 -0500 Subject: [PATCH] Disable auto-refresh on file load --- scwx-qt/source/scwx/qt/main/main_window.cpp | 1 + scwx-qt/source/scwx/qt/map/map_widget.cpp | 18 ++++++++++++++---- scwx-qt/source/scwx/qt/map/map_widget.hpp | 1 + scwx-qt/ts/scwx_en_US.ts | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/scwx-qt/source/scwx/qt/main/main_window.cpp b/scwx-qt/source/scwx/qt/main/main_window.cpp index f1ea1d2f..0c990270 100644 --- a/scwx-qt/source/scwx/qt/main/main_window.cpp +++ b/scwx-qt/source/scwx/qt/main/main_window.cpp @@ -276,6 +276,7 @@ void MainWindow::on_actionOpen_triggered() if (record != nullptr) { + currentMap->SetAutoRefresh(false); currentMap->SelectRadarProduct(record); } else diff --git a/scwx-qt/source/scwx/qt/map/map_widget.cpp b/scwx-qt/source/scwx/qt/map/map_widget.cpp index 3c96ac72..c8205c79 100644 --- a/scwx-qt/source/scwx/qt/map/map_widget.cpp +++ b/scwx-qt/source/scwx/qt/map/map_widget.cpp @@ -356,6 +356,19 @@ void MapWidget::SetActive(bool isActive) update(); } +void MapWidget::SetAutoRefresh(bool enabled) +{ + if (p->autoRefreshEnabled_ != enabled) + { + p->autoRefreshEnabled_ = enabled; + + if (p->autoRefreshEnabled_) + { + p->radarProductManager_->EnableLevel2Refresh(true); + } + } +} + void MapWidget::SetMapParameters( double latitude, double longitude, double zoom, double bearing, double pitch) { @@ -721,10 +734,7 @@ void MapWidgetImpl::SetRadarSite(const std::string& radarSite) radarProductManager_ = manager::RadarProductManager::Instance(radarSite); // Connect signals to new RadarProductManager - if (autoRefreshEnabled_) - { - AutoRefreshConnect(); - } + AutoRefreshConnect(); } } diff --git a/scwx-qt/source/scwx/qt/map/map_widget.hpp b/scwx-qt/source/scwx/qt/map/map_widget.hpp index 115110d9..27981045 100644 --- a/scwx-qt/source/scwx/qt/map/map_widget.hpp +++ b/scwx-qt/source/scwx/qt/map/map_widget.hpp @@ -45,6 +45,7 @@ public: void SelectRadarProduct(common::Level2Product product); void SelectRadarProduct(std::shared_ptr record); void SetActive(bool isActive); + void SetAutoRefresh(bool enabled); void SetMapParameters(double latitude, double longitude, double zoom, diff --git a/scwx-qt/ts/scwx_en_US.ts b/scwx-qt/ts/scwx_en_US.ts index d7b3ce91..78eb7c94 100644 --- a/scwx-qt/ts/scwx_en_US.ts +++ b/scwx-qt/ts/scwx_en_US.ts @@ -102,7 +102,7 @@ scwx::qt::main::MainWindow - + Unrecognized NEXRAD Product: