From: Soeren Apel Date: Tue, 21 Nov 2017 21:07:09 +0000 (+0100) Subject: Move current_segment_ to Trace X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=2749b858a7bc0bb67d550438695f2ae9c613b6c7;p=pulseview.git Move current_segment_ to Trace --- diff --git a/pv/views/trace/signal.cpp b/pv/views/trace/signal.cpp index a286d95d..1e277f0d 100644 --- a/pv/views/trace/signal.cpp +++ b/pv/views/trace/signal.cpp @@ -62,8 +62,7 @@ Signal::Signal(pv::Session &session, shared_ptr channel) : Trace(channel), session_(session), - name_widget_(nullptr), - current_segment_(0) + name_widget_(nullptr) { assert(base_); @@ -89,16 +88,6 @@ shared_ptr Signal::base() const return base_; } -void Signal::set_current_segment(const int segment) -{ - current_segment_ = segment; -} - -int Signal::get_current_segment() const -{ - return current_segment_; -} - void Signal::save_settings(QSettings &settings) const { (void)settings; diff --git a/pv/views/trace/signal.hpp b/pv/views/trace/signal.hpp index 2cc49a77..7f88720f 100644 --- a/pv/views/trace/signal.hpp +++ b/pv/views/trace/signal.hpp @@ -75,10 +75,6 @@ public: shared_ptr base() const; - void set_current_segment(const int segment); - - int get_current_segment() const; - virtual void save_settings(QSettings &settings) const; virtual void restore_settings(QSettings &settings); @@ -102,9 +98,6 @@ protected: pv::Session &session_; QComboBox *name_widget_; - - /// The ID of the currently displayed segment - int current_segment_; }; } // namespace trace diff --git a/pv/views/trace/trace.cpp b/pv/views/trace/trace.cpp index b5fc0b1b..91fde472 100644 --- a/pv/views/trace/trace.cpp +++ b/pv/views/trace/trace.cpp @@ -52,6 +52,7 @@ Trace::Trace(shared_ptr channel) : base_(channel), axis_pen_(AxisPen), segment_display_mode_(ShowLastSegmentOnly), // Will be overwritten by View + current_segment_(0), popup_(nullptr), popup_form_(nullptr) { @@ -161,6 +162,16 @@ QRectF Trace::label_rect(const QRectF &rect) const label_size.height()); } +void Trace::set_current_segment(const int segment) +{ + current_segment_ = segment; +} + +int Trace::get_current_segment() const +{ + return current_segment_; +} + void Trace::paint_back(QPainter &p, ViewItemPaintParams &pp) { const View *view = owner_->view(); diff --git a/pv/views/trace/trace.hpp b/pv/views/trace/trace.hpp index 75705226..cd1c8af3 100644 --- a/pv/views/trace/trace.hpp +++ b/pv/views/trace/trace.hpp @@ -126,6 +126,10 @@ public: */ QRectF label_rect(const QRectF &rect) const; + void set_current_segment(const int segment); + + int get_current_segment() const; + protected: /** * Paints the background layer of the signal with a QPainter. @@ -166,6 +170,9 @@ protected: SegmentDisplayMode segment_display_mode_; + /// The ID of the currently displayed segment + int current_segment_; + private: pv::widgets::Popup *popup_; QFormLayout *popup_form_;