]> sigrok.org Git - pulseview.git/blame - pv/views/trace/signal.hpp
Typo fix: treshold -> threshold
[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
2acdb232 30#include "trace.hpp"
4b5782e1 31#include "viewitemowner.hpp"
e0e90d80 32
6f925ba9
UH
33using std::shared_ptr;
34
51e77110
JH
35namespace pv {
36
2b81ae46 37class Session;
b86aa8f4 38
1b1ec774 39namespace data {
bf0edd2b 40class SignalBase;
28a4c9c5 41class SignalData;
1b1ec774 42}
28a4c9c5 43
f4e57597 44namespace views {
1573bf16 45namespace trace {
a2f71ef0 46
1373fec5
SA
47/**
48 * The Signal class represents a series of numeric values that can be drawn.
49 * This is the main difference to the more generic @ref Trace class.
50 *
51 * It is generally accepted that Signal instances consider themselves to be
52 * individual channels on e.g. an oscilloscope, though it should be kept in
53 * mind that virtual signals (e.g. math) will also be served by the Signal
54 * class.
55 */
4b5782e1 56class Signal : public Trace, public ViewItemOwner
28a4c9c5 57{
2a2512b2
JH
58 Q_OBJECT
59
28a4c9c5 60protected:
6f925ba9 61 Signal(pv::Session &session, shared_ptr<data::SignalBase> channel);
28a4c9c5
JH
62
63public:
49f8ff3f
JH
64 /**
65 * Sets the name of the signal.
66 */
bf0edd2b 67 virtual void set_name(QString name);
49f8ff3f 68
6f925ba9 69 virtual shared_ptr<pv::data::SignalData> data() const = 0;
9a0cd293 70
b3b57abc 71 /**
931f20b0 72 * Returns true if the trace is visible and enabled.
a29bb7fb 73 */
931f20b0 74 bool enabled() const;
a29bb7fb 75
6f925ba9 76 shared_ptr<data::SignalBase> base() const;
632ba77e 77
3a21afa6
SA
78 virtual void save_settings(QSettings &settings) const;
79
80 virtual void restore_settings(QSettings &settings);
81
60938e04 82 void paint_back(QPainter &p, ViewItemPaintParams &pp);
99af6802 83
0c0218fd
JH
84 virtual void populate_popup_form(QWidget *parent, QFormLayout *form);
85
86e823ca
JH
86 QMenu* create_context_menu(QWidget *parent);
87
5ed1adf5
JH
88 void delete_pressed();
89
bf0edd2b
SA
90protected Q_SLOTS:
91 virtual void on_name_changed(const QString &text);
92
86e823ca
JH
93 void on_disable();
94
a45b9b9e
SA
95 void on_enabled_changed(bool enabled);
96
28a4c9c5 97protected:
2b81ae46 98 pv::Session &session_;
cec48d16 99
8dbbc7f0 100 QComboBox *name_widget_;
28a4c9c5 101};
51e77110 102
1573bf16 103} // namespace trace
f4e57597 104} // namespace views
51e77110 105} // namespace pv
640d091b 106
f4e57597 107#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_SIGNAL_HPP