Formatting

This commit is contained in:
Klaus Basan
2017-06-26 02:09:38 +02:00
committed by Mathew Sutcliffe
parent d96a9a9fa2
commit d2d44085ba
6 changed files with 17 additions and 28 deletions

View File

@@ -222,7 +222,6 @@ namespace BlackCore
void CNetworkVatlib::sendInterimPositions() void CNetworkVatlib::sendInterimPositions()
{ {
if (!m_net) { return; } if (!m_net) { return; }
if (isConnected()) if (isConnected())
{ {
CSimulatedAircraft myAircraft(getOwnAircraft()); CSimulatedAircraft myAircraft(getOwnAircraft());

View File

@@ -359,7 +359,7 @@ namespace BlackCore
const QString dts = updateParts.at(1).trimmed(); const QString dts = updateParts.at(1).trimmed();
updateTimestampFromFile = QDateTime::fromString(dts, "yyyyMMddHHmmss"); updateTimestampFromFile = QDateTime::fromString(dts, "yyyyMMddHHmmss");
updateTimestampFromFile.setOffsetFromUtc(0); updateTimestampFromFile.setOffsetFromUtc(0);
bool alreadyRead = (updateTimestampFromFile == this->getUpdateTimestamp()); const bool alreadyRead = (updateTimestampFromFile == this->getUpdateTimestamp());
if (alreadyRead) if (alreadyRead)
{ {
CLogMessage(this).info("VATSIM file has same timestamp, skipped"); CLogMessage(this).info("VATSIM file has same timestamp, skipped");
@@ -374,8 +374,8 @@ namespace BlackCore
const QStringList fsdServerParts = currentLine.split(':'); const QStringList fsdServerParts = currentLine.split(':');
if (fsdServerParts.size() < 5) break; if (fsdServerParts.size() < 5) break;
if (!fsdServerParts.at(4).trimmed().contains('1')) break; // allowed? if (!fsdServerParts.at(4).trimmed().contains('1')) break; // allowed?
QString description(fsdServerParts.at(2)); // part(3) could be added const QString description(fsdServerParts.at(2)); // part(3) could be added
BlackMisc::Network::CServer fsdServer(fsdServerParts.at(0), description, fsdServerParts.at(1), 6809, CUser("id", "real name", "email", "password")); const BlackMisc::Network::CServer fsdServer(fsdServerParts.at(0), description, fsdServerParts.at(1), 6809, CUser("id", "real name", "email", "password"));
fsdServers.push_back(fsdServer); fsdServers.push_back(fsdServer);
} }
break; break;
@@ -385,7 +385,7 @@ namespace BlackCore
const QStringList voiceServerParts = currentLine.split(':'); const QStringList voiceServerParts = currentLine.split(':');
if (voiceServerParts.size() < 3) break; if (voiceServerParts.size() < 3) break;
if (!voiceServerParts.at(3).trimmed().contains('1')) break; // allowed? if (!voiceServerParts.at(3).trimmed().contains('1')) break; // allowed?
BlackMisc::Network::CServer voiceServer(voiceServerParts.at(1), voiceServerParts.at(2), voiceServerParts.at(0), -1, CUser()); const BlackMisc::Network::CServer voiceServer(voiceServerParts.at(1), voiceServerParts.at(2), voiceServerParts.at(0), -1, CUser());
voiceServers.push_back(voiceServer); voiceServers.push_back(voiceServer);
} }
break; break;

View File

@@ -131,9 +131,6 @@ namespace BlackCore
Vat_ConnectProducerConsumerToConsumer(audioMixerVatlib->getVatAudioMixer(), outputPort, nullptr, 0); Vat_ConnectProducerConsumerToConsumer(audioMixerVatlib->getVatAudioMixer(), outputPort, nullptr, 0);
} }
/*
* Process voice handling
*/
void CVoiceVatlib::timerEvent(QTimerEvent *) void CVoiceVatlib::timerEvent(QTimerEvent *)
{ {
Q_ASSERT_X(m_audioService, "CVoiceVatlib", "VatAudioService invalid!"); Q_ASSERT_X(m_audioService, "CVoiceVatlib", "VatAudioService invalid!");

View File

@@ -40,6 +40,7 @@ namespace BlackCore
class IAudioInputDevice; class IAudioInputDevice;
class IAudioOutputDevice; class IAudioOutputDevice;
class IVoiceChannel; class IVoiceChannel;
namespace Vatsim namespace Vatsim
{ {
//! Vatlib implementation of the IVoice interface. //! Vatlib implementation of the IVoice interface.
@@ -90,14 +91,12 @@ namespace BlackCore
//! \copydoc IVoice::disconnectVoice() //! \copydoc IVoice::disconnectVoice()
void disconnectVoice(IAudioMixer *mixer, IAudioMixer::OutputPort outputPort) override; void disconnectVoice(IAudioMixer *mixer, IAudioMixer::OutputPort outputPort) override;
protected: // QObject overrides protected:
//! Process voice lib //! Process voice lib
virtual void timerEvent(QTimerEvent *) override; virtual void timerEvent(QTimerEvent *) override;
private: private:
//! this struct calls Vat_DestroyAudioService to delete the pointer
// this struct calls "myCustomDeallocator" to delete the pointer
struct VatAudioServiceDeleter struct VatAudioServiceDeleter
{ {
static inline void cleanup(VatAudioService_tag *obj) static inline void cleanup(VatAudioService_tag *obj)
@@ -106,6 +105,7 @@ namespace BlackCore
} }
}; };
//! this struct calls Vat_DestroyUDPAudioPort to delete the pointer
struct VatUDPAudioPortDeleter struct VatUDPAudioPortDeleter
{ {
static inline void cleanup(VatUDPAudioPort_tag *obj) static inline void cleanup(VatUDPAudioPort_tag *obj)
@@ -118,7 +118,6 @@ namespace BlackCore
QScopedPointer<VatAudioService_tag, VatAudioServiceDeleter> m_audioService; QScopedPointer<VatAudioService_tag, VatAudioServiceDeleter> m_audioService;
QScopedPointer<VatUDPAudioPort_tag, VatUDPAudioPortDeleter> m_udpPort; QScopedPointer<VatUDPAudioPort_tag, VatUDPAudioPortDeleter> m_udpPort;
}; };
} // namespace } // namespace
} // namespace } // namespace

View File

@@ -157,7 +157,7 @@ namespace BlackMisc
// further reduce // further reduce
if (patternUsed.hasName()) if (patternUsed.hasName())
{ {
CAirlineIcaoCodeList backup(codesFound); const CAirlineIcaoCodeList backup(codesFound);
codesFound = this->findByNamesOrTelephonyDesignator(patternUsed.getName()); codesFound = this->findByNamesOrTelephonyDesignator(patternUsed.getName());
if (codesFound.isEmpty()) { codesFound = backup; } if (codesFound.isEmpty()) { codesFound = backup; }
} }

View File

@@ -22,7 +22,6 @@ namespace BlackMisc
{ {
namespace Network namespace Network
{ {
CVoiceCapabilities::CVoiceCapabilities(const QString &flightPlanRemarks) CVoiceCapabilities::CVoiceCapabilities(const QString &flightPlanRemarks)
{ {
this->setFromFlightPlanRemarks(flightPlanRemarks); this->setFromFlightPlanRemarks(flightPlanRemarks);
@@ -66,20 +65,20 @@ namespace BlackMisc
return; return;
} }
const QString r = flightPlanRemarks.toLower(); const QString r = flightPlanRemarks.toUpper(); // normally already upper case
if (r.contains("/v/") || r.contains("/voice/")) if (r.contains("/V/") || r.contains("/VOICE/"))
{ {
this->setCapabilities(Voice); this->setCapabilities(Voice);
return; return;
} }
if (r.contains("/t/")) if (r.contains("/T/"))
{ {
this->setCapabilities(TextOnly); this->setCapabilities(TextOnly);
return; return;
} }
if (r.contains("/r/")) if (r.contains("/R/"))
{ {
this->setCapabilities(VoiceReceivingOnly); this->setCapabilities(VoiceReceivingOnly);
return; return;
@@ -116,15 +115,11 @@ namespace BlackMisc
switch (capabilities) switch (capabilities)
{ {
case CVoiceCapabilities::TextOnly: case CVoiceCapabilities::TextOnly: return to;
return to; case CVoiceCapabilities::Voice: return v;
case CVoiceCapabilities::Voice: case CVoiceCapabilities::VoiceReceivingOnly: return vro;
return v;
case CVoiceCapabilities::VoiceReceivingOnly:
return vro;
case CVoiceCapabilities::Unknown: case CVoiceCapabilities::Unknown:
default: default: return u;
return u;
} }
} }
@@ -133,6 +128,5 @@ namespace BlackMisc
static const QList<CVoiceCapabilities> all({fromVoiceCapabilities(Unknown), fromVoiceCapabilities(Voice), fromVoiceCapabilities(VoiceReceivingOnly), fromVoiceCapabilities(TextOnly)}); static const QList<CVoiceCapabilities> all({fromVoiceCapabilities(Unknown), fromVoiceCapabilities(Voice), fromVoiceCapabilities(VoiceReceivingOnly), fromVoiceCapabilities(TextOnly)});
return all; return all;
} }
} // namespace } // namespace
} // namespace } // namespace