KTutorial
0.5.1
|
Support module for KTutorial editor to be accessed through D-Bus. More...
#include <EditorSupport.h>
Signals | |
void | started (Tutorial *tutorial) |
This signals is emitted when the given tutorial is about to be started. | |
Public Member Functions | |
EditorSupport (QObject *parent=0) | |
Creates a new EditorSupport with the given parent. | |
void | setObjectFinder (ObjectFinder *objectFinder) |
Sets the helper used to find objects. | |
void | setup (QObject *window) |
Exposes the editor support interfaces through DBus. | |
int | mainWindowObjectId () |
Returns the object id of the application main window. | |
int | findObject (const QString &name) |
Returns the id of the object with the given name. | |
void | highlight (int objectId) |
Starts the highlighting animation for the widget associated to the given id. | |
void | stopHighlighting (int objectId) |
Stops the highlighting animation for the widget associated to the given id. | |
void | enableEventSpy () |
Enables the EventSpy. | |
void | disableEventSpy () |
Disables the EventSpy. | |
void | testScriptedTutorial (const QString &filename, const QString &stepId=QString()) |
Starts the scripted tutorial stored in the given filename. |
Support module for KTutorial editor to be accessed through D-Bus.
EditorSupport provides a way to introspect a running application from KTutorial editor to help the author to design a tutorial.
EditorSupport is composed by three elements: the main object (this class), an object register and an event spy.
The main object sets up the D-Bus objects and provides a way to enable and disable the EventSpy (as notifying all the events sent by an application through D-Bus is very costly, the EventSpy should be enabled only when needed), highlight and stop the highlighting of widgets, test a scripted tutorial (starting the tutorial stored in the given filename and, optionally, from the given step id), and find objects.
The object register assigns an id to QObjects to be identified by the remote KTutorial editor. Using that id, KTutorial editor can request further information about an object to the ObjectRegister (for example, the object name or the class name of an object). Moreover, the object register also provides information about the classes of the registered objects, like the super class or the list of signals defined in each class.
The event spy filters all the events received by the main window and, recursively, all its children objects. It is used in the remote KTutorial editor to know, for example, that some widget got the focus, or that the mouse entered in some widget.
The main object is registered at "/ktutorial" path, and provides the "org.kde.ktutorial.EditorSupport" interface. The object register is registered at "/ktutorial/ObjectRegister" path and provides the "org.kde.ktutorial.ObjectRegister" and "org.kde.ktutorial.ClassRegister" interfaces. Finally, when it is enabled, the EventSpy is registered at "/ktutorial/EVentSpy" path and provides the "org.kde.ktutorial.EventSpy" interface.
Definition at line 76 of file EditorSupport.h.
ktutorial::editorsupport::EditorSupport::EditorSupport | ( | QObject * | parent = 0 | ) | [explicit] |
Creates a new EditorSupport with the given parent.
parent | The parent QObject. |
Definition at line 49 of file EditorSupport.cpp.
int ktutorial::editorsupport::EditorSupport::findObject | ( | const QString & | name | ) |
Returns the id of the object with the given name.
The name can include ancestor names.
name | The name of the object to find. |
Definition at line 83 of file EditorSupport.cpp.
References ktutorial::ObjectFinder::findObject(), and ktutorial::editorsupport::ObjectRegister::idForObject().
Referenced by ktutorial::editorsupport::EditorSupportAdaptor::findObject().
void ktutorial::editorsupport::EditorSupport::highlight | ( | int | objectId | ) |
Starts the highlighting animation for the widget associated to the given id.
objectId | The id of the widget to highlight. |
Definition at line 90 of file EditorSupport.cpp.
References ktutorial::editorsupport::ObjectRegister::objectForId().
Referenced by ktutorial::editorsupport::EditorSupportAdaptor::highlight().
Returns the object id of the application main window.
Definition at line 79 of file EditorSupport.cpp.
References ktutorial::editorsupport::ObjectRegister::idForObject().
Referenced by ktutorial::editorsupport::EditorSupportAdaptor::mainWindowObjectId().
void ktutorial::editorsupport::EditorSupport::setObjectFinder | ( | ObjectFinder * | objectFinder | ) |
Sets the helper used to find objects.
objectFinder | The helper to set. |
Definition at line 55 of file EditorSupport.cpp.
Referenced by ktutorial::KTutorial::setup().
void ktutorial::editorsupport::EditorSupport::setup | ( | QObject * | window | ) |
Exposes the editor support interfaces through DBus.
The window and all its children will be spied when EventSpy is enabled.
window | The main window in the application. |
Definition at line 59 of file EditorSupport.cpp.
Referenced by ktutorial::KTutorial::setup().
void ktutorial::editorsupport::EditorSupport::started | ( | Tutorial * | tutorial | ) | [signal] |
This signals is emitted when the given tutorial is about to be started.
tutorial | The tutorial that is going to be started. |
Referenced by testScriptedTutorial().
void ktutorial::editorsupport::EditorSupport::stopHighlighting | ( | int | objectId | ) |
Stops the highlighting animation for the widget associated to the given id.
objectId | The id of the widget to stop highlighting. |
Definition at line 100 of file EditorSupport.cpp.
References ktutorial::editorsupport::ObjectRegister::objectForId().
Referenced by ktutorial::editorsupport::EditorSupportAdaptor::stopHighlighting().
void ktutorial::editorsupport::EditorSupport::testScriptedTutorial | ( | const QString & | filename, |
const QString & | stepId = QString() |
||
) |
Starts the scripted tutorial stored in the given filename.
If a step id is given, the tutorial is changed to that step after starting.
filename | The name of the file to read the scripted tutorial from. |
stepId | The id of the step to change to, if any. |
Definition at line 126 of file EditorSupport.cpp.
References ktutorial::scripting::ScriptedTutorial::isValid(), ktutorial::Tutorial::nextStep(), ktutorial::Tutorial::start(), and started().
Referenced by ktutorial::editorsupport::EditorSupportAdaptor::testScriptedTutorial().