From: Joel Holdsworth Date: Sat, 16 Mar 2013 08:44:04 +0000 (+0000) Subject: Setup analog probe colours X-Git-Tag: pulseview-0.1.0~78 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=568b90d4fcfb5f67f5fb642a9f0fdb3a54607bf3;p=pulseview.git Setup analog probe colours --- diff --git a/pv/sigsession.cpp b/pv/sigsession.cpp index 5af04b83..55b33087 100644 --- a/pv/sigsession.cpp +++ b/pv/sigsession.cpp @@ -261,7 +261,7 @@ void SigSession::feed_in_header(const sr_dev_inst *sdi) case SR_PROBE_ANALOG: signal = shared_ptr( new view::AnalogSignal(probe->name, - _analog_data)); + _analog_data, probe->index)); break; } diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp index a6f032b5..03b05955 100644 --- a/pv/view/analogsignal.cpp +++ b/pv/view/analogsignal.cpp @@ -32,11 +32,19 @@ using namespace std; namespace pv { namespace view { -AnalogSignal::AnalogSignal(QString name, shared_ptr data) : +const QColor AnalogSignal::SignalColours[4] = { + QColor(0xC4, 0xA0, 0x00), // Yellow + QColor(0x87, 0x20, 0x7A), // Magenta + QColor(0x20, 0x4A, 0x87), // Blue + QColor(0x4E, 0x9A, 0x06) // Green +}; + +AnalogSignal::AnalogSignal(QString name, shared_ptr data, + int probe_index) : Signal(name), _data(data) { - _colour = Qt::blue; + _colour = SignalColours[probe_index % countof(SignalColours)]; } void AnalogSignal::paint(QPainter &p, int y, int left, int right, double scale, diff --git a/pv/view/analogsignal.h b/pv/view/analogsignal.h index 86471537..6e4199ac 100644 --- a/pv/view/analogsignal.h +++ b/pv/view/analogsignal.h @@ -35,9 +35,12 @@ namespace view { class AnalogSignal : public Signal { +private: + static const QColor SignalColours[4]; + public: AnalogSignal(QString name, - boost::shared_ptr data); + boost::shared_ptr data, int probe_index); /** * Paints the signal with a QPainter