mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 15:45:46 +08:00
Ref T177, clear highlighting once new models are stashed
This commit is contained in:
@@ -97,12 +97,13 @@ namespace BlackGui
|
||||
return CStatusMessage();
|
||||
}
|
||||
|
||||
CStatusMessage CDbStashComponent::stashModel(const CAircraftModel &model, bool replace, bool consolidateWithDbData)
|
||||
CStatusMessage CDbStashComponent::stashModel(const CAircraftModel &model, bool replace, bool consolidateWithDbData, bool clearHighlighting)
|
||||
{
|
||||
const CAircraftModel stashModel(consolidateWithDbData ? this->consolidateModel(model) : model);
|
||||
const CStatusMessage m(validateStashModel(stashModel, replace));
|
||||
const CStatusMessage m(this->validateStashModel(stashModel, replace));
|
||||
if (!m.isWarningOrAbove())
|
||||
{
|
||||
if (clearHighlighting) { this->clearValidationHighlighting(); }
|
||||
if (replace)
|
||||
{
|
||||
ui->tvp_StashAircraftModels->replaceOrAdd(&CAircraftModel::getModelString, stashModel.getModelString(), stashModel);
|
||||
@@ -115,15 +116,24 @@ namespace BlackGui
|
||||
return m;
|
||||
}
|
||||
|
||||
CStatusMessageList CDbStashComponent::stashModels(const CAircraftModelList &models)
|
||||
CStatusMessageList CDbStashComponent::stashModels(const CAircraftModelList &models, bool replace, bool consolidateWithDbData, bool clearHighlighting)
|
||||
{
|
||||
if (models.isEmpty()) { return CStatusMessageList(); }
|
||||
CStatusMessageList msgs;
|
||||
int successfullyAdded = 0;
|
||||
for (const CAircraftModel &model : models)
|
||||
{
|
||||
const CStatusMessage m(stashModel(model));
|
||||
if (m.isWarningOrAbove()) { msgs.push_back(m); }
|
||||
const CStatusMessage m(this->stashModel(model, replace, consolidateWithDbData, false));
|
||||
if (m.isWarningOrAbove())
|
||||
{
|
||||
msgs.push_back(m);
|
||||
}
|
||||
else
|
||||
{
|
||||
successfullyAdded++;
|
||||
}
|
||||
}
|
||||
if (successfullyAdded > 0 && clearHighlighting) { this->clearValidationHighlighting(); }
|
||||
return msgs;
|
||||
}
|
||||
|
||||
@@ -448,6 +458,11 @@ namespace BlackGui
|
||||
this->showOverlayMessages(msgs);
|
||||
}
|
||||
|
||||
void CDbStashComponent::clearValidationHighlighting()
|
||||
{
|
||||
ui->tvp_StashAircraftModels->clearHighlighting();
|
||||
}
|
||||
|
||||
void CDbStashComponent::ps_copyOverValuesToSelectedModels()
|
||||
{
|
||||
const QObject *sender = QObject::sender();
|
||||
|
||||
@@ -121,12 +121,15 @@ namespace BlackGui
|
||||
//! Show changed attributes of selected models
|
||||
void showChangedAttributes();
|
||||
|
||||
//! Clear highlighting set by validations
|
||||
void clearValidationHighlighting();
|
||||
|
||||
public slots:
|
||||
//! Stash given model (includes validation and consolidation with DB data)
|
||||
BlackMisc::CStatusMessage stashModel(const BlackMisc::Simulation::CAircraftModel &model, bool replace = false, bool consolidateWithDbData = true);
|
||||
BlackMisc::CStatusMessage stashModel(const BlackMisc::Simulation::CAircraftModel &model, bool replace = false, bool consolidateWithDbData = true, bool clearHighlighting = true);
|
||||
|
||||
//! Stash given models (includes validation and consolidation with DB data)
|
||||
BlackMisc::CStatusMessageList stashModels(const BlackMisc::Simulation::CAircraftModelList &models);
|
||||
BlackMisc::CStatusMessageList stashModels(const BlackMisc::Simulation::CAircraftModelList &models, bool replace = false, bool consolidateWithDbData = true, bool clearHighlighting = true);
|
||||
|
||||
//! Replace models, no validation
|
||||
void replaceModelsUnvalidated(const BlackMisc::Simulation::CAircraftModelList &models);
|
||||
|
||||
Reference in New Issue
Block a user