]> sigrok.org Git - pulseview.git/commitdiff
Added DecodeSignal default colours
authorJoel Holdsworth <redacted>
Thu, 5 Sep 2013 12:58:28 +0000 (13:58 +0100)
committerJoel Holdsworth <redacted>
Sun, 29 Sep 2013 14:56:12 +0000 (23:56 +0900)
pv/sigsession.cpp
pv/view/decodesignal.cpp
pv/view/decodesignal.h

index ffe37d2008e2ac626aa6c686434b284033872c25..1ee5e0033939a1918102f9edd71e84c4e48b03bc 100644 (file)
@@ -209,7 +209,8 @@ void SigSession::add_decoder(srd_decoder *const dec,
                shared_ptr<data::Decoder> decoder(
                        new data::Decoder(dec, probes));
                shared_ptr<view::DecodeSignal> d(
-                       new view::DecodeSignal(*this, decoder));
+                       new view::DecodeSignal(*this, decoder,
+                               _decode_traces.size()));
                _decode_traces.push_back(d);
        }
        signals_changed();
index f6611a0f05205c8e2f88c392a2b1f944ecc6abe1..514fbca339a0b07ca8f6349e0d1451b50c78647e 100644 (file)
@@ -22,8 +22,11 @@ extern "C" {
 #include <libsigrokdecode/libsigrokdecode.h>
 }
 
+#include <extdef.h>
+
 #include "decodesignal.h"
 
+#include <pv/sigsession.h>
 #include <pv/data/decoder.h>
 #include <pv/view/view.h>
 #include <pv/view/decode/annotation.h>
@@ -34,14 +37,21 @@ using namespace std;
 namespace pv {
 namespace view {
 
+const QColor DecodeSignal::DecodeColours[4] = {
+       QColor(0xEF, 0x29, 0x29),       // Red
+       QColor(0xFC, 0xE9, 0x4F),       // Yellow
+       QColor(0x8A, 0xE2, 0x34),       // Green
+       QColor(0x72, 0x9F, 0xCF)        // Blue
+};
+
 DecodeSignal::DecodeSignal(pv::SigSession &session,
-       boost::shared_ptr<pv::data::Decoder> decoder) :
+       boost::shared_ptr<pv::data::Decoder> decoder, int index) :
        Trace(session, QString(decoder->get_decoder()->name)),
        _decoder(decoder)
 {
        assert(_decoder);
 
-       _colour = Qt::red;
+       _colour = DecodeColours[index % countof(DecodeColours)];
 }
 
 void DecodeSignal::init_context_bar_actions(QWidget *parent)
index 271937b831d87410d202776f83bfd5c6bc0e0033..a9ff265e0569ad59cea4b7be869347180d8310ed 100644 (file)
@@ -37,9 +37,12 @@ class DecodeSignal : public Trace
 {
        Q_OBJECT
 
+private:
+       static const QColor DecodeColours[4];
+
 public:
        DecodeSignal(pv::SigSession &session,
-               boost::shared_ptr<pv::data::Decoder> decoder);
+               boost::shared_ptr<pv::data::Decoder> decoder, int index);
 
        void init_context_bar_actions(QWidget *parent);