]> sigrok.org Git - pulseview.git/blame - pv/toolbars/samplingbar.hpp
Snapshot: Renamed to Segment
[pulseview.git] / pv / toolbars / samplingbar.hpp
CommitLineData
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
f65cd27b 34#include <pv/session.hpp>
2acdb232
JH
35#include <pv/widgets/popuptoolbutton.hpp>
36#include <pv/widgets/sweeptimingwidget.hpp>
2b49eeb0 37
e8d00928
ML
38namespace sigrok {
39 class Device;
40}
41
42Q_DECLARE_METATYPE(std::shared_ptr<sigrok::Device>)
43
dde1a563 44class QAction;
d4984fe7 45
51e77110 46namespace pv {
aca00b1e 47
4e7f5ba8 48class MainWindow;
2b81ae46 49class Session;
aca00b1e 50
f4c92e1c 51namespace toolbars {
51e77110 52
d4984fe7
JH
53class SamplingBar : public QToolBar
54{
55 Q_OBJECT
56
215f9499 57private:
b50ef520
JH
58 static const uint64_t MinSampleCount;
59 static const uint64_t MaxSampleCount;
60 static const uint64_t DefaultSampleCount;
215f9499 61
d4984fe7 62public:
2b81ae46 63 SamplingBar(Session &session, pv::MainWindow &main_window);
6fb67b27 64
19adbc2c 65 void set_device_list(
4fe06f49 66 const std::list< std::pair<std::shared_ptr<sigrok::Device>, std::string> > &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 73Q_SIGNALS:
274d4f13
JH
74 void run_stop();
75
6fb67b27 76private:
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 84private 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
92protected:
93 bool eventFilter(QObject *watched, QEvent *event);
94
6fb67b27 95private:
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_;
d4984fe7
JH
118};
119
f4c92e1c 120} // namespace toolbars
51e77110
JH
121} // namespace pv
122
f4c92e1c 123#endif // PULSEVIEW_PV_TOOLBARS_SAMPLINGBAR_H