mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 12:35:43 +08:00
fix: sortorder modelset
This commit is contained in:
@@ -774,12 +774,14 @@ namespace swift::core
|
|||||||
const QString &combinedAircraftType, const QString &modelString)
|
const QString &combinedAircraftType, const QString &modelString)
|
||||||
{
|
{
|
||||||
// TODO TZ remove when testing is done
|
// 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:"
|
CLogMessage(this).info(u"CAirspaceMonitor::onCustomFSInnPacketReceived CHECK:"
|
||||||
u"callsign %1 "
|
u"callsign %1 "
|
||||||
u"airlineIcaoDesignator %2 "
|
u"airlineIcaoDesignator %2 "
|
||||||
u"aircraftIcaoDesignator %3 "
|
u"aircraftIcaoDesignator %3 "
|
||||||
u"modelString %4 ")
|
u"combinedAircraftType %4 "
|
||||||
<< callsign << airlineIcaoDesignator << aircraftIcaoDesignator << modelString;
|
u"modelString %5 ")
|
||||||
|
<< callsign << airlineIcaoDesignator << aircraftIcaoDesignator << combinedAircraftType << modelString;
|
||||||
|
|
||||||
// it can happen this is called before any queries
|
// it can happen this is called before any queries
|
||||||
// ES sends FsInn packets for callsigns such as ACCGER1, which are hard to distinguish
|
// 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,
|
void CAirspaceMonitor::onIcaoCodesReceived(const CCallsign &callsign, const QString &aircraftIcaoDesignator,
|
||||||
const QString &airlineIcaoDesignator, const QString &livery)
|
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:"
|
CLogMessage(this).info(u"CAirspaceMonitor::onIcaoCodesReceived CHECK:"
|
||||||
u"callsign %1 "
|
u"callsign %1 "
|
||||||
u"aircraftIcaoDesignator %2 "
|
u"aircraftIcaoDesignator %2 "
|
||||||
u"airlineIcaoDesignator %3 "
|
u"airlineIcaoDesignator %3 "
|
||||||
u"livery %4 ")
|
u"livery %4 ")
|
||||||
<< callsign << aircraftIcaoDesignator << airlineIcaoDesignator << livery;
|
<< callsign << aircraftIcaoDesignator << airlineIcaoDesignator << livery;
|
||||||
|
// End TODO TZ
|
||||||
|
|
||||||
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "not in main thread");
|
Q_ASSERT_X(CThreadUtils::isInThisThread(this), Q_FUNC_INFO, "not in main thread");
|
||||||
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
if (!this->isConnectedAndNotShuttingDown()) { return; }
|
||||||
|
|||||||
@@ -344,7 +344,8 @@ namespace swift::gui::components
|
|||||||
Q_UNUSED(modelDirectories);
|
Q_UNUSED(modelDirectories);
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
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);
|
this->showOverlayHTMLMessage(msg, 2s);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -530,11 +531,10 @@ namespace swift::gui::components
|
|||||||
IAircraftModelLoader::LoadMode mode,
|
IAircraftModelLoader::LoadMode mode,
|
||||||
const QStringList &modelDirectories)
|
const QStringList &modelDirectories)
|
||||||
{
|
{
|
||||||
// At this point, we switch how the models should be loaded: SimConnect or classic file search
|
// TODO TZ add SimConnect loading
|
||||||
if (simulator.isMSFS2024())
|
if (simulator.isMSFS2024()) this->loadInstalledModelsSimConnect(simulator, mode, modelDirectories);
|
||||||
this->loadInstalledModelsSimConnect(simulator, mode, modelDirectories);
|
|
||||||
else
|
this->loadInstalledModels(simulator, mode, modelDirectories);
|
||||||
this->loadInstalledModels(simulator, mode, modelDirectories);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbOwnModelsComponent::requestSimulatorModelsWithCacheInBackground(const CSimulatorInfo &simulator)
|
void CDbOwnModelsComponent::requestSimulatorModelsWithCacheInBackground(const CSimulatorInfo &simulator)
|
||||||
|
|||||||
@@ -46,10 +46,7 @@ namespace swift::gui::models
|
|||||||
{
|
{
|
||||||
case NotSet:
|
case NotSet:
|
||||||
case OwnAircraftModelClient:
|
case OwnAircraftModelClient:
|
||||||
// m_columns.addColumn(CColumn::standardString("model", { CAircraftModel::IndexModelString }));
|
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(
|
m_columns.addColumn(
|
||||||
CColumn("DB", "DB metadata", CAircraftModel::IndexDatabaseIcon, new CPixmapFormatter()));
|
CColumn("DB", "DB metadata", CAircraftModel::IndexDatabaseIcon, new CPixmapFormatter()));
|
||||||
m_columns.addColumn(
|
m_columns.addColumn(
|
||||||
@@ -86,9 +83,7 @@ namespace swift::gui::models
|
|||||||
|
|
||||||
case OwnAircraftModelMappingTool:
|
case OwnAircraftModelMappingTool:
|
||||||
case StashModel:
|
case StashModel:
|
||||||
m_columns.addColumn(CColumn::standardString("model", CAircraftModel::IndexShortModelString));
|
m_columns.addColumn(CColumn::standardString("model", { CAircraftModel::IndexModelString }));
|
||||||
|
|
||||||
m_columns.addColumn(CColumn::standardString("liverypart", CAircraftModel::IndexModelLivery));
|
|
||||||
m_columns.addColumn(
|
m_columns.addColumn(
|
||||||
CColumn("DB", "DB metadata", CAircraftModel::IndexDatabaseIcon, new CPixmapFormatter()));
|
CColumn("DB", "DB metadata", CAircraftModel::IndexDatabaseIcon, new CPixmapFormatter()));
|
||||||
if (mode == StashModel)
|
if (mode == StashModel)
|
||||||
|
|||||||
@@ -284,8 +284,6 @@ namespace swift::misc::simulation
|
|||||||
case IndexLivery: return m_livery.propertyByIndex(index.copyFrontRemoved());
|
case IndexLivery: return m_livery.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved());
|
case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexMembersDbStatus: return this->getMembersDbStatus();
|
case IndexMembersDbStatus: return this->getMembersDbStatus();
|
||||||
case IndexModelLivery: return QVariant(m_modelLivery);
|
|
||||||
case IndexShortModelString: return QVariant(getShortModelString());
|
|
||||||
default: return CValueObject::propertyByIndex(index);
|
default: return CValueObject::propertyByIndex(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,8 +127,6 @@ namespace swift::misc
|
|||||||
IndexModelModeAsIcon,
|
IndexModelModeAsIcon,
|
||||||
IndexHasQueriedModelString,
|
IndexHasQueriedModelString,
|
||||||
IndexMembersDbStatus,
|
IndexMembersDbStatus,
|
||||||
IndexModelLivery, // MSFS2024
|
|
||||||
IndexShortModelString,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! \copydoc swift::misc::CValueObject::registerMetadata
|
//! \copydoc swift::misc::CValueObject::registerMetadata
|
||||||
|
|||||||
@@ -131,28 +131,28 @@ namespace swift::misc::simulation
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO TZ
|
||||||
QStringList modelDirs = { "", "" };
|
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);
|
emit this->loadingFinished(m_loadingMessages, simulator, LoadingSkipped);
|
||||||
return;
|
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->setObjectInfo(simulator);
|
||||||
this->startLoadingFromDisk(mode, modelConsolidation, modelDirs);
|
this->startLoadingFromDisk(mode, modelConsolidation, modelDirs);
|
||||||
|
|||||||
@@ -444,9 +444,9 @@ namespace swift::simplugin::msfs2024common
|
|||||||
hr += SimConnect_EnumerateSimObjectsAndLiveries(hSimConnect, CSimConnectDefinitions::REQUEST_AIRPLANE,
|
hr += SimConnect_EnumerateSimObjectsAndLiveries(hSimConnect, CSimConnectDefinitions::REQUEST_AIRPLANE,
|
||||||
SIMCONNECT_SIMOBJECT_TYPE_AIRCRAFT);
|
SIMCONNECT_SIMOBJECT_TYPE_AIRCRAFT);
|
||||||
hr += SimConnect_EnumerateSimObjectsAndLiveries(hSimConnect, CSimConnectDefinitions::REQUEST_HELICOPTER,
|
hr += SimConnect_EnumerateSimObjectsAndLiveries(hSimConnect, CSimConnectDefinitions::REQUEST_HELICOPTER,
|
||||||
SIMCONNECT_SIMOBJECT_TYPE_AIRCRAFT);
|
SIMCONNECT_SIMOBJECT_TYPE_HELICOPTER);
|
||||||
// hr += SimConnect_EnumerateSimObjectsAndLiveries(hSimConnect, CSimConnectDefinitions::REQUEST_HOT_AIR,
|
// hr += SimConnect_EnumerateSimObjectsAndLiveries(hSimConnect, CSimConnectDefinitions::REQUEST_HOT_AIR,
|
||||||
// SIMCONNECT_SIMOBJECT_TYPE_AIRCRAFT);
|
// SIMCONNECT_SIMOBJECT_TYPE_HOT_AIR_BALLOON);
|
||||||
|
|
||||||
if (isFailure(hr))
|
if (isFailure(hr))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -448,11 +448,18 @@ namespace swift::simplugin::msfs2024common
|
|||||||
const CSpecializedSimulatorSettings settings = this->getSimulatorSettings();
|
const CSpecializedSimulatorSettings settings = this->getSimulatorSettings();
|
||||||
CSimulatorSettings m_generic = settings.getGenericSettings();
|
CSimulatorSettings m_generic = settings.getGenericSettings();
|
||||||
QStringList excludePatterns = m_generic.getModelExcludeDirectoryPatterns();
|
QStringList excludePatterns = m_generic.getModelExcludeDirectoryPatterns();
|
||||||
|
QStringList filterList = m_generic.getModelDirectories();
|
||||||
|
|
||||||
bool gui_application = true;
|
bool gui_application = true;
|
||||||
|
bool useFilterList = true;
|
||||||
|
bool matchFilter = false;
|
||||||
|
|
||||||
QString guiName = sGui->getApplicationName();
|
QString guiName = sGui->getApplicationName();
|
||||||
if (guiName.contains("mapping")) gui_application = false;
|
if (guiName.contains("mapping")) gui_application = false;
|
||||||
|
|
||||||
|
const CAircraftMatcherSetup setup = m_matchingSettings.get();
|
||||||
|
bool skipExcluded = setup.getMatchingMode().testFlag(CAircraftMatcherSetup::ExcludeNoExcluded);
|
||||||
|
|
||||||
CAircraftModelList newModels;
|
CAircraftModelList newModels;
|
||||||
|
|
||||||
for (int i = 0; i < static_cast<int>(vSimObjectsAndLiveries.size()); ++i)
|
for (int i = 0; i < static_cast<int>(vSimObjectsAndLiveries.size()); ++i)
|
||||||
@@ -463,6 +470,9 @@ namespace swift::simplugin::msfs2024common
|
|||||||
CAircraftModel modelFromDb =
|
CAircraftModel modelFromDb =
|
||||||
sGui->getWebDataServices()->getModelForModelString(modelLivery.szSimObjectCombinedTitle.trimmed());
|
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
|
// If the model is in the database, there is a DbKey
|
||||||
int modelkey = modelFromDb.getDbKey();
|
int modelkey = modelFromDb.getDbKey();
|
||||||
if (modelkey) model = modelFromDb; // copy all data from db
|
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 (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);
|
newModels.replaceOrAddModelWithString(model, Qt::CaseInsensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,7 +538,7 @@ namespace swift::simplugin::msfs2024common
|
|||||||
bool givenDistributorsOnly = false;
|
bool givenDistributorsOnly = false;
|
||||||
bool dbDataOnly = false;
|
bool dbDataOnly = false;
|
||||||
bool dbIcaoOnly = false;
|
bool dbIcaoOnly = false;
|
||||||
bool incremnental = true;
|
bool incremnental = false;
|
||||||
bool sortByDistributor = true;
|
bool sortByDistributor = true;
|
||||||
bool consolidateWithDb = false;
|
bool consolidateWithDb = false;
|
||||||
bool ShowAllInstalledModells = true; // msfs20424 always show all installed models
|
bool ShowAllInstalledModells = true; // msfs20424 always show all installed models
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#include "misc/simulation/aircraftmodel.h"
|
#include "misc/simulation/aircraftmodel.h"
|
||||||
#include "misc/simulation/data/modelcaches.h" // TODO ???
|
#include "misc/simulation/data/modelcaches.h" // TODO ???
|
||||||
#include "misc/simulation/interpolation/interpolatorlinear.h"
|
#include "misc/simulation/interpolation/interpolatorlinear.h"
|
||||||
|
#include "misc/simulation/settings/modelmatchersettings.h"
|
||||||
#include "misc/simulation/settings/simulatorsettings.h"
|
#include "misc/simulation/settings/simulatorsettings.h"
|
||||||
#include "misc/simulation/simulatedaircraft.h"
|
#include "misc/simulation/simulatedaircraft.h"
|
||||||
#include "misc/simulation/simulatorplugininfo.h"
|
#include "misc/simulation/simulatorplugininfo.h"
|
||||||
@@ -742,6 +743,10 @@ namespace swift::simplugin::msfs2024common
|
|||||||
//! Simulator info
|
//! Simulator info
|
||||||
swift::misc::simulation::CSimulatorInfo m_simulatorInfo;
|
swift::misc::simulation::CSimulatorInfo m_simulatorInfo;
|
||||||
|
|
||||||
|
swift::misc::CSetting<swift::misc::simulation::settings::TModelMatching> m_matchingSettings {
|
||||||
|
this
|
||||||
|
}; //!< settings
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! @{
|
//! @{
|
||||||
//! Offsets
|
//! Offsets
|
||||||
|
|||||||
Reference in New Issue
Block a user