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