Communi  3.0.0
A cross-platform IRC framework written with Qt
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Macros Groups Pages
irctextformat.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 IRCTEXTFORMAT_H
16 #define IRCTEXTFORMAT_H
17 
18 #include <IrcGlobal>
19 #include <QtCore/qobject.h>
20 #include <QtCore/qstring.h>
21 #include <QtCore/qmetatype.h>
22 #include <QtCore/qscopedpointer.h>
23 
24 IRC_BEGIN_NAMESPACE
25 
26 class IrcPalette;
27 class IrcTextFormatPrivate;
28 
29 class IRC_UTIL_EXPORT IrcTextFormat : public QObject
30 {
31  Q_OBJECT
32  Q_PROPERTY(IrcPalette* palette READ palette CONSTANT)
33  Q_PROPERTY(QString urlPattern READ urlPattern WRITE setUrlPattern)
34 
35 public:
36  explicit IrcTextFormat(QObject* parent = 0);
37  virtual ~IrcTextFormat();
38 
39  IrcPalette* palette() const;
40 
41  QString urlPattern() const;
42  void setUrlPattern(const QString& pattern);
43 
44  Q_INVOKABLE QString toHtml(const QString& text) const;
45  Q_INVOKABLE QString toPlainText(const QString& text) const;
46 
47 private:
48  QScopedPointer<IrcTextFormatPrivate> d_ptr;
49  Q_DECLARE_PRIVATE(IrcTextFormat)
50  Q_DISABLE_COPY(IrcTextFormat)
51 };
52 
53 IRC_END_NAMESPACE
54 
55 Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(IrcTextFormat*))
56 
57 #endif // IRCTEXTFORMAT_H
Provides methods for text formatting.
Definition: irctextformat.h:29
Specifies a palette of IRC colors.
Definition: ircpalette.h:29