##// END OF EJS Templates
Sets the name of the plugin for products and components...
Alexandre Leroux -
r1076:9c3bb5e93c54
parent child
Show More
@@ -1,152 +1,154
1 #ifndef SCIQLOP_DATASOURCEITEM_H
1 #ifndef SCIQLOP_DATASOURCEITEM_H
2 #define SCIQLOP_DATASOURCEITEM_H
2 #define SCIQLOP_DATASOURCEITEM_H
3
3
4 #include "CoreGlobal.h"
4 #include "CoreGlobal.h"
5
5
6 #include <Common/spimpl.h>
6 #include <Common/spimpl.h>
7
7
8 #include <QVariant>
8 #include <QVariant>
9 #include <QVector>
9 #include <QVector>
10
10
11 class DataSourceItemAction;
11 class DataSourceItemAction;
12
12
13 /**
13 /**
14 * Possible types of an item
14 * Possible types of an item
15 */
15 */
16 enum class DataSourceItemType { NODE, PRODUCT, COMPONENT };
16 enum class DataSourceItemType { NODE, PRODUCT, COMPONENT };
17
17
18 /**
18 /**
19 * @brief The DataSourceItem class aims to represent a structure element of a data source.
19 * @brief The DataSourceItem class aims to represent a structure element of a data source.
20 * A data source has a tree structure that is made up of a main DataSourceItem object (root)
20 * A data source has a tree structure that is made up of a main DataSourceItem object (root)
21 * containing other DataSourceItem objects (children).
21 * containing other DataSourceItem objects (children).
22 * For each DataSourceItem can be associated a set of data representing it.
22 * For each DataSourceItem can be associated a set of data representing it.
23 */
23 */
24 class SCIQLOP_CORE_EXPORT DataSourceItem {
24 class SCIQLOP_CORE_EXPORT DataSourceItem {
25 public:
25 public:
26 /// Key associated with the name of the item
26 /// Key associated with the name of the item
27 static const QString NAME_DATA_KEY;
27 static const QString NAME_DATA_KEY;
28 /// Key associated with the plugin of the item
29 static const QString PLUGIN_DATA_KEY;
28
30
29 explicit DataSourceItem(DataSourceItemType type, const QString &name);
31 explicit DataSourceItem(DataSourceItemType type, const QString &name);
30 explicit DataSourceItem(DataSourceItemType type, QVariantHash data = {});
32 explicit DataSourceItem(DataSourceItemType type, QVariantHash data = {});
31
33
32 std::unique_ptr<DataSourceItem> clone() const;
34 std::unique_ptr<DataSourceItem> clone() const;
33
35
34 /// @return the actions of the item as a vector
36 /// @return the actions of the item as a vector
35 QVector<DataSourceItemAction *> actions() const noexcept;
37 QVector<DataSourceItemAction *> actions() const noexcept;
36
38
37 /**
39 /**
38 * Adds an action to the item. The item takes ownership of the action, and the action is
40 * Adds an action to the item. The item takes ownership of the action, and the action is
39 * automatically associated to the item
41 * automatically associated to the item
40 * @param action the action to add
42 * @param action the action to add
41 */
43 */
42 void addAction(std::unique_ptr<DataSourceItemAction> action) noexcept;
44 void addAction(std::unique_ptr<DataSourceItemAction> action) noexcept;
43
45
44 /**
46 /**
45 * Adds a child to the item. The item takes ownership of the child.
47 * Adds a child to the item. The item takes ownership of the child.
46 * @param child the child to add
48 * @param child the child to add
47 */
49 */
48 void appendChild(std::unique_ptr<DataSourceItem> child) noexcept;
50 void appendChild(std::unique_ptr<DataSourceItem> child) noexcept;
49
51
50 /**
52 /**
51 * Returns the item's child associated to an index
53 * Returns the item's child associated to an index
52 * @param childIndex the index to search
54 * @param childIndex the index to search
53 * @return a pointer to the child if index is valid, nullptr otherwise
55 * @return a pointer to the child if index is valid, nullptr otherwise
54 */
56 */
55 DataSourceItem *child(int childIndex) const noexcept;
57 DataSourceItem *child(int childIndex) const noexcept;
56
58
57 int childCount() const noexcept;
59 int childCount() const noexcept;
58
60
59 /**
61 /**
60 * Get the data associated to a key
62 * Get the data associated to a key
61 * @param key the key to search
63 * @param key the key to search
62 * @return the data found if key is valid, default QVariant otherwise
64 * @return the data found if key is valid, default QVariant otherwise
63 */
65 */
64 QVariant data(const QString &key) const noexcept;
66 QVariant data(const QString &key) const noexcept;
65
67
66 /// Gets all data
68 /// Gets all data
67 QVariantHash data() const noexcept;
69 QVariantHash data() const noexcept;
68
70
69 /**
71 /**
70 * Merge in the item the source item passed as parameter.
72 * Merge in the item the source item passed as parameter.
71 *
73 *
72 * The merge is done by adding as child of the item the complete tree represented by the source
74 * The merge is done by adding as child of the item the complete tree represented by the source
73 * item. If a part of the tree already exists in the item (based on the name of the nodes), it
75 * item. If a part of the tree already exists in the item (based on the name of the nodes), it
74 * is merged by completing the existing tree by items "leaves" (products, components or nodes
76 * is merged by completing the existing tree by items "leaves" (products, components or nodes
75 * with no child).
77 * with no child).
76 *
78 *
77 * For example, with item representing the tree:
79 * For example, with item representing the tree:
78 * R (root node)
80 * R (root node)
79 * - N1 (node)
81 * - N1 (node)
80 * -- N11 (node)
82 * -- N11 (node)
81 * --- P1 (product)
83 * --- P1 (product)
82 * --- P2 (product)
84 * --- P2 (product)
83 * - N2 (node)
85 * - N2 (node)
84 *
86 *
85 * and the source item representing the tree:
87 * and the source item representing the tree:
86 * N1 (root node)
88 * N1 (root node)
87 * - N11 (node)
89 * - N11 (node)
88 * -- P3 (product)
90 * -- P3 (product)
89 * - N12 (node)
91 * - N12 (node)
90 *
92 *
91 * The leaves of the source item to merge into the item are N1/N11/P3 and N1/N12 => we therefore
93 * The leaves of the source item to merge into the item are N1/N11/P3 and N1/N12 => we therefore
92 * have the following merge result:
94 * have the following merge result:
93 * R
95 * R
94 * - N1
96 * - N1
95 * -- N11
97 * -- N11
96 * --- P1
98 * --- P1
97 * --- P2
99 * --- P2
98 * --- P3 (added leaf)
100 * --- P3 (added leaf)
99 * -- N12 (added leaf)
101 * -- N12 (added leaf)
100 *
102 *
101 * @param item the source item
103 * @param item the source item
102 * @remarks No control is performed on products or components that are merged into the same tree
104 * @remarks No control is performed on products or components that are merged into the same tree
103 * part (two products or components may have the same name)
105 * part (two products or components may have the same name)
104 * @remarks the merge is made by copy (source item is not changed and still exists after the
106 * @remarks the merge is made by copy (source item is not changed and still exists after the
105 * operation)
107 * operation)
106 */
108 */
107 void merge(const DataSourceItem &item);
109 void merge(const DataSourceItem &item);
108
110
109 bool isRoot() const noexcept;
111 bool isRoot() const noexcept;
110
112
111 QString name() const noexcept;
113 QString name() const noexcept;
112
114
113 /**
115 /**
114 * Get the item's parent
116 * Get the item's parent
115 * @return a pointer to the parent if it exists, nullptr if the item is a root
117 * @return a pointer to the parent if it exists, nullptr if the item is a root
116 */
118 */
117 DataSourceItem *parentItem() const noexcept;
119 DataSourceItem *parentItem() const noexcept;
118
120
119 /**
121 /**
120 * Gets the item's root
122 * Gets the item's root
121 * @return the top parent, the item itself if it's the root item
123 * @return the top parent, the item itself if it's the root item
122 */
124 */
123 const DataSourceItem &rootItem() const noexcept;
125 const DataSourceItem &rootItem() const noexcept;
124
126
125 /**
127 /**
126 * Sets or appends a value to a key
128 * Sets or appends a value to a key
127 * @param key the key
129 * @param key the key
128 * @param value the value
130 * @param value the value
129 * @param append if true, the value is added to the values already existing for the key,
131 * @param append if true, the value is added to the values already existing for the key,
130 * otherwise it replaces the existing values
132 * otherwise it replaces the existing values
131 */
133 */
132 void setData(const QString &key, const QVariant &value, bool append = false) noexcept;
134 void setData(const QString &key, const QVariant &value, bool append = false) noexcept;
133
135
134 DataSourceItemType type() const noexcept;
136 DataSourceItemType type() const noexcept;
135
137
136 /**
138 /**
137 * @brief Searches the first child matching the specified data.
139 * @brief Searches the first child matching the specified data.
138 * @param data The data to search.
140 * @param data The data to search.
139 * @param recursive So the search recursively.
141 * @param recursive So the search recursively.
140 * @return the item matching the data or nullptr if it was not found.
142 * @return the item matching the data or nullptr if it was not found.
141 */
143 */
142 DataSourceItem *findItem(const QVariantHash &data, bool recursive);
144 DataSourceItem *findItem(const QVariantHash &data, bool recursive);
143
145
144 bool operator==(const DataSourceItem &other);
146 bool operator==(const DataSourceItem &other);
145 bool operator!=(const DataSourceItem &other);
147 bool operator!=(const DataSourceItem &other);
146
148
147 private:
149 private:
148 class DataSourceItemPrivate;
150 class DataSourceItemPrivate;
149 spimpl::unique_impl_ptr<DataSourceItemPrivate> impl;
151 spimpl::unique_impl_ptr<DataSourceItemPrivate> impl;
150 };
152 };
151
153
152 #endif // SCIQLOP_DATASOURCEITEMMODEL_H
154 #endif // SCIQLOP_DATASOURCEITEMMODEL_H
@@ -1,192 +1,169
1 #include "DataSource/DataSourceController.h"
1 #include "DataSource/DataSourceController.h"
2 #include "DataSource/DataSourceItem.h"
2 #include "DataSource/DataSourceItem.h"
3
3
4 #include <Data/IDataProvider.h>
4 #include <Data/IDataProvider.h>
5
5
6 #include <QMutex>
6 #include <QMutex>
7 #include <QThread>
7 #include <QThread>
8
8
9 #include <QDataStream>
9 #include <QDataStream>
10 #include <QDir>
10 #include <QDir>
11 #include <QStandardPaths>
11 #include <QStandardPaths>
12
12
13 Q_LOGGING_CATEGORY(LOG_DataSourceController, "DataSourceController")
13 Q_LOGGING_CATEGORY(LOG_DataSourceController, "DataSourceController")
14
14
15 namespace {
16
17 /**
18 * Builds the metadata of the variable that will be generated from the loading of an item
19 * @param dataSourceItem the data source item from which to generate the metadata
20 * @return the metadata of the variable
21 */
22 QVariantHash variableMetadata(const DataSourceItem &dataSourceItem)
23 {
24 // Variable metadata contains...
25
26 // ... all metadata of the item
27 auto result = dataSourceItem.data();
28
29 // ... and the name of the plugin, recovered from root item
30 result.insert(QStringLiteral("plugin"), dataSourceItem.rootItem().name());
31
32 return result;
33 }
34
35 } // namespace
36
37 class DataSourceController::DataSourceControllerPrivate {
15 class DataSourceController::DataSourceControllerPrivate {
38 public:
16 public:
39 QMutex m_WorkingMutex;
17 QMutex m_WorkingMutex;
40 /// Data sources registered
18 /// Data sources registered
41 QHash<QUuid, QString> m_DataSources;
19 QHash<QUuid, QString> m_DataSources;
42 /// Data sources structures
20 /// Data sources structures
43 std::map<QUuid, std::unique_ptr<DataSourceItem> > m_DataSourceItems;
21 std::map<QUuid, std::unique_ptr<DataSourceItem> > m_DataSourceItems;
44 /// Data providers registered
22 /// Data providers registered
45 /// @remarks Data providers are stored as shared_ptr as they can be sent to a variable and
23 /// @remarks Data providers are stored as shared_ptr as they can be sent to a variable and
46 /// continue to live without necessarily the data source controller
24 /// continue to live without necessarily the data source controller
47 std::map<QUuid, std::shared_ptr<IDataProvider> > m_DataProviders;
25 std::map<QUuid, std::shared_ptr<IDataProvider> > m_DataProviders;
48
26
49 // Search for the first datasource item matching the specified data
27 // Search for the first datasource item matching the specified data
50 DataSourceItem *findDataSourceItem(const QVariantHash &data)
28 DataSourceItem *findDataSourceItem(const QVariantHash &data)
51 {
29 {
52 DataSourceItem *sourceItem = nullptr;
30 DataSourceItem *sourceItem = nullptr;
53 for (const auto &item : m_DataSourceItems) {
31 for (const auto &item : m_DataSourceItems) {
54 sourceItem = item.second->findItem(data, true);
32 sourceItem = item.second->findItem(data, true);
55 if (sourceItem) {
33 if (sourceItem) {
56 break;
34 break;
57 }
35 }
58 }
36 }
59
37
60 return sourceItem;
38 return sourceItem;
61 }
39 }
62 };
40 };
63
41
64 DataSourceController::DataSourceController(QObject *parent)
42 DataSourceController::DataSourceController(QObject *parent)
65 : impl{spimpl::make_unique_impl<DataSourceControllerPrivate>()}
43 : impl{spimpl::make_unique_impl<DataSourceControllerPrivate>()}
66 {
44 {
67 qCDebug(LOG_DataSourceController()) << tr("DataSourceController construction")
45 qCDebug(LOG_DataSourceController()) << tr("DataSourceController construction")
68 << QThread::currentThread();
46 << QThread::currentThread();
69 }
47 }
70
48
71 DataSourceController::~DataSourceController()
49 DataSourceController::~DataSourceController()
72 {
50 {
73 qCDebug(LOG_DataSourceController()) << tr("DataSourceController destruction")
51 qCDebug(LOG_DataSourceController()) << tr("DataSourceController destruction")
74 << QThread::currentThread();
52 << QThread::currentThread();
75 this->waitForFinish();
53 this->waitForFinish();
76 }
54 }
77
55
78 QUuid DataSourceController::registerDataSource(const QString &dataSourceName) noexcept
56 QUuid DataSourceController::registerDataSource(const QString &dataSourceName) noexcept
79 {
57 {
80 auto dataSourceUid = QUuid::createUuid();
58 auto dataSourceUid = QUuid::createUuid();
81 impl->m_DataSources.insert(dataSourceUid, dataSourceName);
59 impl->m_DataSources.insert(dataSourceUid, dataSourceName);
82
60
83 return dataSourceUid;
61 return dataSourceUid;
84 }
62 }
85
63
86 void DataSourceController::setDataSourceItem(
64 void DataSourceController::setDataSourceItem(
87 const QUuid &dataSourceUid, std::unique_ptr<DataSourceItem> dataSourceItem) noexcept
65 const QUuid &dataSourceUid, std::unique_ptr<DataSourceItem> dataSourceItem) noexcept
88 {
66 {
89 if (!dataSourceItem) {
67 if (!dataSourceItem) {
90 qCWarning(LOG_DataSourceController())
68 qCWarning(LOG_DataSourceController())
91 << tr("Data source item can't be registered (null item)");
69 << tr("Data source item can't be registered (null item)");
92 return;
70 return;
93 }
71 }
94
72
95 if (impl->m_DataSources.contains(dataSourceUid)) {
73 if (impl->m_DataSources.contains(dataSourceUid)) {
96 // The data provider is implicitly converted to a shared_ptr
74 // The data provider is implicitly converted to a shared_ptr
97 impl->m_DataSourceItems.insert(std::make_pair(dataSourceUid, std::move(dataSourceItem)));
75 impl->m_DataSourceItems.insert(std::make_pair(dataSourceUid, std::move(dataSourceItem)));
98
76
99 // Retrieves the data source item to emit the signal with it
77 // Retrieves the data source item to emit the signal with it
100 auto it = impl->m_DataSourceItems.find(dataSourceUid);
78 auto it = impl->m_DataSourceItems.find(dataSourceUid);
101 if (it != impl->m_DataSourceItems.end()) {
79 if (it != impl->m_DataSourceItems.end()) {
102 emit dataSourceItemSet(it->second.get());
80 emit dataSourceItemSet(it->second.get());
103 }
81 }
104 }
82 }
105 else {
83 else {
106 qCWarning(LOG_DataSourceController()) << tr("Can't set data source item for uid %1 : no "
84 qCWarning(LOG_DataSourceController()) << tr("Can't set data source item for uid %1 : no "
107 "data source has been registered with the uid")
85 "data source has been registered with the uid")
108 .arg(dataSourceUid.toString());
86 .arg(dataSourceUid.toString());
109 }
87 }
110 }
88 }
111
89
112 void DataSourceController::setDataProvider(const QUuid &dataSourceUid,
90 void DataSourceController::setDataProvider(const QUuid &dataSourceUid,
113 std::unique_ptr<IDataProvider> dataProvider) noexcept
91 std::unique_ptr<IDataProvider> dataProvider) noexcept
114 {
92 {
115 if (impl->m_DataSources.contains(dataSourceUid)) {
93 if (impl->m_DataSources.contains(dataSourceUid)) {
116 impl->m_DataProviders.insert(std::make_pair(dataSourceUid, std::move(dataProvider)));
94 impl->m_DataProviders.insert(std::make_pair(dataSourceUid, std::move(dataProvider)));
117 }
95 }
118 else {
96 else {
119 qCWarning(LOG_DataSourceController()) << tr("Can't set data provider for uid %1 : no data "
97 qCWarning(LOG_DataSourceController()) << tr("Can't set data provider for uid %1 : no data "
120 "source has been registered with the uid")
98 "source has been registered with the uid")
121 .arg(dataSourceUid.toString());
99 .arg(dataSourceUid.toString());
122 }
100 }
123 }
101 }
124
102
125 void DataSourceController::loadProductItem(const QUuid &dataSourceUid,
103 void DataSourceController::loadProductItem(const QUuid &dataSourceUid,
126 const DataSourceItem &productItem) noexcept
104 const DataSourceItem &productItem) noexcept
127 {
105 {
128 if (productItem.type() == DataSourceItemType::PRODUCT
106 if (productItem.type() == DataSourceItemType::PRODUCT
129 || productItem.type() == DataSourceItemType::COMPONENT) {
107 || productItem.type() == DataSourceItemType::COMPONENT) {
130 /// Retrieves the data provider of the data source (if any)
108 /// Retrieves the data provider of the data source (if any)
131 auto it = impl->m_DataProviders.find(dataSourceUid);
109 auto it = impl->m_DataProviders.find(dataSourceUid);
132 auto dataProvider = (it != impl->m_DataProviders.end()) ? it->second : nullptr;
110 auto dataProvider = (it != impl->m_DataProviders.end()) ? it->second : nullptr;
133
111
134 emit variableCreationRequested(productItem.name(), variableMetadata(productItem),
112 emit variableCreationRequested(productItem.name(), productItem.data(), dataProvider);
135 dataProvider);
136 }
113 }
137 else {
114 else {
138 qCWarning(LOG_DataSourceController()) << tr("Can't load an item that is not a product");
115 qCWarning(LOG_DataSourceController()) << tr("Can't load an item that is not a product");
139 }
116 }
140 }
117 }
141
118
142 QByteArray DataSourceController::mimeDataForProductsData(const QVariantList &productsData)
119 QByteArray DataSourceController::mimeDataForProductsData(const QVariantList &productsData)
143 {
120 {
144 QByteArray encodedData;
121 QByteArray encodedData;
145 QDataStream stream{&encodedData, QIODevice::WriteOnly};
122 QDataStream stream{&encodedData, QIODevice::WriteOnly};
146
123
147 stream << productsData;
124 stream << productsData;
148
125
149 return encodedData;
126 return encodedData;
150 }
127 }
151
128
152 QVariantList DataSourceController::productsDataForMimeData(const QByteArray &mimeData)
129 QVariantList DataSourceController::productsDataForMimeData(const QByteArray &mimeData)
153 {
130 {
154 QDataStream stream{mimeData};
131 QDataStream stream{mimeData};
155
132
156 QVariantList productList;
133 QVariantList productList;
157 stream >> productList;
134 stream >> productList;
158
135
159 return productList;
136 return productList;
160 }
137 }
161
138
162 void DataSourceController::initialize()
139 void DataSourceController::initialize()
163 {
140 {
164 qCDebug(LOG_DataSourceController()) << tr("DataSourceController init")
141 qCDebug(LOG_DataSourceController()) << tr("DataSourceController init")
165 << QThread::currentThread();
142 << QThread::currentThread();
166 impl->m_WorkingMutex.lock();
143 impl->m_WorkingMutex.lock();
167 qCDebug(LOG_DataSourceController()) << tr("DataSourceController init END");
144 qCDebug(LOG_DataSourceController()) << tr("DataSourceController init END");
168 }
145 }
169
146
170 void DataSourceController::finalize()
147 void DataSourceController::finalize()
171 {
148 {
172 impl->m_WorkingMutex.unlock();
149 impl->m_WorkingMutex.unlock();
173 }
150 }
174
151
175 void DataSourceController::requestVariable(const QVariantHash &productData)
152 void DataSourceController::requestVariable(const QVariantHash &productData)
176 {
153 {
177 auto sourceItem = impl->findDataSourceItem(productData);
154 auto sourceItem = impl->findDataSourceItem(productData);
178
155
179 if (sourceItem) {
156 if (sourceItem) {
180 auto sourceName = sourceItem->rootItem().name();
157 auto sourceName = sourceItem->rootItem().name();
181 auto sourceId = impl->m_DataSources.key(sourceName);
158 auto sourceId = impl->m_DataSources.key(sourceName);
182 loadProductItem(sourceId, *sourceItem);
159 loadProductItem(sourceId, *sourceItem);
183 }
160 }
184 else {
161 else {
185 qCWarning(LOG_DataSourceController()) << tr("requestVariable, product data not found");
162 qCWarning(LOG_DataSourceController()) << tr("requestVariable, product data not found");
186 }
163 }
187 }
164 }
188
165
189 void DataSourceController::waitForFinish()
166 void DataSourceController::waitForFinish()
190 {
167 {
191 QMutexLocker locker{&impl->m_WorkingMutex};
168 QMutexLocker locker{&impl->m_WorkingMutex};
192 }
169 }
@@ -1,185 +1,186
1 #include <DataSource/DataSourceItem.h>
1 #include <DataSource/DataSourceItem.h>
2 #include <DataSource/DataSourceItemAction.h>
2 #include <DataSource/DataSourceItemAction.h>
3 #include <DataSource/DataSourceItemMergeHelper.h>
3 #include <DataSource/DataSourceItemMergeHelper.h>
4
4
5 #include <QVector>
5 #include <QVector>
6
6
7 const QString DataSourceItem::NAME_DATA_KEY = QStringLiteral("name");
7 const QString DataSourceItem::NAME_DATA_KEY = QStringLiteral("name");
8 const QString DataSourceItem::PLUGIN_DATA_KEY = QStringLiteral("plugin");
8
9
9 struct DataSourceItem::DataSourceItemPrivate {
10 struct DataSourceItem::DataSourceItemPrivate {
10 explicit DataSourceItemPrivate(DataSourceItemType type, QVariantHash data)
11 explicit DataSourceItemPrivate(DataSourceItemType type, QVariantHash data)
11 : m_Parent{nullptr}, m_Children{}, m_Type{type}, m_Data{std::move(data)}, m_Actions{}
12 : m_Parent{nullptr}, m_Children{}, m_Type{type}, m_Data{std::move(data)}, m_Actions{}
12 {
13 {
13 }
14 }
14
15
15 DataSourceItem *m_Parent;
16 DataSourceItem *m_Parent;
16 std::vector<std::unique_ptr<DataSourceItem> > m_Children;
17 std::vector<std::unique_ptr<DataSourceItem> > m_Children;
17 DataSourceItemType m_Type;
18 DataSourceItemType m_Type;
18 QVariantHash m_Data;
19 QVariantHash m_Data;
19 std::vector<std::unique_ptr<DataSourceItemAction> > m_Actions;
20 std::vector<std::unique_ptr<DataSourceItemAction> > m_Actions;
20 };
21 };
21
22
22 DataSourceItem::DataSourceItem(DataSourceItemType type, const QString &name)
23 DataSourceItem::DataSourceItem(DataSourceItemType type, const QString &name)
23 : DataSourceItem{type, QVariantHash{{NAME_DATA_KEY, name}}}
24 : DataSourceItem{type, QVariantHash{{NAME_DATA_KEY, name}}}
24 {
25 {
25 }
26 }
26
27
27 DataSourceItem::DataSourceItem(DataSourceItemType type, QVariantHash data)
28 DataSourceItem::DataSourceItem(DataSourceItemType type, QVariantHash data)
28 : impl{spimpl::make_unique_impl<DataSourceItemPrivate>(type, std::move(data))}
29 : impl{spimpl::make_unique_impl<DataSourceItemPrivate>(type, std::move(data))}
29 {
30 {
30 }
31 }
31
32
32 std::unique_ptr<DataSourceItem> DataSourceItem::clone() const
33 std::unique_ptr<DataSourceItem> DataSourceItem::clone() const
33 {
34 {
34 auto result = std::make_unique<DataSourceItem>(impl->m_Type, impl->m_Data);
35 auto result = std::make_unique<DataSourceItem>(impl->m_Type, impl->m_Data);
35
36
36 // Clones children
37 // Clones children
37 for (const auto &child : impl->m_Children) {
38 for (const auto &child : impl->m_Children) {
38 result->appendChild(std::move(child->clone()));
39 result->appendChild(std::move(child->clone()));
39 }
40 }
40
41
41 // Clones actions
42 // Clones actions
42 for (const auto &action : impl->m_Actions) {
43 for (const auto &action : impl->m_Actions) {
43 result->addAction(std::move(action->clone()));
44 result->addAction(std::move(action->clone()));
44 }
45 }
45
46
46 return result;
47 return result;
47 }
48 }
48
49
49 QVector<DataSourceItemAction *> DataSourceItem::actions() const noexcept
50 QVector<DataSourceItemAction *> DataSourceItem::actions() const noexcept
50 {
51 {
51 auto result = QVector<DataSourceItemAction *>{};
52 auto result = QVector<DataSourceItemAction *>{};
52
53
53 std::transform(std::cbegin(impl->m_Actions), std::cend(impl->m_Actions),
54 std::transform(std::cbegin(impl->m_Actions), std::cend(impl->m_Actions),
54 std::back_inserter(result), [](const auto &action) { return action.get(); });
55 std::back_inserter(result), [](const auto &action) { return action.get(); });
55
56
56 return result;
57 return result;
57 }
58 }
58
59
59 void DataSourceItem::addAction(std::unique_ptr<DataSourceItemAction> action) noexcept
60 void DataSourceItem::addAction(std::unique_ptr<DataSourceItemAction> action) noexcept
60 {
61 {
61 action->setDataSourceItem(this);
62 action->setDataSourceItem(this);
62 impl->m_Actions.push_back(std::move(action));
63 impl->m_Actions.push_back(std::move(action));
63 }
64 }
64
65
65 void DataSourceItem::appendChild(std::unique_ptr<DataSourceItem> child) noexcept
66 void DataSourceItem::appendChild(std::unique_ptr<DataSourceItem> child) noexcept
66 {
67 {
67 child->impl->m_Parent = this;
68 child->impl->m_Parent = this;
68 impl->m_Children.push_back(std::move(child));
69 impl->m_Children.push_back(std::move(child));
69 }
70 }
70
71
71 DataSourceItem *DataSourceItem::child(int childIndex) const noexcept
72 DataSourceItem *DataSourceItem::child(int childIndex) const noexcept
72 {
73 {
73 if (childIndex < 0 || childIndex >= childCount()) {
74 if (childIndex < 0 || childIndex >= childCount()) {
74 return nullptr;
75 return nullptr;
75 }
76 }
76 else {
77 else {
77 return impl->m_Children.at(childIndex).get();
78 return impl->m_Children.at(childIndex).get();
78 }
79 }
79 }
80 }
80
81
81 int DataSourceItem::childCount() const noexcept
82 int DataSourceItem::childCount() const noexcept
82 {
83 {
83 return impl->m_Children.size();
84 return impl->m_Children.size();
84 }
85 }
85
86
86 QVariant DataSourceItem::data(const QString &key) const noexcept
87 QVariant DataSourceItem::data(const QString &key) const noexcept
87 {
88 {
88 return impl->m_Data.value(key);
89 return impl->m_Data.value(key);
89 }
90 }
90
91
91 QVariantHash DataSourceItem::data() const noexcept
92 QVariantHash DataSourceItem::data() const noexcept
92 {
93 {
93 return impl->m_Data;
94 return impl->m_Data;
94 }
95 }
95
96
96 void DataSourceItem::merge(const DataSourceItem &item)
97 void DataSourceItem::merge(const DataSourceItem &item)
97 {
98 {
98 DataSourceItemMergeHelper::merge(item, *this);
99 DataSourceItemMergeHelper::merge(item, *this);
99 }
100 }
100
101
101 bool DataSourceItem::isRoot() const noexcept
102 bool DataSourceItem::isRoot() const noexcept
102 {
103 {
103 return impl->m_Parent == nullptr;
104 return impl->m_Parent == nullptr;
104 }
105 }
105
106
106 QString DataSourceItem::name() const noexcept
107 QString DataSourceItem::name() const noexcept
107 {
108 {
108 return data(NAME_DATA_KEY).toString();
109 return data(NAME_DATA_KEY).toString();
109 }
110 }
110
111
111 DataSourceItem *DataSourceItem::parentItem() const noexcept
112 DataSourceItem *DataSourceItem::parentItem() const noexcept
112 {
113 {
113 return impl->m_Parent;
114 return impl->m_Parent;
114 }
115 }
115
116
116 const DataSourceItem &DataSourceItem::rootItem() const noexcept
117 const DataSourceItem &DataSourceItem::rootItem() const noexcept
117 {
118 {
118 return isRoot() ? *this : parentItem()->rootItem();
119 return isRoot() ? *this : parentItem()->rootItem();
119 }
120 }
120
121
121 void DataSourceItem::setData(const QString &key, const QVariant &value, bool append) noexcept
122 void DataSourceItem::setData(const QString &key, const QVariant &value, bool append) noexcept
122 {
123 {
123 auto it = impl->m_Data.constFind(key);
124 auto it = impl->m_Data.constFind(key);
124 if (append && it != impl->m_Data.constEnd()) {
125 if (append && it != impl->m_Data.constEnd()) {
125 // Case of an existing value to which we want to add to the new value
126 // Case of an existing value to which we want to add to the new value
126 if (it->canConvert<QVariantList>()) {
127 if (it->canConvert<QVariantList>()) {
127 auto variantList = it->value<QVariantList>();
128 auto variantList = it->value<QVariantList>();
128 variantList.append(value);
129 variantList.append(value);
129
130
130 impl->m_Data.insert(key, variantList);
131 impl->m_Data.insert(key, variantList);
131 }
132 }
132 else {
133 else {
133 impl->m_Data.insert(key, QVariantList{*it, value});
134 impl->m_Data.insert(key, QVariantList{*it, value});
134 }
135 }
135 }
136 }
136 else {
137 else {
137 // Other cases :
138 // Other cases :
138 // - new value in map OR
139 // - new value in map OR
139 // - replacement of an existing value (not appending)
140 // - replacement of an existing value (not appending)
140 impl->m_Data.insert(key, value);
141 impl->m_Data.insert(key, value);
141 }
142 }
142 }
143 }
143
144
144 DataSourceItemType DataSourceItem::type() const noexcept
145 DataSourceItemType DataSourceItem::type() const noexcept
145 {
146 {
146 return impl->m_Type;
147 return impl->m_Type;
147 }
148 }
148
149
149 DataSourceItem *DataSourceItem::findItem(const QVariantHash &data, bool recursive)
150 DataSourceItem *DataSourceItem::findItem(const QVariantHash &data, bool recursive)
150 {
151 {
151 for (const auto &child : impl->m_Children) {
152 for (const auto &child : impl->m_Children) {
152 if (child->impl->m_Data == data) {
153 if (child->impl->m_Data == data) {
153 return child.get();
154 return child.get();
154 }
155 }
155
156
156 if (recursive) {
157 if (recursive) {
157 if (auto foundItem = child->findItem(data, true)) {
158 if (auto foundItem = child->findItem(data, true)) {
158 return foundItem;
159 return foundItem;
159 }
160 }
160 }
161 }
161 }
162 }
162
163
163 return nullptr;
164 return nullptr;
164 }
165 }
165
166
166 bool DataSourceItem::operator==(const DataSourceItem &other)
167 bool DataSourceItem::operator==(const DataSourceItem &other)
167 {
168 {
168 // Compares items' attributes
169 // Compares items' attributes
169 if (std::tie(impl->m_Type, impl->m_Data) == std::tie(other.impl->m_Type, other.impl->m_Data)) {
170 if (std::tie(impl->m_Type, impl->m_Data) == std::tie(other.impl->m_Type, other.impl->m_Data)) {
170 // Compares contents of items' children
171 // Compares contents of items' children
171 return std::equal(std::cbegin(impl->m_Children), std::cend(impl->m_Children),
172 return std::equal(std::cbegin(impl->m_Children), std::cend(impl->m_Children),
172 std::cbegin(other.impl->m_Children),
173 std::cbegin(other.impl->m_Children),
173 [](const auto &itemChild, const auto &otherChild) {
174 [](const auto &itemChild, const auto &otherChild) {
174 return *itemChild == *otherChild;
175 return *itemChild == *otherChild;
175 });
176 });
176 }
177 }
177 else {
178 else {
178 return false;
179 return false;
179 }
180 }
180 }
181 }
181
182
182 bool DataSourceItem::operator!=(const DataSourceItem &other)
183 bool DataSourceItem::operator!=(const DataSourceItem &other)
183 {
184 {
184 return !(*this == other);
185 return !(*this == other);
185 }
186 }
@@ -1,74 +1,77
1 #include "AmdaPlugin.h"
1 #include "AmdaPlugin.h"
2 #include "AmdaDefs.h"
2 #include "AmdaDefs.h"
3 #include "AmdaParser.h"
3 #include "AmdaParser.h"
4 #include "AmdaProvider.h"
4 #include "AmdaProvider.h"
5
5
6 #include <DataSource/DataSourceController.h>
6 #include <DataSource/DataSourceController.h>
7 #include <DataSource/DataSourceItem.h>
7 #include <DataSource/DataSourceItem.h>
8 #include <DataSource/DataSourceItemAction.h>
8 #include <DataSource/DataSourceItemAction.h>
9
9
10 #include <SqpApplication.h>
10 #include <SqpApplication.h>
11
11
12 Q_LOGGING_CATEGORY(LOG_AmdaPlugin, "AmdaPlugin")
12 Q_LOGGING_CATEGORY(LOG_AmdaPlugin, "AmdaPlugin")
13
13
14 namespace {
14 namespace {
15
15
16 /// Name of the data source
16 /// Name of the data source
17 const auto DATA_SOURCE_NAME = QStringLiteral("AMDA");
17 const auto DATA_SOURCE_NAME = QStringLiteral("AMDA");
18
18
19 /// Path of the file used to generate the data source item for AMDA
19 /// Path of the file used to generate the data source item for AMDA
20 const auto JSON_FILE_PATH = QStringLiteral(":/samples/AmdaSampleV3.json");
20 const auto JSON_FILE_PATH = QStringLiteral(":/samples/AmdaSampleV3.json");
21
21
22 void associateActions(DataSourceItem &item, const QUuid &dataSourceUid)
22 void associateActions(DataSourceItem &item, const QUuid &dataSourceUid)
23 {
23 {
24 auto addLoadAction = [&item, dataSourceUid](const QString &label) {
24 auto addLoadAction = [&item, dataSourceUid](const QString &label) {
25 item.addAction(
25 item.addAction(
26 std::make_unique<DataSourceItemAction>(label, [dataSourceUid](DataSourceItem &item) {
26 std::make_unique<DataSourceItemAction>(label, [dataSourceUid](DataSourceItem &item) {
27 if (auto app = sqpApp) {
27 if (auto app = sqpApp) {
28 app->dataSourceController().loadProductItem(dataSourceUid, item);
28 app->dataSourceController().loadProductItem(dataSourceUid, item);
29 }
29 }
30 }));
30 }));
31 };
31 };
32
32
33 const auto itemType = item.type();
33 const auto itemType = item.type();
34 if (itemType == DataSourceItemType::PRODUCT) {
34 if (itemType == DataSourceItemType::PRODUCT || itemType == DataSourceItemType::COMPONENT) {
35 addLoadAction(QObject::tr("Load %1 product").arg(item.name()));
35 // Adds plugin name to item metadata
36 }
36 item.setData(DataSourceItem::PLUGIN_DATA_KEY, DATA_SOURCE_NAME);
37 else if (itemType == DataSourceItemType::COMPONENT) {
37
38 addLoadAction(QObject::tr("Load %1 component").arg(item.name()));
38 // Adds load action
39 auto actionLabel = QObject::tr(
40 itemType == DataSourceItemType::PRODUCT ? "Load %1 product" : "Load %1 component");
41 addLoadAction(actionLabel.arg(item.name()));
39 }
42 }
40
43
41 auto count = item.childCount();
44 auto count = item.childCount();
42 for (auto i = 0; i < count; ++i) {
45 for (auto i = 0; i < count; ++i) {
43 if (auto child = item.child(i)) {
46 if (auto child = item.child(i)) {
44 associateActions(*child, dataSourceUid);
47 associateActions(*child, dataSourceUid);
45 }
48 }
46 }
49 }
47 }
50 }
48
51
49 } // namespace
52 } // namespace
50
53
51 void AmdaPlugin::initialize()
54 void AmdaPlugin::initialize()
52 {
55 {
53 if (auto app = sqpApp) {
56 if (auto app = sqpApp) {
54 // Registers to the data source controller
57 // Registers to the data source controller
55 auto &dataSourceController = app->dataSourceController();
58 auto &dataSourceController = app->dataSourceController();
56 auto dataSourceUid = dataSourceController.registerDataSource(DATA_SOURCE_NAME);
59 auto dataSourceUid = dataSourceController.registerDataSource(DATA_SOURCE_NAME);
57
60
58 // Sets data source tree
61 // Sets data source tree
59 if (auto dataSourceItem = AmdaParser::readJson(JSON_FILE_PATH)) {
62 if (auto dataSourceItem = AmdaParser::readJson(JSON_FILE_PATH)) {
60 associateActions(*dataSourceItem, dataSourceUid);
63 associateActions(*dataSourceItem, dataSourceUid);
61
64
62 dataSourceController.setDataSourceItem(dataSourceUid, std::move(dataSourceItem));
65 dataSourceController.setDataSourceItem(dataSourceUid, std::move(dataSourceItem));
63 }
66 }
64 else {
67 else {
65 qCCritical(LOG_AmdaPlugin()) << tr("No data source item could be generated for AMDA");
68 qCCritical(LOG_AmdaPlugin()) << tr("No data source item could be generated for AMDA");
66 }
69 }
67
70
68 // Sets data provider
71 // Sets data provider
69 dataSourceController.setDataProvider(dataSourceUid, std::make_unique<AmdaProvider>());
72 dataSourceController.setDataProvider(dataSourceUid, std::make_unique<AmdaProvider>());
70 }
73 }
71 else {
74 else {
72 qCWarning(LOG_AmdaPlugin()) << tr("Can't access to SciQlop application");
75 qCWarning(LOG_AmdaPlugin()) << tr("Can't access to SciQlop application");
73 }
76 }
74 }
77 }
@@ -1,114 +1,118
1 #include "MockPlugin.h"
1 #include "MockPlugin.h"
2 #include "CosinusProvider.h"
2 #include "CosinusProvider.h"
3 #include "MockDefs.h"
3 #include "MockDefs.h"
4
4
5 #include <DataSource/DataSourceController.h>
5 #include <DataSource/DataSourceController.h>
6 #include <DataSource/DataSourceItem.h>
6 #include <DataSource/DataSourceItem.h>
7 #include <DataSource/DataSourceItemAction.h>
7 #include <DataSource/DataSourceItemAction.h>
8
8
9 #include <SqpApplication.h>
9 #include <SqpApplication.h>
10
10
11 Q_LOGGING_CATEGORY(LOG_MockPlugin, "MockPlugin")
11 Q_LOGGING_CATEGORY(LOG_MockPlugin, "MockPlugin")
12
12
13 namespace {
13 namespace {
14
14
15 /// Name of the data source
15 /// Name of the data source
16 const auto DATA_SOURCE_NAME = QStringLiteral("MMS");
16 const auto DATA_SOURCE_NAME = QStringLiteral("MMS");
17
17
18 /// Creates the data provider relative to the plugin
18 /// Creates the data provider relative to the plugin
19 std::unique_ptr<IDataProvider> createDataProvider() noexcept
19 std::unique_ptr<IDataProvider> createDataProvider() noexcept
20 {
20 {
21 return std::make_unique<CosinusProvider>();
21 return std::make_unique<CosinusProvider>();
22 }
22 }
23
23
24 std::unique_ptr<DataSourceItem> createProductItem(const QVariantHash &data,
24 std::unique_ptr<DataSourceItem> createProductItem(const QVariantHash &data,
25 const QUuid &dataSourceUid)
25 const QUuid &dataSourceUid)
26 {
26 {
27 auto result = std::make_unique<DataSourceItem>(DataSourceItemType::PRODUCT, data);
27 auto result = std::make_unique<DataSourceItem>(DataSourceItemType::PRODUCT, data);
28
29 // Adds plugin name to product metadata
30 result->setData(DataSourceItem::PLUGIN_DATA_KEY, DATA_SOURCE_NAME);
31
28 auto productName = data.value(DataSourceItem::NAME_DATA_KEY).toString();
32 auto productName = data.value(DataSourceItem::NAME_DATA_KEY).toString();
29
33
30 // Add action to load product from DataSourceController
34 // Add action to load product from DataSourceController
31 result->addAction(std::make_unique<DataSourceItemAction>(
35 result->addAction(std::make_unique<DataSourceItemAction>(
32 QObject::tr("Load %1 product").arg(productName),
36 QObject::tr("Load %1 product").arg(productName),
33 [productName, dataSourceUid](DataSourceItem &item) {
37 [productName, dataSourceUid](DataSourceItem &item) {
34 if (auto app = sqpApp) {
38 if (auto app = sqpApp) {
35 app->dataSourceController().loadProductItem(dataSourceUid, item);
39 app->dataSourceController().loadProductItem(dataSourceUid, item);
36 }
40 }
37 }));
41 }));
38
42
39 return result;
43 return result;
40 }
44 }
41
45
42 /// Creates the data source item relative to the plugin
46 /// Creates the data source item relative to the plugin
43 std::unique_ptr<DataSourceItem> createDataSourceItem(const QUuid &dataSourceUid) noexcept
47 std::unique_ptr<DataSourceItem> createDataSourceItem(const QUuid &dataSourceUid) noexcept
44 {
48 {
45 // Magnetic field products
49 // Magnetic field products
46 auto magneticFieldFolder = std::make_unique<DataSourceItem>(DataSourceItemType::NODE,
50 auto magneticFieldFolder = std::make_unique<DataSourceItem>(DataSourceItemType::NODE,
47 QStringLiteral("Magnetic field"));
51 QStringLiteral("Magnetic field"));
48 magneticFieldFolder->appendChild(
52 magneticFieldFolder->appendChild(
49 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Scalar 10 Hz")},
53 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Scalar 10 Hz")},
50 {COSINUS_TYPE_KEY, "scalar"},
54 {COSINUS_TYPE_KEY, "scalar"},
51 {COSINUS_FREQUENCY_KEY, 10.}},
55 {COSINUS_FREQUENCY_KEY, 10.}},
52 dataSourceUid));
56 dataSourceUid));
53 magneticFieldFolder->appendChild(
57 magneticFieldFolder->appendChild(
54 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Scalar 60 Hz")},
58 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Scalar 60 Hz")},
55 {COSINUS_TYPE_KEY, "scalar"},
59 {COSINUS_TYPE_KEY, "scalar"},
56 {COSINUS_FREQUENCY_KEY, 60.}},
60 {COSINUS_FREQUENCY_KEY, 60.}},
57 dataSourceUid));
61 dataSourceUid));
58 magneticFieldFolder->appendChild(
62 magneticFieldFolder->appendChild(
59 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Scalar 100 Hz")},
63 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Scalar 100 Hz")},
60 {COSINUS_TYPE_KEY, "scalar"},
64 {COSINUS_TYPE_KEY, "scalar"},
61 {COSINUS_FREQUENCY_KEY, 100.}},
65 {COSINUS_FREQUENCY_KEY, 100.}},
62 dataSourceUid));
66 dataSourceUid));
63 magneticFieldFolder->appendChild(
67 magneticFieldFolder->appendChild(
64 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Vector 10 Hz")},
68 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Vector 10 Hz")},
65 {COSINUS_TYPE_KEY, "vector"},
69 {COSINUS_TYPE_KEY, "vector"},
66 {COSINUS_FREQUENCY_KEY, 10.}},
70 {COSINUS_FREQUENCY_KEY, 10.}},
67 dataSourceUid));
71 dataSourceUid));
68 magneticFieldFolder->appendChild(
72 magneticFieldFolder->appendChild(
69 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Vector 60 Hz")},
73 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Vector 60 Hz")},
70 {COSINUS_TYPE_KEY, "vector"},
74 {COSINUS_TYPE_KEY, "vector"},
71 {COSINUS_FREQUENCY_KEY, 60.}},
75 {COSINUS_FREQUENCY_KEY, 60.}},
72 dataSourceUid));
76 dataSourceUid));
73 magneticFieldFolder->appendChild(
77 magneticFieldFolder->appendChild(
74 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Vector 100 Hz")},
78 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Vector 100 Hz")},
75 {COSINUS_TYPE_KEY, "vector"},
79 {COSINUS_TYPE_KEY, "vector"},
76 {COSINUS_FREQUENCY_KEY, 100.}},
80 {COSINUS_FREQUENCY_KEY, 100.}},
77 dataSourceUid));
81 dataSourceUid));
78 magneticFieldFolder->appendChild(
82 magneticFieldFolder->appendChild(
79 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Spectrogram 1 Hz")},
83 createProductItem({{DataSourceItem::NAME_DATA_KEY, QStringLiteral("Spectrogram 1 Hz")},
80 {COSINUS_TYPE_KEY, "spectrogram"},
84 {COSINUS_TYPE_KEY, "spectrogram"},
81 {COSINUS_FREQUENCY_KEY, 1.}},
85 {COSINUS_FREQUENCY_KEY, 1.}},
82 dataSourceUid));
86 dataSourceUid));
83
87
84 // Electric field products
88 // Electric field products
85 auto electricFieldFolder = std::make_unique<DataSourceItem>(DataSourceItemType::NODE,
89 auto electricFieldFolder = std::make_unique<DataSourceItem>(DataSourceItemType::NODE,
86 QStringLiteral("Electric field"));
90 QStringLiteral("Electric field"));
87
91
88 // Root
92 // Root
89 auto root = std::make_unique<DataSourceItem>(DataSourceItemType::NODE, DATA_SOURCE_NAME);
93 auto root = std::make_unique<DataSourceItem>(DataSourceItemType::NODE, DATA_SOURCE_NAME);
90 root->appendChild(std::move(magneticFieldFolder));
94 root->appendChild(std::move(magneticFieldFolder));
91 root->appendChild(std::move(electricFieldFolder));
95 root->appendChild(std::move(electricFieldFolder));
92
96
93 return root;
97 return root;
94 }
98 }
95
99
96 } // namespace
100 } // namespace
97
101
98 void MockPlugin::initialize()
102 void MockPlugin::initialize()
99 {
103 {
100 if (auto app = sqpApp) {
104 if (auto app = sqpApp) {
101 // Registers to the data source controller
105 // Registers to the data source controller
102 auto &dataSourceController = app->dataSourceController();
106 auto &dataSourceController = app->dataSourceController();
103 auto dataSourceUid = dataSourceController.registerDataSource(DATA_SOURCE_NAME);
107 auto dataSourceUid = dataSourceController.registerDataSource(DATA_SOURCE_NAME);
104
108
105 // Sets data source tree
109 // Sets data source tree
106 dataSourceController.setDataSourceItem(dataSourceUid, createDataSourceItem(dataSourceUid));
110 dataSourceController.setDataSourceItem(dataSourceUid, createDataSourceItem(dataSourceUid));
107
111
108 // Sets data provider
112 // Sets data provider
109 dataSourceController.setDataProvider(dataSourceUid, createDataProvider());
113 dataSourceController.setDataProvider(dataSourceUid, createDataProvider());
110 }
114 }
111 else {
115 else {
112 qCWarning(LOG_MockPlugin()) << tr("Can't access to SciQlop application");
116 qCWarning(LOG_MockPlugin()) << tr("Can't access to SciQlop application");
113 }
117 }
114 }
118 }
General Comments 0
You need to be logged in to leave comments. Login now