]> sigrok.org Git - pulseview.git/blobdiff - pv/data/decode/row.hpp
Introduce DecodeSignal::annotation_visibility_changed and use it
[pulseview.git] / pv / data / decode / row.hpp
index 21f46d22057fccaf71f32f4b419acc24980fb20f..8e76dfa0b64d9a10ac555419cc752cbbbce16b88 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <vector>
 
+#include <QColor>
+
 #include <pv/data/decode/annotation.hpp>
 #include <pv/data/decode/decoder.hpp>
 
@@ -32,11 +34,16 @@ namespace pv {
 namespace data {
 namespace decode {
 
-struct AnnotationClass;
+#define DECODE_COLOR_SATURATION (180) /* 0-255 */
+#define DECODE_COLOR_VALUE (170) /* 0-255 */
+
+class AnnotationClass;
 class Decoder;
 
-class Row
+class Row: public QObject
 {
+       Q_OBJECT
+
 public:
        Row();
 
@@ -54,14 +61,31 @@ public:
        bool visible() const;
        void set_visible(bool visible);
 
+       void set_base_color(QColor base_color);
+       const QColor color() const;
+       const QColor get_class_color(uint32_t ann_class_id) const;
+       const QColor get_bright_class_color(uint32_t ann_class_id) const;
+       const QColor get_dark_class_color(uint32_t ann_class_id) const;
+
+       bool has_hidden_classes() const;
+       bool class_is_visible(uint32_t ann_class_id) const;
+
        bool operator<(const Row& other) const;
        bool operator==(const Row& other) const;
 
+Q_SIGNALS:
+       void visibility_changed();
+
 private:
        uint32_t index_;
        Decoder* decoder_;
        const srd_decoder_annotation_row* srd_row_;
        bool visible_;
+
+       QColor color_;
+       map<uint32_t, QColor> ann_class_color_;
+       map<uint32_t, QColor> ann_bright_class_color_;
+       map<uint32_t, QColor> ann_dark_class_color_;
 };
 
 }  // namespace decode