refs #889, log categories

This commit is contained in:
Klaus Basan
2017-02-25 16:34:31 +01:00
committed by Mathew Sutcliffe
parent 2c2a043e40
commit ff0c37ff58
8 changed files with 72 additions and 0 deletions

View File

@@ -76,6 +76,12 @@ namespace BlackGui
// void // void
} }
const CLogCategoryList &CDbOwnModelsComponent::getLogCategories()
{
static const CLogCategoryList l({ CLogCategory::modelGui(), CLogCategory::guiComponent() });
return l;
}
CAircraftModelView *CDbOwnModelsComponent::view() const CAircraftModelView *CDbOwnModelsComponent::view() const
{ {
return ui->tvp_OwnAircraftModels; return ui->tvp_OwnAircraftModels;

View File

@@ -64,6 +64,9 @@ namespace BlackGui
//! Destructor //! Destructor
virtual ~CDbOwnModelsComponent(); virtual ~CDbOwnModelsComponent();
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
//! Own (installed) model for given model string //! Own (installed) model for given model string
BlackMisc::Simulation::CAircraftModel getOwnModelForModelString(const QString &modelString) const; BlackMisc::Simulation::CAircraftModel getOwnModelForModelString(const QString &modelString) const;

View File

@@ -131,6 +131,34 @@ namespace BlackMisc
return cat; return cat;
} }
//! Model loader
static const CLogCategory &modelLoader()
{
static const CLogCategory cat { "swift.modelloader" };
return cat;
}
//! Model cache
static const CLogCategory &modelCache()
{
static const CLogCategory cat { "swift.modelcache" };
return cat;
}
//! Model set cache
static const CLogCategory &modelSetCache()
{
static const CLogCategory cat { "swift.modelsetcache" };
return cat;
}
//! Model UI
static const CLogCategory &modelGui()
{
static const CLogCategory cat { "swift.modelui" };
return cat;
}
//! Plugin //! Plugin
static const CLogCategory &plugin() static const CLogCategory &plugin()
{ {
@@ -209,6 +237,10 @@ namespace BlackMisc
guiComponent(), guiComponent(),
mapping(), mapping(),
matching(), matching(),
modelLoader(),
modelCache(),
modelSetCache(),
modelGui(),
network(), network(),
plugin(), plugin(),
swiftDbWebservice(), swiftDbWebservice(),

View File

@@ -35,6 +35,10 @@ namespace BlackMisc
{ "background task", exactMatch(CLogCategory::worker()) }, { "background task", exactMatch(CLogCategory::worker()) },
{ "model mapping", exactMatch(CLogCategory::mapping()) }, { "model mapping", exactMatch(CLogCategory::mapping()) },
{ "model matching", exactMatch(CLogCategory::matching()) }, { "model matching", exactMatch(CLogCategory::matching()) },
{ "model loader", exactMatch(CLogCategory::modelLoader()) },
{ "model cache", exactMatch(CLogCategory::modelCache()) },
{ "model set cache", exactMatch(CLogCategory::modelSetCache()) },
{ "model GUI", exactMatch(CLogCategory::modelGui()) },
{ "network (flight)", exactMatch(CLogCategory::network()) }, { "network (flight)", exactMatch(CLogCategory::network()) },
{ "swift contexts", exactMatch(CLogCategory::context()) }, { "swift contexts", exactMatch(CLogCategory::context()) },
{ "swift context slots", exactMatch(CLogCategory::contextSlot()) }, { "swift context slots", exactMatch(CLogCategory::contextSlot()) },

View File

@@ -41,6 +41,12 @@ namespace BlackMisc
this->gracefulShutdown(); this->gracefulShutdown();
} }
const CLogCategoryList &IAircraftModelLoader::getLogCategories()
{
static const CLogCategoryList cats({ CLogCategory::modelLoader() });
return cats;
}
CStatusMessage IAircraftModelLoader::setCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator) CStatusMessage IAircraftModelLoader::setCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator)
{ {
const CSimulatorInfo sim = simulator.isSingleSimulator() ? simulator : this->getSimulator(); // support default value const CSimulatorInfo sim = simulator.isSingleSimulator() ? simulator : this->getSimulator(); // support default value

View File

@@ -73,6 +73,9 @@ namespace BlackMisc
//! \remark this has to be a abstarct, as DB handling is subject of BlackCore //! \remark this has to be a abstarct, as DB handling is subject of BlackCore
using ModelConsolidation = std::function<int (BlackMisc::Simulation::CAircraftModelList &, bool)>; using ModelConsolidation = std::function<int (BlackMisc::Simulation::CAircraftModelList &, bool)>;
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
//! Start the loading process from disk. //! Start the loading process from disk.
//! Optional DB models can be passed and used for data consolidation. //! Optional DB models can be passed and used for data consolidation.
void startLoading(LoadMode mode = InBackgroundWithCache, const ModelConsolidation &modelConsolidation = {}, const QString &directory = {}); void startLoading(LoadMode mode = InBackgroundWithCache, const ModelConsolidation &modelConsolidation = {}, const QString &directory = {});

View File

@@ -126,6 +126,12 @@ namespace BlackMisc
} }
} }
const CLogCategoryList &CModelCaches::getLogCategories()
{
static const CLogCategoryList l({ CLogCategory::modelCache() });
return l;
}
CAircraftModelList CModelCaches::getCachedModels(const CSimulatorInfo &simulator) const CAircraftModelList CModelCaches::getCachedModels(const CSimulatorInfo &simulator) const
{ {
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator"); Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
@@ -253,6 +259,12 @@ namespace BlackMisc
} }
} }
const CLogCategoryList &CModelSetCaches::getLogCategories()
{
static const CLogCategoryList l({ CLogCategory::modelSetCache() });
return l;
}
CAircraftModelList CModelSetCaches::getCachedModels(const CSimulatorInfo &simulator) const CAircraftModelList CModelSetCaches::getCachedModels(const CSimulatorInfo &simulator) const
{ {
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator"); Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");

View File

@@ -234,6 +234,9 @@ namespace BlackMisc
//! Construtor //! Construtor
CModelCaches(bool synchronizeCache, QObject *parent = nullptr); CModelCaches(bool synchronizeCache, QObject *parent = nullptr);
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
//! \name Interface implementations //! \name Interface implementations
//! @{ //! @{
virtual CAircraftModelList getCachedModels(const BlackMisc::Simulation::CSimulatorInfo &simulator) const override; virtual CAircraftModelList getCachedModels(const BlackMisc::Simulation::CSimulatorInfo &simulator) const override;
@@ -270,6 +273,9 @@ namespace BlackMisc
//! Construtor //! Construtor
CModelSetCaches(bool synchronizeCache, QObject *parent = nullptr); CModelSetCaches(bool synchronizeCache, QObject *parent = nullptr);
//! Log categories
static const BlackMisc::CLogCategoryList &getLogCategories();
//! \name Interface implementations //! \name Interface implementations
//! @{ //! @{
virtual CAircraftModelList getCachedModels(const BlackMisc::Simulation::CSimulatorInfo &simulator) const override; virtual CAircraftModelList getCachedModels(const BlackMisc::Simulation::CSimulatorInfo &simulator) const override;