| 41 | namespace dialogs { |
| 42 | |
| 43 | DsoMeasure::DsoMeasure(SigSession *session, View &parent, |
| 44 | unsigned int position, int last_sig_index) : |
| 45 | DSDialog((QWidget *)&parent), |
| 46 | _session(session), |
| 47 | _view(parent), |
| 48 | _position(position), |
| 49 | _button_box(QDialogButtonBox::Reset | QDialogButtonBox::Cancel, |
| 50 | Qt::Horizontal, this) |
| 51 | { |
| 52 | _measure_tab = NULL; |
| 53 | |
| 54 | setMinimumSize(500, 400); |
| 55 | |
| 56 | _measure_tab = new QTabWidget(this); |
| 57 | _measure_tab->setTabPosition(QTabWidget::West); |
| 58 | _measure_tab->setUsesScrollButtons(false); |
| 59 | |
| 60 | for(auto s : _session->get_signals()) { |
| 61 | if (s->signal_type() == SR_CHANNEL_DSO && s->enabled()) { |
| 62 | view::DsoSignal *dsoSig = (view::DsoSignal*)s; |
| 63 | QWidget *measure_widget = new QWidget(this); |
| 64 | this->add_measure(measure_widget, dsoSig); |
| 65 | _measure_tab->addTab(measure_widget, QString::number(dsoSig->get_index())); |
| 66 | _measure_tab->tabBar()->setMinimumHeight(30); |
| 67 | _measure_tab->tabBar()->setPalette(QPalette(Qt::red)); |
| 68 | measure_widget->setProperty("index", dsoSig->get_index()); |
| 69 | if (dsoSig->get_index() == last_sig_index) |
| 70 | _measure_tab->setCurrentIndex(last_sig_index); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | _layout.addWidget(_measure_tab); |
| 75 | _layout.addWidget(&_button_box, Qt::AlignHCenter | Qt::AlignBottom); |
| 76 | |
| 77 | layout()->addLayout(&_layout); |
| 78 | setTitle(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_MEASUREMENTS), "Measurements")); |
| 79 | |
| 80 | connect(_button_box.button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); |
| 81 | connect(_button_box.button(QDialogButtonBox::Reset), SIGNAL(clicked()), this, SLOT(reset())); |
| 82 | connect(_session->device_event_object(), SIGNAL(device_updated()), this, SLOT(reject())); |
| 83 | } |
| 84 | |
| 85 | DsoMeasure::~DsoMeasure(){ |
| 86 | DESTROY_QT_OBJECT(_measure_tab); |
nothing calls this directly
no test coverage detected