Class sh::ui::web::WebActionManager

class sh::ui::web::WebActionManager : public QObject, public sh::ui::web::WebModule

Manages sh::actions::AbstractActionItem handling, e.g. showing them in the toolbar, executing them, and displaying their user interface.

Public Functions

WebActionManager()
void initialize()
std::shared_ptr<WebActionExecutionInfoPanel> addInfoPanel(int position, sh::actions::ActionExecutionInfo *info, QColor color = QColor())

Adds and returns a new action info panel.

std::shared_ptr<WebActionExecutionInfoDialog> addActionExecutionInfoDialog(sh::actions::ActionExecutionInfo *info)

Adds and returns a new action info dialog.

void refreshToolbar(std::shared_ptr<sh::actions::ActionInstantiation> instantiation)

Refreshes the main toolbar.

bool rootCommand(WebServerEngineRequest *request, QString webadapter)

Returns the root (‘index.html’) content. .

void setEngine(WebServerEngine *webserver)

Assigns this web module to a sh::ui::web::WebServerEngine. .

WebServerEngine *webserver()

Returns the sh::ui::web::WebServerEngine this web module is assigned to (may be nullptr).

Public Static Functions

bool executeCommand_byQObjectReflection(QObject *o, WebServerEngineRequest *request, QString command, QString justLeftside = QString())

Convenience function often used by executeCommand().

For a QObject, it searches there for a slot with the name cmd_{command}, with `’/’s replaced by’_’s (so, for the command”foo/get_bars”, it searches for slotcmd_foo_get_bars`). If it finds one, it gets executed (in a worker thread). The request is considered as handled, if so.

If there is such a slot, but with appended __M in name, it is called in main thread!

Return

If it handled (answered) the command.

Private Functions

bool executeCommand(WebServerEngineRequest *request, QString command) override

Executes command as requested by the browser, if responsible.

Read parameters, check if this module is responsible for answering, and then write an answer with request.

Implementations often use executeCommand_byQObjectReflection() for convenience.

Return

If it handled (answered) the command.

void _observeToolbarAction(sh::actions::AbstractActionItem *a)
std::shared_ptr<sh::actions::AbstractActionItem> resolveActionpath(QString sactionpath, QStringList *actionpath, QList<QPair<QString, std::shared_ptr<sh::actions::AbstractActionItem>>> *subactions)
void _triggerActionuiChanged()

Private Members

QList<WebActionExecutionInfoPanel*> _infopanels
QList<WebActionExecutionInfoDialog*> _infodialogs
QTimer _triggerActionuiChangedTimer
QTimer _triggerToolbarRefreshTimer
QMap<QString, std::shared_ptr<sh::actions::SubmenuActionItem>> _permanentToolbarActions

Private Slots

void cmd__answer_userfeedback__M(WebServerEngineRequest *request)
void cmd__execute(WebServerEngineRequest *request)
void cmd__get(WebServerEngineRequest *request)
void cmd__get_ui__M(WebServerEngineRequest *request)
void cmd__icon(WebServerEngineRequest *request)
void cmd__panel_clicked__M(WebServerEngineRequest *request)

Private Static Attributes

QRegularExpression reActionTextAccel

Friends

friend class WebActionExecutionInfoPanel
friend class WebActionExecutionInfoDialog