mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
refs #409 Rename ISimulatorModelMappings to IModelMappingsProvider
The reason is that the previous name sounded more like a value object. But instead it does read the mappings from somwhere.
This commit is contained in:
@@ -25,11 +25,11 @@ namespace BlackMisc
|
||||
{
|
||||
CAircraftMapper::CAircraftMapper(QObject *parent) : QObject(parent) { }
|
||||
|
||||
CAircraftMapper::CAircraftMapper(std::unique_ptr<ISimulatorModelMappings> mappings, QObject *parent) :
|
||||
CAircraftMapper::CAircraftMapper(std::unique_ptr<IModelMappingsProvider> mappings, QObject *parent) :
|
||||
QObject(parent), m_mappings(mappings.release())
|
||||
{ }
|
||||
|
||||
CAircraftMapper::CAircraftMapper(std::unique_ptr<ISimulatorModelMappings> mappings, const QString &simObjectsDir, QObject *parent) :
|
||||
CAircraftMapper::CAircraftMapper(std::unique_ptr<IModelMappingsProvider> mappings, const QString &simObjectsDir, QObject *parent) :
|
||||
QObject(parent), m_mappings(mappings.release())
|
||||
{
|
||||
this->m_entries.changeDirectory(simObjectsDir);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "aircraftcfgentrieslist.h"
|
||||
#include "../simulatormodelmappings.h"
|
||||
#include "blackmisc/simulation/modelmappingsprovider.h"
|
||||
#include "blackmisc/worker.h"
|
||||
#include <QObject>
|
||||
#include <QScopedPointer>
|
||||
@@ -51,10 +51,10 @@ namespace BlackMisc
|
||||
CAircraftMapper(QObject *parent = nullptr);
|
||||
|
||||
//! Constructor, handing over ownership or mappings object
|
||||
CAircraftMapper(std::unique_ptr<ISimulatorModelMappings> mappings, QObject *parent = nullptr);
|
||||
CAircraftMapper(std::unique_ptr<IModelMappingsProvider> mappings, QObject *parent = nullptr);
|
||||
|
||||
//! Constructor, handing over ownership or mappings object
|
||||
CAircraftMapper(std::unique_ptr<ISimulatorModelMappings> mappings, const QString &simObjectsDir, QObject *parent = nullptr);
|
||||
CAircraftMapper(std::unique_ptr<IModelMappingsProvider> mappings, const QString &simObjectsDir, QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CAircraftMapper();
|
||||
@@ -109,7 +109,7 @@ namespace BlackMisc
|
||||
static const BlackMisc::Simulation::CAircraftModel &getDefaultModel();
|
||||
|
||||
private:
|
||||
QScopedPointer<BlackMisc::Simulation::ISimulatorModelMappings> m_mappings; //!< all mapping definitions
|
||||
QScopedPointer<BlackMisc::Simulation::IModelMappingsProvider> m_mappings; //!< all mapping definitions
|
||||
CAircraftCfgEntriesList m_entries; //!< all entries
|
||||
bool m_init = false;
|
||||
bool m_initInProgress = false;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "vpilotmodelmappings.h"
|
||||
#include "modelmappingsprovidervpilot.h"
|
||||
#include "blackmisc/network/aircraftmapping.h"
|
||||
|
||||
#include <QtXml/QDomElement>
|
||||
@@ -24,19 +24,19 @@ namespace BlackMisc
|
||||
namespace FsCommon
|
||||
{
|
||||
|
||||
CVPilotModelMappings::CVPilotModelMappings(bool standardDirectory, QObject *parent) :
|
||||
ISimulatorModelMappings(parent)
|
||||
CModelMappingsProviderVPilot::CModelMappingsProviderVPilot(bool standardDirectory, QObject *parent) :
|
||||
IModelMappingsProvider(parent)
|
||||
{
|
||||
if (standardDirectory) { this->addDirectory(CVPilotModelMappings::standardMappingsDirectory()); }
|
||||
if (standardDirectory) { this->addDirectory(CModelMappingsProviderVPilot::standardMappingsDirectory()); }
|
||||
}
|
||||
|
||||
void CVPilotModelMappings::addFilename(const QString &fileName)
|
||||
void CModelMappingsProviderVPilot::addFilename(const QString &fileName)
|
||||
{
|
||||
if (this->m_fileList.contains(fileName)) return;
|
||||
this->m_fileList.append(fileName);
|
||||
}
|
||||
|
||||
void CVPilotModelMappings::addDirectory(const QString &directory)
|
||||
void CModelMappingsProviderVPilot::addDirectory(const QString &directory)
|
||||
{
|
||||
QDir dir(directory);
|
||||
if (!dir.exists()) return;
|
||||
@@ -48,7 +48,7 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
const QString &CVPilotModelMappings::standardMappingsDirectory()
|
||||
const QString &CModelMappingsProviderVPilot::standardMappingsDirectory()
|
||||
{
|
||||
static QString directory;
|
||||
if (directory.isEmpty())
|
||||
@@ -60,7 +60,7 @@ namespace BlackMisc
|
||||
return directory;
|
||||
}
|
||||
|
||||
bool CVPilotModelMappings::read()
|
||||
bool CModelMappingsProviderVPilot::read()
|
||||
{
|
||||
bool success = true;
|
||||
this->m_loadedFiles = 0;
|
||||
@@ -75,7 +75,7 @@ namespace BlackMisc
|
||||
return success;
|
||||
}
|
||||
|
||||
bool CVPilotModelMappings::loadFile(const QString &fileName)
|
||||
bool CModelMappingsProviderVPilot::loadFile(const QString &fileName)
|
||||
{
|
||||
QFile f(fileName);
|
||||
if (!f.exists()) { return false; }
|
||||
@@ -13,7 +13,7 @@
|
||||
#define BLACKMISC_SIMULATION_FSCOMMON_VPILOTMODELMAPPINGS_H
|
||||
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
#include "../simulatormodelmappings.h"
|
||||
#include "blackmisc/simulation/modelmappingsprovider.h"
|
||||
#include <QStringList>
|
||||
|
||||
namespace BlackMisc
|
||||
@@ -23,14 +23,14 @@ namespace BlackMisc
|
||||
namespace FsCommon
|
||||
{
|
||||
//! Model mappings
|
||||
class BLACKMISC_EXPORT CVPilotModelMappings : public ISimulatorModelMappings
|
||||
class BLACKMISC_EXPORT CModelMappingsProviderVPilot : public IModelMappingsProvider
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CVPilotModelMappings(bool standardDirectory, QObject *parent = nullptr);
|
||||
CModelMappingsProviderVPilot(bool standardDirectory, QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CVPilotModelMappings() {}
|
||||
virtual ~CModelMappingsProviderVPilot() {}
|
||||
|
||||
//! File names
|
||||
void addFilename(const QString &fileName);
|
||||
@@ -7,7 +7,7 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "simulatormodelmappings.h"
|
||||
#include "modelmappingsprovider.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
@@ -17,24 +17,24 @@ namespace BlackMisc
|
||||
namespace Simulation
|
||||
{
|
||||
|
||||
ISimulatorModelMappings::ISimulatorModelMappings(QObject *parent) : QObject(parent) {}
|
||||
IModelMappingsProvider::IModelMappingsProvider(QObject *parent) : QObject(parent) {}
|
||||
|
||||
int ISimulatorModelMappings::size() const
|
||||
int IModelMappingsProvider::size() const
|
||||
{
|
||||
return this->m_mappings.size();
|
||||
}
|
||||
|
||||
bool ISimulatorModelMappings::isEmpty() const
|
||||
bool IModelMappingsProvider::isEmpty() const
|
||||
{
|
||||
return this->m_mappings.isEmpty();
|
||||
}
|
||||
|
||||
const CAircraftMappingList &ISimulatorModelMappings::getMappingList() const
|
||||
const CAircraftMappingList &IModelMappingsProvider::getMappingList() const
|
||||
{
|
||||
return this->m_mappings;
|
||||
}
|
||||
|
||||
int ISimulatorModelMappings::synchronizeWithExistingModels(const QStringList &modelNames, Qt::CaseSensitivity cs)
|
||||
int IModelMappingsProvider::synchronizeWithExistingModels(const QStringList &modelNames, Qt::CaseSensitivity cs)
|
||||
{
|
||||
if (modelNames.isEmpty() || this->m_mappings.isEmpty()) { return this->m_mappings.size(); }
|
||||
CAircraftMappingList newList;
|
||||
@@ -22,16 +22,16 @@ namespace BlackMisc
|
||||
{
|
||||
//! Model mappings interface, different mapping readers (e.g. from database, from vPilot data files)
|
||||
//! can implement this, but provide the same mapping list.
|
||||
class BLACKMISC_EXPORT ISimulatorModelMappings : public QObject
|
||||
class BLACKMISC_EXPORT IModelMappingsProvider : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
ISimulatorModelMappings(QObject *parent = nullptr);
|
||||
IModelMappingsProvider(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~ISimulatorModelMappings() {}
|
||||
virtual ~IModelMappingsProvider() {}
|
||||
|
||||
//! Load data
|
||||
virtual bool read() = 0;
|
||||
Reference in New Issue
Block a user