aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/modeleditor/modeldocument.h
blob: 28d942244b32e057405240cd5ff114dd958b962e (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
// 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 <coreplugin/idocument.h>
#include <utils/filepath.h>

namespace qmt { class Uid; }

namespace ModelEditor::Internal {

class ExtDocumentController;

class ModelDocument : public Core::IDocument
{
    Q_OBJECT
    class ModelDocumentPrivate;

public:
    explicit ModelDocument(QObject *parent = nullptr);
    ~ModelDocument();

signals:
    void contentSet();

public:
    Utils::Result<> open(const Utils::FilePath &filePath,
                         const Utils::FilePath &realFilePath) override;
    bool shouldAutoSave() const override;
    bool isModified() const override;
    bool isSaveAsAllowed() const override;
    Utils::Result<> reload(ReloadFlag flag, ChangeType type) override;

    ExtDocumentController *documentController() const;

    Utils::Result<> load(const Utils::FilePath &fileName);

protected:
    Utils::Result<> saveImpl(const Utils::FilePath &filePath, SaveOption option) override;

private:
    ModelDocumentPrivate *d;
};

} // namespace ModelEditor::Internal