mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
[P3D] Adjustments for P3D v5
* guess version * added new version selection
This commit is contained in:
committed by
Mat Sutcliffe
parent
828b57f5a2
commit
8278a7d5e6
@@ -148,6 +148,7 @@ namespace BlackGui
|
||||
ui->pb_DisableRendering->setEnabled(m_pluginLoaded);
|
||||
ui->pb_Check->setEnabled(!m_pluginLoaded);
|
||||
ui->pb_ApplyCGSource->setEnabled(m_pluginLoaded);
|
||||
ui->pb_Reload->setEnabled(m_pluginLoaded);
|
||||
|
||||
if (m_pluginLoaded)
|
||||
{
|
||||
|
||||
@@ -65,15 +65,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="wi_Settings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>427</width>
|
||||
<height>328</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_SimulatorSettings" columnstretch="0,0,0">
|
||||
<layout class="QGridLayout" name="gl_SimulatorSettings" columnstretch="1,3,0">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
@@ -102,6 +94,12 @@
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyMaxAircraft">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>apply</string>
|
||||
</property>
|
||||
@@ -109,6 +107,12 @@
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyRecordOwnAircraftGnd">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>apply</string>
|
||||
</property>
|
||||
@@ -192,6 +196,12 @@
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyTimeSync">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>apply</string>
|
||||
</property>
|
||||
@@ -199,6 +209,12 @@
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QPushButton" name="pb_ClearRestrictedRendering">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>clear</string>
|
||||
</property>
|
||||
@@ -213,6 +229,12 @@
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyCGSource">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>apply</string>
|
||||
</property>
|
||||
@@ -220,6 +242,12 @@
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QPushButton" name="pb_DisableRendering">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>disable all rendering</string>
|
||||
</property>
|
||||
@@ -264,6 +292,12 @@
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyMaxDistance">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>apply</string>
|
||||
</property>
|
||||
@@ -391,6 +425,12 @@
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pb_ApplyComSync">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>apply</string>
|
||||
</property>
|
||||
@@ -408,6 +448,12 @@
|
||||
</item>
|
||||
<item row="12" column="2">
|
||||
<widget class="QPushButton" name="pb_Reload">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>125</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>reload</string>
|
||||
</property>
|
||||
|
||||
@@ -243,7 +243,7 @@ namespace BlackMisc
|
||||
{
|
||||
// finding the user settings only works on P3D machine
|
||||
QStringList allPaths = CFsCommonUtil::allP3dAddOnXmlSimObjectPaths(versionHint).values();
|
||||
const QString sod = CFileUtils::normalizeFilePathToQtStandard(simObjectsDir.isEmpty() ? CFsCommonUtil::p3dSimObjectsDir() : simObjectsDir);
|
||||
const QString sod = CFileUtils::normalizeFilePathToQtStandard(simObjectsDir.isEmpty() ? CFsCommonUtil::p3dSimObjectsDir() : simObjectsDir);
|
||||
if (!sod.isEmpty() && !allPaths.contains(sod, Qt::CaseInsensitive))
|
||||
{
|
||||
// case insensitive is important here
|
||||
@@ -256,6 +256,18 @@ namespace BlackMisc
|
||||
return allPaths;
|
||||
}
|
||||
|
||||
QString CFsCommonUtil::guessP3DVersion(const QString &candidate)
|
||||
{
|
||||
if (candidate.isEmpty()) { return "v4"; }
|
||||
if (candidate.contains("v5", Qt::CaseInsensitive)) { return QStringLiteral("v5"); }
|
||||
if (candidate.contains("v4", Qt::CaseInsensitive)) { return QStringLiteral("v4"); }
|
||||
|
||||
if (candidate.contains("5", Qt::CaseInsensitive)) { return QStringLiteral("v5"); }
|
||||
if (candidate.contains("4", Qt::CaseInsensitive)) { return QStringLiteral("v4"); }
|
||||
|
||||
return "v5"; // that is the future (in 2020)
|
||||
}
|
||||
|
||||
QString CFsCommonUtil::p3dSimObjectsDirFromSimDir(const QString &simDir)
|
||||
{
|
||||
if (simDir.isEmpty()) { return {}; }
|
||||
|
||||
@@ -57,7 +57,10 @@ namespace BlackMisc
|
||||
static QStringList fsxSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir = "");
|
||||
|
||||
//! P3D's simObject dir and the add on dirs
|
||||
static QStringList p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir = "", const QString &versionHint = "v4");
|
||||
static QStringList p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(const QString &simObjectsDir, const QString &versionHint);
|
||||
|
||||
//! Guess the P3D version such as v4, v5
|
||||
static QString guessP3DVersion(const QString &candidate);
|
||||
|
||||
//! P3D directory obtained from registry
|
||||
static const QString &p3dDirFromRegistry();
|
||||
|
||||
@@ -588,12 +588,15 @@ namespace BlackMisc
|
||||
switch (m_simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FG: dirs = QStringList(CFlightgearUtil::modelDirectoriesFromSimDir(s)); break;
|
||||
case CSimulatorInfo::FS9: dirs = QStringList({CFsCommonUtil::fs9AircraftDirFromSimDir(s)}); break;
|
||||
case CSimulatorInfo::FS9: dirs = QStringList({ CFsCommonUtil::fs9AircraftDirFromSimDir(s) }); break;
|
||||
case CSimulatorInfo::FSX:
|
||||
dirs = CFsCommonUtil::fsxSimObjectsDirPlusAddOnXmlSimObjectsPaths(CFsCommonUtil::fsxSimObjectsDirFromSimDir(s));
|
||||
break;
|
||||
case CSimulatorInfo::P3D:
|
||||
dirs = CFsCommonUtil::p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(CFsCommonUtil::p3dSimObjectsDirFromSimDir(s));
|
||||
{
|
||||
const QString versionHint = CFsCommonUtil::guessP3DVersion(s);
|
||||
dirs = CFsCommonUtil::p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(CFsCommonUtil::p3dSimObjectsDirFromSimDir(s), versionHint);
|
||||
}
|
||||
break;
|
||||
case CSimulatorInfo::XPLANE: dirs = QStringList({CXPlaneUtil::modelDirectoriesFromSimDir(s)}); break;
|
||||
default: break;
|
||||
@@ -678,8 +681,10 @@ namespace BlackMisc
|
||||
}
|
||||
case CSimulatorInfo::P3D:
|
||||
{
|
||||
if (CFsCommonUtil::p3dSimObjectsDir().isEmpty()) { return e; }
|
||||
static const QStringList md = CFsCommonUtil::p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths();
|
||||
static const QString p3d = CFsCommonUtil::p3dSimObjectsDir();
|
||||
if (p3d.isEmpty()) { return e; }
|
||||
static const QString versionHint = CFsCommonUtil::guessP3DVersion(p3d);
|
||||
static const QStringList md = CFsCommonUtil::p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(p3d, versionHint);
|
||||
return md;
|
||||
}
|
||||
case CSimulatorInfo::XPLANE:
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace BlackMisc
|
||||
|
||||
protected:
|
||||
CSimulatorSettings m_genericSettings; //!< the generic settings
|
||||
CSimulatorInfo m_simulator; //!< represented simulator
|
||||
CSimulatorInfo m_simulator; //!< represented simulator
|
||||
};
|
||||
|
||||
//! XPlane specific settings
|
||||
|
||||
@@ -39,13 +39,13 @@ namespace BlackSimPlugin
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->pb_OpenSwiftSimConnectCfg, &QPushButton::clicked, this, &CSimConnectSettingsComponent::openSwiftSimConnectCfgFile);
|
||||
connect(ui->pb_OpenSwiftSimConnectCfg, &QPushButton::clicked, this, &CSimConnectSettingsComponent::openSwiftSimConnectCfgFile);
|
||||
connect(ui->pb_DeleteSwiftSimConnectCfg, &QPushButton::clicked, this, &CSimConnectSettingsComponent::deleteSwiftSimConnectCfgFile);
|
||||
connect(ui->pb_ExistsSimConnectCfg, &QPushButton::clicked, this, &CSimConnectSettingsComponent::checkSwiftSimConnectCfgFile);
|
||||
connect(ui->pb_SaveSwiftSimConnectCfg, &QPushButton::clicked, this, &CSimConnectSettingsComponent::saveSimConnectCfgFile);
|
||||
connect(ui->pb_OpenUserCfgFile, &QPushButton::clicked, this, &CSimConnectSettingsComponent::openUserSimConnectCfgFile);
|
||||
connect(ui->pb_TestConnection, &QPushButton::clicked, this, &CSimConnectSettingsComponent::testSwiftSimConnectConnection);
|
||||
connect(ui->pb_SaveAsSimConnectIni, &QPushButton::clicked, this, &CSimConnectSettingsComponent::saveSimConnectIniFileDialog);
|
||||
connect(ui->pb_ExistsSimConnectCfg, &QPushButton::clicked, this, &CSimConnectSettingsComponent::checkSwiftSimConnectCfgFile);
|
||||
connect(ui->pb_SaveSwiftSimConnectCfg, &QPushButton::clicked, this, &CSimConnectSettingsComponent::saveSimConnectCfgFile);
|
||||
connect(ui->pb_OpenUserCfgFile, &QPushButton::clicked, this, &CSimConnectSettingsComponent::openUserSimConnectCfgFile);
|
||||
connect(ui->pb_TestConnection, &QPushButton::clicked, this, &CSimConnectSettingsComponent::testSwiftSimConnectConnection);
|
||||
connect(ui->pb_SaveAsSimConnectIni, &QPushButton::clicked, this, &CSimConnectSettingsComponent::saveSimConnectIniFileDialog);
|
||||
this->setSimConnectInfo();
|
||||
|
||||
if (m_p3d64bit)
|
||||
@@ -252,7 +252,7 @@ namespace BlackSimPlugin
|
||||
ui->cb_P3DVersion->setCurrentText(found ? v : "");
|
||||
}
|
||||
|
||||
void BlackSimPlugin::FsxCommon::CSimConnectSettingsComponent::onP3DVersionChanged(const QString &version)
|
||||
void CSimConnectSettingsComponent::onP3DVersionChanged(const QString &version)
|
||||
{
|
||||
if (m_p3dVersion.get() == version) { return; }
|
||||
const CStatusMessage saveMsg = m_p3dVersion.setAndSave(version);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>410</width>
|
||||
<height>466</height>
|
||||
<height>481</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -156,11 +156,31 @@ console=1
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cb_P3DVersion">
|
||||
<property name="currentText">
|
||||
<string>4.5 64bit</string>
|
||||
<string>6.0 64bit</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6.0 64bit</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5.2 64bit</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5.1 64bit</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5.0 64bit</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4.5 64bit</string>
|
||||
|
||||
@@ -191,6 +191,11 @@ P3DSimConnectVersion stringToP3DVersion(const QString &p3d)
|
||||
if (p.contains("43")) { return P3DSimConnectv43; }
|
||||
if (p.contains("44")) { return P3DSimConnectv44; }
|
||||
if (p.contains("45")) { return P3DSimConnectv45; }
|
||||
|
||||
if (p.contains("50")) { return P3DSimConnectv45; }
|
||||
if (p.contains("51")) { return P3DSimConnectv45; }
|
||||
if (p.contains("52")) { return P3DSimConnectv45; }
|
||||
|
||||
}
|
||||
return P3DSimConnectv44; // default
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ namespace BlackSimPlugin
|
||||
namespace P3D
|
||||
{
|
||||
CSimulatorP3D::CSimulatorP3D(const CSimulatorPluginInfo &info,
|
||||
IOwnAircraftProvider *ownAircraftProvider,
|
||||
IOwnAircraftProvider *ownAircraftProvider,
|
||||
IRemoteAircraftProvider *remoteAircraftProvider,
|
||||
IWeatherGridProvider *weatherGridProvider,
|
||||
IClientProvider *clientProvider,
|
||||
IWeatherGridProvider *weatherGridProvider,
|
||||
IClientProvider *clientProvider,
|
||||
QObject *parent) :
|
||||
CSimulatorFsxCommon(info, ownAircraftProvider, remoteAircraftProvider, weatherGridProvider, clientProvider, parent)
|
||||
{
|
||||
@@ -104,9 +104,9 @@ namespace BlackSimPlugin
|
||||
// P3D version with new P3D simconnect functions
|
||||
bool CSimulatorP3D::requestElevation(const ICoordinateGeodetic &reference, const CCallsign &callsign)
|
||||
{
|
||||
if (reference.isNull()) { return false; }
|
||||
if (reference.isNull()) { return false; }
|
||||
if (this->isShuttingDown()) { return false; }
|
||||
if (!this->isConnected()) { return false; }
|
||||
if (!this->isConnected()) { return false; }
|
||||
|
||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "thread");
|
||||
const bool hasHeight = reference.hasMSLGeodeticHeight();
|
||||
|
||||
@@ -37,10 +37,10 @@ namespace BlackSimPlugin
|
||||
public:
|
||||
//! Constructor, parameters as in \sa BlackCore::ISimulatorFactory::create
|
||||
CSimulatorP3D(const BlackMisc::Simulation::CSimulatorPluginInfo &info,
|
||||
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
|
||||
BlackMisc::Simulation::IOwnAircraftProvider *ownAircraftProvider,
|
||||
BlackMisc::Simulation::IRemoteAircraftProvider *remoteAircraftProvider,
|
||||
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider,
|
||||
BlackMisc::Network::IClientProvider *clientProvider,
|
||||
BlackMisc::Weather::IWeatherGridProvider *weatherGridProvider,
|
||||
BlackMisc::Network::IClientProvider *clientProvider,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
//! \name ISimulator implementations
|
||||
|
||||
@@ -664,9 +664,10 @@ void CSwiftLauncher::showSimulatorConfigDirs()
|
||||
|
||||
if (s == ui->pb_P3DConfigDirs)
|
||||
{
|
||||
dirs = CFsCommonUtil::p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths();
|
||||
simDir = CFsCommonUtil::p3dDir();
|
||||
simObjDir = CFsCommonUtil::p3dSimObjectsDir();
|
||||
const QString versionHint = CFsCommonUtil::guessP3DVersion(simDir);
|
||||
dirs = CFsCommonUtil::p3dSimObjectsDirPlusAddOnXmlSimObjectsPaths(simObjDir, versionHint);
|
||||
}
|
||||
else if (s == ui->pb_FSXConfigDirs)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user