blob: 09cf65074a0208433031862e97380b6137230307 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// Copyright (C) 2016 Jochen Becher
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "qmt/infrastructure/exceptions.h"
#include "qmt/infrastructure/qmt_global.h"
#include <utils/filepath.h>
#include <QObject>
#include <QString>
namespace qmt {
class Project;
class QMT_EXPORT NoFileNameException : public Exception
{
public:
NoFileNameException();
};
class QMT_EXPORT ProjectIsModifiedException : public Exception
{
public:
ProjectIsModifiedException();
};
class QMT_EXPORT ProjectController : public QObject
{
Q_OBJECT
public:
explicit ProjectController(QObject *parent = nullptr);
~ProjectController() override;
signals:
void changed();
void fileNameChanged(const Utils::FilePath &fileName);
public:
Project *project() const { return m_project.data(); }
bool isModified() const { return m_isModified; }
void newProject(const Utils::FilePath &fileName);
void setFileName(const Utils::FilePath &fileName);
void setModified();
void load();
void save();
void saveAs(const Utils::FilePath &fileName);
private:
QScopedPointer<Project> m_project;
bool m_isModified = false;
};
} // namespace qmt
|