mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 23:45:35 +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:
@@ -120,6 +120,7 @@ namespace BlackMisc
|
||||
static bool isQtDBusAddress(const QString &address);
|
||||
|
||||
//! True if address is session or system bus address
|
||||
//! \remark actually swift does NOT support system DBus anymore
|
||||
static bool isSessionOrSystemAddress(const QString &address);
|
||||
|
||||
//! False if address is session or system bus address
|
||||
|
||||
@@ -319,7 +319,7 @@ namespace BlackSimPlugin
|
||||
|
||||
if (CDBusServer::isSessionOrSystemAddress(dbusAddress))
|
||||
{
|
||||
m_dBusConnection = connectionFromString(dbusAddress);
|
||||
m_dBusConnection = QDBusConnection::sessionBus();
|
||||
m_dbusMode = Session;
|
||||
}
|
||||
else if (CDBusServer::isQtDBusAddress(dbusAddress))
|
||||
@@ -446,13 +446,6 @@ namespace BlackSimPlugin
|
||||
return false;
|
||||
}
|
||||
|
||||
QDBusConnection CSimulatorFlightgear::connectionFromString(const QString &str)
|
||||
{
|
||||
if (str == CDBusServer::sessionBusAddress()) { return QDBusConnection::sessionBus(); }
|
||||
Q_UNREACHABLE();
|
||||
return QDBusConnection("NO CONNECTION");
|
||||
}
|
||||
|
||||
bool CSimulatorFlightgear::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
|
||||
{
|
||||
return m_flightgearAircraftObjects.contains(callsign);
|
||||
@@ -981,10 +974,10 @@ namespace BlackSimPlugin
|
||||
if (this->isShuttingDown()) { return; }
|
||||
Q_ASSERT_X(!CThreadUtils::isCurrentThreadApplicationThread(), Q_FUNC_INFO, "Expect to run in background");
|
||||
|
||||
QString dbusAddress = m_fgswiftbusServerSetting.getThreadLocal();
|
||||
QString dbusAddress = m_fgSswiftBusServerSetting.getThreadLocal();
|
||||
if (CDBusServer::isSessionOrSystemAddress(dbusAddress))
|
||||
{
|
||||
checkConnectionViaBus(dbusAddress);
|
||||
checkConnectionViaSessionBus();
|
||||
}
|
||||
else if (CDBusServer::isQtDBusAddress(dbusAddress))
|
||||
{
|
||||
@@ -992,9 +985,9 @@ namespace BlackSimPlugin
|
||||
}
|
||||
}
|
||||
|
||||
void CSimulatorFlightgearListener::checkConnectionViaBus(const QString &address)
|
||||
void CSimulatorFlightgearListener::checkConnectionViaSessionBus()
|
||||
{
|
||||
m_conn = CSimulatorFlightgear::connectionFromString(address);
|
||||
m_conn = QDBusConnection::sessionBus();
|
||||
if (!m_conn.isConnected())
|
||||
{
|
||||
m_conn.disconnectFromBus(m_conn.name());
|
||||
|
||||
@@ -138,9 +138,6 @@ namespace BlackSimPlugin
|
||||
virtual bool testSendSituationAndParts(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &situation, const BlackMisc::Aviation::CAircraftParts &parts) override;
|
||||
//! @}
|
||||
|
||||
//! Creates an appropriate dbus connection from the string describing it
|
||||
static QDBusConnection connectionFromString(const QString &str);
|
||||
|
||||
protected:
|
||||
//! \name ISimulator implementations
|
||||
//! @{
|
||||
@@ -264,7 +261,7 @@ namespace BlackSimPlugin
|
||||
|
||||
private:
|
||||
void checkConnection();
|
||||
void checkConnectionViaBus(const QString &address);
|
||||
void checkConnectionViaSessionBus();
|
||||
void checkConnectionViaPeer(const QString &address);
|
||||
void checkConnectionCommon();
|
||||
|
||||
@@ -273,7 +270,7 @@ namespace BlackSimPlugin
|
||||
|
||||
QTimer m_timer { this };
|
||||
QDBusConnection m_conn { "default" };
|
||||
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TFGSwiftBusServer> m_fgswiftbusServerSetting { this, &CSimulatorFlightgearListener::fgSwiftBusServerSettingChanged };
|
||||
BlackMisc::CSettingReadOnly<BlackMisc::Simulation::Settings::TFGSwiftBusServer> m_fgSswiftBusServerSetting { this, &CSimulatorFlightgearListener::fgSwiftBusServerSettingChanged };
|
||||
};
|
||||
|
||||
//! Factory for creating CSimulatorFlightgear instance
|
||||
|
||||
@@ -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