]> sigrok.org Git - pulseview.git/blob - pv/views/trace/mathsignal.hpp
Implement MathSignal
[pulseview.git] / pv / views / trace / mathsignal.hpp
1 /*
2  * This file is part of the PulseView project.
3  *
4  * Copyright (C) 2020 Soeren Apel <soeren@apelpie.net>
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, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef PULSEVIEW_PV_VIEWS_TRACE_MATHSIGNAL_HPP
21 #define PULSEVIEW_PV_VIEWS_TRACE_MATHSIGNAL_HPP
22
23 #include <QComboBox>
24 #include <QString>
25 #include <QTimer>
26
27 #include <pv/data/mathsignal.hpp>
28 #include <pv/views/trace/analogsignal.hpp>
29
30 using std::shared_ptr;
31
32 namespace pv {
33 namespace views {
34 namespace trace {
35
36 class MathSignal : public AnalogSignal
37 {
38         Q_OBJECT
39
40 public:
41         MathSignal(pv::Session &session, shared_ptr<data::SignalBase> base);
42
43 protected:
44         void populate_popup_form(QWidget *parent, QFormLayout *form);
45
46         shared_ptr<pv::data::MathSignal> math_signal_;
47
48 private Q_SLOTS:
49         void on_expression_changed(const QString &text);
50         void on_sample_count_changed(const QString &text);
51
52 private:
53         QLineEdit *expression_edit_;
54         QComboBox *sample_count_cb_, *sample_rate_cb_;
55         QString sample_count_text_, sample_rate_text_;
56         QTimer delayed_expr_updater_, delayed_count_updater_, delayed_rate_updater_;
57 };
58
59 } // namespace trace
60 } // namespace views
61 } // namespace pv
62
63 #endif // PULSEVIEW_PV_VIEWS_TRACE_MATHSIGNAL_HPP