PulseView  unreleased development snapshot
A Qt-based sigrok GUI
subwindowbase.cpp
Go to the documentation of this file.
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"
28 
29 using std::shared_ptr;
30 
31 namespace pv {
32 namespace subwindows {
33 
34 SubWindowBase::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 
42 {
43  return false;
44 }
45 
46 QToolBar* SubWindowBase::create_toolbar(QWidget *parent) const
47 {
48  (void)parent;
49 
50  return nullptr;
51 }
52 
54 {
55  return session_;
56 }
57 
59 {
60  return session_;
61 }
62 
63 unordered_set< shared_ptr<data::SignalBase> > SubWindowBase::signalbases() const
64 {
65  return signalbases_;
66 }
67 
69 {
70  for (const shared_ptr<data::SignalBase>& signalbase : signalbases_) {
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 
80 void SubWindowBase::add_signalbase(const shared_ptr<data::SignalBase> signalbase)
81 {
82  signalbases_.insert(signalbase);
83 }
84 
85 #ifdef ENABLE_DECODE
86 void SubWindowBase::clear_decode_signals()
87 {
88 }
89 
90 void SubWindowBase::add_decode_signal(shared_ptr<data::DecodeSignal> signal)
91 {
92  (void)signal;
93 }
94 
95 void SubWindowBase::remove_decode_signal(shared_ptr<data::DecodeSignal> signal)
96 {
97  (void)signal;
98 }
99 #endif
100 
102 {
103  return 0;
104 }
105 
107 {
108 }
109 
110 } // namespace subwindows
111 } // namespace pv
virtual bool has_toolbar() const
SubWindowBase(Session &session, QWidget *parent=nullptr)
unordered_set< shared_ptr< data::SignalBase > > signalbases() const
virtual QToolBar * create_toolbar(QWidget *parent) const
virtual void add_signalbase(const shared_ptr< data::SignalBase > signalbase)
unordered_set< shared_ptr< data::SignalBase > > signalbases_
virtual int minimum_width() const