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