X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fviews%2Ftrace%2Fdecodetrace.cpp;h=65a2bf6c6a72f3e773b837e1941565bd7378012a;hp=574e9d1ae96b8891689c402548182cceae2b869d;hb=af33d4cbacc745f4473f5c0f4fa1f9ebb8d84d0a;hpb=556259d2d0a212c20db9b18311b9524b52401a56 diff --git a/pv/views/trace/decodetrace.cpp b/pv/views/trace/decodetrace.cpp index 574e9d1a..65a2bf6c 100644 --- a/pv/views/trace/decodetrace.cpp +++ b/pv/views/trace/decodetrace.cpp @@ -173,7 +173,7 @@ void DecodeTrace::paint_mid(QPainter &p, ViewItemPaintParams &pp) // Iterate through the rows int y = get_visual_y(); - pair sample_range = get_sample_range(pp.left(), pp.right()); + pair sample_range = get_view_sample_range(pp.left(), pp.right()); // Just because the view says we see a certain sample range it // doesn't mean we have this many decoded samples, too, so crop @@ -328,6 +328,23 @@ QMenu* DecodeTrace::create_header_context_menu(QWidget *parent) QMenu* DecodeTrace::create_view_context_menu(QWidget *parent, QPoint &click_pos) { + // Get entries from default menu before adding our own + QMenu *const menu = new QMenu(parent); + + QMenu* default_menu = Trace::create_view_context_menu(parent, click_pos); + if (default_menu) { + for (QAction *action : default_menu->actions()) { // clazy:exclude=range-loop + menu->addAction(action); + if (action->parent() == default_menu) + action->setParent(menu); + } + delete default_menu; + + // Add separator if needed + if (menu->actions().length() > 0) + menu->addSeparator(); + } + try { selected_row_ = &visible_rows_[get_row_at_point(click_pos)]; } catch (out_of_range&) { @@ -336,11 +353,9 @@ QMenu* DecodeTrace::create_view_context_menu(QWidget *parent, QPoint &click_pos) // Default sample range is "from here" const pair sample_range = - get_sample_range(click_pos.x(), click_pos.x() + 1); + get_view_sample_range(click_pos.x(), click_pos.x() + 1); selected_sample_range_ = make_pair(sample_range.first, numeric_limits::max()); - QMenu *const menu = new QMenu(parent); - if (decode_signal_->is_paused()) { QAction *const resume = new QAction(tr("Resume decoding"), this); @@ -719,7 +734,7 @@ pair DecodeTrace::get_pixels_offset_samples_per_pixel() const return make_pair(pixels_offset, samplerate * scale); } -pair DecodeTrace::get_sample_range( +pair DecodeTrace::get_view_sample_range( int x_start, int x_end) const { double samples_per_pixel, pixels_offset; @@ -789,7 +804,7 @@ const QString DecodeTrace::get_annotation_at_point(const QPoint &point) return QString(); const pair sample_range = - get_sample_range(point.x(), point.x() + 1); + get_view_sample_range(point.x(), point.x() + 1); const int row = get_row_at_point(point); if (row < 0) return QString(); @@ -884,7 +899,7 @@ void DecodeTrace::create_decoder_form(int index, const vector channels = decode_signal_->get_channels(); // Add the channels - for (DecodeChannel ch : channels) { + for (const DecodeChannel& ch : channels) { // Ignore channels not part of the decoder we create the form for if (ch.decoder_ != dec) continue; @@ -1021,8 +1036,7 @@ void DecodeTrace::export_annotations(vector *annotations) const } QMessageBox msg(owner_->view()); - msg.setText(tr("Error")); - msg.setInformativeText(tr("File %1 could not be written to.").arg(file_name)); + msg.setText(tr("Error") + "\n\n" + tr("File %1 could not be written to.").arg(file_name)); msg.setStandardButtons(QMessageBox::Ok); msg.setIcon(QMessageBox::Warning); msg.exec();