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:
66
include/ProjectManager.h
Normal file
66
include/ProjectManager.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
class ProjectManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ProjectManager(QObject *parent = nullptr);
|
||||
~ProjectManager();
|
||||
|
||||
bool openProject(const QString &projectPath);
|
||||
void closeProject();
|
||||
|
||||
QString projectPath() const;
|
||||
QString projectName() const;
|
||||
bool hasProject() const;
|
||||
|
||||
bool isCMakeProject() const;
|
||||
bool isQMakeProject() const;
|
||||
|
||||
void buildProject();
|
||||
void cleanProject();
|
||||
void configureProject();
|
||||
void runProject();
|
||||
|
||||
QString buildDirectory() const;
|
||||
QString sourceDirectory() const;
|
||||
|
||||
signals:
|
||||
void projectOpened(const QString &projectPath);
|
||||
void projectClosed();
|
||||
void buildStarted();
|
||||
void buildFinished(bool success);
|
||||
void buildOutput(const QString &output);
|
||||
|
||||
private slots:
|
||||
void onBuildProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void onBuildProcessError(QProcess::ProcessError error);
|
||||
void onBuildOutput();
|
||||
|
||||
private:
|
||||
void detectProjectType();
|
||||
void setupBuildDirectory();
|
||||
QString findCMakeListsFile(const QString &directory) const;
|
||||
QString findQMakeFile(const QString &directory) const;
|
||||
|
||||
QString m_projectPath;
|
||||
QString m_projectName;
|
||||
QString m_buildDirectory;
|
||||
|
||||
enum ProjectType {
|
||||
Unknown,
|
||||
CMake,
|
||||
QMake
|
||||
};
|
||||
ProjectType m_projectType;
|
||||
|
||||
QProcess *m_buildProcess;
|
||||
bool m_isBuilding;
|
||||
};
|
Reference in New Issue
Block a user