17 #include <QtCore/QList> 18 #include <QtCore/QTimer> 19 #include <QtCore/QStringList> 36 Q_INVOKABLE QTimer *
timer(
int milliseconds);
39 Q_INVOKABLE
void wait(
const int &milliseconds);
42 Q_INVOKABLE qint64
time()
const;
45 Q_INVOKABLE
int random(
int from,
int to)
const;
48 Q_INVOKABLE
void system(
const QString &command,
bool synchronously =
false);
51 Q_INVOKABLE
void writeToFile(
const QString &file,
const QString &text);
54 Q_INVOKABLE QStringList
readAll(
const QString &file)
const;
57 Q_INVOKABLE
void removeFile(
const QString &file);
80 QList<QTimer *> mTimers;
84 bool mInEventDrivenMode =
false;
void run()
Starts event loop for script.
Definition: scriptExecutionControl.cpp:76
Definition: trikCommunicator.h:23
void stopWaiting()
To be connected to quit() slot of local event loops that are used for waiting.
Q_INVOKABLE QStringList readAll(const QString &file) const
Reads all lines from a text file and returns it as a list of strings.
Definition: scriptExecutionControl.cpp:111
bool isInEventDrivenMode() const
Returns true if a script is in event-driven running mode, so it shall wait for events when script is ...
Definition: scriptExecutionControl.cpp:81
void quitSignal()
Emitted when script requested system to abort execution.
~ScriptExecutionControl() override
Definition: scriptExecutionControl.cpp:27
void sendMessage(const QString &text)
Requests sending a message to a desktop.
Q_INVOKABLE void removeFile(const QString &file)
Removes a file.
Definition: scriptExecutionControl.cpp:129
void quit()
Aborts script execution.
Definition: scriptExecutionControl.cpp:86
Q_INVOKABLE void wait(const int &milliseconds)
Waits given amount of time in milliseconds and returns.
Definition: scriptExecutionControl.cpp:52
Q_INVOKABLE int random(int from, int to) const
Returns random number from an interval [from, to].
Definition: scriptExecutionControl.cpp:67
Script execution controller, provides related functions to scripts.
Definition: scriptExecutionControl.h:24
Q_INVOKABLE QTimer * timer(int milliseconds)
Starts a new timer with given interval and returns reference to it.
Definition: scriptExecutionControl.cpp:44
Q_INVOKABLE qint64 time() const
Returns the number of milliseconds since 1970-01-01T00:00:00 UTC.
Definition: scriptExecutionControl.cpp:62
Q_INVOKABLE void system(const QString &command, bool synchronously=false)
Execute given sh command.
Definition: scriptExecutionControl.cpp:91
void reset()
Resets script execution state, clearing all flags and stopping all timers.
Definition: scriptExecutionControl.cpp:32
Q_INVOKABLE void writeToFile(const QString &file, const QString &text)
Appends given text to the end of a file.
Definition: scriptExecutionControl.cpp:104