2 * This file is part of the PulseView project.
4 * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5 * Copyright (C) 2016 Soeren Apel <soeren@apelpie.net>
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.
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.
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
22 #include "signalbase.hpp"
24 using std::shared_ptr;
26 using sigrok::Channel;
27 using sigrok::ChannelType;
32 const int SignalBase::ColourBGAlpha = 8*256/100;
34 SignalBase::SignalBase(shared_ptr<sigrok::Channel> channel) :
39 shared_ptr<sigrok::Channel> SignalBase::channel() const
44 QString SignalBase::name() const
46 return (channel_) ? QString::fromStdString(channel_->name()) : name_;
49 void SignalBase::set_name(QString name)
52 channel_->set_name(name.toUtf8().constData());
59 bool SignalBase::enabled() const
61 return (channel_) ? channel_->enabled() : true;
64 void SignalBase::set_enabled(bool value)
67 channel_->set_enabled(value);
68 enabled_changed(value);
72 const ChannelType *SignalBase::type() const
74 return (channel_) ? channel_->type() : nullptr;
77 unsigned int SignalBase::index() const
79 return (channel_) ? channel_->index() : (unsigned int)-1;
82 QColor SignalBase::colour() const
87 void SignalBase::set_colour(QColor colour)
92 bgcolour_.setAlpha(ColourBGAlpha);
94 colour_changed(colour);
97 QColor SignalBase::bgcolour() const