]> sigrok.org Git - pulseview.git/blame_incremental - pv/toolbars/samplingbar.h
Update #include directives to work with Qt5 as well as Qt4
[pulseview.git] / pv / toolbars / samplingbar.h
... / ...
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, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef PULSEVIEW_PV_TOOLBARS_SAMPLINGBAR_H
22#define PULSEVIEW_PV_TOOLBARS_SAMPLINGBAR_H
23
24#include <stdint.h>
25
26#include <list>
27#include <map>
28#include <memory>
29
30#include <QComboBox>
31#include <QDoubleSpinBox>
32#include <QToolBar>
33#include <QToolButton>
34
35#include <pv/sigsession.h>
36#include <pv/widgets/popuptoolbutton.h>
37#include <pv/widgets/sweeptimingwidget.h>
38
39class QAction;
40
41namespace pv {
42
43class SigSession;
44
45namespace device {
46class DevInst;
47}
48
49namespace toolbars {
50
51class SamplingBar : public QToolBar
52{
53 Q_OBJECT
54
55private:
56 static const uint64_t MinSampleCount;
57 static const uint64_t MaxSampleCount;
58 static const uint64_t DefaultSampleCount;
59
60public:
61 SamplingBar(SigSession &session, QWidget *parent);
62
63 void set_device_list(
64 const std::list< std::shared_ptr<pv::device::DevInst> >
65 &devices,
66 std::shared_ptr<pv::device::DevInst> selected);
67
68 std::shared_ptr<pv::device::DevInst> get_selected_device() const;
69
70 void set_capture_state(pv::SigSession::capture_state state);
71
72signals:
73 void run_stop();
74
75private:
76 void update_sample_rate_selector();
77 void update_sample_rate_selector_value();
78 void update_sample_count_selector();
79 void update_device_config_widgets();
80 void commit_sample_rate();
81 void commit_sample_count();
82
83private slots:
84 void on_device_selected();
85 void on_sample_count_changed();
86 void on_sample_rate_changed();
87 void on_run_stop();
88
89 void on_config_changed();
90
91protected:
92 bool eventFilter(QObject *watched, QEvent *event);
93
94private:
95 SigSession &_session;
96
97 QComboBox _device_selector;
98 std::map<const sr_dev_inst*, std::weak_ptr<device::DevInst> >
99 _device_selector_map;
100 bool _updating_device_selector;
101
102 pv::widgets::PopupToolButton _configure_button;
103 QAction *_configure_button_action;
104
105 pv::widgets::PopupToolButton _probes_button;
106
107 pv::widgets::SweepTimingWidget _sample_count;
108 pv::widgets::SweepTimingWidget _sample_rate;
109 bool _updating_sample_rate;
110 bool _updating_sample_count;
111
112 bool _sample_count_supported;
113
114 QIcon _icon_red;
115 QIcon _icon_green;
116 QIcon _icon_grey;
117 QToolButton _run_stop_button;
118};
119
120} // namespace toolbars
121} // namespace pv
122
123#endif // PULSEVIEW_PV_TOOLBARS_SAMPLINGBAR_H