mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
refs #834, improved default value for last set/models simulator
Remark: The bug itself was slightly related to the default value, as only the default loader suffered from a not reset flag
This commit is contained in:
@@ -80,6 +80,10 @@ namespace BlackMisc
|
||||
//! Loading finished?
|
||||
virtual bool isLoadingFinished() const = 0;
|
||||
|
||||
//! Loading in progress
|
||||
//! \threadsafe
|
||||
bool isLoadingInProgress() const { return m_loadingInProgress; }
|
||||
|
||||
//! Get the loaded models
|
||||
//! \threadsafe
|
||||
BlackMisc::Simulation::CAircraftModelList getAircraftModels() const;
|
||||
@@ -166,7 +170,7 @@ namespace BlackMisc
|
||||
//! Start the loading process from disk
|
||||
virtual void startLoadingFromDisk(LoadMode mode, const ModelConsolidation &modelConsolidation, const QString &directory) = 0;
|
||||
|
||||
std::atomic<bool> m_cancelLoading { false }; //!< flag
|
||||
std::atomic<bool> m_cancelLoading { false }; //!< flag, requesting to cancel loading
|
||||
std::atomic<bool> m_loadingInProgress { false }; //!< Loading in progress
|
||||
BlackMisc::Simulation::Data::CModelCaches m_caches { false, this }; //!< caches
|
||||
BlackMisc::Simulation::CMultiSimulatorSettings m_settings { this }; //!< settings
|
||||
|
||||
@@ -69,16 +69,12 @@ namespace BlackMisc
|
||||
//! Last selection
|
||||
struct TModelCacheLastSelection : public BlackMisc::TDataTrait<BlackMisc::Simulation::CSimulatorInfo>
|
||||
{
|
||||
//! Default value
|
||||
static const BlackMisc::Simulation::CSimulatorInfo &defaultValue()
|
||||
{
|
||||
static const BlackMisc::Simulation::CSimulatorInfo s(BlackMisc::Simulation::CSimulatorInfo::guessDefaultSimulator());
|
||||
return s;
|
||||
}
|
||||
|
||||
//! First load is synchronous
|
||||
static constexpr bool isPinned() { return true; }
|
||||
|
||||
//! Default simulator
|
||||
static const BlackMisc::Simulation::CSimulatorInfo &defaultValue() { return CSimulatorInfo::guessDefaultSimulator(); }
|
||||
|
||||
//! Key
|
||||
static const char *key() { return "modelcachelastselection"; }
|
||||
};
|
||||
@@ -118,16 +114,12 @@ namespace BlackMisc
|
||||
//! Last selection
|
||||
struct TModelSetLastSelection : public BlackMisc::TDataTrait<BlackMisc::Simulation::CSimulatorInfo>
|
||||
{
|
||||
//! Default value
|
||||
static const BlackMisc::Simulation::CSimulatorInfo &defaultValue()
|
||||
{
|
||||
static const BlackMisc::Simulation::CSimulatorInfo s(BlackMisc::Simulation::CSimulatorInfo::guessDefaultSimulator());
|
||||
return s;
|
||||
}
|
||||
|
||||
//! First load is synchronous
|
||||
static constexpr bool isPinned() { return true; }
|
||||
|
||||
//! Default simulator
|
||||
static const BlackMisc::Simulation::CSimulatorInfo &defaultValue() { return CSimulatorInfo::guessDefaultSimulator(); }
|
||||
|
||||
//! Key
|
||||
static const char *key() { return "modelsetlastselection"; }
|
||||
};
|
||||
|
||||
@@ -230,9 +230,10 @@ namespace BlackMisc
|
||||
return sim;
|
||||
}
|
||||
|
||||
const CSimulatorInfo CSimulatorInfo::guessDefaultSimulator()
|
||||
//! \cond PRIVATE
|
||||
CSimulatorInfo guessDefaultSimulatorImpl()
|
||||
{
|
||||
CSimulatorInfo locallyInstalled(getLocallyInstalledSimulators());
|
||||
static const CSimulatorInfo locallyInstalled(CSimulatorInfo::getLocallyInstalledSimulators());
|
||||
if (CBuildConfig::isRunningOnLinuxPlatform())
|
||||
{
|
||||
return CSimulatorInfo("XPLANE");
|
||||
@@ -242,8 +243,16 @@ namespace BlackMisc
|
||||
if (locallyInstalled.fs9()) { return CSimulatorInfo("FS9"); }
|
||||
|
||||
// fallback
|
||||
return CSimulatorInfo("FSX");
|
||||
return CSimulatorInfo("P3D");
|
||||
}
|
||||
//! \endcond
|
||||
|
||||
const CSimulatorInfo &CSimulatorInfo::guessDefaultSimulator()
|
||||
{
|
||||
static const CSimulatorInfo sim(guessDefaultSimulatorImpl());
|
||||
return sim;
|
||||
}
|
||||
|
||||
|
||||
CSimulatorInfo CSimulatorInfo::fromDatabaseJson(const QJsonObject &json, const QString prefix)
|
||||
{
|
||||
|
||||
@@ -162,8 +162,8 @@ namespace BlackMisc
|
||||
//! Locally installed simulators
|
||||
static const CSimulatorInfo getLocallyInstalledSimulators();
|
||||
|
||||
//! Guess a default simulator
|
||||
static const CSimulatorInfo guessDefaultSimulator();
|
||||
//! Guess a default simulator based on installation
|
||||
static const CSimulatorInfo &guessDefaultSimulator();
|
||||
|
||||
//! From database JSON
|
||||
static CSimulatorInfo fromDatabaseJson(const QJsonObject &json, const QString prefix);
|
||||
|
||||
Reference in New Issue
Block a user