aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/designercore/model/rewriteactioncompressor.h
blob: 0e51f77e6ccc309d8822a28552447eb467e402b0 (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
// 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 "rewriteaction.h"

namespace QmlDesigner {
namespace Internal {

class RewriteActionCompressor
{
public:
    RewriteActionCompressor(const PropertyNameList &propertyOrder, ModelNodePositionStorage *positionStore) :
        m_propertyOrder(propertyOrder),
        m_positionStore(positionStore)
    {}

    void operator()(QList<RewriteAction *> &actions, const TextEditor::TabSettings &tabSettings) const;

private:
    void compressImports(QList<RewriteAction *> &actions) const;

    void compressRereparentActions(QList<RewriteAction *> &actions) const;
    void compressReparentIntoSamePropertyActions(QList<RewriteAction *> &actions) const;
    void compressReparentIntoNewPropertyActions(QList<RewriteAction *> &actions) const;
    void compressAddEditRemoveNodeActions(QList<RewriteAction *> &actions) const;
    void compressPropertyActions(QList<RewriteAction *> &actions) const;
    void compressAddEditActions(QList<RewriteAction *> &actions, const TextEditor::TabSettings &tabSettings) const;
    void compressAddReparentActions(QList<RewriteAction *> &actions) const;

private:
    PropertyNameList m_propertyOrder;
    ModelNodePositionStorage *m_positionStore;
};

} // namespace Internal
} // namespace QmlDesigner