]> sigrok.org Git - pulseview.git/blame - pv/subwindows/subwindowbase.cpp
Session: Fix issue #67 by improving error handling
[pulseview.git] / pv / subwindows / subwindowbase.cpp
CommitLineData
97378470
SA
1/*
2 * This file is part of the PulseView project.
3 *
4 * Copyright (C) 2018 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#ifdef ENABLE_DECODE
21#include <libsigrokdecode/libsigrokdecode.h>
22#endif
23
24#include <QWidget>
25
26#include "pv/session.hpp"
27#include "pv/subwindows/subwindowbase.hpp"
28
29using std::shared_ptr;
30
31namespace pv {
32namespace subwindows {
33
34SubWindowBase::SubWindowBase(Session &session, QWidget *parent) :
35 QWidget(parent),
36 session_(session)
37{
38 connect(&session_, SIGNAL(signals_changed()), this, SLOT(on_signals_changed()));
39}
40
41bool SubWindowBase::has_toolbar() const
42{
43 return false;
44}
45
46QToolBar* SubWindowBase::create_toolbar(QWidget *parent) const
47{
48 (void)parent;
49
50 return nullptr;
51}
52
53Session& SubWindowBase::session()
54{
55 return session_;
56}
57
58const Session& SubWindowBase::session() const
59{
60 return session_;
61}
62
63unordered_set< shared_ptr<data::SignalBase> > SubWindowBase::signalbases() const
64{
65 return signalbases_;
66}
67
68void SubWindowBase::clear_signalbases()
69{
1fd847fe 70 for (const shared_ptr<data::SignalBase>& signalbase : signalbases_) {
97378470
SA
71 disconnect(signalbase.get(), SIGNAL(samples_cleared()),
72 this, SLOT(on_data_updated()));
73 disconnect(signalbase.get(), SIGNAL(samples_added(uint64_t, uint64_t, uint64_t)),
74 this, SLOT(on_samples_added(uint64_t, uint64_t, uint64_t)));
75 }
76
77 signalbases_.clear();
78}
79
80void SubWindowBase::add_signalbase(const shared_ptr<data::SignalBase> signalbase)
81{
82 signalbases_.insert(signalbase);
83}
84
85#ifdef ENABLE_DECODE
86void SubWindowBase::clear_decode_signals()
87{
88}
89
90void SubWindowBase::add_decode_signal(shared_ptr<data::DecodeSignal> signal)
91{
92 (void)signal;
93}
94
95void SubWindowBase::remove_decode_signal(shared_ptr<data::DecodeSignal> signal)
96{
97 (void)signal;
98}
99#endif
100
c52493c9
SA
101int SubWindowBase::minimum_width() const
102{
103 return 0;
104}
105
97378470
SA
106void SubWindowBase::on_signals_changed()
107{
108}
109
110} // namespace subwindows
111} // namespace pv