mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
* new signal sending all 3 states together (connected, running, paused) * renamed ISimulator::Status to ConnectionStatus * consolidated some member / signal names * for FS9/XPlane implemented stub functions
This commit is contained in:
committed by
Roland Winklmeier
parent
326ae96def
commit
a94bceddab
@@ -97,17 +97,12 @@ namespace BlackSimPlugin
|
||||
|
||||
// We tell the host to terminate and stop the thread afterwards
|
||||
QMetaObject::invokeMethod(m_fs9Host, "stopHosting");
|
||||
emit statusChanged(ISimulator::Disconnected);
|
||||
emit connectionStatusChanged(ISimulator::Disconnected);
|
||||
m_fsuipc->disconnect();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CSimulatorFs9::canConnect()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSimulatorFs9::addRemoteAircraft(const CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &initialSituation)
|
||||
{
|
||||
|
||||
@@ -289,7 +284,7 @@ namespace BlackSimPlugin
|
||||
{
|
||||
m_isHosting = true;
|
||||
startTimer(50);
|
||||
emit statusChanged(Connected);
|
||||
emit connectionStatusChanged(Connected);
|
||||
if (m_startedLobbyConnection)
|
||||
{
|
||||
m_lobbyClient->connectFs9ToHost(m_fs9Host->getHostAddress());
|
||||
@@ -304,7 +299,7 @@ namespace BlackSimPlugin
|
||||
connect(&m_hostThread, &QThread::finished, &m_hostThread, &QThread::deleteLater);
|
||||
m_hostThread.quit();
|
||||
m_isHosting = false;
|
||||
emit statusChanged(Disconnected);
|
||||
emit connectionStatusChanged(Disconnected);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -60,7 +60,17 @@ namespace BlackSimPlugin
|
||||
virtual bool isConnected() const override;
|
||||
|
||||
//! \copydoc ISimulator::canConnect()
|
||||
virtual bool canConnect() override;
|
||||
virtual bool canConnect() const override { return true; }
|
||||
|
||||
//! \copydoc ISimulator::isPaused
|
||||
virtual bool isPaused() const override { return m_simPaused; }
|
||||
|
||||
//! \copydoc ISimulator::isRunning
|
||||
//! \todo RW fix, set better state here
|
||||
virtual bool isRunning() const override { return true; }
|
||||
|
||||
//! Is time synchronization on?
|
||||
virtual bool isTimeSynchronized() const override { return m_syncTime; }
|
||||
|
||||
public slots:
|
||||
|
||||
@@ -111,15 +121,9 @@ namespace BlackSimPlugin
|
||||
//! \remarks not all drivers implement this, e.g. if it is an intrinsic simulator feature
|
||||
virtual void setTimeSynchronization(bool enable, BlackMisc::PhysicalQuantities::CTime offset) override;
|
||||
|
||||
//! Is time synchronization on?
|
||||
virtual bool isTimeSynchronized() const override { return m_syncTime; }
|
||||
|
||||
//! Time synchronization offset
|
||||
virtual BlackMisc::PhysicalQuantities::CTime getTimeSynchronizationOffset() const override { return m_syncTimeOffset; }
|
||||
|
||||
//! Simulator paused?
|
||||
virtual bool isSimPaused() const override { return m_simPaused; }
|
||||
|
||||
protected:
|
||||
//! Timer event
|
||||
virtual void timerEvent(QTimerEvent *event);
|
||||
@@ -138,6 +142,7 @@ namespace BlackSimPlugin
|
||||
//! Change DirectPlay host status
|
||||
void ps_changeHostStatus(BlackSimPlugin::Fs9::CFs9Host::HostStatus status);
|
||||
|
||||
//! Change client status for callsign
|
||||
void ps_changeClientStatus(const QString &callsign, BlackSimPlugin::Fs9::CFs9Client::ClientStatus status);
|
||||
|
||||
private:
|
||||
@@ -150,11 +155,11 @@ namespace BlackSimPlugin
|
||||
// DirectPlay object handling
|
||||
CFs9Host *m_fs9Host = nullptr;
|
||||
QThread m_hostThread;
|
||||
bool m_isHosting = false; //!< Is sim connected
|
||||
bool m_isHosting = false; //!< Is sim connected
|
||||
bool m_startedLobbyConnection = false;
|
||||
bool m_syncTime = false; //!< Time synchronized?
|
||||
int m_syncDeferredCounter = 0; //!< Set when synchronized, used to wait some time
|
||||
bool m_simPaused = false; //!< Simulator paused?
|
||||
bool m_syncTime = false; //!< Time synchronized?
|
||||
int m_syncDeferredCounter = 0; //!< Set when synchronized, used to wait some time
|
||||
bool m_simPaused = false; //!< Simulator paused?
|
||||
|
||||
QHash<BlackMisc::Aviation::CCallsign, CFs9Client *> m_hashFs9Clients;
|
||||
QHash<CFs9Client *, QThread *> m_fs9ClientThreads;
|
||||
|
||||
Reference in New Issue
Block a user