Ref T515, validation dialog can trigger new validation

This commit is contained in:
Klaus Basan
2019-01-23 21:35:52 +01:00
committed by Mat Sutcliffe
parent 04e02fd074
commit f316c63fbe
3 changed files with 69 additions and 2 deletions

View File

@@ -25,10 +25,15 @@ namespace BlackGui
ui(new Ui::CAircraftModelValidationComponent)
{
ui->setupUi(this);
ui->comp_Simulator->setMode(CSimulatorSelector::ComboBox);
ui->comp_Simulator->setRememberSelection(false);
const CAircraftMatcherSetup setup = m_matchingSettings.get();
ui->cb_EnableStartupCheck->setChecked(setup.doVerificationAtStartup());
connect(ui->cb_EnableStartupCheck, &QCheckBox::toggled, this, &CAircraftModelValidationComponent::onCheckAtStartupChanged);
connect(ui->pb_TempDisableInvalid, &QPushButton::released, this, &CAircraftModelValidationComponent::onButtonClicked);
connect(ui->cb_EnableStartupCheck, &QCheckBox::toggled, this, &CAircraftModelValidationComponent::onCheckAtStartupChanged);
connect(ui->pb_TempDisableInvalid, &QPushButton::released, this, &CAircraftModelValidationComponent::onButtonClicked);
connect(ui->pb_TempDisableSelected, &QPushButton::released, this, &CAircraftModelValidationComponent::onButtonClicked);
connect(ui->pb_TriggerValidation, &QPushButton::released, this, &CAircraftModelValidationComponent::triggerValidation);
}
CAircraftModelValidationComponent::~CAircraftModelValidationComponent()
@@ -39,6 +44,7 @@ namespace BlackGui
Q_UNUSED(simulator);
Q_UNUSED(valid);
ui->tvp_InvalidModels->updateContainerMaybeAsync(invalid);
ui->comp_Simulator->setValue(simulator);
ui->comp_Messages->clear();
ui->comp_Messages->appendStatusMessagesToList(msgs);
@@ -71,6 +77,27 @@ namespace BlackGui
Q_UNUSED(msg);
}
void CAircraftModelValidationComponent::triggerValidation()
{
if (!sGui || sGui->isShuttingDown() || !sGui->supportsContexts()) { return; }
if (!sGui->getIContextSimulator()) { return; }
if (sGui->getIContextSimulator()->isValidationInProgress())
{
this->showOverlayHTMLMessage("Validation in progress", 5000);
return;
}
const CSimulatorInfo sim = ui->comp_Simulator->getValue();
if (sGui->getIContextSimulator()->triggerModelSetValidation(sim))
{
this->showOverlayHTMLMessage(QStringLiteral("Triggered validation for '%1'").arg(sim.toQString(true)), 5000);
}
else
{
this->showOverlayHTMLMessage(QStringLiteral("Cannot trigger validation for '%1'").arg(sim.toQString(true)), 5000);
}
}
void CAircraftModelValidationComponent::onButtonClicked()
{
const QObject *sender = QObject::sender();

View File

@@ -62,6 +62,9 @@ namespace BlackGui
//! Enable/disable startup check
void onCheckAtStartupChanged(bool checked);
//! Trigger new validation
void triggerValidation();
//! Button has been clicked
void onButtonClicked();
};

View File

@@ -88,6 +88,29 @@
</property>
</spacer>
</item>
<item>
<widget class="BlackGui::Components::CSimulatorSelector" name="comp_Simulator">
<property name="minimumSize">
<size>
<width>75</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_TriggerValidation">
<property name="text">
<string>trigger validation</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_TempDisableInvalid">
<property name="text">
@@ -119,7 +142,21 @@
<header>blackgui/components/logcomponent.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CSimulatorSelector</class>
<extends>QFrame</extends>
<header>blackgui/components/simulatorselector.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tw_CAircraftModelValidationComponent</tabstop>
<tabstop>tvp_InvalidModels</tabstop>
<tabstop>cb_EnableStartupCheck</tabstop>
<tabstop>pb_TriggerValidation</tabstop>
<tabstop>pb_TempDisableInvalid</tabstop>
<tabstop>pb_TempDisableSelected</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>