mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Add "ConnectionFailed" to Simulator status enum
Rename connectionChanged to statusChanged refs #231
This commit is contained in:
committed by
Roland Winklmeier
parent
7a69ad6ad9
commit
5498b449ac
@@ -54,7 +54,10 @@ MainWindow::MainWindow(GuiModes::WindowMode windowMode, QWidget *parent) :
|
|||||||
/*
|
/*
|
||||||
* Destructor
|
* Destructor
|
||||||
*/
|
*/
|
||||||
MainWindow::~MainWindow() {}
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
this->disconnect(this->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &MainWindow::simulatorConnectionChanged);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Graceful shutdown
|
* Graceful shutdown
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ namespace BlackCore
|
|||||||
m_simulator = factory->create(this);
|
m_simulator = factory->create(this);
|
||||||
Q_ASSERT(m_simulator);
|
Q_ASSERT(m_simulator);
|
||||||
|
|
||||||
connect(m_simulator, SIGNAL(connectionChanged(bool)), this, SLOT(setConnectionStatus(bool)));
|
connect(m_simulator, SIGNAL(statusChanged(ISimulator::Status)), this, SLOT(setConnectionStatus(ISimulator::Status)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,13 +132,19 @@ namespace BlackCore
|
|||||||
getIContextNetwork()->updateOwnCockpit(m_ownAircraft.getCom1System(), m_ownAircraft.getCom2System(), m_ownAircraft.getTransponder());
|
getIContextNetwork()->updateOwnCockpit(m_ownAircraft.getCom1System(), m_ownAircraft.getCom2System(), m_ownAircraft.getTransponder());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextSimulator::setConnectionStatus(bool value)
|
void CContextSimulator::setConnectionStatus(ISimulator::Status status)
|
||||||
{
|
{
|
||||||
if (value)
|
if (status == ISimulator::Connected)
|
||||||
|
{
|
||||||
m_updateTimer->start(100);
|
m_updateTimer->start(100);
|
||||||
|
emit connectionChanged(true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_updateTimer->stop();
|
m_updateTimer->stop();
|
||||||
emit connectionChanged(value);
|
emit connectionChanged(false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextSimulator::findSimulatorPlugins()
|
void CContextSimulator::findSimulatorPlugins()
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ namespace BlackCore
|
|||||||
virtual void updateOwnAircraft();
|
virtual void updateOwnAircraft();
|
||||||
|
|
||||||
//! Set new connection status
|
//! Set new connection status
|
||||||
void setConnectionStatus(bool value);
|
void setConnectionStatus(ISimulator::Status status);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! \brief find and catalog all simulator plugins
|
//! \brief find and catalog all simulator plugins
|
||||||
|
|||||||
@@ -28,8 +28,9 @@ namespace BlackCore
|
|||||||
//! \brief Simulator connection
|
//! \brief Simulator connection
|
||||||
enum Status
|
enum Status
|
||||||
{
|
{
|
||||||
Not_Connected,
|
Disconnected,
|
||||||
Connected
|
Connected,
|
||||||
|
ConnectionFailed
|
||||||
};
|
};
|
||||||
|
|
||||||
//! \brief Constructor
|
//! \brief Constructor
|
||||||
@@ -69,7 +70,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Emitted when the connection status has changed
|
//! Emitted when the connection status has changed
|
||||||
void connectionChanged(bool value);
|
void statusChanged(ISimulator::Status status);
|
||||||
|
|
||||||
//! Emitted when new a new data object of the user aircraft is received
|
//! Emitted when new a new data object of the user aircraft is received
|
||||||
void ownAircraftReceived(BlackMisc::Aviation::CAircraft aircraft);
|
void ownAircraftReceived(BlackMisc::Aviation::CAircraft aircraft);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace BlackSimPlugin
|
|||||||
m_simconnectTimerId = startTimer(10);
|
m_simconnectTimerId = startTimer(10);
|
||||||
m_isConnected = true;
|
m_isConnected = true;
|
||||||
|
|
||||||
emit connectionChanged(true);
|
emit statusChanged(Connected);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ namespace BlackSimPlugin
|
|||||||
if (!m_isConnected)
|
if (!m_isConnected)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
emit connectionChanged(false);
|
emit statusChanged(Disconnected);
|
||||||
if (m_hSimConnect)
|
if (m_hSimConnect)
|
||||||
SimConnect_Close(m_hSimConnect);
|
SimConnect_Close(m_hSimConnect);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user