aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/vcsbase/submiteditorfile.h
blob: ce1df2fbc4f5f05727c924d91845aac96687a417 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "vcsbasesubmiteditor.h"

#include <coreplugin/idocument.h>

namespace VcsBase {
class VcsBaseSubmitEditor;

namespace Internal {

class SubmitEditorFile : public Core::IDocument
{
public:
    explicit SubmitEditorFile(VcsBaseSubmitEditor *editor);

    Utils::Result<> open(const Utils::FilePath &filePath,
                         const Utils::FilePath &realFilePath) override;

    QByteArray contents() const override;
    Utils::Result<> setContents(const QByteArray &contents) override;

    bool isModified() const override { return m_modified; }
    ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const override;

    void setModified(bool modified = true);

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

private:
    bool m_modified;
    VcsBaseSubmitEditor *m_editor;
};

} // namespace Internal
} // namespace VcsBase