]>
Commit | Line | Data |
---|---|---|
28a4c9c5 | 1 | /* |
b3f22de0 | 2 | * This file is part of the PulseView project. |
28a4c9c5 JH |
3 | * |
4 | * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk> | |
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, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
19 | */ | |
20 | ||
7a01bd36 JH |
21 | #ifndef PULSEVIEW_PV_VIEW_SIGNAL_HPP |
22 | #define PULSEVIEW_PV_VIEW_SIGNAL_HPP | |
640d091b | 23 | |
f9abf97e | 24 | #include <memory> |
9a0cd293 | 25 | |
9e40e83d | 26 | #include <QComboBox> |
9e40e83d | 27 | #include <QWidgetAction> |
e3f65ace | 28 | |
28a4c9c5 JH |
29 | #include <stdint.h> |
30 | ||
2acdb232 | 31 | #include "trace.hpp" |
4b5782e1 | 32 | #include "viewitemowner.hpp" |
e0e90d80 | 33 | |
e8d00928 ML |
34 | namespace sigrok { |
35 | class Channel; | |
36 | } | |
8d3e0764 | 37 | |
51e77110 JH |
38 | namespace pv { |
39 | ||
2b81ae46 | 40 | class Session; |
b86aa8f4 | 41 | |
1b1ec774 | 42 | namespace data { |
28a4c9c5 | 43 | class SignalData; |
1b1ec774 | 44 | } |
28a4c9c5 | 45 | |
a2f71ef0 JH |
46 | namespace view { |
47 | ||
4b5782e1 | 48 | class Signal : public Trace, public ViewItemOwner |
28a4c9c5 | 49 | { |
2a2512b2 JH |
50 | Q_OBJECT |
51 | ||
28a4c9c5 | 52 | protected: |
2b81ae46 | 53 | Signal(pv::Session &session, |
b86aa8f4 | 54 | std::shared_ptr<sigrok::Channel> channel); |
28a4c9c5 JH |
55 | |
56 | public: | |
49f8ff3f JH |
57 | /** |
58 | * Sets the name of the signal. | |
59 | */ | |
60 | void set_name(QString name); | |
61 | ||
f9abf97e | 62 | virtual std::shared_ptr<pv::data::SignalData> data() const = 0; |
9a0cd293 | 63 | |
b3b57abc | 64 | /** |
931f20b0 | 65 | * Returns true if the trace is visible and enabled. |
a29bb7fb | 66 | */ |
931f20b0 | 67 | bool enabled() const; |
a29bb7fb | 68 | |
aca00b1e JH |
69 | void enable(bool enable = true); |
70 | ||
e8d00928 | 71 | std::shared_ptr<sigrok::Channel> channel() const; |
632ba77e | 72 | |
4b5782e1 JH |
73 | /** |
74 | * Returns a list of row items owned by this object. | |
75 | */ | |
76 | const item_list& child_items() const; | |
77 | ||
0c0218fd JH |
78 | virtual void populate_popup_form(QWidget *parent, QFormLayout *form); |
79 | ||
86e823ca JH |
80 | QMenu* create_context_menu(QWidget *parent); |
81 | ||
5ed1adf5 JH |
82 | void delete_pressed(); |
83 | ||
214470fc JH |
84 | /** |
85 | * Returns the offset to show the drag handle. | |
86 | */ | |
87 | virtual int scale_handle_offset() const = 0; | |
88 | ||
89 | /** | |
90 | * Handles the scale handle being dragged to an offset. | |
91 | * @param offset the offset the scale handle was dragged to. | |
92 | */ | |
93 | virtual void scale_handle_dragged(int offset) = 0; | |
94 | ||
95 | /** | |
96 | * Handles the scale handle being being released. | |
97 | */ | |
98 | virtual void scale_handle_released() {}; | |
99 | ||
e9213170 | 100 | private Q_SLOTS: |
86e823ca JH |
101 | void on_disable(); |
102 | ||
28a4c9c5 | 103 | protected: |
2b81ae46 | 104 | pv::Session &session_; |
8dbbc7f0 | 105 | std::shared_ptr<sigrok::Channel> channel_; |
cec48d16 | 106 | |
4b5782e1 JH |
107 | const item_list items_; |
108 | ||
8dbbc7f0 JH |
109 | QComboBox *name_widget_; |
110 | bool updating_name_widget_; | |
28a4c9c5 | 111 | }; |
51e77110 | 112 | |
8d634081 | 113 | } // namespace view |
51e77110 | 114 | } // namespace pv |
640d091b | 115 | |
7a01bd36 | 116 | #endif // PULSEVIEW_PV_VIEW_SIGNAL_HPP |