Krita Source Code Documentation
Loading...
Searching...
No Matches
kxmlguifactory_p.cpp
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 2001 Simon Hausmann <hausmann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "kxmlguifactory_p.h"
8
9#include "kxmlguiclient.h"
10#include "kxmlguibuilder.h"
11#include "ktoolbar.h"
12
13#include <QWidget>
14#include <QDebug>
15
16#include <assert.h>
17
18using namespace KisKXMLGUI;
19
20void ActionList::plug(QWidget *container, int index) const
21{
22 QAction *before = 0L; // Insert after end of widget's current actions (default).
23
24 if ((index < 0) || (index > container->actions().count())) {
25 qWarning() << "Index " << index << " is not within range (0 - " << container->actions().count();
26 } else if (index != container->actions().count()) {
27 before = container->actions().at(index); // Insert before indexed action.
28 }
29
30 Q_FOREACH (QAction *action, *this) {
31 container->insertAction(before, action);
32 // before = action; // BUG FIX: do not insert actions in reverse order.
33 }
34}
35
36void ActionList::unplug(QWidget *container) const
37{
38 Q_FOREACH (QAction *action, *this) {
39 if (container->actions().contains(action)) {
40 container->removeAction(action);
41 }
42 }
43}
44
45ContainerNode::ContainerNode(QWidget *_container, const QString &_tagName,
46 const QString &_name, ContainerNode *_parent,
47 KisKXMLGUIClient *_client, KisKXMLGUIBuilder *_builder,
48 QAction *_containerAction, const QString &_mergingName,
49 const QString &_groupName, const QStringList &customTags,
50 const QStringList &containerTags)
51 : parent(_parent), client(_client), builder(_builder),
52 builderCustomTags(customTags), builderContainerTags(containerTags),
53 container(_container), containerAction(_containerAction), tagName(_tagName), name(_name),
54 groupName(_groupName), index(0), mergingName(_mergingName)
55{
56 if (parent) {
57 parent->children.append(this);
58 }
59}
60
62{
63 qDeleteAll(children);
64 qDeleteAll(clients);
65}
66
68{
69 MergingIndexList::Iterator mergingIt = findIndex(child->mergingName);
70 adjustMergingIndices(-1, mergingIt);
71 children.removeAll(child);
72 delete child;
73}
74
75void ContainerNode::removeChild(QMutableListIterator<ContainerNode *> &childIterator)
76{
77 MergingIndexList::Iterator mergingIt = findIndex(childIterator.peekNext()->mergingName);
78 adjustMergingIndices(-1, mergingIt);
79 delete childIterator.next();
80 childIterator.remove();
81}
82
83/*
84 * Find a merging index with the given name. Used to find an index defined by <Merge name="blah"/>
85 * or by a <DefineGroup name="foo" /> tag.
86 */
87MergingIndexList::Iterator ContainerNode::findIndex(const QString &name)
88{
89 MergingIndexList::Iterator it(mergingIndices.begin());
90 MergingIndexList::Iterator end(mergingIndices.end());
91 for (; it != end; ++it)
92 if ((*it).mergingName == name) {
93 return it;
94 }
95 return it;
96}
97
98/*
99 * Check if the given container widget is a child of this node and return the node structure
100 * if found.
101 */
103{
104 Q_FOREACH (ContainerNode *child, children)
105 if (child->container == container) {
106 return child;
107 }
108
109 return 0L;
110}
111
112/*
113 * Find a container recursively with the given name. Either compares _name with the
114 * container's tag name or the value of the container's name attribute. Specified by
115 * the tag bool .
116 */
117ContainerNode *ContainerNode::findContainer(const QString &_name, bool tag)
118{
119 if ((tag && tagName == _name) ||
120 (!tag && name == _name)) {
121 return this;
122 }
123
124 Q_FOREACH (ContainerNode *child, children) {
125 ContainerNode *res = child->findContainer(_name, tag);
126 if (res) {
127 return res;
128 }
129 }
130
131 return 0;
132}
133
134/*
135 * Finds a child container node (not recursively) with the given name and tagname. Explicitly
136 * leaves out container widgets specified in the excludeList . Also ensures that the containers
137 * belongs to currClient.
138 */
139ContainerNode *ContainerNode::findContainer(const QString &name, const QString &tagName,
140 const QList<QWidget *> *excludeList,
141 KisKXMLGUIClient * /*currClient*/)
142{
143 ContainerNode *res = 0L;
144 ContainerNodeList::ConstIterator nIt = children.constBegin();
145
146 if (!name.isEmpty()) {
147 for (; nIt != children.constEnd(); ++nIt)
148 if ((*nIt)->name == name &&
149 !excludeList->contains((*nIt)->container)) {
150 res = *nIt;
151 break;
152 }
153
154 return res;
155 }
156
157 if (!tagName.isEmpty())
158 for (; nIt != children.constEnd(); ++nIt) {
159 if ((*nIt)->tagName == tagName &&
160 !excludeList->contains((*nIt)->container)
161 /*
162 * It is a bad idea to also compare the client, because
163 * we don't want to do so in situations like these:
164 *
165 * <MenuBar>
166 * <Menu>
167 * ...
168 *
169 * other client:
170 * <MenuBar>
171 * <Menu>
172 * ...
173 *
174 && (*nIt)->client == currClient )
175 */
176 ) {
177 res = *nIt;
178 break;
179 }
180 }
181
182 return res;
183}
184
186 const QString &groupName,
187 const MergingIndexList::Iterator &mergingIdx)
188{
189 if (!clients.isEmpty()) {
190 Q_FOREACH (ContainerClient *client, clients)
191 if (client->client == currentGUIClient) {
192 if (groupName.isEmpty()) {
193 return client;
194 }
195
196 if (groupName == client->groupName) {
197 return client;
198 }
199 }
200 }
201
203 client->client = currentGUIClient;
204 client->groupName = groupName;
205
206 if (mergingIdx != mergingIndices.end()) {
207 client->mergingName = (*mergingIdx).mergingName;
208 }
209
210 clients.append(client);
211
212 return client;
213}
214
216{
217 MergingIndexList::Iterator mIt(mergingIndices.begin());
218 MergingIndexList::Iterator mEnd(mergingIndices.end());
219 for (; mIt != mEnd; ++mIt) {
220 plugActionList(state, mIt);
221 }
222
223 Q_FOREACH (ContainerNode *child, children) {
224 child->plugActionList(state);
225 }
226}
227
228void ContainerNode::plugActionList(BuildState &state, const MergingIndexList::Iterator &mergingIdxIt)
229{
230 static const QString &tagActionList = QString::fromLatin1("actionlist");
231
232 MergingIndex mergingIdx = *mergingIdxIt;
233
234 QString k(mergingIdx.mergingName);
235
236 if (k.indexOf(tagActionList) == -1) {
237 return;
238 }
239
240 k = k.mid(tagActionList.length());
241
242 if (mergingIdx.clientName != state.clientName) {
243 return;
244 }
245
246 if (k != state.actionListName) {
247 return;
248 }
249
251 QString(),
252 mergingIndices.end());
253
254 client->actionLists.insert(k, state.actionList);
255
256 state.actionList.plug(container, mergingIdx.value);
257
258 adjustMergingIndices(state.actionList.count(), mergingIdxIt);
259}
260
262{
263 MergingIndexList::Iterator mIt(mergingIndices.begin());
264 MergingIndexList::Iterator mEnd(mergingIndices.end());
265 for (; mIt != mEnd; ++mIt) {
266 unplugActionList(state, mIt);
267 }
268
269 Q_FOREACH (ContainerNode *child, children) {
270 child->unplugActionList(state);
271 }
272}
273
274void ContainerNode::unplugActionList(BuildState &state, const MergingIndexList::Iterator &mergingIdxIt)
275{
276 static const QString &tagActionList = QString::fromLatin1("actionlist");
277
278 MergingIndex mergingIdx = *mergingIdxIt;
279
280 QString k = mergingIdx.mergingName;
281
282 if (k.indexOf(tagActionList) == -1) {
283 return;
284 }
285
286 k = k.mid(tagActionList.length());
287
288 if (mergingIdx.clientName != state.clientName) {
289 return;
290 }
291
292 if (k != state.actionListName) {
293 return;
294 }
295
297 QString(),
298 mergingIndices.end());
299
300 ActionListMap::Iterator lIt(client->actionLists.find(k));
301 if (lIt == client->actionLists.end()) {
302 return;
303 }
304
305 lIt.value().unplug(container);
306
307 adjustMergingIndices(-int(lIt.value().count()), mergingIdxIt);
308
309 client->actionLists.erase(lIt);
310}
311
313 const MergingIndexList::Iterator &it)
314{
315 MergingIndexList::Iterator mergingIt = it;
316 MergingIndexList::Iterator mergingEnd = mergingIndices.end();
317
318 for (; mergingIt != mergingEnd; ++mergingIt) {
319 (*mergingIt).value += offset;
320 }
321
322 index += offset;
323}
324
325bool ContainerNode::destruct(QDomElement element, BuildState &state) //krazy:exclude=passbyvalue (this is correct QDom usage, and a ref wouldn't allow passing doc.documentElement() as argument)
326{
327 destructChildren(element, state);
328
329 unplugActions(state);
330
331 // remove all merging indices the client defined
332 QMutableListIterator<MergingIndex> cmIt = mergingIndices;
333 while (cmIt.hasNext())
334 if (cmIt.next().clientName == state.clientName) {
335 cmIt.remove();
336 }
337
338 // ### check for merging index count, too?
339 if (clients.count() == 0 && children.count() == 0 && container &&
340 client == state.guiClient) {
341 QWidget *parentContainer = 0L;
342
343 if (parent && parent->container) {
344 parentContainer = parent->container;
345 }
346
347 assert(builder);
348
349 builder->removeContainer(container, parentContainer, element, containerAction);
350
351 client = 0L;
352
353 return true;
354 }
355
356 if (client == state.guiClient) {
357 client = 0L;
358 }
359
360 return false;
361
362}
363
364void ContainerNode::destructChildren(const QDomElement &element, BuildState &state)
365{
366 QMutableListIterator<ContainerNode *> childIt = children;
367 while (childIt.hasNext()) {
368 ContainerNode *childNode = childIt.peekNext();
369
370 QDomElement childElement = findElementForChild(element, childNode);
371
372 // destruct returns true in case the container really got deleted
373 if (childNode->destruct(childElement, state)) {
374 removeChild(childIt);
375 } else {
376 childIt.next();
377 }
378 }
379}
380
381QDomElement ContainerNode::findElementForChild(const QDomElement &baseElement,
382 ContainerNode *childNode)
383{
384 // ### slow
385 for (QDomNode n = baseElement.firstChild(); !n.isNull();
386 n = n.nextSibling()) {
387 QDomElement e = n.toElement();
388 if (e.tagName().toLower() == childNode->tagName &&
389 e.attribute(QStringLiteral("name")) == childNode->name) {
390 return e;
391 }
392 }
393
394 return QDomElement();
395}
396
398{
399 if (!container) {
400 return;
401 }
402
403 QMutableListIterator<ContainerClient *> clientIt(clients);
404
405 /*
406 Disabled because it means in KisToolBar::saveState isHidden is always true then,
407 which is clearly wrong.
408
409 if ( clients.count() == 1 && clientIt.current()->client == client &&
410 client == state.guiClient )
411 container->hide(); // this container is going to die, that's for sure.
412 // in this case let's just hide it, which makes the
413 // destruction faster
414 */
415
416 while (clientIt.hasNext())
417 //only unplug the actions of the client we want to remove, as the container might be owned
418 //by a different client
419 if (clientIt.peekNext()->client == state.guiClient) {
420 unplugClient(clientIt.peekNext());
421 delete clientIt.next();
422 clientIt.remove();
423 } else {
424 clientIt.next();
425 }
426}
427
429{
430 assert(builder);
431
432 // now quickly remove all custom elements (i.e. separators) and unplug all actions
433
434 QList<QAction *>::ConstIterator custIt = client->customElements.constBegin();
435 QList<QAction *>::ConstIterator custEnd = client->customElements.constEnd();
436 for (; custIt != custEnd; ++custIt) {
438 }
439
440 KisToolBar *bar = qobject_cast<KisToolBar *>(container);
441 if (bar) {
442 bar->removeXMLGUIClient(client->client);
443 }
444
445 client->actions.unplug(container);
446
447 // now adjust all merging indices
448
449 MergingIndexList::Iterator mergingIt = findIndex(client->mergingName);
450
451 adjustMergingIndices(- int(client->actions.count()
452 + client->customElements.count()),
453 mergingIt);
454
455 // unplug all actionlists
456
457 ActionListMap::ConstIterator alIt = client->actionLists.constBegin();
458 ActionListMap::ConstIterator alEnd = client->actionLists.constEnd();
459 for (; alIt != alEnd; ++alIt) {
460 alIt.value().unplug(container);
461
462 // construct the merging index key (i.e. like named merging) , find the
463 // corresponding merging index and adjust all indices
464 QString mergingKey = alIt.key();
465 mergingKey.prepend(QStringLiteral("actionlist"));
466
467 MergingIndexList::Iterator mIt = findIndex(mergingKey);
468 if (mIt == mergingIndices.end()) {
469 continue;
470 }
471
472 adjustMergingIndices(-int(alIt.value().count()), mIt);
473
474 // remove the actionlists' merging index
475 // ### still needed? we clean up below anyway?
476 mergingIndices.erase(mIt);
477 }
478}
479
481{
482 Q_FOREACH (ContainerNode *child, children) {
483 child->reset();
484 }
485
486 if (client) {
487 client->setFactory(0L);
488 }
489}
490
491int ContainerNode::calcMergingIndex(const QString &mergingName,
492 MergingIndexList::Iterator &it,
493 BuildState &state,
494 bool ignoreDefaultMergingIndex)
495{
496 MergingIndexList::Iterator mergingIt;
497
498 if (mergingName.isEmpty()) {
499 mergingIt = findIndex(state.clientName);
500 } else {
501 mergingIt = findIndex(mergingName);
502 }
503
504 MergingIndexList::Iterator mergingEnd = mergingIndices.end();
505 it = mergingEnd;
506
507 if ((mergingIt == mergingEnd && state.currentDefaultMergingIt == mergingEnd) ||
508 ignoreDefaultMergingIndex) {
509 return index;
510 }
511
512 if (mergingIt != mergingEnd) {
513 it = mergingIt;
514 } else {
515 it = state.currentDefaultMergingIt;
516 }
517
518 return (*it).value;
519}
520
521int BuildHelper::calcMergingIndex(const QDomElement &element, MergingIndexList::Iterator &it, QString &group)
522{
523 const QLatin1String attrGroup("group");
524
525 bool haveGroup = false;
526 group = element.attribute(attrGroup);
527 if (!group.isEmpty()) {
528 group.prepend(attrGroup);
529 haveGroup = true;
530 }
531
532 int idx;
533 if (haveGroup) {
536 idx = parentNode->index;
537 } else {
539 }
540
541 return idx;
542}
543
545 : containerClient(0), ignoreDefaultMergingIndex(false), m_state(state),
546 parentNode(node)
547{
548 // create a list of supported container and custom tags
551
555 }
556
560 }
561
562 m_state.currentDefaultMergingIt = parentNode->findIndex(QStringLiteral("<default>"));
564 m_state, /*ignoreDefaultMergingIndex*/ false);
565}
566
567void BuildHelper::build(const QDomElement &element)
568{
569 for (QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling()) {
570 QDomElement e = n.toElement();
571 if (e.isNull()) {
572 continue;
573 }
575 }
576}
577
578void BuildHelper::processElement(const QDomElement &e)
579{
580 QString tag(e.tagName().toLower());
581 QString currName(e.attribute(QStringLiteral("name")));
582
583 bool isActionTag = (tag == QStringLiteral("action"));
584
585 if (isActionTag || customTags.indexOf(tag) != -1) {
586 processActionOrCustomElement(e, isActionTag);
587 } else if (containerTags.indexOf(tag) != -1) {
588 processContainerElement(e, tag, currName);
589 } else if (tag == QStringLiteral("merge") || tag == QLatin1String("definegroup")
590 || tag == QStringLiteral("actionlist")) {
591 processMergeElement(tag, currName, e);
592 } else if (tag == QStringLiteral("state")) {
594 }
595}
596
597void BuildHelper::processActionOrCustomElement(const QDomElement &e, bool isActionTag)
598{
599 if (!parentNode->container) {
600 return;
601 }
602
603 MergingIndexList::Iterator it(m_state.currentClientMergingIt);
604
605 QString group;
606 int idx = calcMergingIndex(e, it, group);
607
609
610 bool guiElementCreated = false;
611 if (isActionTag) {
612 guiElementCreated = processActionElement(e, idx);
613 } else {
614 guiElementCreated = processCustomElement(e, idx);
615 }
616
617 if (guiElementCreated)
618 // adjust any following merging indices and the current running index for the container
619 {
621 }
622}
623
624bool BuildHelper::processActionElement(const QDomElement &e, int idx)
625{
626 assert(m_state.guiClient);
627
628 // look up the action and plug it in
629 QAction *action = m_state.guiClient->action(e);
630
631 //qDebug(260) << "BuildHelper::processActionElement " << e.attribute( "name" ) << " -> " << action << " (in " << m_state.guiClient->actionCollection() << ")";
632 if (!action) {
633 return false;
634 }
635
636 QAction *before = 0L;
637 if (idx >= 0 && idx < parentNode->container->actions().count()) {
638 before = parentNode->container->actions()[idx];
639 }
640
641 parentNode->container->insertAction(before, action);
642
643 // save a reference to the plugged action, in order to properly unplug it afterwards.
644 containerClient->actions.append(action);
645
646 return true;
647}
648
649bool BuildHelper::processCustomElement(const QDomElement &e, int idx)
650{
651 assert(parentNode->builder);
652
653 QAction *action = parentNode->builder->createCustomElement(parentNode->container, idx, e);
654 if (!action) {
655 return false;
656 }
657
658 containerClient->customElements.append(action);
659 return true;
660}
661
662void BuildHelper::processStateElement(const QDomElement &element)
663{
664 QString stateName = element.attribute(QStringLiteral("name"));
665
666 if (stateName.isNull() || !stateName.length()) {
667 return;
668 }
669
670 for (QDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling()) {
671 QDomElement e = n.toElement();
672 if (e.isNull()) {
673 continue;
674 }
675
676 QString tagName = e.tagName().toLower();
677
678 if (tagName != QStringLiteral("enable") && tagName != QLatin1String("disable")) {
679 continue;
680 }
681
682 bool processingActionsToEnable = (tagName == QStringLiteral("enable"));
683
684 // process action names
685 for (QDomNode n2 = n.firstChild(); !n2.isNull(); n2 = n2.nextSibling()) {
686 QDomElement actionEl = n2.toElement();
687 if (actionEl.tagName().toLower() != QStringLiteral("action")) {
688 continue;
689 }
690
691 QString actionName = actionEl.attribute(QStringLiteral("name"));
692 if (actionName.isEmpty()) {
693 return;
694 }
695
696 if (processingActionsToEnable) {
697 m_state.guiClient->addStateActionEnabled(stateName, actionName);
698 } else {
699 m_state.guiClient->addStateActionDisabled(stateName, actionName);
700 }
701
702 }
703 }
704}
705
706void BuildHelper::processMergeElement(const QString &tag, const QString &name, const QDomElement &e)
707{
708 const QLatin1String tagDefineGroup("definegroup");
709 const QLatin1String tagActionList("actionlist");
710 const QLatin1String defaultMergingName("<default>");
711 const QLatin1String attrGroup("group");
712
713 QString mergingName(name);
714 if (mergingName.isEmpty()) {
715 if (tag == tagDefineGroup) {
716 qCritical() << "cannot define group without name!" << Qt::endl;
717 return;
718 }
719 if (tag == tagActionList) {
720 qCritical() << "cannot define actionlist without name!" << Qt::endl;
721 return;
722 }
723 mergingName = defaultMergingName;
724 }
725
726 if (tag == tagDefineGroup) {
727 mergingName.prepend(attrGroup); //avoid possible name clashes by prepending
728 }
729 // "group" to group definitions
730 else if (tag == tagActionList) {
731 mergingName.prepend(tagActionList);
732 }
733
734 if (parentNode->findIndex(mergingName) != parentNode->mergingIndices.end()) {
735 return; //do not allow the redefinition of merging indices!
736 }
737
738 MergingIndexList::Iterator mIt(parentNode->mergingIndices.end());
739
740 QString group(e.attribute(attrGroup));
741 if (!group.isEmpty()) {
742 group.prepend(attrGroup);
743 }
744
745 // calculate the index of the new merging index. Usually this does not need any calculation,
746 // we just want the last available index (i.e. append) . But in case the <Merge> tag appears
747 // "inside" another <Merge> tag from a previously build client, then we have to use the
748 // "parent's" index. That's why we call calcMergingIndex here.
749 MergingIndex newIdx;
751 newIdx.mergingName = mergingName;
753
754 // if that merging index is "inside" another one, then append it right after the "parent" .
755 if (mIt != parentNode->mergingIndices.end()) {
756 parentNode->mergingIndices.insert(++mIt, newIdx);
757 } else {
758 parentNode->mergingIndices.append(newIdx);
759 }
760
761 if (mergingName == defaultMergingName)
762
763 {
765 }
766
767 // re-calculate the running default and client merging indices.
771}
772
773void BuildHelper::processContainerElement(const QDomElement &e, const QString &tag,
774 const QString &name)
775{
776 ContainerNode *containerNode = parentNode->findContainer(name, tag,
779
780 if (!containerNode) {
781 MergingIndexList::Iterator it(m_state.currentClientMergingIt);
782 QString group;
783
784 int idx = calcMergingIndex(e, it, group);
785
786 QAction *containerAction;
787
788 KisKXMLGUIBuilder *builder;
789
790 QWidget *container = createContainer(parentNode->container, idx, e, containerAction, &builder);
791
792 // no container? (probably some <text> tag or so ;-)
793 if (!container) {
794 return;
795 }
796
798
799 assert(!parentNode->findContainerNode(container));
800
801 containerList.append(container);
802
803 QString mergingName;
804 if (it != parentNode->mergingIndices.end()) {
805 mergingName = (*it).mergingName;
806 }
807
810 if (builder != m_state.builder) {
813 }
814
815 containerNode = new ContainerNode(container, tag, name, parentNode,
816 m_state.guiClient, builder, containerAction,
817 mergingName, group, cusTags, conTags);
818 } else {
819 if (tag == QStringLiteral("toolbar")) {
820 KisToolBar *bar = qobject_cast<KisToolBar *>(containerNode->container);
821 if (bar) {
822 if (m_state.guiClient && !m_state.guiClient->xmlFile().isEmpty()) {
824 }
825 } else {
826 qWarning() << "toolbar container is not a KisToolBar";
827 }
828 }
829 }
830
831 BuildHelper(m_state, containerNode).build(e);
832
833 // and re-calculate running values, for better performance
834 m_state.currentDefaultMergingIt = parentNode->findIndex(QStringLiteral("<default>"));
837}
838
839QWidget *BuildHelper::createContainer(QWidget *parent, int index,
840 const QDomElement &element, QAction *&containerAction,
841 KisKXMLGUIBuilder **builder)
842{
843 QWidget *res = 0L;
844
846 res = m_state.clientBuilder->createContainer(parent, index, element, containerAction);
847
848 if (res) {
849 *builder = m_state.clientBuilder;
850 return res;
851 }
852 }
853
855
857
858 res = m_state.builder->createContainer(parent, index, element, containerAction);
859
860 m_state.builder->setBuilderClient(oldClient);
861
862 if (res) {
863 *builder = m_state.builder;
864 }
865
866 return res;
867}
868
870{
871 clientName.clear();
872 actionListName.clear();
873 actionList.clear();
874 guiClient = 0;
875 clientBuilder = 0;
876
877 currentDefaultMergingIt = currentClientMergingIt = MergingIndexList::Iterator();
878}
879
float value(const T *src, size_t ch)
virtual QAction * createCustomElement(QWidget *parent, int index, const QDomElement &element)
virtual QWidget * createContainer(QWidget *parent, int index, const QDomElement &element, QAction *&containerAction)
virtual void removeCustomElement(QWidget *parent, QAction *action)
virtual void removeContainer(QWidget *container, QWidget *parent, QDomElement &element, QAction *containerAction)
void setBuilderClient(KisKXMLGUIClient *client)
KisKXMLGUIClient * builderClient() const
void setFactory(KisKXMLGUIFactory *factory)
virtual QString xmlFile() const
QAction * action(const char *name) const
void addStateActionEnabled(const QString &state, const QString &action)
void addStateActionDisabled(const QString &state, const QString &action)
void unplug(QWidget *container) const
void plug(QWidget *container, int index) const
void processActionOrCustomElement(const QDomElement &e, bool isActionTag)
void processStateElement(const QDomElement &element)
bool processActionElement(const QDomElement &e, int idx)
BuildHelper(BuildState &state, ContainerNode *node)
QWidget * createContainer(QWidget *parent, int index, const QDomElement &element, QAction *&containerAction, KisKXMLGUIBuilder **builder)
bool processCustomElement(const QDomElement &e, int idx)
void processElement(const QDomElement &element)
void build(const QDomElement &element)
QList< QWidget * > containerList
void processMergeElement(const QString &tag, const QString &name, const QDomElement &e)
int calcMergingIndex(const QDomElement &element, MergingIndexList::Iterator &it, QString &group)
ContainerClient * containerClient
void processContainerElement(const QDomElement &e, const QString &tag, const QString &name)
Floatable toolbar with auto resize.
Definition ktoolbar.h:47
void removeXMLGUIClient(KisKXMLGUIClient *client)
Definition ktoolbar.cpp:850
void addXMLGUIClient(KisKXMLGUIClient *client)
Definition ktoolbar.cpp:845
MergingIndexList::Iterator currentDefaultMergingIt
QStringList clientBuilderContainerTags
QStringList clientBuilderCustomTags
KisKXMLGUIBuilder * builder
KisKXMLGUIClient * guiClient
KisKXMLGUIBuilder * clientBuilder
MergingIndexList::Iterator currentClientMergingIt
QList< QAction * > customElements
ContainerNode * findContainerNode(QWidget *container)
void unplugActionList(BuildState &state)
MergingIndexList::Iterator findIndex(const QString &name)
MergingIndexList mergingIndices
void removeChild(ContainerNode *child)
static QDomElement findElementForChild(const QDomElement &baseElement, ContainerNode *childNode)
ContainerClient * findChildContainerClient(KisKXMLGUIClient *currentGUIClient, const QString &groupName, const MergingIndexList::Iterator &mergingIdx)
void unplugActions(BuildState &state)
void plugActionList(BuildState &state)
int calcMergingIndex(const QString &mergingName, MergingIndexList::Iterator &it, BuildState &state, bool ignoreDefaultMergingIndex)
ContainerClientList clients
ContainerNode * findContainer(const QString &_name, bool tag)
QList< ContainerNode * > children
void destructChildren(const QDomElement &element, BuildState &state)
void adjustMergingIndices(int offset, const MergingIndexList::Iterator &it)
bool destruct(QDomElement element, BuildState &state)
void unplugClient(ContainerClient *client)
KisKXMLGUIBuilder * builder
ContainerNode(QWidget *_container, const QString &_tagName, const QString &_name, ContainerNode *_parent=0L, KisKXMLGUIClient *_client=0L, KisKXMLGUIBuilder *_builder=0L, QAction *containerAction=0, const QString &_mergingName=QString(), const QString &groupName=QString(), const QStringList &customTags=QStringList(), const QStringList &containerTags=QStringList())