mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +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/simulatorselector.h"
|
||||
#include "blackgui/editors/modelmappingmodifyform.h"
|
||||
#include "blackgui/uppercasevalidator.h"
|
||||
#include "blackmisc/simulation/aircraftmodel.h"
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
#include "blackmisc/network/authenticateduser.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
#include "ui_modelmappingmodifyform.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
@@ -21,6 +23,7 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackGui::Components;
|
||||
|
||||
@@ -33,12 +36,20 @@ namespace BlackGui
|
||||
ui(new Ui::CModelMappingModifyForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
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);
|
||||
|
||||
ui->le_Parts->setPlaceholderText("Parts " + CAircraftModel::supportedParts());
|
||||
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()
|
||||
@@ -49,6 +60,7 @@ namespace BlackGui
|
||||
CPropertyIndexVariantMap CModelMappingModifyForm::getValues() const
|
||||
{
|
||||
CPropertyIndexVariantMap vm;
|
||||
|
||||
if (ui->cb_Name->isChecked())
|
||||
{
|
||||
vm.addValue(CAircraftModel::IndexName, ui->le_Name->text().trimmed());
|
||||
@@ -73,6 +85,23 @@ namespace BlackGui
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -127,8 +156,19 @@ namespace BlackGui
|
||||
if (widget == ui->le_Description) { return ui->cb_Description; }
|
||||
if (widget == ui->le_Name) { return ui->cb_Name; }
|
||||
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; }
|
||||
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
|
||||
|
||||
@@ -64,6 +64,9 @@ namespace BlackGui
|
||||
//! Checkbox from its corresponding widgte
|
||||
QCheckBox *widgetToCheckbox(QObject *widget) const;
|
||||
|
||||
//! CG changed
|
||||
void onCGEdited();
|
||||
|
||||
QScopedPointer<Ui::CModelMappingModifyForm> ui;
|
||||
};
|
||||
} // ns
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>150</height>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@@ -20,20 +20,17 @@
|
||||
<string>Modify model data</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_ModelMappingModifyForm">
|
||||
<item row="2" column="2">
|
||||
<widget class="QCheckBox" name="cb_Simulator">
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="cb_Name">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="BlackGui::Components::CSimulatorSelector" name="selector_SimulatorSelector">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
<item row="4" column="2">
|
||||
<widget class="QCheckBox" name="cb_Simulator">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -47,20 +44,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QCheckBox" name="cb_Name">
|
||||
<item row="4" column="1">
|
||||
<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">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lbl_Name">
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="lbl_Mode">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>le_Name</cstring>
|
||||
<string>Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -74,17 +75,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QCheckBox" name="cb_Description">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="lbl_Simulator">
|
||||
<widget class="QLabel" name="lbl_CG">
|
||||
<property name="text">
|
||||
<string>Simulator:</string>
|
||||
<string>CG/vert.offset:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -101,30 +95,81 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="lbl_Mode">
|
||||
<property name="text">
|
||||
<string>Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<item row="5" column="3" alignment="Qt::AlignLeft">
|
||||
<widget class="BlackGui::Components::CModelModeSelector" name="selector_ModeSelector">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>24</height>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</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>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@@ -146,6 +191,10 @@
|
||||
<tabstop>le_Name</tabstop>
|
||||
<tabstop>cb_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_Mode</tabstop>
|
||||
</tabstops>
|
||||
|
||||
Reference in New Issue
Block a user