]> sigrok.org Git - pulseview.git/blame - pv/toolbars/samplingbar.h
Updated the sample rate selector when the config is changed
[pulseview.git] / pv / toolbars / samplingbar.h
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
18203d86 26#include <list>
19adbc2c
JH
27#include <map>
28
29#include <boost/shared_ptr.hpp>
18203d86 30
6fb67b27 31#include <QComboBox>
dde1a563 32#include <QDoubleSpinBox>
d4984fe7 33#include <QToolBar>
dde1a563
JH
34#include <QToolButton>
35
2b49eeb0 36#include <pv/sigsession.h>
51d4a9ab 37#include <pv/widgets/popuptoolbutton.h>
1198b887 38#include <pv/widgets/sweeptimingwidget.h>
2b49eeb0 39
dde1a563 40class QAction;
d4984fe7 41
51e77110 42namespace pv {
aca00b1e 43
19adbc2c 44class DevInst;
aca00b1e
JH
45class SigSession;
46
f4c92e1c 47namespace toolbars {
51e77110 48
d4984fe7
JH
49class SamplingBar : public QToolBar
50{
51 Q_OBJECT
52
215f9499 53private:
b50ef520
JH
54 static const uint64_t MinSampleCount;
55 static const uint64_t MaxSampleCount;
56 static const uint64_t DefaultSampleCount;
215f9499 57
d4984fe7 58public:
aca00b1e 59 SamplingBar(SigSession &session, QWidget *parent);
6fb67b27 60
19adbc2c
JH
61 void set_device_list(
62 const std::list< boost::shared_ptr<pv::DevInst> > &devices);
18203d86 63
19adbc2c
JH
64 boost::shared_ptr<pv::DevInst> get_selected_device() const;
65 void set_selected_device(boost::shared_ptr<pv::DevInst> dev_inst);
18203d86 66
2b49eeb0 67 void set_capture_state(pv::SigSession::capture_state state);
6ac96c2e 68
274d4f13
JH
69signals:
70 void run_stop();
71
6fb67b27 72private:
dde1a563 73 void update_sample_rate_selector();
48888313 74 void update_sample_rate_selector_value();
85756012 75 void update_sample_count_selector();
48888313 76 void commit_sample_rate();
124d97de 77 void commit_sample_count();
dde1a563
JH
78
79private slots:
80 void on_device_selected();
124d97de 81 void on_sample_count_changed();
48888313 82 void on_sample_rate_changed();
9f3d12f3 83 void on_run_stop();
6fb67b27 84
82afd5e3
JH
85 void on_config_changed();
86
6fb67b27 87private:
aca00b1e
JH
88 SigSession &_session;
89
6fb67b27 90 QComboBox _device_selector;
19adbc2c
JH
91 std::map<const sr_dev_inst*, boost::weak_ptr<DevInst> >
92 _device_selector_map;
95237c18 93 bool _updating_device_selector;
51d4a9ab
JH
94
95 pv::widgets::PopupToolButton _configure_button;
b3e8a5d8 96 QAction *_configure_button_action;
b7b659aa 97
51d4a9ab 98 pv::widgets::PopupToolButton _probes_button;
dde1a563 99
124d97de 100 pv::widgets::SweepTimingWidget _sample_count;
1198b887
JH
101 pv::widgets::SweepTimingWidget _sample_rate;
102 bool _updating_sample_rate;
85756012 103 bool _updating_sample_count;
274d4f13 104
6546a6a7
ML
105 bool _sample_count_supported;
106
2b49eeb0 107 QIcon _icon_red;
f5798068
JH
108 QIcon _icon_green;
109 QIcon _icon_grey;
274d4f13 110 QToolButton _run_stop_button;
d4984fe7
JH
111};
112
f4c92e1c 113} // namespace toolbars
51e77110
JH
114} // namespace pv
115
f4c92e1c 116#endif // PULSEVIEW_PV_TOOLBARS_SAMPLINGBAR_H