|
Krita Source Code Documentation
|
#include <kxmlguifactory.h>
Inheritance diagram for KisKXMLGUIFactory:Signals | |
| void | clientAdded (KisKXMLGUIClient *client) |
| void | clientRemoved (KisKXMLGUIClient *client) |
| void | makingChanges (bool) |
Public Member Functions | |
| void | addClient (KisKXMLGUIClient *client) |
| QList< KisKXMLGUIClient * > | clients () const |
| QWidget * | container (const QString &containerName, KisKXMLGUIClient *client, bool useTagName=false) |
| QList< QWidget * > | containers (const QString &tagName) |
| KisKXMLGUIFactory (KisKXMLGUIBuilder *builder, QObject *parent=0) | |
| void | plugActionList (KisKXMLGUIClient *client, const QString &name, const QList< QAction * > &actionList) |
| void | removeClient (KisKXMLGUIClient *client) |
| void | reset () |
| void | resetContainer (const QString &containerName, bool useTagName=false) |
| void | unplugActionList (KisKXMLGUIClient *client, const QString &name) |
| ~KisKXMLGUIFactory () override | |
Static Public Member Functions | |
| static QDomElement | actionPropertiesElement (QDomDocument &doc) |
| static QDomElement | findActionByName (QDomElement &elem, const QString &sName, bool create) |
| static QString | readConfigFile (const QString &filename, const QString &componentName=QString()) |
| static bool | saveConfigFile (const QDomDocument &doc, const QString &filename, const QString &componentName=QString()) |
Private Member Functions | |
| void | forgetClient (KisKXMLGUIClient *client) |
| Internal, called by KisKXMLGUIClient destructor. | |
Private Attributes | |
| KisKXMLGUIFactoryPrivate *const | d |
Friends | |
| class | KisKXMLGUI::BuildHelper |
| class | KisKXMLGUIClient |
KisKXMLGUIFactory, together with KisKXMLGUIClient objects, can be used to create a GUI of container widgets (like menus, toolbars, etc.) and container items (menu items, toolbar buttons, etc.) from an XML document and action objects.
Each KisKXMLGUIClient represents a part of the GUI, composed from containers and actions. KisKXMLGUIFactory takes care of building (with the help of a KisKXMLGUIBuilder) and merging the GUI from an unlimited number of clients.
Each client provides XML through a QDomDocument and actions through a KisKActionCollection . The XML document contains the rules for how to merge the GUI.
KisKXMLGUIFactory processes the DOM tree provided by a client and plugs in the client's actions, according to the XML and the merging rules of previously inserted clients. Container widgets are built via a KisKXMLGUIBuilder , which has to be provided with the KisKXMLGUIFactory constructor.
Definition at line 51 of file kxmlguifactory.h.
|
explicit |
Constructs a KisKXMLGUIFactory. The provided builder KisKXMLGUIBuilder will be called for creating and removing container widgets, when clients are added/removed from the GUI.
Note that the ownership of the given KisKXMLGUIBuilder object won't be transferred to this KisKXMLGUIFactory, so you have to take care of deleting it properly.
Removes all QDomComment objects from the specified node and all its children.
Definition at line 202 of file kxmlguifactory.cpp.
References KisKXMLGUI::BuildState::builder, KisKXMLGUI::BuildState::builderContainerTags, KisKXMLGUI::BuildState::builderCustomTags, KisKXMLGUIBuilder::containerTags(), KisKXMLGUIBuilder::customTags(), d, and KisKXMLGUI::BuildState::guiClient.
|
override |
Destructor
Definition at line 213 of file kxmlguifactory.cpp.
References d, KisKXMLGUIFactoryPrivate::m_clients, and KisKXMLGUIClient::setFactory().
|
static |
Definition at line 653 of file kxmlguifactory.cpp.
References findActionPropertiesElement().
| void KisKXMLGUIFactory::addClient | ( | KisKXMLGUIClient * | client | ) |
Creates the GUI described by the QDomDocument of the client, using the client's actions, and merges it with the previously created GUI. This also means that the order in which clients are added to the factory is relevant; assuming that your application supports plugins, you should first add your application to the factory and then the plugin, so that the plugin's UI is merged into the UI of your application, and not the other way round.
Definition at line 221 of file kxmlguifactory.cpp.
References KisKXMLGUIClient::actionCollection(), KisKActionCollection::actions(), addClient(), KisKXMLGUIFactoryPrivate::attrName, KisKXMLGUIClient::beginXMLPlug(), KisKXMLGUI::BuildState::builder, KisKXMLGUIClient::childClients(), clientAdded(), KisKXMLGUIClient::clientBuilder(), KisKXMLGUI::BuildState::clientBuilder, KisKXMLGUI::BuildState::clientBuilderContainerTags, KisKXMLGUI::BuildState::clientBuilderCustomTags, KisKXMLGUI::BuildState::clientName, KisKXMLGUIBuilder::containerTags(), KisKXMLGUIBuilder::customTags(), d, debugWidgetUtils, KisKXMLGUIClient::domDocument(), KisKXMLGUIFactoryPrivate::emptyState(), KisKXMLGUIClient::endXMLPlug(), KisKXMLGUIClient::factory(), KisKXMLGUIBuilder::finalizeGUI(), KisKXMLGUI::BuildState::guiClient, KisKXMLGUI::ContainerNode::index, KisKXMLGUI::BuildHelper, KisKXMLGUIFactoryPrivate::m_clients, KisKXMLGUIFactoryPrivate::m_rootNode, makingChanges(), KisKXMLGUIFactoryPrivate::popState(), KisKXMLGUIFactoryPrivate::pushState(), KisKXMLGUIFactoryPrivate::refreshActionProperties(), removeClient(), KisKXMLGUIFactoryPrivate::saveDefaultActionProperties(), KisKXMLGUIClient::setFactory(), KisKXMLGUIBuilder::widget(), and KisKXMLGUIClient::xmlguiBuildDocument().
|
signal |
|
signal |
| QList< KisKXMLGUIClient * > KisKXMLGUIFactory::clients | ( | ) | const |
Returns a list of all clients currently added to this factory
Definition at line 445 of file kxmlguifactory.cpp.
References d, and KisKXMLGUIFactoryPrivate::m_clients.
| QWidget * KisKXMLGUIFactory::container | ( | const QString & | containerName, |
| KisKXMLGUIClient * | client, | ||
| bool | useTagName = false ) |
Use this method to get access to a container widget with the name specified with containerName and which is owned by the client. The container name is specified with a "name" attribute in the XML document.
This function is particularly useful for getting hold of a popupmenu defined in an XMLUI file. For instance:
where "my_popup" is the name of the menu in the XMLUI file, and "this" is XMLGUIClient which owns the popupmenu (e.g. the mainwindow, or the part, or the plugin...)
| containerName | Name of the container widget |
| client | Owner of the container widget |
| useTagName | Specifies whether to compare the specified name with the name attribute or the tag name. |
This method may return 0 if no container with the given name exists or is not owned by the client.
Definition at line 450 of file kxmlguifactory.cpp.
References d, KisKXMLGUIFactoryPrivate::findRecursive(), KisKXMLGUI::BuildState::guiClient, KisKXMLGUIFactoryPrivate::m_containerName, KisKXMLGUIFactoryPrivate::m_rootNode, KisKXMLGUIFactoryPrivate::popState(), and KisKXMLGUIFactoryPrivate::pushState().
| QList< QWidget * > KisKXMLGUIFactory::containers | ( | const QString & | tagName | ) |
Definition at line 467 of file kxmlguifactory.cpp.
References d, KisKXMLGUIFactoryPrivate::findRecursive(), and KisKXMLGUIFactoryPrivate::m_rootNode.
|
static |
Definition at line 666 of file kxmlguifactory.cpp.
|
private |
Internal, called by KisKXMLGUIClient destructor.
Definition at line 379 of file kxmlguifactory.cpp.
References d, and KisKXMLGUIFactoryPrivate::m_clients.
|
signal |
Emitted when the factory is currently making changes to the GUI, i.e. adding or removing clients. makingChanges(true) is emitted before any change happens, and makingChanges(false) is emitted after the change is done. This allows e.g. KisKMainWindow to know that the GUI is being changed programmatically and not by the user (so there is no reason to save toolbar settings afterwards).
| void KisKXMLGUIFactory::plugActionList | ( | KisKXMLGUIClient * | client, |
| const QString & | name, | ||
| const QList< QAction * > & | actionList ) |
Definition at line 545 of file kxmlguifactory.cpp.
References KisKXMLGUI::BuildState::actionList, KisKXMLGUI::BuildState::actionListName, KisKXMLGUIFactoryPrivate::attrName, KisKXMLGUI::BuildState::clientName, d, KisKXMLGUIClient::domDocument(), KisKXMLGUI::BuildState::guiClient, KisKXMLGUIFactoryPrivate::m_rootNode, KisKXMLGUI::ContainerNode::plugActionList(), KisKXMLGUIFactoryPrivate::popState(), KisKXMLGUIFactoryPrivate::pushState(), KisKXMLGUIFactoryPrivate::refreshActionProperties(), and KisKXMLGUIFactoryPrivate::saveDefaultActionProperties().
|
static |
Definition at line 109 of file kxmlguifactory.cpp.
| void KisKXMLGUIFactory::removeClient | ( | KisKXMLGUIClient * | client | ) |
Removes the GUI described by the client, by unplugging all provided actions and removing all owned containers (and storing container state information in the given client)
Definition at line 384 of file kxmlguifactory.cpp.
References KisKXMLGUIFactoryPrivate::attrName, KisKXMLGUI::BuildState::builder, KisKXMLGUIClient::childClients(), KisKXMLGUIClient::clientBuilder(), KisKXMLGUI::BuildState::clientBuilder, KisKXMLGUI::BuildState::clientName, clientRemoved(), d, KisKXMLGUI::ContainerNode::destruct(), KisKXMLGUIClient::domDocument(), KisKXMLGUIFactoryPrivate::emptyState(), KisKXMLGUIClient::factory(), KisKXMLGUI::BuildState::guiClient, KisKXMLGUIFactoryPrivate::m_clients, KisKXMLGUIFactoryPrivate::m_rootNode, makingChanges(), KisKXMLGUIFactoryPrivate::popState(), KisKXMLGUIClient::prepareXMLUnplug(), KisKXMLGUIFactoryPrivate::pushState(), removeClient(), KisKXMLGUIClient::setFactory(), KisKXMLGUIClient::setXMLGUIBuildDocument(), KisKXMLGUIBuilder::widget(), and KisKXMLGUIClient::xmlguiBuildDocument().
| void KisKXMLGUIFactory::reset | ( | ) |
Use this method to free all memory allocated by the KisKXMLGUIFactory. This deletes the internal node tree and therefore resets the internal state of the class. Please note that the actual GUI is NOT touched at all, meaning no containers are deleted nor any actions unplugged. That is something you have to do on your own. So use this method only if you know what you are doing :-)
(also note that this will call KisKXMLGUIClient::setFactory( 0 ) for all inserted clients)
Definition at line 472 of file kxmlguifactory.cpp.
References KisKXMLGUI::ContainerNode::clearChildren(), d, KisKXMLGUIFactoryPrivate::m_rootNode, and KisKXMLGUI::ContainerNode::reset().
| void KisKXMLGUIFactory::resetContainer | ( | const QString & | containerName, |
| bool | useTagName = false ) |
Use this method to free all memory allocated by the KisKXMLGUIFactory for a specific container, including all child containers and actions. This deletes the internal node subtree for the specified container. The actual GUI is not touched, no containers are deleted or any actions unplugged. Use this method only if you know what you are doing :-)
(also note that this will call KisKXMLGUIClient::setFactory( 0 ) for all clients of the container)
Definition at line 479 of file kxmlguifactory.cpp.
References container(), d, KisKXMLGUI::ContainerNode::findContainer(), and KisKXMLGUIFactoryPrivate::m_rootNode.
|
static |
Definition at line 154 of file kxmlguifactory.cpp.
References KisPortingUtils::setUtf8OnStream().
| void KisKXMLGUIFactory::unplugActionList | ( | KisKXMLGUIClient * | client, |
| const QString & | name ) |
Definition at line 564 of file kxmlguifactory.cpp.
References KisKXMLGUI::BuildState::actionListName, KisKXMLGUIFactoryPrivate::attrName, KisKXMLGUI::BuildState::clientName, d, KisKXMLGUIClient::domDocument(), KisKXMLGUI::BuildState::guiClient, KisKXMLGUIFactoryPrivate::m_rootNode, KisKXMLGUIFactoryPrivate::popState(), KisKXMLGUIFactoryPrivate::pushState(), and KisKXMLGUI::ContainerNode::unplugActionList().
|
friend |
Definition at line 53 of file kxmlguifactory.h.
|
friend |
Definition at line 180 of file kxmlguifactory.h.
|
private |
Definition at line 184 of file kxmlguifactory.h.