Files
pilotclient/src/blackcore/atclistmgr.cpp
Mathew Sutcliffe e607121cc4 Updating IContext to our current style and making it less reliant on macros.
Updating code that uses IContext to a more conformant pattern of usage.
2013-10-05 18:12:16 +01:00

35 lines
1.3 KiB
C++

/* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "atclistmgr.h"
#include "network.h"
BlackCore::CAtcListManager::CAtcListManager(BlackMisc::IContext &ctx)
{
INetwork *net = &ctx.getObject<INetwork>();
connect(net, &INetwork::atcPositionUpdate, this, &CAtcListManager::update, Qt::QueuedConnection);
connect(net, &INetwork::atcDisconnected, this, &CAtcListManager::remove, Qt::QueuedConnection);
connect(net, &INetwork::connectionStatusDisconnected, this, &CAtcListManager::clear, Qt::QueuedConnection);
}
void BlackCore::CAtcListManager::update(const QString& callsign, const BlackMisc::PhysicalQuantities::CFrequency& freq,
const BlackMisc::Geo::CCoordinateGeodetic& pos, const BlackMisc::PhysicalQuantities::CLength& range)
{
m_list.insert(BlackMisc::CAtcListEntry(callsign, freq, pos, range));
emit listChanged(m_list);
}
void BlackCore::CAtcListManager::remove(const QString& callsign)
{
m_list.remove(callsign);
emit listChanged(m_list);
}
void BlackCore::CAtcListManager::clear()
{
m_list.clear();
emit listChanged(m_list);
}