]>
Commit | Line | Data |
---|---|---|
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_MAINBAR_HPP | |
22 | #define PULSEVIEW_PV_TOOLBARS_MAINBAR_HPP | |
23 | ||
24 | #include <stdint.h> | |
25 | ||
26 | #include <list> | |
27 | #include <memory> | |
28 | ||
29 | #include <QComboBox> | |
30 | #include <QDoubleSpinBox> | |
31 | #include <QMenu> | |
32 | #include <QToolBar> | |
33 | #include <QToolButton> | |
34 | ||
35 | #include <pv/session.hpp> | |
36 | #include <pv/widgets/devicetoolbutton.hpp> | |
37 | #include <pv/widgets/popuptoolbutton.hpp> | |
38 | #include <pv/widgets/sweeptimingwidget.hpp> | |
39 | ||
40 | namespace sigrok { | |
41 | class Device; | |
42 | class InputFormat; | |
43 | } | |
44 | ||
45 | Q_DECLARE_METATYPE(std::shared_ptr<sigrok::Device>) | |
46 | ||
47 | class QAction; | |
48 | ||
49 | namespace pv { | |
50 | ||
51 | class MainWindow; | |
52 | class Session; | |
53 | ||
54 | namespace toolbars { | |
55 | ||
56 | class MainBar : public QToolBar | |
57 | { | |
58 | Q_OBJECT | |
59 | ||
60 | private: | |
61 | static const uint64_t MinSampleCount; | |
62 | static const uint64_t MaxSampleCount; | |
63 | static const uint64_t DefaultSampleCount; | |
64 | ||
65 | public: | |
66 | MainBar(Session &session, pv::MainWindow &main_window); | |
67 | ||
68 | void update_device_list(); | |
69 | ||
70 | void set_capture_state(pv::Session::capture_state state); | |
71 | ||
72 | private: | |
73 | void update_sample_rate_selector(); | |
74 | void update_sample_rate_selector_value(); | |
75 | void update_sample_count_selector(); | |
76 | void update_device_config_widgets(); | |
77 | void commit_sample_rate(); | |
78 | void commit_sample_count(); | |
79 | ||
80 | private Q_SLOTS: | |
81 | void on_device_selected(); | |
82 | void on_sample_count_changed(); | |
83 | void on_sample_rate_changed(); | |
84 | void on_run_stop(); | |
85 | ||
86 | void on_config_changed(); | |
87 | ||
88 | protected: | |
89 | bool eventFilter(QObject *watched, QEvent *event); | |
90 | ||
91 | private: | |
92 | Session &session_; | |
93 | MainWindow &main_window_; | |
94 | ||
95 | pv::widgets::DeviceToolButton device_selector_; | |
96 | ||
97 | pv::widgets::PopupToolButton configure_button_; | |
98 | QAction *configure_button_action_; | |
99 | ||
100 | pv::widgets::PopupToolButton channels_button_; | |
101 | QAction *channels_button_action_; | |
102 | ||
103 | pv::widgets::SweepTimingWidget sample_count_; | |
104 | pv::widgets::SweepTimingWidget sample_rate_; | |
105 | bool updating_sample_rate_; | |
106 | bool updating_sample_count_; | |
107 | ||
108 | bool sample_count_supported_; | |
109 | ||
110 | QIcon icon_red_; | |
111 | QIcon icon_green_; | |
112 | QIcon icon_grey_; | |
113 | QToolButton run_stop_button_; | |
114 | QAction *run_stop_button_action_; | |
115 | ||
116 | QToolButton menu_button_; | |
117 | }; | |
118 | ||
119 | } // namespace toolbars | |
120 | } // namespace pv | |
121 | ||
122 | #endif // PULSEVIEW_PV_TOOLBARS_MAINBAR_HPP |