mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
fix: sortorder modelset
This commit is contained in:
@@ -774,12 +774,14 @@ namespace swift::core
|
||||
const QString &combinedAircraftType, const QString &modelString)
|
||||
{
|
||||
// TODO TZ remove when testing is done
|
||||
// #SBBER750:DAL483:FSIPIR:0:BER:A320:::::L2J:PMDG 737-800 AIRBERLIN (D-ABKM)
|
||||
CLogMessage(this).info(u"CAirspaceMonitor::onCustomFSInnPacketReceived CHECK:"
|
||||
u"callsign %1 "
|
||||
u"airlineIcaoDesignator %2 "
|
||||
u"aircraftIcaoDesignator %3 "
|
||||
u"modelString %4 ")
|
||||
<< callsign << airlineIcaoDesignator << aircraftIcaoDesignator << modelString;
|
||||
u"combinedAircraftType %4 "
|
||||
u"modelString %5 ")
|
||||
<< callsign << airlineIcaoDesignator << aircraftIcaoDesignator << combinedAircraftType << modelString;
|
||||
|
||||
// it can happen this is called before any queries
|
||||
// ES sends FsInn packets for callsigns such as ACCGER1, which are hard to distinguish
|
||||
@@ -854,13 +856,15 @@ namespace swift::core
|
||||
void CAirspaceMonitor::onIcaoCodesReceived(const CCallsign &callsign, const QString &aircraftIcaoDesignator,
|
||||
const QString &airlineIcaoDesignator, const QString &livery)
|
||||
{
|
||||
// TODO TZ remove when testing is done
|
||||
// TODO TZ remove logmessage when testing is done
|
||||
// #SBDAL483:BER636:PI:GEN:EQUIPMENT=B738:AIRLINE=DAL:LIVERY=swift_l1855a1787m13853
|
||||
CLogMessage(this).info(u"CAirspaceMonitor::onIcaoCodesReceived CHECK:"
|
||||
u"callsign %1 "
|
||||
u"aircraftIcaoDesignator %2 "
|
||||
u"airlineIcaoDesignator %3 "
|
||||
u"livery %4 ")
|
||||
<< callsign << aircraftIcaoDesignator << airlineIcaoDesignator << livery;
|
||||
// End TODO TZ
|
||||
|
||||
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "not in main thread");
|
||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||
|
||||
@@ -344,7 +344,8 @@ namespace swift::gui::components
|
||||
Q_UNUSED(modelDirectories);
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
const CStatusMessage msg = CLogMessage(this).info(u"Start loading models for %1") << simulator.toQString();
|
||||
const CStatusMessage msg = CLogMessage(this).info(u"Triiger loading models for %1 from SimConnect")
|
||||
<< simulator.toQString();
|
||||
this->showOverlayHTMLMessage(msg, 2s);
|
||||
|
||||
return;
|
||||
@@ -530,11 +531,10 @@ namespace swift::gui::components
|
||||
IAircraftModelLoader::LoadMode mode,
|
||||
const QStringList &modelDirectories)
|
||||
{
|
||||
// At this point, we switch how the models should be loaded: SimConnect or classic file search
|
||||
if (simulator.isMSFS2024())
|
||||
this->loadInstalledModelsSimConnect(simulator, mode, modelDirectories);
|
||||
else
|
||||
this->loadInstalledModels(simulator, mode, modelDirectories);
|
||||
// TODO TZ add SimConnect loading
|
||||
if (simulator.isMSFS2024()) this->loadInstalledModelsSimConnect(simulator, mode, modelDirectories);
|
||||
|
||||
this->loadInstalledModels(simulator, mode, modelDirectories);
|
||||
}
|
||||
|
||||
void CDbOwnModelsComponent::requestSimulatorModelsWithCacheInBackground(const CSimulatorInfo &simulator)
|
||||
|
||||
@@ -46,10 +46,7 @@ namespace swift::gui::models
|
||||
{
|
||||
case NotSet:
|
||||
case OwnAircraftModelClient:
|
||||
// m_columns.addColumn(CColumn::standardString("model", { CAircraftModel::IndexModelString }));
|
||||
m_columns.addColumn(CColumn::standardString("model", { CAircraftModel::IndexShortModelString }));
|
||||
|
||||
m_columns.addColumn(CColumn::standardString("liverypart", CAircraftModel::IndexModelLivery));
|
||||
m_columns.addColumn(CColumn::standardString("model", { CAircraftModel::IndexModelString }));
|
||||
m_columns.addColumn(
|
||||
CColumn("DB", "DB metadata", CAircraftModel::IndexDatabaseIcon, new CPixmapFormatter()));
|
||||
m_columns.addColumn(
|
||||
@@ -86,9 +83,7 @@ namespace swift::gui::models
|
||||
|
||||
case OwnAircraftModelMappingTool:
|
||||
case StashModel:
|
||||
m_columns.addColumn(CColumn::standardString("model", CAircraftModel::IndexShortModelString));
|
||||
|
||||
m_columns.addColumn(CColumn::standardString("liverypart", CAircraftModel::IndexModelLivery));
|
||||
m_columns.addColumn(CColumn::standardString("model", { CAircraftModel::IndexModelString }));
|
||||
m_columns.addColumn(
|
||||
CColumn("DB", "DB metadata", CAircraftModel::IndexDatabaseIcon, new CPixmapFormatter()));
|
||||
if (mode == StashModel)
|
||||
|
||||
@@ -284,8 +284,6 @@ namespace swift::misc::simulation
|
||||
case IndexLivery: return m_livery.propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexMembersDbStatus: return this->getMembersDbStatus();
|
||||
case IndexModelLivery: return QVariant(m_modelLivery);
|
||||
case IndexShortModelString: return QVariant(getShortModelString());
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,8 +127,6 @@ namespace swift::misc
|
||||
IndexModelModeAsIcon,
|
||||
IndexHasQueriedModelString,
|
||||
IndexMembersDbStatus,
|
||||
IndexModelLivery, // MSFS2024
|
||||
IndexShortModelString,
|
||||
};
|
||||
|
||||
//! \copydoc swift::misc::CValueObject::registerMetadata
|
||||
|
||||
@@ -131,28 +131,28 @@ namespace swift::misc::simulation
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO TZ
|
||||
QStringList modelDirs = { "", "" };
|
||||
if (simulator.isMSFS2024())
|
||||
// if (simulator.isMSFS2024())
|
||||
//{
|
||||
// emit this->loadingFinished(m_loadingMessages, simulator, LoadingSkipped);
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
//{
|
||||
// really load from disk?
|
||||
modelDirs = this->getInitializedModelDirectories(modelDirectories, simulator);
|
||||
if (m_skipLoadingEmptyModelDir && modelDirs.isEmpty())
|
||||
{
|
||||
const CStatusMessage status = CStatusMessage(this, CStatusMessage::SeverityWarning,
|
||||
u"Empty or not existing '%1' directory '%2', skipping read")
|
||||
<< simulator.toQString() << modelDirectories.join(", ");
|
||||
m_loadingMessages.push_back(status);
|
||||
m_loadingMessages.freezeOrder();
|
||||
emit this->loadingFinished(m_loadingMessages, simulator, LoadingSkipped);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// really load from disk?
|
||||
modelDirs = this->getInitializedModelDirectories(modelDirectories, simulator);
|
||||
if (m_skipLoadingEmptyModelDir && modelDirs.isEmpty())
|
||||
{
|
||||
const CStatusMessage status =
|
||||
CStatusMessage(this, CStatusMessage::SeverityWarning,
|
||||
u"Empty or not existing '%1' directory '%2', skipping read")
|
||||
<< simulator.toQString() << modelDirectories.join(", ");
|
||||
m_loadingMessages.push_back(status);
|
||||
m_loadingMessages.freezeOrder();
|
||||
emit this->loadingFinished(m_loadingMessages, simulator, LoadingSkipped);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
this->setObjectInfo(simulator);
|
||||
this->startLoadingFromDisk(mode, modelConsolidation, modelDirs);
|
||||
|
||||
@@ -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