]> sigrok.org Git - pulseview.git/commitdiff
Move current_segment_ to Trace
authorSoeren Apel <redacted>
Tue, 21 Nov 2017 21:07:09 +0000 (22:07 +0100)
committerSoeren Apel <redacted>
Wed, 27 Dec 2017 17:40:19 +0000 (18:40 +0100)
pv/views/trace/signal.cpp
pv/views/trace/signal.hpp
pv/views/trace/trace.cpp
pv/views/trace/trace.hpp

index a286d95d3c6d07e9b299aefce8ef48701668a987..1e277f0d57196beb1ada1be3c4b016e4d44a5d95 100644 (file)
@@ -62,8 +62,7 @@ Signal::Signal(pv::Session &session,
        shared_ptr<data::SignalBase> channel) :
        Trace(channel),
        session_(session),
-       name_widget_(nullptr),
-       current_segment_(0)
+       name_widget_(nullptr)
 {
        assert(base_);
 
@@ -89,16 +88,6 @@ shared_ptr<data::SignalBase> 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;
index 2cc49a77d1962499c8bece819c5a0824485bf543..7f88720f7943904142008b82d88f8103caefa464 100644 (file)
@@ -75,10 +75,6 @@ public:
 
        shared_ptr<data::SignalBase> 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
index b5fc0b1b5478333930ffbb150460c779a0a2ee40..91fde4725cbbf6f142644174a7e1103be26ff5fa 100644 (file)
@@ -52,6 +52,7 @@ Trace::Trace(shared_ptr<data::SignalBase> 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();
index 75705226780e8c7a7aea029806fbf5ffdf78b4d4..cd1c8af349f7014b80547549ed462f33eba63d16 100644 (file)
@@ -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_;