]>
Commit | Line | Data |
---|---|---|
d4984fe7 | 1 | /* |
b3f22de0 | 2 | * This file is part of the PulseView project. |
d4984fe7 JH |
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 | ||
f4c92e1c JH |
21 | #ifndef PULSEVIEW_PV_TOOLBARS_SAMPLINGBAR_H |
22 | #define PULSEVIEW_PV_TOOLBARS_SAMPLINGBAR_H | |
d4984fe7 | 23 | |
dde1a563 JH |
24 | #include <stdint.h> |
25 | ||
4fe06f49 | 26 | #include <list> |
f9abf97e | 27 | #include <memory> |
18203d86 | 28 | |
6fb67b27 | 29 | #include <QComboBox> |
dde1a563 | 30 | #include <QDoubleSpinBox> |
d4984fe7 | 31 | #include <QToolBar> |
dde1a563 JH |
32 | #include <QToolButton> |
33 | ||
2acdb232 JH |
34 | #include <pv/sigsession.hpp> |
35 | #include <pv/widgets/popuptoolbutton.hpp> | |
36 | #include <pv/widgets/sweeptimingwidget.hpp> | |
2b49eeb0 | 37 | |
e8d00928 ML |
38 | namespace sigrok { |
39 | class Device; | |
40 | } | |
41 | ||
42 | Q_DECLARE_METATYPE(std::shared_ptr<sigrok::Device>) | |
43 | ||
dde1a563 | 44 | class QAction; |
d4984fe7 | 45 | |
51e77110 | 46 | namespace pv { |
aca00b1e JH |
47 | |
48 | class SigSession; | |
49 | ||
f4c92e1c | 50 | namespace toolbars { |
51e77110 | 51 | |
d4984fe7 JH |
52 | class SamplingBar : public QToolBar |
53 | { | |
54 | Q_OBJECT | |
55 | ||
215f9499 | 56 | private: |
b50ef520 JH |
57 | static const uint64_t MinSampleCount; |
58 | static const uint64_t MaxSampleCount; | |
59 | static const uint64_t DefaultSampleCount; | |
215f9499 | 60 | |
d4984fe7 | 61 | public: |
aca00b1e | 62 | SamplingBar(SigSession &session, QWidget *parent); |
6fb67b27 | 63 | |
19adbc2c | 64 | void set_device_list( |
4fe06f49 | 65 | const std::list< std::pair<std::shared_ptr<sigrok::Device>, std::string> > &devices, |
e8d00928 | 66 | std::shared_ptr<sigrok::Device> selected); |
18203d86 | 67 | |
e8d00928 | 68 | std::shared_ptr<sigrok::Device> get_selected_device() const; |
18203d86 | 69 | |
2b49eeb0 | 70 | void set_capture_state(pv::SigSession::capture_state state); |
6ac96c2e | 71 | |
e9213170 | 72 | Q_SIGNALS: |
274d4f13 JH |
73 | void run_stop(); |
74 | ||
6fb67b27 | 75 | private: |
dde1a563 | 76 | void update_sample_rate_selector(); |
48888313 | 77 | void update_sample_rate_selector_value(); |
85756012 | 78 | void update_sample_count_selector(); |
e95e8563 | 79 | void update_device_config_widgets(); |
48888313 | 80 | void commit_sample_rate(); |
124d97de | 81 | void commit_sample_count(); |
dde1a563 | 82 | |
e9213170 | 83 | private Q_SLOTS: |
dde1a563 | 84 | void on_device_selected(); |
124d97de | 85 | void on_sample_count_changed(); |
48888313 | 86 | void on_sample_rate_changed(); |
9f3d12f3 | 87 | void on_run_stop(); |
6fb67b27 | 88 | |
82afd5e3 JH |
89 | void on_config_changed(); |
90 | ||
40065ab6 JS |
91 | protected: |
92 | bool eventFilter(QObject *watched, QEvent *event); | |
93 | ||
6fb67b27 | 94 | private: |
8dbbc7f0 | 95 | SigSession &session_; |
aca00b1e | 96 | |
8dbbc7f0 JH |
97 | QComboBox device_selector_; |
98 | bool updating_device_selector_; | |
51d4a9ab | 99 | |
8dbbc7f0 JH |
100 | pv::widgets::PopupToolButton configure_button_; |
101 | QAction *configure_button_action_; | |
b7b659aa | 102 | |
8dbbc7f0 | 103 | pv::widgets::PopupToolButton channels_button_; |
dde1a563 | 104 | |
8dbbc7f0 JH |
105 | pv::widgets::SweepTimingWidget sample_count_; |
106 | pv::widgets::SweepTimingWidget sample_rate_; | |
107 | bool updating_sample_rate_; | |
108 | bool updating_sample_count_; | |
274d4f13 | 109 | |
8dbbc7f0 | 110 | bool sample_count_supported_; |
6546a6a7 | 111 | |
8dbbc7f0 JH |
112 | QIcon icon_red_; |
113 | QIcon icon_green_; | |
114 | QIcon icon_grey_; | |
115 | QToolButton run_stop_button_; | |
d4984fe7 JH |
116 | }; |
117 | ||
f4c92e1c | 118 | } // namespace toolbars |
51e77110 JH |
119 | } // namespace pv |
120 | ||
f4c92e1c | 121 | #endif // PULSEVIEW_PV_TOOLBARS_SAMPLINGBAR_H |