##// END OF EJS Templates
Makes the connection between Data source controller and Variable controller...
Alexandre Leroux -
r169:90c64bed8482
parent child
Show More
@@ -3,6 +3,8
3
3
4 #include <memory>
4 #include <memory>
5
5
6 #include <QObject>
7
6 class DataProviderParameters;
8 class DataProviderParameters;
7 class IDataSeries;
9 class IDataSeries;
8
10
@@ -22,4 +24,7 public:
22 retrieveData(const DataProviderParameters &parameters) const = 0;
24 retrieveData(const DataProviderParameters &parameters) 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 #endif // SCIQLOP_IDATAPROVIDER_H
30 #endif // SCIQLOP_IDATAPROVIDER_H
@@ -71,6 +71,15 signals:
71 /// Signal emitted when a structure has been set for a data source
71 /// Signal emitted when a structure has been set for a data source
72 void dataSourceItemSet(DataSourceItem *dataSourceItem);
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 private:
83 private:
75 void waitForFinish();
84 void waitForFinish();
76
85
@@ -86,6 +86,9 void DataSourceController::loadProductItem(const QUuid &dataSourceUid,
86 /// Retrieves the data provider of the data source (if any)
86 /// Retrieves the data provider of the data source (if any)
87 auto it = impl->m_DataProviders.find(dataSourceUid);
87 auto it = impl->m_DataProviders.find(dataSourceUid);
88 auto dataProvider = (it != impl->m_DataProviders.end()) ? it->second : nullptr;
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 else {
93 else {
91 qCWarning(LOG_DataSourceController()) << tr("Can't load an item that is not a product");
94 qCWarning(LOG_DataSourceController()) << tr("Can't load an item that is not a product");
@@ -1,5 +1,6
1 #include "SqpApplication.h"
1 #include "SqpApplication.h"
2
2
3 #include <Data/IDataProvider.h>
3 #include <DataSource/DataSourceController.h>
4 #include <DataSource/DataSourceController.h>
4 #include <QThread>
5 #include <QThread>
5 #include <Variable/VariableController.h>
6 #include <Variable/VariableController.h>
@@ -14,6 +15,17 public:
14 m_VariableController{std::make_unique<VariableController>()},
15 m_VariableController{std::make_unique<VariableController>()},
15 m_VisualizationController{std::make_unique<VisualizationController>()}
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 m_DataSourceController->moveToThread(&m_DataSourceControllerThread);
29 m_DataSourceController->moveToThread(&m_DataSourceControllerThread);
18 m_VariableController->moveToThread(&m_VariableControllerThread);
30 m_VariableController->moveToThread(&m_VariableControllerThread);
19 m_VisualizationController->moveToThread(&m_VisualizationControllerThread);
31 m_VisualizationController->moveToThread(&m_VisualizationControllerThread);
General Comments 0
You need to be logged in to leave comments. Login now