]> sigrok.org Git - pulseview.git/blame - pv/views/trace/signal.hpp
Adjust trace view namespace
[pulseview.git] / pv / views / trace / signal.hpp
CommitLineData
28a4c9c5 1/*
b3f22de0 2 * This file is part of the PulseView project.
28a4c9c5
JH
3 *
4 * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
efdec55a 17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
28a4c9c5
JH
18 */
19
f4e57597
SA
20#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNAL_HPP
21#define PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNAL_HPP
640d091b 22
f9abf97e 23#include <memory>
9a0cd293 24
9e40e83d 25#include <QComboBox>
9e40e83d 26#include <QWidgetAction>
e3f65ace 27
cafe470e 28#include <cstdint>
28a4c9c5 29
f1626bb8 30#include "signalscalehandle.hpp"
2acdb232 31#include "trace.hpp"
4b5782e1 32#include "viewitemowner.hpp"
e0e90d80 33
6f925ba9
UH
34using std::shared_ptr;
35
51e77110
JH
36namespace pv {
37
2b81ae46 38class Session;
b86aa8f4 39
1b1ec774 40namespace data {
bf0edd2b 41class SignalBase;
28a4c9c5 42class SignalData;
1b1ec774 43}
28a4c9c5 44
f4e57597 45namespace views {
1573bf16 46namespace trace {
a2f71ef0 47
4b5782e1 48class Signal : public Trace, public ViewItemOwner
28a4c9c5 49{
2a2512b2
JH
50 Q_OBJECT
51
28a4c9c5 52protected:
6f925ba9 53 Signal(pv::Session &session, shared_ptr<data::SignalBase> channel);
28a4c9c5
JH
54
55public:
49f8ff3f
JH
56 /**
57 * Sets the name of the signal.
58 */
bf0edd2b 59 virtual void set_name(QString name);
49f8ff3f 60
6f925ba9 61 virtual shared_ptr<pv::data::SignalData> data() const = 0;
9a0cd293 62
b3b57abc 63 /**
931f20b0 64 * Returns true if the trace is visible and enabled.
a29bb7fb 65 */
931f20b0 66 bool enabled() const;
a29bb7fb 67
6f925ba9 68 shared_ptr<data::SignalBase> base() const;
632ba77e 69
3a21afa6
SA
70 virtual void save_settings(QSettings &settings) const;
71
72 virtual void restore_settings(QSettings &settings);
73
4b5782e1
JH
74 /**
75 * Returns a list of row items owned by this object.
76 */
77 const item_list& child_items() const;
78
60938e04 79 void paint_back(QPainter &p, ViewItemPaintParams &pp);
99af6802 80
0c0218fd
JH
81 virtual void populate_popup_form(QWidget *parent, QFormLayout *form);
82
86e823ca
JH
83 QMenu* create_context_menu(QWidget *parent);
84
5ed1adf5
JH
85 void delete_pressed();
86
214470fc
JH
87 /**
88 * Returns the offset to show the drag handle.
89 */
90 virtual int scale_handle_offset() const = 0;
91
92 /**
93 * Handles the scale handle being dragged to an offset.
94 * @param offset the offset the scale handle was dragged to.
95 */
96 virtual void scale_handle_dragged(int offset) = 0;
97
98 /**
99 * Handles the scale handle being being released.
100 */
101 virtual void scale_handle_released() {};
102
bf0edd2b
SA
103protected Q_SLOTS:
104 virtual void on_name_changed(const QString &text);
105
86e823ca
JH
106 void on_disable();
107
a45b9b9e
SA
108 void on_enabled_changed(bool enabled);
109
28a4c9c5 110protected:
2b81ae46 111 pv::Session &session_;
cec48d16 112
6f925ba9 113 const shared_ptr<SignalScaleHandle> scale_handle_;
4b5782e1
JH
114 const item_list items_;
115
8dbbc7f0 116 QComboBox *name_widget_;
28a4c9c5 117};
51e77110 118
1573bf16 119} // namespace trace
f4e57597 120} // namespace views
51e77110 121} // namespace pv
640d091b 122
f4e57597 123#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNAL_HPP