mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-02-05 07:15:01 +01:00
Qt: some cleanup
This commit is contained in:
parent
49bcc93072
commit
be77083a2b
|
|
@ -1,11 +1,11 @@
|
|||
#include "syntax_highlighter.h"
|
||||
#include "qt_utils.h"
|
||||
|
||||
Highlighter::Highlighter(QTextDocument *parent) : QSyntaxHighlighter(parent)
|
||||
Highlighter::Highlighter(QTextDocument* parent) : QSyntaxHighlighter(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void Highlighter::addRule(const QString &pattern, const QBrush &brush)
|
||||
void Highlighter::addRule(const QString& pattern, const QBrush& brush)
|
||||
{
|
||||
HighlightingRule rule;
|
||||
rule.pattern = QRegularExpression(pattern);
|
||||
|
|
@ -13,14 +13,14 @@ void Highlighter::addRule(const QString &pattern, const QBrush &brush)
|
|||
highlightingRules.append(rule);
|
||||
}
|
||||
|
||||
void Highlighter::highlightBlock(const QString &text)
|
||||
void Highlighter::highlightBlock(const QString& text)
|
||||
{
|
||||
for (const HighlightingRule& rule : highlightingRules)
|
||||
{
|
||||
QRegularExpressionMatchIterator matchIterator = rule.pattern.globalMatch(text);
|
||||
while (matchIterator.hasNext())
|
||||
{
|
||||
QRegularExpressionMatch match = matchIterator.next();
|
||||
const QRegularExpressionMatch match = matchIterator.next();
|
||||
setFormat(match.capturedStart(), match.capturedLength(), rule.format);
|
||||
}
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ LogHighlighter::LogHighlighter(QTextDocument* parent) : Highlighter(parent)
|
|||
addRule("^·T.*$", gui::utils::get_label_color("log_level_trace", color, color));
|
||||
}
|
||||
|
||||
AsmHighlighter::AsmHighlighter(QTextDocument *parent) : Highlighter(parent)
|
||||
AsmHighlighter::AsmHighlighter(QTextDocument* parent) : Highlighter(parent)
|
||||
{
|
||||
addRule("^\\b[A-Z0-9]+\\b", Qt::darkBlue); // Instructions
|
||||
addRule("-?R\\d[^,;\\s]*", Qt::darkRed); // -R0.*
|
||||
|
|
@ -78,7 +78,7 @@ AsmHighlighter::AsmHighlighter(QTextDocument *parent) : Highlighter(parent)
|
|||
addRule("#[^\\n]*", Qt::darkGreen); // Single line comment
|
||||
}
|
||||
|
||||
GlslHighlighter::GlslHighlighter(QTextDocument *parent) : Highlighter(parent)
|
||||
GlslHighlighter::GlslHighlighter(QTextDocument* parent) : Highlighter(parent)
|
||||
{
|
||||
const QStringList keywordPatterns = QStringList()
|
||||
// Selection-Iteration-Jump Statements:
|
||||
|
|
|
|||
|
|
@ -10,11 +10,11 @@ class Highlighter : public QSyntaxHighlighter
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Highlighter(QTextDocument *parent = nullptr);
|
||||
explicit Highlighter(QTextDocument* parent = nullptr);
|
||||
|
||||
protected:
|
||||
void highlightBlock(const QString &text) override;
|
||||
void addRule(const QString &pattern, const QBrush &brush);
|
||||
void highlightBlock(const QString& text) override;
|
||||
void addRule(const QString& pattern, const QBrush& brush);
|
||||
|
||||
struct HighlightingRule
|
||||
{
|
||||
|
|
@ -42,7 +42,7 @@ class AsmHighlighter : public Highlighter
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AsmHighlighter(QTextDocument *parent = nullptr);
|
||||
explicit AsmHighlighter(QTextDocument* parent = nullptr);
|
||||
};
|
||||
|
||||
class GlslHighlighter : public Highlighter
|
||||
|
|
@ -50,5 +50,5 @@ class GlslHighlighter : public Highlighter
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GlslHighlighter(QTextDocument *parent = nullptr);
|
||||
explicit GlslHighlighter(QTextDocument* parent = nullptr);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue