@@ -136,13 +136,14 void VariableController::createVariable(const QString &name, | |||||
136 | // store the provider |
|
136 | // store the provider | |
137 | impl->m_VariableToProviderMap[newVariable] = provider; |
|
137 | impl->m_VariableToProviderMap[newVariable] = provider; | |
138 |
|
138 | |||
139 | auto addDateTimeAcquired |
|
139 | auto addDateTimeAcquired = [ this, varW = std::weak_ptr<Variable>{newVariable} ]( | |
140 |
|
|
140 | auto dataSeriesAcquired, auto dateTimeToPutInCache) | |
141 |
|
141 | { | ||
142 | impl->m_VariableCacheController->addDateTime(newVariable, dateTimeToPutInCache); |
|
142 | if (auto variable = varW.lock()) { | |
143 | newVariable->setDataSeries(dataSeriesAcquired); |
|
143 | impl->m_VariableCacheController->addDateTime(variable, dateTimeToPutInCache); | |
144 |
|
144 | variable->setDataSeries(dataSeriesAcquired); | ||
145 |
|
|
145 | } | |
|
146 | }; | |||
146 |
|
147 | |||
147 | connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired); |
|
148 | connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired); | |
148 | this->onRequestDataLoading(newVariable, dateTime); |
|
149 | this->onRequestDataLoading(newVariable, dateTime); |
@@ -121,9 +121,12 void GenerateVariableMenuOperation::visitLeave(VisualizationTabWidget *tabWidget | |||||
121 | { |
|
121 | { | |
122 | if (tabWidget) { |
|
122 | if (tabWidget) { | |
123 | // 'Plot' menu |
|
123 | // 'Plot' menu | |
124 | impl->visitNodeLeavePlot( |
|
124 | impl->visitNodeLeavePlot(*tabWidget, QObject::tr("Open in a new zone"), | |
125 | *tabWidget, QObject::tr("Open in a new zone"), |
|
125 | [ varW = std::weak_ptr<Variable>{impl->m_Variable}, tabWidget ]() { | |
126 | [ var = impl->m_Variable, tabWidget ]() { tabWidget->createZone(var); }); |
|
126 | if (auto var = varW.lock()) { | |
|
127 | tabWidget->createZone(var); | |||
|
128 | } | |||
|
129 | }); | |||
127 |
|
130 | |||
128 | // 'Unplot' menu |
|
131 | // 'Unplot' menu | |
129 | impl->visitNodeLeaveUnplot(); |
|
132 | impl->visitNodeLeaveUnplot(); | |
@@ -152,7 +155,11 void GenerateVariableMenuOperation::visitLeave(VisualizationZoneWidget *zoneWidg | |||||
152 | // 'Plot' menu |
|
155 | // 'Plot' menu | |
153 | impl->visitNodeLeavePlot( |
|
156 | impl->visitNodeLeavePlot( | |
154 | *zoneWidget, QObject::tr("Open in a new graph"), |
|
157 | *zoneWidget, QObject::tr("Open in a new graph"), | |
155 |
[ var = impl->m_Variable, zoneWidget ]() { |
|
158 | [ varW = std::weak_ptr<Variable>{impl->m_Variable}, zoneWidget ]() { | |
|
159 | if (auto var = varW.lock()) { | |||
|
160 | zoneWidget->createGraph(var); | |||
|
161 | } | |||
|
162 | }); | |||
156 |
|
163 | |||
157 | // 'Unplot' menu |
|
164 | // 'Unplot' menu | |
158 | impl->visitNodeLeaveUnplot(); |
|
165 | impl->visitNodeLeaveUnplot(); | |
@@ -167,14 +174,20 void GenerateVariableMenuOperation::visit(VisualizationGraphWidget *graphWidget) | |||||
167 | { |
|
174 | { | |
168 | if (graphWidget) { |
|
175 | if (graphWidget) { | |
169 | // 'Plot' menu |
|
176 | // 'Plot' menu | |
170 | impl->visitLeafPlot( |
|
177 | impl->visitLeafPlot(*graphWidget, QObject::tr("Open in %1").arg(graphWidget->name()), | |
171 | *graphWidget, QObject::tr("Open in %1").arg(graphWidget->name()), |
|
178 | [ varW = std::weak_ptr<Variable>{impl->m_Variable}, graphWidget ]() { | |
172 | [ var = impl->m_Variable, graphWidget ]() { graphWidget->addVariableUsingGraph(var); }); |
|
179 | if (auto var = varW.lock()) { | |
|
180 | graphWidget->addVariableUsingGraph(var); | |||
|
181 | } | |||
|
182 | }); | |||
173 |
|
183 | |||
174 | // 'Unplot' menu |
|
184 | // 'Unplot' menu | |
175 | impl->visitLeafUnplot( |
|
185 | impl->visitLeafUnplot(*graphWidget, QObject::tr("Remove from %1").arg(graphWidget->name()), | |
176 | *graphWidget, QObject::tr("Remove from %1").arg(graphWidget->name()), |
|
186 | [ varW = std::weak_ptr<Variable>{impl->m_Variable}, graphWidget ]() { | |
177 | [ var = impl->m_Variable, graphWidget ]() { graphWidget->removeVariable(var); }); |
|
187 | if (auto var = varW.lock()) { | |
|
188 | graphWidget->removeVariable(var); | |||
|
189 | } | |||
|
190 | }); | |||
178 | } |
|
191 | } | |
179 | else { |
|
192 | else { | |
180 | qCCritical(LOG_GenerateVariableMenuOperation(), |
|
193 | qCCritical(LOG_GenerateVariableMenuOperation(), |
General Comments 0
You need to be logged in to leave comments.
Login now