50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "model/tkrTikzDocument.h"
|
|
|
|
#include <QMainWindow>
|
|
#include <memory>
|
|
|
|
class QAction;
|
|
class QCloseEvent;
|
|
class QPlainTextEdit;
|
|
|
|
namespace TikzRefinery {
|
|
|
|
class tkrDiagramScene;
|
|
class tkrDiagramView;
|
|
class tkrEditorController;
|
|
class tkrWorkspaceSidebar;
|
|
|
|
class tkrMainWindow final : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit tkrMainWindow(QWidget *pParent = nullptr, const QString &strInitialFilePath = {});
|
|
~tkrMainWindow() override;
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent *pEvent) override;
|
|
|
|
private:
|
|
void openDocument();
|
|
bool saveDocument();
|
|
bool confirmDiscardOrSave();
|
|
void updateDocumentView();
|
|
|
|
// Reverse member destruction releases the controller before its document.
|
|
tkrTikzDocument m_document;
|
|
tkrDiagramScene *m_pScene = nullptr; // Owned by this window through QObject parenting.
|
|
tkrDiagramView *m_pView = nullptr;
|
|
tkrWorkspaceSidebar *m_pSidebar = nullptr; // Owned through the central widget's Qt parent tree.
|
|
QPlainTextEdit *m_pSourceView = nullptr;
|
|
QAction *m_pSaveAction = nullptr;
|
|
QAction *m_pUndoAction = nullptr;
|
|
QAction *m_pRedoAction = nullptr;
|
|
// No QObject parent: unique_ptr is this controller's single owning mechanism.
|
|
std::unique_ptr<tkrEditorController> m_upController;
|
|
};
|
|
|
|
} // namespace TikzRefinery
|