Open Source Snapmatic picture and Savegame viewer/editor for GTA V https://gta5view.syping.de/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

JSHighlighter.h 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*****************************************************************************
  2. * gta5view Grand Theft Auto V Profile Viewer
  3. * Copyright (C) 2017 Syping
  4. *
  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 3 of the License, or
  8. * (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, see <http://www.gnu.org/licenses/>.
  17. *****************************************************************************/
  18. #ifndef JSHIGHLIGHTER_H
  19. #define JSHIGHLIGHTER_H
  20. #include <QSyntaxHighlighter>
  21. #include <QTextCharFormat>
  22. #include <QTextDocument>
  23. #include <QTextFormat>
  24. #include <QStringList>
  25. #include <QRegExp>
  26. #include <QVector>
  27. #include <QHash>
  28. class QTextDocument;
  29. class JSHighlighter : public QSyntaxHighlighter
  30. {
  31. Q_OBJECT
  32. public:
  33. struct HighlightingRule
  34. {
  35. QRegExp pattern;
  36. QTextCharFormat format;
  37. };
  38. QVector<HighlightingRule> highlightingRules;
  39. QTextCharFormat keywordFormat;
  40. QTextCharFormat doubleFormat;
  41. QTextCharFormat quotationFormat;
  42. QTextCharFormat objectFormat;
  43. JSHighlighter(QTextDocument *parent = 0);
  44. protected:
  45. void highlightBlock(const QString &text) override;
  46. };
  47. #endif // JSHIGHLIGHTER_H