mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +08:00
Ref T525 Avoid directly calling getLogCategories.
This commit is contained in:
@@ -1038,7 +1038,7 @@ namespace BlackCore
|
|||||||
const CStatusMessage m = this->supportsContexts() ?
|
const CStatusMessage m = this->supportsContexts() ?
|
||||||
this->getIContextApplication()->saveSettings() :
|
this->getIContextApplication()->saveSettings() :
|
||||||
CSettingsCache::instance()->saveToStore();
|
CSettingsCache::instance()->saveToStore();
|
||||||
CLogMessage(getLogCategories()).preformatted(m);
|
CLogMessage(this).preformatted(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
// from here on we really rip apart the application object
|
// from here on we really rip apart the application object
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
const CStatusMessage &CContext::statusMessageEmptyContext()
|
const CStatusMessage &CContext::statusMessageEmptyContext()
|
||||||
{
|
{
|
||||||
static const CStatusMessage m(getLogCategories(), CStatusMessage::SeverityWarning, u"empty context");
|
static const CStatusMessage m(static_cast<CContext *>(nullptr), CStatusMessage::SeverityWarning, u"empty context");
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -757,7 +757,7 @@ namespace BlackCore
|
|||||||
if (jsonContent.isEmpty())
|
if (jsonContent.isEmpty())
|
||||||
{
|
{
|
||||||
static const QString errorMsg = "Empty JSON string, status: %1, URL: '%2', load time: %3";
|
static const QString errorMsg = "Empty JSON string, status: %1, URL: '%2', load time: %3";
|
||||||
datastoreResponse.setMessage(CStatusMessage(getLogCategories(),
|
datastoreResponse.setMessage(CStatusMessage(static_cast<CDatabaseReader *>(nullptr),
|
||||||
CStatusMessage::SeverityError,
|
CStatusMessage::SeverityError,
|
||||||
errorMsg.arg(status).arg(datastoreResponse.getUrlString(), datastoreResponse.getLoadTimeStringWithStartedHint())));
|
errorMsg.arg(status).arg(datastoreResponse.getUrlString(), datastoreResponse.getLoadTimeStringWithStartedHint())));
|
||||||
return;
|
return;
|
||||||
@@ -770,14 +770,14 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
static const QString errorMsg = "Looks like PHP errror, status %1, URL: '%2', msg: %3";
|
static const QString errorMsg = "Looks like PHP errror, status %1, URL: '%2', msg: %3";
|
||||||
const QString phpErrorMessage = CNetworkUtils::removeHtmlPartsFromPhpErrorMessage(jsonContent);
|
const QString phpErrorMessage = CNetworkUtils::removeHtmlPartsFromPhpErrorMessage(jsonContent);
|
||||||
datastoreResponse.setMessage(CStatusMessage(getLogCategories(),
|
datastoreResponse.setMessage(CStatusMessage(static_cast<CDatabaseReader *>(nullptr),
|
||||||
CStatusMessage::SeverityError,
|
CStatusMessage::SeverityError,
|
||||||
errorMsg.arg(status).arg(datastoreResponse.getUrlString(), phpErrorMessage)));
|
errorMsg.arg(status).arg(datastoreResponse.getUrlString(), phpErrorMessage)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static const QString errorMsg = "Empty JSON document, URL: '%1', load time: %2";
|
static const QString errorMsg = "Empty JSON document, URL: '%1', load time: %2";
|
||||||
datastoreResponse.setMessage(CStatusMessage(getLogCategories(),
|
datastoreResponse.setMessage(CStatusMessage(static_cast<CDatabaseReader *>(nullptr),
|
||||||
CStatusMessage::SeverityError,
|
CStatusMessage::SeverityError,
|
||||||
errorMsg.arg(datastoreResponse.getUrlString(), datastoreResponse.getLoadTimeStringWithStartedHint())));
|
errorMsg.arg(datastoreResponse.getUrlString(), datastoreResponse.getLoadTimeStringWithStartedHint())));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ namespace BlackCore
|
|||||||
stashModels.push_back(dbModel); // changed DB model
|
stashModels.push_back(dbModel); // changed DB model
|
||||||
if (updateInfo)
|
if (updateInfo)
|
||||||
{
|
{
|
||||||
const CStatusMessage m = CStatusMessage(getLogCategories()).info(u"%1 -> %2 (%3) for '%4'")
|
const CStatusMessage m = CStatusMessage(static_cast<CDatabaseUtils *>(nullptr)).info(u"%1 -> %2 (%3) for '%4'")
|
||||||
<< dbModelSimulator.toQString(true) << simulator.toQString(true)
|
<< dbModelSimulator.toQString(true) << simulator.toQString(true)
|
||||||
<< delta.toQString(true) << dbModel.getModelStringAndDbKey();
|
<< delta.toQString(true) << dbModel.getModelStringAndDbKey();
|
||||||
updateInfo->push_back(m);
|
updateInfo->push_back(m);
|
||||||
|
|||||||
@@ -493,7 +493,7 @@ namespace BlackCore
|
|||||||
CStatusMessage m = m_updateInfo.set(updateInfo, lastModified);
|
CStatusMessage m = m_updateInfo.set(updateInfo, lastModified);
|
||||||
if (m.isFailure())
|
if (m.isFailure())
|
||||||
{
|
{
|
||||||
m.addCategories(getLogCategories());
|
m.addCategories(this);
|
||||||
CLogMessage::preformatted(m);
|
CLogMessage::preformatted(m);
|
||||||
this->manageUpdateInfoAvailability(false);
|
this->manageUpdateInfoAvailability(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
catch (const CJsonException &ex)
|
catch (const CJsonException &ex)
|
||||||
{
|
{
|
||||||
const CStatusMessage m = ex.toStatusMessage(getLogCategories(), QString("Parsing flight plan from failed."));
|
const CStatusMessage m = ex.toStatusMessage(&fp, QString("Parsing flight plan from failed."));
|
||||||
Q_UNUSED(m);
|
Q_UNUSED(m);
|
||||||
}
|
}
|
||||||
return fp;
|
return fp;
|
||||||
@@ -457,7 +457,7 @@ namespace BlackMisc
|
|||||||
CStatusMessage m;
|
CStatusMessage m;
|
||||||
if (!Json::looksLikeSwiftJson(data))
|
if (!Json::looksLikeSwiftJson(data))
|
||||||
{
|
{
|
||||||
m = CStatusMessage(CFlightPlan::getLogCategories(), CStatusMessage::SeverityWarning, u"Reading '%1' yields no data", true) << fileName;
|
m = CStatusMessage(getLogCategories(), CStatusMessage::SeverityWarning, u"Reading '%1' yields no data", true) << fileName;
|
||||||
if (msgs) { msgs->push_back(m); }
|
if (msgs) { msgs->push_back(m); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -477,7 +477,7 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m = CStatusMessage(CFlightPlan::getLogCategories(), CStatusMessage::SeverityWarning, u"Wrong format for flight plan in '%1'") << fileName;
|
m = CStatusMessage(getLogCategories(), CStatusMessage::SeverityWarning, u"Wrong format for flight plan in '%1'") << fileName;
|
||||||
if (msgs) { msgs->push_back(m); }
|
if (msgs) { msgs->push_back(m); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -489,7 +489,7 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
catch (const CJsonException &ex)
|
catch (const CJsonException &ex)
|
||||||
{
|
{
|
||||||
m = ex.toStatusMessage(CFlightPlan::getLogCategories(), "Parse error in " + fileName);
|
m = ex.toStatusMessage(getLogCategories(), "Parse error in " + fileName);
|
||||||
if (msgs) { msgs->push_back(m); }
|
if (msgs) { msgs->push_back(m); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ namespace BlackMisc
|
|||||||
QFile file(fnFixed); // includes path
|
QFile file(fnFixed); // includes path
|
||||||
if (!file.open(QFile::ReadOnly | QFile::Text))
|
if (!file.open(QFile::ReadOnly | QFile::Text))
|
||||||
{
|
{
|
||||||
const CStatusMessage m = CStatusMessage(getLogCategories()).warning(u"Unable to read file '%1'") << fnFixed;
|
const CStatusMessage m = CStatusMessage(static_cast<CAircraftCfgParser *>(nullptr)).warning(u"Unable to read file '%1'") << fnFixed;
|
||||||
msgs.push_back(m);
|
msgs.push_back(m);
|
||||||
return CAircraftCfgEntriesList();
|
return CAircraftCfgEntriesList();
|
||||||
}
|
}
|
||||||
@@ -371,7 +371,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
if (e.getTitle().isEmpty())
|
if (e.getTitle().isEmpty())
|
||||||
{
|
{
|
||||||
const CStatusMessage m = CStatusMessage(getLogCategories()).info(u"FS model in %1, index %2 has no title") << fileName << e.getIndex();
|
const CStatusMessage m = CStatusMessage(static_cast<CAircraftCfgParser *>(nullptr)).info(u"FS model in %1, index %2 has no title") << fileName << e.getIndex();
|
||||||
msgs.push_back(m);
|
msgs.push_back(m);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
const QJsonDocument doc(jsonObject);
|
const QJsonDocument doc(jsonObject);
|
||||||
const QString partsAsString = doc.toJson(QJsonDocument::Compact);
|
const QString partsAsString = doc.toJson(QJsonDocument::Compact);
|
||||||
const CStatusMessage message(getLogCategories(), CStatusMessage::SeverityInfo, callsign.isEmpty() ? callsign.toQString() + ": " + partsAsString.trimmed() : partsAsString.trimmed());
|
const CStatusMessage message(this, CStatusMessage::SeverityInfo, callsign.isEmpty() ? callsign.toQString() + ": " + partsAsString.trimmed() : partsAsString.trimmed());
|
||||||
|
|
||||||
QReadLocker l(&m_lockPartsHistory);
|
QReadLocker l(&m_lockPartsHistory);
|
||||||
if (m_aircraftPartsMessages.contains(callsign))
|
if (m_aircraftPartsMessages.contains(callsign))
|
||||||
|
|||||||
@@ -2088,7 +2088,7 @@ namespace BlackSimPlugin
|
|||||||
if (position.Airspeed < 2)
|
if (position.Airspeed < 2)
|
||||||
{
|
{
|
||||||
position.OnGround = 1U;
|
position.OnGround = 1U;
|
||||||
if (details) { *details = CStatusMessage(getLogCategories()).warning(u"Force GND flag for underflow protection"); }
|
if (details) { *details = CStatusMessage(static_cast<CSimulatorFsxCommon *>(nullptr)).warning(u"Force GND flag for underflow protection"); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user