Ref T710 Propagate libxplanemp CSL load error messages as swift validation errors.

This commit is contained in:
Mat Sutcliffe
2019-07-29 22:08:39 +01:00
parent 5b5e139d10
commit b36172437b
5 changed files with 13 additions and 9 deletions

View File

@@ -595,7 +595,11 @@ namespace BlackSimPlugin
{
if (CDirectoryUtils::isSameOrSubDirectoryOf(package, simDir))
{
m_trafficProxy->loadPlanesPackage(package);
const QString message = m_trafficProxy->loadPlanesPackage(package);
if (!message.isEmpty())
{
CLogMessage(this).validationError(u"CSL package '%1' xpmp error: %2") << package << message;
}
}
else
{

View File

@@ -64,9 +64,9 @@ namespace BlackSimPlugin
m_dbusInterface->callDBus(QLatin1String("cleanup"));
}
bool CXSwiftBusTrafficProxy::loadPlanesPackage(const QString &path)
QString CXSwiftBusTrafficProxy::loadPlanesPackage(const QString &path)
{
return m_dbusInterface->callDBusRet<bool>(QLatin1String("loadPlanesPackage"), path);
return m_dbusInterface->callDBusRet<QString>(QLatin1String("loadPlanesPackage"), path);
}
void CXSwiftBusTrafficProxy::setDefaultIcao(const QString &defaultIcao)

View File

@@ -163,7 +163,7 @@ namespace BlackSimPlugin
void cleanup();
//! \copydoc XSwiftBus::CTraffic::loadPlanesPackage
bool loadPlanesPackage(const QString &path);
QString loadPlanesPackage(const QString &path);
//! \copydoc XSwiftBus::CTraffic::setDefaultIcao
void setDefaultIcao(const QString &defaultIcao);

View File

@@ -226,7 +226,7 @@ namespace XSwiftBus
return def;
}
bool CTraffic::loadPlanesPackage(const std::string &path)
std::string CTraffic::loadPlanesPackage(const std::string &path)
{
initXPlanePath();
auto dir = g_xplanePath + "Resources" + g_sep + "plugins" + g_sep + "xswiftbus" + g_sep + "LegacyData" + g_sep;
@@ -234,8 +234,8 @@ namespace XSwiftBus
std::string related = dir + "related.txt";
std::string doc8643 = dir + "Doc8643.txt";
auto err = XPMPLoadCSLPackage(path.c_str(), related.c_str(), doc8643.c_str());
if (*err) { return false; }
return true;
if (*err) { return err; }
return {};
}
void CTraffic::setDefaultIcao(const std::string &defaultIcao)

View File

@@ -70,8 +70,8 @@ namespace XSwiftBus
//! Reverse the actions of initialize().
void cleanup();
//! Load a collection of planes from the given directory and return true if successful
bool loadPlanesPackage(const std::string &path);
//! Load a collection of planes from the given directory and return error message if unsuccessful
std::string loadPlanesPackage(const std::string &path);
//! Set the ICAO code to use for aircraft without a model match
void setDefaultIcao(const std::string &defaultIcao);