mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 02:45:33 +08:00
Ref T59, stash validation triggered by "stash" button
From non stash tabs not using full validation
This commit is contained in:
committed by
Mathew Sutcliffe
parent
74e0bf397f
commit
d7ae3712dd
@@ -352,10 +352,17 @@ namespace BlackGui
|
|||||||
|
|
||||||
CStatusMessageList CDbMappingComponent::validateCurrentModel(bool withNestedForms) const
|
CStatusMessageList CDbMappingComponent::validateCurrentModel(bool withNestedForms) const
|
||||||
{
|
{
|
||||||
CStatusMessageList msgs(ui->editor_ModelMapping->validate(!withNestedForms));
|
CStatusMessageList msgs;
|
||||||
if (withNestedForms)
|
if (withNestedForms)
|
||||||
{
|
{
|
||||||
msgs.push_back(ui->editor_AircraftModel->validate(withNestedForms));
|
// tests the 3 subforms and the model itself lenient
|
||||||
|
msgs.push_back(ui->editor_ModelMapping->validate(false));
|
||||||
|
msgs.push_back(ui->editor_AircraftModel->validate(true));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// model lenient
|
||||||
|
msgs.push_back(ui->editor_ModelMapping->validate(false));
|
||||||
}
|
}
|
||||||
return msgs;
|
return msgs;
|
||||||
}
|
}
|
||||||
@@ -369,14 +376,16 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CDbMappingComponent::ps_stashCurrentModel()
|
void CDbMappingComponent::ps_stashCurrentModel()
|
||||||
{
|
{
|
||||||
CStatusMessageList msgs(this->validateCurrentModel(true));
|
const bool nested = this->isStashTab(); // on stash tab, full validation, otherwise not
|
||||||
|
CStatusMessageList msgs(this->validateCurrentModel(nested));
|
||||||
if (!msgs.hasErrorMessages())
|
if (!msgs.hasErrorMessages())
|
||||||
{
|
{
|
||||||
const CAircraftModel editorModel(getEditorAircraftModel());
|
const CAircraftModel editorModel(getEditorAircraftModel());
|
||||||
|
|
||||||
// do not consolidate, because we want to keep data as they are from the editor
|
// from stash, do not consolidate, because we want to keep data as they are from the editor
|
||||||
|
const bool consolidate = !this->isStashTab();
|
||||||
msgs.push_back(
|
msgs.push_back(
|
||||||
ui->comp_StashAircraft->stashModel(editorModel, true, false)
|
ui->comp_StashAircraft->stashModel(editorModel, true, consolidate)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (msgs.hasErrorMessages())
|
if (msgs.hasErrorMessages())
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
CStatusMessageList CModelMappingForm::validate(bool withNestedObjects) const
|
CStatusMessageList CModelMappingForm::validate(bool withNestedObjects) const
|
||||||
{
|
{
|
||||||
CAircraftModel model(getValue());
|
const CAircraftModel model(getValue());
|
||||||
CStatusMessageList msgs(model.validate(withNestedObjects));
|
CStatusMessageList msgs(model.validate(withNestedObjects));
|
||||||
ui->val_Indicator->setState(msgs);
|
ui->val_Indicator->setState(msgs);
|
||||||
return msgs;
|
return msgs;
|
||||||
|
|||||||
Reference in New Issue
Block a user