From cde18d23aace3169c5678f540b6f5875dca1e2f6 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 23 Oct 2019 23:11:37 +0200 Subject: [PATCH] [AFV] Style, Doxygen --- src/blackcore/context/contextnetworkimpl.cpp | 2 +- src/blackcore/fsd/clientquery.h | 2 ++ src/blackcore/fsd/deletepilot.h | 3 ++- src/blackcore/fsd/fsdclient.cpp | 18 +++++++++--------- src/blackcore/fsd/fsdclient.h | 19 +++++++++++++++---- src/blackcore/fsd/ping.h | 2 +- src/blackcore/fsd/planeinforequest.h | 3 +-- src/blackcore/fsd/planeinforequestfsinn.h | 4 ++-- src/blackcore/fsd/planeinformation.h | 2 ++ src/blackcore/setupreader.cpp | 8 ++++---- src/swiftlauncher/main.cpp | 2 +- 11 files changed, 40 insertions(+), 25 deletions(-) diff --git a/src/blackcore/context/contextnetworkimpl.cpp b/src/blackcore/context/contextnetworkimpl.cpp index e98df1726..59c83e9c1 100644 --- a/src/blackcore/context/contextnetworkimpl.cpp +++ b/src/blackcore/context/contextnetworkimpl.cpp @@ -223,7 +223,7 @@ namespace BlackCore if (!server.getUser().hasCredentials()) { return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityError, u"Invalid user credentials"); } if (!this->ownAircraft().getAircraftIcaoCode().hasDesignator()) { return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityError, u"Invalid ICAO data for own aircraft"); } if (!CNetworkUtils::canConnect(server, msg, 5000)) { return CStatusMessage(CStatusMessage::SeverityError, msg); } - if (m_fsdClient->isConnected()) { return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityError, u"Already connected"); } + if (m_fsdClient->isConnected()) { return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityError, u"Already connected"); } if (this->isPendingConnection()) { return CStatusMessage({ CLogCategory::validation() }, CStatusMessage::SeverityError, u"Pending connection, please wait"); } this->getIContextOwnAircraft()->updateOwnAircraftPilot(server.getUser()); diff --git a/src/blackcore/fsd/clientquery.h b/src/blackcore/fsd/clientquery.h index 652172f9f..907c0b2b1 100644 --- a/src/blackcore/fsd/clientquery.h +++ b/src/blackcore/fsd/clientquery.h @@ -39,8 +39,10 @@ namespace BlackCore //! PDU identifier static QString pdu() { return "$CQ"; } + //! Properties @{ ClientQueryType m_queryType = ClientQueryType::Unknown; QStringList m_queryData; + //! @} private: ClientQuery(); diff --git a/src/blackcore/fsd/deletepilot.h b/src/blackcore/fsd/deletepilot.h index 236c846bf..9c43123cd 100644 --- a/src/blackcore/fsd/deletepilot.h +++ b/src/blackcore/fsd/deletepilot.h @@ -34,9 +34,10 @@ namespace BlackCore //! PDU identifier static QString pdu() { return QStringLiteral("#DP"); } - QString m_cid; + QString m_cid; //!< id private: + //! Ctor DeletePilot(); }; diff --git a/src/blackcore/fsd/fsdclient.cpp b/src/blackcore/fsd/fsdclient.cpp index d710d1149..66dabd2b1 100644 --- a/src/blackcore/fsd/fsdclient.cpp +++ b/src/blackcore/fsd/fsdclient.cpp @@ -206,17 +206,17 @@ namespace BlackCore Q_ASSERT((m_versionMajor + m_versionMinor) > 0); Q_ASSERT(m_capabilities != Capabilities::None); - if (m_hostApplication.isEmpty()) { m_hostApplication = getSimulatorNameAndVersion().replace(':', ' '); } + if (m_hostApplication.isEmpty()) { m_hostApplication = this->getSimulatorNameAndVersion().replace(':', ' '); } - clearState(); + this->clearState(); m_filterPasswordFromLogin = true; - updateConnectionStatus(CConnectionStatus::Connecting); + this->updateConnectionStatus(CConnectionStatus::Connecting); - QString host = m_server.getAddress(); - quint16 port = static_cast(m_server.getPort()); + const QString host = m_server.getAddress(); + const quint16 port = static_cast(m_server.getPort()); m_socket.connectToHost(host, port); - startPositionTimers(); + this->startPositionTimers(); } void CFSDClient::disconnectFromServer() @@ -225,10 +225,10 @@ namespace BlackCore this->updateConnectionStatus(CConnectionStatus::Disconnecting); // allow also to close if broken - if (!m_socket.isOpen()) + if (m_socket.isOpen()) { - if (m_loginMode.isPilot()) { sendDeletePilot(); } - else if (m_loginMode.isObserver()) { sendDeleteAtc(); } + if (m_loginMode.isPilot()) { this->sendDeletePilot(); } + else if (m_loginMode.isObserver()) { this->sendDeleteAtc(); } } m_socket.close(); diff --git a/src/blackcore/fsd/fsdclient.h b/src/blackcore/fsd/fsdclient.h index 5f0de5ee6..842ad4c2b 100644 --- a/src/blackcore/fsd/fsdclient.h +++ b/src/blackcore/fsd/fsdclient.h @@ -42,15 +42,18 @@ #include #include +//! Protocol version @{ #define PROTOCOL_REVISION_CLASSIC 9 #define PROTOCOL_REVISION_VATSIM_ATC 10 #define PROTOCOL_REVISION_VATSIM_AUTH 100 +//! @} namespace BlackFsdTest { class CTestFSDClient; } namespace BlackCore { namespace Fsd { + //! Message groups enum class TextMessageGroups { AllClients, @@ -59,10 +62,9 @@ namespace BlackCore AllSups }; - //! TODO: - //! Send (interim) data updates automatically - //! Check ':' in FSD messages. Disconnect if there is a wrong one - + //! FSD client + //! Todo: Send (interim) data updates automatically + //! Todo Check ':' in FSD messages. Disconnect if there is a wrong one class BLACKCORE_EXPORT CFSDClient : public QObject, public BlackMisc::Network::IEcosystemProvider, // provide info about used ecosystem @@ -102,9 +104,16 @@ namespace BlackCore void setAtcRating(AtcRating rating) { m_atcRating = rating; } //! @} + //! Get the server const BlackMisc::Network::CServer &getServer() const { return m_server; } + + //! List of all preset values QStringList getPresetValues() const; + + //! Callsign BlackMisc::Aviation::CCallsign getPresetPartnerCallsign() const { return m_partnerCallsign; } + + //! Mode BlackMisc::Network::CLoginMode getLoginMode() const; //! Conenct/disconnect { @@ -112,8 +121,10 @@ namespace BlackCore void disconnectFromServer(); //! @} + //! Interim positions @{ void addInterimPositionReceiver(const BlackMisc::Aviation::CCallsign &receiver) { m_interimPositionReceivers.push_back(receiver); } void removeInterimPositionReceiver(const BlackMisc::Aviation::CCallsign &receiver) { m_interimPositionReceivers.remove(receiver); } + //! @} //! Convenience functions for sendClientQuery //! \private diff --git a/src/blackcore/fsd/ping.h b/src/blackcore/fsd/ping.h index d46b0ba20..3155fc7cf 100644 --- a/src/blackcore/fsd/ping.h +++ b/src/blackcore/fsd/ping.h @@ -33,7 +33,7 @@ namespace BlackCore //! PDU identifier static QString pdu() { return "$PI"; } - QString m_timestamp; + QString m_timestamp; //!< timestamp private: Ping(); diff --git a/src/blackcore/fsd/planeinforequest.h b/src/blackcore/fsd/planeinforequest.h index e058c311f..5eb08145c 100644 --- a/src/blackcore/fsd/planeinforequest.h +++ b/src/blackcore/fsd/planeinforequest.h @@ -22,10 +22,9 @@ namespace BlackCore class BLACKCORE_EXPORT PlaneInfoRequest : public MessageBase { public: + //! Ctor PlaneInfoRequest(const QString &sender, const QString &receiver); - virtual ~PlaneInfoRequest() {} - //! Message converted to tokens QStringList toTokens() const; diff --git a/src/blackcore/fsd/planeinforequestfsinn.h b/src/blackcore/fsd/planeinforequestfsinn.h index 6fa1111c5..6c16fe482 100644 --- a/src/blackcore/fsd/planeinforequestfsinn.h +++ b/src/blackcore/fsd/planeinforequestfsinn.h @@ -29,8 +29,6 @@ namespace BlackCore const QString &aircraftIcaoCombinedType, const QString &sendMModelString); - virtual ~PlaneInfoRequestFsinn() {} - //! Message converted to tokens QStringList toTokens() const; @@ -40,10 +38,12 @@ namespace BlackCore //! PDU identifier static QString pdu() { return QStringLiteral("#SB"); } + //! Properties @{ QString m_airlineIcao; QString m_aircraftIcao; QString m_aircraftIcaoCombinedType; QString m_sendMModelString; + //! @} private: PlaneInfoRequestFsinn(); diff --git a/src/blackcore/fsd/planeinformation.h b/src/blackcore/fsd/planeinformation.h index 264849bcc..043481ff7 100644 --- a/src/blackcore/fsd/planeinformation.h +++ b/src/blackcore/fsd/planeinformation.h @@ -34,9 +34,11 @@ namespace BlackCore //! PDU identifier static QString pdu() { return "#SB"; } + //! Properties @{ QString m_aircraft; QString m_airline; QString m_livery; + //! @} private: diff --git a/src/blackcore/setupreader.cpp b/src/blackcore/setupreader.cpp index ab5a1eb13..67f24800e 100644 --- a/src/blackcore/setupreader.cpp +++ b/src/blackcore/setupreader.cpp @@ -668,10 +668,10 @@ namespace BlackCore void CSetupReader::networkReplyProgress(int logId, qint64 current, qint64 max, const QUrl &url) { - Q_UNUSED(url); - Q_UNUSED(logId); - Q_UNUSED(current); - Q_UNUSED(max); + Q_UNUSED(url) + Q_UNUSED(logId) + Q_UNUSED(current) + Q_UNUSED(max) } CStatusMessageList CSetupReader::manageSetupAvailability(bool webRead, bool localRead) diff --git a/src/swiftlauncher/main.cpp b/src/swiftlauncher/main.cpp index 0e3baea5e..c0e1a7b04 100644 --- a/src/swiftlauncher/main.cpp +++ b/src/swiftlauncher/main.cpp @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) //! [SwiftApplicationDemo] CGuiApplication::highDpiScreenSupport(CGuiApplication::parseScaleFactor(argc, argv)); QApplication qa(argc, argv); // needed - Q_UNUSED(qa); + Q_UNUSED(qa) CGuiApplication a(CApplicationInfo::swiftLauncher(), CApplicationInfo::Laucher, CIcons::swiftLauncher1024()); a.addVatlibOptions(); // so it can be passed (hand over) to started applications a.addParserOption({{"i", "installer"}, QCoreApplication::translate("main", "Installer setup.")});