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