Validate simulator info for model (used for quick mapping wizard)

This commit is contained in:
Klaus Basan
2019-03-23 19:53:29 +01:00
committed by Mat Sutcliffe
parent 3d563d9e7d
commit 88e82404e2
2 changed files with 15 additions and 1 deletions

View File

@@ -220,6 +220,16 @@ namespace BlackMisc
return e;
}
CStatusMessage CSimulatorInfo::validateSimulatorsForModel() const
{
CStatusMessage m(this);
if (!this->isAnySimulator()) { return m.validationError(u"No simulator"); }
if (this->isMicrosoftOrPrepare3DSimulator() && this->isXPlane()) { return m.validationError(u"Cannot combine XPlane and FS simulators"); }
if (this->isMicrosoftOrPrepare3DSimulator() && this->isFG()) { return m.validationError(u"Cannot combine FG and FS simulators"); }
if (this->isXPlane() && this->isFG()) { return m.validationError(u"Cannot combine FG and XPlane simulators"); }
return m.info(u"Simulators OK for model");
}
CSimulatorInfo::Simulator CSimulatorInfo::boolToFlag(bool fsx, bool fs9, bool xp, bool p3d, bool fg)
{
Simulator s = fsx ? FSX : None;

View File

@@ -11,10 +11,11 @@
#ifndef BLACKMISC_SIMULATION_SIMULATORINFO_H
#define BLACKMISC_SIMULATION_SIMULATORINFO_H
#include "blackmisc/blackmiscexport.h"
#include "blackmisc/statusmessage.h"
#include "blackmisc/metaclass.h"
#include "blackmisc/propertyindex.h"
#include "blackmisc/valueobject.h"
#include "blackmisc/blackmiscexport.h"
#include <QFlag>
#include <QFlags>
@@ -167,6 +168,9 @@ namespace BlackMisc
//! To plugin indentifier, empty string if not single simulator
const QString &toPluginIdentifier() const;
//! Validate simulators for an aircraft model
CStatusMessage validateSimulatorsForModel() const;
//! Bool flags to enum
static Simulator boolToFlag(bool isFSX, bool isFS9, bool xp, bool isP3D, bool fg);