]> sigrok.org Git - pulseview.git/blame - pv/data/signalbase.hpp
Rename Trace::channel_ to Trace::base_, including dependencies
[pulseview.git] / pv / data / signalbase.hpp
CommitLineData
bf0edd2b
SA
1/*
2 * This file is part of the PulseView project.
3 *
4 * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5 * Copyright (C) 2016 Soeren Apel <soeren@apelpie.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef PULSEVIEW_PV_DATA_SIGNALBASE_HPP
23#define PULSEVIEW_PV_DATA_SIGNALBASE_HPP
24
25#include <QColor>
26#include <QObject>
27#include <QString>
28
29#include <libsigrokcxx/libsigrokcxx.hpp>
30
31
32namespace sigrok {
33class Channel;
34class ChannelType;
35}
36
37namespace pv {
38namespace data {
39
40class SignalBase : public QObject
41{
42 Q_OBJECT
43
44private:
45 static const int ColourBGAlpha;
46
47public:
48 SignalBase(std::shared_ptr<sigrok::Channel> channel);
49 virtual ~SignalBase() {}
50
51public:
52 /**
53 * Returns the underlying SR channel.
54 */
55 std::shared_ptr<sigrok::Channel> channel() const;
56
57 /**
58 * Returns enabled status of this channel.
59 */
60 bool enabled() const;
61
62 /**
63 * Sets the enabled status of this channel.
64 * @param value Boolean value to set.
65 */
66 void set_enabled(bool value);
67
68 /**
69 * Gets the type of this channel.
70 */
71 const sigrok::ChannelType *type() const;
72
73 /**
74 * Gets the index number of this channel.
75 */
76 unsigned int index() const;
77
78 /**
79 * Gets the name of this signal.
80 */
81 QString name() const;
82
83 /**
84 * Sets the name of the signal.
85 */
86 virtual void set_name(QString name);
87
88 /**
89 * Get the colour of the signal.
90 */
91 QColor colour() const;
92
93 /**
94 * Set the colour of the signal.
95 */
96 void set_colour(QColor colour);
97
98 /**
99 * Get the background colour of the signal.
100 */
101 QColor bgcolour() const;
102
103Q_SIGNALS:
104 void enabled_changed(const bool &value);
105
106 void name_changed(const QString &name);
107
108 void colour_changed(const QColor &colour);
109
110private:
111 std::shared_ptr<sigrok::Channel> channel_;
112 QString name_;
113 QColor colour_, bgcolour_;
114};
115
116} // namespace data
117} // namespace pv
118
119#endif // PULSEVIEW_PV_DATA_SIGNALBASE_HPP