]>
Commit | Line | Data |
---|---|---|
cdb50f67 JH |
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, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | ||
7a01bd36 JH |
21 | #ifndef PULSEVIEW_PV_POPUPS_CHANNELS_HPP |
22 | #define PULSEVIEW_PV_POPUPS_CHANNELS_HPP | |
cdb50f67 | 23 | |
bfc9f61e | 24 | #include <map> |
f9abf97e | 25 | #include <memory> |
488f068c JH |
26 | #include <vector> |
27 | ||
28 | #include <QFormLayout> | |
65cbcf46 JH |
29 | #include <QHBoxLayout> |
30 | #include <QPushButton> | |
bfc9f61e | 31 | #include <QSignalMapper> |
cdb50f67 | 32 | |
2acdb232 | 33 | #include <pv/widgets/popup.hpp> |
cdb50f67 | 34 | |
488f068c JH |
35 | class QCheckBox; |
36 | class QGridLayout; | |
37 | ||
e8d00928 ML |
38 | namespace sigrok { |
39 | class ChannelGroup; | |
40 | } | |
41 | ||
cdb50f67 | 42 | namespace pv { |
aca00b1e | 43 | |
2b81ae46 | 44 | class Session; |
aca00b1e | 45 | |
488f068c | 46 | namespace binding { |
3cc9ad7b | 47 | class Device; |
488f068c | 48 | } |
488f068c JH |
49 | |
50 | namespace view { | |
51 | class Signal; | |
52 | } | |
53 | ||
51d4a9ab | 54 | namespace popups { |
cdb50f67 | 55 | |
6ac6242b | 56 | class Channels : public pv::widgets::Popup |
cdb50f67 | 57 | { |
ed773982 JH |
58 | Q_OBJECT |
59 | ||
cdb50f67 | 60 | public: |
2b81ae46 | 61 | Channels(Session &session_, QWidget *parent); |
f23cd1e5 | 62 | |
cdb50f67 | 63 | private: |
6ac6242b | 64 | void set_all_channels(bool set); |
ed773982 | 65 | |
e8d00928 | 66 | void populate_group(std::shared_ptr<sigrok::ChannelGroup> group, |
f9abf97e | 67 | const std::vector< std::shared_ptr<pv::view::Signal> > sigs); |
488f068c | 68 | |
2445160a | 69 | QGridLayout* create_channel_group_grid( |
f9abf97e | 70 | const std::vector< std::shared_ptr<pv::view::Signal> > sigs); |
488f068c | 71 | |
b7b659aa JH |
72 | private: |
73 | void showEvent(QShowEvent *e); | |
74 | ||
e9213170 | 75 | private Q_SLOTS: |
6ac6242b | 76 | void on_channel_checked(QWidget *widget); |
51d4a9ab | 77 | |
6ac6242b ML |
78 | void enable_all_channels(); |
79 | void disable_all_channels(); | |
ed773982 | 80 | |
0740907f | 81 | private: |
2b81ae46 | 82 | pv::Session &session_; |
0740907f | 83 | |
8dbbc7f0 | 84 | QFormLayout layout_; |
0740907f | 85 | |
8dbbc7f0 | 86 | bool updating_channels_; |
b7b659aa | 87 | |
3cc9ad7b | 88 | std::vector< std::shared_ptr<pv::binding::Device> > |
8dbbc7f0 | 89 | group_bindings_; |
f9abf97e | 90 | std::map< QCheckBox*, std::shared_ptr<pv::view::Signal> > |
8dbbc7f0 | 91 | check_box_signal_map_; |
488f068c | 92 | |
8dbbc7f0 JH |
93 | QHBoxLayout buttons_bar_; |
94 | QPushButton enable_all_channels_; | |
95 | QPushButton disable_all_channels_; | |
488f068c | 96 | |
8dbbc7f0 | 97 | QSignalMapper check_box_mapper_; |
cdb50f67 JH |
98 | }; |
99 | ||
51d4a9ab JH |
100 | } // popups |
101 | } // pv | |
cdb50f67 | 102 | |
7a01bd36 | 103 | #endif // PULSEVIEW_PV_POPUPS_CHANNELS_HPP |