Ref T246, some upfront formatting

This commit is contained in:
Klaus Basan
2018-02-08 03:14:27 +01:00
parent 33d4cf82ea
commit 887d1ec401
8 changed files with 66 additions and 66 deletions

View File

@@ -201,12 +201,12 @@ namespace BlackMisc
//! Get model directories from settings if empty, otherwise checked and UNC path fixed
QStringList getInitializedModelDirectories(const QStringList &modelDirectories, const CSimulatorInfo &simulator) const;
std::atomic<bool> m_cancelLoading { false }; //!< flag, requesting to cancel loading
std::atomic<bool> m_loadingInProgress { false }; //!< Loading in progress
std::atomic<bool> m_skipLoadingEmptyModelDir { true }; //!< Loading empty model dirs might erase the cache, so normally we skip it
Data::CModelCaches m_caches { false, this }; //!< caches used with this loader
Settings::CMultiSimulatorSettings m_settings { this }; //!< settings
CStatusMessageList m_loadingMessages; //!< loading messages
std::atomic<bool> m_cancelLoading { false }; //!< flag, requesting to cancel loading
std::atomic<bool> m_loadingInProgress { false }; //!< Loading in progress
std::atomic<bool> m_skipLoadingEmptyModelDir { true }; //!< Loading empty model dirs might erase the cache, so normally we skip it
Data::CModelCaches m_caches { false, this }; //!< caches used with this loader
Settings::CMultiSimulatorSettings m_settings { this }; //!< settings
CStatusMessageList m_loadingMessages; //!< loading messages
};
} // ns
} // ns

View File

@@ -18,10 +18,9 @@ namespace BlackMisc
{
namespace Simulation
{
CAircraftModelSetLoader::CAircraftModelSetLoader(QObject *parent) :
QObject(parent)
CAircraftModelSetLoader::CAircraftModelSetLoader(QObject *parent) : QObject(parent)
{
connect(&this->m_caches, &CModelSetCaches::cacheChanged, this, &CAircraftModelSetLoader::cacheChanged);
connect(&m_caches, &CModelSetCaches::cacheChanged, this, &CAircraftModelSetLoader::cacheChanged);
}
CAircraftModelSetLoader::~CAircraftModelSetLoader()
@@ -31,19 +30,19 @@ namespace BlackMisc
CStatusMessage CAircraftModelSetLoader::setCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator)
{
const CSimulatorInfo sim = simulator.isSingleSimulator() ? simulator : this->m_caches.getCurrentSimulator();
const CSimulatorInfo sim = simulator.isSingleSimulator() ? simulator : m_caches.getCurrentSimulator();
if (!sim.isSingleSimulator()) { return CStatusMessage(this, CStatusMessage::SeverityError, "Invalid simulator"); }
const CStatusMessage m(this->m_caches.setCachedModels(models, sim));
const CStatusMessage m(m_caches.setCachedModels(models, sim));
return m;
}
CStatusMessage CAircraftModelSetLoader::replaceOrAddCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator)
{
if (models.isEmpty()) { return CStatusMessage(this, CStatusMessage::SeverityInfo, "No data"); }
const CSimulatorInfo sim = simulator.isSingleSimulator() ? simulator : this->m_caches.getCurrentSimulator();
const CSimulatorInfo sim = simulator.isSingleSimulator() ? simulator : m_caches.getCurrentSimulator();
if (!sim.isSingleSimulator()) { return CStatusMessage(this, CStatusMessage::SeverityError, "Invalid simuataor"); }
this->m_caches.synchronizeCache(sim);
CAircraftModelList allModels(this->m_caches.getSynchronizedCachedModels(sim));
m_caches.synchronizeCache(sim);
CAircraftModelList allModels(m_caches.getSynchronizedCachedModels(sim));
const int c = allModels.replaceOrAddModelsWithString(models, Qt::CaseInsensitive);
if (c > 0)
{
@@ -59,25 +58,25 @@ namespace BlackMisc
{
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Only one simulator per loader");
if (this->getSimulator() == simulator) { return; }
this->m_caches.setCurrentSimulator(simulator);
this->m_caches.synchronizeCurrentCache();
m_caches.setCurrentSimulator(simulator);
m_caches.synchronizeCurrentCache();
emit simulatorChanged(simulator);
}
CAircraftModelList CAircraftModelSetLoader::getAircraftModels() const
{
return this->m_caches.getCurrentCachedModels();
return m_caches.getCurrentCachedModels();
}
CAircraftModelList CAircraftModelSetLoader::getAircraftModels(const CSimulatorInfo &simulator)
{
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
return this->m_caches.getSynchronizedCachedModels(simulator);
return m_caches.getSynchronizedCachedModels(simulator);
}
int CAircraftModelSetLoader::getAircraftModelsCount() const
{
return getAircraftModels().size();
return this->getAircraftModels().size();
}
CAircraftModel CAircraftModelSetLoader::getModelForModelString(const QString &modelString) const
@@ -88,27 +87,27 @@ namespace BlackMisc
CAircraftModelList CAircraftModelSetLoader::getCachedModels(const CSimulatorInfo &simulator) const
{
return this->m_caches.getCachedModels(simulator);
return m_caches.getCachedModels(simulator);
}
QDateTime CAircraftModelSetLoader::getCacheTimestamp() const
{
return this->m_caches.getCurrentCacheTimestamp();
return m_caches.getCurrentCacheTimestamp();
}
bool CAircraftModelSetLoader::synchronizeCache()
{
return this->m_caches.synchronizeCurrentCache();
return m_caches.synchronizeCurrentCache();
}
bool CAircraftModelSetLoader::admitCache()
{
return this->m_caches.admitCurrentCache();
return m_caches.admitCurrentCache();
}
bool CAircraftModelSetLoader::hasCachedData() const
{
return !this->m_caches.getCurrentCachedModels().isEmpty();
return !m_caches.getCurrentCachedModels().isEmpty();
}
CStatusMessage CAircraftModelSetLoader::clearCache()
@@ -118,7 +117,7 @@ namespace BlackMisc
CSimulatorInfo CAircraftModelSetLoader::getSimulator() const
{
return this->m_caches.getCurrentSimulator();
return m_caches.getCurrentSimulator();
}
QString CAircraftModelSetLoader::getSimulatorAsString() const
@@ -133,7 +132,7 @@ namespace BlackMisc
CSimulatorInfo CAircraftModelSetLoader::simulatorsWithInitializedModelSet() const
{
return this->m_caches.simulatorsWithInitializedCache();
return m_caches.simulatorsWithInitializedCache();
}
void CAircraftModelSetLoader::gracefulShutdown()
@@ -143,12 +142,12 @@ namespace BlackMisc
QString CAircraftModelSetLoader::getInfoString() const
{
return this->m_caches.getInfoString();
return m_caches.getInfoString();
}
QString CAircraftModelSetLoader::getInfoStringFsFamily() const
{
return this->m_caches.getInfoStringFsFamily();
return m_caches.getInfoStringFsFamily();
}
} // ns
} // ns

View File

@@ -24,14 +24,13 @@ namespace BlackMisc
namespace Settings
{
//! Settings for models
class BLACKMISC_EXPORT CModelSettings :
public BlackMisc::CValueObject<CModelSettings>
class BLACKMISC_EXPORT CModelSettings : public CValueObject<CModelSettings>
{
public:
//! Properties by index
enum ColumnIndex
{
IndexAllowExclude = BlackMisc::CPropertyIndex::GlobalIndexCSimulatorSettings
IndexAllowExclude = CPropertyIndex::GlobalIndexCSimulatorSettings
};
//! Default constructor
@@ -47,10 +46,10 @@ namespace BlackMisc
QString convertToQString(bool i18n = false) const;
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
BlackMisc::CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
BlackMisc::CVariant propertyByIndex(const CPropertyIndex &index) const;
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const BlackMisc::CVariant &variant);
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
private:
bool m_allowExcludeModels = false; //!< Allow excluded models in sets
@@ -62,7 +61,7 @@ namespace BlackMisc
};
//! Trait for simulator settings
struct TModel : public BlackMisc::TSettingTrait<CModelSettings>
struct TModel : public TSettingTrait<CModelSettings>
{
//! Key in data cache
static const char *key() { return "Models"; }
@@ -72,7 +71,7 @@ namespace BlackMisc
};
//! Mapping preferences for model distributor list
struct TDistributorListPreferences : public BlackMisc::TSettingTrait<BlackMisc::Simulation::CDistributorListPreferences>
struct TDistributorListPreferences : public TSettingTrait<Simulation::CDistributorListPreferences>
{
//! \copydoc BlackCore::TSettingTrait::humanReadable
static const QString &humanReadable() { static const QString name("Distributor preferences"); return name; }

View File

@@ -302,7 +302,7 @@ namespace BlackMisc
case CSimulatorInfo::FS9: return CFsCommonUtil::fs9Dir();
case CSimulatorInfo::FSX: return CFsCommonUtil::fsxDir();
case CSimulatorInfo::P3D: return CFsCommonUtil::p3dDir();
case CSimulatorInfo::XPLANE: return CXPlaneUtil::xplaneRootDir(); //! check XPlane
case CSimulatorInfo::XPLANE: return CXPlaneUtil::xplaneRootDir();
default:
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
break;

View File

@@ -202,8 +202,7 @@ namespace BlackMisc
//! Settings regarding message handling.
//! Driver independent part, related to network
class BLACKMISC_EXPORT CSimulatorMessagesSettings :
public CValueObject<CSimulatorMessagesSettings>
class BLACKMISC_EXPORT CSimulatorMessagesSettings : public CValueObject<CSimulatorMessagesSettings>
{
public:
//! Properties by index