1 /***************************************************************************
2 * Copyright (C) 2005-07 by the Quassel IRC Team *
3 * devel@quassel-irc.org *
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) any later version. *
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. *
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 ***************************************************************************/
24 #include <QTextCharFormat>
25 #include <QTextLayout>
36 /** This enumerates the possible formats a text element may have. */
38 None, Bold, Italic, Underline, Reverse, // Standard formats
39 PlainMsg, NoticeMsg, ServerMsg, ErrorMsg, JoinMsg, PartMsg, QuitMsg, KickMsg, // Internal message formats
40 RenameMsg, ModeMsg, ActionMsg, // ...cnt'd
41 Timestamp, Sender, Nick, Hostmask, ChannelName, ModeFlags, Url, // individual elements
42 FgCol00, FgCol01, FgCol02, FgCol03, FgCol04, FgCol05, FgCol06, FgCol07, // Color codes
43 FgCol08, FgCol09, FgCol10, FgCol11, FgCol12, FgCol13, FgCol14, FgCol15,
44 BgCol00, BgCol01, BgCol02, BgCol03, BgCol04, BgCol05, BgCol06, BgCol07,
45 BgCol08, BgCol09, BgCol10, BgCol11, BgCol12, BgCol13, BgCol14, BgCol15,
46 NumFormatTypes, Invalid // Do not add anything after this
56 QList<QTextLayout::FormatRange> formats;
60 StyledString styleString(QString);
62 void setFormat(FormatType, QTextCharFormat);
63 QTextCharFormat format(FormatType) const;
65 FormatType formatType(const QString &code) const;
66 QString formatCode(FormatType) const;
72 QTextCharFormat mergedFormat(QList<FormatType>);
74 QVector<QTextCharFormat> _formats;
75 QHash<QString, FormatType> _formatCodes;