summaryrefslogtreecommitdiffstats
path: root/ksirc/nickColourMaker.h
blob: 239a7935aeb3d10e3b197a50cedbb68a707f86ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* This file is part of the KDE project
   Copyright (C) 2003 Andrew Stanley-Jones

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GPL.
*/
#ifndef __nickcolourmaker_h__
#define __nickcolourmaker_h__

#include <qdict.h>
#include <qstring.h>
#include <qmap.h>
#include <qcolor.h>
#include "ksopts.h"

struct nickColourInfo
{
    nickColourInfo(int _fg) { fg = _fg; }
    int fg;
};

// Helper class to parse IRC colour nicks in the
// irc channel and the nick list
class nickColourMaker
{
public:
    nickColourMaker();

    int findIdx(QString nick) const;
    QColor findFg(QString nick) const;
    QColor operator[]( QString nick ) const
    {
        return findFg(nick);
    }

    static nickColourMaker *colourMaker() { return s_ncm; }


private:
    static nickColourMaker *s_ncm;
    QDict<nickColourInfo> m_nicks;
};

#endif