KTutorial  0.5.1
Signals | Public Member Functions | Protected Member Functions
ktutorial::scripting::ScriptedTutorial Class Reference

Tutorial to be used in scripts. More...

#include <ScriptedTutorial.h>

Inheritance diagram for ktutorial::scripting::ScriptedTutorial:
Inheritance graph
[legend]
Collaboration diagram for ktutorial::scripting::ScriptedTutorial:
Collaboration graph
[legend]

List of all members.

Signals

void setup (QObject *scriptedTutorial)
 Emitted when this ScriptedTutorial has to be set up.
void tearDown (QObject *scriptedTutorial)
 Emitted when this ScriptedTutorial has to be cleaned.

Public Member Functions

 ScriptedTutorial (const QString &filename)
 Creates a new ScriptedTutorial for the given filename.
virtual ~ScriptedTutorial ()
 Destroys this ScriptedTutorial.
Q_INVOKABLE QObject * tutorialInformationAsObject () const
 Returns the TutorialInformation of this Tutorial.
bool isValid () const
 Whether the file used in the constructor contained a valid script or not.

Protected Member Functions

virtual void setup ()
 Emits setup(scripting::ScriptedTutorial*) signal using this ScriptedTutorial as parameter.
virtual void tearDown ()
 Emits tearDown(scripting::ScriptedTutorial*) signal using this ScriptedTutorial as parameter.

Detailed Description

Tutorial to be used in scripts.

This class acts as a bridge between scripts and tutorials. The tutorial is written in a script, which is interpreted by the ScriptedTutorial through Kross. The script is executed when the ScriptedTutorial is created.

Not every script file is valid, as the filename may be wrong, it could be written in a language not manageable by current Kross environment, or it may contain errors. In those cases, a ScriptedTutorial is useless. Method isValid() can be used to check whether the ScriptedTutorial is valid or not.

The ScriptedTutorial is exposed to the script as "tutorial" object. The ScriptingModule is exposed to the script as "ktutorial" object.

If something must be set before starting the Tutorial, implement a function in the script and connect it to setup(QObject*) signal. Note that, although the argument in the signal is declared as QObject*, it is in fact the ScriptedStep that emitted the signal. It is a Kross limitation.

You can do the same if something has to be cleaned after the Tutorial finishes using tearDown(QObject*) signal.

Definition at line 54 of file ScriptedTutorial.h.


Constructor & Destructor Documentation

ktutorial::scripting::ScriptedTutorial::ScriptedTutorial ( const QString &  filename) [explicit]

Creates a new ScriptedTutorial for the given filename.

The id of its TutorialInformation is set to the filename.

Parameters:
filenameThe name of the file containing the script.

Definition at line 30 of file ScriptedTutorial.cpp.

References ktutorial::scripting::ScriptingModule::self().


Member Function Documentation

Whether the file used in the constructor contained a valid script or not.

A file is valid if it exists, contains an script written in a language that can be managed by the current Kross environment and the script has no errors. That is, if the script could be executed.

Returns:
True if the file is valid, false otherwise.

Definition at line 52 of file ScriptedTutorial.cpp.

Referenced by ktutorial::editorsupport::EditorSupport::testScriptedTutorial().

void ktutorial::scripting::ScriptedTutorial::setup ( QObject *  scriptedTutorial) [signal]

Emitted when this ScriptedTutorial has to be set up.

Parameters:
scriptedTutorialA pointer to this ScriptedTutorial.
See also:
Tutorial::setup()
Todo:
Change argument type to scripting::ScriptedTutorial* once all major Kross scripting backends support classes wrapped through WrapperInterface
void ktutorial::scripting::ScriptedTutorial::tearDown ( QObject *  scriptedTutorial) [signal]

Emitted when this ScriptedTutorial has to be cleaned.

Parameters:
scriptedTutorialA pointer to this ScriptedTutorial.
See also:
Tutorial::tearDown()
Todo:
Change argument type to scripting::ScriptedTutorial* once all major Kross scripting backends support classes wrapped through WrapperInterface

Returns the TutorialInformation of this Tutorial.

This method can be invoked from a script.

This is a temporal method to be used instead of Tutorial::tutorialInformation().

Returns:
The TutorialInformation of this Tutorial.
Todo:
Remove this method once all major Kross scripting backends support classes wrapped through WrapperInterface

Definition at line 48 of file ScriptedTutorial.cpp.

References ktutorial::Tutorial::tutorialInformation().


The documentation for this class was generated from the following files: