X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Flogicsignal.cpp;h=3593a5d0a7035039e33ee312ee0de8ca0864e7e2;hb=60938e0430a0d08792ba53b86ca94153baaed74d;hp=f78170b01a30a0028a95befaf7665e7d8a33e649;hpb=6f925ba9d6faf1077b73c5a5808259576081716a;p=pulseview.git diff --git a/pv/view/logicsignal.cpp b/pv/view/logicsignal.cpp index f78170b..3593a5d 100644 --- a/pv/view/logicsignal.cpp +++ b/pv/view/logicsignal.cpp @@ -31,14 +31,14 @@ #include "logicsignal.hpp" #include "view.hpp" -#include -#include -#include #include #include #include -#include +#include +#include #include +#include +#include #include @@ -53,9 +53,7 @@ using std::vector; using sigrok::ConfigKey; using sigrok::Capability; -using sigrok::Error; using sigrok::Trigger; -using sigrok::TriggerStage; using sigrok::TriggerMatch; using sigrok::TriggerMatchType; @@ -156,7 +154,7 @@ void LogicSignal::scale_handle_dragged(int offset) signal_height_ = ((units < 1) ? 1 : units) * font_height; } -void LogicSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp) +void LogicSignal::paint_mid(QPainter &p, ViewItemPaintParams &pp) { QLineF *line; @@ -178,8 +176,7 @@ void LogicSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp) if (segments.empty()) return; - const shared_ptr &segment = - segments.front(); + const shared_ptr &segment = segments.front(); double samplerate = segment->samplerate(); @@ -256,7 +253,7 @@ void LogicSignal::paint_mid(QPainter &p, const ViewItemPaintParams &pp) delete[] sampling_points; } -void LogicSignal::paint_fore(QPainter &p, const ViewItemPaintParams &pp) +void LogicSignal::paint_fore(QPainter &p, ViewItemPaintParams &pp) { // Draw the trigger marker if (!trigger_match_ || !base_->enabled()) @@ -347,6 +344,10 @@ void LogicSignal::init_trigger_actions(QWidget *parent) const vector LogicSignal::get_trigger_types() const { + // We may not be associated with a device + if (!device_) + return vector(); + const auto sr_dev = device_->device(); if (sr_dev->config_check(ConfigKey::TRIGGER_MATCH, Capability::LIST)) { const Glib::VariantContainerBase gvar = @@ -393,7 +394,7 @@ QAction* LogicSignal::action_from_trigger_type(const TriggerMatchType *type) action = trigger_change_; break; default: - assert(0); + assert(false); } }