annotate colourset.cpp @ 53:3c46b2ac45d3

* Put proper labels &c in changeset items; colour branches and users; etc
author Chris Cannam
date Fri, 12 Nov 2010 16:48:18 +0000
parents
children f583e44d9d31
rev   line source
Chris@53 1
Chris@53 2 #include "colourset.h"
Chris@53 3
Chris@53 4 ColourSet
Chris@53 5 ColourSet::m_instance;
Chris@53 6
Chris@53 7 ColourSet::ColourSet() { }
Chris@53 8
Chris@53 9 ColourSet *
Chris@53 10 ColourSet::instance()
Chris@53 11 {
Chris@53 12 return &m_instance;
Chris@53 13 }
Chris@53 14
Chris@53 15 QColor
Chris@53 16 ColourSet::getColourFor(QString n)
Chris@53 17 {
Chris@53 18 if (m_defaultNames.contains(n)) return Qt::black;
Chris@53 19 if (m_colours.contains(n)) return m_colours[n];
Chris@53 20
Chris@53 21 QColor c;
Chris@53 22
Chris@53 23 if (m_colours.empty()) {
Chris@53 24 c = QColor::fromHsv(0, 200, 100);
Chris@53 25 } else {
Chris@53 26 c = QColor::fromHsv((m_lastColour.hue() + 70) % 360, 200, 100);
Chris@53 27 }
Chris@53 28
Chris@53 29 m_colours[n] = c;
Chris@53 30 m_lastColour = c;
Chris@53 31 return c;
Chris@53 32 }
Chris@53 33
Chris@53 34
Chris@53 35