]>
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 | ||
7c657094 JH |
21 | #ifndef PULSEVIEW_PV_TOOLBARS_MAINBAR_H |
22 | #define PULSEVIEW_PV_TOOLBARS_MAINBAR_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> |
079d39ea | 31 | #include <QMenu> |
d4984fe7 | 32 | #include <QToolBar> |
dde1a563 JH |
33 | #include <QToolButton> |
34 | ||
f65cd27b | 35 | #include <pv/session.hpp> |
079d39ea | 36 | #include <pv/widgets/devicetoolbutton.hpp> |
2acdb232 JH |
37 | #include <pv/widgets/popuptoolbutton.hpp> |
38 | #include <pv/widgets/sweeptimingwidget.hpp> | |
2b49eeb0 | 39 | |
e8d00928 ML |
40 | namespace sigrok { |
41 | class Device; | |
42 | } | |
43 | ||
44 | Q_DECLARE_METATYPE(std::shared_ptr<sigrok::Device>) | |
45 | ||
dde1a563 | 46 | class QAction; |
d4984fe7 | 47 | |
51e77110 | 48 | namespace pv { |
aca00b1e | 49 | |
4e7f5ba8 | 50 | class MainWindow; |
2b81ae46 | 51 | class Session; |
aca00b1e | 52 | |
f4c92e1c | 53 | namespace toolbars { |
51e77110 | 54 | |
7c657094 | 55 | class MainBar : public QToolBar |
d4984fe7 JH |
56 | { |
57 | Q_OBJECT | |
58 | ||
215f9499 | 59 | private: |
b50ef520 JH |
60 | static const uint64_t MinSampleCount; |
61 | static const uint64_t MaxSampleCount; | |
62 | static const uint64_t DefaultSampleCount; | |
215f9499 | 63 | |
d4984fe7 | 64 | public: |
7c657094 | 65 | MainBar(Session &session, pv::MainWindow &main_window); |
6fb67b27 | 66 | |
079d39ea | 67 | void update_device_list(); |
18203d86 | 68 | |
2b81ae46 | 69 | void set_capture_state(pv::Session::capture_state state); |
6ac96c2e | 70 | |
e9213170 | 71 | Q_SIGNALS: |
274d4f13 JH |
72 | void run_stop(); |
73 | ||
6fb67b27 | 74 | private: |
dde1a563 | 75 | void update_sample_rate_selector(); |
48888313 | 76 | void update_sample_rate_selector_value(); |
85756012 | 77 | void update_sample_count_selector(); |
e95e8563 | 78 | void update_device_config_widgets(); |
48888313 | 79 | void commit_sample_rate(); |
124d97de | 80 | void commit_sample_count(); |
dde1a563 | 81 | |
e9213170 | 82 | private Q_SLOTS: |
dde1a563 | 83 | void on_device_selected(); |
124d97de | 84 | void on_sample_count_changed(); |
48888313 | 85 | void on_sample_rate_changed(); |
9f3d12f3 | 86 | void on_run_stop(); |
6fb67b27 | 87 | |
82afd5e3 JH |
88 | void on_config_changed(); |
89 | ||
40065ab6 JS |
90 | protected: |
91 | bool eventFilter(QObject *watched, QEvent *event); | |
92 | ||
6fb67b27 | 93 | private: |
2b81ae46 | 94 | Session &session_; |
4e7f5ba8 | 95 | MainWindow &main_window_; |
aca00b1e | 96 | |
079d39ea | 97 | pv::widgets::DeviceToolButton device_selector_; |
51d4a9ab | 98 | |
8dbbc7f0 JH |
99 | pv::widgets::PopupToolButton configure_button_; |
100 | QAction *configure_button_action_; | |
b7b659aa | 101 | |
8dbbc7f0 | 102 | pv::widgets::PopupToolButton channels_button_; |
dde1a563 | 103 | |
8dbbc7f0 JH |
104 | pv::widgets::SweepTimingWidget sample_count_; |
105 | pv::widgets::SweepTimingWidget sample_rate_; | |
106 | bool updating_sample_rate_; | |
107 | bool updating_sample_count_; | |
274d4f13 | 108 | |
8dbbc7f0 | 109 | bool sample_count_supported_; |
6546a6a7 | 110 | |
8dbbc7f0 JH |
111 | QIcon icon_red_; |
112 | QIcon icon_green_; | |
113 | QIcon icon_grey_; | |
114 | QToolButton run_stop_button_; | |
87f0df9b JH |
115 | |
116 | QToolButton menu_button_; | |
d4984fe7 JH |
117 | }; |
118 | ||
f4c92e1c | 119 | } // namespace toolbars |
51e77110 JH |
120 | } // namespace pv |
121 | ||
7c657094 | 122 | #endif // PULSEVIEW_PV_TOOLBARS_MAINBAR_H |