]> sigrok.org Git - pulseview.git/blame - pv/views/decoder_output/view.cpp
Save/restore view type
[pulseview.git] / pv / views / decoder_output / view.cpp
CommitLineData
2bdc5796
SA
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>
a24412db 23#include <QToolBar>
2bdc5796
SA
24#include <QVBoxLayout>
25
26#include "view.hpp"
27
28#include "pv/session.hpp"
29#include "pv/util.hpp"
30
31using pv::util::TimeUnit;
32using pv::util::Timestamp;
33
34using std::shared_ptr;
35
36namespace pv {
37namespace views {
38namespace decoder_output {
39
a24412db 40View::View(Session &session, bool is_main_view, QMainWindow *parent) :
2bdc5796
SA
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
a24412db
SA
48 QToolBar* tool_bar = new QToolBar();
49 tool_bar->setContextMenuPolicy(Qt::PreventContextMenu);
50
51 parent->addToolBar(tool_bar);
52
2bdc5796
SA
53 reset_view_state();
54}
55
56View::~View()
57{
58}
59
db298158
SA
60ViewType View::get_type() const
61{
62 return ViewTypeDecoderOutput;
63}
64
2bdc5796
SA
65void View::reset_view_state()
66{
67 ViewBase::reset_view_state();
68}
69
70void View::clear_signals()
71{
72 ViewBase::clear_signalbases();
73}
74
75void View::clear_decode_signals()
76{
77}
78
79void 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
85void View::remove_decode_signal(shared_ptr<data::DecodeSignal> signal)
86{
87 (void)signal;
88}
89
90void View::save_settings(QSettings &settings) const
91{
92 (void)settings;
93}
94
95void 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
102void View::on_signal_name_changed()
103{
104}
105
106} // namespace decoder_output
107} // namespace views
108} // namespace pv