From: Tilman Sauerbeck Date: Sat, 7 Nov 2015 10:40:02 +0000 (+0100) Subject: Use the TriggerMarker class to visualize the time of SR_DF_TRIGGER. X-Git-Tag: pulseview-0.3.0~44 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1a2288a1b2479be9001fab6ced8385cfc86c3f69;p=pulseview.git Use the TriggerMarker class to visualize the time of SR_DF_TRIGGER. This allows us to remove the name-based immovable hack from Flag. Note that this also means that the trigger marker no longer has a name at all. --- diff --git a/pv/view/flag.cpp b/pv/view/flag.cpp index 380ef327..779ea2ee 100644 --- a/pv/view/flag.cpp +++ b/pv/view/flag.cpp @@ -108,15 +108,5 @@ void Flag::on_text_changed(const QString &text) view_.time_item_appearance_changed(true, false); } -void Flag::drag_by(const QPoint &delta) -{ - // Treat trigger markers as immovable - if (text_ == "T") - return; - - TimeMarker::drag_by(delta); -} - - } // namespace view } // namespace pv diff --git a/pv/view/flag.hpp b/pv/view/flag.hpp index af4c7b9d..bc82934e 100644 --- a/pv/view/flag.hpp +++ b/pv/view/flag.hpp @@ -68,8 +68,6 @@ public: void delete_pressed(); - void drag_by(const QPoint &delta); - private Q_SLOTS: void on_delete(); diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 7f9caa4c..15dd0581 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -48,6 +48,7 @@ #include "ruler.hpp" #include "signal.hpp" #include "tracegroup.hpp" +#include "triggermarker.hpp" #include "view.hpp" #include "viewport.hpp" @@ -114,6 +115,7 @@ View::View(Session &session, QWidget *parent) : show_cursors_(false), cursors_(new CursorPair(*this)), next_flag_text_('A'), + trigger_marker_(nullptr), hover_point_(-1, -1) { connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), @@ -207,6 +209,10 @@ vector< shared_ptr > View::time_items() const items.push_back(cursors_); items.push_back(cursors_->first()); items.push_back(cursors_->second()); + + if (trigger_marker_) + items.push_back(trigger_marker_); + return items; } @@ -466,10 +472,6 @@ void View::add_flag(const Timestamp& time) next_flag_text_ = (next_flag_text_ >= 'Z') ? 'A' : (next_flag_text_ + 1); - // Skip 'T' (for trigger) as it's treated special - if (next_flag_text_ == 'T') - next_flag_text_ += 1; - time_item_appearance_changed(true, true); } @@ -526,12 +528,10 @@ void View::restack_all_trace_tree_items() void View::trigger_event(util::Timestamp location) { - char next_flag_text = next_flag_text_; - - next_flag_text_ = 'T'; - add_flag(location); - - next_flag_text_ = next_flag_text; + if (trigger_marker_) + trigger_marker_->set_time(location); + else + trigger_marker_ = std::shared_ptr(new TriggerMarker(*this, location)); } void View::get_scroll_layout(double &length, Timestamp &offset) const diff --git a/pv/view/view.hpp b/pv/view/view.hpp index 9bb42ef1..b64c09d2 100644 --- a/pv/view/view.hpp +++ b/pv/view/view.hpp @@ -55,6 +55,7 @@ class Header; class Ruler; class Trace; class Viewport; +class TriggerMarker; class View : public QAbstractScrollArea, public TraceTreeItemOwner { Q_OBJECT @@ -383,6 +384,8 @@ private: std::list< std::shared_ptr > flags_; char next_flag_text_; + std::shared_ptr trigger_marker_; + QPoint hover_point_; unsigned int sticky_events_;