]> sigrok.org Git - pulseview.git/blame - pv/view/signal.hpp
Fix inconsistent declaration parameter names.
[pulseview.git] / pv / view / 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
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
7a01bd36
JH
21#ifndef PULSEVIEW_PV_VIEW_SIGNAL_HPP
22#define PULSEVIEW_PV_VIEW_SIGNAL_HPP
640d091b 23
f9abf97e 24#include <memory>
9a0cd293 25
9e40e83d 26#include <QComboBox>
9e40e83d 27#include <QWidgetAction>
e3f65ace 28
28a4c9c5
JH
29#include <stdint.h>
30
f1626bb8 31#include "signalscalehandle.hpp"
2acdb232 32#include "trace.hpp"
4b5782e1 33#include "viewitemowner.hpp"
e0e90d80 34
e8d00928
ML
35namespace sigrok {
36 class Channel;
37}
8d3e0764 38
51e77110
JH
39namespace pv {
40
2b81ae46 41class Session;
b86aa8f4 42
1b1ec774 43namespace data {
28a4c9c5 44class SignalData;
1b1ec774 45}
28a4c9c5 46
a2f71ef0
JH
47namespace view {
48
4b5782e1 49class Signal : public Trace, public ViewItemOwner
28a4c9c5 50{
2a2512b2
JH
51 Q_OBJECT
52
28a4c9c5 53protected:
2b81ae46 54 Signal(pv::Session &session,
b86aa8f4 55 std::shared_ptr<sigrok::Channel> channel);
28a4c9c5
JH
56
57public:
49f8ff3f
JH
58 /**
59 * Sets the name of the signal.
60 */
61 void set_name(QString name);
62
f9abf97e 63 virtual std::shared_ptr<pv::data::SignalData> data() const = 0;
9a0cd293 64
b3b57abc 65 /**
931f20b0 66 * Returns true if the trace is visible and enabled.
a29bb7fb 67 */
931f20b0 68 bool enabled() const;
a29bb7fb 69
aca00b1e
JH
70 void enable(bool enable = true);
71
e8d00928 72 std::shared_ptr<sigrok::Channel> channel() const;
632ba77e 73
4b5782e1
JH
74 /**
75 * Returns a list of row items owned by this object.
76 */
77 const item_list& child_items() const;
78
99af6802
SA
79 void paint_back(QPainter &p, const ViewItemPaintParams &pp);
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
e9213170 103private Q_SLOTS:
86e823ca
JH
104 void on_disable();
105
28a4c9c5 106protected:
2b81ae46 107 pv::Session &session_;
8dbbc7f0 108 std::shared_ptr<sigrok::Channel> channel_;
cec48d16 109
f1626bb8 110 const std::shared_ptr<SignalScaleHandle> scale_handle_;
4b5782e1
JH
111 const item_list items_;
112
8dbbc7f0 113 QComboBox *name_widget_;
28a4c9c5 114};
51e77110 115
8d634081 116} // namespace view
51e77110 117} // namespace pv
640d091b 118
7a01bd36 119#endif // PULSEVIEW_PV_VIEW_SIGNAL_HPP