13 using namespace swift::config;
15 using namespace swift::misc::simulation::settings;
17 namespace swift::misc::simulation
19 QProcess *CModelConverterX::s_proccess =
nullptr;
21 bool CModelConverterX::supportsModelConverterX()
24 return !getBinary().isEmpty();
27 QProcess *CModelConverterX::startModelConverterX(
const CAircraftModel &model, QObject *parent)
30 if (model.
getFileName().isEmpty()) {
return nullptr; }
31 const QString modelConverterX = getBinary();
32 if (modelConverterX.isEmpty()) {
return nullptr; }
37 QProcess *old = s_proccess;
39 if (old->state() == QProcess::Running)
42 QObject::connect(old, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), old,
43 &QObject::deleteLater);
46 else { old->deleteLater(); }
49 QProcess *process =
new QProcess(parent);
50 const QString argument = QDir::toNativeSeparators(model.
getFileName());
51 process->setProgram(modelConverterX);
52 process->setArguments({ argument });
58 QString CModelConverterX::getBinary()
61 const QString mcx = setting.get();
62 if (mcx.isEmpty())
return {};
64 return (f.exists()) ? mcx : QString();
static constexpr bool isRunningOnWindowsNtPlatform()
Running on Windows NT platform?
Class template for accessing a specific value in the CSettingsCache.
Aircraft model (used by another pilot, my models on disk)
const QString & getFileName() const
File name (corresponding data for simulator, only available if representing simulator model.
Free functions in swift::misc.