@@ -3,6 +3,8 | |||
|
3 | 3 | |
|
4 | 4 | #include <memory> |
|
5 | 5 | |
|
6 | #include <QObject> | |
|
7 | ||
|
6 | 8 | class DataProviderParameters; |
|
7 | 9 | class IDataSeries; |
|
8 | 10 | |
@@ -22,4 +24,7 public: | |||
|
22 | 24 | retrieveData(const DataProviderParameters ¶meters) const = 0; |
|
23 | 25 | }; |
|
24 | 26 | |
|
27 | // Required for using shared_ptr in signals/slots | |
|
28 | Q_DECLARE_METATYPE(std::shared_ptr<IDataProvider>) | |
|
29 | ||
|
25 | 30 | #endif // SCIQLOP_IDATAPROVIDER_H |
@@ -71,6 +71,15 signals: | |||
|
71 | 71 | /// Signal emitted when a structure has been set for a data source |
|
72 | 72 | void dataSourceItemSet(DataSourceItem *dataSourceItem); |
|
73 | 73 | |
|
74 | /** | |
|
75 | * Signal emitted when a variable creation is asked for a product | |
|
76 | * @param variableName the name of the variable | |
|
77 | * @param variableProvider the provider that will be used to retrieve the data of the variable | |
|
78 | * (can be null) | |
|
79 | */ | |
|
80 | void variableCreationRequested(const QString &variableName, | |
|
81 | std::shared_ptr<IDataProvider> variableProvider); | |
|
82 | ||
|
74 | 83 | private: |
|
75 | 84 | void waitForFinish(); |
|
76 | 85 |
@@ -86,6 +86,9 void DataSourceController::loadProductItem(const QUuid &dataSourceUid, | |||
|
86 | 86 | /// Retrieves the data provider of the data source (if any) |
|
87 | 87 | auto it = impl->m_DataProviders.find(dataSourceUid); |
|
88 | 88 | auto dataProvider = (it != impl->m_DataProviders.end()) ? it->second : nullptr; |
|
89 | ||
|
90 | /// @todo retrieve timerange, and pass it to the signal | |
|
91 | emit variableCreationRequested(productItem.name(), dataProvider); | |
|
89 | 92 | } |
|
90 | 93 | else { |
|
91 | 94 | qCWarning(LOG_DataSourceController()) << tr("Can't load an item that is not a product"); |
@@ -1,5 +1,6 | |||
|
1 | 1 | #include "SqpApplication.h" |
|
2 | 2 | |
|
3 | #include <Data/IDataProvider.h> | |
|
3 | 4 | #include <DataSource/DataSourceController.h> |
|
4 | 5 | #include <QThread> |
|
5 | 6 | #include <Variable/VariableController.h> |
@@ -14,6 +15,17 public: | |||
|
14 | 15 | m_VariableController{std::make_unique<VariableController>()}, |
|
15 | 16 | m_VisualizationController{std::make_unique<VisualizationController>()} |
|
16 | 17 | { |
|
18 | // /////////////////////////////// // | |
|
19 | // Connections between controllers // | |
|
20 | // /////////////////////////////// // | |
|
21 | ||
|
22 | // VariableController <-> DataSourceController | |
|
23 | qRegisterMetaType<std::shared_ptr<IDataProvider> >(); | |
|
24 | connect(m_DataSourceController.get(), | |
|
25 | SIGNAL(variableCreationRequested(const QString &, std::shared_ptr<IDataProvider>)), | |
|
26 | m_VariableController.get(), | |
|
27 | SLOT(createVariable(const QString &, std::shared_ptr<IDataProvider>))); | |
|
28 | ||
|
17 | 29 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); |
|
18 | 30 | m_VariableController->moveToThread(&m_VariableControllerThread); |
|
19 | 31 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); |
General Comments 0
You need to be logged in to leave comments.
Login now