Songbook-Client  0.7
This application is a manager of customguitar songbooks
 All Classes Files Functions Variables Enumerations Enumerator Pages
logs-highlighter.hh
Go to the documentation of this file.
1 // Copyright (C) 2009-2011, Romain Goffe <romain.goffe@gmail.com>
2 // Copyright (C) 2009-2011, Alexandre Dupas <alexandre.dupas@gmail.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License as
6 // published by the Free Software Foundation; either version 2 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but
10 // WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 // 02110-1301, USA.
18 //******************************************************************************
19 #ifndef __LOGS_HIGHLIGHTER_HH__
20 #define __LOGS_HIGHLIGHTER_HH__
21 
22 #include <QSyntaxHighlighter>
23 
24 #include <QHash>
25 #include <QTextCharFormat>
26 
27 class QTextDocument;
28 
38 class CLogsHighlighter : public QSyntaxHighlighter
39 {
40  Q_OBJECT
41 
42 public:
44  CLogsHighlighter(QTextDocument *parent = 0);
47 
48 protected:
50  void highlightBlock(const QString &text);
51 
52 private:
53  struct HighlightingRule
54  {
55  QRegExp pattern;
56  QTextCharFormat format;
57  };
58  QVector<HighlightingRule> highlightingRules;
59 
60  QTextCharFormat m_latexFileFormat;
61  QTextCharFormat m_latexErrorFormat;
62  QTextCharFormat m_latexWarningFormat;
63 };
64 
65 #endif // __LOGS_HIGHLIGHTER_HH__