ircmessageclass.h
1 //------------------------------------------------------------------------------
2 // ircmessageclass.h
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
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 Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 
22 // Copyright (C) 2010 "Zalewa" <zalewapl@gmail.com>
23 //------------------------------------------------------------------------------
24 #ifndef __IRCMESSAGECLASS_H__
25 #define __IRCMESSAGECLASS_H__
26 
27 #include <QString>
28 
30 {
31  public:
32  enum ClassName
33  {
34  ChannelAction,
35  Ctcp,
36  Error,
42  NetworkAction
43  };
44 
45  static QString toStyleSheetClassName(ClassName className);
46 
48  {
49  this->className = Normal;
50  }
51 
52  IRCMessageClass(const IRCMessageClass& other)
53  {
54  this->className = other.className;
55  }
56 
57  IRCMessageClass(const ClassName& className)
58  {
59  this->className = className;
60  }
61 
62  bool operator==(const IRCMessageClass& other) const
63  {
64  return this->className == other.className;
65  }
66 
67  bool operator==(const ClassName& className) const
68  {
69  return this->className == className;
70  }
71 
72  bool operator!=(const IRCMessageClass& other) const
73  {
74  return this->className != other.className;
75  }
76 
77  bool operator!=(const ClassName& className) const
78  {
79  return this->className != className;
80  }
81 
82  operator ClassName() const
83  {
84  return this->className;
85  }
86 
90  QString colorFromConfig() const;
91 
92  QString toStyleSheetClassName() const
93  {
94  return toStyleSheetClassName(this->className);
95  }
96 
97  private:
98  ClassName className;
99 };
100 
101 #endif
Normal has no representation in string, ie. it represents a global style for the widget.
QString colorFromConfig() const
Obtains HTML color from config for this message class.