mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
Ref T683, settings for "record gnd.elevation" (based on own aircraft)
This commit is contained in:
@@ -128,6 +128,7 @@ namespace BlackGui
|
||||
// record GND
|
||||
ui->pb_ApplyRecordOwnAircraftGnd->setEnabled(m_pluginLoaded);
|
||||
ui->cb_RecordOwnGndPositions->setEnabled(m_pluginLoaded);
|
||||
ui->le_RecordOwnGndPositionsRadius->setEnabled(m_pluginLoaded);
|
||||
|
||||
// led
|
||||
ui->led_RestrictedRendering->setOn(m_pluginLoaded ? setup.isRenderingRestricted() : false);
|
||||
@@ -157,6 +158,10 @@ namespace BlackGui
|
||||
// CG
|
||||
ui->comp_CGSourceSelector->setValue(settings);
|
||||
|
||||
// record
|
||||
ui->le_RecordOwnGndPositionsRadius->setText(settings.getRecordedGndRadius().valueRoundedWithUnit(CLengthUnit::m(), 1, false, true));
|
||||
ui->cb_RecordOwnGndPositions->setChecked(settings.isRecordOwnAircraftGnd());
|
||||
|
||||
// rendering
|
||||
const int maxAircraft = setup.getMaxRenderedAircraft();
|
||||
ui->le_MaxAircraft->setText(setup.isMaxAircraftRestricted() ? QString::number(maxAircraft) : "");
|
||||
@@ -291,7 +296,7 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
CSimulatorSettings CSettingsSimulatorComponent::getSimulatorSettings(bool &ok)
|
||||
CSimulatorSettings CSettingsSimulatorComponent::getSimulatorSettings(bool &ok)
|
||||
{
|
||||
ok = false;
|
||||
if (!sGui || sGui->isShuttingDown() || !sGui->getIContextSimulator()) { return {}; }
|
||||
@@ -331,9 +336,14 @@ namespace BlackGui
|
||||
void CSettingsSimulatorComponent::onApplyRecordGnd()
|
||||
{
|
||||
bool ok = false;
|
||||
CSimulatorSettings settings = getSimulatorSettings(ok);
|
||||
if (!ok || !settings.setRecordOwnAircraftGnd(ui->cb_RecordOwnGndPositions->isChecked())) { return; }
|
||||
setSimulatorSettings(settings);
|
||||
CSimulatorSettings settings = this->getSimulatorSettings(ok);
|
||||
if (!ok) { return; }
|
||||
CLength radius;
|
||||
radius.parseFromString(ui->le_RecordOwnGndPositionsRadius->text());
|
||||
const bool c1 = settings.setRecordOwnAircraftGnd(ui->cb_RecordOwnGndPositions->isChecked());
|
||||
const bool c2 = settings.setRecordedGndRadius(radius);
|
||||
if (!c1 && !c2) { return; }
|
||||
this->setSimulatorSettings(settings);
|
||||
}
|
||||
|
||||
void CSettingsSimulatorComponent::clearRestricedRendering()
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>352</width>
|
||||
<height>343</height>
|
||||
<width>368</width>
|
||||
<height>281</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Simulator settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_SettingsSimulator" columnstretch="0,0,0">
|
||||
<layout class="QGridLayout" name="gl_SettingsSimulator" columnstretch="0,1,0">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
@@ -69,11 +69,11 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>346</width>
|
||||
<height>269</height>
|
||||
<width>362</width>
|
||||
<height>207</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_SimulatorSettings" columnstretch="0,10,3">
|
||||
<layout class="QGridLayout" name="gl_SimulatorSettings" columnstretch="0,0,0">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
@@ -86,10 +86,13 @@
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="7" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyMaxDistance">
|
||||
<item row="4" column="2">
|
||||
<widget class="QPushButton" name="pb_DisableRendering">
|
||||
<property name="toolTip">
|
||||
<string>disable all rendering</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>apply</string>
|
||||
<string>dis.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -100,29 +103,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyCGSource">
|
||||
<item row="7" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyMaxDistance">
|
||||
<property name="text">
|
||||
<string>apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyMaxAircraft">
|
||||
<property name="text">
|
||||
<string>apply</string>
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="hl_MaxDistance">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="BlackGui::CLedWidget" name="led_RenderingEnabled" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_MaxDistance">
|
||||
<property name="placeholderText">
|
||||
<string>no restrictions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lbl_RestrictedRendering">
|
||||
@@ -137,50 +137,12 @@
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lbl_RecordOwnGndPositions">
|
||||
<property name="text">
|
||||
<string>Record gnd.</string>
|
||||
<string>Record gnd.pos.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="lbl_MaxDistance">
|
||||
<property name="text">
|
||||
<string>Max.dist.(NM)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="BlackGui::Components::CCGSourceSelector" name="comp_CGSourceSelector"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_CGSource">
|
||||
<property name="text">
|
||||
<string>CG (vert offset):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="cb_RecordOwnGndPositions">
|
||||
<property name="text">
|
||||
<string>record own gnd positions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QPushButton" name="pb_DisableRendering">
|
||||
<property name="text">
|
||||
<string>disable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="cb_ComSync">
|
||||
<property name="text">
|
||||
<string>use COM sync.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyComSync">
|
||||
<item row="6" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyMaxAircraft">
|
||||
<property name="text">
|
||||
<string>apply</string>
|
||||
</property>
|
||||
@@ -252,23 +214,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="pb_ClearRestrictedRendering">
|
||||
<property name="text">
|
||||
<string>clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_TimeSync">
|
||||
<property name="toolTip">
|
||||
<string>Time synchronization</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Time synch.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="hl_RestrictedRendering">
|
||||
<property name="spacing">
|
||||
@@ -286,6 +231,38 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QWidget" name="wi_RecordOwnGndPositions" native="true">
|
||||
<layout class="QHBoxLayout" name="hl_RecordOwnGndPositions">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cb_RecordOwnGndPositions">
|
||||
<property name="text">
|
||||
<string>record pos.radius</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_RecordOwnGndPositionsRadius">
|
||||
<property name="placeholderText">
|
||||
<string>e.g. 250m</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lbl_MaxAircraft">
|
||||
<property name="text">
|
||||
@@ -293,30 +270,51 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_ComSync">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_TimeSync">
|
||||
<property name="toolTip">
|
||||
<string>Synchronize COM unit with simulator</string>
|
||||
<string>Time synchronization</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>COM synch.</string>
|
||||
<string>Time synch.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyRecordOwnAircraftGnd">
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyComSync">
|
||||
<property name="text">
|
||||
<string>apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lbl_RenderingEnabled">
|
||||
<property name="toolTip">
|
||||
<string>Rendering enabled</string>
|
||||
<item row="4" column="1">
|
||||
<widget class="BlackGui::CLedWidget" name="led_RenderingEnabled" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyCGSource">
|
||||
<property name="text">
|
||||
<string>Rendering enabled</string>
|
||||
<string>apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="pb_ClearRestrictedRendering">
|
||||
<property name="text">
|
||||
<string>clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="lbl_MaxDistance">
|
||||
<property name="text">
|
||||
<string>Max.dist.(NM)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -334,19 +332,49 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="hl_MaxDistance">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyRecordOwnAircraftGnd">
|
||||
<property name="text">
|
||||
<string>apply</string>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="le_MaxDistance">
|
||||
<property name="placeholderText">
|
||||
<string>no restrictions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="cb_ComSync">
|
||||
<property name="text">
|
||||
<string>use COM sync.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lbl_RenderingEnabled">
|
||||
<property name="toolTip">
|
||||
<string>Rendering enabled</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rendering enabled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_CGSource">
|
||||
<property name="text">
|
||||
<string>CG (vert offset):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="BlackGui::Components::CCGSourceSelector" name="comp_CGSourceSelector"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_ComSync">
|
||||
<property name="toolTip">
|
||||
<string>Synchronize COM unit with simulator</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>COM synch.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@@ -375,10 +403,23 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>pb_Check</tabstop>
|
||||
<tabstop>sa_Settings</tabstop>
|
||||
<tabstop>cb_TimeSync</tabstop>
|
||||
<tabstop>le_TimeSyncOffset</tabstop>
|
||||
<tabstop>pb_ApplyTimeSync</tabstop>
|
||||
<tabstop>pb_ApplyCGSource</tabstop>
|
||||
<tabstop>cb_ComSync</tabstop>
|
||||
<tabstop>pb_ApplyComSync</tabstop>
|
||||
<tabstop>cb_RecordOwnGndPositions</tabstop>
|
||||
<tabstop>le_RecordOwnGndPositionsRadius</tabstop>
|
||||
<tabstop>pb_ApplyRecordOwnAircraftGnd</tabstop>
|
||||
<tabstop>pb_DisableRendering</tabstop>
|
||||
<tabstop>pb_ClearRestrictedRendering</tabstop>
|
||||
<tabstop>le_MaxAircraft</tabstop>
|
||||
<tabstop>pb_ApplyMaxAircraft</tabstop>
|
||||
<tabstop>le_MaxDistance</tabstop>
|
||||
<tabstop>pb_ApplyMaxDistance</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -125,6 +125,13 @@ namespace BlackMisc
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSimulatorSettings::setRecordedGndRadius(CLength &radius)
|
||||
{
|
||||
if (radius == m_recordedGndRadius) { return false; }
|
||||
m_recordedGndRadius = radius;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSimulatorSettings::resetPaths()
|
||||
{
|
||||
m_excludeDirectoryPatterns.clear();
|
||||
@@ -159,6 +166,7 @@ namespace BlackMisc
|
||||
case IndexComIntegration: return CVariant::fromValue(m_comIntegration);
|
||||
case IndexRecordOwnAircraftGnd: return CVariant::fromValue(m_recordGnd);
|
||||
case IndexCGSource: return CVariant::fromValue(m_cgSource);
|
||||
case IndexRecordOwnAircraftGndRadius: return m_recordedGndRadius.propertyByIndex(index.copyFrontRemoved());
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
@@ -174,7 +182,8 @@ namespace BlackMisc
|
||||
case IndexModelExcludeDirectoryPatterns: m_excludeDirectoryPatterns = variant.value<QStringList>(); break;
|
||||
case IndexComIntegration: this->setComIntegrated(variant.toBool()); break;
|
||||
case IndexRecordOwnAircraftGnd: this->setRecordOwnAircraftGnd(variant.toBool()); break;
|
||||
case IndexCGSource: m_cgSource = variant.toInt(); break;
|
||||
case IndexCGSource: m_cgSource = variant.toInt(); break;
|
||||
case IndexRecordOwnAircraftGndRadius: m_recordedGndRadius.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
#include "blackmisc/simulation/simulatorinfo.h"
|
||||
#include "blackmisc/network/textmessage.h"
|
||||
#include "blackmisc/weather/weatherscenario.h"
|
||||
#include "blackmisc/pq/length.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/propertyindex.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QObject>
|
||||
@@ -41,8 +42,9 @@ namespace BlackMisc
|
||||
IndexModelDirectories,
|
||||
IndexModelExcludeDirectoryPatterns,
|
||||
IndexComIntegration, //!< COM unit integration
|
||||
IndexCGSource,
|
||||
IndexRecordOwnAircraftGnd,
|
||||
IndexCGSource
|
||||
IndexRecordOwnAircraftGndRadius
|
||||
};
|
||||
|
||||
//! Where we get the CG (aka vertical offset) from
|
||||
@@ -117,6 +119,12 @@ namespace BlackMisc
|
||||
//! Record GND values (of own aircraft)
|
||||
bool setRecordOwnAircraftGnd(bool record);
|
||||
|
||||
//! Record GND values with radius
|
||||
BlackMisc::PhysicalQuantities::CLength getRecordedGndRadius() const { return m_recordedGndRadius; }
|
||||
|
||||
//! Record GND values with radius
|
||||
bool setRecordedGndRadius(BlackMisc::PhysicalQuantities::CLength &radius);
|
||||
|
||||
//! Reset the paths
|
||||
void resetPaths();
|
||||
|
||||
@@ -139,13 +147,16 @@ namespace BlackMisc
|
||||
bool m_comIntegration = false; //!< COM integration
|
||||
bool m_recordGnd = false; //!< Record GND values (of own aircraft)
|
||||
int m_cgSource = static_cast<int>(CGFromSimulatorFirst); //!< CG source
|
||||
PhysicalQuantities::CLength m_recordedGndRadius { 250.0, PhysicalQuantities::CLengthUnit::m() };
|
||||
|
||||
BLACK_METACLASS(
|
||||
CSimulatorSettings,
|
||||
BLACK_METAMEMBER(simulatorDirectory),
|
||||
BLACK_METAMEMBER(modelDirectories),
|
||||
BLACK_METAMEMBER(excludeDirectoryPatterns),
|
||||
BLACK_METAMEMBER(comIntegration)
|
||||
BLACK_METAMEMBER(comIntegration),
|
||||
BLACK_METAMEMBER(recordGnd),
|
||||
BLACK_METAMEMBER(recordedGndRadius)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user