]>
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 | ||
f1626bb8 | 31 | #include "signalscalehandle.hpp" |
2acdb232 | 32 | #include "trace.hpp" |
4b5782e1 | 33 | #include "viewitemowner.hpp" |
e0e90d80 | 34 | |
51e77110 JH |
35 | namespace pv { |
36 | ||
2b81ae46 | 37 | class Session; |
b86aa8f4 | 38 | |
1b1ec774 | 39 | namespace data { |
bf0edd2b | 40 | class SignalBase; |
28a4c9c5 | 41 | class SignalData; |
1b1ec774 | 42 | } |
28a4c9c5 | 43 | |
a2f71ef0 JH |
44 | namespace view { |
45 | ||
4b5782e1 | 46 | class Signal : public Trace, public ViewItemOwner |
28a4c9c5 | 47 | { |
2a2512b2 JH |
48 | Q_OBJECT |
49 | ||
28a4c9c5 | 50 | protected: |
2b81ae46 | 51 | Signal(pv::Session &session, |
bf0edd2b | 52 | std::shared_ptr<data::SignalBase> channel); |
28a4c9c5 JH |
53 | |
54 | public: | |
49f8ff3f JH |
55 | /** |
56 | * Sets the name of the signal. | |
57 | */ | |
bf0edd2b | 58 | virtual void set_name(QString name); |
49f8ff3f | 59 | |
f9abf97e | 60 | virtual std::shared_ptr<pv::data::SignalData> data() const = 0; |
9a0cd293 | 61 | |
b3b57abc | 62 | /** |
931f20b0 | 63 | * Returns true if the trace is visible and enabled. |
a29bb7fb | 64 | */ |
931f20b0 | 65 | bool enabled() const; |
a29bb7fb | 66 | |
73a25a6e | 67 | std::shared_ptr<data::SignalBase> base() const; |
632ba77e | 68 | |
4b5782e1 JH |
69 | /** |
70 | * Returns a list of row items owned by this object. | |
71 | */ | |
72 | const item_list& child_items() const; | |
73 | ||
99af6802 SA |
74 | void paint_back(QPainter &p, const ViewItemPaintParams &pp); |
75 | ||
0c0218fd JH |
76 | virtual void populate_popup_form(QWidget *parent, QFormLayout *form); |
77 | ||
86e823ca JH |
78 | QMenu* create_context_menu(QWidget *parent); |
79 | ||
5ed1adf5 JH |
80 | void delete_pressed(); |
81 | ||
214470fc JH |
82 | /** |
83 | * Returns the offset to show the drag handle. | |
84 | */ | |
85 | virtual int scale_handle_offset() const = 0; | |
86 | ||
87 | /** | |
88 | * Handles the scale handle being dragged to an offset. | |
89 | * @param offset the offset the scale handle was dragged to. | |
90 | */ | |
91 | virtual void scale_handle_dragged(int offset) = 0; | |
92 | ||
93 | /** | |
94 | * Handles the scale handle being being released. | |
95 | */ | |
96 | virtual void scale_handle_released() {}; | |
97 | ||
bf0edd2b SA |
98 | protected Q_SLOTS: |
99 | virtual void on_name_changed(const QString &text); | |
100 | ||
86e823ca JH |
101 | void on_disable(); |
102 | ||
a45b9b9e SA |
103 | void on_enabled_changed(bool enabled); |
104 | ||
28a4c9c5 | 105 | protected: |
2b81ae46 | 106 | pv::Session &session_; |
cec48d16 | 107 | |
f1626bb8 | 108 | const std::shared_ptr<SignalScaleHandle> scale_handle_; |
4b5782e1 JH |
109 | const item_list items_; |
110 | ||
8dbbc7f0 | 111 | QComboBox *name_widget_; |
28a4c9c5 | 112 | }; |
51e77110 | 113 | |
8d634081 | 114 | } // namespace view |
51e77110 | 115 | } // namespace pv |
640d091b | 116 | |
7a01bd36 | 117 | #endif // PULSEVIEW_PV_VIEW_SIGNAL_HPP |