]> sigrok.org Git - pulseview.git/blame_incremental - pv/popups/channels.hpp
Channels: Add missing include
[pulseview.git] / pv / popups / channels.hpp
... / ...
CommitLineData
1/*
2 * This file is part of the PulseView project.
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, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef PULSEVIEW_PV_POPUPS_CHANNELS_HPP
21#define PULSEVIEW_PV_POPUPS_CHANNELS_HPP
22
23#include <functional>
24#include <map>
25#include <memory>
26#include <vector>
27
28#include <QCheckBox>
29#include <QFormLayout>
30#include <QGridLayout>
31#include <QLabel>
32#include <QPushButton>
33#include <QSignalMapper>
34
35#include <pv/widgets/popup.hpp>
36
37using std::function;
38using std::map;
39using std::shared_ptr;
40using std::vector;
41
42namespace sigrok {
43 class ChannelGroup;
44}
45
46namespace pv {
47
48class Session;
49
50namespace binding {
51class Device;
52}
53
54namespace data {
55class SignalBase;
56}
57
58namespace view {
59class Signal;
60}
61
62namespace popups {
63
64class Channels : public pv::widgets::Popup
65{
66 Q_OBJECT
67
68public:
69 Channels(Session &session, QWidget *parent);
70
71private:
72 void set_all_channels(bool set);
73 void set_all_channels_conditionally(
74 function<bool (const shared_ptr<data::SignalBase>)> cond_func);
75
76 void populate_group(shared_ptr<sigrok::ChannelGroup> group,
77 const vector< shared_ptr<pv::data::SignalBase> > sigs);
78
79 QGridLayout* create_channel_group_grid(
80 const vector< shared_ptr<pv::data::SignalBase> > sigs);
81
82private:
83 void showEvent(QShowEvent *event);
84
85private Q_SLOTS:
86 void on_channel_checked(QWidget *widget);
87
88 void enable_all_channels();
89 void disable_all_channels();
90 void enable_all_logic_channels();
91 void enable_all_analog_channels();
92 void enable_all_named_channels();
93 void enable_all_changing_channels();
94
95private:
96 pv::Session &session_;
97
98 QFormLayout layout_;
99
100 bool updating_channels_;
101
102 vector< shared_ptr<pv::binding::Device> > group_bindings_;
103 map< QCheckBox*, shared_ptr<pv::data::SignalBase> >
104 check_box_signal_map_;
105 map< shared_ptr<sigrok::ChannelGroup>, QLabel*> group_label_map_;
106
107 QGridLayout buttons_bar_;
108 QPushButton enable_all_channels_, disable_all_channels_;
109 QPushButton enable_all_logic_channels_, enable_all_analog_channels_;
110 QPushButton enable_all_named_channels_, enable_all_changing_channels_;
111
112 QSignalMapper check_box_mapper_;
113};
114
115} // namespace popups
116} // namespace pv
117
118#endif // PULSEVIEW_PV_POPUPS_CHANNELS_HPP