mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Ref T294, display simulator internals correctly
* view rows not selectable * added settings to ISimulator * ISimulator implements initSimulatorInternals() and sets default values * also display plugin name * XPlane using initSimulatorInternals()
This commit is contained in:
@@ -142,7 +142,7 @@ namespace BlackSimPlugin
|
||||
{
|
||||
m_fsuipc->connect(); // connect FSUIPC too
|
||||
}
|
||||
initSimulatorInternals();
|
||||
this->initSimulatorInternals();
|
||||
m_timerId = startTimer(50);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,17 +45,15 @@ namespace BlackSimPlugin
|
||||
|
||||
void CSimulatorFsCommon::initSimulatorInternals()
|
||||
{
|
||||
CSimulatorInternals s;
|
||||
s.setSimulatorName(this->getSimulatorName());
|
||||
s.setSimulatorVersion(this->getSimulatorVersion());
|
||||
s.setValue("fscommon/fsuipc", boolToOnOff(m_useFsuipc));
|
||||
CSimulatorPluginCommon::initSimulatorInternals();
|
||||
m_simulatorInternals.setSimulatorVersion(this->getSimulatorVersion());
|
||||
m_simulatorInternals.setValue("fscommon/fsuipc", boolToOnOff(m_useFsuipc));
|
||||
if (m_fsuipc)
|
||||
{
|
||||
const QString v(m_fsuipc->getVersion());
|
||||
if (!v.isEmpty()) { s.setValue("fscommon/fsuipcversion", v); }
|
||||
s.setValue("fscommon/fsuipcconnect", boolToYesNo(m_fsuipc->isConnected()));
|
||||
if (!v.isEmpty()) { m_simulatorInternals.setValue("fscommon/fsuipcversion", v); }
|
||||
m_simulatorInternals.setValue("fscommon/fsuipcconnect", boolToYesNo(m_fsuipc->isConnected()));
|
||||
}
|
||||
m_simulatorInternals = s;
|
||||
}
|
||||
|
||||
bool CSimulatorFsCommon::parseDetails(const CSimpleCommandParser &parser)
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace BlackSimPlugin
|
||||
QObject *parent = nullptr);
|
||||
|
||||
//! Init the internal objects
|
||||
virtual void initSimulatorInternals();
|
||||
virtual void initSimulatorInternals() override;
|
||||
|
||||
//! \name When swift DB data are read
|
||||
//! @{
|
||||
|
||||
@@ -370,10 +370,10 @@ namespace BlackSimPlugin
|
||||
this->initSimulatorInternals();
|
||||
this->emitSimulatorCombinedStatus();
|
||||
|
||||
// Internals depends on sim data which take a while to be read
|
||||
// Internals depends on simulator data which take a while to be read
|
||||
// this is a trick and I re-init again after a while (which is not really expensive)
|
||||
const QPointer<CSimulatorFsxCommon> myself(this);
|
||||
QTimer::singleShot(1000, this, [myself]
|
||||
QTimer::singleShot(2500, this, [myself]
|
||||
{
|
||||
if (myself.isNull()) { return; }
|
||||
myself->initSimulatorInternals();
|
||||
@@ -1833,13 +1833,8 @@ namespace BlackSimPlugin
|
||||
void CSimulatorFsxCommon::initSimulatorInternals()
|
||||
{
|
||||
CSimulatorFsCommon::initSimulatorInternals();
|
||||
CSimulatorInternals s = m_simulatorInternals;
|
||||
const QString fsxPath = CFsCommonUtil::fsxDirFromRegistry(); // can be empty for remote FSX
|
||||
if (!fsxPath.isEmpty()) { s.setSimulatorInstallationDirectory(fsxPath); }
|
||||
|
||||
s.setValue("fsx/simConnectCfgFilename", CSimConnectUtilities::getSwiftLocalSimConnectCfgFilename());
|
||||
s.setValue("fsx/simConnectVersion", m_simConnectVersion);
|
||||
m_simulatorInternals = s;
|
||||
m_simulatorInternals.setValue("fsx/simConnectCfgFilename", CSimConnectUtilities::getSwiftLocalSimConnectCfgFilename());
|
||||
m_simulatorInternals.setValue("fsx/simConnectVersion", m_simConnectVersion);
|
||||
}
|
||||
|
||||
void CSimulatorFsxCommon::reset()
|
||||
|
||||
@@ -294,6 +294,7 @@ namespace BlackSimPlugin
|
||||
m_trafficProxy = new CXSwiftBusTrafficProxy(m_dBusConnection, this);
|
||||
m_weatherProxy = new CXSwiftBusWeatherProxy(m_dBusConnection, this);
|
||||
|
||||
bool ok = false;
|
||||
if (m_serviceProxy->isValid() && m_trafficProxy->isValid() && m_weatherProxy->isValid() && m_trafficProxy->initialize())
|
||||
{
|
||||
emitOwnAircraftModelChanged(m_serviceProxy->getAircraftModelPath(), m_serviceProxy->getAircraftModelFilename(), m_serviceProxy->getAircraftLivery(),
|
||||
@@ -308,13 +309,15 @@ namespace BlackSimPlugin
|
||||
m_trafficProxy->removeAllPlanes();
|
||||
this->loadCslPackages();
|
||||
this->emitSimulatorCombinedStatus();
|
||||
return true;
|
||||
ok = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->disconnectFrom();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ok) { this->initSimulatorInternals(); }
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool CSimulatorXPlane::disconnectFrom()
|
||||
|
||||
Reference in New Issue
Block a user