From: Joel Holdsworth Date: Thu, 5 Sep 2013 12:58:28 +0000 (+0100) Subject: Added DecodeSignal default colours X-Git-Tag: pulseview-0.2.0~294 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=06bb4e6a55f5f6983d94fef2b25afc0a70f7b8d9;p=pulseview.git Added DecodeSignal default colours --- diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index ffe37d20..1ee5e003 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -209,7 +209,8 @@ void SigSession::add_decoder(srd_decoder *const dec, shared_ptr decoder( new data::Decoder(dec, probes)); shared_ptr d( - new view::DecodeSignal(*this, decoder)); + new view::DecodeSignal(*this, decoder, + _decode_traces.size())); _decode_traces.push_back(d); } signals_changed(); diff --git a/pv/view/decodesignal.cpp b/pv/view/decodesignal.cpp index f6611a0f..514fbca3 100644 --- a/pv/view/decodesignal.cpp +++ b/pv/view/decodesignal.cpp @@ -22,8 +22,11 @@ extern "C" { #include } +#include + #include "decodesignal.h" +#include #include #include #include @@ -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 decoder) : + boost::shared_ptr 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) diff --git a/pv/view/decodesignal.h b/pv/view/decodesignal.h index 271937b8..a9ff265e 100644 --- a/pv/view/decodesignal.h +++ b/pv/view/decodesignal.h @@ -37,9 +37,12 @@ class DecodeSignal : public Trace { Q_OBJECT +private: + static const QColor DecodeColours[4]; + public: DecodeSignal(pv::SigSession &session, - boost::shared_ptr decoder); + boost::shared_ptr decoder, int index); void init_context_bar_actions(QWidget *parent);