67 lines
1.7 KiB
C++
67 lines
1.7 KiB
C++
#ifndef APPLICATIONCONTROLLER_H
|
|
#define APPLICATIONCONTROLLER_H
|
|
|
|
#include <QObject>
|
|
#include "ViewportWidget.h" // For SketchPlane enum
|
|
#include <gp_Pnt.hxx>
|
|
|
|
class Document;
|
|
class MainWindow;
|
|
class SketchFeature;
|
|
|
|
class ApplicationController : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
enum ToolType {
|
|
None,
|
|
Line,
|
|
Rectangle,
|
|
Circle
|
|
};
|
|
Q_ENUM(ToolType)
|
|
|
|
explicit ApplicationController(QObject *parent = nullptr);
|
|
~ApplicationController();
|
|
|
|
void setMainWindow(MainWindow* mainWindow);
|
|
Document* document() const;
|
|
SketchFeature* activeSketch() const;
|
|
ToolType activeTool() const;
|
|
|
|
public slots:
|
|
void setActiveTool(ToolType tool);
|
|
void addLine(const gp_Pnt& start, const gp_Pnt& end);
|
|
void addRectangle(const gp_Pnt& corner1, const gp_Pnt& corner2);
|
|
void addCircle(const gp_Pnt& center, double radius);
|
|
void newDocument();
|
|
bool openDocument();
|
|
bool saveDocument();
|
|
bool saveDocumentAs();
|
|
|
|
void beginSketchCreation();
|
|
void onPlaneSelected(ViewportWidget::SketchPlane plane);
|
|
void endSketch();
|
|
|
|
signals:
|
|
void planeSelectionModeStarted();
|
|
void sketchModeStarted(ViewportWidget::SketchPlane plane);
|
|
void sketchModeEnded();
|
|
void currentFileChanged(const QString& path);
|
|
void activeToolChanged(ToolType tool);
|
|
|
|
private:
|
|
ApplicationController(const ApplicationController&) = delete;
|
|
ApplicationController& operator=(const ApplicationController&) = delete;
|
|
|
|
void setCurrentFile(const QString& fileName);
|
|
|
|
Document* m_document;
|
|
QString m_currentFile;
|
|
MainWindow* m_mainWindow = nullptr;
|
|
SketchFeature* m_activeSketch = nullptr;
|
|
ToolType m_activeTool = ToolType::None;
|
|
};
|
|
|
|
#endif // APPLICATIONCONTROLLER_H
|