Mercurial > hg > easyhg
comparison 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 |
comparison
equal
deleted
inserted
replaced
52:384420567575 | 53:3c46b2ac45d3 |
---|---|
1 | |
2 #include "colourset.h" | |
3 | |
4 ColourSet | |
5 ColourSet::m_instance; | |
6 | |
7 ColourSet::ColourSet() { } | |
8 | |
9 ColourSet * | |
10 ColourSet::instance() | |
11 { | |
12 return &m_instance; | |
13 } | |
14 | |
15 QColor | |
16 ColourSet::getColourFor(QString n) | |
17 { | |
18 if (m_defaultNames.contains(n)) return Qt::black; | |
19 if (m_colours.contains(n)) return m_colours[n]; | |
20 | |
21 QColor c; | |
22 | |
23 if (m_colours.empty()) { | |
24 c = QColor::fromHsv(0, 200, 100); | |
25 } else { | |
26 c = QColor::fromHsv((m_lastColour.hue() + 70) % 360, 200, 100); | |
27 } | |
28 | |
29 m_colours[n] = c; | |
30 m_lastColour = c; | |
31 return c; | |
32 } | |
33 | |
34 | |
35 |