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:
TIPC1110
2025-07-04 12:23:20 +07:00
parent cb1b9863e0
commit a32f79f6d5
22 changed files with 2930 additions and 0 deletions

View 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;
};