This commit is contained in:
Michał Garapich
2015-03-31 20:33:23 +02:00
committed by Roland Winklmeier
parent 45f48f7594
commit 9d37a0876d
3 changed files with 13 additions and 15 deletions

View File

@@ -245,12 +245,12 @@ namespace BlackCore
Q_ASSERT(this->getIContextApplication()); Q_ASSERT(this->getIContextApplication());
Q_ASSERT(this->getIContextApplication()->isUsingImplementingObject()); Q_ASSERT(this->getIContextApplication()->isUsingImplementingObject());
if (this->m_simulator && this->m_simulator->getSimulatorInfo() == simulatorInfo) { return true; } // already loaded if (this->m_simulator && this->m_simulator->getSimulatorInfo() == simulatorInfo) {
if (simulatorInfo.isUnspecified()) { return false; } return true;
} // already loaded
// warning if we do not have any plugins // warning if we do not have any plugins
if (m_simulatorFactories.isEmpty()) if (m_simulatorFactories.isEmpty()) {
{
CLogMessage(this).error("No simulator plugins"); CLogMessage(this).error("No simulator plugins");
return false; return false;
} }

View File

@@ -116,9 +116,7 @@ namespace BlackGui
{ {
int intervalMs = getUpdateIntervalMs(); int intervalMs = getUpdateIntervalMs();
this->m_updateTimer->startTimer(intervalMs); this->m_updateTimer->startTimer(intervalMs);
} } else {
else
{
this->stopTimer(); this->stopTimer();
} }
} }

View File

@@ -154,12 +154,15 @@ namespace BlackSimPlugin
bool CSimulatorXPlane::connectTo() bool CSimulatorXPlane::connectTo()
{ {
if (isConnected()) { return true; } if (isConnected()) {
return true;
}
m_conn = QDBusConnection::sessionBus(); // TODO make this configurable m_conn = QDBusConnection::sessionBus(); // TODO make this configurable
m_service = new CXBusServiceProxy(m_conn, this); m_service = new CXBusServiceProxy(m_conn, this);
m_traffic = new CXBusTrafficProxy(m_conn, this); m_traffic = new CXBusTrafficProxy(m_conn, this);
if (m_service->isValid() && m_traffic->isValid() && m_traffic->initialize())
{ if (m_service->isValid() && m_traffic->isValid() && m_traffic->initialize()) {
// FIXME duplication // FIXME duplication
connect(m_service, &CXBusServiceProxy::aircraftModelChanged, this, &CSimulatorXPlane::ps_emitOwnAircraftModelChanged); connect(m_service, &CXBusServiceProxy::aircraftModelChanged, this, &CSimulatorXPlane::ps_emitOwnAircraftModelChanged);
connect(m_service, &CXBusServiceProxy::airportsInRangeUpdated, this, &CSimulatorXPlane::ps_setAirportsInRange); connect(m_service, &CXBusServiceProxy::airportsInRangeUpdated, this, &CSimulatorXPlane::ps_setAirportsInRange);
@@ -167,9 +170,7 @@ namespace BlackSimPlugin
m_watcher->setConnection(m_conn); m_watcher->setConnection(m_conn);
emitSimulatorCombinedStatus(); emitSimulatorCombinedStatus();
return true; return true;
} } else {
else
{
disconnectFrom(); disconnectFrom();
return false; return false;
} }
@@ -183,8 +184,7 @@ namespace BlackSimPlugin
bool CSimulatorXPlane::disconnectFrom() bool CSimulatorXPlane::disconnectFrom()
{ {
if (m_traffic) if (m_traffic) {
{
m_traffic->cleanup(); m_traffic->cleanup();
} }