]> sigrok.org Git - pulseview.git/blob - pv/views/decoder_output/view.cpp
Change parameter to ViewBase constructor
[pulseview.git] / pv / views / decoder_output / view.cpp
1 /*
2  * This file is part of the PulseView project.
3  *
4  * Copyright (C) 2019 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 #include <libsigrokdecode/libsigrokdecode.h>
21
22 #include <QMenu>
23 #include <QToolBar>
24 #include <QVBoxLayout>
25
26 #include "view.hpp"
27
28 #include "pv/session.hpp"
29 #include "pv/util.hpp"
30
31 using pv::util::TimeUnit;
32 using pv::util::Timestamp;
33
34 using std::shared_ptr;
35
36 namespace pv {
37 namespace views {
38 namespace decoder_output {
39
40 View::View(Session &session, bool is_main_view, QMainWindow *parent) :
41         ViewBase(session, is_main_view, parent)
42
43         // Note: Place defaults in View::reset_view_state(), not here
44 {
45         QVBoxLayout *root_layout = new QVBoxLayout(this);
46         root_layout->setContentsMargins(0, 0, 0, 0);
47
48         QToolBar* tool_bar = new QToolBar();
49         tool_bar->setContextMenuPolicy(Qt::PreventContextMenu);
50
51         parent->addToolBar(tool_bar);
52
53         reset_view_state();
54 }
55
56 View::~View()
57 {
58 }
59
60 void View::reset_view_state()
61 {
62         ViewBase::reset_view_state();
63 }
64
65 void View::clear_signals()
66 {
67         ViewBase::clear_signalbases();
68 }
69
70 void View::clear_decode_signals()
71 {
72 }
73
74 void View::add_decode_signal(shared_ptr<data::DecodeSignal> signal)
75 {
76         connect(signal.get(), SIGNAL(name_changed(const QString&)),
77                 this, SLOT(on_signal_name_changed()));
78 }
79
80 void View::remove_decode_signal(shared_ptr<data::DecodeSignal> signal)
81 {
82         (void)signal;
83 }
84
85 void View::save_settings(QSettings &settings) const
86 {
87         (void)settings;
88 }
89
90 void View::restore_settings(QSettings &settings)
91 {
92         // Note: It is assumed that this function is only called once,
93         // immediately after restoring a previous session.
94         (void)settings;
95 }
96
97 void View::on_signal_name_changed()
98 {
99 }
100
101 } // namespace decoder_output
102 } // namespace views
103 } // namespace pv