| 183 | } |
| 184 | |
| 185 | void MathOptions::Apply() |
| 186 | { |
| 187 | int src1 = -1; |
| 188 | int src2 = -1; |
| 189 | data::MathStack::MathType type = data::MathStack::MATH_ADD; |
| 190 | for (QVector<QRadioButton *>::const_iterator i = _src1_radio.begin(); |
| 191 | i != _src1_radio.end(); i++) { |
| 192 | if ((*i)->isChecked()) { |
| 193 | src1 = (*i)->property("index").toInt(); |
| 194 | break; |
| 195 | } |
| 196 | } |
| 197 | for (QVector<QRadioButton *>::const_iterator i = _src2_radio.begin(); |
| 198 | i != _src2_radio.end(); i++) { |
| 199 | if ((*i)->isChecked()) { |
| 200 | src2 = (*i)->property("index").toInt(); |
| 201 | break; |
| 202 | } |
| 203 | } |
| 204 | for (QVector<QRadioButton *>::const_iterator i = _math_radio.begin(); |
| 205 | i != _math_radio.end(); i++) { |
| 206 | if ((*i)->isChecked()) { |
| 207 | type = (data::MathStack::MathType)(*i)->property("type").toInt(); |
| 208 | break; |
| 209 | } |
| 210 | } |
| 211 | bool enable = (src1 != -1 && src2 != -1 && _enable->isChecked()); |
| 212 | view::DsoSignal *dsoSig1 = NULL; |
| 213 | view::DsoSignal *dsoSig2 = NULL; |
| 214 | |
| 215 | for(auto s : _session->get_signals()) { |
| 216 | if (s->signal_type() == SR_CHANNEL_DSO) { |
| 217 | view::DsoSignal *dsoSig = (view::DsoSignal*)s; |
| 218 | if (dsoSig->get_index() == src1) |
| 219 | dsoSig1 = dsoSig; |
| 220 | if (dsoSig->get_index() == src2) |
| 221 | dsoSig2 = dsoSig; |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | if (dsoSig1 != NULL && dsoSig2 != NULL){ |
| 226 | _session->math_rebuild(enable, dsoSig1, dsoSig2, type); |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | void MathOptions::reject() |
| 231 | { |
no test coverage detected