Style, minor adjustments

This commit is contained in:
Klaus Basan
2019-10-20 23:08:52 +02:00
parent 852f707f7f
commit be99911372
10 changed files with 38 additions and 28 deletions

View File

@@ -169,7 +169,7 @@ namespace BlackCore
}
}
QString CSoundcardSampleProvider::getReceivingCallsigns(quint16 transceiverID)
QString CSoundcardSampleProvider::getReceivingCallsigns(quint16 transceiverID) const
{
return m_receiverInputs.at(transceiverID)->getReceivingCallsignsString();
}

View File

@@ -52,7 +52,7 @@ namespace BlackCore
void updateRadioTransceivers(const QVector<TransceiverDto> &radioTransceivers);
//! Receiving callsign as single string
QString getReceivingCallsigns(quint16 transceiverID);
QString getReceivingCallsigns(quint16 transceiverID) const;
signals:
//! Changed callsigns

View File

@@ -747,20 +747,30 @@ namespace BlackCore
emit outputVolumePeakVU(args.PeakVU);
}
QString CAfvClient::getReceivingCallsignsCom1()
QString CAfvClient::getReceivingCallsignsCom1() const
{
QMutexLocker lock(&m_mutex);
if (!m_soundcardSampleProvider) return {};
return m_soundcardSampleProvider->getReceivingCallsigns(0);
}
QString CAfvClient::getReceivingCallsignsCom2()
QString CAfvClient::getReceivingCallsignsCom2() const
{
QMutexLocker lock(&m_mutex);
if (!m_soundcardSampleProvider) return {};
return m_soundcardSampleProvider->getReceivingCallsigns(1);
}
QStringList CAfvClient::getReceivingCallsignsCom1Com2() const
{
QStringList coms;
QMutexLocker lock(&m_mutex);
if (!m_soundcardSampleProvider) { return {{ QString(), QString()}}; }
coms << m_soundcardSampleProvider->getReceivingCallsigns(0);
coms << m_soundcardSampleProvider->getReceivingCallsigns(1);
return coms;
}
bool CAfvClient::updateVoiceServerUrl(const QString &url)
{
QMutexLocker lock(&m_mutexConnection);

View File

@@ -224,7 +224,7 @@ namespace BlackCore
//! Recently used device
//! \threadsafe
//! @{
const BlackMisc::Audio::CAudioDeviceInfo &getInputDevice() const;
const BlackMisc::Audio::CAudioDeviceInfo &getInputDevice() const;
const BlackMisc::Audio::CAudioDeviceInfo &getOutputDevice() const;
bool usesSameDevices(const BlackMisc::Audio::CAudioDeviceInfo &inputDevice, const BlackMisc::Audio::CAudioDeviceInfo &outputDevice);
//! @}
@@ -232,8 +232,9 @@ namespace BlackCore
//! Callsigns currently received
//! \threadsafe
//! @{
QString getReceivingCallsignsCom1();
QString getReceivingCallsignsCom2();
QString getReceivingCallsignsCom1() const;
QString getReceivingCallsignsCom2() const;
QStringList getReceivingCallsignsCom1Com2() const;
//! @}
//! Update the voice server URL

View File

@@ -11,11 +11,11 @@
#ifndef BLACKCORE_CONTEXT_CONTEXTOWNAIRCRAFT_IMPL_H
#define BLACKCORE_CONTEXT_CONTEXTOWNAIRCRAFT_IMPL_H
#include "blackcore/blackcoreexport.h"
#include "blackcore/context/contextownaircraft.h"
#include "blackcore/corefacadeconfig.h"
#include "blackcore/vatsim/vatsimsettings.h"
#include "blackcore/actionbind.h"
#include "blackcore/blackcoreexport.h"
#include "blackmisc/simulation/aircraftmodel.h"
#include "blackmisc/simulation/ownaircraftprovider.h"
#include "blackmisc/simulation/simulatedaircraft.h"
@@ -211,16 +211,16 @@ namespace BlackCore
CContextOwnAircraft *registerWithDBus(BlackMisc::CDBusServer *server);
private:
BlackMisc::Simulation::CSimulatedAircraft m_ownAircraft; //!< my aircraft
mutable QReadWriteLock m_lockAircraft; //!< lock aircraft
BlackMisc::Simulation::CSimulatedAircraft m_ownAircraft; //!< my aircraft
mutable QReadWriteLock m_lockAircraft; //!< lock aircraft
CActionBind m_actionToggleXpdr { BlackMisc::Input::toggleXPDRStateHotkeyAction(), BlackMisc::Input::toggleXPDRStateHotkeyIcon(), this, &CContextOwnAircraft::actionToggleTransponder };
CActionBind m_actionIdent { BlackMisc::Input::toggleXPDRIdentHotkeyAction(), BlackMisc::Input::toggleXPDRIdentHotkeyIcon(), this, &CContextOwnAircraft::actionIdent };
static constexpr qint64 MinHistoryDeltaMs = 1000;
static constexpr int MaxHistoryElements = 20;
QTimer m_historyTimer; //!< history timer
std::atomic_bool m_history { true }; //!< enable history
QTimer m_historyTimer; //!< history timer
std::atomic_bool m_history { true }; //!< enable history
BlackMisc::Aviation::CAircraftSituationList m_situationHistory; //!< history, latest situation first
BlackMisc::CSetting<BlackMisc::Network::Settings::TCurrentTrafficServer> m_currentNetworkServer { this };

View File

@@ -24,7 +24,7 @@ namespace BlackCore
{
const CLogCategoryList &CNetworkWatchdog::getLogCategories()
{
static const BlackMisc::CLogCategoryList cats = CContinuousWorker::getLogCategories().with(
static const CLogCategoryList cats = CContinuousWorker::getLogCategories().with(
{
CLogCategory::swiftDbWebservice(), CLogCategory::webservice(), CLogCategory::network()
});

View File

@@ -11,6 +11,8 @@
#include "blackmisc/logmessage.h"
using namespace BlackMisc;
namespace BlackCore
{
namespace Fsd
@@ -40,9 +42,9 @@ namespace BlackCore
{
if (tokens.size() < 6)
{
BlackMisc::CLogMessage(static_cast<AddPilot*>(nullptr)).warning(u"Wrong number of arguments.");
CLogMessage(static_cast<AddPilot*>(nullptr)).warning(u"Wrong number of arguments.");
return {};
};
}
PilotRating rating = static_cast<PilotRating>(tokens[4].toInt());
int protocolRevision = tokens[5].toInt();

View File

@@ -29,10 +29,10 @@ namespace BlackCore
AddPilot(const QString &callsign, const QString &cid, const QString &password, PilotRating rating, int protocolRevision, SimType simType, const QString &realName);
//! Get user cid
QString cid() const { return m_cid; }
const QString &cid() const { return m_cid; }
//! Get user password
QString password() const { return m_password; }
const QString &password() const { return m_password; }
//! Get pilot rating
PilotRating rating() const { return m_rating; }
@@ -44,7 +44,7 @@ namespace BlackCore
SimType simType() const { return m_simType; }
//! Get real name
QString realName() const { return m_realName; }
const QString &realName() const { return m_realName; }
//! Message converted to tokens
QStringList toTokens() const;

View File

@@ -1246,10 +1246,10 @@ namespace BlackCore
case ServerErrorCode::NoWeatherProfile: CLogMessage(this).info(u"FSD Server: requested weather profile does not exist"); break;
// we have no idea what these mean
case ServerErrorCode::AlreadyRegistered: CLogMessage(this).info(u"Server says already registered: %1") << serverError.m_description; break;
case ServerErrorCode::InvalidCtrl: CLogMessage(this).info(u"Server invalid control: %1") << serverError.m_description; break;
case ServerErrorCode::Unknown: CLogMessage(this).info(u"Server sent unknown error code: %1 (%2)") << serverError.m_causingParameter << serverError.m_description; break;
case ServerErrorCode::AuthTimeout: CLogMessage(this).info(u"Client did not authenticate in time"); break;
case ServerErrorCode::AlreadyRegistered: CLogMessage(this).info(u"Server says already registered: %1") << serverError.m_description; break;
case ServerErrorCode::InvalidCtrl: CLogMessage(this).info(u"Server invalid control: %1") << serverError.m_description; break;
case ServerErrorCode::Unknown: CLogMessage(this).info(u"Server sent unknown error code: %1 (%2)") << serverError.m_causingParameter << serverError.m_description; break;
case ServerErrorCode::AuthTimeout: CLogMessage(this).info(u"Client did not authenticate in time"); break;
}
if (serverError.isFatalError()) { disconnectFromServer(); }
}

View File

@@ -208,9 +208,6 @@ namespace BlackCore
//! We received a reply to one of our ATIS queries.
void atisReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CInformationMessage &atis);
//! We received a reply to one of our ATIS queries, containing the controller's voice room URL.
// void atisVoiceRoomReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &url);
//! We received a reply to one of our ATIS queries, containing the controller's planned logoff time.
void atisLogoffTimeReplyReceived(const BlackMisc::Aviation::CCallsign &callsign, const QString &zuluTime);
@@ -349,8 +346,8 @@ namespace BlackCore
// Client data
QString m_clientName;
QString m_hostApplication;
int m_versionMajor = 0;
int m_versionMinor = 0;
int m_versionMajor = 0;
int m_versionMinor = 0;
int m_protocolRevision = 0;
ServerType m_serverType = ServerType::LegacyFsd;
Capabilities m_capabilities = Capabilities::None;
@@ -413,7 +410,7 @@ namespace BlackCore
QTimer m_positionUpdateTimer; //!< sending positions
QTimer m_interimPositionUpdateTimer; //!< sending interim positions
qint64 m_additionalOffsetTime = 0; //!< additional offset time
qint64 m_additionalOffsetTime = 0; //!< additional offset time
bool m_statistics = false;
QMap <QString, int> m_callStatistics;