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
|
||||
*/
|
||||
MainWindow::~MainWindow() {}
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
this->disconnect(this->getIContextSimulator(), &IContextSimulator::connectionChanged, this, &MainWindow::simulatorConnectionChanged);
|
||||
}
|
||||
|
||||
/*
|
||||
* Graceful shutdown
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace BlackCore
|
||||
m_simulator = factory->create(this);
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -132,13 +132,19 @@ namespace BlackCore
|
||||
getIContextNetwork()->updateOwnCockpit(m_ownAircraft.getCom1System(), m_ownAircraft.getCom2System(), m_ownAircraft.getTransponder());
|
||||
}
|
||||
|
||||
void CContextSimulator::setConnectionStatus(bool value)
|
||||
void CContextSimulator::setConnectionStatus(ISimulator::Status status)
|
||||
{
|
||||
if (status == ISimulator::Connected)
|
||||
{
|
||||
if (value)
|
||||
m_updateTimer->start(100);
|
||||
emit connectionChanged(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_updateTimer->stop();
|
||||
emit connectionChanged(value);
|
||||
emit connectionChanged(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CContextSimulator::findSimulatorPlugins()
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace BlackCore
|
||||
virtual void updateOwnAircraft();
|
||||
|
||||
//! Set new connection status
|
||||
void setConnectionStatus(bool value);
|
||||
void setConnectionStatus(ISimulator::Status status);
|
||||
|
||||
private:
|
||||
//! \brief find and catalog all simulator plugins
|
||||
|
||||
@@ -28,8 +28,9 @@ namespace BlackCore
|
||||
//! \brief Simulator connection
|
||||
enum Status
|
||||
{
|
||||
Not_Connected,
|
||||
Connected
|
||||
Disconnected,
|
||||
Connected,
|
||||
ConnectionFailed
|
||||
};
|
||||
|
||||
//! \brief Constructor
|
||||
@@ -69,7 +70,7 @@ namespace BlackCore
|
||||
|
||||
signals:
|
||||
//! 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
|
||||
void ownAircraftReceived(BlackMisc::Aviation::CAircraft aircraft);
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace BlackSimPlugin
|
||||
m_simconnectTimerId = startTimer(10);
|
||||
m_isConnected = true;
|
||||
|
||||
emit connectionChanged(true);
|
||||
emit statusChanged(Connected);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace BlackSimPlugin
|
||||
if (!m_isConnected)
|
||||
return true;
|
||||
|
||||
emit connectionChanged(false);
|
||||
emit statusChanged(Disconnected);
|
||||
if (m_hSimConnect)
|
||||
SimConnect_Close(m_hSimConnect);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user