fixing a bug where quit messages from different networks were shown if the user has...
[quassel.git] / src / qtui / qtuistyle.cpp
1 /***************************************************************************
2  *   Copyright (C) 2005-08 by the Quassel Project                          *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) version 3.                                           *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19  ***************************************************************************/
20
21 #include "qtuistyle.h"
22 #include "qtuisettings.h"
23
24 QtUiStyle::QtUiStyle() : UiStyle("QtUiStyle") {
25   // We need to just set our internal formats; everything else is done by the base class...
26
27   // Internal message formats
28   QTextCharFormat plainMsg;
29   plainMsg.setForeground(QBrush("black"));
30   setFormat(PlainMsg, plainMsg, Settings::Default);
31
32   QTextCharFormat notice;
33   notice.setForeground(QBrush("navy"));
34   setFormat(NoticeMsg, notice, Settings::Default);
35
36   QTextCharFormat server;
37   server.setForeground(QBrush("navy"));
38   setFormat(ServerMsg, server, Settings::Default);
39
40   QTextCharFormat error;
41   error.setForeground(QBrush("red"));
42   setFormat(ErrorMsg, error, Settings::Default);
43
44   QTextCharFormat join;
45   join.setForeground(QBrush("green"));
46   setFormat(JoinMsg, join, Settings::Default);
47
48   QTextCharFormat part;
49   part.setForeground(QBrush("indianred"));
50   setFormat(PartMsg, part, Settings::Default);
51
52   QTextCharFormat quit;
53   quit.setForeground(QBrush("indianred"));
54   setFormat(QuitMsg, quit, Settings::Default);
55
56   QTextCharFormat kick;
57   kick.setForeground(QBrush("indianred"));
58   setFormat(KickMsg, kick, Settings::Default);
59
60   QTextCharFormat nren;
61   nren.setForeground(QBrush("magenta"));
62   setFormat(RenameMsg, nren, Settings::Default);
63
64   QTextCharFormat mode;
65   mode.setForeground(QBrush("steelblue"));
66   setFormat(ModeMsg, mode, Settings::Default);
67
68   QTextCharFormat action;
69   action.setFontItalic(true);
70   action.setForeground(QBrush("darkmagenta"));
71   setFormat(ActionMsg, action, Settings::Default);
72
73   // Internal message element formats
74   QTextCharFormat ts;
75   ts.setForeground(QBrush("grey"));
76   setFormat(Timestamp, ts, Settings::Default);
77
78   QTextCharFormat sender;
79   sender.setAnchor(true);
80   sender.setForeground(QBrush("navy"));
81   setFormat(Sender, sender, Settings::Default);
82
83   QTextCharFormat nick;
84   nick.setAnchor(true);
85   nick.setFontWeight(QFont::Bold);
86   setFormat(Nick, nick, Settings::Default);
87
88   QTextCharFormat hostmask;
89   hostmask.setFontItalic(true);
90   setFormat(Hostmask, hostmask, Settings::Default);
91
92   QTextCharFormat channel;
93   channel.setAnchor(true);
94   channel.setFontWeight(QFont::Bold);
95   setFormat(ChannelName, channel, Settings::Default);
96
97   QTextCharFormat flags;
98   flags.setFontWeight(QFont::Bold);
99   setFormat(ModeFlags, flags, Settings::Default);
100
101   QTextCharFormat url;
102   url.setFontUnderline(true);
103   url.setAnchor(true);
104   setFormat(Url, url, Settings::Default);
105
106   QtUiStyleSettings s;
107   _highlightColor = s.highlightColor();
108   if(!_highlightColor.isValid()) _highlightColor = QColor("lightcoral");
109 }
110
111 QtUiStyle::~QtUiStyle() {}
112
113 void QtUiStyle::setHighlightColor(const QColor &col) {
114   _highlightColor = col;
115   QtUiStyleSettings s;
116   s.setHighlightColor(col);
117 }