Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
theme_code_view.h
Go to the documentation of this file.
1
9
10#ifndef THEME_CODE_VIEW_H
11#define THEME_CODE_VIEW_H
12
13#include <QFont>
14#include <QString>
15#include <QVector>
16#include <QWidget>
17
18class QSyntaxHighlighter;
19class ThemeCodeEdit;
20
22enum class ThemeDiffKind { Equal, Changed, Added, Removed };
23
26{
27 ThemeDiffKind kind = ThemeDiffKind::Equal;
28 QString text;
29 int number = 0; // line number in the current text; 0 for removed lines
30};
31
37class ThemeCodeView : public QWidget
38{
39 Q_OBJECT
40public:
41 explicit ThemeCodeView(QWidget *parent = nullptr);
42
43 void setTexts(const QString &compareText, const QString &currentText);
44 void setViewFont(const QFont &monospace);
45
46 int changedLines() const { return changed_lines_; }
47 int addedLines() const { return added_lines_; }
48 int removedLines() const { return removed_lines_; }
49
51 void nextChange();
52 void previousChange();
53
55 QString currentText() const { return current_text_; }
56
57signals:
58 void countsChanged();
59
60private:
61 void applyColors();
62 void rebuildSelections();
63 void goToBlock(int block);
64
65 ThemeCodeEdit *edit_;
66 QSyntaxHighlighter *highlighter_ = nullptr;
67 QVector<ThemeDiffLine> lines_;
68 QVector<int> run_starts_;
69 QString current_text_;
70 int changed_lines_ = 0;
71 int added_lines_ = 0;
72 int removed_lines_ = 0;
73};
74
75#endif // THEME_CODE_VIEW_H
Definition theme_code_view.cpp:38
QString currentText() const
Definition theme_code_view.h:55
void nextChange()
Definition theme_code_view.cpp:340
Definition theme_code_view.h:26
ThemeDiffKind
Definition theme_code_view.h:22