projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
INSTALL: Fix incorrect gcc/clang minimum versions.
[pulseview.git]
/
pv
/
popups
/
channels.cpp
diff --git
a/pv/popups/channels.cpp
b/pv/popups/channels.cpp
index 4598f1239185219a9ce088ae7dccbd4d16ada088..49784bd7ae40630f3f5b3ccc4e125a9f228053e4 100644
(file)
--- a/
pv/popups/channels.cpp
+++ b/
pv/popups/channels.cpp
@@
-14,8
+14,7
@@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <map>
*/
#include <map>
@@
-27,33
+26,32
@@
#include "channels.hpp"
#include "channels.hpp"
-#include <pv/prop/binding/deviceoptions.hpp>
-#include <pv/sigsession.hpp>
+#include <pv/binding/device.hpp>
+#include <pv/data/signalbase.hpp>
+#include <pv/devices/device.hpp>
+#include <pv/session.hpp>
#include <pv/view/signal.hpp>
#include <pv/view/signal.hpp>
-#include <libsigrok
/libsigrok
.hpp>
+#include <libsigrok
cxx/libsigrokcxx
.hpp>
using namespace Qt;
using namespace Qt;
-using boost::shared_lock;
-using boost::shared_mutex;
-using std::lock_guard;
using std::map;
using std::map;
-using std::mutex;
-using std::set;
using std::shared_ptr;
using std::shared_ptr;
+using std::make_shared;
+using std::unordered_set;
using std::vector;
using std::vector;
+using pv::data::SignalBase;
+
using sigrok::Channel;
using sigrok::ChannelGroup;
using sigrok::Device;
using sigrok::Channel;
using sigrok::ChannelGroup;
using sigrok::Device;
-using pv::view::Signal;
-
namespace pv {
namespace popups {
namespace pv {
namespace popups {
-Channels::Channels(S
igS
ession &session, QWidget *parent) :
+Channels::Channels(Session &session, QWidget *parent) :
Popup(parent),
session_(session),
updating_channels_(false),
Popup(parent),
session_(session),
updating_channels_(false),
@@
-64,27
+62,26
@@
Channels::Channels(SigSession &session, QWidget *parent) :
// Create the layout
setLayout(&layout_);
// Create the layout
setLayout(&layout_);
-
shared_ptr<sigrok::Device> device = session_.
device();
+
const shared_ptr<sigrok::Device> device = session_.device()->
device();
assert(device);
// Collect a set of signals
assert(device);
// Collect a set of signals
- map<shared_ptr<Channel>, shared_ptr<Signal> > signal_map;
+ map<shared_ptr<Channel>, shared_ptr<Signal
Base
> > signal_map;
- shared_lock<shared_mutex> lock(session_.signals_mutex());
- const vector< shared_ptr<Signal> > &sigs(session_.signals());
+ unordered_set< shared_ptr<SignalBase> > sigs;
+ for (const shared_ptr<data::SignalBase> b : session_.signalbases())
+ sigs.insert(b);
- for (const shared_ptr<Signal> &sig : sigs)
+ for (const shared_ptr<Signal
Base
> &sig : sigs)
signal_map[sig->channel()] = sig;
// Populate channel groups
signal_map[sig->channel()] = sig;
// Populate channel groups
- for (auto entry : device->channel_groups())
- {
+ for (auto entry : device->channel_groups()) {
shared_ptr<ChannelGroup> group = entry.second;
// Make a set of signals, and removed this signals from the
// signal map.
shared_ptr<ChannelGroup> group = entry.second;
// Make a set of signals, and removed this signals from the
// signal map.
- vector< shared_ptr<Signal> > group_sigs;
- for (auto channel : group->channels())
- {
+ vector< shared_ptr<SignalBase> > group_sigs;
+ for (auto channel : group->channels()) {
const auto iter = signal_map.find(channel);
if (iter == signal_map.end())
const auto iter = signal_map.find(channel);
if (iter == signal_map.end())
@@
-98,17
+95,16
@@
Channels::Channels(SigSession &session, QWidget *parent) :
}
// Make a vector of the remaining channels
}
// Make a vector of the remaining channels
- vector< shared_ptr<Signal> > global_sigs;
- for (auto channel : device->channels())
- {
- const map<shared_ptr<Channel>, shared_ptr<Signal> >::
+ vector< shared_ptr<SignalBase> > global_sigs;
+ for (auto channel : device->channels()) {
+ const map<shared_ptr<Channel>, shared_ptr<SignalBase> >::
const_iterator iter = signal_map.find(channel);
if (iter != signal_map.end())
global_sigs.push_back((*iter).second);
}
// Create a group
const_iterator iter = signal_map.find(channel);
if (iter != signal_map.end())
global_sigs.push_back((*iter).second);
}
// Create a group
- populate_group(
NULL
, global_sigs);
+ populate_group(
nullptr
, global_sigs);
// Create the enable/disable all buttons
connect(&enable_all_channels_, SIGNAL(clicked()),
// Create the enable/disable all buttons
connect(&enable_all_channels_, SIGNAL(clicked()),
@@
-134,14
+130,13
@@
void Channels::set_all_channels(bool set)
{
updating_channels_ = true;
{
updating_channels_ = true;
- for (map<QCheckBox*, shared_ptr<Signal> >::const_iterator i =
- check_box_signal_map_.begin();
- i != check_box_signal_map_.end(); i++)
- {
- const shared_ptr<Signal> sig = (*i).second;
+ for (map<QCheckBox*, shared_ptr<SignalBase> >::const_iterator i =
+ check_box_signal_map_.begin();
+ i != check_box_signal_map_.end(); i++) {
+ const shared_ptr<SignalBase> sig = (*i).second;
assert(sig);
assert(sig);
- sig->
enable
(set);
+ sig->
set_enabled
(set);
(*i).first->setChecked(set);
}
(*i).first->setChecked(set);
}
@@
-149,16
+144,16
@@
void Channels::set_all_channels(bool set)
}
void Channels::populate_group(shared_ptr<ChannelGroup> group,
}
void Channels::populate_group(shared_ptr<ChannelGroup> group,
- const vector< shared_ptr<
pv::view::Signal
> > sigs)
+ const vector< shared_ptr<
SignalBase
> > sigs)
{
{
- using pv::
prop::binding::DeviceOptions
;
+ using pv::
binding::Device
;
// Only bind options if this is a group. We don't do it for general
// options, because these properties are shown in the device config
// popup.
// Only bind options if this is a group. We don't do it for general
// options, because these properties are shown in the device config
// popup.
- shared_ptr<Device
Options
> binding;
+ shared_ptr<Device> binding;
if (group)
if (group)
- binding =
shared_ptr<DeviceOptions>(new DeviceOptions(group)
);
+ binding =
make_shared<Device>(group
);
// Create a title if the group is going to have any content
if ((!sigs.empty() || (binding && !binding->properties().empty())) &&
// Create a title if the group is going to have any content
if ((!sigs.empty() || (binding && !binding->properties().empty())) &&
@@
-167,26
+162,23
@@
void Channels::populate_group(shared_ptr<ChannelGroup> group,
QString("<h3>%1</h3>").arg(group->name().c_str())));
// Create the channel group grid
QString("<h3>%1</h3>").arg(group->name().c_str())));
// Create the channel group grid
- QGridLayout *const channel_grid =
- create_channel_group_grid(sigs);
+ QGridLayout *const channel_grid = create_channel_group_grid(sigs);
layout_.addRow(channel_grid);
// Create the channel group options
layout_.addRow(channel_grid);
// Create the channel group options
- if (binding)
- {
+ if (binding) {
binding->add_properties_to_form(&layout_, true);
group_bindings_.push_back(binding);
}
}
QGridLayout* Channels::create_channel_group_grid(
binding->add_properties_to_form(&layout_, true);
group_bindings_.push_back(binding);
}
}
QGridLayout* Channels::create_channel_group_grid(
- const vector< shared_ptr<
pv::view::Signal
> > sigs)
+ const vector< shared_ptr<
SignalBase
> > sigs)
{
int row = 0, col = 0;
QGridLayout *const grid = new QGridLayout();
{
int row = 0, col = 0;
QGridLayout *const grid = new QGridLayout();
- for (const shared_ptr<pv::view::Signal>& sig : sigs)
- {
+ for (const shared_ptr<SignalBase>& sig : sigs) {
assert(sig);
QCheckBox *const checkbox = new QCheckBox(sig->name());
assert(sig);
QCheckBox *const checkbox = new QCheckBox(sig->name());
@@
-198,24
+190,23
@@
QGridLayout* Channels::create_channel_group_grid(
check_box_signal_map_[checkbox] = sig;
check_box_signal_map_[checkbox] = sig;
- if(++col >= 8)
+ if
(++col >= 8)
col = 0, row++;
}
return grid;
}
col = 0, row++;
}
return grid;
}
-void Channels::showEvent(QShowEvent *e)
+void Channels::showEvent(QShowEvent *e
vent
)
{
{
- pv::widgets::Popup::showEvent(e);
+ pv::widgets::Popup::showEvent(e
vent
);
updating_channels_ = true;
updating_channels_ = true;
- for (map<QCheckBox*, shared_ptr<Signal> >::const_iterator i =
- check_box_signal_map_.begin();
- i != check_box_signal_map_.end(); i++)
- {
- const shared_ptr<Signal> sig = (*i).second;
+ for (map<QCheckBox*, shared_ptr<SignalBase> >::const_iterator i =
+ check_box_signal_map_.begin();
+ i != check_box_signal_map_.end(); i++) {
+ const shared_ptr<SignalBase> sig = (*i).second;
assert(sig);
(*i).first->setChecked(sig->enabled());
assert(sig);
(*i).first->setChecked(sig->enabled());
@@
-233,14
+224,14
@@
void Channels::on_channel_checked(QWidget *widget)
assert(check_box);
// Look up the signal of this check-box
assert(check_box);
// Look up the signal of this check-box
- map< QCheckBox*, shared_ptr<Signal> >::const_iterator iter =
+ map< QCheckBox*, shared_ptr<Signal
Base
> >::const_iterator iter =
check_box_signal_map_.find((QCheckBox*)check_box);
assert(iter != check_box_signal_map_.end());
check_box_signal_map_.find((QCheckBox*)check_box);
assert(iter != check_box_signal_map_.end());
- const shared_ptr<
pv::view::Signal
> s = (*iter).second;
+ const shared_ptr<
SignalBase
> s = (*iter).second;
assert(s);
assert(s);
- s->
enable
(check_box->isChecked());
+ s->
set_enabled
(check_box->isChecked());
}
void Channels::enable_all_channels()
}
void Channels::enable_all_channels()
@@
-253,5
+244,5
@@
void Channels::disable_all_channels()
set_all_channels(false);
}
set_all_channels(false);
}
-}
//
popups
-}
//
pv
+}
// namespace
popups
+}
// namespace
pv