]> sigrok.org Git - pulseview.git/blob - pv/binding/decoder.hpp
Fix #957 and #874 by implementing the pane splitter
[pulseview.git] / pv / binding / decoder.hpp
1 /*
2  * This file is part of the PulseView project.
3  *
4  * Copyright (C) 2013 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, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef PULSEVIEW_PV_BINDING_DECODER_HPP
21 #define PULSEVIEW_PV_BINDING_DECODER_HPP
22
23 #include "binding.hpp"
24
25 #include <pv/prop/property.hpp>
26
27 using std::shared_ptr;
28
29 struct srd_decoder_option;
30
31 namespace pv {
32
33 namespace data {
34 class DecoderStack;
35 namespace decode {
36 class Decoder;
37 }
38 }
39
40 namespace binding {
41
42 class Decoder : public Binding
43 {
44 public:
45         Decoder(shared_ptr<pv::data::DecoderStack> decoder_stack,
46                 shared_ptr<pv::data::decode::Decoder> decoder);
47
48 private:
49         static shared_ptr<prop::Property> bind_enum(const QString &name,
50                 const QString &desc, const srd_decoder_option *option,
51                 prop::Property::Getter getter, prop::Property::Setter setter);
52
53         Glib::VariantBase getter(const char *id);
54
55         void setter(const char *id, Glib::VariantBase value);
56
57 private:
58         shared_ptr<pv::data::DecoderStack> decoder_stack_;
59         shared_ptr<pv::data::decode::Decoder> decoder_;
60 };
61
62 }  // namespace binding
63 }  // namespace pv
64
65 #endif // PULSEVIEW_PV_BINDING_DECODER_HPP