mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 00:16:51 +08:00
[XPlane][FG] Q_UNREACHABLE removal follow up
* removed CSimulatorXPlane::connectionFromString as this only works for session DBus * renamed to "checkConnectionViaSessionBus" * discussed around here: https://discordapp.com/channels/539048679160676382/539925070550794240/668105458300485652
This commit is contained in:
@@ -386,7 +386,7 @@ namespace BlackSimPlugin
|
||||
|
||||
if (CDBusServer::isSessionOrSystemAddress(dBusServerAddress))
|
||||
{
|
||||
m_dBusConnection = connectionFromString(dBusServerAddress);
|
||||
m_dBusConnection = QDBusConnection::sessionBus();
|
||||
m_dbusMode = Session;
|
||||
}
|
||||
else if (CDBusServer::isQtDBusAddress(dBusServerAddress))
|
||||
@@ -538,7 +538,7 @@ namespace BlackSimPlugin
|
||||
|
||||
bool CSimulatorXPlane::setTimeSynchronization(bool enable, const PhysicalQuantities::CTime &offset)
|
||||
{
|
||||
Q_UNUSED(offset);
|
||||
Q_UNUSED(offset)
|
||||
if (enable)
|
||||
{
|
||||
CLogMessage(this).info(u"X-Plane provides real time synchronization, use this one");
|
||||
@@ -546,13 +546,6 @@ namespace BlackSimPlugin
|
||||
return false;
|
||||
}
|
||||
|
||||
QDBusConnection CSimulatorXPlane::connectionFromString(const QString &str)
|
||||
{
|
||||
if (str == CDBusServer::sessionBusAddress()) { return QDBusConnection::sessionBus(); }
|
||||
Q_UNREACHABLE();
|
||||
return QDBusConnection("NO CONNECTION");
|
||||
}
|
||||
|
||||
bool CSimulatorXPlane::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
|
||||
{
|
||||
return m_xplaneAircraftObjects.contains(callsign);
|
||||
@@ -1337,7 +1330,7 @@ namespace BlackSimPlugin
|
||||
m_dBusServerAddress = m_xSwiftBusServerSettings.getThreadLocal().getDBusServerAddressQt();
|
||||
if (CDBusServer::isSessionOrSystemAddress(m_dBusServerAddress))
|
||||
{
|
||||
checkConnectionViaBus(m_dBusServerAddress);
|
||||
checkConnectionViaSessionBus();
|
||||
}
|
||||
else if (CDBusServer::isQtDBusAddress(m_dBusServerAddress))
|
||||
{
|
||||
@@ -1345,9 +1338,9 @@ namespace BlackSimPlugin
|
||||
}
|
||||
}
|
||||
|
||||
void CSimulatorXPlaneListener::checkConnectionViaBus(const QString &address)
|
||||
void CSimulatorXPlaneListener::checkConnectionViaSessionBus()
|
||||
{
|
||||
m_DBusConnection = CSimulatorXPlane::connectionFromString(address);
|
||||
m_DBusConnection = QDBusConnection::sessionBus();
|
||||
if (!m_DBusConnection.isConnected())
|
||||
{
|
||||
m_DBusConnection.disconnectFromBus(m_DBusConnection.name());
|
||||
|
||||
@@ -149,9 +149,6 @@ namespace BlackSimPlugin
|
||||
//! \copydoc BlackMisc::Simulation::ISimulationEnvironmentProvider::requestElevation
|
||||
virtual bool requestElevation(const BlackMisc::Geo::ICoordinateGeodetic &reference, const BlackMisc::Aviation::CCallsign &callsign) override;
|
||||
|
||||
//! Creates an appropriate dbus connection from the string describing it
|
||||
static QDBusConnection connectionFromString(const QString &str);
|
||||
|
||||
protected:
|
||||
//! \name ISimulator implementations
|
||||
//! @{
|
||||
@@ -296,7 +293,7 @@ namespace BlackSimPlugin
|
||||
|
||||
private:
|
||||
void checkConnection();
|
||||
void checkConnectionViaBus(const QString &address);
|
||||
void checkConnectionViaSessionBus();
|
||||
void checkConnectionViaPeer(const QString &address);
|
||||
void checkConnectionCommon();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user