Class sh::ui::web::WebDialogManager

class sh::ui::web::WebDialogManager : public QObject, public sh::ui::web::WebModule, public sh::ui::DialogManager

A DialogManager used in Web ui.

Public Functions

WebDialogManager()
WebServerEngine *webserver()

Return the WebServerEngine hosting this dialog.

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. .

std::shared_ptr<Dialog> getDialogById(qint64 id)

Returns a Dialog by dialog id.

Must be called in main thread.

QList<std::shared_ptr<Dialog>> getAllDialogs()

Returns a list of all dialogs currently shown (in order of creation).

Must be called in main thread.

QList<qint64> getAllDialogIds()

Returns a list of dialog ids of all dialogs currently shown (in order of creation).

Must be called in main thread.

template<class TDlg, typename ...Args>
std::shared_ptr<TDlg> createAndShowDialog(Args... args)

Creates and shows a Dialog by class and constructor parameters.

Those dialogs (TDlg) have to implement Dialog (typically a subclass of it, representing a particular dialog, like FilePropertyDialog), and also some ui mode (e.g. qt, web) specific class (depends on that ui mode).

You typically should not have to use it outside of MainWindow or subclasses. The MainWindow interface allows to create all available dialogs in a ui mode independent way.

May be called in any thread.

Return

The created Dialog instance.

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

std::shared_ptr<Dialog> getDialogForRequest(WebServerEngineRequest *request)

Returns the WebDialog referred to the request (i.e. its dialogId parameter).

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 showDialog(std::shared_ptr<Dialog> dialog) override

This method implements the ui mode specific mechanism for showing a dialog.

Must be called in main thread.

Private Slots

void cmd__change_dialog_property__M(WebServerEngineRequest *request)
void cmd__closed_in_browser__M(WebServerEngineRequest *request)
void cmd__list__M(WebServerEngineRequest *request)