mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +08:00
Ref T681, settings for CG from DB
This commit is contained in:
committed by
Mat Sutcliffe
parent
6f29e1bfc8
commit
a447c054ca
@@ -50,25 +50,28 @@ namespace BlackMisc
|
||||
CVPilotModelRuleSet::registerMetadata();
|
||||
CAircraftMatcherSetup::registerMetadata();
|
||||
|
||||
qRegisterMetaType<CSimulatorSettings::CGSource>();
|
||||
qRegisterMetaType<CAircraftMatcherSetup::MatchingAlgorithm>();
|
||||
qRegisterMetaType<CAircraftMatcherSetup::MatchingMode>();
|
||||
qRegisterMetaType<CAircraftMatcherSetup::MatchingModeFlag>();
|
||||
qRegisterMetaType<CAircraftMatcherSetup::PickSimilarStrategy>();
|
||||
qRegisterMetaType<MatchingLog>();
|
||||
qRegisterMetaType<MatchingLogFlag>();
|
||||
qRegisterMetaType<CAircraftMatcherSetup::PickSimilarStrategy>();
|
||||
qRegisterMetaType<ReverseLookupLoggingFlag>();
|
||||
qRegisterMetaType<ReverseLookupLogging>();
|
||||
|
||||
// the ones generate with Q_DECLARE_FLAGS and no streamin operator fail here
|
||||
qDBusRegisterMetaType<CSimulatorSettings::CGSource>();
|
||||
qDBusRegisterMetaType<CInterpolationAndRenderingSetupBase::InterpolatorMode>();
|
||||
qDBusRegisterMetaType<CAircraftMatcherSetup::MatchingAlgorithm>();
|
||||
qDBusRegisterMetaType<CAircraftMatcherSetup::MatchingModeFlag>();
|
||||
qDBusRegisterMetaType<CAircraftMatcherSetup::PickSimilarStrategy>();
|
||||
qDBusRegisterMetaType<MatchingLogFlag>();
|
||||
qDBusRegisterMetaType<MatchingLog>();
|
||||
qDBusRegisterMetaType<CAircraftMatcherSetup::PickSimilarStrategy>();
|
||||
qDBusRegisterMetaType<ReverseLookupLoggingFlag>();
|
||||
qDBusRegisterMetaType<ReverseLookupLogging>();
|
||||
|
||||
qRegisterMetaTypeStreamOperators<CSimulatorSettings::CGSource>();
|
||||
qRegisterMetaTypeStreamOperators<CInterpolationAndRenderingSetupBase::InterpolatorMode>();
|
||||
qRegisterMetaTypeStreamOperators<CAircraftMatcherSetup::MatchingAlgorithm>();
|
||||
qRegisterMetaTypeStreamOperators<CAircraftMatcherSetup::MatchingModeFlag>();
|
||||
|
||||
@@ -27,6 +27,25 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
const QString &CSimulatorSettings::cgSourceAsString(CSimulatorSettings::CGSource source)
|
||||
{
|
||||
static const QString sf("simulator 1st");
|
||||
static const QString dbf("DB 1st");
|
||||
static const QString so("simulator only");
|
||||
static const QString dbo("DB only");
|
||||
|
||||
switch (source)
|
||||
{
|
||||
case CGFromSimulatorFirst: return sf;
|
||||
case CGFromDBFirst: return dbf;
|
||||
case CGFromSimulatorOnly: return so;
|
||||
case CGFromDBOnly: return dbo;
|
||||
default: break;
|
||||
}
|
||||
static const QString u("unknown");
|
||||
return u;
|
||||
}
|
||||
|
||||
CSimulatorSettings::CSimulatorSettings()
|
||||
{ }
|
||||
|
||||
@@ -84,6 +103,28 @@ namespace BlackMisc
|
||||
return m_excludeDirectoryPatterns;
|
||||
}
|
||||
|
||||
bool CSimulatorSettings::setComIntegrated(bool integrated)
|
||||
{
|
||||
if (integrated == m_comIntegration) { return false; }
|
||||
m_comIntegration = integrated;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSimulatorSettings::setCGSource(CSimulatorSettings::CGSource source)
|
||||
{
|
||||
const int s = static_cast<int>(source);
|
||||
if (m_cgSource == s) { return false; }
|
||||
m_cgSource = s;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSimulatorSettings::setRecordOwnAircraftGnd(bool record)
|
||||
{
|
||||
if (record == m_recordGnd) { return false; }
|
||||
m_recordGnd = record;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSimulatorSettings::resetPaths()
|
||||
{
|
||||
m_excludeDirectoryPatterns.clear();
|
||||
@@ -112,9 +153,12 @@ namespace BlackMisc
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexSimulatorDirectory: return CVariant::fromValue(m_simulatorDirectory);
|
||||
case IndexModelDirectories: return CVariant::fromValue(m_modelDirectories);
|
||||
case IndexSimulatorDirectory: return CVariant::fromValue(m_simulatorDirectory);
|
||||
case IndexModelDirectories: return CVariant::fromValue(m_modelDirectories);
|
||||
case IndexModelExcludeDirectoryPatterns: return CVariant::fromValue(m_excludeDirectoryPatterns);
|
||||
case IndexComIntegration: return CVariant::fromValue(m_comIntegration);
|
||||
case IndexRecordOwnAircraftGnd: return CVariant::fromValue(m_recordGnd);
|
||||
case IndexCGSource: return CVariant::fromValue(m_cgSource);
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
@@ -125,9 +169,12 @@ namespace BlackMisc
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexSimulatorDirectory: this->setSimulatorDirectory(variant.toQString()); break;
|
||||
case IndexModelDirectories: this->setSimulatorDirectory(variant.toQString()); break;
|
||||
case IndexSimulatorDirectory: this->setSimulatorDirectory(variant.toQString()); break;
|
||||
case IndexModelDirectories: this->setSimulatorDirectory(variant.toQString()); break;
|
||||
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;
|
||||
default: CValueObject::setPropertyByIndex(index, variant); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,9 +40,23 @@ namespace BlackMisc
|
||||
IndexSimulatorDirectory = CPropertyIndex::GlobalIndexCSimulatorSettings,
|
||||
IndexModelDirectories,
|
||||
IndexModelExcludeDirectoryPatterns,
|
||||
IndexComIntegration //!< COM unit integration
|
||||
IndexComIntegration, //!< COM unit integration
|
||||
IndexRecordOwnAircraftGnd,
|
||||
IndexCGSource
|
||||
};
|
||||
|
||||
//! Where we get the CG (aka vertical offset) from
|
||||
enum CGSource
|
||||
{
|
||||
CGFromSimulatorFirst,
|
||||
CGFromDBFirst,
|
||||
CGFromSimulatorOnly,
|
||||
CGFromDBOnly
|
||||
};
|
||||
|
||||
//! CG source as string
|
||||
static const QString &cgSourceAsString(CGSource source);
|
||||
|
||||
//! Default constructor
|
||||
CSimulatorSettings();
|
||||
|
||||
@@ -89,7 +103,19 @@ namespace BlackMisc
|
||||
bool isComIntegrated() const { return m_comIntegration; }
|
||||
|
||||
//! COM unit integration
|
||||
void setComIntegrated(bool integrated) { m_comIntegration = integrated; }
|
||||
bool setComIntegrated(bool integrated);
|
||||
|
||||
//! CG source
|
||||
CGSource getCGSource() const { return static_cast<CGSource>(m_cgSource); }
|
||||
|
||||
//! CG source
|
||||
bool setCGSource(CGSource source);
|
||||
|
||||
//! Record GND values (of own aircraft)
|
||||
bool isRecordOwnAircraftGnd() const { return m_recordGnd; }
|
||||
|
||||
//! Record GND values (of own aircraft)
|
||||
bool setRecordOwnAircraftGnd(bool record);
|
||||
|
||||
//! Reset the paths
|
||||
void resetPaths();
|
||||
@@ -111,13 +137,16 @@ namespace BlackMisc
|
||||
QStringList m_modelDirectories; //!< Model directory
|
||||
QStringList m_excludeDirectoryPatterns; //!< Exclude model directory
|
||||
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
|
||||
|
||||
BLACK_METACLASS(
|
||||
CSimulatorSettings,
|
||||
BLACK_METAMEMBER(simulatorDirectory),
|
||||
BLACK_METAMEMBER(modelDirectories),
|
||||
BLACK_METAMEMBER(excludeDirectoryPatterns),
|
||||
BLACK_METAMEMBER(comIntegration)
|
||||
BLACK_METAMEMBER(comIntegration),
|
||||
BLACK_METAMEMBER(cgSource)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -599,6 +628,7 @@ namespace BlackMisc
|
||||
} // ns
|
||||
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::Settings::CSimulatorSettings)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::Settings::CSimulatorSettings::CGSource)
|
||||
Q_DECLARE_METATYPE(BlackMisc::Simulation::Settings::CFsxP3DSettings)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Simulation::Settings::CSimulatorSettings>)
|
||||
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Simulation::Settings::CSimulatorSettings>)
|
||||
|
||||
Reference in New Issue
Block a user