6#ifndef SWIFT_MISC_SIMULATION_IAIRCRAFTMODELLOADER_H
7#define SWIFT_MISC_SIMULATION_IAIRCRAFTMODELLOADER_H
28namespace swift::misc::simulation
62 Q_DECLARE_FLAGS(LoadMode, LoadModeFlag)
77 static const QString &enumToString(LoadFinishedInfo info);
80 static const QString &enumToString(LoadModeFlag modeFlag);
83 static QString enumToString(LoadMode mode);
86 static bool needsCacheSynchronized(LoadMode mode);
177 LoadFinishedInfo info);
203 qint64 m_loadingStartedTs = -1;
207Q_DECLARE_METATYPE(swift::misc::simulation::IAircraftModelLoader::LoadMode)
210Q_DECLARE_OPERATORS_FOR_FLAGS(swift::misc::simulation::IAircraftModelLoader::LoadMode)
Status messages, e.g. from Core -> GUI.
Value object encapsulating a list of aircraft models.
CDummyModelLoader(const CSimulatorInfo &simulator, QObject *parent)
Dummy loader.
bool isLoadingFinished() const
IAircraftModelLoader::isLoadingFinished.
void startLoadingFromDisk(LoadMode mode, const ModelConsolidationCallback &modelConsolidation, const QStringList &modelDirectories)
IAircraftModelLoader::startLoadingFromDisk.
Simple hardcoded info about the corresponding simulator.
void loadingProgress(const CSimulatorInfo &simulator, const QString &message, int progressPercentage)
Loading progress, normally from disk.
std::function< int(swift::misc::simulation::CAircraftModelList &, bool)> ModelConsolidationCallback
Callback to consolidate data, normally with DB data.
~IAircraftModelLoader()=default
Destructor.
std::atomic< bool > m_cancelLoading
flag, requesting to cancel loading
void cacheChanged(const CSimulatorInfo &simulator)
Relayed from centralized caches.
QStringList getInitializedModelDirectories(const QStringList &modelDirectories, const CSimulatorInfo &simulator) const
Get model directories from settings if empty, otherwise checked and UNC path fixed.
void loadingFinished(const CStatusMessageList &status, const CSimulatorInfo &simulator, IAircraftModelLoader::LoadFinishedInfo info)
Parsing is finished or cache has been loaded.
const CSimulatorInfo m_simulator
related simulator
const CSimulatorInfo & getSimulator() const
Simulator.
void startLoading(LoadMode mode=InBackgroundWithCache, const ModelConsolidationCallback &modelConsolidation={}, const QStringList &modelDirectories={})
Start the loading process from disk. Optional DB models can be passed and used for data consolidation...
QString getFirstModelDirectoryOrDefault() const
First directory, can be used when only 1 directory is expected.
static const QStringList & getLogCategories()
Log categories.
bool hasCachedData() const
Any cached data?
bool supportsSimulator(const CSimulatorInfo &simulator) const
Supported simulator.
void diskLoadingStarted(const CSimulatorInfo &simulator, IAircraftModelLoader::LoadMode loadMode)
Disk loading started.
QStringList getModelExcludeDirectoryPatterns() const
Exclude directories.
bool isLoadingInProgress() const
Loading in progress.
settings::CMultiSimulatorSettings m_settings
settings
IAircraftModelLoader(const CSimulatorInfo &simulator, QObject *parent=nullptr)
Constructor.
virtual bool isLoadingFinished() const =0
Loading finished?
std::atomic< bool > m_loadingInProgress
loading in progress
virtual void startLoadingFromDisk(LoadMode mode, const ModelConsolidationCallback &modelConsolidation, const QStringList &modelDirectories)=0
Start the loading process from disk.
static bool isLoadedInfo(LoadFinishedInfo info)
Loaded info.
LoadFinishedInfo
Load mode.
@ LoadingFailed
loading failed
@ CacheLoaded
cache was loaded
@ LoadingSkipped
loading skipped (empty directory)
CStatusMessageList m_loadingMessages
loading messages
@ CacheOnly
only read cache, never load from disk
@ LoadInBackground
load in background, asyncronously
@ InBackgroundWithCache
Background, cached.
@ InBackgroundNoCache
Background, not checking cache.
@ CacheFirst
always use cache (if it has data)
@ LoadDirectly
load synchronously (blocking), normally for testing
@ CacheSkipped
ignore cache
QStringList getModelDirectoriesOrDefault() const
Model directories.
std::atomic< bool > m_skipLoadingEmptyModelDir
loading empty model dirs might erase the cache, so normally we skip it
Interface to "something" backing models, which can be set.
Interface to "something" backing models, which can be modified (updated).
Interface to "something" backing models, which can be set.
IModelsSetable()=default
Ctor, dtor, copy operators (CLANG warnings).
Interface to "something" backing models, which can be modified (updated).
IModelsUpdatable()=default
Ctor, dtor, copy operators (CLANG warnings).
Basically a QObject free (delegate based) version of CCentralMultiSimulatorModelCachesProvider.
Bundle of settings for all simulators.
QObject * parent() const const
#define SWIFT_MISC_EXPORT
Export a class or function from the library.