Mercurial > hg > easyhg
annotate colourset.cpp @ 277:b6e4643d6c05
Remove no-longer-used icon files
author | Chris Cannam |
---|---|
date | Wed, 09 Feb 2011 12:02:53 +0000 |
parents | 8fd71f570884 |
children |
rev | line source |
---|---|
Chris@57 | 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@57 | 2 |
Chris@57 | 3 /* |
Chris@57 | 4 EasyMercurial |
Chris@57 | 5 |
Chris@57 | 6 Based on HgExplorer by Jari Korhonen |
Chris@57 | 7 Copyright (c) 2010 Jari Korhonen |
Chris@244 | 8 Copyright (c) 2011 Chris Cannam |
Chris@244 | 9 Copyright (c) 2011 Queen Mary, University of London |
Chris@57 | 10 |
Chris@57 | 11 This program is free software; you can redistribute it and/or |
Chris@57 | 12 modify it under the terms of the GNU General Public License as |
Chris@57 | 13 published by the Free Software Foundation; either version 2 of the |
Chris@57 | 14 License, or (at your option) any later version. See the file |
Chris@57 | 15 COPYING included with this distribution for more information. |
Chris@57 | 16 */ |
Chris@57 | 17 |
Chris@53 | 18 |
Chris@53 | 19 #include "colourset.h" |
Chris@53 | 20 |
Chris@53 | 21 ColourSet |
Chris@53 | 22 ColourSet::m_instance; |
Chris@53 | 23 |
Chris@53 | 24 ColourSet::ColourSet() { } |
Chris@53 | 25 |
Chris@53 | 26 ColourSet * |
Chris@53 | 27 ColourSet::instance() |
Chris@53 | 28 { |
Chris@53 | 29 return &m_instance; |
Chris@53 | 30 } |
Chris@53 | 31 |
Chris@53 | 32 QColor |
Chris@53 | 33 ColourSet::getColourFor(QString n) |
Chris@53 | 34 { |
Chris@53 | 35 if (m_defaultNames.contains(n)) return Qt::black; |
Chris@53 | 36 if (m_colours.contains(n)) return m_colours[n]; |
Chris@53 | 37 |
Chris@53 | 38 QColor c; |
Chris@53 | 39 |
Chris@53 | 40 if (m_colours.empty()) { |
Chris@53 | 41 c = QColor::fromHsv(0, 200, 100); |
Chris@53 | 42 } else { |
Chris@53 | 43 c = QColor::fromHsv((m_lastColour.hue() + 70) % 360, 200, 100); |
Chris@53 | 44 } |
Chris@53 | 45 |
Chris@53 | 46 m_colours[n] = c; |
Chris@53 | 47 m_lastColour = c; |
Chris@53 | 48 return c; |
Chris@53 | 49 } |
Chris@53 | 50 |
Chris@53 | 51 |
Chris@53 | 52 |