fix: sortorder modelset

This commit is contained in:
tzobler
2025-11-10 13:50:25 +01:00
parent f034d31694
commit 0110146a74
9 changed files with 71 additions and 40 deletions

View File

@@ -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))
{

View File

@@ -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

View File

@@ -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