Script execution controller, provides related functions to scripts.
More...
#include <scriptExecutionControl.h>
|
| void | run () |
| | Starts event loop for script. More...
|
| |
| void | quit () |
| | Aborts script execution. More...
|
| |
| void | reset () |
| | Resets script execution state, clearing all flags and stopping all timers. More...
|
| |
|
| | ~ScriptExecutionControl () override |
| |
| bool | isInEventDrivenMode () const |
| | Returns true if a script is in event-driven running mode, so it shall wait for events when script is executed. More...
|
| |
| Q_INVOKABLE QTimer * | timer (int milliseconds) |
| | Starts a new timer with given interval and returns reference to it. More...
|
| |
| Q_INVOKABLE void | wait (const int &milliseconds) |
| | Waits given amount of time in milliseconds and returns. More...
|
| |
| Q_INVOKABLE qint64 | time () const |
| | Returns the number of milliseconds since 1970-01-01T00:00:00 UTC. More...
|
| |
| Q_INVOKABLE int | random (int from, int to) const |
| | Returns random number from an interval [from, to]. More...
|
| |
| Q_INVOKABLE void | system (const QString &command, bool synchronously=false) |
| | Execute given sh command. More...
|
| |
| Q_INVOKABLE void | writeToFile (const QString &file, const QString &text) |
| | Appends given text to the end of a file. More...
|
| |
| Q_INVOKABLE QStringList | readAll (const QString &file) const |
| | Reads all lines from a text file and returns it as a list of strings. More...
|
| |
| Q_INVOKABLE void | removeFile (const QString &file) |
| | Removes a file. More...
|
| |
Script execution controller, provides related functions to scripts.
| ScriptExecutionControl::~ScriptExecutionControl |
( |
| ) |
|
|
override |
| bool ScriptExecutionControl::isInEventDrivenMode |
( |
| ) |
const |
Returns true if a script is in event-driven running mode, so it shall wait for events when script is executed.
If it is false, script will exit immediately.
| void ScriptExecutionControl::quit |
( |
| ) |
|
|
slot |
| void trikScriptRunner::ScriptExecutionControl::quitSignal |
( |
| ) |
|
|
signal |
Emitted when script requested system to abort execution.
| int ScriptExecutionControl::random |
( |
int |
from, |
|
|
int |
to |
|
) |
| const |
Returns random number from an interval [from, to].
| QStringList ScriptExecutionControl::readAll |
( |
const QString & |
file | ) |
const |
Reads all lines from a text file and returns it as a list of strings.
| void ScriptExecutionControl::removeFile |
( |
const QString & |
file | ) |
|
| void ScriptExecutionControl::reset |
( |
| ) |
|
|
slot |
Resets script execution state, clearing all flags and stopping all timers.
| void ScriptExecutionControl::run |
( |
| ) |
|
|
slot |
Starts event loop for script.
| void trikScriptRunner::ScriptExecutionControl::sendMessage |
( |
const QString & |
text | ) |
|
|
signal |
Requests sending a message to a desktop.
| void trikScriptRunner::ScriptExecutionControl::stopWaiting |
( |
| ) |
|
|
signal |
To be connected to quit() slot of local event loops that are used for waiting.
| void ScriptExecutionControl::system |
( |
const QString & |
command, |
|
|
bool |
synchronously = false |
|
) |
| |
Execute given sh command.
| qint64 ScriptExecutionControl::time |
( |
| ) |
const |
Returns the number of milliseconds since 1970-01-01T00:00:00 UTC.
| QTimer * ScriptExecutionControl::timer |
( |
int |
milliseconds | ) |
|
Starts a new timer with given interval and returns reference to it.
| void ScriptExecutionControl::wait |
( |
const int & |
milliseconds | ) |
|
Waits given amount of time in milliseconds and returns.
| void ScriptExecutionControl::writeToFile |
( |
const QString & |
file, |
|
|
const QString & |
text |
|
) |
| |
Appends given text to the end of a file.
The documentation for this class was generated from the following files: