-const QColor AnalogSignal::SignalColors[4] = {
- QColor(0xC4, 0xA0, 0x00), // Yellow
- QColor(0x87, 0x20, 0x7A), // Magenta
- QColor(0x20, 0x4A, 0x87), // Blue
- QColor(0x4E, 0x9A, 0x06) // Green
-};
-
const QPen AnalogSignal::AxisPen(QColor(0, 0, 0, 30 * 256 / 100), 2);
const QColor AnalogSignal::GridMajorColor = QColor(0, 0, 0, 40 * 256 / 100);
const QColor AnalogSignal::GridMinorColor = QColor(0, 0, 0, 20 * 256 / 100);
const QPen AnalogSignal::AxisPen(QColor(0, 0, 0, 30 * 256 / 100), 2);
const QColor AnalogSignal::GridMajorColor = QColor(0, 0, 0, 40 * 256 / 100);
const QColor AnalogSignal::GridMinorColor = QColor(0, 0, 0, 20 * 256 / 100);
- if (!segment || (segment->get_sample_count() == 0))
- return;
-
- const double pixels_offset = pp.pixels_offset();
- const double samplerate = max(1.0, segment->samplerate());
- const pv::util::Timestamp& start_time = segment->start_time();
- const int64_t last_sample = (int64_t)segment->get_sample_count() - 1;
- const double samples_per_pixel = samplerate * pp.scale();
- const pv::util::Timestamp start = samplerate * (pp.offset() - start_time);
- const pv::util::Timestamp end = start + samples_per_pixel * pp.width();
-
- const int64_t start_sample = min(max(floor(start).convert_to<int64_t>(),
- (int64_t)0), last_sample);
- const int64_t end_sample = min(max((ceil(end) + 1).convert_to<int64_t>(),
- (int64_t)0), last_sample);
-
- if (samples_per_pixel < EnvelopeThreshold)
- paint_trace(p, segment, y, pp.left(), start_sample, end_sample,
- pixels_offset, samples_per_pixel);
- else
- paint_envelope(p, segment, y, pp.left(), start_sample, end_sample,
- pixels_offset, samples_per_pixel);
+
+ if (segment && (segment->get_sample_count() > 0)) {
+ const double pixels_offset = pp.pixels_offset();
+ const double samplerate = max(1.0, segment->samplerate());
+ const pv::util::Timestamp& start_time = segment->start_time();
+ const int64_t last_sample = (int64_t)segment->get_sample_count() - 1;
+ const double samples_per_pixel = samplerate * pp.scale();
+ const pv::util::Timestamp start = samplerate * (pp.offset() - start_time);
+ const pv::util::Timestamp end = start + samples_per_pixel * pp.width();
+
+ const int64_t start_sample = min(max(floor(start).convert_to<int64_t>(),
+ (int64_t)0), last_sample);
+ const int64_t end_sample = min(max((ceil(end) + 1).convert_to<int64_t>(),
+ (int64_t)0), last_sample);
+
+ if (samples_per_pixel < EnvelopeThreshold)
+ paint_trace(p, segment, y, pp.left(), start_sample, end_sample,
+ pixels_offset, samples_per_pixel);
+ else
+ paint_envelope(p, segment, y, pp.left(), start_sample, end_sample,
+ pixels_offset, samples_per_pixel);
+ }
// Show the info section on the right side of the trace, including
// the value at the hover point when the hover marker is enabled
// and we have corresponding data available
if (show_hover_marker_ && !std::isnan(value_at_hover_pos_)) {
infotext = QString("[%1] %2 V/div")
// Show the info section on the right side of the trace, including
// the value at the hover point when the hover marker is enabled
// and we have corresponding data available
if (show_hover_marker_ && !std::isnan(value_at_hover_pos_)) {
infotext = QString("[%1] %2 V/div")
// Add div-related settings
pvdiv_sb_ = new QSpinBox(parent);
pvdiv_sb_->setRange(0, MaximumVDivs);
pvdiv_sb_->setValue(pos_vdivs_);
connect(pvdiv_sb_, SIGNAL(valueChanged(int)),
this, SLOT(on_pos_vdivs_changed(int)));
// Add div-related settings
pvdiv_sb_ = new QSpinBox(parent);
pvdiv_sb_->setRange(0, MaximumVDivs);
pvdiv_sb_->setValue(pos_vdivs_);
connect(pvdiv_sb_, SIGNAL(valueChanged(int)),
this, SLOT(on_pos_vdivs_changed(int)));
nvdiv_sb_ = new QSpinBox(parent);
nvdiv_sb_->setRange(0, MaximumVDivs);
nvdiv_sb_->setValue(neg_vdivs_);
connect(nvdiv_sb_, SIGNAL(valueChanged(int)),
this, SLOT(on_neg_vdivs_changed(int)));
nvdiv_sb_ = new QSpinBox(parent);
nvdiv_sb_->setRange(0, MaximumVDivs);
nvdiv_sb_->setValue(neg_vdivs_);
connect(nvdiv_sb_, SIGNAL(valueChanged(int)),
this, SLOT(on_neg_vdivs_changed(int)));
div_height_sb_->setValue(div_height_);
connect(div_height_sb_, SIGNAL(valueChanged(int)),
this, SLOT(on_div_height_changed(int)));
div_height_sb_->setValue(div_height_);
connect(div_height_sb_, SIGNAL(valueChanged(int)),
this, SLOT(on_div_height_changed(int)));
vdiv_layout->addWidget(resolution_cb_, 0, 0);
vdiv_layout->addWidget(vdiv_unit, 0, 1);
vdiv_layout->addWidget(resolution_cb_, 0, 0);
vdiv_layout->addWidget(vdiv_unit, 0, 1);
connect(display_type_cb_, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_display_type_changed(int)));
// Update the conversion widget contents and states
update_conversion_widgets();
connect(display_type_cb_, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_display_type_changed(int)));
// Update the conversion widget contents and states
update_conversion_widgets();