Stellarium 0.13.3
List of all members | Public Slots | Signals | Public Member Functions
StelScriptMgr Class Reference

Manage scripting in Stellarium. More...

#include <StelScriptMgr.hpp>

Public Slots

const QString getName (const QString &s)
 Gets a single line name of the script. More...
 
const QString getAuthor (const QString &s)
 Gets the name of the script Author. More...
 
const QString getLicense (const QString &s)
 Gets the licensing terms for the script. More...
 
const QString getDescription (const QString &s)
 Gets a description of the script. More...
 
const QString getShortcut (const QString &s)
 Gets the default shortcut of the script. More...
 
bool runPreprocessedScript (const QString &preprocessedScript)
 Run the prprocessed script. More...
 
bool runScript (const QString &fileName, const QString &includePath="")
 Run the script located at the given location. More...
 
void stopScript ()
 Stops any running script. More...
 
void setScriptRate (float r)
 Changes the rate at which the script executes as a multiple of real time. More...
 
double getScriptRate ()
 Get the rate at which the script is running as a multiple of the normal execution rate. More...
 
void debug (const QString &msg)
 cause the emission of the scriptDebug signal. More...
 
void output (const QString &msg)
 cause the emission of the scriptOutput signal. More...
 
void pauseScript ()
 Pause a running script. More...
 
void resumeScript ()
 Resume a paused script. More...
 

Signals

void scriptRunning ()
 Notification when a script starts running. More...
 
void scriptStopped ()
 Notification when a script has stopped running. More...
 
void scriptDebug (const QString &)
 Notification of a script event - warnings, current execution line etc. More...
 
void scriptOutput (const QString &)
 Notification of a script event - output line. More...
 

Public Member Functions

 StelScriptMgr (QObject *parent=0)
 
QStringList getScriptList ()
 
bool scriptIsRunning ()
 Find out if a script is running. More...
 
QString runningScriptId ()
 Get the ID (filename) of the currently running script. More...
 
bool preprocessScript (const QString &input, QString &output, const QString &scriptDir)
 
bool preprocessScript (QFile &input, QString &output, const QString &scriptDir)
 
void addModules ()
 Add all the StelModules into the script engine. More...
 

Detailed Description

Manage scripting in Stellarium.

Definition at line 39 of file StelScriptMgr.hpp.

Member Function Documentation

void StelScriptMgr::addModules ( )

Add all the StelModules into the script engine.

void StelScriptMgr::debug ( const QString &  msg)
slot

cause the emission of the scriptDebug signal.

This is so that functions in StelMainScriptAPI can explicitly send information to the ScriptConsole

const QString StelScriptMgr::getAuthor ( const QString &  s)
slot

Gets the name of the script Author.

Parameters
sthe file name of the script whose name is to be returned.
Returns
text following a comment with Author: at the start. If no such comment is found, "" is returned. If the file is not found or cannot be opened for some reason, an Empty string will be returned.
const QString StelScriptMgr::getDescription ( const QString &  s)
slot

Gets a description of the script.

Parameters
sthe file name of the script whose name is to be returned.
Returns
text following a comment with Description: at the start. The description is considered to be over when a line with no comment is found. If no such comment is found, QString("") is returned. If the file is not found or cannot be opened for some reason, an Empty string will be returned.
const QString StelScriptMgr::getLicense ( const QString &  s)
slot

Gets the licensing terms for the script.

Parameters
sthe file name of the script whose name is to be returned.
Returns
text following a comment with License: at the start. If no such comment is found, "" is returned. If the file is not found or cannot be opened for some reason, an Empty string will be returned.
const QString StelScriptMgr::getName ( const QString &  s)
slot

Gets a single line name of the script.

Parameters
sthe file name of the script whose name is to be returned.
Returns
text following a comment with Name: at the start. If no such comment is found, the file name will be returned. If the file is not found or cannot be opened for some reason, an Empty string will be returned.
double StelScriptMgr::getScriptRate ( )
slot

Get the rate at which the script is running as a multiple of the normal execution rate.

const QString StelScriptMgr::getShortcut ( const QString &  s)
slot

Gets the default shortcut of the script.

Parameters
sthe file name of the script whose name is to be returned.
Returns
text following a comment with Shortcut: at the start. If no such comment is found, QString("") is returned. If the file is not found or cannot be opened for some reason, an Empty string will be returned.
void StelScriptMgr::output ( const QString &  msg)
slot

cause the emission of the scriptOutput signal.

This is so that functions in StelMainScriptAPI can explicitly send information to the ScriptConsole

void StelScriptMgr::pauseScript ( )
slot

Pause a running script.

void StelScriptMgr::resumeScript ( )
slot

Resume a paused script.

QString StelScriptMgr::runningScriptId ( )

Get the ID (filename) of the currently running script.

Returns
Empty string if no script is running, else the ID of the script which is running.
bool StelScriptMgr::runPreprocessedScript ( const QString &  preprocessedScript)
slot

Run the prprocessed script.

Parameters
preprocessedScriptthe string containing the preprocessed script.
Returns
false if the given script could not be run, true otherwise
bool StelScriptMgr::runScript ( const QString &  fileName,
const QString &  includePath = "" 
)
slot

Run the script located at the given location.

Parameters
fileNamethe location of the file containing the script.
includePaththe directory to use when searching for include files in the SSC preprocessor. Usually this will be the same as the script file itself, but if you're running a generated script from a temp directory, but want to include a file from elsewhere, it can be usetul to set it to something else (e.g. in ScriptConsole).
Returns
false if the named script could not be run, true otherwise
void StelScriptMgr::scriptDebug ( const QString &  )
signal

Notification of a script event - warnings, current execution line etc.

bool StelScriptMgr::scriptIsRunning ( )

Find out if a script is running.

Returns
true if a script is running, else false
void StelScriptMgr::scriptOutput ( const QString &  )
signal

Notification of a script event - output line.

void StelScriptMgr::scriptRunning ( )
signal

Notification when a script starts running.

void StelScriptMgr::scriptStopped ( )
signal

Notification when a script has stopped running.

void StelScriptMgr::setScriptRate ( float  r)
slot

Changes the rate at which the script executes as a multiple of real time.

Note that this is not the same as the rate at which simulation time passes because the script running at normal rate might set the simulation time rate to be non-real time.

Parameters
rrate, e.g. 2.0 = script runs at twice the normal rate
void StelScriptMgr::stopScript ( )
slot

Stops any running script.

Returns
false if no script was running, true otherwise.

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