mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 19:35:32 +08:00
fix: sortorder modelset
This commit is contained in:
@@ -444,9 +444,9 @@ namespace swift::simplugin::msfs2024common
|
||||
hr += SimConnect_EnumerateSimObjectsAndLiveries(hSimConnect, CSimConnectDefinitions::REQUEST_AIRPLANE,
|
||||
SIMCONNECT_SIMOBJECT_TYPE_AIRCRAFT);
|
||||
hr += SimConnect_EnumerateSimObjectsAndLiveries(hSimConnect, CSimConnectDefinitions::REQUEST_HELICOPTER,
|
||||
SIMCONNECT_SIMOBJECT_TYPE_AIRCRAFT);
|
||||
SIMCONNECT_SIMOBJECT_TYPE_HELICOPTER);
|
||||
// hr += SimConnect_EnumerateSimObjectsAndLiveries(hSimConnect, CSimConnectDefinitions::REQUEST_HOT_AIR,
|
||||
// SIMCONNECT_SIMOBJECT_TYPE_AIRCRAFT);
|
||||
// SIMCONNECT_SIMOBJECT_TYPE_HOT_AIR_BALLOON);
|
||||
|
||||
if (isFailure(hr))
|
||||
{
|
||||
|
||||
@@ -448,11 +448,18 @@ namespace swift::simplugin::msfs2024common
|
||||
const CSpecializedSimulatorSettings settings = this->getSimulatorSettings();
|
||||
CSimulatorSettings m_generic = settings.getGenericSettings();
|
||||
QStringList excludePatterns = m_generic.getModelExcludeDirectoryPatterns();
|
||||
QStringList filterList = m_generic.getModelDirectories();
|
||||
|
||||
bool gui_application = true;
|
||||
bool useFilterList = true;
|
||||
bool matchFilter = false;
|
||||
|
||||
QString guiName = sGui->getApplicationName();
|
||||
if (guiName.contains("mapping")) gui_application = false;
|
||||
|
||||
const CAircraftMatcherSetup setup = m_matchingSettings.get();
|
||||
bool skipExcluded = setup.getMatchingMode().testFlag(CAircraftMatcherSetup::ExcludeNoExcluded);
|
||||
|
||||
CAircraftModelList newModels;
|
||||
|
||||
for (int i = 0; i < static_cast<int>(vSimObjectsAndLiveries.size()); ++i)
|
||||
@@ -463,6 +470,9 @@ namespace swift::simplugin::msfs2024common
|
||||
CAircraftModel modelFromDb =
|
||||
sGui->getWebDataServices()->getModelForModelString(modelLivery.szSimObjectCombinedTitle.trimmed());
|
||||
|
||||
// model is marked as excluded in the database, so skip it
|
||||
if (modelFromDb.getModelMode() == CAircraftModel::Exclude && skipExcluded && gui_application) { continue; }
|
||||
|
||||
// If the model is in the database, there is a DbKey
|
||||
int modelkey = modelFromDb.getDbKey();
|
||||
if (modelkey) model = modelFromDb; // copy all data from db
|
||||
@@ -487,6 +497,27 @@ namespace swift::simplugin::msfs2024common
|
||||
}
|
||||
if (excluded) continue; // skip adding this model
|
||||
|
||||
if (useFilterList)
|
||||
{
|
||||
matchFilter = false;
|
||||
for (const QString &rawFilter : filterList)
|
||||
{
|
||||
if (rawFilter.trimmed().contains("*"))
|
||||
{
|
||||
// wildcard found, disable filter list
|
||||
useFilterList = false;
|
||||
continue;
|
||||
}
|
||||
const QString filter = rawFilter.trimmed();
|
||||
if (model.getModelString().contains(filter, Qt::CaseInsensitive))
|
||||
{
|
||||
matchFilter = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (useFilterList && !matchFilter) continue; // skip adding this model
|
||||
|
||||
newModels.replaceOrAddModelWithString(model, Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
@@ -507,7 +538,7 @@ namespace swift::simplugin::msfs2024common
|
||||
bool givenDistributorsOnly = false;
|
||||
bool dbDataOnly = false;
|
||||
bool dbIcaoOnly = false;
|
||||
bool incremnental = true;
|
||||
bool incremnental = false;
|
||||
bool sortByDistributor = true;
|
||||
bool consolidateWithDb = false;
|
||||
bool ShowAllInstalledModells = true; // msfs20424 always show all installed models
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "misc/simulation/aircraftmodel.h"
|
||||
#include "misc/simulation/data/modelcaches.h" // TODO ???
|
||||
#include "misc/simulation/interpolation/interpolatorlinear.h"
|
||||
#include "misc/simulation/settings/modelmatchersettings.h"
|
||||
#include "misc/simulation/settings/simulatorsettings.h"
|
||||
#include "misc/simulation/simulatedaircraft.h"
|
||||
#include "misc/simulation/simulatorplugininfo.h"
|
||||
@@ -742,6 +743,10 @@ namespace swift::simplugin::msfs2024common
|
||||
//! Simulator info
|
||||
swift::misc::simulation::CSimulatorInfo m_simulatorInfo;
|
||||
|
||||
swift::misc::CSetting<swift::misc::simulation::settings::TModelMatching> m_matchingSettings {
|
||||
this
|
||||
}; //!< settings
|
||||
|
||||
public:
|
||||
//! @{
|
||||
//! Offsets
|
||||
|
||||
Reference in New Issue
Block a user