mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +08:00
Issue #77 getLogCategories returns a simple QStringList instead of our own class
This commit is contained in:
@@ -106,7 +106,7 @@ namespace BlackMisc
|
||||
|
||||
CStatusMessageList CAircraftIcaoCode::validate() const
|
||||
{
|
||||
static const CLogCategoryList cats({ CLogCategory("swift.blackmisc.aircrafticao"), CLogCategory::validation()});
|
||||
static const CLogCategoryList cats({ CLogCategory("swift.blackmisc.aircrafticao"), CLogCategories::validation()});
|
||||
CStatusMessageList msg;
|
||||
if (this->isLoadedFromDb())
|
||||
{
|
||||
|
||||
@@ -20,9 +20,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
const CLogCategoryList &CAirlineIcaoCodeList::getLogCategories()
|
||||
const QStringList &CAirlineIcaoCodeList::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats(CLogCategory::aviation());
|
||||
static const QStringList cats(CLogCategories::aviation());
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace BlackMisc
|
||||
using CSequence::CSequence;
|
||||
|
||||
//! Categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Default constructor.
|
||||
CAirlineIcaoCodeList();
|
||||
|
||||
@@ -202,9 +202,9 @@ namespace BlackMisc
|
||||
return r.isEmpty() ? newRemark : r % u" " % newRemark;
|
||||
}
|
||||
|
||||
const CLogCategoryList &CFlightPlan::getLogCategories()
|
||||
const QStringList &CFlightPlan::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats { CLogCategory::flightPlan() };
|
||||
static const QStringList cats { CLogCategories::flightPlan() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
@@ -643,14 +643,14 @@ namespace BlackMisc
|
||||
QFileInfo fi(fileName);
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
if (msgs) { msgs->push_back(CStatusMessage(getLogCategories()).validationError(u"No file name")); }
|
||||
if (msgs) { msgs->push_back(CStatusMessage(static_cast<CFlightPlan *>(nullptr)).validationError(u"No file name")); }
|
||||
return CFlightPlan();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!fi.exists())
|
||||
{
|
||||
if (msgs) { msgs->push_back(CStatusMessage(getLogCategories()).validationError(u"File '%1' does not exist") << fileName); }
|
||||
if (msgs) { msgs->push_back(CStatusMessage(static_cast<CFlightPlan *>(nullptr)).validationError(u"File '%1' does not exist") << fileName); }
|
||||
return CFlightPlan();
|
||||
}
|
||||
}
|
||||
@@ -658,7 +658,7 @@ namespace BlackMisc
|
||||
const QString data = CFileUtils::readFileToString(fileName);
|
||||
if (data.isEmpty())
|
||||
{
|
||||
if (msgs) { msgs->push_back(CStatusMessage(getLogCategories()).validationError(u"File '%1' does not contain data") << fileName); }
|
||||
if (msgs) { msgs->push_back(CStatusMessage(static_cast<CFlightPlan *>(nullptr)).validationError(u"File '%1' does not contain data") << fileName); }
|
||||
return CFlightPlan();
|
||||
}
|
||||
|
||||
@@ -671,7 +671,7 @@ namespace BlackMisc
|
||||
CStatusMessage m;
|
||||
if (!Json::looksLikeSwiftJson(data))
|
||||
{
|
||||
m = CStatusMessage(getLogCategories(), CStatusMessage::SeverityWarning, u"Reading '%1' yields no data", true) << fileName;
|
||||
m = CStatusMessage(static_cast<CFlightPlan *>(nullptr), CStatusMessage::SeverityWarning, u"Reading '%1' yields no data", true) << fileName;
|
||||
if (msgs) { msgs->push_back(m); }
|
||||
break;
|
||||
}
|
||||
@@ -691,7 +691,7 @@ namespace BlackMisc
|
||||
}
|
||||
else
|
||||
{
|
||||
m = CStatusMessage(getLogCategories(), CStatusMessage::SeverityWarning, u"Wrong format for flight plan in '%1'") << fileName;
|
||||
m = CStatusMessage(static_cast<CFlightPlan *>(nullptr), CStatusMessage::SeverityWarning, u"Wrong format for flight plan in '%1'") << fileName;
|
||||
if (msgs) { msgs->push_back(m); }
|
||||
}
|
||||
}
|
||||
@@ -703,7 +703,7 @@ namespace BlackMisc
|
||||
}
|
||||
catch (const CJsonException &ex)
|
||||
{
|
||||
m = CStatusMessage::fromJsonException(ex, getLogCategories(), "Parse error in " + fileName);
|
||||
m = CStatusMessage::fromJsonException(ex, static_cast<CFlightPlan *>(nullptr), "Parse error in " + fileName);
|
||||
if (msgs) { msgs->push_back(m); }
|
||||
break;
|
||||
}
|
||||
@@ -717,7 +717,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (msgs)
|
||||
{
|
||||
msgs->push_back(CStatusMessage::fromJsonException(ex, getLogCategories(), QStringLiteral("Parsing flight plan from '%1' failed.").arg(fileName)));
|
||||
msgs->push_back(CStatusMessage::fromJsonException(ex, static_cast<CFlightPlan *>(nullptr), QStringLiteral("Parsing flight plan from '%1' failed.").arg(fileName)));
|
||||
}
|
||||
}
|
||||
return CFlightPlan();
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
//! The log. catgeories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Flight rules (VFR or IFR)
|
||||
enum FlightRules
|
||||
|
||||
@@ -12,53 +12,53 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
void CLogUtilities::addLogDetailsToList(CStatusMessageList *log, const CCallsign &callsign, const QString &message, const CLogCategoryList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
void CLogUtilities::addLogDetailsToList(CStatusMessageList *log, const CCallsign &callsign, const QString &message, const QStringList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
{
|
||||
if (!log) { return; }
|
||||
if (message.isEmpty()) { return; }
|
||||
log->push_back(CLogUtilities::logMessage(callsign, message, extraCategories, s));
|
||||
}
|
||||
|
||||
void CLogUtilities::addLogDetailsToList(CStatusMessageList *log, const CAircraftIcaoCode &icao, const QString &message, const CLogCategoryList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
void CLogUtilities::addLogDetailsToList(CStatusMessageList *log, const CAircraftIcaoCode &icao, const QString &message, const QStringList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
{
|
||||
if (!log) { return; }
|
||||
if (message.isEmpty()) { return; }
|
||||
log->push_back(CLogUtilities::logMessage(icao, message, extraCategories, s));
|
||||
}
|
||||
|
||||
void CLogUtilities::addLogDetailsToList(CStatusMessageList *log, const CAirlineIcaoCode &icao, const QString &message, const CLogCategoryList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
void CLogUtilities::addLogDetailsToList(CStatusMessageList *log, const CAirlineIcaoCode &icao, const QString &message, const QStringList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
{
|
||||
if (!log) { return; }
|
||||
if (message.isEmpty()) { return; }
|
||||
log->push_back(CLogUtilities::logMessage(icao, message, extraCategories, s));
|
||||
}
|
||||
|
||||
void CLogUtilities::addLogDetailsToList(CStatusMessageList *log, const CLivery &livery, const QString &message, const CLogCategoryList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
void CLogUtilities::addLogDetailsToList(CStatusMessageList *log, const CLivery &livery, const QString &message, const QStringList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
{
|
||||
if (!log) { return; }
|
||||
if (message.isEmpty()) { return; }
|
||||
log->push_back(CLogUtilities::logMessage(livery, message, extraCategories, s));
|
||||
}
|
||||
|
||||
CStatusMessage CLogUtilities::logMessage(const CCallsign &callsign, const QString &message, const CLogCategoryList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
CStatusMessage CLogUtilities::logMessage(const CCallsign &callsign, const QString &message, const QStringList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
{
|
||||
const CStatusMessage m(categories(extraCategories), s, callsign.isEmpty() ? message.trimmed() : callsign.toQString() + ": " + message.trimmed());
|
||||
return m;
|
||||
}
|
||||
|
||||
CStatusMessage CLogUtilities::logMessage(const CAircraftIcaoCode &icaoCode, const QString &message, const CLogCategoryList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
CStatusMessage CLogUtilities::logMessage(const CAircraftIcaoCode &icaoCode, const QString &message, const QStringList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
{
|
||||
const CStatusMessage m(categories(extraCategories), s, icaoCode.hasDesignator() ? icaoCode.getDesignatorDbKey() + ": " + message.trimmed() : message.trimmed());
|
||||
return m;
|
||||
}
|
||||
|
||||
CStatusMessage CLogUtilities::logMessage(const CAirlineIcaoCode &icaoCode, const QString &message, const CLogCategoryList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
CStatusMessage CLogUtilities::logMessage(const CAirlineIcaoCode &icaoCode, const QString &message, const QStringList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
{
|
||||
const CStatusMessage m(categories(extraCategories), s, icaoCode.hasValidDesignator() ? icaoCode.getVDesignatorDbKey() + ": " + message.trimmed() : message.trimmed());
|
||||
return m;
|
||||
}
|
||||
|
||||
CStatusMessage CLogUtilities::logMessage(const CLivery &livery, const QString &message, const CLogCategoryList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
CStatusMessage CLogUtilities::logMessage(const CLivery &livery, const QString &message, const QStringList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
{
|
||||
const CStatusMessage m(categories(extraCategories), s, livery.hasCombinedCode() ? livery.getCombinedCodePlusInfoAndId() + ": " + message.trimmed() : message.trimmed());
|
||||
return m;
|
||||
@@ -66,15 +66,15 @@ namespace BlackMisc
|
||||
|
||||
const CLogCategoryList &CLogUtilities::defaultCategories()
|
||||
{
|
||||
static const CLogCategoryList cats({ CLogCategory::aviation() });
|
||||
static const CLogCategoryList cats({ CLogCategories::aviation() });
|
||||
return cats;
|
||||
}
|
||||
|
||||
CLogCategoryList CLogUtilities::categories(const CLogCategoryList &extraCategories)
|
||||
CLogCategoryList CLogUtilities::categories(const QStringList &extraCategories)
|
||||
{
|
||||
if (extraCategories.isEmpty()) { return defaultCategories(); }
|
||||
CLogCategoryList cats(defaultCategories());
|
||||
cats.push_back(extraCategories);
|
||||
cats.push_back(CLogCategoryList::fromQStringList(extraCategories));
|
||||
return cats;
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -33,53 +33,53 @@ namespace BlackMisc
|
||||
//! Specialized log for matching / reverse lookup
|
||||
//! \threadsafe
|
||||
static void addLogDetailsToList(CStatusMessageList *log, const CCallsign &callsign,
|
||||
const QString &message, const CLogCategoryList &extraCategories = {},
|
||||
const QString &message, const QStringList &extraCategories = {},
|
||||
CStatusMessage::StatusSeverity s = CStatusMessage::SeverityInfo);
|
||||
|
||||
//! Specialized log for matching / reverse lookup
|
||||
//! \threadsafe
|
||||
static void addLogDetailsToList(CStatusMessageList *log, const CAircraftIcaoCode &icao,
|
||||
const QString &message, const CLogCategoryList &extraCategories = {},
|
||||
const QString &message, const QStringList &extraCategories = {},
|
||||
CStatusMessage::StatusSeverity s = CStatusMessage::SeverityInfo);
|
||||
|
||||
//! Specialized log for matching / reverse lookup
|
||||
//! \threadsafe
|
||||
static void addLogDetailsToList(CStatusMessageList *log, const CAirlineIcaoCode &icao,
|
||||
const QString &message, const CLogCategoryList &extraCategories = {},
|
||||
const QString &message, const QStringList &extraCategories = {},
|
||||
CStatusMessage::StatusSeverity s = CStatusMessage::SeverityInfo);
|
||||
|
||||
//! Specialized log for matching / reverse lookup
|
||||
//! \threadsafe
|
||||
static void addLogDetailsToList(CStatusMessageList *log, const CLivery &livery,
|
||||
const QString &message, const CLogCategoryList &extraCategories = {},
|
||||
const QString &message, const QStringList &extraCategories = {},
|
||||
CStatusMessage::StatusSeverity s = CStatusMessage::SeverityInfo);
|
||||
|
||||
//! Specialized log message for matching / reverse lookup
|
||||
//! \threadsafe
|
||||
static CStatusMessage logMessage(
|
||||
const CCallsign &callsign,
|
||||
const QString &message, const CLogCategoryList &extraCategories = {},
|
||||
const QString &message, const QStringList &extraCategories = {},
|
||||
CStatusMessage::StatusSeverity s = CStatusMessage::SeverityInfo);
|
||||
|
||||
//! Specialized log message for matching / reverse lookup
|
||||
//! \threadsafe
|
||||
static CStatusMessage logMessage(
|
||||
const CAircraftIcaoCode &icaoCode,
|
||||
const QString &message, const CLogCategoryList &extraCategories = {},
|
||||
const QString &message, const QStringList &extraCategories = {},
|
||||
CStatusMessage::StatusSeverity s = CStatusMessage::SeverityInfo);
|
||||
|
||||
//! Specialized log message for matching / reverse lookup
|
||||
//! \threadsafe
|
||||
static CStatusMessage logMessage(
|
||||
const CAirlineIcaoCode &icaoCode,
|
||||
const QString &message, const CLogCategoryList &extraCategories = {},
|
||||
const QString &message, const QStringList &extraCategories = {},
|
||||
CStatusMessage::StatusSeverity s = CStatusMessage::SeverityInfo);
|
||||
|
||||
//! Specialized log message for matching / reverse lookup
|
||||
//! \threadsafe
|
||||
static CStatusMessage logMessage(
|
||||
const CLivery &livery,
|
||||
const QString &message, const CLogCategoryList &extraCategories = {},
|
||||
const QString &message, const QStringList &extraCategories = {},
|
||||
CStatusMessage::StatusSeverity s = CStatusMessage::SeverityInfo);
|
||||
|
||||
private:
|
||||
@@ -87,7 +87,7 @@ namespace BlackMisc
|
||||
static const CLogCategoryList &defaultCategories();
|
||||
|
||||
//! Categories
|
||||
static CLogCategoryList categories(const CLogCategoryList &extraCategories);
|
||||
static CLogCategoryList categories(const QStringList &extraCategories);
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Aviation
|
||||
{
|
||||
const CLogCategoryList &CSimBriefData::getLogCategories()
|
||||
const QStringList &CSimBriefData::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats { CLogCategory::flightPlan() };
|
||||
static const QStringList cats { CLogCategories::flightPlan() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
//! The log. catgeories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Default constructor
|
||||
CSimBriefData();
|
||||
|
||||
@@ -261,9 +261,9 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
const CLogCategoryList &CDataCacheSerializer::getLogCategories()
|
||||
const QStringList &CDataCacheSerializer::getLogCategories()
|
||||
{
|
||||
static const BlackMisc::CLogCategoryList cats { BlackMisc::CLogCategory::cache() };
|
||||
static const QStringList cats { BlackMisc::CLogCategories::cache() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace BlackMisc
|
||||
|
||||
public:
|
||||
//! Log categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Constructor.
|
||||
CDataCacheSerializer(CDataCache *owner, const QString &revisionFileName);
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Db
|
||||
{
|
||||
const CLogCategoryList &CDatastoreUtility::getLogCategories()
|
||||
const QStringList &CDatastoreUtility::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats({CLogCategory::swiftDbWebservice()});
|
||||
static const QStringList cats({CLogCategories::swiftDbWebservice()});
|
||||
return cats;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace BlackMisc
|
||||
|
||||
if (jsonResponse.isEmpty())
|
||||
{
|
||||
messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, u"Empty JSON data for published models"));
|
||||
messages.push_back(CStatusMessage(static_cast<CDatastoreUtility *>(nullptr), CStatusMessage::SeverityError, u"Empty JSON data for published models"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace BlackMisc
|
||||
if (!jsonDoc.isObject())
|
||||
{
|
||||
const QString phpError(CNetworkUtils::removeHtmlPartsFromPhpErrorMessage(jsonResponse));
|
||||
messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, phpError));
|
||||
messages.push_back(CStatusMessage(static_cast<CDatastoreUtility *>(nullptr), CStatusMessage::SeverityError, phpError));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace BlackMisc
|
||||
|
||||
if (!hasData)
|
||||
{
|
||||
messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, u"Received response, but no JSON data"));
|
||||
messages.push_back(CStatusMessage(static_cast<CDatastoreUtility *>(nullptr), CStatusMessage::SeverityError, u"Received response, but no JSON data"));
|
||||
}
|
||||
|
||||
return hasData;
|
||||
@@ -163,7 +163,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (jsonResponse.isEmpty())
|
||||
{
|
||||
messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, u"Empty JSON data for published models"));
|
||||
messages.push_back(CStatusMessage(static_cast<CDatastoreUtility *>(nullptr), CStatusMessage::SeverityError, u"Empty JSON data for published models"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace BlackMisc
|
||||
if (!jsonDoc.isObject())
|
||||
{
|
||||
const QString phpError(CNetworkUtils::removeHtmlPartsFromPhpErrorMessage(jsonResponse));
|
||||
messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, phpError));
|
||||
messages.push_back(CStatusMessage(static_cast<CDatastoreUtility *>(nullptr), CStatusMessage::SeverityError, phpError));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
//! Log.categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! No constructor
|
||||
CDatastoreUtility() = delete;
|
||||
|
||||
@@ -109,9 +109,9 @@ namespace BlackMisc
|
||||
return CDBusServer::isP2PConnection(connection) ? empty : CDBusServer::coreServiceName();
|
||||
}
|
||||
|
||||
const CLogCategoryList &CDBusServer::getLogCategories()
|
||||
const QStringList &CDBusServer::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats({ CLogCategory::dbus() });
|
||||
static const QStringList cats({ CLogCategories::dbus() });
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace BlackMisc
|
||||
static const QString &coreServiceName(const QDBusConnection &connection);
|
||||
|
||||
//! Log categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Server mode
|
||||
enum ServerMode
|
||||
|
||||
@@ -17,9 +17,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Geo
|
||||
{
|
||||
const CLogCategoryList &CKmlUtils::getLogCategories()
|
||||
const QStringList &CKmlUtils::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats { CLogCategory::interpolator() };
|
||||
static const QStringList cats { CLogCategories::interpolator() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
//! Log categories
|
||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! KML settings
|
||||
struct KMLSettings
|
||||
|
||||
337
src/blackmisc/logcategories.h
Normal file
337
src/blackmisc/logcategories.h
Normal file
@@ -0,0 +1,337 @@
|
||||
/* Copyright (C) 2014
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
|
||||
* or distributed except according to the terms contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_LOGCATEGORIES_H
|
||||
#define BLACKMISC_LOGCATEGORIES_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
/*!
|
||||
* Predefined special log categories.
|
||||
*
|
||||
* \see CLogCategory
|
||||
*/
|
||||
class BLACKMISC_EXPORT CLogCategories
|
||||
{
|
||||
public:
|
||||
//! Uncategorized
|
||||
static const QString &uncategorized()
|
||||
{
|
||||
static const QString cat { "swift.uncategorized" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Verification
|
||||
static const QString &verification()
|
||||
{
|
||||
static const QString cat { "swift.verification" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Validation
|
||||
static const QString &validation()
|
||||
{
|
||||
static const QString cat { "swift.validation" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Core/base services such as caching etc.
|
||||
static const QString &services()
|
||||
{
|
||||
static const QString cat { "swift.services" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Audio related
|
||||
static const QString &audio()
|
||||
{
|
||||
static const QString cat { "swift.audio" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! DBus related
|
||||
static const QString &dbus()
|
||||
{
|
||||
static const QString cat { "swift.dbus" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Contexts
|
||||
static const QString &context()
|
||||
{
|
||||
static const QString cat { "swift.context" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Interpolator
|
||||
static const QString &interpolator()
|
||||
{
|
||||
static const QString cat { "swift.interpolator" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Flight plan
|
||||
static const QString &flightPlan()
|
||||
{
|
||||
static const QString cat { "swift.flightplan" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Context slots
|
||||
static const QString &contextSlot()
|
||||
{
|
||||
static const QString cat { "swift.context.slot" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! GUI components
|
||||
static const QString &guiComponent()
|
||||
{
|
||||
static const QString cat { "swift.gui.component" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Generic downloads
|
||||
static const QString &download()
|
||||
{
|
||||
static const QString cat { "swift.download" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Webservice
|
||||
static const QString &webservice()
|
||||
{
|
||||
static const QString cat { "swift.webservice" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Mapping
|
||||
static const QString &mapping()
|
||||
{
|
||||
static const QString cat { "swift.mapping" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Matching
|
||||
static const QString &matching()
|
||||
{
|
||||
static const QString cat { "swift.matching" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Settings
|
||||
static const QString &settings()
|
||||
{
|
||||
static const QString cat { "swift.settings" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Cache
|
||||
static const QString &cache()
|
||||
{
|
||||
static const QString cat { "swift.cache" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Cmd.line parsing
|
||||
static const QString &cmdLine()
|
||||
{
|
||||
static const QString cat { "swift.cmdLine" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Driver
|
||||
static const QString &driver()
|
||||
{
|
||||
static const QString cat { "swift.driver" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Model loader
|
||||
static const QString &modelLoader()
|
||||
{
|
||||
static const QString cat { "swift.modelloader" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Model cache
|
||||
static const QString &modelCache()
|
||||
{
|
||||
static const QString cat { "swift.modelcache" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Model set cache
|
||||
static const QString &modelSetCache()
|
||||
{
|
||||
static const QString cat { "swift.modelsetcache" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Model UI
|
||||
static const QString &modelGui()
|
||||
{
|
||||
static const QString cat { "swift.modelui" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Plugin
|
||||
static const QString &plugin()
|
||||
{
|
||||
static const QString cat { "swift.plugin" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Wizard
|
||||
static const QString &wizard()
|
||||
{
|
||||
static const QString cat { "swift.wizard" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Background task
|
||||
static const QString &worker()
|
||||
{
|
||||
static const QString cat { "swift.worker" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Data inconsistency
|
||||
static const QString &dataInconsistency()
|
||||
{
|
||||
static const QString cat { "swift.datainconsistency" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! JSON and JSON conversions
|
||||
static const QString &json()
|
||||
{
|
||||
static const QString cat { "swift.json" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Startup of application
|
||||
static const QString &startup()
|
||||
{
|
||||
static const QString cat { "swift.startup" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Webservice with swift DB
|
||||
static const QString &swiftDbWebservice()
|
||||
{
|
||||
static const QString cat { "swift.db.webservice" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! swift GUI
|
||||
static const QString &swiftPilotClient()
|
||||
{
|
||||
static const QString cat { "SwiftGuiStd" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! swift data tool (aka mapping tool)
|
||||
static const QString &swiftDataTool()
|
||||
{
|
||||
static const QString cat { "CSwiftData" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! swift core
|
||||
static const QString &swiftCore()
|
||||
{
|
||||
static const QString cat { "CSwiftCore" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! VATSIM specific
|
||||
static const QString &vatsimSpecific()
|
||||
{
|
||||
static const QString cat { "swift.vatsim" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Network specific, but not necessarily one specific flight network
|
||||
static const QString &network()
|
||||
{
|
||||
static const QString cat { "swift.network" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! FSD specific
|
||||
static const QString &fsd()
|
||||
{
|
||||
static const QString cat { "swift.fsd" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Aviation specific
|
||||
static const QString &aviation()
|
||||
{
|
||||
static const QString cat { "swift.aviation" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! All predefined special categories
|
||||
//! \note Human readable patterns are defined in CLogPattern::allHumanReadablePatterns
|
||||
static const QStringList &allSpecialCategories()
|
||||
{
|
||||
static const QStringList cats
|
||||
{
|
||||
uncategorized(),
|
||||
aviation(),
|
||||
audio(),
|
||||
cache(),
|
||||
cmdLine(),
|
||||
context(),
|
||||
contextSlot(),
|
||||
dbus(),
|
||||
dataInconsistency(),
|
||||
download(),
|
||||
driver(),
|
||||
flightPlan(),
|
||||
fsd(),
|
||||
guiComponent(),
|
||||
interpolator(),
|
||||
json(),
|
||||
mapping(),
|
||||
matching(),
|
||||
modelLoader(),
|
||||
modelCache(),
|
||||
modelSetCache(),
|
||||
modelGui(),
|
||||
network(),
|
||||
plugin(),
|
||||
swiftDbWebservice(),
|
||||
swiftCore(),
|
||||
swiftDataTool(),
|
||||
swiftPilotClient(),
|
||||
services(),
|
||||
settings(),
|
||||
startup(),
|
||||
validation(),
|
||||
vatsimSpecific(),
|
||||
verification(),
|
||||
webservice(),
|
||||
wizard(),
|
||||
worker()
|
||||
};
|
||||
return cats;
|
||||
}
|
||||
};
|
||||
} // ns
|
||||
|
||||
#endif
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "blackmisc/metaclass.h"
|
||||
#include "blackmisc/valueobject.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "blackmisc/logcategories.h"
|
||||
|
||||
#include <QList>
|
||||
#include <QMetaType>
|
||||
@@ -25,321 +26,11 @@ namespace BlackMisc
|
||||
* A log category is an arbitrary string tag which can be attached to log messages.
|
||||
*
|
||||
* A log handler can filter messages based on their categories.
|
||||
* \see CLogCategories
|
||||
*/
|
||||
class BLACKMISC_EXPORT CLogCategory : public CValueObject<CLogCategory>
|
||||
{
|
||||
public:
|
||||
//! \name Predefined special categories (public static methods)
|
||||
//! @{
|
||||
|
||||
//! Uncategorized
|
||||
static const CLogCategory &uncategorized()
|
||||
{
|
||||
static const CLogCategory cat { "swift.uncategorized" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Verification
|
||||
static const CLogCategory &verification()
|
||||
{
|
||||
static const CLogCategory cat { "swift.verification" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Validation
|
||||
static const CLogCategory &validation()
|
||||
{
|
||||
static const CLogCategory cat { "swift.validation" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Core/base services such as caching etc.
|
||||
static const CLogCategory &services()
|
||||
{
|
||||
static const CLogCategory cat { "swift.services" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Audio related
|
||||
static const CLogCategory &audio()
|
||||
{
|
||||
static const CLogCategory cat { "swift.audio" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! DBus related
|
||||
static const CLogCategory &dbus()
|
||||
{
|
||||
static const CLogCategory cat { "swift.dbus" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Contexts
|
||||
static const CLogCategory &context()
|
||||
{
|
||||
static const CLogCategory cat { "swift.context" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Interpolator
|
||||
static const CLogCategory &interpolator()
|
||||
{
|
||||
static const CLogCategory cat { "swift.interpolator" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Flight plan
|
||||
static const CLogCategory &flightPlan()
|
||||
{
|
||||
static const CLogCategory cat { "swift.flightplan" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Context slots
|
||||
static const CLogCategory &contextSlot()
|
||||
{
|
||||
static const CLogCategory cat { "swift.context.slot" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! GUI components
|
||||
static const CLogCategory &guiComponent()
|
||||
{
|
||||
static const CLogCategory cat { "swift.gui.component" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Generic downloads
|
||||
static const CLogCategory &download()
|
||||
{
|
||||
static const CLogCategory cat { "swift.download" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Webservice
|
||||
static const CLogCategory &webservice()
|
||||
{
|
||||
static const CLogCategory cat { "swift.webservice" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Mapping
|
||||
static const CLogCategory &mapping()
|
||||
{
|
||||
static const CLogCategory cat { "swift.mapping" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Matching
|
||||
static const CLogCategory &matching()
|
||||
{
|
||||
static const CLogCategory cat { "swift.matching" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Settings
|
||||
static const CLogCategory &settings()
|
||||
{
|
||||
static const CLogCategory cat { "swift.settings" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Cache
|
||||
static const CLogCategory &cache()
|
||||
{
|
||||
static const CLogCategory cat { "swift.cache" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Cmd.line parsing
|
||||
static const CLogCategory &cmdLine()
|
||||
{
|
||||
static const CLogCategory cat { "swift.cmdLine" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Driver
|
||||
static const CLogCategory &driver()
|
||||
{
|
||||
static const CLogCategory cat { "swift.driver" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Model loader
|
||||
static const CLogCategory &modelLoader()
|
||||
{
|
||||
static const CLogCategory cat { "swift.modelloader" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Model cache
|
||||
static const CLogCategory &modelCache()
|
||||
{
|
||||
static const CLogCategory cat { "swift.modelcache" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Model set cache
|
||||
static const CLogCategory &modelSetCache()
|
||||
{
|
||||
static const CLogCategory cat { "swift.modelsetcache" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Model UI
|
||||
static const CLogCategory &modelGui()
|
||||
{
|
||||
static const CLogCategory cat { "swift.modelui" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Plugin
|
||||
static const CLogCategory &plugin()
|
||||
{
|
||||
static const CLogCategory cat { "swift.plugin" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Wizard
|
||||
static const CLogCategory &wizard()
|
||||
{
|
||||
static const CLogCategory cat { "swift.wizard" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Background task
|
||||
static const CLogCategory &worker()
|
||||
{
|
||||
static const CLogCategory cat { "swift.worker" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Data inconsistency
|
||||
static const CLogCategory &dataInconsistency()
|
||||
{
|
||||
static const CLogCategory cat { "swift.datainconsistency" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! JSON and JSON conversions
|
||||
static const CLogCategory &json()
|
||||
{
|
||||
static const CLogCategory cat { "swift.json" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Startup of application
|
||||
static const CLogCategory &startup()
|
||||
{
|
||||
static const CLogCategory cat { "swift.startup" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Webservice with swift DB
|
||||
static const CLogCategory &swiftDbWebservice()
|
||||
{
|
||||
static const CLogCategory cat { "swift.db.webservice" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! swift GUI
|
||||
static const CLogCategory &swiftPilotClient()
|
||||
{
|
||||
static const CLogCategory cat { "SwiftGuiStd" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! swift data tool (aka mapping tool)
|
||||
static const CLogCategory &swiftDataTool()
|
||||
{
|
||||
static const CLogCategory cat { "CSwiftData" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! swift core
|
||||
static const CLogCategory &swiftCore()
|
||||
{
|
||||
static const CLogCategory cat { "CSwiftCore" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! VATSIM specific
|
||||
static const CLogCategory &vatsimSpecific()
|
||||
{
|
||||
static const CLogCategory cat { "swift.vatsim" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Network specific, but not necessarily one specific flight network
|
||||
static const CLogCategory &network()
|
||||
{
|
||||
static const CLogCategory cat { "swift.network" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! FSD specific
|
||||
static const CLogCategory &fsd()
|
||||
{
|
||||
static const CLogCategory cat { "swift.fsd" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! Aviation specific
|
||||
static const CLogCategory &aviation()
|
||||
{
|
||||
static const CLogCategory cat { "swift.aviation" };
|
||||
return cat;
|
||||
}
|
||||
|
||||
//! All predefined special categories
|
||||
//! \note Human readable patterns are defined in CLogPattern::allHumanReadablePatterns
|
||||
static const QList<CLogCategory> &allSpecialCategories()
|
||||
{
|
||||
static const QList<CLogCategory> cats
|
||||
{
|
||||
uncategorized(),
|
||||
aviation(),
|
||||
audio(),
|
||||
cache(),
|
||||
cmdLine(),
|
||||
context(),
|
||||
contextSlot(),
|
||||
dbus(),
|
||||
dataInconsistency(),
|
||||
download(),
|
||||
driver(),
|
||||
flightPlan(),
|
||||
fsd(),
|
||||
guiComponent(),
|
||||
interpolator(),
|
||||
json(),
|
||||
mapping(),
|
||||
matching(),
|
||||
modelLoader(),
|
||||
modelCache(),
|
||||
modelSetCache(),
|
||||
modelGui(),
|
||||
network(),
|
||||
plugin(),
|
||||
swiftDbWebservice(),
|
||||
swiftCore(),
|
||||
swiftDataTool(),
|
||||
swiftPilotClient(),
|
||||
services(),
|
||||
settings(),
|
||||
startup(),
|
||||
validation(),
|
||||
vatsimSpecific(),
|
||||
verification(),
|
||||
webservice(),
|
||||
wizard(),
|
||||
worker()
|
||||
};
|
||||
return cats;
|
||||
}
|
||||
|
||||
//! @}
|
||||
|
||||
//! Constructor.
|
||||
CLogCategory() = default;
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace BlackMisc
|
||||
CLogCategoryList with(const CLogCategoryList &other) const { auto copy = *this; copy.push_back(other); return copy; }
|
||||
|
||||
//! Return a copy with validation category appended.
|
||||
CLogCategoryList withValidation() const { return with(CLogCategory::validation()); }
|
||||
CLogCategoryList withValidation() const { return with(CLogCategories::validation()); }
|
||||
|
||||
//! Convert each of the categories to a QString and return the result as a QStringList.
|
||||
QStringList toQStringList() const;
|
||||
@@ -118,14 +118,14 @@ namespace BlackMisc
|
||||
list.appendCategoriesFromMemberFunction(tag<T>(), THasGetLogCategories<T>());
|
||||
list.appendCategoriesFromMetaType(tag<T>(), std::integral_constant<bool, QMetaTypeId<T>::Defined>());
|
||||
list.appendCategoriesFromMetaObject(tag<T>(), std::is_base_of<QObject, T>());
|
||||
if (list.isEmpty()) { list.push_back(CLogCategory::uncategorized()); }
|
||||
if (list.isEmpty()) { list.push_back(CLogCategories::uncategorized()); }
|
||||
return list;
|
||||
}();
|
||||
return list;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void appendCategoriesFromMemberFunction(tag<T>, std::true_type) { push_back(T::getLogCategories()); }
|
||||
void appendCategoriesFromMemberFunction(tag<T>, std::true_type) { push_back(fromQStringList(T::getLogCategories())); }
|
||||
void appendCategoriesFromMemberFunction(...) {}
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace BlackMisc
|
||||
//! \warning This must only be called from the main thread.
|
||||
CLogPatternHandler *handlerForValidation()
|
||||
{
|
||||
return handlerForPattern(CLogPattern::exactMatch(CLogCategory::validation()).withSeverityAtOrAbove(CStatusMessage::SeverityWarning));
|
||||
return handlerForPattern(CLogPattern::exactMatch(CLogCategories::validation()).withSeverityAtOrAbove(CStatusMessage::SeverityWarning));
|
||||
}
|
||||
|
||||
//! Returns all log patterns for which there are currently subscribed log pattern handlers.
|
||||
|
||||
@@ -23,41 +23,41 @@ namespace BlackMisc
|
||||
{
|
||||
static const QHash<QString, CLogPattern> patterns
|
||||
{
|
||||
{ "uncategorized (swift)", exactMatch(CLogCategory::uncategorized()) },
|
||||
{ "background task", exactMatch(CLogCategory::worker()) },
|
||||
{ "cache", exactMatch(CLogCategory::cache()) },
|
||||
{ "cmd.line handling", exactMatch(CLogCategory::cmdLine()) },
|
||||
{ "data inconsistency", exactMatch(CLogCategory::dataInconsistency()) },
|
||||
{ "DBus", exactMatch(CLogCategory::dbus()) },
|
||||
{ "downloading data", exactMatch(CLogCategory::download()) },
|
||||
{ "driver", exactMatch(CLogCategory::driver()) },
|
||||
{ "flight plan", exactMatch(CLogCategory::flightPlan()) },
|
||||
{ "FSD", exactMatch(CLogCategory::fsd()) },
|
||||
{ "interpolator", exactMatch(CLogCategory::interpolator()) },
|
||||
{ "JSON (conversion)", exactMatch(CLogCategory::json()) },
|
||||
{ "model cache", exactMatch(CLogCategory::modelCache()) },
|
||||
{ "model GUI", exactMatch(CLogCategory::modelGui()) },
|
||||
{ "model loader", exactMatch(CLogCategory::modelLoader()) },
|
||||
{ "model mapping", exactMatch(CLogCategory::mapping()) },
|
||||
{ "model matching", exactMatch(CLogCategory::matching()) },
|
||||
{ "model set cache", exactMatch(CLogCategory::modelSetCache()) },
|
||||
{ "network (flight)", exactMatch(CLogCategory::network()) },
|
||||
{ "plugin", exactMatch(CLogCategory::plugin()) },
|
||||
{ "services", exactMatch(CLogCategory::services()) },
|
||||
{ "settings", exactMatch(CLogCategory::settings()) },
|
||||
{ "startup phase", exactMatch(CLogCategory::startup()) },
|
||||
{ "swift context slots", exactMatch(CLogCategory::contextSlot()) },
|
||||
{ "swift contexts", exactMatch(CLogCategory::context()) },
|
||||
{ "swift core", exactMatch(CLogCategory::swiftCore()) },
|
||||
{ "swift data tool", exactMatch(CLogCategory::swiftDataTool()) },
|
||||
{ "swift DB webservice related", exactMatch(CLogCategory::swiftDbWebservice()) },
|
||||
{ "swift GUI", exactMatch(CLogCategory::guiComponent()) },
|
||||
{ "swift pilot client", exactMatch(CLogCategory::swiftPilotClient()) },
|
||||
{ "validation", exactMatch(CLogCategory::validation()) },
|
||||
{ "VATSIM specific", exactMatch(CLogCategory::vatsimSpecific()) },
|
||||
{ "verification", exactMatch(CLogCategory::verification()) },
|
||||
{ "webservice related", exactMatch(CLogCategory::webservice()) },
|
||||
{ "wizard", exactMatch(CLogCategory::wizard()) },
|
||||
{ "uncategorized (swift)", exactMatch(CLogCategories::uncategorized()) },
|
||||
{ "background task", exactMatch(CLogCategories::worker()) },
|
||||
{ "cache", exactMatch(CLogCategories::cache()) },
|
||||
{ "cmd.line handling", exactMatch(CLogCategories::cmdLine()) },
|
||||
{ "data inconsistency", exactMatch(CLogCategories::dataInconsistency()) },
|
||||
{ "DBus", exactMatch(CLogCategories::dbus()) },
|
||||
{ "downloading data", exactMatch(CLogCategories::download()) },
|
||||
{ "driver", exactMatch(CLogCategories::driver()) },
|
||||
{ "flight plan", exactMatch(CLogCategories::flightPlan()) },
|
||||
{ "FSD", exactMatch(CLogCategories::fsd()) },
|
||||
{ "interpolator", exactMatch(CLogCategories::interpolator()) },
|
||||
{ "JSON (conversion)", exactMatch(CLogCategories::json()) },
|
||||
{ "model cache", exactMatch(CLogCategories::modelCache()) },
|
||||
{ "model GUI", exactMatch(CLogCategories::modelGui()) },
|
||||
{ "model loader", exactMatch(CLogCategories::modelLoader()) },
|
||||
{ "model mapping", exactMatch(CLogCategories::mapping()) },
|
||||
{ "model matching", exactMatch(CLogCategories::matching()) },
|
||||
{ "model set cache", exactMatch(CLogCategories::modelSetCache()) },
|
||||
{ "network (flight)", exactMatch(CLogCategories::network()) },
|
||||
{ "plugin", exactMatch(CLogCategories::plugin()) },
|
||||
{ "services", exactMatch(CLogCategories::services()) },
|
||||
{ "settings", exactMatch(CLogCategories::settings()) },
|
||||
{ "startup phase", exactMatch(CLogCategories::startup()) },
|
||||
{ "swift context slots", exactMatch(CLogCategories::contextSlot()) },
|
||||
{ "swift contexts", exactMatch(CLogCategories::context()) },
|
||||
{ "swift core", exactMatch(CLogCategories::swiftCore()) },
|
||||
{ "swift data tool", exactMatch(CLogCategories::swiftDataTool()) },
|
||||
{ "swift DB webservice related", exactMatch(CLogCategories::swiftDbWebservice()) },
|
||||
{ "swift GUI", exactMatch(CLogCategories::guiComponent()) },
|
||||
{ "swift pilot client", exactMatch(CLogCategories::swiftPilotClient()) },
|
||||
{ "validation", exactMatch(CLogCategories::validation()) },
|
||||
{ "VATSIM specific", exactMatch(CLogCategories::vatsimSpecific()) },
|
||||
{ "verification", exactMatch(CLogCategories::verification()) },
|
||||
{ "webservice related", exactMatch(CLogCategories::webservice()) },
|
||||
{ "wizard", exactMatch(CLogCategories::wizard()) },
|
||||
{ "Qt library", startsWith("qt.") },
|
||||
{ "uncategorized (default)", exactMatch("default") },
|
||||
{ "uncategorized (none)", empty() }
|
||||
|
||||
@@ -402,7 +402,7 @@ namespace BlackMisc
|
||||
|
||||
CStatusMessageList CNetworkUtils::createNetworkReport(const CUrl &url, const QNetworkAccessManager *qam)
|
||||
{
|
||||
static const CLogCategoryList cats({CLogCategory::network()});
|
||||
static const CLogCategoryList cats({CLogCategories::network()});
|
||||
CStatusMessageList msgs;
|
||||
|
||||
if (!url.isEmpty())
|
||||
|
||||
@@ -844,12 +844,12 @@ namespace BlackMisc
|
||||
{
|
||||
if (same)
|
||||
{
|
||||
static const CStatusMessage msgSame({ CLogCategory::validation() }, CStatusMessage::SeverityWarning, u"Model '%1' same %2 '%3'");
|
||||
static const CStatusMessage msgSame({ CLogCategories::validation() }, CStatusMessage::SeverityWarning, u"Model '%1' same %2 '%3'");
|
||||
return CStatusMessage(msgSame) << model.getModelStringAndDbKey() << description << newValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
static const CStatusMessage msgDiff({ CLogCategory::validation() }, CStatusMessage::SeverityInfo, u"Model '%1' changed %2 '%3'->'%4'");
|
||||
static const CStatusMessage msgDiff({ CLogCategories::validation() }, CStatusMessage::SeverityInfo, u"Model '%1' changed %2 '%3'->'%4'");
|
||||
return CStatusMessage(msgDiff) << model.getModelStringAndDbKey() << description << oldValue << newValue;
|
||||
}
|
||||
}
|
||||
@@ -858,7 +858,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (!dbModel.isLoadedFromDb())
|
||||
{
|
||||
static const CStatusMessage msgNoDbModel({ CLogCategory::validation() }, CStatusMessage::SeverityInfo, u"No DB model yet");
|
||||
static const CStatusMessage msgNoDbModel({ CLogCategories::validation() }, CStatusMessage::SeverityInfo, u"No DB model yet");
|
||||
if (details) { details->push_back(msgNoDbModel); }
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
const CLogCategoryList &IAircraftModelLoader::getLogCategories()
|
||||
const QStringList &IAircraftModelLoader::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats({ CLogCategory::modelLoader() });
|
||||
static const QStringList cats({ CLogCategories::modelLoader() });
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace BlackMisc
|
||||
|
||||
public:
|
||||
//! Log categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Parser mode
|
||||
enum LoadModeFlag
|
||||
|
||||
@@ -144,27 +144,28 @@ namespace BlackMisc
|
||||
CStatusMessageList CAircraftModelUtilities::validateModelFiles(const CSimulatorInfo &simulator, const CAircraftModelList &models, CAircraftModelList &validModels, CAircraftModelList &invalidModels, bool ignoreEmpty, int stopAtFailedFiles, std::atomic_bool &wasStopped, const QString &simulatorDir)
|
||||
{
|
||||
// some generic tests
|
||||
CLogCategoryList cats = { CLogCategories::matching() };
|
||||
CStatusMessageList msgs;
|
||||
if (models.isEmpty())
|
||||
{
|
||||
msgs.push_back(CStatusMessage(CLogCategory::matching(), CStatusMessage::SeverityError, u"No models", true));
|
||||
msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, u"No models", true));
|
||||
return msgs;
|
||||
}
|
||||
|
||||
const int noDb = models.size() - models.countWithValidDbKey();
|
||||
if (noDb > 0)
|
||||
{
|
||||
msgs.push_back(CStatusMessage(CLogCategory::matching(), CStatusMessage::SeverityWarning, QStringLiteral("%1 models without DB data, is this intended?").arg(noDb), true));
|
||||
msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityWarning, QStringLiteral("%1 models without DB data, is this intended?").arg(noDb), true));
|
||||
const QString ms = models.findWithoutValidDbKey(5).getModelStringList().join(", ");
|
||||
msgs.push_back(CStatusMessage(CLogCategory::matching(), CStatusMessage::SeverityWarning, QStringLiteral("Some of the non DB models are: '%1'").arg(ms), true));
|
||||
msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityWarning, QStringLiteral("Some of the non DB models are: '%1'").arg(ms), true));
|
||||
}
|
||||
|
||||
const int noExcluded = models.countByMode(CAircraftModel::Exclude);
|
||||
if (noExcluded > 0)
|
||||
{
|
||||
msgs.push_back(CStatusMessage(CLogCategory::matching(), CStatusMessage::SeverityWarning, QStringLiteral("%1 models marked as excluded, is this intended?").arg(noExcluded), true));
|
||||
msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityWarning, QStringLiteral("%1 models marked as excluded, is this intended?").arg(noExcluded), true));
|
||||
const QString ms = models.findAllExcludedModels(5).getModelStringList().join(", ");
|
||||
msgs.push_back(CStatusMessage(CLogCategory::matching(), CStatusMessage::SeverityWarning, QStringLiteral("Some of the excluded models are: '%1'").arg(ms), true));
|
||||
msgs.push_back(CStatusMessage(cats, CStatusMessage::SeverityWarning, QStringLiteral("Some of the excluded models are: '%1'").arg(ms), true));
|
||||
}
|
||||
|
||||
// specific checks for FSX/XPlane/FG
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace BlackMisc
|
||||
|
||||
CStatusMessageList CAutoPublishData::analyzeAgainstDBData(const CAircraftModelList &dbModels)
|
||||
{
|
||||
static const CLogCategoryList cats({ CLogCategory::mapping(), CLogCategory::webservice() });
|
||||
static const CLogCategoryList cats({ CLogCategories::mapping(), CLogCategories::webservice() });
|
||||
if (dbModels.isEmpty()) { return CStatusMessage(this).validationError(u"No DB data"); }
|
||||
if (this->isEmpty()) { return CStatusMessage(this).validationWarning(u"No data"); }
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
const CLogCategoryList &CBackgroundValidation::getLogCategories()
|
||||
const QStringList &CBackgroundValidation::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats({ CLogCategory::worker(), CLogCategory::modelSetCache() });
|
||||
static const QStringList cats({ CLogCategories::worker(), CLogCategories::modelSetCache() });
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace BlackMisc
|
||||
|
||||
public:
|
||||
//! Log categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Constructor
|
||||
CBackgroundValidation(QObject *owner);
|
||||
|
||||
@@ -20,9 +20,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
const CLogCategoryList &CCategoryMatcher::getLogCategories()
|
||||
const QStringList &CCategoryMatcher::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats { CLogCategory::matching() };
|
||||
static const QStringList cats { CLogCategories::matching() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
//! Log categories
|
||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Constructor
|
||||
CCategoryMatcher() {}
|
||||
|
||||
@@ -192,9 +192,9 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
const CLogCategoryList &CModelCaches::getLogCategories()
|
||||
const QStringList &CModelCaches::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList l({ CLogCategory::modelCache() });
|
||||
static const QStringList l({ CLogCategories::modelCache() });
|
||||
return l;
|
||||
}
|
||||
|
||||
@@ -411,9 +411,9 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
const CLogCategoryList &CModelSetCaches::getLogCategories()
|
||||
const QStringList &CModelSetCaches::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList l({ CLogCategory::modelSetCache() });
|
||||
static const QStringList l({ CLogCategories::modelSetCache() });
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ namespace BlackMisc
|
||||
CModelCaches(bool synchronizeCache, QObject *parent = nullptr);
|
||||
|
||||
//! Log categories
|
||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! \name Interface implementations
|
||||
//! @{
|
||||
@@ -361,7 +361,7 @@ namespace BlackMisc
|
||||
CModelSetCaches(bool synchronizeCache, QObject *parent = nullptr);
|
||||
|
||||
//! Log categories
|
||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! \name Interface implementations
|
||||
//! @{
|
||||
|
||||
@@ -39,9 +39,9 @@ namespace BlackMisc
|
||||
{
|
||||
using FsRegistryPathPair = QList<QPair<QString, QString>>;
|
||||
|
||||
const CLogCategoryList &CFsCommonUtil::getLogCategories()
|
||||
const QStringList &CFsCommonUtil::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats({ CLogCategory::validation(), CLogCategory::driver() });
|
||||
static const QStringList cats({ CLogCategories::validation(), CLogCategories::driver() });
|
||||
return cats;
|
||||
}
|
||||
|
||||
@@ -421,13 +421,13 @@ namespace BlackMisc
|
||||
messages.clear();
|
||||
if (!CDirectoryUtils::existsUnemptyDirectory(CSwiftDirectories::shareTerrainProbeDirectory()))
|
||||
{
|
||||
messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, u"No terrain probe source files in '%1'") << CSwiftDirectories::shareTerrainProbeDirectory());
|
||||
messages.push_back(CStatusMessage(static_cast<CFsCommonUtil *>(nullptr), CStatusMessage::SeverityError, u"No terrain probe source files in '%1'") << CSwiftDirectories::shareTerrainProbeDirectory());
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (simObjectDir.isEmpty())
|
||||
{
|
||||
messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, u"No simObject directory"));
|
||||
messages.push_back(CStatusMessage(static_cast<CFsCommonUtil *>(nullptr), CStatusMessage::SeverityError, u"No simObject directory"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ namespace BlackMisc
|
||||
const QDir td(targetDir);
|
||||
if (!td.exists())
|
||||
{
|
||||
messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, u"Cannot access target directory '%1'") << targetDir);
|
||||
messages.push_back(CStatusMessage(static_cast<CFsCommonUtil *>(nullptr), CStatusMessage::SeverityError, u"Cannot access target directory '%1'") << targetDir);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -444,12 +444,12 @@ namespace BlackMisc
|
||||
const bool hasDir = td.mkpath(targetDir);
|
||||
if (!hasDir)
|
||||
{
|
||||
messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, u"Cannot create target directory '%1'") << targetDir);
|
||||
messages.push_back(CStatusMessage(static_cast<CFsCommonUtil *>(nullptr), CStatusMessage::SeverityError, u"Cannot create target directory '%1'") << targetDir);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const int copied = CDirectoryUtils::copyDirectoryRecursively(CSwiftDirectories::shareTerrainProbeDirectory(), targetDir, true);
|
||||
messages.push_back(CStatusMessage(getLogCategories(), CStatusMessage::SeverityInfo, u"Copied %1 files from '%2' to '%3'") << copied << CSwiftDirectories::shareTerrainProbeDirectory() << targetDir);
|
||||
messages.push_back(CStatusMessage(static_cast<CFsCommonUtil *>(nullptr), CStatusMessage::SeverityInfo, u"Copied %1 files from '%2' to '%3'") << copied << CSwiftDirectories::shareTerrainProbeDirectory() << targetDir);
|
||||
return copied;
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ namespace BlackMisc
|
||||
const QString pathUp = CFileUtils::appendFilePaths(CFileUtils::pathUp(path), "Lockheed Martin");
|
||||
const QDir d(pathUp);
|
||||
if (!d.exists()) { continue; }
|
||||
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"P3D config dir: '%1'") << d.absolutePath(); }
|
||||
if (logConfigPathReading()) { CLogMessage(static_cast<CFsCommonUtil *>(nullptr)).info(u"P3D config dir: '%1'") << d.absolutePath(); }
|
||||
|
||||
// all versions sub directories
|
||||
// looking for "add-ons.cfg" or simobjects.cfg
|
||||
@@ -490,7 +490,7 @@ namespace BlackMisc
|
||||
if (fi.exists())
|
||||
{
|
||||
files.insert(f);
|
||||
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"P3D config file: '%1'") << f; }
|
||||
if (logConfigPathReading()) { CLogMessage(static_cast<CFsCommonUtil *>(nullptr)).info(u"P3D config file: '%1'") << f; }
|
||||
}
|
||||
} // contains
|
||||
} // entries
|
||||
@@ -531,7 +531,7 @@ namespace BlackMisc
|
||||
QDomDocument doc;
|
||||
QFile file(filename);
|
||||
if (!file.open(QIODevice::ReadOnly) || !doc.setContent(&file)) { continue; }
|
||||
if (CFsCommonUtil::logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"Reading '%1' from addon path: '%2'") << file.fileName() << addOnPath; }
|
||||
if (CFsCommonUtil::logConfigPathReading()) { CLogMessage(static_cast<CFsCommonUtil *>(nullptr)).info(u"Reading '%1' from addon path: '%2'") << file.fileName() << addOnPath; }
|
||||
|
||||
const QDomNodeList components = doc.elementsByTagName("AddOn.Component");
|
||||
for (int i = 0; i < components.size(); i++)
|
||||
@@ -550,11 +550,11 @@ namespace BlackMisc
|
||||
const QString fp = pathValue.left(3).contains(':') ?
|
||||
pathValue :
|
||||
CFileUtils::appendFilePaths(addOnPath, pathValue);
|
||||
if (CFsCommonUtil::logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"Testing '%1' as addon path: '%2'") << fp << addOnPath; }
|
||||
if (CFsCommonUtil::logConfigPathReading()) { CLogMessage(static_cast<CFsCommonUtil *>(nullptr)).info(u"Testing '%1' as addon path: '%2'") << fp << addOnPath; }
|
||||
if (!checked || QDir(fp).exists())
|
||||
{
|
||||
simObjectPaths.insert(CFileUtils::normalizeFilePathToQtStandard(fp));
|
||||
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"P3D SimObjects path: '%1'") << fp; }
|
||||
if (logConfigPathReading()) { CLogMessage(static_cast<CFsCommonUtil *>(nullptr)).info(u"P3D SimObjects path: '%1'") << fp; }
|
||||
}
|
||||
} // components
|
||||
} // paths
|
||||
@@ -591,7 +591,7 @@ namespace BlackMisc
|
||||
if (fi.exists())
|
||||
{
|
||||
files.push_back(fi.absoluteFilePath());
|
||||
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"FSX config file: '%1'") << fi.absoluteFilePath(); }
|
||||
if (logConfigPathReading()) { CLogMessage(static_cast<CFsCommonUtil *>(nullptr)).info(u"FSX config file: '%1'") << fi.absoluteFilePath(); }
|
||||
}
|
||||
}
|
||||
return files;
|
||||
@@ -626,7 +626,7 @@ namespace BlackMisc
|
||||
if (i2 < 0 || i1 >= i2 || line.endsWith('=')) { continue; }
|
||||
const QStringRef path = line.mid(i2 + 1);
|
||||
QString soPath = QDir::fromNativeSeparators(path.toString());
|
||||
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"FSX SimObjects path checked: '%1' in '%2'") << line << fsxFile; }
|
||||
if (logConfigPathReading()) { CLogMessage(static_cast<CFsCommonUtil *>(nullptr)).info(u"FSX SimObjects path checked: '%1' in '%2'") << line << fsxFile; }
|
||||
|
||||
// ignore exclude patterns
|
||||
if (containsAny(soPath, CFsCommonUtil::fsxSimObjectsExcludeDirectoryPatterns(), Qt::CaseInsensitive)) { continue; }
|
||||
@@ -638,19 +638,19 @@ namespace BlackMisc
|
||||
if (checked && !dir.exists())
|
||||
{
|
||||
// skip, not existing
|
||||
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"FSX SimObjects path skipped, not existing: '%1' in '%2'") << dir.absolutePath() << fsxFile; }
|
||||
if (logConfigPathReading()) { CLogMessage(static_cast<CFsCommonUtil *>(nullptr)).info(u"FSX SimObjects path skipped, not existing: '%1' in '%2'") << dir.absolutePath() << fsxFile; }
|
||||
continue;
|
||||
}
|
||||
|
||||
const QString afp = dir.absolutePath().toLower();
|
||||
if (!CDirectoryUtils::containsFileInDir(afp, airFileFilter(), true))
|
||||
{
|
||||
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"FSX SimObjects path: Skipping '%1' from '%2', no '%3' file") << afp << fsxFile << airFileFilter(); }
|
||||
if (logConfigPathReading()) { CLogMessage(static_cast<CFsCommonUtil *>(nullptr)).info(u"FSX SimObjects path: Skipping '%1' from '%2', no '%3' file") << afp << fsxFile << airFileFilter(); }
|
||||
continue;
|
||||
}
|
||||
|
||||
paths.insert(afp);
|
||||
if (logConfigPathReading()) { CLogMessage(getLogCategories()).info(u"FSX SimObjects path: '%1' from '%2'") << afp << fsxFile; }
|
||||
if (logConfigPathReading()) { CLogMessage(static_cast<CFsCommonUtil *>(nullptr)).info(u"FSX SimObjects path: '%1' from '%2'") << afp << fsxFile; }
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
@@ -669,13 +669,13 @@ namespace BlackMisc
|
||||
{
|
||||
for (const CAircraftModel &model : nonFsModels)
|
||||
{
|
||||
m = CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, QStringLiteral("Removed '%1' non FS family model").arg(model.getModelStringAndDbKey()), true);
|
||||
m = CStatusMessage(static_cast<CFsCommonUtil *>(nullptr), CStatusMessage::SeverityError, QStringLiteral("Removed '%1' non FS family model").arg(model.getModelStringAndDbKey()), true);
|
||||
msgs.push_back(m);
|
||||
if (wasStopped) { break; } // allow to break from "outside"
|
||||
}
|
||||
|
||||
const int d = validModels.removeIfNotFsFamily();
|
||||
m = CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, QStringLiteral("Removed %1 non FS family models").arg(d), true);
|
||||
m = CStatusMessage(static_cast<CFsCommonUtil *>(nullptr), CStatusMessage::SeverityError, QStringLiteral("Removed %1 non FS family models").arg(d), true);
|
||||
msgs.push_back(m);
|
||||
}
|
||||
|
||||
@@ -692,7 +692,7 @@ namespace BlackMisc
|
||||
for (const CAircraftModel &removedModel : removedModels)
|
||||
{
|
||||
removedCfgEntries++;
|
||||
m = CStatusMessage(getLogCategories(), CStatusMessage::SeverityError, QStringLiteral("'%1' removed because no longer in '%2'").arg(removedModel.getModelStringAndDbKey(), removedModel.getFileName()), true);
|
||||
m = CStatusMessage(static_cast<CFsCommonUtil *>(nullptr), CStatusMessage::SeverityError, QStringLiteral("'%1' removed because no longer in '%2'").arg(removedModel.getModelStringAndDbKey(), removedModel.getFileName()), true);
|
||||
msgs.push_back(m);
|
||||
CAircraftModelList::addAsValidOrInvalidModel(removedModel, false, validModels, invalidModels);
|
||||
}
|
||||
@@ -700,18 +700,18 @@ namespace BlackMisc
|
||||
|
||||
if (removedCfgEntries < 1)
|
||||
{
|
||||
m = CStatusMessage(getLogCategories(), CStatusMessage::SeverityInfo, QStringLiteral("Not removed any models, all OK!"), true);
|
||||
m = CStatusMessage(static_cast<CFsCommonUtil *>(nullptr), CStatusMessage::SeverityInfo, QStringLiteral("Not removed any models, all OK!"), true);
|
||||
msgs.push_back(m);
|
||||
}
|
||||
|
||||
if (!validModels.isEmpty())
|
||||
{
|
||||
m = CStatusMessage(getLogCategories(), CStatusMessage::SeverityInfo, QStringLiteral("cfg validation, valid models: %1").arg(validModels.size()), true);
|
||||
m = CStatusMessage(static_cast<CFsCommonUtil *>(nullptr), CStatusMessage::SeverityInfo, QStringLiteral("cfg validation, valid models: %1").arg(validModels.size()), true);
|
||||
msgs.push_back(m);
|
||||
}
|
||||
if (!invalidModels.isEmpty())
|
||||
{
|
||||
m = CStatusMessage(getLogCategories(), CStatusMessage::SeverityWarning, QStringLiteral("cfg validation, invalid models: %1").arg(invalidModels.size()), true);
|
||||
m = CStatusMessage(static_cast<CFsCommonUtil *>(nullptr), CStatusMessage::SeverityWarning, QStringLiteral("cfg validation, invalid models: %1").arg(invalidModels.size()), true);
|
||||
msgs.push_back(m);
|
||||
}
|
||||
|
||||
@@ -747,7 +747,7 @@ namespace BlackMisc
|
||||
CStatusMessageList msgs;
|
||||
if (simObjectDirs.isEmpty())
|
||||
{
|
||||
msgs.push_back(CStatusMessage(getLogCategories()).validationInfo(u"No SimObject directories from cfg files, skipping validation"));
|
||||
msgs.push_back(CStatusMessage(static_cast<CFsCommonUtil *>(nullptr)).validationInfo(u"No SimObject directories from cfg files, skipping validation"));
|
||||
return msgs;
|
||||
}
|
||||
|
||||
@@ -755,13 +755,13 @@ namespace BlackMisc
|
||||
sortedModels.sortByFileName();
|
||||
if (sortedModels.isEmpty())
|
||||
{
|
||||
msgs.push_back(CStatusMessage(getLogCategories()).validationInfo(u"No models to validate"));
|
||||
msgs.push_back(CStatusMessage(static_cast<CFsCommonUtil *>(nullptr)).validationInfo(u"No models to validate"));
|
||||
return msgs;
|
||||
}
|
||||
|
||||
// info
|
||||
const QString simObjDirs = joinStringSet(simObjectDirs, ", ");
|
||||
msgs.push_back(CStatusMessage(getLogCategories()).validationInfo(u"Validating %1 models against %2 SimObjects path(s): '%3'") << models.size() << simObjectDirs.size() << simObjDirs);
|
||||
msgs.push_back(CStatusMessage(static_cast<CFsCommonUtil *>(nullptr)).validationInfo(u"Validating %1 models against %2 SimObjects path(s): '%3'") << models.size() << simObjectDirs.size() << simObjDirs);
|
||||
|
||||
// validate
|
||||
int failed = 0;
|
||||
@@ -770,7 +770,7 @@ namespace BlackMisc
|
||||
if (!model.hasFileName())
|
||||
{
|
||||
if (ignoreEmptyFileNames) { continue; }
|
||||
msgs.push_back(CStatusMessage(getLogCategories()).validationWarning(u"No file name for model '%1'") << model.getModelString());
|
||||
msgs.push_back(CStatusMessage(static_cast<CFsCommonUtil *>(nullptr)).validationWarning(u"No file name for model '%1'") << model.getModelString());
|
||||
CAircraftModelList::addAsValidOrInvalidModel(model, false, validModels, invalidModels);
|
||||
continue;
|
||||
}
|
||||
@@ -785,14 +785,14 @@ namespace BlackMisc
|
||||
CAircraftModelList::addAsValidOrInvalidModel(model, ok, validModels, invalidModels);
|
||||
if (!ok)
|
||||
{
|
||||
msgs.push_back(CStatusMessage(getLogCategories()).validationWarning(u"Model '%1' '%2' in none of the %3 SimObjects path(s)") << model.getModelString() << model.getFileName() << simObjectDirs.size());
|
||||
msgs.push_back(CStatusMessage(static_cast<CFsCommonUtil *>(nullptr)).validationWarning(u"Model '%1' '%2' in none of the %3 SimObjects path(s)") << model.getModelString() << model.getFileName() << simObjectDirs.size());
|
||||
failed++;
|
||||
}
|
||||
|
||||
if (stopAtFailedFiles > 0 && failed >= stopAtFailedFiles)
|
||||
{
|
||||
stopped = true;
|
||||
msgs.push_back(CStatusMessage(getLogCategories()).validationWarning(u"Stopping after %1 failed models") << failed);
|
||||
msgs.push_back(CStatusMessage(static_cast<CFsCommonUtil *>(nullptr)).validationWarning(u"Stopping after %1 failed models") << failed);
|
||||
break;
|
||||
}
|
||||
} // models
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
//! Log categories
|
||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Constructor
|
||||
CFsCommonUtil() = delete;
|
||||
|
||||
@@ -41,9 +41,9 @@ namespace BlackMisc
|
||||
this->setObjectName("CInterpolationLogger");
|
||||
}
|
||||
|
||||
const CLogCategoryList &CInterpolationLogger::getLogCategories()
|
||||
const QStringList &CInterpolationLogger::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats { CLogCategory::interpolator() };
|
||||
static const QStringList cats { CLogCategories::interpolator() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace BlackMisc
|
||||
CInterpolationLogger(QObject *parent = nullptr);
|
||||
|
||||
//! Log categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Write a log in background
|
||||
CWorker *writeLogInBackground(bool clearLog);
|
||||
|
||||
@@ -163,9 +163,9 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
const CLogCategoryList &CInterpolator<Derived>::getLogCategories()
|
||||
const QStringList &CInterpolator<Derived>::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats { CLogCategory::interpolator() };
|
||||
static const QStringList cats { CLogCategories::interpolator() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
//! Log categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Latest interpolation result
|
||||
const Aviation::CAircraftSituation &getLastInterpolatedSituation() const { return m_lastSituation; }
|
||||
|
||||
@@ -15,22 +15,22 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
void CMatchingUtils::addLogDetailsToList(CStatusMessageList *log, const CSimulatedAircraft &remoteAircraft, const QString &message, const CLogCategoryList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
void CMatchingUtils::addLogDetailsToList(CStatusMessageList *log, const CSimulatedAircraft &remoteAircraft, const QString &message, const QStringList &extraCategories, CStatusMessage::StatusSeverity s)
|
||||
{
|
||||
CLogUtilities::addLogDetailsToList(log, remoteAircraft.getCallsign(), message, extraCategories, s);
|
||||
}
|
||||
|
||||
const CLogCategoryList &CMatchingUtils::defaultCategories()
|
||||
{
|
||||
static const CLogCategoryList cats({ CLogCategory::matching() });
|
||||
static const CLogCategoryList cats({ CLogCategories::matching() });
|
||||
return cats;
|
||||
}
|
||||
|
||||
CLogCategoryList CMatchingUtils::categories(const CLogCategoryList &extraCategories)
|
||||
CLogCategoryList CMatchingUtils::categories(const QStringList &extraCategories)
|
||||
{
|
||||
if (extraCategories.isEmpty()) { return defaultCategories(); }
|
||||
CLogCategoryList cats(defaultCategories());
|
||||
cats.push_back(extraCategories);
|
||||
cats.push_back(CLogCategoryList::fromQStringList(extraCategories));
|
||||
return cats;
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace BlackMisc
|
||||
//! \threadsafe
|
||||
static void addLogDetailsToList(
|
||||
CStatusMessageList *log, const Simulation::CSimulatedAircraft &remoteAircraft,
|
||||
const QString &message, const CLogCategoryList &extraCategories = {},
|
||||
const QString &message, const QStringList &extraCategories = {},
|
||||
CStatusMessage::StatusSeverity s = CStatusMessage::SeverityInfo);
|
||||
|
||||
private:
|
||||
@@ -37,7 +37,7 @@ namespace BlackMisc
|
||||
static const CLogCategoryList &defaultCategories();
|
||||
|
||||
//! Categories
|
||||
static CLogCategoryList categories(const CLogCategoryList &extraCategories);
|
||||
static CLogCategoryList categories(const QStringList &extraCategories);
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -31,9 +31,9 @@ namespace BlackMisc
|
||||
IRemoteAircraftProvider::~IRemoteAircraftProvider()
|
||||
{ }
|
||||
|
||||
const CLogCategoryList &CRemoteAircraftProvider::getLogCategories()
|
||||
const QStringList &CRemoteAircraftProvider::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats { CLogCategory::matching(), CLogCategory::network() };
|
||||
static const QStringList cats { CLogCategories::matching(), CLogCategories::network() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace BlackMisc
|
||||
|
||||
public:
|
||||
//! Log categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Constructor
|
||||
CRemoteAircraftProvider(QObject *parent);
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
break;
|
||||
}
|
||||
return CStatusMessage({ CLogCategory::settings() }, CStatusMessage::SeverityError, u"wrong simulator");
|
||||
return CStatusMessage({ CLogCategories::settings() }, CStatusMessage::SeverityError, u"wrong simulator");
|
||||
}
|
||||
|
||||
CStatusMessage CMultiSimulatorSettings::addModelDirectory(const QString &modelDirectory, const CSimulatorInfo &simulator)
|
||||
@@ -244,7 +244,7 @@ namespace BlackMisc
|
||||
CSimulatorSettings s = this->getSettings(simulator);
|
||||
if (!s.addModelDirectory(modelDirectory))
|
||||
{
|
||||
return CStatusMessage({ CLogCategory::settings() }, CStatusMessage::SeverityInfo, u"directory already existing");
|
||||
return CStatusMessage({ CLogCategories::settings() }, CStatusMessage::SeverityInfo, u"directory already existing");
|
||||
}
|
||||
return this->setSettings(s, simulator);
|
||||
}
|
||||
@@ -296,7 +296,7 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
break;
|
||||
}
|
||||
return CStatusMessage({ CLogCategory::settings() }, CStatusMessage::SeverityError, u"wrong simulator");
|
||||
return CStatusMessage({ CLogCategories::settings() }, CStatusMessage::SeverityError, u"wrong simulator");
|
||||
}
|
||||
|
||||
CStatusMessage CMultiSimulatorSettings::setAndSaveSettings(const CSpecializedSimulatorSettings &settings, const CSimulatorInfo &simulator)
|
||||
@@ -318,7 +318,7 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
break;
|
||||
}
|
||||
return CStatusMessage({ CLogCategory::settings() }, CStatusMessage::SeverityError, u"wrong simulator");
|
||||
return CStatusMessage({ CLogCategories::settings() }, CStatusMessage::SeverityError, u"wrong simulator");
|
||||
}
|
||||
|
||||
QString CMultiSimulatorSettings::getSimulatorDirectoryIfNotDefault(const CSimulatorInfo &simulator) const
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace BlackMisc
|
||||
{
|
||||
namespace XPlane
|
||||
{
|
||||
const CLogCategoryList &CXPlaneUtil::getLogCategories()
|
||||
const QStringList &CXPlaneUtil::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats { CLogCategory::matching() };
|
||||
static const QStringList cats { CLogCategories::matching() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ namespace BlackMisc
|
||||
{
|
||||
if (simDir.isEmpty())
|
||||
{
|
||||
return CStatusMessage(getLogCategories(), CStatusMessage::SeverityWarning, u"no simulator directory", true);
|
||||
return CStatusMessage(static_cast<CXPlaneUtil *>(nullptr), CStatusMessage::SeverityWarning, u"no simulator directory", true);
|
||||
}
|
||||
|
||||
CStatusMessageList msgs;
|
||||
@@ -302,8 +302,8 @@ namespace BlackMisc
|
||||
CDirectoryUtils::isSameOrSubDirectoryOf(modelDir, sd) :
|
||||
CDirectoryUtils::isSameOrSubDirectoryOfStringBased(modelDir, sd.absolutePath());
|
||||
const CStatusMessage m = exists ?
|
||||
CStatusMessage(getLogCategories()).info(u"Model directory '%1' inside '%2'") << modelDir << sd.absolutePath() :
|
||||
CStatusMessage(getLogCategories()).error(u"Model directory '%1' NOT inside '%2'") << modelDir << sd.absolutePath();
|
||||
CStatusMessage(static_cast<CXPlaneUtil *>(nullptr)).info(u"Model directory '%1' inside '%2'") << modelDir << sd.absolutePath() :
|
||||
CStatusMessage(static_cast<CXPlaneUtil *>(nullptr)).error(u"Model directory '%1' NOT inside '%2'") << modelDir << sd.absolutePath();
|
||||
msgs.push_back(m);
|
||||
}
|
||||
msgs.addValidationCategory();
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BlackMisc
|
||||
CXPlaneUtil() = delete;
|
||||
|
||||
//! Log categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! XPlane 9 directory
|
||||
static QString xplane9Dir();
|
||||
|
||||
@@ -343,7 +343,7 @@ namespace BlackMisc
|
||||
StatusSeverity severity = stringToSeverity(severityText);
|
||||
|
||||
typeText = u"swift.db.type." % typeText.toLower().remove(' ');
|
||||
const CStatusMessage m({ CLogCategory::swiftDbWebservice(), CLogCategory(typeText)}, severity, msgText);
|
||||
const CStatusMessage m({ CLogCategories::swiftDbWebservice(), typeText}, severity, msgText);
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ namespace BlackMisc
|
||||
bool isEmpty() const { return this->m_message.isEmpty() && this->m_args.isEmpty(); }
|
||||
|
||||
private:
|
||||
void setValidation() { m_categories.remove(CLogCategory::uncategorized()); this->addIfNotExisting(CLogCategory::validation()); }
|
||||
void setValidation() { m_categories.remove(CLogCategories::uncategorized()); this->addIfNotExisting(CLogCategories::validation()); }
|
||||
Derived &arg(const QString &value) { m_args.push_back(value); return derived(); }
|
||||
Derived &derived() { return static_cast<Derived &>(*this); }
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace BlackMisc
|
||||
//! @{
|
||||
CStrongStringView m_message;
|
||||
QStringList m_args;
|
||||
CLogCategoryList m_categories = CLogCategoryList { CLogCategory::uncategorized() };
|
||||
CLogCategoryList m_categories = CLogCategoryList { CLogCategories::uncategorized() };
|
||||
StatusSeverity m_severity = SeverityDebug;
|
||||
|
||||
QString message() const { return Private::arg(m_message.view(), m_args); }
|
||||
@@ -451,7 +451,7 @@ namespace BlackMisc
|
||||
void addCategory(const CLogCategory &category) { this->addIfNotExisting(category); }
|
||||
|
||||
//! Adds validation as category
|
||||
void addValidationCategory() { this->addCategory(CLogCategory::validation()); }
|
||||
void addValidationCategory() { this->addCategory(CLogCategories::validation()); }
|
||||
|
||||
//! Add categories, avoids duplicates
|
||||
void addCategories(const CLogCategoryList &categories) { this->addIfNotExisting(categories); }
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace BlackMisc
|
||||
|
||||
void CStatusMessageList::addValidationCategory()
|
||||
{
|
||||
this->addCategory(CLogCategory::validation());
|
||||
this->addCategory(CLogCategories::validation());
|
||||
}
|
||||
|
||||
void CStatusMessageList::addCategories(const CLogCategoryList &categories)
|
||||
@@ -102,7 +102,7 @@ namespace BlackMisc
|
||||
|
||||
void CStatusMessageList::addValidationMessage(const QString &validationText, CStatusMessage::StatusSeverity severity)
|
||||
{
|
||||
static const CLogCategoryList cats({ CLogCategory::validation() });
|
||||
static const CLogCategoryList cats({ CLogCategories::validation() });
|
||||
const CStatusMessage msg(cats, severity, validationText);
|
||||
this->push_back(msg);
|
||||
}
|
||||
|
||||
@@ -158,9 +158,9 @@ namespace BlackMisc
|
||||
// CValueCache
|
||||
////////////////////////////////
|
||||
|
||||
const CLogCategoryList &CValueCache::getLogCategories()
|
||||
const QStringList &CValueCache::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats({ CLogCategory("swift.valuecache") , CLogCategory::services()} );
|
||||
static const QStringList cats({ "swift.valuecache" , CLogCategories::services()} );
|
||||
return cats;
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ namespace BlackMisc
|
||||
// Private :: CValuePage
|
||||
////////////////////////////////
|
||||
|
||||
const CLogCategoryList &CValuePage::getLogCategories()
|
||||
const QStringList &CValuePage::getLogCategories()
|
||||
{
|
||||
return CValueCache::getLogCategories();
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace BlackMisc
|
||||
class BatchGuard;
|
||||
|
||||
//! Log categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Constructor.
|
||||
explicit CValueCache(int fileSplitDepth, QObject *parent = nullptr);
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace BlackMisc
|
||||
|
||||
public:
|
||||
//! Log categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Returns a CValuePage owned by the parent and connected to the cache, creating one if it doesn't exist.
|
||||
static CValuePage &getPageFor(QObject *parent, CValueCache *cache);
|
||||
|
||||
@@ -65,11 +65,11 @@ namespace BlackMisc
|
||||
#if defined(QT_NO_DEBUG) || defined(Q_CC_MSVC)
|
||||
if (context && message)
|
||||
{
|
||||
CLogMessage(CLogCategory::verification()).warning(u"Failed to verify: %1 (%2 in %3) in %4 line %5") << condition << message << context << filename << line;
|
||||
CLogMessage(CLogCategories::verification()).warning(u"Failed to verify: %1 (%2 in %3) in %4 line %5") << condition << message << context << filename << line;
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(CLogCategory::verification()).warning(u"Failed to verify: %1 in %2 line %3") << condition << filename << line;
|
||||
CLogMessage(CLogCategories::verification()).warning(u"Failed to verify: %1 in %2 line %3") << condition << filename << line;
|
||||
}
|
||||
# if defined(BLACK_USE_CRASHPAD)
|
||||
CRASHPAD_SIMULATE_CRASH();
|
||||
|
||||
@@ -117,9 +117,9 @@ namespace BlackMisc
|
||||
s_allWorkers.remove(this);
|
||||
}
|
||||
|
||||
const CLogCategoryList &CWorkerBase::getLogCategories()
|
||||
const QStringList &CWorkerBase::getLogCategories()
|
||||
{
|
||||
static const BlackMisc::CLogCategoryList cats { CLogCategory::worker() };
|
||||
static const QStringList cats { CLogCategories::worker() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace BlackMisc
|
||||
|
||||
public:
|
||||
//! Log categories
|
||||
static const CLogCategoryList &getLogCategories();
|
||||
static const QStringList &getLogCategories();
|
||||
|
||||
//! Connects to a functor or method which will be called when the task is finished.
|
||||
//! \threadsafe The functor may not call any method that observes the worker's finished flag.
|
||||
|
||||
Reference in New Issue
Block a user