mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
Ref T658, settings for matching (dirs/UI)
This commit is contained in:
@@ -9,7 +9,9 @@
|
||||
#include "ui_matchingform.h"
|
||||
#include "matchingform.h"
|
||||
#include "guiutility.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QFileDialog>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
@@ -29,6 +31,8 @@ namespace BlackGui
|
||||
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_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()
|
||||
@@ -61,6 +65,11 @@ namespace BlackGui
|
||||
ui->rb_PickFirst->setEnabled(enabled);
|
||||
ui->rb_PickByOrder->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
|
||||
@@ -94,11 +103,20 @@ namespace BlackGui
|
||||
|
||||
this->setMatchingAlgorithm(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
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -119,6 +137,23 @@ namespace BlackGui
|
||||
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
|
||||
{
|
||||
if (ui->rb_Reduction->isChecked()) { return CAircraftMatcherSetup::MatchingStepwiseReduce; }
|
||||
@@ -193,6 +228,5 @@ namespace BlackGui
|
||||
const CAircraftMatcherSetup setup = this->value();
|
||||
this->setValue(setup);
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -71,6 +71,9 @@ namespace BlackGui
|
||||
void resetAll();
|
||||
//! }
|
||||
|
||||
//! Directory browser
|
||||
void fileDialog();
|
||||
|
||||
QScopedPointer<Ui::CMatchingForm> ui;
|
||||
};
|
||||
} // ns
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>293</width>
|
||||
<height>559</height>
|
||||
<height>647</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -70,6 +70,71 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
<widget class="QGroupBox" name="gb_PickStrategy">
|
||||
<property name="title">
|
||||
@@ -312,9 +377,17 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>pb_ResetAll</tabstop>
|
||||
<tabstop>rb_Reduction</tabstop>
|
||||
<tabstop>rb_ScoreOnly</tabstop>
|
||||
<tabstop>rb_ScoreAndReduction</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_PickRandom</tabstop>
|
||||
<tabstop>rb_PickByOrder</tabstop>
|
||||
@@ -337,8 +410,6 @@
|
||||
<tabstop>cb_ExclNoDbData</tabstop>
|
||||
<tabstop>cb_ScorePreferColorLiveries</tabstop>
|
||||
<tabstop>cb_ScoreIgnoreZeros</tabstop>
|
||||
<tabstop>pb_ResetAll</tabstop>
|
||||
<tabstop>rb_Reduction</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
Reference in New Issue
Block a user