Ref T298, added algorithm and score values to matching setup

This commit is contained in:
Klaus Basan
2018-08-07 19:54:47 +02:00
parent bd8d11d9d6
commit 8b6bdf2276
9 changed files with 276 additions and 53 deletions

View File

@@ -9,10 +9,10 @@
#include "settingsmatchingcomponent.h"
#include "ui_settingsmatchingcomponent.h"
#include "blackgui/guiapplication.h"
#include "blackcore/context/contextsimulator.h"
#include "blackmisc/simulation/aircraftmatchersetup.h"
#include <QPointer>
using namespace BlackMisc::Simulation;
using namespace BlackCore::Context;
@@ -28,6 +28,7 @@ namespace BlackGui
ui->setupUi(this);
connect(ui->pb_Save, &QPushButton::released, this, &CSettingsMatchingComponent::onSavePressed);
connect(ui->pb_Reload, &QPushButton::released, this, &CSettingsMatchingComponent::onReloadPressed);
this->deferredReload(5000);
}
CSettingsMatchingComponent::~CSettingsMatchingComponent()
@@ -43,10 +44,27 @@ namespace BlackGui
void CSettingsMatchingComponent::onReloadPressed()
{
IContextSimulator *simContext = simulatorContext();
if (!simContext) { return; }
const CAircraftMatcherSetup setup = simContext->getMatchingSetup();
ui->editor_MatchingForm->setValue(setup);
this->deferredReload(0);
}
void CSettingsMatchingComponent::deferredReload(int deferMs)
{
if (deferMs < 1)
{
IContextSimulator *simContext = simulatorContext();
if (!simContext) { return; }
const CAircraftMatcherSetup setup = simContext->getMatchingSetup();
ui->editor_MatchingForm->setValue(setup);
}
else
{
QPointer<CSettingsMatchingComponent> myself(this);
QTimer::singleShot(deferMs, this, [ = ]
{
if (!myself) { return; }
this->deferredReload(0);
});
}
}
IContextSimulator *CSettingsMatchingComponent::simulatorContext()

View File

@@ -42,6 +42,9 @@ namespace BlackGui
//! Reload pressed
void onReloadPressed();
//! Deferred reload
void deferredReload(int deferMs);
//! Network context
static BlackCore::Context::IContextSimulator *simulatorContext();
};

View File

@@ -6,21 +6,33 @@
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
<width>232</width>
<height>197</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
<string>Matching settings</string>
</property>
<layout class="QVBoxLayout" name="vl_MatchingComponent">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="BlackGui::Editors::CMatchingForm" name="editor_MatchingForm">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<property name="minimumSize">
<size>
<width>0</width>
<height>150</height>
</size>
</property>
</widget>
</item>