refactor: Introduce ApplicationController to centralize logic
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
46
src/ApplicationController.h
Normal file
46
src/ApplicationController.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef APPLICATIONCONTROLLER_H
|
||||
#define APPLICATIONCONTROLLER_H
|
||||
|
||||
#include <QObject>
|
||||
#include "ViewportWidget.h" // For SketchPlane enum
|
||||
|
||||
class Document;
|
||||
class MainWindow;
|
||||
|
||||
class ApplicationController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static ApplicationController* instance();
|
||||
|
||||
void setMainWindow(MainWindow* mainWindow);
|
||||
Document* document() const;
|
||||
|
||||
public slots:
|
||||
void newDocument();
|
||||
bool openDocument();
|
||||
bool saveDocument();
|
||||
bool saveDocumentAs();
|
||||
|
||||
void beginSketchCreation();
|
||||
void endSketch();
|
||||
|
||||
signals:
|
||||
void sketchModeStarted(ViewportWidget::SketchPlane plane);
|
||||
void sketchModeEnded();
|
||||
void currentFileChanged(const QString& path);
|
||||
|
||||
private:
|
||||
explicit ApplicationController(QObject *parent = nullptr);
|
||||
~ApplicationController();
|
||||
ApplicationController(const ApplicationController&) = delete;
|
||||
ApplicationController& operator=(const ApplicationController&) = delete;
|
||||
|
||||
void setCurrentFile(const QString& fileName);
|
||||
|
||||
Document* m_document;
|
||||
QString m_currentFile;
|
||||
MainWindow* m_mainWindow = nullptr;
|
||||
};
|
||||
|
||||
#endif // APPLICATIONCONTROLLER_H
|
||||
Reference in New Issue
Block a user