20 #ifndef _STELSCRIPTMGR_HPP_ 21 #define _STELSCRIPTMGR_HPP_ 24 #include <QStringList> 30 class StelScriptEngineAgent;
33 #ifdef ENABLE_SCRIPT_CONSOLE 44 #ifdef ENABLE_SCRIPT_CONSOLE 52 QStringList getScriptList();
68 bool preprocessScript(QFile &input, QString& output,
const QString& scriptDir);
85 QString
getName(
const QString& s)
const;
93 QString
getAuthor(
const QString& s)
const;
129 bool runScript(
const QString& fileName,
const QString& includePath=
"");
138 bool runScriptDirect(
const QString& scriptCode,
const QString &includePath = QString());
159 bool prepareScript(QString& script,
const QString& fileName,
const QString& includePath=
"");
178 void debug(
const QString& msg);
182 void output(
const QString& msg);
214 QMap<QString, QString> mappify(
const QStringList& args,
bool lowerKey=
false);
215 bool strToBool(
const QString& str);
227 QString getHeaderSingleLineCommentText(
const QString& s,
const QString&
id,
const QString& notFoundText=
"")
const;
228 QScriptEngine* engine;
233 QString scriptFileName;
236 StelScriptEngineAgent *agent;
239 #endif // _STELSCRIPTMGR_HPP_ void scriptOutput(const QString &) const
Notification of a script event - output line.
QString getName(const QString &s) const
Gets a single line name of the script.
bool runScript(const QString &fileName, const QString &includePath="")
Run the script located in the given file.
void debug(const QString &msg)
cause the emission of the scriptDebug signal.
void setScriptRate(float r)
Changes the rate at which the script executes as a multiple of real time.
void scriptRunning()
Notification when a script starts running.
void runningScriptIdChanged(const QString &id)
Emitted when the running script id changes (also on start/stop)
void scriptDebug(const QString &) const
Notification of a script event - warnings, current execution line etc.
void stopScript()
Stops any running script.
bool scriptIsRunning()
Find out if a script is running.
void addModules()
Add all the StelModules into the script engine.
bool preprocessScript(const QString &input, QString &output, const QString &scriptDir)
Preprocess script, esp.
QString getHtmlDescription(const QString &s, bool generateDocumentTags=true) const
Returns a HTML description of the specified script.
Provide script API for Stellarium global functions.
void resumeScript()
Resume a paused script.
QString getAuthor(const QString &s) const
Gets the name of the script Author.
bool runPreprocessedScript(const QString &preprocessedScript, const QString &scriptId)
Runs preprocessed script code which has been generated using runPreprocessedScript().
void scriptStopped()
Notification when a script has stopped running.
QString getShortcut(const QString &s) const
Gets the default shortcut of the script.
void output(const QString &msg)
cause the emission of the scriptOutput signal.
void pauseScript()
Pause a running script.
QString getLicense(const QString &s) const
Gets the licensing terms for the script.
Manage scripting in Stellarium.
bool runScriptDirect(const QString &scriptCode, const QString &includePath=QString())
Runs the script code given.
QString runningScriptId()
Get the ID (usually filename) of the currently running script.
QString getDescription(const QString &s) const
Gets a description of the script.
void resetOutput(void)
Reset output file and cause the emission of an (empty) scriptOutput signal.
void saveOutputAs(const QString &filename)
Save output file to new file (in same directory as output.txt).
bool prepareScript(QString &script, const QString &fileName, const QString &includePath="")
Loads a script file and does all preparatory steps except for actually executing the script in the en...
double getScriptRate()
Get the rate at which the script is running as a multiple of the normal execution rate...