Krita Source Code Documentation
Loading...
Searching...
No Matches
KisTranslateLayerNamesVisitor.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
9#include "kis_node.h"
10#include "kis_paint_layer.h"
11#include "kis_group_layer.h"
14#include "kis_clone_layer.h"
15#include "kis_filter_mask.h"
16#include "kis_transform_mask.h"
18#include "kis_selection_mask.h"
21
22#include <klocalizedstring.h>
23
25 : m_dictionary(dictionary)
26{
27 QMap<QString, QString> d = defaultDictionary();
28 QMap<QString, QString>::const_iterator i = d.constBegin();
29 while (i != d.constEnd()) {
30 if (!dictionary.contains(i.key())) {
31 dictionary[i.key()] = i.value();
32 }
33 ++i;
34 }
35 m_dictionary = dictionary;
36}
37
39{
40 if (m_dictionary.contains(node->name())) {
41 node->setName(m_dictionary[node->name()]);
42 }
43 node->setName(node->name().replace("Layer", i18n("Layer")));
44 node->setName(node->name().replace("layer", i18n("layer")));
45 return true;
46}
47
49 return translate(node);
50}
51
53{
54 QMap<QString, QString> dictionary;
55
56 dictionary["Background"] = i18nc("Layer name for translation of template", "Background");
57 dictionary["Group"] = i18nc("Layer name for translation of template", "Group");
58 dictionary["Margins"] = i18nc("Layer name for translation of template", "Margins");
59 dictionary["Bleed"] = i18nc("Layer name for translation of template", "Bleed");
60 dictionary["Lines"] = i18nc("Layer name for translation of template", "Lines");
61 dictionary["Colors"] = i18nc("Layer name for translation of template", "Colors");
62 dictionary["Sketch"] = i18nc("Layer name for translation of template", "Sketch");
63 dictionary["Shade"] = i18nc("Layer name for translation of template", "Shade");
64 dictionary["Filter"] = i18nc("Layer name for translation of template", "Filter");
65 dictionary["Mask"] = i18nc("Layer name for translation of template", "Mask");
66 dictionary["Layer"] = i18nc("Layer name for translation of template", "Layer");
67 dictionary["Indirect light"] = i18nc("Layer name for translation of template", "Indirect light");
68 dictionary["Highlight"] = i18nc("Layer name for translation of template", "Highlight");
69 dictionary["Flat"] = i18nc("Layer name for translation of template", "Flat");
70 dictionary["Panel"] = i18nc("Layer name for translation of template", "Panel");
71 dictionary["Text"] = i18nc("Layer name for translation of template", "Text");
72 dictionary["Effect"] = i18nc("Layer name for translation of template", "Effect");
73 dictionary["Tones"] = i18nc("Layer name for translation of template", "Tones");
74 dictionary["Textures"] = i18nc("Layer name for translation of template", "Textures");
75 dictionary["Guides"] = i18nc("Layer name for translation of template", "Guides");
76 dictionary["Balloons"] = i18nc("Layer name for translation of template", "Balloons");
77 dictionary["Clone"] = i18nc("Layer name for translation of template", "Clone");
78 dictionary["In Betweening"] = i18nc("Layer name for translation of template", "In Betweening");
79 dictionary["Layout"] = i18nc("Layer name for translation of template", "Layout");
80
81 return dictionary;
82}
83
87
91
92
96
97
101
102
104 return translate(layer);
105}
106
107
111
115
119
120
124
128
132
KisTranslateLayerNamesVisitor(QMap< QString, QString > dictionary)
void setName(const QString &name)
QString name() const