Skip to content

Commit 66acba9

Browse files
committed
feat: enginepower implemented for fsxcommon
1 parent 2519a87 commit 66acba9

63 files changed

Lines changed: 9315 additions & 1333 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/core/context/contextsimulatorimpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ namespace swift::core::context
241241
{
242242
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
243243
if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
244-
if (this->isSimulatorAvailable()) { return; } // if a plugin is loaded, do ignore this
244+
if (this->isSimulatorAvailable() && !simulator.isMSFS2024()) return; // if a plugin is loaded, do ignore this
245245
m_modelSetSimulator.set(simulator);
246246
const CAircraftModelList models = this->getModelSet(); // cache synced
247247
m_aircraftMatcher.setModelSet(models, simulator, false);

src/core/db/databaseutils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ namespace swift::core::db
7575
dbModelModified.updateMissingParts(model);
7676
dbModelModified.setDistributorOrder(distributorOrder);
7777
dbModelModified.setSimulator(dbModel.getSimulator()); // DB simulator settings have priority
78+
dbModelModified.setModelLivery(model.getModelLivery()); // keep local livery settings msfs2024
7879
return dbModelModified;
7980
}
8081

@@ -88,6 +89,7 @@ namespace swift::core::db
8889
{
8990
if (modified) { *modified = true; }
9091
consolidatedModel.setLivery(dbLivery);
92+
consolidatedModel.setModelLivery(model.getModelLivery()); // keep local livery settings msfs2024
9193
}
9294
}
9395
if (!consolidatedModel.getAircraftIcaoCode().hasValidDbKey() && consolidatedModel.hasAircraftDesignator())
@@ -99,6 +101,7 @@ namespace swift::core::db
99101
{
100102
if (modified) { *modified = true; }
101103
consolidatedModel.setAircraftIcaoCode(dbIcao);
104+
consolidatedModel.setModelLivery(model.getModelLivery()); // keep local livery settings msfs2024
102105
}
103106
}
104107

@@ -108,6 +111,7 @@ namespace swift::core::db
108111
{
109112
if (modified) { *modified = true; }
110113
consolidatedModel.setDistributor(dbDistributor);
114+
consolidatedModel.setModelLivery(model.getModelLivery()); // keep local livery settings msfs2024
111115
}
112116
consolidatedModel.updateLocalFileNames(model);
113117
consolidatedModel.setDistributorOrder(distributorOrder);

src/core/modelsetbuilder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ namespace swift::core
4949
}
5050
else
5151
{
52-
// without any information we can not use them
53-
modelSet = modelSet.findWithKnownAircraftDesignator();
52+
if (!options.testFlag(ShowAllInstalledModels))
53+
// without any information we can not use them
54+
modelSet = modelSet.findWithKnownAircraftDesignator();
5455
}
5556

5657
// Include only

src/core/modelsetbuilder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ namespace swift::core
3434
OnlyDbIcaoCodes = 1 << 2,
3535
Incremental = 1 << 3,
3636
SortByDistributors = 1 << 4,
37-
ConsolidateWithDb = 1 << 5
37+
ConsolidateWithDb = 1 << 5,
38+
ShowAllInstalledModels = 1 << 6,
3839
};
3940
Q_DECLARE_FLAGS(Builder, BuilderFlag)
4041

src/gui/components/dbownmodelscomponent.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,22 @@ namespace swift::gui::components
332332
ui->tvp_OwnAircraftModels->updateContainerMaybeAsync(this->getOwnModels());
333333
}
334334

335+
// TODO TZ this is a stub for SimConnect loading
336+
void CDbOwnModelsComponent::loadInstalledModelsSimConnect(const CSimulatorInfo &simulator,
337+
IAircraftModelLoader::LoadMode mode,
338+
const QStringList &modelDirectories)
339+
{
340+
Q_UNUSED(mode);
341+
Q_UNUSED(modelDirectories);
342+
343+
using namespace std::chrono_literals;
344+
const CStatusMessage msg = CLogMessage(this).info(u"Triiger loading models for %1 from SimConnect")
345+
<< simulator.toQString();
346+
this->showOverlayHTMLMessage(msg, 2s);
347+
348+
return;
349+
}
350+
335351
void CDbOwnModelsComponent::loadInstalledModels(const CSimulatorInfo &simulator,
336352
IAircraftModelLoader::LoadMode mode,
337353
const QStringList &modelDirectories)
@@ -512,6 +528,9 @@ namespace swift::gui::components
512528
IAircraftModelLoader::LoadMode mode,
513529
const QStringList &modelDirectories)
514530
{
531+
// TODO TZ add SimConnect loading
532+
if (simulator.isMSFS2024()) this->loadInstalledModelsSimConnect(simulator, mode, modelDirectories);
533+
515534
this->loadInstalledModels(simulator, mode, modelDirectories);
516535
}
517536

src/gui/components/dbownmodelscomponent.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ namespace swift::gui
153153
void ownModelsSimulatorChanged(const swift::misc::simulation::CSimulatorInfo &simulator);
154154

155155
private:
156+
static constexpr std::chrono::milliseconds OverlayMsgTimeout { 5000 }; //!< how long overlay is displayed
157+
156158
QScopedPointer<Ui::CDbOwnModelsComponent> ui;
157159
swift::misc::simulation::IAircraftModelLoader *m_modelLoader =
158160
nullptr; //!< read own aircraft models, aka models on disk
@@ -167,7 +169,12 @@ namespace swift::gui
167169
//! Request own models
168170
void requestOwnModelsUpdate();
169171

170-
//! Load the models
172+
//! Load the models via SimConnect
173+
void loadInstalledModelsSimConnect(const swift::misc::simulation::CSimulatorInfo &simulator,
174+
swift::misc::simulation::IAircraftModelLoader::LoadMode mode,
175+
const QStringList &modelDirectories = {});
176+
177+
//! Load the models via disk
171178
void loadInstalledModels(const swift::misc::simulation::CSimulatorInfo &simulator,
172179
swift::misc::simulation::IAircraftModelLoader::LoadMode mode,
173180
const QStringList &modelDirectories = {});

src/gui/components/mappingcomponent.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ namespace swift::gui::components
333333
}
334334
const CCallsign callsign(this->validateRenderedCallsign());
335335
if (callsign.isEmpty()) { return; }
336+
337+
// Because of msfs2024, the model string contains the combination of title and livery.
336338
const QString modelString = ui->completer_ModelStrings->getModelString();
337339
if (modelString.isEmpty())
338340
{
@@ -375,6 +377,7 @@ namespace swift::gui::components
375377
}
376378

377379
CAircraftModel model(models.front());
380+
// found more than one model?
378381
if (models.size() > 1)
379382
{
380383
if (models.containsModelString(modelString))
@@ -391,8 +394,10 @@ namespace swift::gui::components
391394
model.setModelType(CAircraftModel::TypeManuallySet);
392395
CLogMessage(this).info(u"Requesting changes for '%1'") << callsign.asString();
393396

394-
// enable in any case
397+
// rendering-flag enable in any case
395398
sGui->getIContextNetwork()->updateAircraftEnabled(aircraftFromBackend.getCallsign(), true);
399+
400+
// trigger model change
396401
changed =
397402
sGui->getIContextNetwork()->updateAircraftModel(aircraftFromBackend.getCallsign(), model, identifier());
398403
}

0 commit comments

Comments
 (0)