diff --git a/src/blackcore/application.h b/src/blackcore/application.h index 871732939..ca1c9744c 100644 --- a/src/blackcore/application.h +++ b/src/blackcore/application.h @@ -506,26 +506,26 @@ namespace BlackCore int maxRedirects, std::function requestOrPostMethod); - QNetworkAccessManager *m_accessManager = nullptr; //!< single network access manager + QNetworkAccessManager *m_accessManager = nullptr; //!< single network access manager BlackMisc::CApplicationInfo::Application m_application = BlackMisc::CApplicationInfo::Unknown; //!< Application if specified - QScopedPointer m_coreFacade; //!< core facade if any - QScopedPointer m_setupReader; //!< setup reader - QScopedPointer m_webDataServices; //!< web data services - QScopedPointer m_fileLogger; //!< file logger - CCookieManager m_cookieManager; //!< single cookie manager for our access manager - QString m_applicationName; //!< application name - QReadWriteLock m_accessManagerLock; //!< lock to make access manager access threadsafe - CCoreFacadeConfig m_coreFacadeConfig; //!< Core facade config if any - CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used - BlackCore::Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< Load or used caching? - std::atomic m_shutdown { false }; //!< is being shutdown? + QScopedPointer m_coreFacade; //!< core facade if any + QScopedPointer m_setupReader; //!< setup reader + QScopedPointer m_webDataServices; //!< web data services + QScopedPointer m_fileLogger; //!< file logger + CCookieManager m_cookieManager; //!< single cookie manager for our access manager + QString m_applicationName; //!< application name + QReadWriteLock m_accessManagerLock; //!< lock to make access manager access threadsafe + CCoreFacadeConfig m_coreFacadeConfig; //!< Core facade config if any + CWebReaderFlags::WebReader m_webReadersUsed; //!< Readers to be used + BlackCore::Db::CDatabaseReaderConfigList m_dbReaderConfig; //!< Load or used caching? + std::atomic m_shutdown { false }; //!< is being shutdown? QTimer m_internetAccessTimer { this }; - bool m_useContexts = false; //!< use contexts - bool m_useWebData = false; //!< use web data - bool m_signalStartup = true; //!< signal startup automatically - bool m_devEnv = false; //!< dev. environment - bool m_unitTest = false; //!< is UNIT test - bool m_autoSaveSettings = true; //!< automatically saving all settings + bool m_useContexts = false; //!< use contexts + bool m_useWebData = false; //!< use web data + bool m_signalStartup = true; //!< signal startup automatically + bool m_devEnv = false; //!< dev. environment + bool m_unitTest = false; //!< is UNIT test + bool m_autoSaveSettings = true; //!< automatically saving all settings bool m_internetAccessible = true; //!< Internet accessible // -------------- crashpad ----------------- diff --git a/src/blackcore/data/vatsimsetup.cpp b/src/blackcore/data/vatsimsetup.cpp index 28f1cc16d..a1c8a1037 100644 --- a/src/blackcore/data/vatsimsetup.cpp +++ b/src/blackcore/data/vatsimsetup.cpp @@ -8,7 +8,6 @@ */ #include "blackcore/data/vatsimsetup.h" - #include using namespace BlackMisc; @@ -66,15 +65,12 @@ namespace BlackCore if (index.isMyself()) { return CVariant::from(*this); } if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); } - ColumnIndex i = index.frontCasted(); + const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexFsdServers: - return CVariant::fromValue(this->m_fsdServers); - case IndexDataFiles: - return CVariant::fromValue(this->m_dataFileUrls); - default: - return CValueObject::propertyByIndex(index); + case IndexFsdServers: return CVariant::fromValue(this->m_fsdServers); + case IndexDataFiles: return CVariant::fromValue(this->m_dataFileUrls); + default: return CValueObject::propertyByIndex(index); } } @@ -87,18 +83,12 @@ namespace BlackCore return; } - ColumnIndex i = index.frontCasted(); + const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexFsdServers: - this->m_fsdServers = variant.value(); - break; - case IndexDataFiles: - this->m_dataFileUrls = variant.value(); - break; - default: - CValueObject::setPropertyByIndex(index, variant); - break; + case IndexFsdServers: this->m_fsdServers = variant.value(); break; + case IndexDataFiles: this->m_dataFileUrls = variant.value(); break; + default: CValueObject::setPropertyByIndex(index, variant); break; } } } // ns diff --git a/src/blackcore/db/databaseauthentication.cpp b/src/blackcore/db/databaseauthentication.cpp index 6a1499b6d..0dc62deea 100644 --- a/src/blackcore/db/databaseauthentication.cpp +++ b/src/blackcore/db/databaseauthentication.cpp @@ -89,8 +89,8 @@ namespace BlackCore QString query = params.toString(); const QNetworkRequest request(CNetworkUtils::getNetworkRequest(url, CNetworkUtils::PostUrlEncoded)); - sApp->postToNetwork(request, query.toUtf8(), { this, &CDatabaseAuthenticationService::parseServerResponse}); - QString rm("Sent request to authentication server %1"); + sApp->postToNetwork(request, CApplication::NoLogRequestId, query.toUtf8(), { this, &CDatabaseAuthenticationService::parseServerResponse}); + static const QString rm("Sent request to authentication server '%1'"); msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityInfo, rm.arg(url.toQString()))); return msgs; } diff --git a/src/blackcore/db/databasereader.cpp b/src/blackcore/db/databasereader.cpp index 8ad743937..5daaf59d2 100644 --- a/src/blackcore/db/databasereader.cpp +++ b/src/blackcore/db/databasereader.cpp @@ -601,10 +601,8 @@ namespace BlackCore Q_ASSERT_X(CEntityFlags::isSingleEntity(entity), Q_FUNC_INFO, "needs single entity"); switch (mode) { - case CDbFlags::Shared: - return CDbInfo::entityToSharedName(entity); - case CDbFlags::SharedInfoOnly: - return CDbInfo::sharedInfoFileName(); + case CDbFlags::Shared: return CDbInfo::entityToSharedName(entity); + case CDbFlags::SharedInfoOnly: return CDbInfo::sharedInfoFileName(); default: case CDbFlags::DbReading: return CDbInfo::entityToServiceName(entity); @@ -613,7 +611,7 @@ namespace BlackCore QString CDatabaseReader::dateTimeToDbLatestTs(const QDateTime &ts) { - if (!ts.isValid()) return ""; + if (!ts.isValid()) { return ""; } return ts.toUTC().toString(Qt::ISODate); } diff --git a/src/blackcore/db/databasereader.h b/src/blackcore/db/databasereader.h index c2de3c166..06fd0d43c 100644 --- a/src/blackcore/db/databasereader.h +++ b/src/blackcore/db/databasereader.h @@ -262,10 +262,10 @@ namespace BlackCore void sharedFileHeaderRead(BlackMisc::Network::CEntityFlags::Entity entity, const QString &fileName, bool success); protected: - CDatabaseReaderConfigList m_config; //!< DB reder configuration - QString m_statusMessage; //!< Returned status message from watchdog - bool m_1stReplyReceived = false; //!< Successful connection? Does not mean data / authorizations are correct - mutable QReadWriteLock m_statusLock; //!< Lock + CDatabaseReaderConfigList m_config; //!< DB reder configuration + QString m_statusMessage; //!< Returned status message from watchdog + bool m_1stReplyReceived = false; //!< Successful connection? Does not mean data / authorizations are correct + mutable QReadWriteLock m_statusLock; //!< Lock QNetworkReply::NetworkError m_1stReplyStatus = QNetworkReply::UnknownServerError; //!< Successful connection? QMap m_sharedFileResponses; //!< file responses of the shared files BlackMisc::CStatusMessage::StatusSeverity m_severityNoWorkingUrl = BlackMisc::CStatusMessage::SeverityError; //!< severity of message if there is no working URL diff --git a/src/blackcore/db/databasewriter.h b/src/blackcore/db/databasewriter.h index 0359888ac..e99140c6b 100644 --- a/src/blackcore/db/databasewriter.h +++ b/src/blackcore/db/databasewriter.h @@ -61,9 +61,9 @@ namespace BlackCore private: BlackMisc::Network::CUrl m_modelPublishUrl; - QNetworkReply *m_pendingReply = nullptr; - qint64 m_replyPendingSince = -1; - bool m_shutdown = false; + QNetworkReply *m_pendingReply = nullptr; + qint64 m_replyPendingSince = -1; + bool m_shutdown = false; //! Kill the pending reply bool killPendingReply(); diff --git a/src/blackcore/threadedreader.h b/src/blackcore/threadedreader.h index 72d2fdfa9..a1d698a38 100644 --- a/src/blackcore/threadedreader.h +++ b/src/blackcore/threadedreader.h @@ -73,10 +73,11 @@ namespace BlackCore void pauseReader(); //! Used in unit test + //! \remark needs to be done before started in different thread void markAsUsedInUnitTest() { m_unitTest = true; } protected: - mutable QReadWriteLock m_lock {QReadWriteLock::Recursive}; //!< lock which can be used from the derived classes + mutable QReadWriteLock m_lock { QReadWriteLock::Recursive }; //!< lock which can be used from the derived classes //! Constructor CThreadedReader(QObject *owner, const QString &name); @@ -97,7 +98,7 @@ namespace BlackCore //! This method does the actual work in the derived class virtual void doWorkImpl() {} - //! Still enabled etc. + //! Still enabled etc.? bool doWorkCheck() const; //! Use this to log inconsistent data diff --git a/src/blackgui/guiapplication.cpp b/src/blackgui/guiapplication.cpp index 67469db31..c84f95cae 100644 --- a/src/blackgui/guiapplication.cpp +++ b/src/blackgui/guiapplication.cpp @@ -625,8 +625,10 @@ namespace BlackGui { if (CBuildConfig::isRunningOnWindowsNtPlatform()) { - QMessageBox::information(nullptr, QGuiApplication::applicationDisplayName(), - QGuiApplication::applicationDisplayName() + ' ' + QCoreApplication::applicationVersion()); + QMessageBox::information(nullptr, + QGuiApplication::applicationDisplayName(), + QGuiApplication::applicationDisplayName() + ' ' + + QCoreApplication::applicationVersion()); } else { diff --git a/src/blackmisc/db/datastoreobjectlist.cpp b/src/blackmisc/db/datastoreobjectlist.cpp index 30180aa59..5050686bd 100644 --- a/src/blackmisc/db/datastoreobjectlist.cpp +++ b/src/blackmisc/db/datastoreobjectlist.cpp @@ -227,6 +227,5 @@ namespace BlackMisc template class BLACKMISC_EXPORT_DEFINE_TEMPLATE IDatastoreObjectList; template class BLACKMISC_EXPORT_DEFINE_TEMPLATE IDatastoreObjectList; //! \endcond - } // ns } // ns diff --git a/src/blackmisc/db/datastoreobjectlist.h b/src/blackmisc/db/datastoreobjectlist.h index bc22f8566..e5a8818dc 100644 --- a/src/blackmisc/db/datastoreobjectlist.h +++ b/src/blackmisc/db/datastoreobjectlist.h @@ -82,14 +82,13 @@ namespace BlackMisc extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList; extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList; extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList; + extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList; extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList; extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList; extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList; extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList; extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList; - extern template class BLACKMISC_EXPORT_DECLARE_TEMPLATE IDatastoreObjectList; //! \endcond - } // ns } //ns diff --git a/src/blackmisc/network/clientlist.cpp b/src/blackmisc/network/clientlist.cpp index bde8dad08..57da5ef13 100644 --- a/src/blackmisc/network/clientlist.cpp +++ b/src/blackmisc/network/clientlist.cpp @@ -7,23 +7,15 @@ * contained in the LICENSE file. */ -#include "blackmisc/network/clientlist.h" -#include "blackmisc/metaclassprivate.h" - -#include -#include - -using namespace BlackMisc::Aviation; +#include "clientlist.h" namespace BlackMisc { namespace Network { - CClientList::CClientList() { } CClientList::CClientList(const CSequence &other) : CSequence(other) { } - } // namespace } // namespace diff --git a/src/blackmisc/network/clientlist.h b/src/blackmisc/network/clientlist.h index 14c69cfea..b40210a82 100644 --- a/src/blackmisc/network/clientlist.h +++ b/src/blackmisc/network/clientlist.h @@ -18,7 +18,6 @@ #include "blackmisc/network/client.h" #include "blackmisc/sequence.h" #include "blackmisc/variant.h" - #include namespace BlackMisc @@ -39,7 +38,6 @@ namespace BlackMisc //! Construct from a base class object. CClientList(const CSequence &other); - }; } //namespace } // namespace diff --git a/src/blackmisc/network/rolelist.h b/src/blackmisc/network/rolelist.h index 37b4ef4a2..429ded195 100644 --- a/src/blackmisc/network/rolelist.h +++ b/src/blackmisc/network/rolelist.h @@ -58,7 +58,6 @@ namespace BlackMisc //! From our database JSON format static CRoleList fromDatabaseJson(const QJsonArray &array); }; - } //namespace } // namespace diff --git a/src/blackmisc/network/url.cpp b/src/blackmisc/network/url.cpp index cba345d8f..c87a34383 100644 --- a/src/blackmisc/network/url.cpp +++ b/src/blackmisc/network/url.cpp @@ -234,48 +234,32 @@ namespace BlackMisc return q; } - CVariant CUrl::propertyByIndex(const BlackMisc::CPropertyIndex &index) const + CVariant CUrl::propertyByIndex(const CPropertyIndex &index) const { if (index.isMyself()) { return CVariant::from(*this); } - ColumnIndex i = index.frontCasted(); + const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexHost: - return CVariant::fromValue(this->m_host); - case IndexPort: - return CVariant::fromValue(this->m_port); - case IndexScheme: - return CVariant::fromValue(this->m_scheme); - case IndexPath: - return CVariant::fromValue(this->m_path); - default: - return CValueObject::propertyByIndex(index); + case IndexHost: return CVariant::fromValue(this->m_host); + case IndexPort: return CVariant::fromValue(this->m_port); + case IndexScheme: return CVariant::fromValue(this->m_scheme); + case IndexPath: return CVariant::fromValue(this->m_path); + default: return CValueObject::propertyByIndex(index); } } void CUrl::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant) { if (index.isMyself()) { (*this) = variant.to(); return; } - ColumnIndex i = index.frontCasted(); + const ColumnIndex i = index.frontCasted(); switch (i) { - case IndexHost: - this->setHost(variant.value()); - break; - case IndexPort: - this->setPort(variant.value()); - break; - case IndexPath: - this->setPath(variant.value()); - break; - case IndexScheme: - this->setScheme(variant.value()); - break; - default: - CValueObject::setPropertyByIndex(index, variant); - break; + case IndexHost: this->setHost(variant.value()); break; + case IndexPort: this->setPort(variant.value()); break; + case IndexPath: this->setPath(variant.value()); break; + case IndexScheme: this->setScheme(variant.value()); break; + default: CValueObject::setPropertyByIndex(index, variant); break; } } - } // namespace } // namespace diff --git a/src/blackmisc/network/url.h b/src/blackmisc/network/url.h index 902578998..1364ede55 100644 --- a/src/blackmisc/network/url.h +++ b/src/blackmisc/network/url.h @@ -9,8 +9,8 @@ //! \file -#ifndef BLACKMISC_NETWORK_NETWORKLOCATION_H -#define BLACKMISC_NETWORK_NETWORKLOCATION_H +#ifndef BLACKMISC_NETWORK_URL_H +#define BLACKMISC_NETWORK_URL_H #include "blackmisc/blackmiscexport.h" #include "blackmisc/metaclass.h" diff --git a/src/blackmisc/network/urllist.h b/src/blackmisc/network/urllist.h index 1a7318558..2a4bf4e6c 100644 --- a/src/blackmisc/network/urllist.h +++ b/src/blackmisc/network/urllist.h @@ -9,8 +9,8 @@ //! \file -#ifndef BLACKMISC_NETWORK_NETWORKLOCATIONLIST_H -#define BLACKMISC_NETWORK_NETWORKLOCATIONLIST_H +#ifndef BLACKMISC_NETWORK_URLLIST_H +#define BLACKMISC_NETWORK_URLLIST_H #include "blackmisc/blackmiscexport.h" #include "blackmisc/collection.h" @@ -26,7 +26,7 @@ namespace BlackMisc { namespace Network { - //! Value object encapsulating a list of servers. + //! Value object encapsulating a list of URLs. class BLACKMISC_EXPORT CUrlList : public CSequence, public BlackMisc::Mixin::MetaType diff --git a/src/blackmisc/timestampbased.cpp b/src/blackmisc/timestampbased.cpp index 355ddb5b3..a7c18b827 100644 --- a/src/blackmisc/timestampbased.cpp +++ b/src/blackmisc/timestampbased.cpp @@ -174,7 +174,7 @@ namespace BlackMisc bool ITimestampBased::canHandleIndex(const CPropertyIndex &index) { if (index.isEmpty()) { return false; } - int i = index.frontCasted(); + const int i = index.frontCasted(); return (i >= static_cast(IndexUtcTimestamp)) && (i <= static_cast(IndexMSecsSinceEpoch)); } @@ -182,7 +182,7 @@ namespace BlackMisc { if (!index.isEmpty()) { - ColumnIndex i = index.frontCasted(); + const ColumnIndex i = index.frontCasted(); switch (i) { case IndexUtcTimestamp: @@ -212,7 +212,7 @@ namespace BlackMisc { if (!index.isEmpty()) { - ColumnIndex i = index.frontCasted(); + const ColumnIndex i = index.frontCasted(); switch (i) { case IndexUtcTimestamp: