mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 19:35:32 +08:00
XPlane sub directory check (model dirs in XPlane dir), unified with settings is valid
This commit is contained in:
committed by
Mat Sutcliffe
parent
ac2d665c6b
commit
5799e31d27
@@ -380,7 +380,7 @@ namespace BlackMisc
|
||||
};
|
||||
|
||||
//! Trait for simulator settings
|
||||
struct TSimulatorXP : public TSettingTrait<CSimulatorSettings>
|
||||
struct BLACKMISC_EXPORT TSimulatorXP : public TSettingTrait<CSimulatorSettings>
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "settingssimulatorxplane"; }
|
||||
@@ -389,20 +389,7 @@ namespace BlackMisc
|
||||
static const QString &humanReadable() { static const QString name("XPlane settings"); return name; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::isValid
|
||||
static bool isValid(const CSimulatorSettings &value, QString &reason)
|
||||
{
|
||||
const QString simDir = value.hasSimulatorDirectory() ? value.getSimulatorDirectory()
|
||||
: CSpecializedSimulatorSettings::defaultSimulatorDirectory(CSimulatorInfo::XPLANE);
|
||||
for (const QString &modelDir : value.getModelDirectories())
|
||||
{
|
||||
if (!CDirectoryUtils::isSubDirectoryOf(modelDir, simDir))
|
||||
{
|
||||
reason = QStringLiteral("Model directory must be within the simulator directory structure");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static bool isValid(const CSimulatorSettings &value, QString &reason);
|
||||
};
|
||||
|
||||
//! Trait for simulator settings
|
||||
@@ -457,6 +444,10 @@ namespace BlackMisc
|
||||
//! Clear the model directory
|
||||
CStatusMessage clearModelDirectories(const CSimulatorInfo &simulator);
|
||||
|
||||
//! Set settings per simulator, but do NOT save yet, but validate
|
||||
//! \remark can be simulator specific
|
||||
CStatusMessageList setAndValidateSettings(const CSimulatorSettings &settings, const CSimulatorInfo &simulator);
|
||||
|
||||
//! Set settings per simulator
|
||||
CStatusMessage setAndSaveSettings(const CSimulatorSettings &settings, const CSimulatorInfo &simulator);
|
||||
|
||||
@@ -533,8 +524,8 @@ namespace BlackMisc
|
||||
enum ColumnIndex
|
||||
{
|
||||
IndexTechnicalLogSeverity = CPropertyIndex::GlobalIndexCSimulatorMessageSettings,
|
||||
IndexTextMessageRelay,
|
||||
IndexGloballyEnabled
|
||||
IndexRelayTextMessage,
|
||||
IndexRelayGloballyEnabled
|
||||
};
|
||||
|
||||
//! Enabled matching mode flags
|
||||
@@ -557,10 +548,10 @@ namespace BlackMisc
|
||||
void setTechnicalLogSeverity(CStatusMessage::StatusSeverity severity);
|
||||
|
||||
//! Globally enable / disable
|
||||
void setGloballyEnabled(bool enabled) { m_globallyEnabled = enabled; }
|
||||
void setRelayGloballyEnabled(bool enabled) { m_relayGloballyEnabled = enabled; }
|
||||
|
||||
//! Globally enabled?
|
||||
bool isGloballyEnabled() const { return m_globallyEnabled; }
|
||||
bool isRelayGloballyEnabled() const { return m_relayGloballyEnabled; }
|
||||
|
||||
//! No technical messages
|
||||
void disableTechnicalMessages();
|
||||
@@ -614,9 +605,9 @@ namespace BlackMisc
|
||||
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
private:
|
||||
int m_technicalLogLevel = CStatusMessage::SeverityError; //!< Simulator directory
|
||||
int m_messageType = static_cast<int>(TextMessagePrivate | TextMessageSupervisor);
|
||||
bool m_globallyEnabled = true; //!< messsage relay enabled to simulator
|
||||
int m_technicalLogLevel = CStatusMessage::SeverityError; //!< log level
|
||||
int m_messageType = static_cast<int>(TextMessagePrivate | TextMessageSupervisor);
|
||||
bool m_relayGloballyEnabled = true; //!< messsage relay enabled to simulator
|
||||
|
||||
BLACK_METACLASS(
|
||||
CSimulatorMessagesSettings,
|
||||
|
||||
Reference in New Issue
Block a user