mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:40:05 +00:00
Add checks to prevent files being saved before being fully read.
This commit is contained in:
parent
f3c846f0b1
commit
bc79ed11a3
5 changed files with 31 additions and 1 deletions
|
|
@ -96,6 +96,8 @@ public:
|
|||
manager::PlacefileManager::Instance()};
|
||||
|
||||
types::LayerVector layers_ {};
|
||||
|
||||
bool fileRead_ {false};
|
||||
};
|
||||
|
||||
LayerModel::LayerModel(QObject* parent) :
|
||||
|
|
@ -201,6 +203,8 @@ void LayerModel::Impl::ReadLayerSettings()
|
|||
// Assign read layers
|
||||
layers_.swap(newLayers);
|
||||
}
|
||||
|
||||
fileRead_ = true;
|
||||
}
|
||||
|
||||
void LayerModel::Impl::ValidateLayerSettings(types::LayerVector& layers)
|
||||
|
|
@ -314,6 +318,10 @@ void LayerModel::Impl::ValidateLayerSettings(types::LayerVector& layers)
|
|||
|
||||
void LayerModel::Impl::WriteLayerSettings()
|
||||
{
|
||||
if (!fileRead_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
logger_->info("Saving layer settings");
|
||||
|
||||
auto layerJson = boost::json::value_from(layers_);
|
||||
|
|
|
|||
|
|
@ -68,6 +68,8 @@ public:
|
|||
scwx::common::Coordinate previousPosition_;
|
||||
|
||||
QIcon starIcon_ {":/res/icons/font-awesome-6/star-solid.svg"};
|
||||
|
||||
bool presetsRead_ {false};
|
||||
};
|
||||
|
||||
RadarSiteModel::RadarSiteModel(QObject* parent) :
|
||||
|
|
@ -146,10 +148,15 @@ void RadarSiteModelImpl::ReadPresets()
|
|||
}
|
||||
}
|
||||
}
|
||||
presetsRead_ = true;
|
||||
}
|
||||
|
||||
void RadarSiteModelImpl::WritePresets()
|
||||
{
|
||||
if (!presetsRead_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
logger_->info("Saving presets");
|
||||
|
||||
auto presetsJson = boost::json::value_from(presets_);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue