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:
58
include/TerminalWidget.h
Normal file
58
include/TerminalWidget.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtWidgets/QWidget>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
#include <QtWidgets/QLineEdit>
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
#include <QtWidgets/QPushButton>
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
class TerminalWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TerminalWidget(QWidget *parent = nullptr);
|
||||
~TerminalWidget();
|
||||
|
||||
void setWorkingDirectory(const QString &directory);
|
||||
QString workingDirectory() const;
|
||||
|
||||
void executeCommand(const QString &command);
|
||||
void clear();
|
||||
|
||||
void showBuildOutput();
|
||||
void showRunOutput();
|
||||
|
||||
signals:
|
||||
void commandFinished(int exitCode);
|
||||
|
||||
private slots:
|
||||
void onCommandEntered();
|
||||
void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void onProcessError(QProcess::ProcessError error);
|
||||
void onProcessOutput();
|
||||
void updatePrompt();
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
void setupProcess();
|
||||
void appendOutput(const QString &text, const QColor &color = Qt::white);
|
||||
void appendPrompt();
|
||||
|
||||
QTextEdit *m_output;
|
||||
QLineEdit *m_input;
|
||||
QPushButton *m_clearButton;
|
||||
|
||||
QProcess *m_process;
|
||||
QString m_workingDirectory;
|
||||
QString m_currentPrompt;
|
||||
|
||||
// Colors for different output types
|
||||
QColor m_normalColor;
|
||||
QColor m_errorColor;
|
||||
QColor m_successColor;
|
||||
QColor m_promptColor;
|
||||
};
|
Reference in New Issue
Block a user