mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-11 23:05:34 +08:00
refs #234, add methods to resolve user names from VATSIM file and display them in voice rooms
This commit is contained in:
@@ -339,11 +339,20 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
// we might have unresolved callsigns
|
||||
// these are the ones not in range
|
||||
foreach(CCallsign callsign, searchList)
|
||||
{
|
||||
CUser user;
|
||||
user.setCallsign(callsign);
|
||||
users.push_back(user);
|
||||
CUserList usersByCallsign = this->m_vatsimDataFileReader->getUsersForCallsign(callsign);
|
||||
if (usersByCallsign.isEmpty())
|
||||
{
|
||||
CUser user;
|
||||
user.setCallsign(callsign);
|
||||
users.push_back(user);
|
||||
}
|
||||
else
|
||||
{
|
||||
users.push_back(usersByCallsign[0]);
|
||||
}
|
||||
}
|
||||
return users;
|
||||
}
|
||||
@@ -365,11 +374,7 @@ namespace BlackCore
|
||||
if (callsigns.isEmpty()) return clients;
|
||||
foreach(CCallsign callsign, callsigns)
|
||||
{
|
||||
CClientList clientsForCallsign = this->m_otherClients.findBy(&CClient::getCallsign, callsign);
|
||||
foreach(CClient c, clientsForCallsign)
|
||||
{
|
||||
clients.push_back(c);
|
||||
}
|
||||
clients.push_back(this->m_otherClients.findBy(&CClient::getCallsign, callsign));
|
||||
}
|
||||
return clients;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,61 @@ namespace BlackCore
|
||||
this->m_updateTimer->start(updatePeriodMs);
|
||||
}
|
||||
|
||||
CUserList CVatsimDataFileReader::getPilotsForCallsigns(const CCallsignList &callsigns)
|
||||
{
|
||||
CUserList users;
|
||||
if (callsigns.isEmpty()) return users;
|
||||
foreach(CCallsign callsign, callsigns)
|
||||
{
|
||||
users.push_back(this->m_aircrafts.findByCallsign(callsign).getPilots());
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
||||
CUserList CVatsimDataFileReader::getPilotsForCallsign(const CCallsign &callsign)
|
||||
{
|
||||
CCallsignList callsigns;
|
||||
callsigns.push_back(callsign);
|
||||
return this->getPilotsForCallsigns(callsigns);
|
||||
}
|
||||
|
||||
CUserList CVatsimDataFileReader::getControllersForCallsign(const CCallsign &callsign)
|
||||
{
|
||||
CCallsignList callsigns;
|
||||
callsigns.push_back(callsign);
|
||||
return this->getControllersForCallsigns(callsigns);
|
||||
}
|
||||
|
||||
CUserList CVatsimDataFileReader::getUsersForCallsign(const CCallsign &callsign)
|
||||
{
|
||||
CCallsignList callsigns;
|
||||
callsigns.push_back(callsign);
|
||||
return this->getUsersForCallsigns(callsigns);
|
||||
}
|
||||
|
||||
CUserList CVatsimDataFileReader::getControllersForCallsigns(const CCallsignList &callsigns)
|
||||
{
|
||||
CUserList users;
|
||||
if (callsigns.isEmpty()) return users;
|
||||
foreach(CCallsign callsign, callsigns)
|
||||
{
|
||||
users.push_back(this->m_atcStations.findByCallsign(callsign).getControllers());
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
||||
CUserList CVatsimDataFileReader::getUsersForCallsigns(const CCallsignList &callsigns)
|
||||
{
|
||||
CUserList users;
|
||||
if (callsigns.isEmpty()) return users;
|
||||
foreach(CCallsign callsign, callsigns)
|
||||
{
|
||||
users.push_back(this->getPilotsForCallsign(callsign));
|
||||
users.push_back(this->getControllersForCallsign(callsign));
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
||||
/*
|
||||
* Data file read from XML
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "blackmisc/avatcstationlist.h"
|
||||
#include "blackmisc/avaircraftlist.h"
|
||||
#include "blackmisc/nwserverlist.h"
|
||||
#include "blackmisc/nwuserlist.h"
|
||||
#include "blackmisc/avcallsignlist.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QNetworkReply>
|
||||
@@ -50,6 +53,23 @@ namespace BlackCore
|
||||
//! Get all voice servers
|
||||
const BlackMisc::Network::CServerList &getVoiceServers() { return this->m_voiceServers; }
|
||||
|
||||
//! Users for callsign(s)
|
||||
BlackMisc::Network::CUserList getUsersForCallsigns(const BlackMisc::Aviation::CCallsignList &callsigns);
|
||||
|
||||
//! User for callsign
|
||||
BlackMisc::Network::CUserList getUsersForCallsign(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
//! Controllers for callsigns
|
||||
BlackMisc::Network::CUserList getControllersForCallsigns(const BlackMisc::Aviation::CCallsignList &callsigns);
|
||||
|
||||
//! Controllers for callsign
|
||||
BlackMisc::Network::CUserList getControllersForCallsign(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
//! Users for callsigns
|
||||
BlackMisc::Network::CUserList getPilotsForCallsigns(const BlackMisc::Aviation::CCallsignList &callsigns);
|
||||
|
||||
//! Users for callsign
|
||||
BlackMisc::Network::CUserList getPilotsForCallsign(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
|
||||
private slots:
|
||||
//! Data have been read
|
||||
|
||||
Reference in New Issue
Block a user