6 #ifndef SWIFT_MISC_SIMULATION_SETTINGS_SIMULATORSETTINGS_H
7 #define SWIFT_MISC_SIMULATION_SETTINGS_SIMULATORSETTINGS_H
10 #include <QStringList>
26 namespace swift::misc::simulation::settings
36 IndexSimulatorDirectory = CPropertyIndexRef::GlobalIndexCSimulatorSettings,
37 IndexModelDirectories,
38 IndexModelExcludeDirectoryPatterns,
41 IndexRecordOwnAircraftGnd,
42 IndexRecordOwnAircraftGndRadius
55 static const QString &cgSourceAsString(CGSource source);
64 void setSimulatorDirectory(
const QString &simulatorDirectory);
67 const QString &getSimulatorDirectory()
const;
73 void setModelDirectories(
const QStringList &modelDirectories);
76 void clearModelDirectories();
79 void setModelDirectory(
const QString &modelDirectory);
82 bool addModelDirectory(
const QString &modelDirectory);
91 void setModelExcludeDirectories(
const QStringList &excludeDirectories);
94 const QStringList &getModelExcludeDirectoryPatterns()
const;
103 bool setComIntegrated(
bool integrated);
109 bool setCGSource(CGSource source);
115 bool setRecordOwnAircraftGnd(
bool record);
127 QString convertToQString(
bool i18n =
false)
const;
130 QString convertToQString(
const QString &separator,
bool i18n =
false)
const;
142 bool m_comIntegration =
false;
143 bool m_recordGnd =
false;
144 int m_cgSource =
static_cast<int>(CGFromSimulatorFirst);
167 : m_useSimulatedObjectAdding(simulatedObject), m_useSbOffsets(sbOffsets)
183 QString convertToQString(
bool i18n =
false)
const;
192 bool m_useSimulatedObjectAdding =
false;
193 bool m_useSbOffsets =
true;
210 : m_genericSettings(settings), m_simulator(simulator)
222 const QString &getDefaultSimulatorDirectory()
const;
225 const QString &getSimulatorDirectoryIfNotDefault()
const;
228 const QString &getSimulatorDirectoryOrDefault()
const;
234 QStringList getModelDirectoriesFromSimulatorDirectoy()
const;
237 QStringList getModelDirectoriesFromSimulatorDirectoryOrDefault()
const;
240 const QStringList &getModelDirectoriesIfNotDefault()
const;
243 const QStringList &getDefaultModelExcludeDirectoryPatterns()
const;
246 QString getFirstModelDirectoryOrDefault()
const;
249 const QStringList &getDefaultModelDirectories()
const;
252 const QStringList &getModelExcludeDirectoryPatternsIfNotDefault()
const;
255 const QStringList &getModelExcludeDirectoryPatternsOrDefault()
const;
263 return m_genericSettings.addModelDirectory(modelDirectory);
298 QString getPluginDirOrDefault()
const;
305 static const char *
key() {
return "settingssimulatorp3d"; }
310 static const QString name(
"P3D settings");
319 static const char *
key() {
return "settingssimulatormsfs"; }
324 static const QString name(
"MSFS settings");
333 static const char *
key() {
return "settingssimulatormsfs2024"; }
338 static const QString name(
"MSFS2024 settings");
347 static const char *
key() {
return "simulator/p3dversion"; }
352 static const QString name(
"P3D version");
359 static const QString version(
"4.3");
368 static const char *
key() {
return "simulator/fsxdetailsettings"; }
373 static const QString name(
"FSX details");
389 static const char *
key() {
return "simulator/p3ddetailsettings"; }
394 static const QString name(
"P3D details");
410 static const char *
key() {
return "settingssimulatorxplane"; }
415 static const QString name(
"XPlane settings");
427 static const char *
key() {
return "settingssimulatorfg"; }
432 static const QString name(
"FG settings");
526 &CMultiSimulatorSettings::onP3DSettingsChanged };
528 this, &CMultiSimulatorSettings::onMsfsSettingsChanged
531 this, &CMultiSimulatorSettings::onMsfs2024SettingsChanged
534 CSetting<TSimulatorFG> m_simSettingsFG {
this, &CMultiSimulatorSettings::onFGSettingsChanged };
538 void onP3DSettingsChanged();
539 void onMsfsSettingsChanged();
540 void onMsfs2024SettingsChanged();
541 void onXPSettingsChanged();
542 void onFGSettingsChanged();
546 void emitSettingsChanged(
const CSimulatorInfo &simInfo);
557 IndexTechnicalLogSeverity = CPropertyIndexRef::GlobalIndexCSimulatorMessageSettings,
558 IndexRelayTextMessage,
559 IndexRelayGloballyEnabled
566 TextMessagesUnicom = 1 << 0,
567 TextMessagesCom1 = 1 << 1,
568 TextMessagesCom2 = 1 << 2,
569 TextMessagePrivate = 1 << 3,
570 TextMessageSupervisor = 1 << 4,
571 TextMessagesAll = TextMessagesUnicom | TextMessagesCom1 | TextMessagesCom2 | TextMessagePrivate
573 Q_DECLARE_FLAGS(TextMessageType, TextMessageTypeFlag)
582 void setRelayGloballyEnabled(
bool enabled) { m_relayGloballyEnabled = enabled; }
588 void disableTechnicalMessages();
591 bool isRelayErrorsMessages()
const;
594 bool isRelayWarningMessages()
const;
597 bool isRelayInfoMessages()
const;
600 bool isRelayTechnicalMessages()
const;
603 void setRelayTextMessages(CSimulatorMessagesSettings::TextMessageType messageType);
606 bool isRelaySupervisorTextMessages()
const;
609 bool isRelayPrivateTextMessages()
const;
612 bool isRelayUnicomTextMessages()
const;
615 bool isRelayCom1TextMessages()
const;
618 bool isRelayCom2TextMessages()
const;
627 CSimulatorMessagesSettings::TextMessageType getRelayedTextMessageTypes()
const;
630 QString convertToQString(
bool i18n =
false)
const;
640 int m_messageType =
static_cast<int>(TextMessagePrivate | TextMessageSupervisor);
641 bool m_relayGloballyEnabled =
true;
653 static const char *
key() {
return "settingssimulatormessages"; }
658 static const QString name(
"Simulator messages");
672 Q_DECLARE_METATYPE(swift::misc::simulation::settings::CSimulatorMessagesSettings::TextMessageType)
673 Q_DECLARE_OPERATORS_FOR_FLAGS(swift::misc::simulation::settings::CSimulatorMessagesSettings::TextMessageType)
Generic ordered container with value semantics.
Non-owning reference to a CPropertyIndex with a subset of its features.
Class template for accessing a specific value in the CSettingsCache.
Streamable status message, e.g.
constexpr static auto SeverityError
Status severities.
Status messages, e.g. from Core -> GUI.
Mix of the most commonly used mixin classes.
ColumnIndex
Base class enums.
Value object encapsulating information of a text message.
Physical unit length (length)
static CLengthUnit m()
Meter m.
Comprehensive information of an aircraft.
Simple hardcoded info about the corresponding simulator.
bool isAddingAsSimulatedObjectEnabled() const
Use simulated object adding.
CFsxP3DSettings(bool simulatedObject, bool sbOffsets)
Constructor.
void setSbOffsetsEnabled(bool enable)
Use SB offsets?
CFsxP3DSettings()=default
Default constructor.
void setAddingAsSimulatedObjectEnabled(bool enable)
Use simulated object adding.
bool isSbOffsetsEnabled() const
Are SB offsets enabled.
Bundle of detail settings.
Bundle of settings for all simulators.
void settingsChanged(const swift::misc::simulation::CSimulatorInfo &simulator)
Simulator settings have been changed.
Settings regarding message handling. Driver independent part, related to network.
TextMessageTypeFlag
Enabled matching mode flags.
bool isRelayGloballyEnabled() const
Globally enabled?
Settings for simulator Driver independent parts (such as directories), also used in model loaders.
bool isComIntegrated() const
COM unit integration.
bool hasSimulatorDirectory() const
Setting has simulator setting.
bool hasModelDirectories() const
Having model directories?
swift::misc::physical_quantities::CLength getRecordedGndRadius() const
Record GND values with radius.
bool hasModelExcludeDirectoryPatterns() const
Having model exclude directoy patterns?
CGSource
Where we get the CG (aka vertical offset) from.
CSimulatorSettings(const QString &simDir)
Constructor.
bool isRecordOwnAircraftGnd() const
Record GND values (of own aircraft)
CSimulatorSettings()=default
Default constructor.
@ IndexComIntegration
COM unit integration.
CGSource getCGSource() const
CG source.
Allows to have specific utility functions for each simulator.
CSpecializedSimulatorSettings(const CSimulatorSettings &settings, const CSimulatorInfo &simulator)
Ctor.
bool addModelDirectory(const QString &modelDirectory)
Add (if not exists) model directory.
CSimulatorInfo m_simulator
represented simulator
CSimulatorSettings m_genericSettings
the generic settings
CSpecializedSimulatorSettings(const QString &simulatorDir, const CSimulatorInfo &simulator)
Ctor.
const CSimulatorSettings & getGenericSettings() const
Get the generic settings.
void clearModelDirectories()
Clear the model directories.
void setSimulatorDirectory(const QString &simDir)
Set simulator directory.
const CSimulatorSettings & getSimulatorSettings() const
The generic settings.
XPlane specific settings.
CXPlaneSimulatorSettings(const CSimulatorSettings &settings)
Constructor.
CXPlaneSimulatorSettings(const CSpecializedSimulatorSettings &settings)
Constructor.
StatusSeverity
Status severities.
Base class for traits to be used as template argument to swift::misc::CSetting.
static const QString & humanReadable()
Optional human readable name.
static const CFsxP3DSettings & defaultValue()
Return the value to use in case the supplied value does not satisfy the validator....
static const char * key()
Key string of the value. Reimplemented in derived class.
static const char * key()
Key string of the value. Reimplemented in derived class.
static const CFsxP3DSettings & defaultValue()
Return the value to use in case the supplied value does not satisfy the validator....
static const QString & humanReadable()
Optional human readable name.
Selected P3D version (64bit)
static const QString & humanReadable()
Optional human readable name.
static const QString & defaultValue()
Return the value to use in case the supplied value does not satisfy the validator....
static const char * key()
Key string of the value. Reimplemented in derived class.
Trait for simulator settings.
static const QString & humanReadable()
Optional human readable name.
static const char * key()
Key string of the value. Reimplemented in derived class.
Trait for simulator message settings.
static const QString & humanReadable()
Optional human readable name.
static const char * key()
Key string of the value. Reimplemented in derived class.
Trait for simulator settings.
static const char * key()
Key string of the value. Reimplemented in derived class.
static const QString & humanReadable()
Optional human readable name.
Trait for simulator settings.
static const char * key()
Key string of the value. Reimplemented in derived class.
static const QString & humanReadable()
Optional human readable name.
Trait for simulator settings.
static const char * key()
Key string of the value. Reimplemented in derived class.
static const QString & humanReadable()
Optional human readable name.
Trait for simulator settings.
static const QString & humanReadable()
Optional human readable name.
static const char * key()
Key string of the value. Reimplemented in derived class.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...