blob: 01ddafc23bf39ff6f0488e044ccd4fb41ff240e8 (
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
|
// 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 "utils_global.h"
#include "filepath.h"
#include "result.h"
#include "store.h"
namespace Utils {
class QTCREATOR_UTILS_EXPORT PersistentSettingsReader
{
public:
PersistentSettingsReader();
QVariant restoreValue(const Key &variable, const QVariant &defaultValue = {}) const;
Store restoreValues() const;
bool load(const FilePath &fileName);
FilePath filePath();
private:
QVariantMap m_valueMap;
FilePath m_filePath;
};
class QTCREATOR_UTILS_EXPORT PersistentSettingsWriter
{
public:
PersistentSettingsWriter(const FilePath &fileName, const QString &docType);
Result<> save(const Store &data, bool showError = true) const;
FilePath fileName() const;
void setContents(const Store &data);
private:
Result<> write(const Store &data) const;
const FilePath m_fileName;
const QString m_docType;
mutable Store m_savedData;
};
} // namespace Utils
|