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);
85 const QStringList &getModelDirectories()
const;
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;
139 QString m_simulatorDirectory;
140 QStringList m_modelDirectories;
141 QStringList m_excludeDirectoryPatterns;
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;
231 QStringList getModelDirectoriesOrDefault()
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);
270 static const QStringList &defaultModelDirectories(
const CSimulatorInfo &simulator);
273 static const QString &defaultSimulatorDirectory(
const CSimulatorInfo &simulator);
276 static const QStringList &defaultModelExcludeDirectoryPatterns(
const CSimulatorInfo &simulator);
298 QString getPluginDirOrDefault()
const;
305 static const char *
key() {
return "settingssimulatorfsx"; }
310 static const QString name(
"FSX settings");
319 static const char *
key() {
return "settingssimulatorfs9"; }
324 static const QString name(
"FS9 settings");
333 static const char *
key() {
return "settingssimulatorp3d"; }
338 static const QString name(
"P3D settings");
347 static const char *
key() {
return "settingssimulatormsfs"; }
352 static const QString name(
"MSFS settings");
361 static const char *
key() {
return "settingssimulatormsfs2024"; }
366 static const QString name(
"MSFS2024 settings");
375 static const char *
key() {
return "simulator/p3dversion"; }
380 static const QString name(
"P3D version");
387 static const QString version(
"4.3");
396 static const char *
key() {
return "simulator/fsxdetailsettings"; }
401 static const QString name(
"FSX details");
417 static const char *
key() {
return "simulator/p3ddetailsettings"; }
422 static const QString name(
"P3D details");
438 static const char *
key() {
return "settingssimulatorxplane"; }
443 static const QString name(
"XPlane settings");
455 static const char *
key() {
return "settingssimulatorfg"; }
460 static const QString name(
"FG settings");
522 QString getSimulatorDirectoryIfNotDefault(
const CSimulatorInfo &simulator)
const;
525 QString getSimulatorDirectoryOrDefault(
const CSimulatorInfo &simulator)
const;
528 QStringList getModelDirectoriesIfNotDefault(
const CSimulatorInfo &simulator)
const;
531 QStringList getModelDirectoriesOrDefault(
const CSimulatorInfo &simulator)
const;
534 QString getFirstModelDirectoryOrDefault(
const CSimulatorInfo &simulator)
const;
537 QStringList getModelExcludeDirectoryPatternsIfNotDefault(
const CSimulatorInfo &simulator)
const;
540 QStringList getModelExcludeDirectoryPatternsOrDefault(
const CSimulatorInfo &simulator)
const;
546 const QStringList &defaultModelDirectories(
const CSimulatorInfo &simulator)
const;
554 &CMultiSimulatorSettings::onFsxSettingsChanged };
556 &CMultiSimulatorSettings::onFs9SettingsChanged };
558 &CMultiSimulatorSettings::onP3DSettingsChanged };
560 this, &CMultiSimulatorSettings::onMsfsSettingsChanged
562 CSetting<TSimulatorMsfs2024> m_simSettingsMsfs2024 {
563 this, &CMultiSimulatorSettings::onMsfs2024SettingsChanged
565 CSetting<TSimulatorXP> m_simSettingsXP {
this, &CMultiSimulatorSettings::onXPSettingsChanged };
566 CSetting<TSimulatorFG> m_simSettingsFG {
this, &CMultiSimulatorSettings::onFGSettingsChanged };
570 void onFsxSettingsChanged();
571 void onFs9SettingsChanged();
572 void onP3DSettingsChanged();
573 void onMsfsSettingsChanged();
574 void onMsfs2024SettingsChanged();
575 void onXPSettingsChanged();
576 void onFGSettingsChanged();
580 void emitSettingsChanged(
const CSimulatorInfo &simInfo);
591 IndexTechnicalLogSeverity = CPropertyIndexRef::GlobalIndexCSimulatorMessageSettings,
592 IndexRelayTextMessage,
593 IndexRelayGloballyEnabled
600 TextMessagesUnicom = 1 << 0,
601 TextMessagesCom1 = 1 << 1,
602 TextMessagesCom2 = 1 << 2,
603 TextMessagePrivate = 1 << 3,
604 TextMessageSupervisor = 1 << 4,
605 TextMessagesAll = TextMessagesUnicom | TextMessagesCom1 | TextMessagesCom2 | TextMessagePrivate
607 Q_DECLARE_FLAGS(TextMessageType, TextMessageTypeFlag)
622 void disableTechnicalMessages();
625 bool isRelayErrorsMessages()
const;
628 bool isRelayWarningMessages()
const;
631 bool isRelayInfoMessages()
const;
634 bool isRelayTechnicalMessages()
const;
637 void setRelayTextMessages(CSimulatorMessagesSettings::TextMessageType messageType);
640 bool isRelaySupervisorTextMessages()
const;
643 bool isRelayPrivateTextMessages()
const;
646 bool isRelayUnicomTextMessages()
const;
649 bool isRelayCom1TextMessages()
const;
652 bool isRelayCom2TextMessages()
const;
661 CSimulatorMessagesSettings::TextMessageType getRelayedTextMessageTypes()
const;
664 QString convertToQString(
bool i18n =
false)
const;
674 int m_messageType =
static_cast<int>(TextMessagePrivate | TextMessageSupervisor);
675 bool m_relayGloballyEnabled =
true;
687 static const char *
key() {
return "settingssimulatormessages"; }
692 static const QString name(
"Simulator messages");
706 Q_DECLARE_METATYPE(swift::misc::simulation::settings::CSimulatorMessagesSettings::TextMessageType)
707 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 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.
void setRelayGloballyEnabled(bool enabled)
Globally enable / disable.
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)
@ 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 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 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 ...