Class sh::ui::web::WebModule

class sh::ui::web::WebModule

Base class for modules, which provide some functionaly on top of a web server engine.

Subclassed by sh::ui::web::WebActionManager, sh::ui::web::WebDetailPanelManager, sh::ui::web::WebDialogManager, sh::ui::web::WebFileViewManager, sh::ui::web::WebMainWindow, sh::ui::web::WebServerEngineDispatcher, sh::ui::web::WebServerEngineMainModule

Public Functions

WebModule()
~WebModule()
bool executeCommand(WebServerEngineRequest *request, QString command)

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.

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 Members

WebServerEngine *_webserver = nullptr