]>
Commit | Line | Data |
---|---|---|
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 | ||
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 | ||
41 | bool SubWindowBase::has_toolbar() const | |
42 | { | |
43 | return false; | |
44 | } | |
45 | ||
46 | QToolBar* SubWindowBase::create_toolbar(QWidget *parent) const | |
47 | { | |
48 | (void)parent; | |
49 | ||
50 | return nullptr; | |
51 | } | |
52 | ||
53 | Session& SubWindowBase::session() | |
54 | { | |
55 | return session_; | |
56 | } | |
57 | ||
58 | const Session& SubWindowBase::session() const | |
59 | { | |
60 | return session_; | |
61 | } | |
62 | ||
63 | unordered_set< shared_ptr<data::SignalBase> > SubWindowBase::signalbases() const | |
64 | { | |
65 | return signalbases_; | |
66 | } | |
67 | ||
68 | void SubWindowBase::clear_signalbases() | |
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 | ||
101 | int SubWindowBase::minimum_width() const | |
102 | { | |
103 | return 0; | |
104 | } | |
105 | ||
106 | void SubWindowBase::on_signals_changed() | |
107 | { | |
108 | } | |
109 | ||
110 | } // namespace subwindows | |
111 | } // namespace pv |