mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +08:00
Ref T229, do not display a directory if same as default
* component: made overlay compliant * sim.dir can be empty on a machine where no simulator is installed * formatting * utility functions
This commit is contained in:
@@ -25,8 +25,14 @@ namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
const CLogCategoryList &CSettingsSimulatorBasicsComponent::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats({ CLogCategory::guiComponent(), CLogCategory::wizard() });
|
||||
return cats;
|
||||
}
|
||||
|
||||
CSettingsSimulatorBasicsComponent::CSettingsSimulatorBasicsComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
COverlayMessagesFrame(parent),
|
||||
ui(new Ui::CSettingsSimulatorBasicsComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@@ -112,6 +118,13 @@ namespace BlackGui
|
||||
const QString simulatorDir(ui->le_SimulatorDirectory->text().trimmed());
|
||||
const QStringList modelDirs(this->parseDirectories(ui->pte_ModelDirectories->toPlainText()));
|
||||
const QStringList excludeDirs(this->parseDirectories(ui->pte_ExcludeDirectories->toPlainText()));
|
||||
|
||||
if (simulatorDir.trimmed().isEmpty())
|
||||
{
|
||||
this->showOverlayMessage(CStatusMessage(this).validationError("Empty simulator directory"));
|
||||
return;
|
||||
}
|
||||
|
||||
const QStringList relativeDirs = CFileUtils::makeDirectoriesRelative(excludeDirs, this->getFileBrowserModelDirectory(), m_fileCaseSensitivity);
|
||||
s.setSimulatorDirectory(simulatorDir);
|
||||
s.setModelDirectories(modelDirs);
|
||||
@@ -187,7 +200,8 @@ namespace BlackGui
|
||||
const QString raw = rawString.trimmed();
|
||||
if (raw.isEmpty()) { return QStringList(); }
|
||||
QStringList dirs;
|
||||
const QStringList rawLines = raw.split(QRegularExpression("\n|\r\n|\r"));
|
||||
static thread_local QRegularExpression regExp("\n|\r\n|\r");
|
||||
const QStringList rawLines = raw.split(regExp);
|
||||
for (const QString &l : rawLines)
|
||||
{
|
||||
const QString normalized = CFileUtils::normalizeFilePathToQtStandard(l);
|
||||
@@ -238,10 +252,9 @@ namespace BlackGui
|
||||
|
||||
void CSettingsSimulatorBasicsComponent::displaySettings(const CSimulatorInfo &simulator)
|
||||
{
|
||||
const CSimulatorSettings s = this->getSettings(simulator);
|
||||
this->displayExcludeDirectoryPatterns(s.getModelExcludeDirectoryPatterns());
|
||||
this->displayModelDirectories(s.getModelDirectories());
|
||||
ui->le_SimulatorDirectory->setText(s.getSimulatorDirectory());
|
||||
this->displayExcludeDirectoryPatterns(m_settings.getModelExcludeDirectoryPatternsIfNotDefault(simulator));
|
||||
this->displayModelDirectories(m_settings.getModelDirectoriesIfNotDefault(simulator));
|
||||
ui->le_SimulatorDirectory->setText(m_settings.getSimulatorDirectoryIfNotDefault(simulator));
|
||||
}
|
||||
|
||||
void CSettingsSimulatorBasicsComponent::displayDefaultValuesAsPlaceholder(const CSimulatorInfo &simulator)
|
||||
|
||||
@@ -12,8 +12,11 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_SETTINGSSIMULATORBASICSCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_SETTINGSSIMULATORBASICSCOMPONENT_H
|
||||
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "blackmisc/simulation/settings/simulatorsettings.h"
|
||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||
#include "blackmisc/logcategorylist.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QFileDialog>
|
||||
|
||||
@@ -26,11 +29,14 @@ namespace BlackGui
|
||||
* Driver independent parts of simulator settings, ie those one are also used independent of the driver.
|
||||
* Example: model paths used in loaders
|
||||
*/
|
||||
class CSettingsSimulatorBasicsComponent : public QFrame
|
||||
class CSettingsSimulatorBasicsComponent : public COverlayMessagesFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Log categories
|
||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||
|
||||
//! Constructor
|
||||
explicit CSettingsSimulatorBasicsComponent(QWidget *parent = nullptr);
|
||||
|
||||
@@ -51,13 +57,28 @@ namespace BlackGui
|
||||
BlackMisc::Simulation::Settings::CMultiSimulatorSettings m_settings { this };
|
||||
Qt::CaseSensitivity m_fileCaseSensitivity = BlackMisc::CFileUtils::osFileNameCaseSensitivity();
|
||||
|
||||
//! Model file dialog
|
||||
void modelFileDialog();
|
||||
|
||||
//! Exclude file dialog
|
||||
void excludeFileDialog();
|
||||
|
||||
//! Simulator file dialog
|
||||
void simulatorFileDialog();
|
||||
|
||||
//! Simulator directory entered
|
||||
void simulatorDirectoryEntered();
|
||||
|
||||
//! Copy the default values
|
||||
void copyDefaults();
|
||||
|
||||
//! Adjust model directory
|
||||
void adjustModelDirectory();
|
||||
|
||||
//! Reset values
|
||||
void reset();
|
||||
|
||||
//! Simulator has been changed
|
||||
void simulatorChanged();
|
||||
|
||||
//! Optimize for small layout
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace BlackMisc
|
||||
|
||||
QString CFsCommonUtil::fsxSimObjectsDirFromSimDir(const QString &simDir)
|
||||
{
|
||||
Q_ASSERT_X(!simDir.isEmpty(), Q_FUNC_INFO, "missing simulator directory");
|
||||
if (simDir.isEmpty()) { return QStringLiteral(""); }
|
||||
return CFileUtils::appendFilePaths(simDir, "SimObjects");
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ namespace BlackMisc
|
||||
{
|
||||
FsRegistryPathPair p3dRegistryPathPairs =
|
||||
{
|
||||
{ QStringLiteral("HKEY_CURRENT_USER\\Software\\Lockheed Martin\\Prepar3d v4"), QStringLiteral("AppPath") },
|
||||
{ QStringLiteral("HKEY_CURRENT_USER\\Software\\Lockheed Martin\\Prepar3d v3"), QStringLiteral("AppPath") },
|
||||
{ QStringLiteral("HKEY_CURRENT_USER\\Software\\Lockheed Martin\\Prepar3d v2"), QStringLiteral("AppPath") },
|
||||
{ QStringLiteral("HKEY_CURRENT_USER\\Software\\LockheedMartin\\Prepar3d"), QStringLiteral("AppPath") }
|
||||
@@ -164,6 +165,7 @@ namespace BlackMisc
|
||||
if (!dir.isEmpty()) { return dir; }
|
||||
const QStringList someDefaultDirs(
|
||||
{
|
||||
"C:/Program Files (x86)/Lockheed Martin/Prepar3D v4",
|
||||
"C:/Program Files (x86)/Lockheed Martin/Prepar3D v3",
|
||||
"C:/Program Files (x86)/Lockheed Martin/Prepar3D v2",
|
||||
"C:/Program Files (x86)/Lockheed Martin/Prepar3D"
|
||||
@@ -271,7 +273,7 @@ namespace BlackMisc
|
||||
QString fs9AircraftDirFromRegistryImpl()
|
||||
{
|
||||
QString fs9Path = CFsCommonUtil::fs9DirFromRegistry();
|
||||
if (fs9Path.isEmpty()) { return ""; }
|
||||
if (fs9Path.isEmpty()) { return QStringLiteral(""); }
|
||||
return CFsCommonUtil::fs9AircraftDirFromSimDir(fs9Path);
|
||||
}
|
||||
|
||||
@@ -284,7 +286,7 @@ namespace BlackMisc
|
||||
QString fs9AircraftDirImpl()
|
||||
{
|
||||
const QString dir(CFsCommonUtil::fs9Dir());
|
||||
if (dir.isEmpty()) { return ""; }
|
||||
if (dir.isEmpty()) { return QStringLiteral(""); }
|
||||
return CFsCommonUtil::fs9AircraftDirFromSimDir(dir);
|
||||
}
|
||||
|
||||
@@ -296,7 +298,7 @@ namespace BlackMisc
|
||||
|
||||
QString CFsCommonUtil::fs9AircraftDirFromSimDir(const QString &simDir)
|
||||
{
|
||||
Q_ASSERT_X(!simDir.isEmpty(), Q_FUNC_INFO, "missing simulator directory");
|
||||
if (simDir.isEmpty()) { return QStringLiteral(""); }
|
||||
return CFileUtils::appendFilePaths(simDir, "Aircraft");
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "blackmisc/simulation/fscommon/fscommonutil.h"
|
||||
#include "blackmisc/simulation/xplane/xplaneutil.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
@@ -82,12 +83,11 @@ namespace BlackMisc
|
||||
QString CSimulatorSettings::convertToQString(const QString &separator, bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
QString s("model directories: ");
|
||||
s.append(m_modelDirectories.join(','));
|
||||
s.append(separator);
|
||||
s.append("exclude directories: ");
|
||||
s.append(m_excludeDirectoryPatterns.join(','));
|
||||
return s;
|
||||
return QStringLiteral("model directories: ") %
|
||||
m_modelDirectories.join(',') %
|
||||
separator %
|
||||
QStringLiteral("exclude directories: ") %
|
||||
m_excludeDirectoryPatterns.join(',');
|
||||
}
|
||||
|
||||
CVariant CSimulatorSettings::propertyByIndex(const CPropertyIndex &index) const
|
||||
@@ -185,30 +185,36 @@ namespace BlackMisc
|
||||
return CStatusMessage({ CLogCategory::settings() }, CStatusMessage::SeverityError, "wrong simulator");
|
||||
}
|
||||
|
||||
QString CMultiSimulatorSettings::getSimulatorDirectoryIfNotDefault(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
const CSimulatorSettings s = this->getSettings(simulator);
|
||||
const QString dir = s.getSimulatorDirectory();
|
||||
if (dir.isEmpty() || dir == CMultiSimulatorSettings::getDefaultSimulatorDirectory(simulator))
|
||||
{
|
||||
return QStringLiteral("");
|
||||
}
|
||||
return s.getSimulatorDirectory();
|
||||
}
|
||||
|
||||
QString CMultiSimulatorSettings::getSimulatorDirectoryOrDefault(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
const CSimulatorSettings s = this->getSettings(simulator);
|
||||
if (s.getSimulatorDirectory().isEmpty())
|
||||
{
|
||||
return this->getDefaultSimulatorDirectory(simulator);
|
||||
return CMultiSimulatorSettings::getDefaultSimulatorDirectory(simulator);
|
||||
}
|
||||
return s.getSimulatorDirectory();
|
||||
}
|
||||
|
||||
QString CMultiSimulatorSettings::getDefaultSimulatorDirectory(const CSimulatorInfo &simulator) const
|
||||
QStringList CMultiSimulatorSettings::getModelDirectoriesIfNotDefault(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
const CSimulatorSettings s = this->getSettings(simulator);
|
||||
const QStringList dirs = s.getModelDirectories();
|
||||
if (dirs.isEmpty() || dirs == CMultiSimulatorSettings::getDefaultModelDirectories(simulator))
|
||||
{
|
||||
case CSimulatorInfo::FS9: return CFsCommonUtil::fs9Dir();
|
||||
case CSimulatorInfo::FSX: return CFsCommonUtil::fsxDir();
|
||||
case CSimulatorInfo::P3D: return CFsCommonUtil::p3dDir();
|
||||
case CSimulatorInfo::XPLANE: return CXPlaneUtil::xplaneRootDir(); //! check XP
|
||||
default:
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
break;
|
||||
return QStringList();
|
||||
}
|
||||
return "";
|
||||
return dirs;
|
||||
}
|
||||
|
||||
QStringList CMultiSimulatorSettings::getModelDirectoriesOrDefault(const CSimulatorInfo &simulator) const
|
||||
@@ -245,6 +251,17 @@ namespace BlackMisc
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QStringList CMultiSimulatorSettings::getModelExcludeDirectoryPatternsIfNotDefault(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
const CSimulatorSettings s = this->getSettings(simulator);
|
||||
const QStringList patterns = s.getModelExcludeDirectoryPatterns();
|
||||
if (patterns.isEmpty() || patterns == CMultiSimulatorSettings::getDefaultModelExcludeDirectoryPatterns(simulator))
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
return patterns;
|
||||
}
|
||||
|
||||
QStringList CMultiSimulatorSettings::getModelExcludeDirectoryPatternsOrDefault(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
const CSimulatorSettings s = this->getSettings(simulator);
|
||||
@@ -277,6 +294,23 @@ namespace BlackMisc
|
||||
this->setAndSaveSettings(s, simulator);
|
||||
}
|
||||
|
||||
QString CMultiSimulatorSettings::getDefaultSimulatorDirectory(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return CFsCommonUtil::fs9Dir();
|
||||
case CSimulatorInfo::FSX: return CFsCommonUtil::fsxDir();
|
||||
case CSimulatorInfo::P3D: return CFsCommonUtil::p3dDir();
|
||||
case CSimulatorInfo::XPLANE: return CXPlaneUtil::xplaneRootDir(); //! check XPlane
|
||||
default:
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
break;
|
||||
}
|
||||
static const QString empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
CSimulatorMessagesSettings::CSimulatorMessagesSettings()
|
||||
{
|
||||
// void
|
||||
@@ -392,7 +426,7 @@ namespace BlackMisc
|
||||
QString severity;
|
||||
if (this->isRelayedTechnicalMessages())
|
||||
{
|
||||
severity = "No tech. msgs";
|
||||
severity = QStringLiteral("No tech. msgs");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -33,13 +33,13 @@ namespace BlackMisc
|
||||
//! Settings for simulator
|
||||
//! Driver independent part also used in loaders (such as directories)
|
||||
class BLACKMISC_EXPORT CSimulatorSettings :
|
||||
public BlackMisc::CValueObject<CSimulatorSettings>
|
||||
public CValueObject<CSimulatorSettings>
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
enum ColumnIndex
|
||||
{
|
||||
IndexSimulatorDirectory = BlackMisc::CPropertyIndex::GlobalIndexCSimulatorSettings,
|
||||
IndexSimulatorDirectory = CPropertyIndex::GlobalIndexCSimulatorSettings,
|
||||
IndexModelDirectory,
|
||||
IndexModelExcludeDirectoryPatterns
|
||||
};
|
||||
@@ -81,10 +81,10 @@ namespace BlackMisc
|
||||
QString convertToQString(const QString &separator, bool i18n = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
|
||||
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
private:
|
||||
QString m_simulatorDirectory; //! Simulator directory
|
||||
@@ -100,7 +100,7 @@ namespace BlackMisc
|
||||
};
|
||||
|
||||
//! Trait for simulator settings
|
||||
struct TSimulatorFsx : public BlackMisc::TSettingTrait<CSimulatorSettings>
|
||||
struct TSimulatorFsx : public TSettingTrait<CSimulatorSettings>
|
||||
{
|
||||
//! \copydoc BlackCore::TSettingTrait::key
|
||||
static const char *key() { return "settingssimulatorfsx"; }
|
||||
@@ -110,7 +110,7 @@ namespace BlackMisc
|
||||
};
|
||||
|
||||
//! Trait for simulator settings
|
||||
struct TSimulatorFs9 : public BlackMisc::TSettingTrait<CSimulatorSettings>
|
||||
struct TSimulatorFs9 : public TSettingTrait<CSimulatorSettings>
|
||||
{
|
||||
//! \copydoc BlackCore::TSettingTrait::key
|
||||
static const char *key() { return "settingssimulatorfs9"; }
|
||||
@@ -120,7 +120,7 @@ namespace BlackMisc
|
||||
};
|
||||
|
||||
//! Trait for simulator settings
|
||||
struct TSimulatorP3D : public BlackMisc::TSettingTrait<CSimulatorSettings>
|
||||
struct TSimulatorP3D : public TSettingTrait<CSimulatorSettings>
|
||||
{
|
||||
//! \copydoc BlackCore::TSettingTrait::key
|
||||
static const char *key() { return "settingssimulatorp3d"; }
|
||||
@@ -130,7 +130,7 @@ namespace BlackMisc
|
||||
};
|
||||
|
||||
//! Trait for simulator settings
|
||||
struct TSimulatorXP : public BlackMisc::TSettingTrait<CSimulatorSettings>
|
||||
struct TSimulatorXP : public TSettingTrait<CSimulatorSettings>
|
||||
{
|
||||
//! \copydoc BlackCore::TSettingTrait::key
|
||||
static const char *key() { return "settingssimulatorxplane"; }
|
||||
@@ -149,58 +149,67 @@ namespace BlackMisc
|
||||
CMultiSimulatorSettings(QObject *parent = nullptr);
|
||||
|
||||
//! Settings per simulator
|
||||
CSimulatorSettings getSettings(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
CSimulatorSettings getSettings(const CSimulatorInfo &simulator) const;
|
||||
|
||||
//! Set settings per simulator
|
||||
BlackMisc::CStatusMessage setSettings(const BlackMisc::Simulation::Settings::CSimulatorSettings &settings, const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
CStatusMessage setSettings(const Settings::CSimulatorSettings &settings, const CSimulatorInfo &simulator);
|
||||
|
||||
//! Set settings per simulator
|
||||
BlackMisc::CStatusMessage setAndSaveSettings(const BlackMisc::Simulation::Settings::CSimulatorSettings &settings, const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
CStatusMessage setAndSaveSettings(const Settings::CSimulatorSettings &settings, const CSimulatorInfo &simulator);
|
||||
|
||||
//! Set settings per simulator
|
||||
BlackMisc::CStatusMessage saveSettings(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
CStatusMessage saveSettings(const CSimulatorInfo &simulator);
|
||||
|
||||
//! Simulator directory or empty if default dir
|
||||
QString getSimulatorDirectoryIfNotDefault(const CSimulatorInfo &simulator) const;
|
||||
|
||||
//! Simulator directory or default model path per simulator
|
||||
QString getSimulatorDirectoryOrDefault(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
QString getSimulatorDirectoryOrDefault(const CSimulatorInfo &simulator) const;
|
||||
|
||||
//! Default simulator path per simulator
|
||||
QString getDefaultSimulatorDirectory(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
//! Model directory or or empty if default
|
||||
QStringList getModelDirectoriesIfNotDefault(const CSimulatorInfo &simulator) const;
|
||||
|
||||
//! Model directory or default model path per simulator
|
||||
QStringList getModelDirectoriesOrDefault(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
QStringList getModelDirectoriesOrDefault(const CSimulatorInfo &simulator) const;
|
||||
|
||||
//! First model directoy
|
||||
QString getFirstModelDirectoryOrDefault(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
QString getFirstModelDirectoryOrDefault(const CSimulatorInfo &simulator) const;
|
||||
|
||||
//! Default model path per simulator
|
||||
QStringList getDefaultModelDirectories(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
QStringList getDefaultModelDirectories(const CSimulatorInfo &simulator) const;
|
||||
|
||||
//! Model exclude paths per simulator
|
||||
QStringList getModelExcludeDirectoryPatternsOrDefault(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
//! Model exclude patterns or empty if default
|
||||
QStringList getModelExcludeDirectoryPatternsIfNotDefault(const CSimulatorInfo &simulator) const;
|
||||
|
||||
//! Default model exclude paths per simulator
|
||||
QStringList getDefaultModelExcludeDirectoryPatterns(const BlackMisc::Simulation::CSimulatorInfo &simulator) const;
|
||||
//! Model exclude patterns per simulator
|
||||
QStringList getModelExcludeDirectoryPatternsOrDefault(const CSimulatorInfo &simulator) const;
|
||||
|
||||
//! Default model exclude patterns per simulator
|
||||
QStringList getDefaultModelExcludeDirectoryPatterns(const CSimulatorInfo &simulator) const;
|
||||
|
||||
//! Reset to defaults
|
||||
void resetToDefaults(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
void resetToDefaults(const CSimulatorInfo &simulator);
|
||||
|
||||
//! Default simulator path per simulator
|
||||
static QString getDefaultSimulatorDirectory(const CSimulatorInfo &simulator);
|
||||
|
||||
private:
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TSimulatorFsx> m_simSettingsFsx {this}; //!< FSX cache
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TSimulatorFs9> m_simSettingsFs9 {this}; //!< FS9 cache
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TSimulatorP3D> m_simSettingsP3D {this}; //!< P3D cache
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TSimulatorXP> m_simSettingsXP {this}; //!< XP cache
|
||||
CSetting<Settings::TSimulatorFsx> m_simSettingsFsx {this}; //!< FSX cache
|
||||
CSetting<Settings::TSimulatorFs9> m_simSettingsFs9 {this}; //!< FS9 cache
|
||||
CSetting<Settings::TSimulatorP3D> m_simSettingsP3D {this}; //!< P3D cache
|
||||
CSetting<Settings::TSimulatorXP> m_simSettingsXP {this}; //!< XP cache
|
||||
};
|
||||
|
||||
//! Settings regarding message handling.
|
||||
//! Driver independent part, related to network
|
||||
class BLACKMISC_EXPORT CSimulatorMessagesSettings :
|
||||
public BlackMisc::CValueObject<CSimulatorMessagesSettings>
|
||||
public CValueObject<CSimulatorMessagesSettings>
|
||||
{
|
||||
public:
|
||||
//! Properties by index
|
||||
enum ColumnIndex
|
||||
{
|
||||
IndexTechnicalLogSeverity = BlackMisc::CPropertyIndex::GlobalIndexCSimulatorMessageSettings,
|
||||
IndexTechnicalLogSeverity = CPropertyIndex::GlobalIndexCSimulatorMessageSettings,
|
||||
IndexTextMessageRelay,
|
||||
IndexGloballyEnabled
|
||||
};
|
||||
@@ -225,10 +234,10 @@ namespace BlackMisc
|
||||
void setTechnicalLogSeverity(BlackMisc::CStatusMessage::StatusSeverity severity);
|
||||
|
||||
//! Globally enable / disable
|
||||
void setGloballyEnabled(bool enabled) { this->m_globallyEnabled = enabled; }
|
||||
void setGloballyEnabled(bool enabled) { m_globallyEnabled = enabled; }
|
||||
|
||||
//! Globally enabled?
|
||||
bool isGloballyEnabled() const { return this->m_globallyEnabled; }
|
||||
bool isGloballyEnabled() const { return m_globallyEnabled; }
|
||||
|
||||
//! No technical messages
|
||||
void disableTechnicalMessages();
|
||||
@@ -246,7 +255,7 @@ namespace BlackMisc
|
||||
bool isRelayedTechnicalMessages() const;
|
||||
|
||||
//! Relay the following message types
|
||||
void setRelayedTextMessages(BlackMisc::Simulation::Settings::CSimulatorMessagesSettings::TextMessageType messageType);
|
||||
void setRelayedTextMessages(Settings::CSimulatorMessagesSettings::TextMessageType messageType);
|
||||
|
||||
//! Relay supervisor messages
|
||||
bool isRelayedSupervisorTextMessages() const;
|
||||
@@ -264,10 +273,10 @@ namespace BlackMisc
|
||||
bool isRelayedCom2TextMessages() const;
|
||||
|
||||
//! Relay given text message
|
||||
bool relayThisTextMessage(const BlackMisc::Network::CTextMessage &msg, const BlackMisc::Simulation::CSimulatedAircraft &aircraft) const;
|
||||
bool relayThisTextMessage(const Network::CTextMessage &msg, const CSimulatedAircraft &aircraft) const;
|
||||
|
||||
//! Relay this particular message
|
||||
bool relayThisStatusMessage(const BlackMisc::CStatusMessage &message) const;
|
||||
bool relayThisStatusMessage(const CStatusMessage &message) const;
|
||||
|
||||
//! Relayed text messages
|
||||
CSimulatorMessagesSettings::TextMessageType getRelayedTextMessageTypes() const;
|
||||
@@ -276,13 +285,13 @@ namespace BlackMisc
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
BlackMisc::CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
|
||||
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||
|
||||
private:
|
||||
int m_technicalLogLevel = BlackMisc::CStatusMessage::SeverityError; //!< Simulator directory
|
||||
int m_technicalLogLevel = CStatusMessage::SeverityError; //!< Simulator directory
|
||||
int m_messageType = static_cast<int>(TextMessagePrivate | TextMessageSupervisor);
|
||||
bool m_globallyEnabled = true; //!< messsage relay enabled to simulator
|
||||
|
||||
@@ -294,7 +303,7 @@ namespace BlackMisc
|
||||
};
|
||||
|
||||
//! Trait for simulator message settings
|
||||
struct TSimulatorMessages : public BlackMisc::TSettingTrait<CSimulatorMessagesSettings>
|
||||
struct TSimulatorMessages : public TSettingTrait<CSimulatorMessagesSettings>
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "settingssimulatormessages"; }
|
||||
@@ -304,7 +313,7 @@ namespace BlackMisc
|
||||
};
|
||||
|
||||
//! Selected weather scenario
|
||||
struct TSelectedWeatherScenario : public BlackMisc::TSettingTrait<BlackMisc::Weather::CWeatherScenario>
|
||||
struct TSelectedWeatherScenario : public TSettingTrait<Weather::CWeatherScenario>
|
||||
{
|
||||
//! \copydoc BlackMisc::TSettingTrait::key
|
||||
static const char *key() { return "simulator/selectedweatherscenario"; }
|
||||
@@ -313,9 +322,9 @@ namespace BlackMisc
|
||||
static const QString &humanReadable() { static const QString name("Weather scenario"); return name; }
|
||||
|
||||
//! \copydoc BlackMisc::TSettingTrait::defaultValue
|
||||
static const BlackMisc::Weather::CWeatherScenario &defaultValue()
|
||||
static const Weather::CWeatherScenario &defaultValue()
|
||||
{
|
||||
static const BlackMisc::Weather::CWeatherScenario scenario {};
|
||||
static const Weather::CWeatherScenario scenario {};
|
||||
return scenario;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user