]> sigrok.org Git - pulseview.git/blob - pv/popups/probes.h
Replaced QToolBar in probes popup
[pulseview.git] / pv / popups / probes.h
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
21 #ifndef PULSEVIEW_PV_POPUPS_PROBES_H
22 #define PULSEVIEW_PV_POPUPS_PROBES_H
23
24 #include <vector>
25
26 #include <QFormLayout>
27 #include <QHBoxLayout>
28 #include <QPushButton>
29
30 #include <pv/widgets/popup.h>
31
32 class QCheckBox;
33 class QGridLayout;
34
35 namespace pv {
36
37 class SigSession;
38
39 namespace prop {
40 namespace binding {
41 class DeviceOptions;
42 }
43 }
44
45 namespace view {
46 class Signal;
47 }
48
49 namespace popups {
50
51 class Probes : public pv::widgets::Popup
52 {
53         Q_OBJECT
54
55 public:
56         Probes(SigSession &_session, QWidget *parent);
57
58 private:
59         void set_all_probes(bool set);
60
61         void populate_group(const sr_probe_group *group,
62                 const std::vector< boost::shared_ptr<pv::view::Signal> > sigs);
63
64         QGridLayout* create_probe_group_grid(
65                 const std::vector< boost::shared_ptr<pv::view::Signal> > sigs);
66
67 private:
68         void showEvent(QShowEvent *e);
69
70 private slots:
71         void on_probe_checked(QWidget *widget);
72
73         void enable_all_probes();
74         void disable_all_probes();
75
76 private:
77         pv::SigSession &_session;
78
79         QFormLayout _layout;
80
81         bool _updating_probes;
82
83         std::vector< boost::shared_ptr<pv::prop::binding::DeviceOptions> >
84                  _group_bindings;
85         std::map< QCheckBox*, boost::shared_ptr<pv::view::Signal> >
86                 _check_box_signal_map;
87
88         QHBoxLayout _buttons_bar;
89         QPushButton _enable_all_probes;
90         QPushButton _disable_all_probes;
91
92         QSignalMapper _check_box_mapper;
93 };
94
95 } // popups
96 } // pv
97
98 #endif // PULSEVIEW_PV_POPUPS_PROBES_H