mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Ref T710 Propagate libxplanemp CSL load error messages as swift validation errors.
This commit is contained in:
@@ -595,7 +595,11 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
if (CDirectoryUtils::isSameOrSubDirectoryOf(package, simDir))
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -64,9 +64,9 @@ namespace BlackSimPlugin
|
|||||||
m_dbusInterface->callDBus(QLatin1String("cleanup"));
|
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)
|
void CXSwiftBusTrafficProxy::setDefaultIcao(const QString &defaultIcao)
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ namespace BlackSimPlugin
|
|||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
//! \copydoc XSwiftBus::CTraffic::loadPlanesPackage
|
//! \copydoc XSwiftBus::CTraffic::loadPlanesPackage
|
||||||
bool loadPlanesPackage(const QString &path);
|
QString loadPlanesPackage(const QString &path);
|
||||||
|
|
||||||
//! \copydoc XSwiftBus::CTraffic::setDefaultIcao
|
//! \copydoc XSwiftBus::CTraffic::setDefaultIcao
|
||||||
void setDefaultIcao(const QString &defaultIcao);
|
void setDefaultIcao(const QString &defaultIcao);
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ namespace XSwiftBus
|
|||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTraffic::loadPlanesPackage(const std::string &path)
|
std::string CTraffic::loadPlanesPackage(const std::string &path)
|
||||||
{
|
{
|
||||||
initXPlanePath();
|
initXPlanePath();
|
||||||
auto dir = g_xplanePath + "Resources" + g_sep + "plugins" + g_sep + "xswiftbus" + g_sep + "LegacyData" + g_sep;
|
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 related = dir + "related.txt";
|
||||||
std::string doc8643 = dir + "Doc8643.txt";
|
std::string doc8643 = dir + "Doc8643.txt";
|
||||||
auto err = XPMPLoadCSLPackage(path.c_str(), related.c_str(), doc8643.c_str());
|
auto err = XPMPLoadCSLPackage(path.c_str(), related.c_str(), doc8643.c_str());
|
||||||
if (*err) { return false; }
|
if (*err) { return err; }
|
||||||
return true;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTraffic::setDefaultIcao(const std::string &defaultIcao)
|
void CTraffic::setDefaultIcao(const std::string &defaultIcao)
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ namespace XSwiftBus
|
|||||||
//! Reverse the actions of initialize().
|
//! Reverse the actions of initialize().
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
//! Load a collection of planes from the given directory and return true if successful
|
//! Load a collection of planes from the given directory and return error message if unsuccessful
|
||||||
bool loadPlanesPackage(const std::string &path);
|
std::string loadPlanesPackage(const std::string &path);
|
||||||
|
|
||||||
//! Set the ICAO code to use for aircraft without a model match
|
//! Set the ICAO code to use for aircraft without a model match
|
||||||
void setDefaultIcao(const std::string &defaultIcao);
|
void setDefaultIcao(const std::string &defaultIcao);
|
||||||
|
|||||||
Reference in New Issue
Block a user