mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T515, logic for "isLikely" simulator list moved to model list
This commit is contained in:
committed by
Mat Sutcliffe
parent
11daf3b418
commit
77e642d42d
@@ -43,12 +43,9 @@ namespace BlackGui
|
||||
|
||||
CAircraftModelList valid;
|
||||
CAircraftModelList invalid;
|
||||
const CCountPerSimulator counts = m_models.countPerSimulator();
|
||||
const double fsFamilyCount = counts.getCountForFsFamilySimulators();
|
||||
const double fsRatio = fsFamilyCount / m_models.size();
|
||||
const bool ignoreEmpty = false;
|
||||
const int maxFailedFiles = 25;
|
||||
const CStatusMessageList msgs = fsRatio > 0.9 ?
|
||||
const CStatusMessageList msgs = m_models.isLikelyFsFamilyModelList() ?
|
||||
CFsCommonUtil::validateConfigFiles(m_models, valid, invalid, ignoreEmpty, maxFailedFiles) :
|
||||
m_models.validateFiles(valid, invalid, ignoreEmpty, maxFailedFiles);
|
||||
ui->comp_StatusMessage->clear();
|
||||
|
||||
@@ -557,6 +557,34 @@ namespace BlackMisc
|
||||
return CSimulatorInfo(s);
|
||||
}
|
||||
|
||||
namespace Private
|
||||
{
|
||||
bool isLikelyImpl(double count, double total)
|
||||
{
|
||||
if (total < 1) { return false; }
|
||||
const double fsRatio = count / total;
|
||||
return fsRatio > 0.95;
|
||||
}
|
||||
}
|
||||
|
||||
bool CAircraftModelList::isLikelyFsFamilyModelList() const
|
||||
{
|
||||
if (this->isEmpty()) { return false; } // avoid DIV 0
|
||||
return Private::isLikelyImpl(this->countPerSimulator().getCountForFsFamilySimulators(), this->size());
|
||||
}
|
||||
|
||||
bool CAircraftModelList::isLikelyFsxFamilyModelList() const
|
||||
{
|
||||
if (this->isEmpty()) { return false; } // avoid DIV 0
|
||||
return Private::isLikelyImpl(this->countPerSimulator().getCountForFsxFamilySimulators(), this->size());
|
||||
}
|
||||
|
||||
bool CAircraftModelList::isLikelyXplaneModelList() const
|
||||
{
|
||||
if (this->isEmpty()) { return false; } // avoid DIV 0
|
||||
return Private::isLikelyImpl(this->countPerSimulator().getCount(CSimulatorInfo::xplane()), this->size());
|
||||
}
|
||||
|
||||
int CAircraftModelList::setModelMode(CAircraftModel::ModelMode mode)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
@@ -229,9 +229,18 @@ namespace BlackMisc
|
||||
//! Set simulator for all elements
|
||||
int setSimulatorInfo(const CSimulatorInfo &info);
|
||||
|
||||
//! Which simulators are supported in that model list
|
||||
//! Which simulators are supported in this model list
|
||||
CSimulatorInfo simulatorsSupported() const;
|
||||
|
||||
//! Is this here a FS family (P3D/FSX/FS9) model list?
|
||||
bool isLikelyFsFamilyModelList() const;
|
||||
|
||||
//! Is this here a FS family (P3D/FSX) model list?
|
||||
bool isLikelyFsxFamilyModelList() const;
|
||||
|
||||
//! Is this here a XPlane model list?
|
||||
bool isLikelyXplaneModelList() const;
|
||||
|
||||
//! Set mode for all elements
|
||||
int setModelMode(CAircraftModel::ModelMode mode);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user