refs #907, model interface

* extended interface, function to get simulator
* made CDbMappingComponentAware an interface
* public getMappingComponent
This commit is contained in:
Klaus Basan
2017-03-09 22:47:17 +01:00
committed by Mathew Sutcliffe
parent 1153f70776
commit 60a937b5b6
5 changed files with 25 additions and 8 deletions

View File

@@ -36,6 +36,7 @@ namespace BlackGui
public BlackCore::IProgressIndicator public BlackCore::IProgressIndicator
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(BlackGui::Components::CDbMappingComponentAware)
public: public:
//! Current state of this component //! Current state of this component
@@ -50,7 +51,7 @@ namespace BlackGui
explicit CDbAutoSimulatorStashingComponent(QWidget *parent = nullptr); explicit CDbAutoSimulatorStashingComponent(QWidget *parent = nullptr);
//! Destructor //! Destructor
~CDbAutoSimulatorStashingComponent(); virtual ~CDbAutoSimulatorStashingComponent();
//! At least run once and completed //! At least run once and completed
bool isCompleted() const { return m_state == Completed; } bool isCompleted() const { return m_state == Completed; }

View File

@@ -45,6 +45,7 @@ namespace BlackGui
public BlackCore::IProgressIndicator public BlackCore::IProgressIndicator
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(BlackGui::Components::CDbMappingComponentAware)
public: public:
//! Current state of this component //! Current state of this component
@@ -62,7 +63,7 @@ namespace BlackGui
explicit CDbAutoStashingComponent(QWidget *parent = nullptr); explicit CDbAutoStashingComponent(QWidget *parent = nullptr);
//! Destructor //! Destructor
~CDbAutoStashingComponent(); virtual ~CDbAutoStashingComponent();
//! At least run once and completed //! At least run once and completed
bool isCompleted() const { return m_state == Completed; } bool isCompleted() const { return m_state == Completed; }

View File

@@ -13,8 +13,7 @@
#define BLACKGUI_COMPONENTS_DBMAPPINGCOMPONENTAWARE_H #define BLACKGUI_COMPONENTS_DBMAPPINGCOMPONENTAWARE_H
#include "blackgui/blackguiexport.h" #include "blackgui/blackguiexport.h"
#include <QObject>
class QObject;
namespace BlackGui namespace BlackGui
{ {
@@ -29,16 +28,19 @@ namespace BlackGui
//! Set the corresponding component //! Set the corresponding component
virtual void setMappingComponent(CDbMappingComponent *component); virtual void setMappingComponent(CDbMappingComponent *component);
//! Get the mapping component
CDbMappingComponent *getMappingComponent() const { return m_mappingComponent; }
protected: protected:
//! Constructor //! Constructor
CDbMappingComponentAware(QObject *parent); CDbMappingComponentAware(QObject *parent);
//! Get the mapping component
CDbMappingComponent *getMappingComponent() const { return m_mappingComponent; }
private : private :
CDbMappingComponent *m_mappingComponent = nullptr; //!< reference to component CDbMappingComponent *m_mappingComponent = nullptr; //!< reference to component
}; };
} // ns } // ns
} // ns } // ns
Q_DECLARE_INTERFACE(BlackGui::Components::CDbMappingComponentAware, "org.swift-project.blackgui.components.dbmappingcomponentaware")
#endif // guard #endif // guard

View File

@@ -49,13 +49,16 @@ namespace BlackGui
public BlackMisc::Simulation::IModelsSetable, public BlackMisc::Simulation::IModelsSetable,
public BlackMisc::Simulation::IModelsUpdatable, public BlackMisc::Simulation::IModelsUpdatable,
public BlackMisc::Simulation::IModelsPerSimulatorSetable, public BlackMisc::Simulation::IModelsPerSimulatorSetable,
public BlackMisc::Simulation::IModelsPerSimulatorUpdatable public BlackMisc::Simulation::IModelsPerSimulatorUpdatable,
public BlackMisc::Simulation::ISimulatorSelectable
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(BlackGui::Components::CDbMappingComponentAware)
Q_INTERFACES(BlackMisc::Simulation::IModelsSetable) Q_INTERFACES(BlackMisc::Simulation::IModelsSetable)
Q_INTERFACES(BlackMisc::Simulation::IModelsUpdatable) Q_INTERFACES(BlackMisc::Simulation::IModelsUpdatable)
Q_INTERFACES(BlackMisc::Simulation::IModelsPerSimulatorSetable) Q_INTERFACES(BlackMisc::Simulation::IModelsPerSimulatorSetable)
Q_INTERFACES(BlackMisc::Simulation::IModelsPerSimulatorUpdatable) Q_INTERFACES(BlackMisc::Simulation::IModelsPerSimulatorUpdatable)
Q_INTERFACES(BlackMisc::Simulation::ISimulatorSelectable)
public: public:
//! Constructor //! Constructor
@@ -91,6 +94,7 @@ namespace BlackGui
virtual void updateModels(const BlackMisc::Simulation::CAircraftModelList &models) override { this->replaceOrAddModelSet(models, this->getModelSetSimulator()); } virtual void updateModels(const BlackMisc::Simulation::CAircraftModelList &models) override { this->replaceOrAddModelSet(models, this->getModelSetSimulator()); }
virtual void setModels(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator) override { this->setModelSet(models, simulator); } virtual void setModels(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator) override { this->setModelSet(models, simulator); }
virtual void updateModels(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator) override { this->replaceOrAddModelSet(models, simulator); } virtual void updateModels(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator) override { this->replaceOrAddModelSet(models, simulator); }
virtual BlackMisc::Simulation::CSimulatorInfo getSelectedSimulator() const override { return this->getModelSetSimulator(); }
//! @} //! @}
public slots: public slots:

View File

@@ -50,6 +50,14 @@ namespace BlackMisc
//! Set models //! Set models
virtual void updateModels(const CAircraftModelList &models, const CSimulatorInfo &simulator) = 0; virtual void updateModels(const CAircraftModelList &models, const CSimulatorInfo &simulator) = 0;
}; };
//! Interface to "something" allowing a simulator selection
class BLACKMISC_EXPORT ISimulatorSelectable
{
public:
//! Simulator
virtual BlackMisc::Simulation::CSimulatorInfo getSelectedSimulator() const = 0;
};
} // namespace } // namespace
} // namespace } // namespace
@@ -57,5 +65,6 @@ Q_DECLARE_INTERFACE(BlackMisc::Simulation::IModelsSetable, "org.swift-project.bl
Q_DECLARE_INTERFACE(BlackMisc::Simulation::IModelsUpdatable, "org.swift-project.blackmisc.simulation.imodelsupdateable") Q_DECLARE_INTERFACE(BlackMisc::Simulation::IModelsUpdatable, "org.swift-project.blackmisc.simulation.imodelsupdateable")
Q_DECLARE_INTERFACE(BlackMisc::Simulation::IModelsPerSimulatorSetable, "org.swift-project.blackmisc.simulation.imodelspersimulatorsetable") Q_DECLARE_INTERFACE(BlackMisc::Simulation::IModelsPerSimulatorSetable, "org.swift-project.blackmisc.simulation.imodelspersimulatorsetable")
Q_DECLARE_INTERFACE(BlackMisc::Simulation::IModelsPerSimulatorUpdatable, "org.swift-project.blackmisc.simulation.imodelspersimulatorupdatabale") Q_DECLARE_INTERFACE(BlackMisc::Simulation::IModelsPerSimulatorUpdatable, "org.swift-project.blackmisc.simulation.imodelspersimulatorupdatabale")
Q_DECLARE_INTERFACE(BlackMisc::Simulation::ISimulatorSelectable, "org.swift-project.blackmisc.simulation.isimulatorselectable")
#endif // guard #endif // guard