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

#pragma once

#include <utils/settingsaccessor.h>

#include <QHash>
#include <QVariantMap>
#include <QMessageBox>

namespace ProjectExplorer {

class Project;

namespace Internal {

class UserFileAccessor : public Utils::MergingSettingsAccessor
{
public:
    UserFileAccessor(Project *project);

protected:
    Utils::Store prepareToWriteSettings(const Utils::Store &data) const final;

private:
    Utils::Store postprocessMerge(const Utils::Store &main,
                                  const Utils::Store &secondary,
                                  const Utils::Store &result) const final;

    Utils::SettingsMergeResult merge(const SettingsMergeData &global,
                                     const SettingsMergeData &local) const final;
    std::optional<Issue> writeFile(const Utils::FilePath &path, const Utils::Store &data) const final;

    virtual QVariant retrieveSharedSettings() const;

    Utils::FilePath projectUserFileV1() const;
    Utils::FilePath projectUserFileV2() const;
    Utils::FilePath externalUserFile() const;
    Utils::FilePath sharedFile() const;
    Utils::SettingsMergeFunction userStickyTrackerFunction(Utils::KeyList &stickyKeys) const;

    Project * const m_project;
};

QObject *createUserFileAccessorTest();

} // namespace Internal
} // namespace ProjectExplorer