Class sh::scripting::ScriptingEngine

class sh::scripting::ScriptingEngine : public QObject, public sh::base::Singleton

The Scripting engine loads scripts by means of the registered interpreters.

Public Functions

void loadScript(QString script)

Loads a plugin script from file.

void doShutdown()

Executes singleton shutdown.

void shutdown()

Shutdown down this singleton.

bool isAlive()

Returns if this singleton is alive (true until its shutdown begins).

Private Functions

ScriptingEngine()
void registerInterpreter(std::shared_ptr<sh::scripting::ScriptInterpreter> interpreter)

Private Members

QMap<QString, std::shared_ptr<sh::scripting::ScriptInterpreter>> _interpreters

Private Static Attributes

std::shared_ptr<sh::configuration::ConfigurationValue> cfgvalLastStartupFailed = sh::configuration::ConfigurationManager::instance()->registerConfigValue("sh::scripting::ScriptingEngine.LastStartupFailed", false, sh::configuration::ConfigurationValue::valueTypeBoolean())
class ActionPluginLoadCrashedAgain : public sh::actions::ActionActionItem

Public Functions

ActionPluginLoadCrashedAgain(QString path, QMutex *mutex)
void execute()

Executes this action.

void execute(sh::actions::ActionExecutionInfo *info)

Executes this action.

QKeySequence shortcuthint()

Returns the keyboard shortcut for triggering this action.

bool shortcuthintTriggersOnCurrentDirectory()

Checks if using the keyboard shortcut shall trigger the action on the current directory (or on the entry selection).

void setShortcuthint(QKeySequence shortcut, bool triggersOnCurrentDirectory = false)

Sets the keyboard shortcut for triggering this action.

QString text()

Returns the displayed text for this action.

QString icon()

Returns the icon for this action.

bool enabled()

Checks if this action is enabled.

bool isChecked()

Checks if this action is checked (has a cross in the ui).

bool isCheckable()

Checks if this action is checkable (can have a cross in the ui).

int defaultActionPrecedence() const

Returns the precedence for becoming the default action of a parent submenu.

This e.g. leads to a bold label.

The action with the highest value becomes the default. Only values >0 will be considered. See ActionDefaultPrecedenceValues for reference values.

void setText(QString text)

Sets the displayed text.

void setIcon(QString icon)

Sets the icon.

void setEnabled(bool enabled)

Sets if the item is enabled.

void setChecked(bool checked)

Sets if the item is checked (has a cross in the ui).

void setVisible(bool visible)

Sets the visibility of this item.

bool visible()

Checks the visibility of this item (non-recursively).

std::weak_ptr<AbstractActionItem> parentAction()

Returns the parent action, if it is added to a container.

void _setParentAction(std::shared_ptr<AbstractActionItem> parent)

Sets the parent action. .

void initializeAsync(std::function<void()> oninitialized = 0)

Asynchonously initializes the action.

void initializeSync()

Synchonously initializes the action.

bool isInitialized()

Checks if this action is initialized.

bool isInitializing()

Checks if this action is initializing.

Signals

void changed()

Emits when some data changed.

class ScriptedException : public sh::exceptions::Exception

Exception for errors within the scripting engine and interpreters.

Public Functions

ScriptedException(sh::exceptions::ExceptionData data)
QString message() const
QString name() const
QString classes() const
QString details() const
QString callstack() const
QString auxiliary() const
QString customValue(QString key) const
bool isRuntimeException() const
bool isProgramException() const
bool isRetryable() const
bool isResumeable() const
bool isDetailsAreInteresting() const
int autoRetryRecommendedIn() const
void setResumeable(bool v)
void setReTryable(bool v)
void setCustomValue(QString key, QString value)
bool isClass(QString classname)
sh::exceptions::ExceptionData data()

Public Static Functions

template<class Handler>
std::shared_ptr<RegisterHandler<Handler>> createRegisterHandler(Handler handler, QStack<Handler> *stack)
void executeGuarded(std::function<void()> fctint flags = 0, )

Executes some code with some standard exection handling around.

Parameters
  • fct: The code to execute guarded.

  • flags: Flags of ExecuteGuardFlag for choosing the behavior.

void executeGuarded_errorpanel(std::function<void()> fctint flags = 0, )
QString _demangle(QString l)
void exceptionDialog(sh::exceptions::Exception &e, bool *doRetry)

Public Static Attributes

const QString UNDEFINED_ERROR_OCCURRED = QObject::tr("An unspecified error occurred.")
const QString SHALLOT_MUST_CLOSE_TEXT = QObject::tr("Your Shallot process is disturbed by an error and needs to be closed now. You can try if starting Shallot again solves the issue. If you are interested in technical details, please take a look at the log.")
const QString Value_isShallotException = "_isShallotException"