mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 02:35:38 +08:00
Ref T265, Ref T430, added parts and CG to modify form
This commit is contained in:
committed by
Mat Sutcliffe
parent
ddb26a0ea5
commit
0817d38b4c
@@ -10,9 +10,11 @@
|
|||||||
#include "blackgui/components/modelmodeselector.h"
|
#include "blackgui/components/modelmodeselector.h"
|
||||||
#include "blackgui/components/simulatorselector.h"
|
#include "blackgui/components/simulatorselector.h"
|
||||||
#include "blackgui/editors/modelmappingmodifyform.h"
|
#include "blackgui/editors/modelmappingmodifyform.h"
|
||||||
|
#include "blackgui/uppercasevalidator.h"
|
||||||
#include "blackmisc/simulation/aircraftmodel.h"
|
#include "blackmisc/simulation/aircraftmodel.h"
|
||||||
#include "blackmisc/simulation/simulatorinfo.h"
|
#include "blackmisc/simulation/simulatorinfo.h"
|
||||||
#include "blackmisc/network/authenticateduser.h"
|
#include "blackmisc/network/authenticateduser.h"
|
||||||
|
#include "blackmisc/stringutils.h"
|
||||||
#include "ui_modelmappingmodifyform.h"
|
#include "ui_modelmappingmodifyform.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
@@ -21,6 +23,7 @@
|
|||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
|
using namespace BlackMisc::PhysicalQuantities;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackGui::Components;
|
using namespace BlackGui::Components;
|
||||||
|
|
||||||
@@ -33,12 +36,20 @@ namespace BlackGui
|
|||||||
ui(new Ui::CModelMappingModifyForm)
|
ui(new Ui::CModelMappingModifyForm)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
connect(ui->le_Description, &QLineEdit::returnPressed, this, &CModelMappingModifyForm::returnPressed);
|
ui->le_Parts->setPlaceholderText("Parts " + CAircraftModel::supportedParts());
|
||||||
connect(ui->le_Name, &QLineEdit::returnPressed, this, &CModelMappingModifyForm::returnPressed);
|
|
||||||
connect(ui->selector_ModeSelector, &CModelModeSelector::changed, this, &CModelMappingModifyForm::changed);
|
|
||||||
connect(ui->selector_SimulatorSelector, &CSimulatorSelector::changed, this, &CModelMappingModifyForm::changed);
|
|
||||||
|
|
||||||
this->userChanged();
|
this->userChanged();
|
||||||
|
|
||||||
|
CUpperCaseValidator *ucv = new CUpperCaseValidator(true, 0, CAircraftModel::supportedParts().size(), ui->le_Parts);
|
||||||
|
ucv->setAllowedCharacters(CAircraftModel::supportedParts());
|
||||||
|
ui->le_Parts->setValidator(ucv);
|
||||||
|
|
||||||
|
// "auto checked" disabled
|
||||||
|
// connect(ui->le_Description, &QLineEdit::returnPressed, this, &CModelMappingModifyForm::returnPressed);
|
||||||
|
// connect(ui->le_Name, &QLineEdit::returnPressed, this, &CModelMappingModifyForm::returnPressed);
|
||||||
|
// connect(ui->selector_ModeSelector, &CModelModeSelector::changed, this, &CModelMappingModifyForm::changed);
|
||||||
|
// connect(ui->selector_SimulatorSelector, &CSimulatorSelector::changed, this, &CModelMappingModifyForm::changed);
|
||||||
|
|
||||||
|
connect(ui->le_CG, &QLineEdit::editingFinished, this, &CModelMappingModifyForm::onCGEdited);
|
||||||
}
|
}
|
||||||
|
|
||||||
CModelMappingModifyForm::~CModelMappingModifyForm()
|
CModelMappingModifyForm::~CModelMappingModifyForm()
|
||||||
@@ -49,6 +60,7 @@ namespace BlackGui
|
|||||||
CPropertyIndexVariantMap CModelMappingModifyForm::getValues() const
|
CPropertyIndexVariantMap CModelMappingModifyForm::getValues() const
|
||||||
{
|
{
|
||||||
CPropertyIndexVariantMap vm;
|
CPropertyIndexVariantMap vm;
|
||||||
|
|
||||||
if (ui->cb_Name->isChecked())
|
if (ui->cb_Name->isChecked())
|
||||||
{
|
{
|
||||||
vm.addValue(CAircraftModel::IndexName, ui->le_Name->text().trimmed());
|
vm.addValue(CAircraftModel::IndexName, ui->le_Name->text().trimmed());
|
||||||
@@ -73,6 +85,23 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
vm.addValue(CAircraftModel::IndexModelMode, ui->selector_ModeSelector->getMode());
|
vm.addValue(CAircraftModel::IndexModelMode, ui->selector_ModeSelector->getMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ui->cb_Parts->isChecked())
|
||||||
|
{
|
||||||
|
vm.addValue(CAircraftModel::IndexSupportedParts, ui->le_Parts->text().toUpper());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ui->cb_CG->isChecked())
|
||||||
|
{
|
||||||
|
const QString cgv = ui->le_CG->text().trimmed();
|
||||||
|
CLength cg = CLength::null();
|
||||||
|
if (!cgv.isEmpty())
|
||||||
|
{
|
||||||
|
cg.parseFromString(cgv, CPqString::SeparatorBestGuess);
|
||||||
|
}
|
||||||
|
vm.addValue(CAircraftModel::IndexCG, cg);
|
||||||
|
}
|
||||||
|
|
||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,8 +156,19 @@ namespace BlackGui
|
|||||||
if (widget == ui->le_Description) { return ui->cb_Description; }
|
if (widget == ui->le_Description) { return ui->cb_Description; }
|
||||||
if (widget == ui->le_Name) { return ui->cb_Name; }
|
if (widget == ui->le_Name) { return ui->cb_Name; }
|
||||||
if (widget == ui->selector_ModeSelector) { return ui->cb_Mode; }
|
if (widget == ui->selector_ModeSelector) { return ui->cb_Mode; }
|
||||||
|
if (widget == ui->le_CG) { return ui->cb_CG; }
|
||||||
|
if (widget == ui->le_Parts) { return ui->cb_Parts; }
|
||||||
if (widget == ui->selector_SimulatorSelector) { return ui->cb_Simulator; }
|
if (widget == ui->selector_SimulatorSelector) { return ui->cb_Simulator; }
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CModelMappingModifyForm::onCGEdited()
|
||||||
|
{
|
||||||
|
QString cgv = ui->le_CG->text().trimmed();
|
||||||
|
if (isDigitsOnlyString(cgv)) { cgv += "ft"; }
|
||||||
|
CLength cg = CLength::null();
|
||||||
|
cg.parseFromString(cgv, CPqString::SeparatorBestGuess);
|
||||||
|
ui->le_CG->setText(cg.isNull() ? "" : cg.toQString(true));
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ namespace BlackGui
|
|||||||
//! Checkbox from its corresponding widgte
|
//! Checkbox from its corresponding widgte
|
||||||
QCheckBox *widgetToCheckbox(QObject *widget) const;
|
QCheckBox *widgetToCheckbox(QObject *widget) const;
|
||||||
|
|
||||||
|
//! CG changed
|
||||||
|
void onCGEdited();
|
||||||
|
|
||||||
QScopedPointer<Ui::CModelMappingModifyForm> ui;
|
QScopedPointer<Ui::CModelMappingModifyForm> ui;
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>300</width>
|
<width>300</width>
|
||||||
<height>150</height>
|
<height>151</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -20,20 +20,17 @@
|
|||||||
<string>Modify model data</string>
|
<string>Modify model data</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gl_ModelMappingModifyForm">
|
<layout class="QGridLayout" name="gl_ModelMappingModifyForm">
|
||||||
<item row="2" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QCheckBox" name="cb_Simulator">
|
<widget class="QCheckBox" name="cb_Name">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="3">
|
<item row="4" column="2">
|
||||||
<widget class="BlackGui::Components::CSimulatorSelector" name="selector_SimulatorSelector">
|
<widget class="QCheckBox" name="cb_Simulator">
|
||||||
<property name="minimumSize">
|
<property name="text">
|
||||||
<size>
|
<string/>
|
||||||
<width>0</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -47,20 +44,24 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="4" column="1">
|
||||||
<widget class="QCheckBox" name="cb_Name">
|
<widget class="QLabel" name="lbl_Simulator">
|
||||||
|
<property name="text">
|
||||||
|
<string>Simulator:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QCheckBox" name="cb_Description">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QLabel" name="lbl_Name">
|
<widget class="QLabel" name="lbl_Mode">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Name:</string>
|
<string>Mode:</string>
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>le_Name</cstring>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -74,17 +75,10 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QCheckBox" name="cb_Description">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLabel" name="lbl_Simulator">
|
<widget class="QLabel" name="lbl_CG">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Simulator:</string>
|
<string>CG/vert.offset:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -101,30 +95,81 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="5" column="3" alignment="Qt::AlignLeft">
|
||||||
<widget class="QLabel" name="lbl_Mode">
|
|
||||||
<property name="text">
|
|
||||||
<string>Mode:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="3">
|
|
||||||
<widget class="BlackGui::Components::CModelModeSelector" name="selector_ModeSelector">
|
<widget class="BlackGui::Components::CModelModeSelector" name="selector_ModeSelector">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>100</width>
|
||||||
<height>24</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="4" column="3" alignment="Qt::AlignLeft">
|
||||||
|
<widget class="BlackGui::Components::CSimulatorSelector" name="selector_SimulatorSelector">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="2">
|
||||||
<widget class="QCheckBox" name="cb_Mode">
|
<widget class="QCheckBox" name="cb_Mode">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="lbl_Name">
|
||||||
|
<property name="text">
|
||||||
|
<string>Name:</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>le_Name</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QCheckBox" name="cb_CG">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QLineEdit" name="le_CG">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>CG/vert.offset e,g, 10ft</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="3">
|
||||||
|
<widget class="QLineEdit" name="le_Parts">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Parts</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLabel" name="lbl_Parts">
|
||||||
|
<property name="text">
|
||||||
|
<string>Parts:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="QCheckBox" name="cb_Parts">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
@@ -146,6 +191,10 @@
|
|||||||
<tabstop>le_Name</tabstop>
|
<tabstop>le_Name</tabstop>
|
||||||
<tabstop>cb_Description</tabstop>
|
<tabstop>cb_Description</tabstop>
|
||||||
<tabstop>le_Description</tabstop>
|
<tabstop>le_Description</tabstop>
|
||||||
|
<tabstop>cb_CG</tabstop>
|
||||||
|
<tabstop>le_CG</tabstop>
|
||||||
|
<tabstop>cb_Parts</tabstop>
|
||||||
|
<tabstop>le_Parts</tabstop>
|
||||||
<tabstop>cb_Simulator</tabstop>
|
<tabstop>cb_Simulator</tabstop>
|
||||||
<tabstop>cb_Mode</tabstop>
|
<tabstop>cb_Mode</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
|
|||||||
Reference in New Issue
Block a user