]> sigrok.org Git - pulseview.git/blob - pv/views/decoder_output/view.cpp
Save/restore view type
[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 ViewType View::get_type() const
61 {
62         return ViewTypeDecoderOutput;
63 }
64
65 void View::reset_view_state()
66 {
67         ViewBase::reset_view_state();
68 }
69
70 void View::clear_signals()
71 {
72         ViewBase::clear_signalbases();
73 }
74
75 void View::clear_decode_signals()
76 {
77 }
78
79 void View::add_decode_signal(shared_ptr<data::DecodeSignal> signal)
80 {
81         connect(signal.get(), SIGNAL(name_changed(const QString&)),
82                 this, SLOT(on_signal_name_changed()));
83 }
84
85 void View::remove_decode_signal(shared_ptr<data::DecodeSignal> signal)
86 {
87         (void)signal;
88 }
89
90 void View::save_settings(QSettings &settings) const
91 {
92         (void)settings;
93 }
94
95 void View::restore_settings(QSettings &settings)
96 {
97         // Note: It is assumed that this function is only called once,
98         // immediately after restoring a previous session.
99         (void)settings;
100 }
101
102 void View::on_signal_name_changed()
103 {
104 }
105
106 } // namespace decoder_output
107 } // namespace views
108 } // namespace pv