feat: Implement core functionality for DTC C/C++ IDE
- Added ProjectManager class to handle project operations including opening, closing, building, and running projects. - Introduced SyntaxHighlighter class for syntax highlighting in C and C++ files. - Developed TerminalWidget for command execution and output display. - Created TextEditor with line numbering and auto-indentation features. - Established main application entry point in main.cpp. - Designed UI layout for MainWindow using Qt Designer.
This commit is contained in:
47
include/SyntaxHighlighter.h
Normal file
47
include/SyntaxHighlighter.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtGui/QSyntaxHighlighter>
|
||||
#include <QtGui/QTextDocument>
|
||||
#include <QtGui/QTextCharFormat>
|
||||
#include <QtCore/QRegularExpression>
|
||||
|
||||
class SyntaxHighlighter : public QSyntaxHighlighter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SyntaxHighlighter(QTextDocument *parent = nullptr);
|
||||
~SyntaxHighlighter();
|
||||
|
||||
void setLanguage(const QString &language);
|
||||
QString language() const;
|
||||
|
||||
protected:
|
||||
void highlightBlock(const QString &text) override;
|
||||
|
||||
private:
|
||||
struct HighlightingRule
|
||||
{
|
||||
QRegularExpression pattern;
|
||||
QTextCharFormat format;
|
||||
};
|
||||
QVector<HighlightingRule> m_highlightingRules;
|
||||
|
||||
void setupCppHighlighting();
|
||||
void setupCHighlighting();
|
||||
void setupCommonRules();
|
||||
|
||||
QTextCharFormat m_keywordFormat;
|
||||
QTextCharFormat m_classFormat;
|
||||
QTextCharFormat m_singleLineCommentFormat;
|
||||
QTextCharFormat m_multiLineCommentFormat;
|
||||
QTextCharFormat m_quotationFormat;
|
||||
QTextCharFormat m_functionFormat;
|
||||
QTextCharFormat m_numberFormat;
|
||||
QTextCharFormat m_preprocessorFormat;
|
||||
|
||||
QRegularExpression m_commentStartExpression;
|
||||
QRegularExpression m_commentEndExpression;
|
||||
|
||||
QString m_language;
|
||||
};
|
Reference in New Issue
Block a user