mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
CAtcListManager class
This commit is contained in:
39
src/blackcore/atclistmgr.cpp
Normal file
39
src/blackcore/atclistmgr.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
/* 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(const BlackCoreTest::EnableTesting&)
|
||||
{
|
||||
}
|
||||
|
||||
BlackCore::CAtcListManager::CAtcListManager()
|
||||
{
|
||||
INetwork *net = BlackMisc::IContext::getInstance().singleton<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);
|
||||
}
|
||||
Reference in New Issue
Block a user