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