Matcher settings as dialog so they can be changed in mapping tool model matcher for testing

This commit is contained in:
Klaus Basan
2018-10-27 20:50:54 +02:00
parent 8c3c55afec
commit 541fd4bd61
9 changed files with 247 additions and 18 deletions

View File

@@ -32,22 +32,45 @@ namespace BlackGui
connect(ui->pb_Reload, &QPushButton::released, this, &CSettingsMatchingComponent::onReloadPressed);
connect(ui->pb_MatchingAgain, &QPushButton::released, this, &CSettingsMatchingComponent::onMatchingsAgainPressed);
// also used in mapping tool, must also work without contexts
IContextSimulator *simContext = simulatorContext();
if (simContext)
{
connect(simContext, &IContextSimulator::matchingSetupChanged, this, &CSettingsMatchingComponent::onSetupChanged, Qt::QueuedConnection);
this->deferredReload(5000);
}
else
{
this->showButtons(false);
}
this->deferredReload(5000);
}
CSettingsMatchingComponent::~CSettingsMatchingComponent()
{ }
CAircraftMatcherSetup CSettingsMatchingComponent::getMatchingSetup() const
{
return ui->form_Matching->value();
}
void CSettingsMatchingComponent::setMatchingSetup(const CAircraftMatcherSetup &setup)
{
ui->form_Matching->setValue(setup);
}
void CSettingsMatchingComponent::showButtons(bool show)
{
ui->fr_Buttons->setVisible(show);
// ui->pb_MatchingAgain->setVisible(show);
// ui->pb_Reload->setVisible(show);
// ui->pb_Save->setVisible(show);
}
void CSettingsMatchingComponent::onSavePressed() const
{
IContextSimulator *simContext = simulatorContext();
if (!simContext) { return; }
const CAircraftMatcherSetup setup = ui->editor_MatchingForm->value();
const CAircraftMatcherSetup setup = ui->form_Matching->value();
simContext->setMatchingSetup(setup);
}
@@ -72,12 +95,12 @@ namespace BlackGui
void CSettingsMatchingComponent::deferredReload(int deferMs)
{
IContextSimulator *simContext = simulatorContext();
if (!simContext) { return; }
if (deferMs < 1)
{
IContextSimulator *simContext = simulatorContext();
if (!simContext) { return; }
const CAircraftMatcherSetup setup = simContext->getMatchingSetup();
ui->editor_MatchingForm->setValue(setup);
ui->form_Matching->setValue(setup);
}
else
{