mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
35 lines
1.3 KiB
C++
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);
|
|
} |