]>
Commit | Line | Data |
---|---|---|
f9101a91 JH |
1 | /* |
2 | * This file is part of the PulseView project. | |
3 | * | |
4 | * Copyright (C) 2014 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 | |
efdec55a | 17 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
f9101a91 JH |
18 | */ |
19 | ||
7a01bd36 JH |
20 | #ifndef PULSEVIEW_PV_DATA_DECODE_ROW_HPP |
21 | #define PULSEVIEW_PV_DATA_DECODE_ROW_HPP | |
f9101a91 | 22 | |
1e948182 | 23 | #include <map> |
f9101a91 JH |
24 | #include <vector> |
25 | ||
1e948182 | 26 | #include <QObject> |
ae30ff42 SA |
27 | #include <QColor> |
28 | ||
f9101a91 JH |
29 | struct srd_decoder; |
30 | struct srd_decoder_annotation_row; | |
31 | ||
1e948182 SA |
32 | using std::map; |
33 | using std::vector; | |
34 | ||
f9101a91 JH |
35 | namespace pv { |
36 | namespace data { | |
37 | namespace decode { | |
38 | ||
ae30ff42 SA |
39 | #define DECODE_COLOR_SATURATION (180) /* 0-255 */ |
40 | #define DECODE_COLOR_VALUE (170) /* 0-255 */ | |
41 | ||
02078aa1 | 42 | class AnnotationClass; |
cbb2e4da SA |
43 | class Decoder; |
44 | ||
02078aa1 | 45 | class Row: public QObject |
f9101a91 | 46 | { |
02078aa1 SA |
47 | Q_OBJECT |
48 | ||
f9101a91 JH |
49 | public: |
50 | Row(); | |
51 | ||
6a26fc44 SA |
52 | Row(uint32_t index, Decoder* decoder, |
53 | const srd_decoder_annotation_row* srd_row = nullptr); | |
f9101a91 | 54 | |
cbb2e4da | 55 | const Decoder* decoder() const; |
6a26fc44 | 56 | const srd_decoder_annotation_row* get_srd_row() const; |
f9101a91 | 57 | |
88908838 | 58 | const QString title() const; |
6a26fc44 SA |
59 | const QString description() const; |
60 | vector<AnnotationClass*> ann_classes() const; | |
61 | uint32_t index() const; | |
88908838 | 62 | |
c6b4e925 SA |
63 | bool visible() const; |
64 | void set_visible(bool visible); | |
65 | ||
ae30ff42 SA |
66 | void set_base_color(QColor base_color); |
67 | const QColor color() const; | |
68 | const QColor get_class_color(uint32_t ann_class_id) const; | |
69 | const QColor get_bright_class_color(uint32_t ann_class_id) const; | |
70 | const QColor get_dark_class_color(uint32_t ann_class_id) const; | |
71 | ||
81dc0221 | 72 | bool has_hidden_classes() const; |
86d4b8e3 | 73 | bool class_is_visible(uint32_t ann_class_id) const; |
81dc0221 | 74 | |
cbb2e4da SA |
75 | bool operator<(const Row& other) const; |
76 | bool operator==(const Row& other) const; | |
f9101a91 | 77 | |
02078aa1 SA |
78 | Q_SIGNALS: |
79 | void visibility_changed(); | |
80 | ||
f9101a91 | 81 | private: |
6a26fc44 SA |
82 | uint32_t index_; |
83 | Decoder* decoder_; | |
84 | const srd_decoder_annotation_row* srd_row_; | |
c6b4e925 | 85 | bool visible_; |
ae30ff42 SA |
86 | |
87 | QColor color_; | |
88 | map<uint32_t, QColor> ann_class_color_; | |
89 | map<uint32_t, QColor> ann_bright_class_color_; | |
90 | map<uint32_t, QColor> ann_dark_class_color_; | |
f9101a91 JH |
91 | }; |
92 | ||
870ea3db UH |
93 | } // namespace decode |
94 | } // namespace data | |
95 | } // namespace pv | |
f9101a91 | 96 | |
7a01bd36 | 97 | #endif // PULSEVIEW_PV_DATA_DECODE_ROW_HPP |