Save radar smoothing state in settings

This commit is contained in:
Dan Paulat 2024-12-15 06:39:26 -06:00
parent f010ea8fad
commit cc0ebcd13c
2 changed files with 22 additions and 9 deletions

View file

@ -1092,16 +1092,25 @@ void MainWindowImpl::ConnectOtherSignals()
} }
} }
}); });
connect(mainWindow_->ui->smoothRadarDataCheckBox, connect(
&QCheckBox::checkStateChanged, mainWindow_->ui->smoothRadarDataCheckBox,
mainWindow_, &QCheckBox::checkStateChanged,
[this](Qt::CheckState state) mainWindow_,
{ [this](Qt::CheckState state)
bool smoothingEnabled = (state == Qt::CheckState::Checked); {
bool smoothingEnabled = (state == Qt::CheckState::Checked);
// Turn on smoothing auto it = std::find(maps_.cbegin(), maps_.cend(), activeMap_);
activeMap_->SetSmoothingEnabled(smoothingEnabled); if (it != maps_.cend())
}); {
std::size_t i = std::distance(maps_.cbegin(), it);
settings::MapSettings::Instance().smoothing_enabled(i).StageValue(
smoothingEnabled);
}
// Turn on smoothing
activeMap_->SetSmoothingEnabled(smoothingEnabled);
});
connect(mainWindow_->ui->trackLocationCheckBox, connect(mainWindow_->ui->trackLocationCheckBox,
&QCheckBox::checkStateChanged, &QCheckBox::checkStateChanged,
mainWindow_, mainWindow_,

View file

@ -19,6 +19,7 @@
#include <scwx/qt/model/imgui_context_model.hpp> #include <scwx/qt/model/imgui_context_model.hpp>
#include <scwx/qt/model/layer_model.hpp> #include <scwx/qt/model/layer_model.hpp>
#include <scwx/qt/settings/general_settings.hpp> #include <scwx/qt/settings/general_settings.hpp>
#include <scwx/qt/settings/map_settings.hpp>
#include <scwx/qt/settings/palette_settings.hpp> #include <scwx/qt/settings/palette_settings.hpp>
#include <scwx/qt/util/file.hpp> #include <scwx/qt/util/file.hpp>
#include <scwx/qt/util/maplibre.hpp> #include <scwx/qt/util/maplibre.hpp>
@ -105,13 +106,16 @@ public:
map::AlertLayer::InitializeHandler(); map::AlertLayer::InitializeHandler();
auto& generalSettings = settings::GeneralSettings::Instance(); auto& generalSettings = settings::GeneralSettings::Instance();
auto& mapSettings = settings::MapSettings::Instance();
// Initialize context // Initialize context
context_->set_map_provider( context_->set_map_provider(
GetMapProvider(generalSettings.map_provider().GetValue())); GetMapProvider(generalSettings.map_provider().GetValue()));
context_->set_overlay_product_view(overlayProductView); context_->set_overlay_product_view(overlayProductView);
// Initialize map data
SetRadarSite(generalSettings.default_radar_site().GetValue()); SetRadarSite(generalSettings.default_radar_site().GetValue());
smoothingEnabled_ = mapSettings.smoothing_enabled(id).GetValue();
// Create ImGui Context // Create ImGui Context
static size_t currentMapId_ {0u}; static size_t currentMapId_ {0u};