Communi  3.0.0
A cross-platform IRC framework written with Qt
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Macros Groups Pages
ircpalette.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2008-2013 The Communi Project
3 *
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
12 * License for more details.
13 */
14 
15 #ifndef IRCPALETTE_H
16 #define IRCPALETTE_H
17 
18 #include <IrcGlobal>
19 #include <QtCore/qmap.h>
20 #include <QtCore/qobject.h>
21 #include <QtCore/qstring.h>
22 #include <QtCore/qmetatype.h>
23 #include <QtCore/qscopedpointer.h>
24 
25 IRC_BEGIN_NAMESPACE
26 
27 class IrcPalettePrivate;
28 
29 class IrcPalette : public QObject
30 {
31  Q_OBJECT
32  Q_PROPERTY(QString white READ white WRITE setWhite)
33  Q_PROPERTY(QString black READ black WRITE setBlack)
34  Q_PROPERTY(QString blue READ blue WRITE setBlue)
35  Q_PROPERTY(QString green READ green WRITE setGreen)
36  Q_PROPERTY(QString red READ red WRITE setRed)
37  Q_PROPERTY(QString brown READ brown WRITE setBrown)
38  Q_PROPERTY(QString purple READ purple WRITE setPurple)
39  Q_PROPERTY(QString orange READ orange WRITE setOrange)
40  Q_PROPERTY(QString yellow READ yellow WRITE setYellow)
41  Q_PROPERTY(QString lightGreen READ lightGreen WRITE setLightGreen)
42  Q_PROPERTY(QString cyan READ cyan WRITE setCyan)
43  Q_PROPERTY(QString lightCyan READ lightCyan WRITE setLightCyan)
44  Q_PROPERTY(QString lightBlue READ lightBlue WRITE setLightBlue)
45  Q_PROPERTY(QString pink READ pink WRITE setPink)
46  Q_PROPERTY(QString gray READ gray WRITE setGray)
47  Q_PROPERTY(QString lightGray READ lightGray WRITE setLightGray)
48 
49 public:
50  ~IrcPalette();
51 
52  QMap<int, QString> colorNames() const;
53  void setColorNames(const QMap<int, QString>& names);
54 
55  QString colorName(int color, const QString& fallback = QLatin1String("black")) const;
56  void setColorName(int color, const QString& name);
57 
58  QString white() const;
59  void setWhite(const QString& color);
60 
61  QString black() const;
62  void setBlack(const QString& color);
63 
64  QString blue() const;
65  void setBlue(const QString& color);
66 
67  QString green() const;
68  void setGreen(const QString& color);
69 
70  QString red() const;
71  void setRed(const QString& color);
72 
73  QString brown() const;
74  void setBrown(const QString& color);
75 
76  QString purple() const;
77  void setPurple(const QString& color);
78 
79  QString orange() const;
80  void setOrange(const QString& color);
81 
82  QString yellow() const;
83  void setYellow(const QString& color);
84 
85  QString lightGreen() const;
86  void setLightGreen(const QString& color);
87 
88  QString cyan() const;
89  void setCyan(const QString& color);
90 
91  QString lightCyan() const;
92  void setLightCyan(const QString& color);
93 
94  QString lightBlue() const;
95  void setLightBlue(const QString& color);
96 
97  QString pink() const;
98  void setPink(const QString& color);
99 
100  QString gray() const;
101  void setGray(const QString& color);
102 
103  QString lightGray() const;
104  void setLightGray(const QString& color);
105 
106 private:
107  friend class IrcTextFormat;
108  explicit IrcPalette(QObject* parent);
109 
110  QScopedPointer<IrcPalettePrivate> d_ptr;
111  Q_DECLARE_PRIVATE(IrcPalette)
112  Q_DISABLE_COPY(IrcPalette)
113 };
114 
115 IRC_END_NAMESPACE
116 
117 Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcPalette*))
118 
119 #endif // IRCPALETTE_H
Provides methods for text formatting.
Definition: irctextformat.h:29
QMap< int, QString > colorNames() const
Definition: ircpalette.cpp:466
void setColorName(int color, const QString &name)
Definition: ircpalette.cpp:505
QString colorName(int color, const QString &fallback=QLatin1String("black")) const
Definition: ircpalette.cpp:485
Specifies a palette of IRC colors.
Definition: ircpalette.h:29
void setColorNames(const QMap< int, QString > &names)
Definition: ircpalette.cpp:475
QObject * parent() const