From 8569713331edac3de9bc638f03093212ab2038d1 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 14 Mar 2019 03:35:42 +0100 Subject: [PATCH] Ref T554, style --- src/blackcore/db/databasewriter.h | 2 +- src/blackgui/components/dbdebugdatabasesetup.cpp | 4 ++-- src/blackgui/components/dbdebugdatabasesetup.h | 10 +++------- src/blackgui/components/logincomponent.h | 2 +- src/blackmisc/db/datastoreutility.cpp | 15 ++++++++++----- src/blackmisc/db/datastoreutility.h | 4 ++++ 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/blackcore/db/databasewriter.h b/src/blackcore/db/databasewriter.h index d03e9d949..c1ecffbf4 100644 --- a/src/blackcore/db/databasewriter.h +++ b/src/blackcore/db/databasewriter.h @@ -74,7 +74,7 @@ namespace BlackCore BlackMisc::Network::CUrl m_autoPublishUrl; //!< auto publish data QNetworkReply *m_pendingModelPublishReply = nullptr; QNetworkReply *m_pendingAutoPublishReply = nullptr; - qint64 m_modelReplyPendingSince = -1; + qint64 m_modelReplyPendingSince = -1; qint64 m_autoPublishReplyPendingSince = -1; bool m_shutdown = false; diff --git a/src/blackgui/components/dbdebugdatabasesetup.cpp b/src/blackgui/components/dbdebugdatabasesetup.cpp index 64af4e832..a6bda4efa 100644 --- a/src/blackgui/components/dbdebugdatabasesetup.cpp +++ b/src/blackgui/components/dbdebugdatabasesetup.cpp @@ -33,14 +33,14 @@ namespace BlackGui } else { - connect(ui->cb_EnableServerDebugging, &QCheckBox::toggled, this, &CDbDebugDatabaseSetup::ps_debugChanged); + connect(ui->cb_EnableServerDebugging, &QCheckBox::toggled, this, &CDbDebugDatabaseSetup::onDebugChanged); } } CDbDebugDatabaseSetup::~CDbDebugDatabaseSetup() { } - void CDbDebugDatabaseSetup::ps_debugChanged(bool set) + void CDbDebugDatabaseSetup::onDebugChanged(bool set) { CGlobalSetup gs(m_setup.getThreadLocal()); gs.setServerDebugFlag(set); diff --git a/src/blackgui/components/dbdebugdatabasesetup.h b/src/blackgui/components/dbdebugdatabasesetup.h index 581586079..e6a722548 100644 --- a/src/blackgui/components/dbdebugdatabasesetup.h +++ b/src/blackgui/components/dbdebugdatabasesetup.h @@ -19,10 +19,7 @@ #include #include -class QWidget; - namespace Ui { class CDbDebugDatabaseSetup; } - namespace BlackGui { namespace Components @@ -42,11 +39,10 @@ namespace BlackGui //! Dstructor ~CDbDebugDatabaseSetup(); - private slots: - //! Changed the debug checkbox - void ps_debugChanged(bool set); - private: + //! Changed the debug checkbox + void onDebugChanged(bool set); + QScopedPointer ui; BlackMisc::CData m_setup {this}; //!< data cache }; diff --git a/src/blackgui/components/logincomponent.h b/src/blackgui/components/logincomponent.h index 0e7ff74c1..62c9fa0a0 100644 --- a/src/blackgui/components/logincomponent.h +++ b/src/blackgui/components/logincomponent.h @@ -34,6 +34,7 @@ #include #include +namespace Ui { class CLoginComponent; } namespace BlackMisc { namespace Simulation @@ -42,7 +43,6 @@ namespace BlackMisc class CSimulatedAircraft; } } -namespace Ui { class CLoginComponent; } namespace BlackGui { namespace Components diff --git a/src/blackmisc/db/datastoreutility.cpp b/src/blackmisc/db/datastoreutility.cpp index 7d6a44fb1..4e1694aac 100644 --- a/src/blackmisc/db/datastoreutility.cpp +++ b/src/blackmisc/db/datastoreutility.cpp @@ -29,6 +29,12 @@ namespace BlackMisc { namespace Db { + const CLogCategoryList &CDatastoreUtility::getLogCategories() + { + static const CLogCategoryList cats({CLogCategory::swiftDbWebservice()}); + return cats; + } + bool CDatastoreUtility::dbBoolStringToBool(const QString &dbBool) { return BlackMisc::stringToBool(dbBool); @@ -76,16 +82,15 @@ namespace BlackMisc bool CDatastoreUtility::parseSwiftPublishResponse(const QString &jsonResponse, CAircraftModelList &publishedModels, CAircraftModelList &skippedModels, CStatusMessageList &messages, bool &directWrite) { - static const CLogCategoryList cats({CLogCategory::swiftDbWebservice()}); directWrite = false; if (jsonResponse.isEmpty()) { - messages.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, u"Empty JSON data for published models")); + messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, u"Empty JSON data for published models")); return false; } - QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonResponse.toUtf8())); + const QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonResponse.toUtf8())); // array of messages only if (jsonDoc.isArray()) @@ -99,7 +104,7 @@ namespace BlackMisc if (!jsonDoc.isObject()) { const QString phpError(CNetworkUtils::removeHtmlPartsFromPhpErrorMessage(jsonResponse)); - messages.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, phpError)); + messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, phpError)); return false; } @@ -148,7 +153,7 @@ namespace BlackMisc if (!hasData) { - messages.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, u"Received response, but no JSON data")); + messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, u"Received response, but no JSON data")); } return hasData; diff --git a/src/blackmisc/db/datastoreutility.h b/src/blackmisc/db/datastoreutility.h index d9a4425da..7c873208f 100644 --- a/src/blackmisc/db/datastoreutility.h +++ b/src/blackmisc/db/datastoreutility.h @@ -11,6 +11,7 @@ #ifndef BLACKMISC_DB_DATASTOREUTILITY_H #define BLACKMISC_DB_DATASTOREUTILITY_H +#include "blackmisc/logcategorylist.h" #include "blackmisc/blackmiscexport.h" #include @@ -29,6 +30,9 @@ namespace BlackMisc class BLACKMISC_EXPORT CDatastoreUtility { public: + //! Log.categories + static const CLogCategoryList &getLogCategories(); + //! No constructor CDatastoreUtility() = delete;