Ref T485 Adjust CLogMessage and CStatusMessage call sites to use the new API.

This commit is contained in:
Mat Sutcliffe
2018-12-23 20:12:49 +00:00
parent cba820cbce
commit 225ff81252
118 changed files with 724 additions and 721 deletions

View File

@@ -162,7 +162,7 @@ namespace BlackCore
//! Empty context called
void logEmptyContextWarning(const QString &functionName) const
{
BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).warning("Empty context called, details: %1") << functionName;
BlackMisc::CLogMessage(this, BlackMisc::CLogCategory::contextSlot()).warning(u"Empty context called, details: %1") << functionName;
}
//! Standard message when status message is returned in empty context

View File

@@ -550,7 +550,7 @@ namespace BlackCore
break;
case IVoiceChannel::ConnectingFailed:
case IVoiceChannel::DisconnectedError:
CLogMessage(this).warning("Voice channel disconnecting error");
CLogMessage(this).warning(u"Voice channel disconnecting error");
// intentional fall-through
case IVoiceChannel::Disconnected:
emit this->changedVoiceRooms(getComVoiceRooms(), false);

View File

@@ -219,7 +219,7 @@ namespace BlackCore
// Fall back to observer mode, if no simulator is available or not simulating
if (!CBuildConfig::isLocalDeveloperDebugBuild() && !this->getIContextSimulator()->isSimulatorSimulating())
{
CLogMessage(this).info("No simulator connected or connected simulator not simulating. Falling back to observer mode");
CLogMessage(this).info(u"No simulator connected or connected simulator not simulating. Falling back to observer mode");
mode = INetwork::LoginAsObserver;
}
@@ -288,17 +288,17 @@ namespace BlackCore
{
if (!this->getIContextNetwork()->isConnected())
{
CLogMessage(this).validationError("Network needs to be connected");
CLogMessage(this).validationError(u"Network needs to be connected");
return false;
}
else if (!this->getIContextOwnAircraft())
{
CLogMessage(this).validationError("No own aircraft data, no text message can be sent");
CLogMessage(this).validationError(u"No own aircraft data, no text message can be sent");
return false;
}
if (parser.countParts() < 3)
{
CLogMessage(this).validationError("Incorrect message");
CLogMessage(this).validationError(u"Incorrect message");
return false;
}
@@ -307,7 +307,7 @@ namespace BlackCore
const CSimulatedAircraft ownAircraft(this->getIContextOwnAircraft()->getOwnAircraft());
if (ownAircraft.getCallsign().isEmpty())
{
CLogMessage(this).validationError("No own callsign");
CLogMessage(this).validationError(u"No own callsign");
return false;
}
@@ -337,7 +337,7 @@ namespace BlackCore
}
else
{
CLogMessage(this).validationError("Wrong COM frequency for text message");
CLogMessage(this).validationError(u"Wrong COM frequency for text message");
return false;
}
}
@@ -352,7 +352,7 @@ namespace BlackCore
tm.setMessage(msg);
if (tm.isEmpty())
{
CLogMessage(this).validationError("No text message body");
CLogMessage(this).validationError(u"No text message body");
return false;
}
CTextMessageList tml(tm);
@@ -375,7 +375,7 @@ namespace BlackCore
cs = CCallsign(csPart);
if (!m_airspace->isAircraftInRange(cs))
{
CLogMessage(this).validationError("Altitude offset unknown callsign");
CLogMessage(this).validationError(u"Altitude offset unknown callsign");
return false;
}
}
@@ -387,8 +387,8 @@ namespace BlackCore
}
const bool added = this->testAddAltitudeOffset(cs, os);
if (added) { CLogMessage(this).info("Added altitude offset %1 for %2") << os.valueRoundedWithUnit(2) << cs.asString(); }
else { CLogMessage(this).info("Removed altitude offset %1") << cs.asString(); }
if (added) { CLogMessage(this).info(u"Added altitude offset %1 for %2") << os.valueRoundedWithUnit(2) << cs.asString(); }
else { CLogMessage(this).info(u"Removed altitude offset %1") << cs.asString(); }
return true;
}
@@ -399,7 +399,7 @@ namespace BlackCore
const bool watchdog = parser.toBool(1, true);
m_airspace->enableAnalyzer(watchdog);
CLogMessage(this).info("Enabled watchdog: %1") << boolToYesNo(watchdog);
CLogMessage(this).info(u"Enabled watchdog: %1") << boolToYesNo(watchdog);
}
else if (parser.matchesCommand(".reinit", ".reinitialize"))
{
@@ -407,7 +407,7 @@ namespace BlackCore
const int count = m_airspace->reInitializeAllAircraft();
if (count > 0)
{
CLogMessage(this).info("Re-init %1 aircraft") << count;
CLogMessage(this).info(u"Re-init %1 aircraft") << count;
}
}
else if (parser.matchesCommand(".wallop"))
@@ -546,7 +546,7 @@ namespace BlackCore
// send 1st position
if (to == INetwork::Connected)
{
CLogMessage(this).info("Connected, own aircraft %1") << this->ownAircraft().getCallsignAsString();
CLogMessage(this).info(u"Connected, own aircraft %1") << this->ownAircraft().getCallsignAsString();
if (m_network)
{
@@ -595,7 +595,7 @@ namespace BlackCore
void CContextNetwork::updateMetars(const BlackMisc::Weather::CMetarList &metars)
{
if (this->isDebugEnabled()) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
CLogMessage(this).info("%1 METARs updated") << metars.size();
CLogMessage(this).info(u"%1 METARs updated") << metars.size();
}
void CContextNetwork::onChangedAtisReceived(const CCallsign &callsign)
@@ -862,7 +862,7 @@ namespace BlackCore
if (c)
{
const CSimulatedAircraft aircraft(this->getAircraftInRangeForCallsign(callsign));
CLogMessage(this).info("Callsign '%1' fast positions '%2'") << aircraft.getCallsign() << BlackMisc::boolToOnOff(aircraft.fastPositionUpdates());
CLogMessage(this).info(u"Callsign '%1' fast positions '%2'") << aircraft.getCallsign() << BlackMisc::boolToOnOff(aircraft.fastPositionUpdates());
emit this->changedFastPositionUpdates(aircraft);
}
return c;
@@ -875,7 +875,7 @@ namespace BlackCore
if (c)
{
const CSimulatedAircraft aircraft(this->getAircraftInRangeForCallsign(callsign));
CLogMessage(this).info("Callsign '%1' set gnd.capability: %2") << aircraft.getCallsign() << boolToOnOff(aircraft.isSupportingGndFlag());
CLogMessage(this).info(u"Callsign '%1' set gnd.capability: %2") << aircraft.getCallsign() << boolToOnOff(aircraft.isSupportingGndFlag());
emit this->changedGndFlagCapability(aircraft);
}
return c;

View File

@@ -208,12 +208,12 @@ namespace BlackCore
CStatusMessageList msgs;
if (!sApp || !sApp->isNetworkAccessible())
{
msgs.push_back(CStatusMessage(this).error("No network interface, simulation will not work properly"));
msgs.push_back(CStatusMessage(this).error(u"No network interface, simulation will not work properly"));
}
const CSimulatorInfo simulators = this->simulatorsWithInitializedModelSet();
if (simulators.isNoSimulator())
{
msgs.push_back(CStatusMessage(this).error("No model set so far, you need at least one model set. Hint: You can create a model set in the mapping tool, or copy an existing set in the launcher."));
msgs.push_back(CStatusMessage(this).error(u"No model set so far, you need at least one model set. Hint: You can create a model set in the mapping tool, or copy an existing set in the launcher."));
}
return msgs;
}
@@ -358,7 +358,7 @@ namespace BlackCore
if (!simulatorPluginInfo.isValid())
{
CLogMessage(this).error("Illegal plugin");
CLogMessage(this).error(u"Illegal plugin");
return false;
}
@@ -421,7 +421,7 @@ namespace BlackCore
const bool connected = simulator->connectTo();
if (!connected)
{
CLogMessage(this).error("Simulator plugin connection to simulator '%1' failed") << simulatorPluginInfo.toQString(true);
CLogMessage(this).error(u"Simulator plugin connection to simulator '%1' failed") << simulatorPluginInfo.toQString(true);
return false;
}
@@ -440,7 +440,7 @@ namespace BlackCore
emit this->simulatorPluginChanged(simulatorPluginInfo);
});
CLogMessage(this).info("Simulator plugin loaded: '%1' connected: %2")
CLogMessage(this).info(u"Simulator plugin loaded: '%1' connected: %2")
<< simulatorPluginInfo.toQString(true)
<< boolToYesNo(connected);
@@ -470,7 +470,7 @@ namespace BlackCore
const bool c = connect(listener, &ISimulatorListener::simulatorStarted, this, &CContextSimulator::onSimulatorStarted, Qt::QueuedConnection);
if (!c)
{
CLogMessage(this).error("Unable to use '%1'") << simulatorInfo.toQString();
CLogMessage(this).error(u"Unable to use '%1'") << simulatorInfo.toQString();
return false;
}
listener->setProperty("isInitialized", true);
@@ -484,7 +484,7 @@ namespace BlackCore
Q_ASSERT_X(s, Q_FUNC_INFO, "cannot invoke method");
Q_UNUSED(s);
}
CLogMessage(this).info("Listening for simulator '%1'") << simulatorInfo.getIdentifier();
CLogMessage(this).info(u"Listening for simulator '%1'") << simulatorInfo.getIdentifier();
return true;
}
@@ -559,7 +559,7 @@ namespace BlackCore
if (this->isAircraftInRange(aircraftAfterModelApplied.getCallsign())) { return; } // removed, but callsig, we did crosscheck
// callsign, but no model string
CLogMessage(this).error("Matching error for '%1', no model string") << aircraftAfterModelApplied.getCallsign().asString();
CLogMessage(this).error(u"Matching error for '%1', no model string") << aircraftAfterModelApplied.getCallsign().asString();
CSimulatedAircraft brokenAircraft(aircraftAfterModelApplied);
brokenAircraft.setEnabled(false);
@@ -854,7 +854,7 @@ namespace BlackCore
else if (p1 == "parts") { rs.setEnabledAircraftParts(on); }
else { return false; }
this->setInterpolationAndRenderingSetupGlobal(rs);
CLogMessage(this, CLogCategory::cmdLine()).info("Setup is: '%1'") << rs.toQString(true);
CLogMessage(this, CLogCategory::cmdLine()).info(u"Setup is: '%1'") << rs.toQString(true);
return true;
}
if (parser.matchesCommand("plugin") || parser.matchesCommand("drv") || parser.matchesCommand("driver"))
@@ -1035,7 +1035,7 @@ namespace BlackCore
const CSimulatorInfo simulator(m_modelSetSimulator.get());
CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().synchronizeCache(simulator);
const CAircraftModelList models(this->getModelSet());
CLogMessage(this).info("Init aircraft matcher with %1 models from set for '%2'") << models.size() << simulator.toQString();
CLogMessage(this).info(u"Init aircraft matcher with %1 models from set for '%2'") << models.size() << simulator.toQString();
m_aircraftMatcher.setModelSet(models, simulator, false);
}
} // namespace