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

#pragma once

#include "cppeditor_global.h"
#include "cppcodestylesettings.h"

#include <texteditor/icodestylepreferences.h>

namespace CppEditor {

class CPPEDITOR_EXPORT CppCodeStylePreferences : public TextEditor::ICodeStylePreferences
{
    Q_OBJECT
public:
    explicit CppCodeStylePreferences(
        QObject *parent = nullptr);

    QVariant value() const override;
    void setValue(const QVariant &) override;

    CppCodeStyleSettings codeStyleSettings() const;

    // tracks parent hierarchy until currentParentSettings is null
    CppCodeStyleSettings currentCodeStyleSettings() const;

    QVariantMap toMap() const override;
    void fromMap(const QVariantMap &map) override;

public slots:
    void setCodeStyleSettings(const CppCodeStyleSettings &data);

signals:
    void codeStyleSettingsChanged(const CppCodeStyleSettings &);
    void currentCodeStyleSettingsChanged(const CppCodeStyleSettings &);

private:
    void slotCurrentValueChanged(const QVariant &);

    CppCodeStyleSettings m_data;
};

} // namespace CppEditor