mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 11:25:33 +08:00
Ref T658, settings for matching (dirs/UI)
This commit is contained in:
@@ -9,7 +9,9 @@
|
|||||||
#include "ui_matchingform.h"
|
#include "ui_matchingform.h"
|
||||||
#include "matchingform.h"
|
#include "matchingform.h"
|
||||||
#include "guiutility.h"
|
#include "guiutility.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
@@ -29,6 +31,8 @@ namespace BlackGui
|
|||||||
connect(ui->rb_ScoreOnly, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection);
|
connect(ui->rb_ScoreOnly, &QRadioButton::released, this, &CMatchingForm::onAlgorithmChanged, Qt::QueuedConnection);
|
||||||
connect(ui->pb_ResetAlgorithm, &QPushButton::released, this, &CMatchingForm::resetByAlgorithm, Qt::QueuedConnection);
|
connect(ui->pb_ResetAlgorithm, &QPushButton::released, this, &CMatchingForm::resetByAlgorithm, Qt::QueuedConnection);
|
||||||
connect(ui->pb_ResetAll, &QPushButton::released, this, &CMatchingForm::resetAll, Qt::QueuedConnection);
|
connect(ui->pb_ResetAll, &QPushButton::released, this, &CMatchingForm::resetAll, Qt::QueuedConnection);
|
||||||
|
connect(ui->pb_MsNetwork, &QPushButton::released, this, &CMatchingForm::fileDialog, Qt::QueuedConnection);
|
||||||
|
connect(ui->pb_MsMatching, &QPushButton::released, this, &CMatchingForm::fileDialog, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMatchingForm::~CMatchingForm()
|
CMatchingForm::~CMatchingForm()
|
||||||
@@ -61,6 +65,11 @@ namespace BlackGui
|
|||||||
ui->rb_PickFirst->setEnabled(enabled);
|
ui->rb_PickFirst->setEnabled(enabled);
|
||||||
ui->rb_PickByOrder->setEnabled(enabled);
|
ui->rb_PickByOrder->setEnabled(enabled);
|
||||||
ui->rb_PickRandom->setEnabled(enabled);
|
ui->rb_PickRandom->setEnabled(enabled);
|
||||||
|
|
||||||
|
ui->le_MsNetwork->setEnabled(enabled);
|
||||||
|
ui->le_MsMatching->setEnabled(enabled);
|
||||||
|
CGuiUtility::checkBoxReadOnly(ui->cb_MsNetwork, readonly);
|
||||||
|
CGuiUtility::checkBoxReadOnly(ui->cb_MsMatching, readonly);
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusMessageList CMatchingForm::validate(bool withNestedForms) const
|
CStatusMessageList CMatchingForm::validate(bool withNestedForms) const
|
||||||
@@ -94,11 +103,20 @@ namespace BlackGui
|
|||||||
|
|
||||||
this->setMatchingAlgorithm(setup);
|
this->setMatchingAlgorithm(setup);
|
||||||
this->setPickStrategy(setup);
|
this->setPickStrategy(setup);
|
||||||
|
|
||||||
|
ui->cb_MsNetwork->setChecked(setup.isMsNetworkEntryEnabled());
|
||||||
|
ui->cb_MsMatching->setChecked(setup.isMsMatchingStageEnabled());
|
||||||
|
ui->le_MsNetwork->setText(setup.getMsNetworkEntryFile());
|
||||||
|
ui->le_MsMatching->setText(setup.getMsMatchingStageFile());
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftMatcherSetup CMatchingForm::value() const
|
CAircraftMatcherSetup CMatchingForm::value() const
|
||||||
{
|
{
|
||||||
const CAircraftMatcherSetup setup(algorithm(), matchingMode(), pickStrategy());
|
CAircraftMatcherSetup setup(algorithm(), matchingMode(), pickStrategy());
|
||||||
|
setup.setMsNetworkEntryFile(ui->le_MsNetwork->text());
|
||||||
|
setup.setMsMatchingStageFile(ui->le_MsMatching->text());
|
||||||
|
setup.setMsNetworkEntryEnabled(ui->cb_MsNetwork->isChecked());
|
||||||
|
setup.setMsMatchingStageEnabled(ui->cb_MsMatching->isChecked());
|
||||||
return setup;
|
return setup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +137,23 @@ namespace BlackGui
|
|||||||
this->setValue(s);
|
this->setValue(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMatchingForm::fileDialog()
|
||||||
|
{
|
||||||
|
const bool nw = (QObject::sender() == ui->pb_MsNetwork);
|
||||||
|
QString fn = nw ? ui->le_MsNetwork->text() : ui->le_MsMatching->text();
|
||||||
|
fn = QFileDialog::getOpenFileName(nullptr, tr("Matching script"), fn, "Matching script (*.js)");
|
||||||
|
const QFileInfo fi(fn);
|
||||||
|
if (!fi.exists()) { return; }
|
||||||
|
if (nw)
|
||||||
|
{
|
||||||
|
ui->le_MsNetwork->setText(fi.absoluteFilePath());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->le_MsMatching->setText(fi.absoluteFilePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CAircraftMatcherSetup::MatchingAlgorithm CMatchingForm::algorithm() const
|
CAircraftMatcherSetup::MatchingAlgorithm CMatchingForm::algorithm() const
|
||||||
{
|
{
|
||||||
if (ui->rb_Reduction->isChecked()) { return CAircraftMatcherSetup::MatchingStepwiseReduce; }
|
if (ui->rb_Reduction->isChecked()) { return CAircraftMatcherSetup::MatchingStepwiseReduce; }
|
||||||
@@ -193,6 +228,5 @@ namespace BlackGui
|
|||||||
const CAircraftMatcherSetup setup = this->value();
|
const CAircraftMatcherSetup setup = this->value();
|
||||||
this->setValue(setup);
|
this->setValue(setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ namespace BlackGui
|
|||||||
void resetAll();
|
void resetAll();
|
||||||
//! }
|
//! }
|
||||||
|
|
||||||
|
//! Directory browser
|
||||||
|
void fileDialog();
|
||||||
|
|
||||||
QScopedPointer<Ui::CMatchingForm> ui;
|
QScopedPointer<Ui::CMatchingForm> ui;
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>293</width>
|
<width>293</width>
|
||||||
<height>559</height>
|
<height>647</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -70,6 +70,71 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="gb_MatchingScript">
|
||||||
|
<property name="title">
|
||||||
|
<string>Matching script</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gl_MatchingSCript" columnstretch="0,1,0,0">
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_MsMatching">
|
||||||
|
<property name="text">
|
||||||
|
<string>Matching:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QPushButton" name="pb_MsMatching">
|
||||||
|
<property name="text">
|
||||||
|
<string>[...]</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLineEdit" name="le_MsNetwork">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>network entry matching script file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="le_MsMatching">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>matching stage matching script file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QPushButton" name="pb_MsNetwork">
|
||||||
|
<property name="text">
|
||||||
|
<string>[...]</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="lbl_MsNetwork">
|
||||||
|
<property name="text">
|
||||||
|
<string>Network:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QCheckBox" name="cb_MsNetwork">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QCheckBox" name="cb_MsMatching">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_PickStrategy">
|
<widget class="QGroupBox" name="gb_PickStrategy">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@@ -312,9 +377,17 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
<tabstop>pb_ResetAll</tabstop>
|
||||||
|
<tabstop>rb_Reduction</tabstop>
|
||||||
<tabstop>rb_ScoreOnly</tabstop>
|
<tabstop>rb_ScoreOnly</tabstop>
|
||||||
<tabstop>rb_ScoreAndReduction</tabstop>
|
<tabstop>rb_ScoreAndReduction</tabstop>
|
||||||
<tabstop>pb_ResetAlgorithm</tabstop>
|
<tabstop>pb_ResetAlgorithm</tabstop>
|
||||||
|
<tabstop>le_MsNetwork</tabstop>
|
||||||
|
<tabstop>cb_MsNetwork</tabstop>
|
||||||
|
<tabstop>pb_MsNetwork</tabstop>
|
||||||
|
<tabstop>le_MsMatching</tabstop>
|
||||||
|
<tabstop>cb_MsMatching</tabstop>
|
||||||
|
<tabstop>pb_MsMatching</tabstop>
|
||||||
<tabstop>rb_PickFirst</tabstop>
|
<tabstop>rb_PickFirst</tabstop>
|
||||||
<tabstop>rb_PickRandom</tabstop>
|
<tabstop>rb_PickRandom</tabstop>
|
||||||
<tabstop>rb_PickByOrder</tabstop>
|
<tabstop>rb_PickByOrder</tabstop>
|
||||||
@@ -337,8 +410,6 @@
|
|||||||
<tabstop>cb_ExclNoDbData</tabstop>
|
<tabstop>cb_ExclNoDbData</tabstop>
|
||||||
<tabstop>cb_ScorePreferColorLiveries</tabstop>
|
<tabstop>cb_ScorePreferColorLiveries</tabstop>
|
||||||
<tabstop>cb_ScoreIgnoreZeros</tabstop>
|
<tabstop>cb_ScoreIgnoreZeros</tabstop>
|
||||||
<tabstop>pb_ResetAll</tabstop>
|
|
||||||
<tabstop>rb_Reduction</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace BlackMisc
|
|||||||
return u"algorithm: '" % this->getMatchingAlgorithmAsString() %
|
return u"algorithm: '" % this->getMatchingAlgorithmAsString() %
|
||||||
u"' mode: '" % this->getMatchingModeAsString() %
|
u"' mode: '" % this->getMatchingModeAsString() %
|
||||||
u"' strategy: '" % this->getPickStrategyAsString() %
|
u"' strategy: '" % this->getPickStrategyAsString() %
|
||||||
u'\'';
|
u"\' matching script: " % boolToOnOff(m_msNetworkEnabled) % u'/' % boolToOnOff(m_msMatchingEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
CVariant CAircraftMatcherSetup::propertyByIndex(const CPropertyIndex &index) const
|
CVariant CAircraftMatcherSetup::propertyByIndex(const CPropertyIndex &index) const
|
||||||
@@ -83,6 +83,10 @@ namespace BlackMisc
|
|||||||
case IndexMatchingAlgorithm: return CVariant::fromValue(m_algorithm);
|
case IndexMatchingAlgorithm: return CVariant::fromValue(m_algorithm);
|
||||||
case IndexMatchingMode: return CVariant::fromValue(m_mode);
|
case IndexMatchingMode: return CVariant::fromValue(m_mode);
|
||||||
case IndexPickStrategy: return CVariant::fromValue(m_strategy);
|
case IndexPickStrategy: return CVariant::fromValue(m_strategy);
|
||||||
|
case IndexMsNetworkEntryFile: return CVariant::fromValue(m_msNetworkEntryFile);
|
||||||
|
case IndexMsMatchingStageFile: return CVariant::fromValue(m_msMatchingStageFile);
|
||||||
|
case IndexMsNetworkEnabled: return CVariant::fromValue(m_msNetworkEnabled);
|
||||||
|
case IndexMsMatchingStageEnabled: return CVariant::fromValue(m_msMatchingEnabled);
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return CValueObject::propertyByIndex(index);
|
return CValueObject::propertyByIndex(index);
|
||||||
@@ -97,6 +101,10 @@ namespace BlackMisc
|
|||||||
case IndexMatchingAlgorithm: m_algorithm = variant.toInt(); break;
|
case IndexMatchingAlgorithm: m_algorithm = variant.toInt(); break;
|
||||||
case IndexMatchingMode: m_mode = variant.toInt(); break;
|
case IndexMatchingMode: m_mode = variant.toInt(); break;
|
||||||
case IndexPickStrategy: m_strategy = variant.toInt(); break;
|
case IndexPickStrategy: m_strategy = variant.toInt(); break;
|
||||||
|
case IndexMsNetworkEntryFile: m_msNetworkEntryFile = variant.toQString(); break;
|
||||||
|
case IndexMsMatchingStageFile: m_msMatchingStageFile = variant.toQString(); break;
|
||||||
|
case IndexMsNetworkEnabled: m_msNetworkEnabled = variant.toBool(); break;
|
||||||
|
case IndexMsMatchingStageEnabled: m_msNetworkEnabled = variant.toBool(); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
CValueObject::setPropertyByIndex(index, variant);
|
CValueObject::setPropertyByIndex(index, variant);
|
||||||
@@ -105,6 +113,10 @@ namespace BlackMisc
|
|||||||
void CAircraftMatcherSetup::reset()
|
void CAircraftMatcherSetup::reset()
|
||||||
{
|
{
|
||||||
this->reset(MatchingStepwiseReducePlusScoreBased);
|
this->reset(MatchingStepwiseReducePlusScoreBased);
|
||||||
|
m_msNetworkEntryFile.clear();
|
||||||
|
m_msMatchingStageFile.clear();
|
||||||
|
m_msNetworkEnabled = false;
|
||||||
|
m_msMatchingEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAircraftMatcherSetup::reset(CAircraftMatcherSetup::MatchingAlgorithm algorithm)
|
void CAircraftMatcherSetup::reset(CAircraftMatcherSetup::MatchingAlgorithm algorithm)
|
||||||
|
|||||||
@@ -94,7 +94,11 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
IndexMatchingAlgorithm = CPropertyIndex::GlobalIndexCAircraftMatcherSetup,
|
IndexMatchingAlgorithm = CPropertyIndex::GlobalIndexCAircraftMatcherSetup,
|
||||||
IndexMatchingMode,
|
IndexMatchingMode,
|
||||||
IndexPickStrategy
|
IndexPickStrategy,
|
||||||
|
IndexMsNetworkEntryFile,
|
||||||
|
IndexMsMatchingStageFile,
|
||||||
|
IndexMsNetworkEnabled,
|
||||||
|
IndexMsMatchingStageEnabled
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
@@ -118,6 +122,26 @@ namespace BlackMisc
|
|||||||
//! Matching mode
|
//! Matching mode
|
||||||
MatchingMode getMatchingMode() const { return static_cast<MatchingMode>(m_mode); }
|
MatchingMode getMatchingMode() const { return static_cast<MatchingMode>(m_mode); }
|
||||||
|
|
||||||
|
//! Get matching files @{
|
||||||
|
const QString &getMsNetworkEntryFile() const { return m_msNetworkEntryFile; }
|
||||||
|
const QString &getMsMatchingStageFile() const { return m_msMatchingStageFile; }
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! Set matching files @{
|
||||||
|
void setMsNetworkEntryFile(const QString &file) { m_msNetworkEntryFile = file; }
|
||||||
|
void setMsMatchingStageFile(const QString &file) { m_msMatchingStageFile = file; }
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! Is matching script enabled @{
|
||||||
|
bool isMsNetworkEntryEnabled() const { return m_msNetworkEnabled; }
|
||||||
|
bool isMsMatchingStageEnabled() const { return m_msMatchingEnabled; }
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! Is matching script enabled @{
|
||||||
|
void setMsNetworkEntryEnabled(bool enabled) { m_msNetworkEnabled = enabled; }
|
||||||
|
void setMsMatchingStageEnabled(bool enabled) { m_msMatchingEnabled = enabled; }
|
||||||
|
//! @}
|
||||||
|
|
||||||
//! Verification at startup?
|
//! Verification at startup?
|
||||||
//! \sa ModelVerificationOnStartup
|
//! \sa ModelVerificationOnStartup
|
||||||
bool doVerificationAtStartup() const { return this->getMatchingMode().testFlag(ModelVerificationAtStartup); }
|
bool doVerificationAtStartup() const { return this->getMatchingMode().testFlag(ModelVerificationAtStartup); }
|
||||||
@@ -199,12 +223,20 @@ namespace BlackMisc
|
|||||||
int m_algorithm = static_cast<int>(MatchingStepwiseReducePlusScoreBased);
|
int m_algorithm = static_cast<int>(MatchingStepwiseReducePlusScoreBased);
|
||||||
int m_mode = static_cast<int>(ModeDefaultReducePlusScore);
|
int m_mode = static_cast<int>(ModeDefaultReducePlusScore);
|
||||||
int m_strategy = static_cast<int>(PickByOrder);
|
int m_strategy = static_cast<int>(PickByOrder);
|
||||||
|
QString m_msNetworkEntryFile; //!< network entry matching script file
|
||||||
|
QString m_msMatchingStageFile; //!< matching stage matching script file
|
||||||
|
bool m_msNetworkEnabled = false; //!< enable network matching script
|
||||||
|
bool m_msMatchingEnabled = false; //!< enable matching stage matching script
|
||||||
|
|
||||||
BLACK_METACLASS(
|
BLACK_METACLASS(
|
||||||
CAircraftMatcherSetup,
|
CAircraftMatcherSetup,
|
||||||
BLACK_METAMEMBER(algorithm),
|
BLACK_METAMEMBER(algorithm),
|
||||||
BLACK_METAMEMBER(mode),
|
BLACK_METAMEMBER(mode),
|
||||||
BLACK_METAMEMBER(strategy)
|
BLACK_METAMEMBER(strategy),
|
||||||
|
BLACK_METAMEMBER(msNetworkEntryFile),
|
||||||
|
BLACK_METAMEMBER(msMatchingStageFile),
|
||||||
|
BLACK_METAMEMBER(msNetworkEnabled),
|
||||||
|
BLACK_METAMEMBER(msMatchingEnabled)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
Reference in New Issue
Block a user