Namespace sh::ui::web¶
-
namespace
sh::ui
::
web
The web user interface implementation.
This optional UI provides an application running in a web browser.
Typedefs
-
typedef QPair<QIcon, int>
WebIconTextBannerItemIcon
-
typedef QPair<WebIconTextBannerItemIcon, QString>
WebIconTextBannerItem
-
typedef QMap<QString, QString>
WebCommandData
-
class
WebAboutDialog
: public QObject, public sh::ui::web::WebDialog, public sh::ui::AboutDialog - #include <webaboutdialog.h>
Web based about dialog.
Public Functions
-
WebAboutDialog
()
-
QVariant
dialogProperty
(QString dlgPropertyKey, QVariant deflt = QVariant()) Returns a dialog property value by key.
-
void
setDialogProperty
(QString dlgPropertyKey, QVariant value) Sets a dialog property value for a key.
-
QVariantHash
dialogResult
() Returns the dialog result as hash.
The browser side of a web dialog can ‘accept’ a dialog while closing by setting a non-empty dialog result. This mechanism allows browser side dialogs to return data to the backend. It’s up to the backend to interpret the content of this hash.
If the dialog was cancelled, or is still open, the returned hash is empty. See also wasClosed().
-
void
triggerDialogEvent
(QString name, QJsonObject data = QJsonObject()) Triggers a dialog event (at the browsers).
They in turn typically fetch some data again in order to refresh the ui.
-
void
setCloseableByUser
(bool v = true) Sets if this dialog shall be directly closeable by the user by the window decoration. Set to
false
if the user has to react on this dialog by clicking on some controls in the dialog body.This method must be called during construction.
-
bool
isCloseableByUser
() Returns if this dialog shall be directly closeable by the user by the window decoration.
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
-
qint64
dialogId
() Returns the dialog id.
Each instance has an id unique in the complete Shallot process lifetime.
Must be called in main thread.
-
bool
isInited
() Returns if this dialog is initialized.
Must be called in main thread.
-
bool
wasAccepted
() Returns if this dialog was ‘accepted’ by the user (typically by clicking some ‘OK’ button).
Must be called in main thread.
-
void
waitClosed
() Wait until the user closed the dialog in some way.
May be called in any thread.
-
void
close
() Closes the dialog.
Must be called in main thread.
-
bool
wasClosed
() Returns if this dialog was closed.
Must be called in main thread.
-
DialogManager *
manager
() Returns the DialogManager which hosts this dialog.
-
-
class
WebActionExecutionInfoDialog
: public sh::ui::ActionExecutionInfoDialog - #include <webactionexecutioninfodialog.h>
Web based action execution dialog.
Public Types
-
enum
MessageBoxButton
Buttons in a message box from ActionExecutionUserFeedback.
Values:
-
enumerator
NONE
= 0
-
enumerator
OK
= 1 << 0
-
enumerator
Continue
= 1 << 1
-
enumerator
Cancel
= 1 << 2
-
enumerator
Retry
= 1 << 3
-
enumerator
Yes
= 1 << 4
-
enumerator
No
= 1 << 5
-
enumerator
Public Functions
-
WebActionExecutionInfoDialog
(sh::actions::ActionExecutionInfo *info)
-
void
setDetails
(QString fv, QString fob, QString tv, QString tob) Sets the item details text (‘from a/foo.jpg’, ‘to b/foo.jpg’). .
-
void
setHead
(QString txt) Sets the header text. .
-
void
setProgress
(bool isDeterminate, quint64 done, quint64 all, QString text) Sets the progress. .
-
int
messageBox
(QString text, QList<QString> answers, QString icon = QString(), int defaultanswer = -1, int cancelanswer = -1, QList<QString> answericons = QList<QString>())
-
int
inputBox
(QString text, QList<QString> answers, QString *value, QString icon = QString(), int defaultanswer = -1, int cancelanswer = -1, int valuePreselectFrom = -1, int valuePreselectTo = -1)
-
int
multilineInputBox
(QString text, QList<QString> answers, QString *value, QString icon = QString(), int defaultanswer = -1, int cancelanswer = -1)
-
int
simpleChooserGridform
(QString text, GridformEntries *entries, QStringList answers, int defaultanswer = -1, int cancelanswer = -1)
-
bool
credentialsDialog
(QString text, bool showDomain, bool showUsername, bool showPassword, bool showAnonymous, bool showRemember, QString *domain, QString *username, QString *password, bool *isAnonymous, bool *isRemember)
-
bool
unixPermissionsDialog
(bool *userMayRead, bool *userMayWrite, bool *userMayExecute, bool *groupMayRead, bool *groupMayWrite, bool *groupMayExecute, bool *othersMayRead, bool *othersMayWrite, bool *othersMayExecute, bool *sticky, bool *setuid, bool *setgid, QStringList users, QStringList groups, QString *ownerUser, QString *ownerGroup)
-
qint64
id
()
-
qint64
webts_created
()
-
QString
details_fromverb
()
-
QString
details_fromobject
()
-
QString
details_toverb
()
-
QString
details_toobject
()
-
QString
head
()
-
bool
progress_isDeterminate
()
-
quint64
progress_done
()
-
quint64
progress_all
()
-
QString
progress_text
()
-
QJsonValue
userFeedbackAsJsonValue
()
-
bool
isLogicallyVisible
() Returns if this dialog is logically visible (i.e. set visible by the action).
-
void
setLogicallyVisible
(bool v) Sets if this dialog is logically visible (i.e. set visible by the action). .
-
bool
isBackground
() Returns if this dialog is currently in background mode (i.e. not visible).
-
void
setBackground
(bool v) Sets if this dialog is currently in background mode (i.e. not visible). .
-
void
setForceForeground
(bool v) Sets if this dialog is currently forced to be visible in foreground. .
-
QString
simpleInputBox
(QString text, QString deflt, int valuePreselectFrom = -1, int valuePreselectTo = -1)
-
int
simpleMessageBox
(QString text, int buttons = (int)MessageBoxButton::OK, QString icon = QString(), int defaultbutton = (MessageBoxButton)0, int cancelbutton = (MessageBoxButton)0)
Private Functions
-
void
_triggerChanged
()
Private Members
-
qint64
_id
-
QString
_details_fv
-
QString
_details_fob
-
QString
_details_tv
-
QString
_details_tob
-
QString
_head
-
bool
_progress_isDeterminate
-
quint64
_progress_done
-
quint64
_progress_all
-
QString
_progress_text
-
std::shared_ptr<UserFeedback>
_currentUserFeedback
= 0
-
QMutex
_currentUserFeedbackMutex
-
QWaitCondition
_currentUserFeedbackChangedCondition
-
qint64
_webts_created
Private Static Functions
-
QByteArray
iconToBase64Src
(QString icon, int sizeInPt)
-
QList<QVariant>
iconsToBase64Srcs
(QStringList icons, int sizeInPt)
Friends
- friend class WebActionManager
-
class
UserFeedback
: public QMap<QString, QVariant> - #include <webactionexecutioninfodialog.h>
Public Members
-
qint64
id
= -1
-
bool
answered
= false
-
qint64
-
enum
-
class
WebActionExecutionInfoPanel
: public sh::ui::ActionExecutionInfoPanel - #include <webactionexecutioninfopanel.h>
Web based action execution info panel.
Public Functions
-
WebActionExecutionInfoPanel
(sh::actions::ActionExecutionInfo *info, QColor color)
-
~WebActionExecutionInfoPanel
()
-
void
setLabel
(QString s) Sets the label text. .
-
void
setProgress
(bool isProgressDeterminate, quint64 progressDone, quint64 progressAll) Sets the progress. .
-
void
setForceForeground
(bool v) Sets if the associated action is currently forced to be visible in foreground. .
-
void
setPanelVisible
(bool v) Sets if the panel is visible. .
-
void
setWidth
(int width) Sets the panel with (in pixels). .
-
qint64
id
()
-
QString
label
()
-
bool
isProgressDeterminate
()
-
quint64
progressDone
()
-
quint64
progressAll
()
-
bool
forceForeground
()
-
bool
panelVisible
()
-
int
width
()
-
QColor
color
()
-
sh::actions::ActionExecutionInfo *
info
()
-
void
onClicked
(std::function<void()> fctQObject *owner = 0, ) Sets a handler for a click on the button (optionally bound to an owner lifetime).
-
void
onDestroyed
(std::function<void()> fctQObject *owner = 0, ) Sets a handler for panel removal (optionally bound to an owner lifetime).
-
void
onVisibilityChanged
(std::function<void()> fctQObject *owner = 0, ) Sets a handler for panel visibility changes (optionally bound to an owner lifetime).
Private Functions
-
void
_triggerChanged
()
Private Members
-
QColor
_color
-
sh::actions::ActionExecutionInfo *
_info
-
qint64
_id
-
QString
_label
-
bool
_isProgressDeterminate
-
quint64
_progressDone
-
quint64
_progressAll
-
bool
_forceForeground
-
bool
_panelVisible
-
int
_width
Friends
- friend class WebActionManager
-
-
class
WebActionManager
: public QObject, public sh::ui::web::WebModule - #include <webactionmanager.h>
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.
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 slot
cmd_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)
-
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
-
-
class
WebDetailPanelManager
: public QObject, public sh::ui::web::WebModule - #include <webdetailpanelmanager.h>
Manages the detail panel (typically in bottom part of main window).
Public Functions
-
WebDetailPanelManager
()
Loads details for a given list of nodes (typically called after they get selected).
-
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 slot
cmd_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.
Private Members
-
QMutex
_mutex
-
QList<std::shared_ptr<sh::paneldetails::PanelDetail>>
_paneldetails
-
qint64
_webts_lastupdate
Private Slots
-
void
cmd__get_details
(WebServerEngineRequest *request)
-
void
cmd__get_thumbnail
(WebServerEngineRequest *request)
-
void
cmd__link_clicked
(WebServerEngineRequest *request)
-
-
class
WebDialog
: public sh::tools::Jsonable - #include <webdialog.h>
Abstract base class for a web based dialog. Typically used for also implementing some sh::ui::Dialog.
A web dialog is a dialog window presented to the user on browser side. A web dialog implementation consists of a backend part (a subclass of WebDialog) and a browser side part (basically a subclass of shwebui.Dialog).
For implementing a web dialog, implement a subclass of WebDialog (which in turn will specify the browser side part) and sh::ui::Dialog. Create such dialogs by means of WebDialogManager.
Communicating values between backend and browser typically works by dialogProperty() and setDialogProperty(), also dialogResult() for the dialog result after closing.
Subclassed by sh::ui::web::WebAboutDialog, sh::ui::web::WebExceptionDialog, sh::ui::web::WebFilePropertyDialog, sh::ui::web::WebLogViewDialog, sh::ui::web::WebManageBookmarksDialog, sh::ui::web::WebManageProfilesDialog, sh::ui::web::WebOpenWithDialog, sh::ui::web::WebStoreProfileDialog, sh::ui::web::WebTuningDialog
Public Functions
-
WebDialog
(QString dialogClassName) See WebDialogManager.
- Parameters
dialogClassName
: The name of the shwebui.Dialog subclass which implements the web dialog on browser side.
-
QVariant
dialogProperty
(QString dlgPropertyKey, QVariant deflt = QVariant()) Returns a dialog property value by key.
-
void
setDialogProperty
(QString dlgPropertyKey, QVariant value) Sets a dialog property value for a key.
-
QVariantHash
dialogResult
() Returns the dialog result as hash.
The browser side of a web dialog can ‘accept’ a dialog while closing by setting a non-empty dialog result. This mechanism allows browser side dialogs to return data to the backend. It’s up to the backend to interpret the content of this hash.
If the dialog was cancelled, or is still open, the returned hash is empty. See also wasClosed().
-
void
triggerDialogEvent
(QString name, QJsonObject data = QJsonObject()) Triggers a dialog event (at the browsers).
They in turn typically fetch some data again in order to refresh the ui.
-
void
setCloseableByUser
(bool v = true) Sets if this dialog shall be directly closeable by the user by the window decoration. Set to
false
if the user has to react on this dialog by clicking on some controls in the dialog body.This method must be called during construction.
-
bool
isCloseableByUser
() Returns if this dialog shall be directly closeable by the user by the window decoration.
-
~WebDialog
()
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
Private Members
-
QVariantHash
_properties
-
QString
_dialogClassName
-
qint64
_webts_created
Friends
- friend class WebDialogManager
-
-
class
WebDialogManager
: public QObject, public sh::ui::web::WebModule, public sh::ui::DialogManager - #include <webdialog.h>
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.
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 slot
cmd_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. itsdialogId
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.
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)
-
-
class
WebExceptionDialog
: public QObject, public sh::ui::web::WebDialog, public sh::ui::ExceptionDialog - #include <webexceptiondialog.h>
Web based exception dialog.
Public Functions
-
WebExceptionDialog
(QString error1, QString error2, QString details, QString icon, bool mayRetry, bool mayClose, bool mayCancel, bool showLoglabelAndDetails)
-
ExceptionDialogResult
answer
() override Returns the answer the user has given in this dialog.
-
QVariant
dialogProperty
(QString dlgPropertyKey, QVariant deflt = QVariant()) Returns a dialog property value by key.
-
void
setDialogProperty
(QString dlgPropertyKey, QVariant value) Sets a dialog property value for a key.
-
QVariantHash
dialogResult
() Returns the dialog result as hash.
The browser side of a web dialog can ‘accept’ a dialog while closing by setting a non-empty dialog result. This mechanism allows browser side dialogs to return data to the backend. It’s up to the backend to interpret the content of this hash.
If the dialog was cancelled, or is still open, the returned hash is empty. See also wasClosed().
-
void
triggerDialogEvent
(QString name, QJsonObject data = QJsonObject()) Triggers a dialog event (at the browsers).
They in turn typically fetch some data again in order to refresh the ui.
-
void
setCloseableByUser
(bool v = true) Sets if this dialog shall be directly closeable by the user by the window decoration. Set to
false
if the user has to react on this dialog by clicking on some controls in the dialog body.This method must be called during construction.
-
bool
isCloseableByUser
() Returns if this dialog shall be directly closeable by the user by the window decoration.
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
-
QString
error1
() Returns the 1st error text.
-
QString
error2
() Returns the 2nd error text.
-
QString
details
() Returns the error details.
-
QString
icon
() Returns the icon (as name resolveable by sh::base::IconManager).
-
bool
mayRetry
() Returns if it’s allowed to retry.
-
bool
mayClose
() Returns if it’s allowed to just close and continue without closing Shallot.
-
bool
mayCancel
() Returns if it’s allowed to cancel, i.e. throwing a sh::exceptions::CancelException.
-
bool
showLoglabelAndDetails
() Returns if the dialog shall allow to read the details.
-
qint64
dialogId
() Returns the dialog id.
Each instance has an id unique in the complete Shallot process lifetime.
Must be called in main thread.
-
bool
isInited
() Returns if this dialog is initialized.
Must be called in main thread.
-
bool
wasAccepted
() Returns if this dialog was ‘accepted’ by the user (typically by clicking some ‘OK’ button).
Must be called in main thread.
-
void
waitClosed
() Wait until the user closed the dialog in some way.
May be called in any thread.
-
void
close
() Closes the dialog.
Must be called in main thread.
-
bool
wasClosed
() Returns if this dialog was closed.
Must be called in main thread.
-
DialogManager *
manager
() Returns the DialogManager which hosts this dialog.
Private Slots
-
void
cmd__icon__M
(WebServerEngineRequest *request)
-
-
class
WebFilePropertyDialog
: public QObject, public sh::ui::web::WebDialog, public sh::ui::FilePropertyDialog - #include <webfilepropertydialog.h>
Web based file property dialog.
Public Functions
-
void
refresh
() override Refreshes the dialog content.
-
FilePropertyDialogTabTableView *
createTabViewTable
() override Creates a new tab view table sub-widget.
-
FilePropertyDialogTabTextView *
createTabViewText
() override Creates a new tab view text sub-widget.
-
FilePropertyDialogTabIconTextBannerView *
createTabViewIconTextBanner
() override Creates a new tab view icon text banner sub-widget.
-
~WebFilePropertyDialog
()
-
QVariant
dialogProperty
(QString dlgPropertyKey, QVariant deflt = QVariant()) Returns a dialog property value by key.
-
void
setDialogProperty
(QString dlgPropertyKey, QVariant value) Sets a dialog property value for a key.
-
QVariantHash
dialogResult
() Returns the dialog result as hash.
The browser side of a web dialog can ‘accept’ a dialog while closing by setting a non-empty dialog result. This mechanism allows browser side dialogs to return data to the backend. It’s up to the backend to interpret the content of this hash.
If the dialog was cancelled, or is still open, the returned hash is empty. See also wasClosed().
-
void
triggerDialogEvent
(QString name, QJsonObject data = QJsonObject()) Triggers a dialog event (at the browsers).
They in turn typically fetch some data again in order to refresh the ui.
-
void
setCloseableByUser
(bool v = true) Sets if this dialog shall be directly closeable by the user by the window decoration. Set to
false
if the user has to react on this dialog by clicking on some controls in the dialog body.This method must be called during construction.
-
bool
isCloseableByUser
() Returns if this dialog shall be directly closeable by the user by the window decoration.
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
-
QList<std::shared_ptr<FilePropertyDialogTab>>
tabs
() Returns a list of all tabs.
Returns the widget from a tab at a certain index.
Returns the number of widgets in a tab.
-
qint64
dialogId
() Returns the dialog id.
Each instance has an id unique in the complete Shallot process lifetime.
Must be called in main thread.
-
bool
isInited
() Returns if this dialog is initialized.
Must be called in main thread.
-
bool
wasAccepted
() Returns if this dialog was ‘accepted’ by the user (typically by clicking some ‘OK’ button).
Must be called in main thread.
-
void
waitClosed
() Wait until the user closed the dialog in some way.
May be called in any thread.
-
void
close
() Closes the dialog.
Must be called in main thread.
-
bool
wasClosed
() Returns if this dialog was closed.
Must be called in main thread.
-
DialogManager *
manager
() Returns the DialogManager which hosts this dialog.
Public Static Functions
Adds a FilePropertyDialogTabFactory so the Properties dialogs show its content.
See also the REGISTER_FILEPROPERTYDIALOGTAB macro.
- Parameters
i
: An index which controls the display order. Use one of the REGISTER_FILEPROPERTYDIALOGTAB_INDEX_* values in FilePropertyDialogTabFactory as base values.
Private Functions
-
void
tabwidgetTableSelect
(int cookie, int tabidx, int widgetidx, QList<int> lsel)
-
void
triggerAction
(int cookie, int tabidx, int widgetidx, int btnidx)
-
QJsonArray
getProperties
()
Private Slots
-
void
cmd__get_properties__M
(WebServerEngineRequest *request)
-
void
cmd__refresh__M
(WebServerEngineRequest *request)
-
void
cmd__trigger_action__M
(WebServerEngineRequest *request)
-
void
cmd__tabwidget_table_select__M
(WebServerEngineRequest *request)
-
class
WebFilePropertyDialogChild
Subclassed by sh::ui::web::WebFilePropertyDialog::WebFilePropertyDialogTabActionsView, sh::ui::web::WebFilePropertyDialog::WebFilePropertyDialogTabIconTextBannerView, sh::ui::web::WebFilePropertyDialog::WebFilePropertyDialogTabTableView, sh::ui::web::WebFilePropertyDialog::WebFilePropertyDialogTabTextView
Public Functions
-
WebFilePropertyDialogChild
(WebFilePropertyDialog *dlg)
-
~WebFilePropertyDialogChild
()
-
-
class
WebFilePropertyDialogTabActionsView
: public sh::ui::FilePropertyDialogTabActionsView, public sh::tools::Jsonable, public sh::ui::web::WebFilePropertyDialog::WebFilePropertyDialogChild Public Functions
-
WebFilePropertyDialogTabActionsView
(WebFilePropertyDialog *dlg)
-
void
setVisible
(bool v) override Sets the view visible or hidden. .
-
void
setContent
(FilePropertyDialogTabViewContent *cnt) override Sets the main widget. .
-
void
setButtons
(QList<QString> buttons) override Sets the list of buttons. .
-
void
setLabelText
(QString text)
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
-
FilePropertyDialogTabViewContent *
content
() The main widget.
The list of buttons.
-
void
onButtonTriggered
(std::function<void(int i)> fct, QObject *owner = 0, ) Sets a handler for a click on one of the buttons (optionally bound to an owner lifetime).
Private Members
-
bool
_visible
= false
-
QString
_labelText
Friends
- friend class WebFilePropertyDialog
-
-
class
WebFilePropertyDialogTabIconTextBannerView
: public sh::ui::FilePropertyDialogTabIconTextBannerView, public sh::tools::Jsonable, public sh::ui::web::WebFilePropertyDialog::WebFilePropertyDialogChild Public Functions
-
WebFilePropertyDialogTabIconTextBannerView
(WebFilePropertyDialog *dlg)
-
void
clear
() override Clears the contents.
-
void
insertIcon
(QIcon icon, int sizePt = 24) override Adds an icon.
-
void
insertText
(QString text) override Adds a text.
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
Private Members
-
QList<WebIconTextBannerItem>
_content
-
-
class
WebFilePropertyDialogTabTableView
: public sh::ui::FilePropertyDialogTabTableView, public sh::tools::Jsonable, public sh::ui::web::WebFilePropertyDialog::WebFilePropertyDialogChild Public Types
-
typedef QPair<int, int>
ItemIndex
Public Functions
-
WebFilePropertyDialogTabTableView
(WebFilePropertyDialog *dlg)
-
void
setContent
(QList<QPair<QString, QString>> content) override Sets the content.
-
QList<ItemIndex>
getSelectedItems
() override Returns the selected cells.
-
QVariant
getItemValue
(int r, int c) override Returns a value of a cell.
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
-
void
setSelectedItems
(QList<int> selitms)
Private Members
-
QList<QPair<QString, QString>>
_content
-
QList<int>
_selectedItems
-
typedef QPair<int, int>
-
class
WebFilePropertyDialogTabTextView
: public sh::ui::FilePropertyDialogTabTextView, public sh::tools::Jsonable, public sh::ui::web::WebFilePropertyDialog::WebFilePropertyDialogChild Public Functions
-
WebFilePropertyDialogTabTextView
(WebFilePropertyDialog *dlg)
-
void
setContent
(QString content) override Sets the content.
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
Private Members
-
QString
_content
-
-
void
-
class
WebFileView
: public sh::ui::FileView - #include <webfileview.h>
Web based file view.
Public Functions
-
WebFileView
(WebFileViewManager *manager)
-
sh::ui::ColumnDimensions *
columndimensions
() override Returns the column dimensions handler. .
-
sh::tools::HistoryTracker<std::shared_ptr<const sh::filesystem::Eurl>> *
historyTracker
() override Returns the history tracker. .
-
FileViewMode
viewmode
() override Returns the view mode (icons, list, … ?). .
-
void
setViewmode
(FileViewMode m) override Sets the view mode. .
-
int
index
() override Returns the position of this file view within the panel. .
Jumps to a new current directory.
Implementations have to call the base class implementation inside.
-
sh::filesystem::SizeFormatting
getSizeFormattingMode
() override Returns the mode how file sizes are formatted for displaying. .
-
void
setSizeFormattingMode
(sh::filesystem::SizeFormatting mode) override Sets the mode how file sizes are formatted for displaying. .
Returns if hidden files are visible. .
-
void
setHiddenFilesVisible
(bool v) override Sets the visibility of hidden files. .
-
int
iconDimension
() override Returns the icon size (in pixels). .
-
void
setIconDimension
(int v) override Sets the icon size (in pixels). .
-
void
setSort
(int column, Qt::SortOrder order) override Sets how to sort this view. .
-
int
sortColumn
() override Returns the index of the current sort column. .
-
Qt::SortOrder
sortOrder
() override Returns the current sort order. .
-
QList<std::shared_ptr<sh::filesystem::FilesystemNode>>
selectedNodes
() override Returns the nodes which the user has selected in this fileview. .
Sets the node selection of this fileview. .
-
QList<std::shared_ptr<sh::filesystem::FilesystemNode>>
getAllVisibleNodes
() override Returns a list of all nodes currently listed in this file view. .
-
qint64
id
() Returns the unique identifier.
-
std::shared_ptr<sh::filesystem::FilesystemModelFileviewProxy>
model
() Returns the filesystem model bound to this view.
-
std::shared_ptr<sh::filesystem::FilesystemNode>
node
() Returns the current directory.
-
void
reload
(bool skipModel = false) Reloads the data inside this file view.
-
sh::filesystem::FilesystemModelFileviewProxy *
filemodel
() Returns the filesystem model for this view. .
-
void
setFilemodel
(sh::filesystem::FilesystemModelFileviewProxy *model) Sets the filesystem model for this view. .
Signals
-
void
currentNodeChanged
()
-
void
modelChanged
()
-
void
selectionChanged
() Triggered when the selection have changed.
-
void
viewOptionChanged
() Triggered when some view options have changed.
Private Functions
-
void
_set_model
()
Private Members
-
std::shared_ptr<sh::filesystem::FilesystemModelFileviewProxy>
_model
-
qint64
_id
-
FileViewMode
_viewmode
= FileViewMode::ListView
-
sh::filesystem::SizeFormatting
_sizeformatting
= sh::filesystem::SizeFormatting::SizeFormattingModePrefixes
-
int
_iconDimension
= 20
-
int
_sortColumn
= 0
-
Qt::SortOrder
_sortOrder
= Qt::SortOrder::AscendingOrder
-
std::shared_ptr<sh::filesystem::FilesystemNode>
_selectedNode
-
QList<std::shared_ptr<sh::filesystem::FilesystemNode>>
_checkedNodes
-
WebFileViewManager *
_manager
Friends
- friend class WebFileViewManager
-
-
class
WebFileViewManager
: public QObject, public sh::ui::web::WebModule - #include <webfileview.h>
Manages WebFileView instances.
Public 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.
-
std::shared_ptr<WebFileView>
addFileView
(bool reinitialize)
-
void
setCurrentFileViewByIndex
(int idx)
-
sh::ui::web::WebFileView *
currentFileView
()
-
int
fileViewCount
()
-
void
removeFileView
(int i)
-
sh::ui::web::WebFileView *
getFileView
(int i)
-
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).
Signals
-
void
activeSelectionChanged
()
-
void
fileViewOptionsChanged
(int i)
-
void
fileViewCountChanged
()
-
void
currentFileViewChanged
()
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 slot
cmd_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 Slots
-
void
cmd__checkednodes_changed__M
(WebServerEngineRequest *request)
-
void
cmd__focus_current__M
(WebServerEngineRequest *request)
-
void
cmd__get__M
(WebServerEngineRequest *request)
-
void
cmd__list_view_items__M
(WebServerEngineRequest *request)
-
void
cmd__node_activated__M
(WebServerEngineRequest *request)
-
void
cmd__selection_changed__M
(WebServerEngineRequest *request)
-
bool
-
class
WebI18n
- #include <webi18n.h>
Web related helpers for internationalization/translations.
Public Static Functions
-
QString
get
() Returns the Javascript representation for translated strings (in current ui language).
-
QString
-
class
WebLogViewDialog
: public QObject, public sh::ui::web::WebDialog, public sh::ui::LogViewDialog - #include <weblogviewdialog.h>
Web based log view dialog.
Public Functions
-
WebLogViewDialog
(QString headtext, QString subheadtxt, sh::base::LogSeverity minseverity)
-
QVariant
dialogProperty
(QString dlgPropertyKey, QVariant deflt = QVariant()) Returns a dialog property value by key.
-
void
setDialogProperty
(QString dlgPropertyKey, QVariant value) Sets a dialog property value for a key.
-
QVariantHash
dialogResult
() Returns the dialog result as hash.
The browser side of a web dialog can ‘accept’ a dialog while closing by setting a non-empty dialog result. This mechanism allows browser side dialogs to return data to the backend. It’s up to the backend to interpret the content of this hash.
If the dialog was cancelled, or is still open, the returned hash is empty. See also wasClosed().
-
void
triggerDialogEvent
(QString name, QJsonObject data = QJsonObject()) Triggers a dialog event (at the browsers).
They in turn typically fetch some data again in order to refresh the ui.
-
void
setCloseableByUser
(bool v = true) Sets if this dialog shall be directly closeable by the user by the window decoration. Set to
false
if the user has to react on this dialog by clicking on some controls in the dialog body.This method must be called during construction.
-
bool
isCloseableByUser
() Returns if this dialog shall be directly closeable by the user by the window decoration.
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
-
QString
headtext
() Returns the header text.
-
QString
subheadtxt
() Returns the 2nd header text.
-
sh::base::LogSeverity
minimumSeverity
() Returns the minimum severity.
-
qint64
dialogId
() Returns the dialog id.
Each instance has an id unique in the complete Shallot process lifetime.
Must be called in main thread.
-
bool
isInited
() Returns if this dialog is initialized.
Must be called in main thread.
-
bool
wasAccepted
() Returns if this dialog was ‘accepted’ by the user (typically by clicking some ‘OK’ button).
Must be called in main thread.
-
void
waitClosed
() Wait until the user closed the dialog in some way.
May be called in any thread.
-
void
close
() Closes the dialog.
Must be called in main thread.
-
bool
wasClosed
() Returns if this dialog was closed.
Must be called in main thread.
-
DialogManager *
manager
() Returns the DialogManager which hosts this dialog.
Private Slots
-
void
cmd__get_messages
(WebServerEngineRequest *request)
-
-
class
WebMainWindow
: public QObject, public sh::ui::MainWindow, public sh::ui::web::WebModule - #include <webmainwindow.h>
The web main window implementation.
Public Functions
-
WebMainWindow
(QString dispatcherUrl, QByteArray wtoken)
-
~WebMainWindow
()
-
WebServerEngine *
webserver
() Returns the WebServerEngine instance for this main window.
-
void
initialize
() override Initializes this main window. .
-
std::shared_ptr<DialogManager>
dialogManager
() override Returns the DialogManager which creates and drives
Dialog
s for this main window.You typically should not need to use it directly.
-
int
fileViewCount
() override Returns the current number of file views. .
-
void
addFileView
(bool reinitialize = false) override Adds a new file view. .
-
void
removeFileView
(int i) override Removes a file view. .
-
sh::ui::FileView *
currentFileView
() override Returns the file view which is currently active (i.e. focussed). .
Let the current view jump to another location. .
-
std::shared_ptr<sh::filesystem::FilesystemNode>
currentDirectory
() override Gets the sh::filesystem::FilesystemNode selected in the current view. .
-
void
setTitlePattern
(QString value) override Sets the window title pattern. .
-
void
setTreeVisible
(bool v) override Sets the visibility of the directory tree. .
-
void
setTreeSticky
(bool v) override Sets if the directory tree should follow the active file view. .
-
void
setFileDetailsPanelVisible
(bool v) override Sets the visibility of the file details panel. .
-
std::shared_ptr<sh::ui::ActionExecutionInfoPanel>
addInfoPanel
(int position, sh::actions::ActionExecutionInfo *info, QColor color = QColor()) override Creates a new action execution panel.
Let this smart pointer die for removing it.
-
void
jumpbarSetTextMode
() override Sets the jumpbar to text input mode. .
-
void
jumpbarSetButtonMode
() override Sets the jumpbar to button mode. .
-
bool
jumpbarIsTextMode
() override Returns if the jumpbar is in text input mode. .
-
QString
toolbarPosition
() override Returns the current toolbar position. .
-
void
setToolbarPosition
(QString pos) override Sets the toolbar position. .
-
QString
detailPanelPosition
() override Returns the current detail panel position. .
-
void
setDetailPanelPosition
(QString pos) override Sets the detail panel position. .
-
std::shared_ptr<AboutDialog>
showAboutDialog
() override Shows and returns an ‘About’ dialog. .
-
std::shared_ptr<ManageProfilesDialog>
showManageProfilesDialog
() override Shows and returns a ‘Manage Saved Settings’ dialog. .
Shows and returns a ‘Open With’ dialog. .
Shows and returns a ‘Save Settings’ dialog. .
-
std::shared_ptr<TuningDialog>
showTuningDialog
() override Shows and returns a ‘Tuning’ dialog. .
-
std::shared_ptr<LogViewDialog>
showLogViewDialog
(QString headtext = QString(), QString subheadtxt = QString(), sh::base::LogSeverity minseverity = sh::base::LogSeverity::_DEFAULT) override Shows and returns a ‘Log’ dialog. .
-
std::shared_ptr<ManageBookmarksDialog>
showManageBookmarksDialog
() override Shows and returns a ‘Manage Bookmarks’ dialog. .
Shows and returns a ‘File Properties’ dialog. .
-
std::shared_ptr<ActionExecutionInfoDialog>
createActionExecutionInfoDialog
(sh::actions::ActionExecutionInfo *info) override Creates an action execution dialog. .
-
void
handleCloseAppRejected
(QString rejectmsg) override React on a rejected application close request (with some feedback message). .
-
void
_initialize
(sh::base::SingletonInitializer *singletonInitializer) Initializes the main window. For custom initialization logic, see MainWindow.initialize. .
-
void
fileViewsReloadAll
() Reload all content in each file view.
-
void
onFileViewOptionsChanged
(std::function<void(int)> fct, QObject *owner = 0, ) Sets a handler for some view options in a file view changed (optionally bound to an owner lifetime).
-
void
onCurrentFileViewChanged
(std::function<void()> fctQObject *owner = 0, ) Sets a handler for the currently active file view changed (optionally bound to an owner lifetime).
-
void
onFileViewCountChanged
(std::function<void()> fctQObject *owner = 0, ) Sets a handler for the number of file views changed (optionally bound to an owner lifetime).
-
void
onCurrentDirectoryChanged
(std::function<void()> fctQObject *owner = 0, ) Sets a handler for the current directory in the active file view changed (optionally bound to an owner lifetime).
-
void
onGlobalViewOptionsChanged
(std::function<void()> fctQObject *owner = 0, ) Sets a handler for some global view options changed (optionally bound to an owner lifetime).
-
void
onCurrentProfileChanged
(std::function<void()> fctQObject *owner = 0, ) Sets a handler for the current profile changed (optionally bound to an owner lifetime).
Let the current view jump to another location. .
-
QString
titlePattern
() Returns the window title pattern.
-
void
setCurrentProfile
(QString profile) Sets the current profile. .
-
QString
currentProfile
() Returns the current profile.
-
void
reloadProfile
() Reloads the profile data.
-
bool
treeVisible
() Returns the visibility of the directory tree.
-
bool
treeSticky
() Returns if the directory tree follows the active file view.
-
bool
fileDetailsPanelVisible
() Returns the visibility of the file details panel.
-
std::shared_ptr<sh::ui::ActionExecutionInfoPanel>
addInfoPanel
(sh::actions::ActionExecutionInfo *info, QColor color = QColor()) Creates a new action execution panel.
Let this smart pointer die for removing it.
-
std::shared_ptr<ActionExecutionInfoPanel>
showErrorPanel
() Shows an error panel.
-
void
_closeDirectly
() Directly begin application shutdown without checks.
-
bool
closeApp
() Check if the application may shut down now, and if so, initiate it.
-
bool
isCloseable
(QString *msg = nullptr) Check if the application may shut down now.
-
void
handleClosed
() Do some cleanup steps just when closing starts. Implementations must call base implementation!
-
bool
isClosing
() Returns if the application is currently closing.
-
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. .
Public Static Functions
-
bool
tryCreateMainWindow
(MainWindow *&mainWindow)
-
WebMainWindow *
mainWindow
()
-
void
openUrlOnDesktop
(QUrl url) Opens a url on the user desktop, typically in the browser.
Note: It obeys the ‘openbrowser’ ui parameter.
-
void
setMainWindow
(MainWindow *mainWindow) Sets the main window instance. .
-
bool
isReady
() Returns if this process ui is ready (i.e. is created or runs headless).
-
bool
runsHeadless
() Returns if this process runs headless, i.e. without any ui, just for a background process.
-
void
_closeDirectly
(sh::base::SingletonInitializer *singletonInitializer)
-
QString
uiMode
() Returns the UI mode (e.g. qt, web).
-
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 slot
cmd_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<sh::ui::web::WebActionManager>
actionManager
()
-
void
setCloseable
(bool closeable, QString message = QString()) override Sets the closeable state and message.
Private Members
-
bool
_treeSticky
= true
-
bool
_detailsPanelVisible
= true
-
QString
_currentProfile
-
WebServerEngine *
_webserver
-
std::shared_ptr<sh::filesystem::FilesystemNode>
_currentDirectory
= 0
-
std::shared_ptr<WebActionManager>
_actionManager
-
std::shared_ptr<WebDetailPanelManager>
_detailPanelManager
-
std::shared_ptr<WebDialogManager>
_dialogManager
-
std::shared_ptr<WebFileViewManager>
_fileViewManager
-
QString
_lastCloseableState
Private Slots
-
void
cmd_filesystem_get_icon
(WebServerEngineRequest *request)
-
void
cmd_filesystem_list_items
(WebServerEngineRequest *request)
-
void
cmd_log_as_text
(WebServerEngineRequest *request)
-
void
cmd_log_log_message
(WebServerEngineRequest *request)
-
void
cmd_mainwindow_set_current_directory
(WebServerEngineRequest *request)
-
void
cmd_mainwindow_shallot_icon
(WebServerEngineRequest *request)
-
void
cmd_mainwindow_show_logview
(WebServerEngineRequest *request)
Private Static Attributes
-
WebMainWindow *
_webMainWindow
= nullptr
Friends
- friend class WebFileViewManager
- friend class WebActionExecutionInfoPanel
- friend class WebActionExecutionInfoDialog
- friend class WebDetailPanelManager
-
-
class
WebManageBookmarksDialog
: public QObject, public sh::ui::web::WebDialog, public sh::ui::ManageBookmarksDialog - #include <webmanagebookmarksdialog.h>
Web based manage bookmarks dialog.
Public Functions
-
WebManageBookmarksDialog
()
-
QVariant
dialogProperty
(QString dlgPropertyKey, QVariant deflt = QVariant()) Returns a dialog property value by key.
-
void
setDialogProperty
(QString dlgPropertyKey, QVariant value) Sets a dialog property value for a key.
-
QVariantHash
dialogResult
() Returns the dialog result as hash.
The browser side of a web dialog can ‘accept’ a dialog while closing by setting a non-empty dialog result. This mechanism allows browser side dialogs to return data to the backend. It’s up to the backend to interpret the content of this hash.
If the dialog was cancelled, or is still open, the returned hash is empty. See also wasClosed().
-
void
triggerDialogEvent
(QString name, QJsonObject data = QJsonObject()) Triggers a dialog event (at the browsers).
They in turn typically fetch some data again in order to refresh the ui.
-
void
setCloseableByUser
(bool v = true) Sets if this dialog shall be directly closeable by the user by the window decoration. Set to
false
if the user has to react on this dialog by clicking on some controls in the dialog body.This method must be called during construction.
-
bool
isCloseableByUser
() Returns if this dialog shall be directly closeable by the user by the window decoration.
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
-
qint64
dialogId
() Returns the dialog id.
Each instance has an id unique in the complete Shallot process lifetime.
Must be called in main thread.
-
bool
isInited
() Returns if this dialog is initialized.
Must be called in main thread.
-
bool
wasAccepted
() Returns if this dialog was ‘accepted’ by the user (typically by clicking some ‘OK’ button).
Must be called in main thread.
-
void
waitClosed
() Wait until the user closed the dialog in some way.
May be called in any thread.
-
void
close
() Closes the dialog.
Must be called in main thread.
-
bool
wasClosed
() Returns if this dialog was closed.
Must be called in main thread.
-
DialogManager *
manager
() Returns the DialogManager which hosts this dialog.
Private Slots
-
void
cmd__add_bookmark__M
(WebServerEngineRequest *request)
-
void
cmd__delete_bookmark
(WebServerEngineRequest *request)
-
void
cmd__get
(WebServerEngineRequest *request)
-
void
cmd__move_bookmark_down
(WebServerEngineRequest *request)
-
void
cmd__move_bookmark_to_folder
(WebServerEngineRequest *request)
-
void
cmd__move_bookmark_up
(WebServerEngineRequest *request)
-
void
cmd__store
(WebServerEngineRequest *request)
-
-
class
WebManageProfilesDialog
: public QObject, public sh::ui::web::WebDialog, public sh::ui::ManageProfilesDialog - #include <webmanageprofilesdialog.h>
Web based manage saved settings dialog.
Public Functions
-
WebManageProfilesDialog
()
-
QVariant
dialogProperty
(QString dlgPropertyKey, QVariant deflt = QVariant()) Returns a dialog property value by key.
-
void
setDialogProperty
(QString dlgPropertyKey, QVariant value) Sets a dialog property value for a key.
-
QVariantHash
dialogResult
() Returns the dialog result as hash.
The browser side of a web dialog can ‘accept’ a dialog while closing by setting a non-empty dialog result. This mechanism allows browser side dialogs to return data to the backend. It’s up to the backend to interpret the content of this hash.
If the dialog was cancelled, or is still open, the returned hash is empty. See also wasClosed().
-
void
triggerDialogEvent
(QString name, QJsonObject data = QJsonObject()) Triggers a dialog event (at the browsers).
They in turn typically fetch some data again in order to refresh the ui.
-
void
setCloseableByUser
(bool v = true) Sets if this dialog shall be directly closeable by the user by the window decoration. Set to
false
if the user has to react on this dialog by clicking on some controls in the dialog body.This method must be called during construction.
-
bool
isCloseableByUser
() Returns if this dialog shall be directly closeable by the user by the window decoration.
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
-
qint64
dialogId
() Returns the dialog id.
Each instance has an id unique in the complete Shallot process lifetime.
Must be called in main thread.
-
bool
isInited
() Returns if this dialog is initialized.
Must be called in main thread.
-
bool
wasAccepted
() Returns if this dialog was ‘accepted’ by the user (typically by clicking some ‘OK’ button).
Must be called in main thread.
-
void
waitClosed
() Wait until the user closed the dialog in some way.
May be called in any thread.
-
void
close
() Closes the dialog.
Must be called in main thread.
-
bool
wasClosed
() Returns if this dialog was closed.
Must be called in main thread.
-
DialogManager *
manager
() Returns the DialogManager which hosts this dialog.
Private Slots
-
void
cmd__get__M
(WebServerEngineRequest *request)
-
void
cmd__icon
(WebServerEngineRequest *request)
-
void
cmd__remove_node__M
(WebServerEngineRequest *request)
-
void
cmd__remove_profile__M
(WebServerEngineRequest *request)
-
-
class
WebModule
- #include <webmodule.h>
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 slot
cmd_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
-
-
class
WebOpenWithDialog
: public QObject, public sh::ui::web::WebDialog, public sh::ui::OpenWithDialog - #include <webopenwithdialog.h>
Web based open with dialog.
Public Functions
-
std::shared_ptr<sh::tools::filetypes::OpenMethod>
chosenMethod
() override Returns the chosen open-method (program for opening the file).
-
bool
rememberForMimetype
() override Returns if the chosen method is checked to be remembered for the same mime-type in the future.
-
std::shared_ptr<const sh::filesystem::Eurl>
rememberForDirectory
() override If it’s checked for the chosen method to be remembered for some subdirectory in the future, it returns the Eurl of this subdirectory, otherwise
nullptr
.
-
bool
rememberForFile
() override Returns if the chosen method is checked to be remembered for the same file in the future.
-
QVariant
dialogProperty
(QString dlgPropertyKey, QVariant deflt = QVariant()) Returns a dialog property value by key.
-
void
setDialogProperty
(QString dlgPropertyKey, QVariant value) Sets a dialog property value for a key.
-
QVariantHash
dialogResult
() Returns the dialog result as hash.
The browser side of a web dialog can ‘accept’ a dialog while closing by setting a non-empty dialog result. This mechanism allows browser side dialogs to return data to the backend. It’s up to the backend to interpret the content of this hash.
If the dialog was cancelled, or is still open, the returned hash is empty. See also wasClosed().
-
void
triggerDialogEvent
(QString name, QJsonObject data = QJsonObject()) Triggers a dialog event (at the browsers).
They in turn typically fetch some data again in order to refresh the ui.
-
void
setCloseableByUser
(bool v = true) Sets if this dialog shall be directly closeable by the user by the window decoration. Set to
false
if the user has to react on this dialog by clicking on some controls in the dialog body.This method must be called during construction.
-
bool
isCloseableByUser
() Returns if this dialog shall be directly closeable by the user by the window decoration.
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
-
std::shared_ptr<sh::filesystem::FilesystemNode>
node
() Returns the file node which is later to be opened.
-
QList<std::shared_ptr<tools::filetypes::OpenMethod>>
openMethods
() Returns the open-methods (programs for opening the file) to present for choice.
-
qint64
dialogId
() Returns the dialog id.
Each instance has an id unique in the complete Shallot process lifetime.
Must be called in main thread.
-
bool
isInited
() Returns if this dialog is initialized.
Must be called in main thread.
-
bool
wasAccepted
() Returns if this dialog was ‘accepted’ by the user (typically by clicking some ‘OK’ button).
Must be called in main thread.
-
void
waitClosed
() Wait until the user closed the dialog in some way.
May be called in any thread.
-
void
close
() Closes the dialog.
Must be called in main thread.
-
bool
wasClosed
() Returns if this dialog was closed.
Must be called in main thread.
-
DialogManager *
manager
() Returns the DialogManager which hosts this dialog.
Private Slots
-
void
cmd__check_another_ancestor__M
(WebServerEngineRequest *request)
-
void
cmd__check_custom_opener__M
(WebServerEngineRequest *request)
-
void
cmd__open_method_icon__M
(WebServerEngineRequest *request)
-
void
cmd__open_methods__M
(WebServerEngineRequest *request)
-
std::shared_ptr<sh::tools::filetypes::OpenMethod>
-
class
WebServerEngine
- #include <webserverengine.h>
Abstract base class for a web server engine.
Such an engine implements an http server which a browser can connect to.
Public Functions
-
WebServerEngine
(bool withMainModule, int minport, int maxport, QString externalUrl, QString dispatcherUrl, QByteArray wtoken)
-
~WebServerEngine
()
-
QUrl
url
() = 0 Returns the home url of this engine (where the end user can point the browser to). .
-
QUrl
externalUrl
() Returns the external root url for creating full externally valid urls (even behind reverse proxies).
Returns url() if no external root url is specified.
Change this by the cmdline parameter
'externalUrl'
.
-
QUrl
dispatcherUrl
() Returns the internal root url of the dispatcher (workers only).
-
QByteArray
dispatcherWtoken
() Returns the wtoken got from the dispatcher (workers only).
-
QUrl
getFullCommandUrl
(QString command, WebCommandData data, bool external) Generates a url path for a command.
Typically only needed for full url generation on server side.
-
void
triggerEvent
(QString name, QJsonObject data) Triggers an event (at the clients).
-
void
triggerEvent
(QString name, QJsonValue data = QJsonValue::Undefined)
-
QString
getConfigValue
(QString key) Returns the value for a runtime configuration key.
-
void
setConfigValue
(QString key, QString value) Sets the runtime configuration key to a value (triggering a event updating the clients).
-
void
getStaticFile
(WebServerEngineRequest *request, QString path) Returns a static file content (for the app itself) on a request.
-
QUrl
rebaseUrl
(QUrl rootUrl, QUrl url) Returns a url rebased to another engine’s root url.
Used for dispatching to workers.
Plugs a WebModule into the engine and holds a pointer to it. Unplug it by calling removeModule().
Plugs a WebModule into the engine. Unplug it by either delete
module
(drop all pointers to it) or by calling removeModule().
-
qint64
currentTimestamp
() Returns the current engine timestamp.
It’s not related to real time, but just a value which is higher each time you query it.
This is used for coordination of some time-order sensitive operations on browser side.
Public Static Functions
-
WebServerEngine *
createDispatcherEngine
() Creates and returns a web engine for a dispatcher.
-
WebServerEngine *
createWorkerEngine
(QString dispatcherUrl, QByteArray wtoken) Creates and returns a web engine for a worker.
- Parameters
dispatcherUrl
: The root url of the dispatcher.
Private Members
-
const QJsonObject
_jok
-
QMutex
_configValuesMutex
-
QMutex
_modulesMutex
-
int
_minport
-
int
_maxport
-
QUrl
_externalurl
-
QUrl
_dispatcherurl
-
QMap<QString, QString>
_configValues
-
std::shared_ptr<sh::ui::web::WebServerEngineMainModule>
_mainmodule
-
QString
_webstaticpath
-
qint64
_currentTimestamp
= 1
-
QByteArray
_wtoken
Private Static Functions
-
WebServerEngine *
_createEngine
(bool withMainModule, QString dispatcherUrl, QByteArray wtoken)
Friends
- friend class WebServerEngineMainModule
-
-
class
WebServerEngineDispatcher
: public QObject, public sh::ui::web::WebModule - #include <webserverenginedispatcher.h>
The web serve engine dispatcher module, used in dispatcher mode for providing a portal url which starts Shallot instances on request and internally redirects to them.
Public Functions
-
WebServerEngineDispatcher
()
-
~WebServerEngineDispatcher
()
-
void
stop
() Stops the dispatcher.
-
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
-
WebMainWindow *
handleDispatching
(std::function<WebMainWindow*(QString dispatcherUrl, QByteArray wtoken)> createWndFct) Handles dispatching and creates a new main window (in child processes) on demand via a given factory function.
-
void
doInitialize
()
-
void
doShutdown
()
-
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 slot
cmd_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
compareHashRedirectorWebworkerUrl
(QByteArray hash, QString url, QString wtoken) Compares a hash for a redirector webworker url to other data.
-
WorkerProcess *
spawnNewWorker
(WebServerEngineRequest *request) Spawns a new worker.
Does not execute any requests on it.
-
WorkerProcess *
findWorkerForWtoken
(QString wtoken) Returns the worker for a wtoken.
-
QString
wtokenFromRequestCookie
(WebServerEngineRequest *request) Returns the wtoken from a request (typically from cookie).
-
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.
-
bool
rootCommand
(WebServerEngineRequest *request, QString webadapter) override Returns the root (‘index.html’) content. .
Private Members
-
std::shared_ptr<WebServerEngine>
_webserver
-
QMutex
_workersmutex
-
QHash<QString, WorkerProcess*>
_workers
-
JanitorThread
_janitor
Private Slots
-
void
cmd__drop_worker__M
(WebServerEngineRequest *request)
-
void
cmd__set_last_user_activity
(WebServerEngineRequest *request)
-
void
cmd__set_prevent_close_message
(WebServerEngineRequest *request)
-
void
cmd__working_for
(WebServerEngineRequest *request)
Private Static Functions
-
void
start
(QUrl &url) Starts the dispatcher engine, accepting http connections and internally handling child processes.
-
QByteArray
hashRedirectorWebworkerUrl
(QString url, QString wtoken) Compute a hash for a redirector webworker url.
Private Static Attributes
-
std::shared_ptr<WebServerEngineDispatcher>
_dispatcher
= nullptr
-
QString
_dispatcherId
= QString::fromLatin1(sh::tools::Misc::generateUniqueHash())
-
QString
_dispatcherCookieName
= QUrl::toPercentEncoding(QString("shallot_%1").arg(_dispatcherId).toLocal8Bit())
-
class
JanitorThread
: public QThread -
Private Functions
-
qint64
machineMemory
() Returns the amount of memory this machine provides (in bytes).
Returns -1 if this is not supported on the target platform or it failed.
-
void
stopWorker
(WorkerProcess *worker, QString reason)
-
int
detectGoodMaxNumberWorkersByMachineCapabilities
()
-
QList<WorkerProcess*>
stopWorkers
(QList<WorkerProcess*> workers, int stopcount, QString reason)
Private Members
-
WebServerEngineDispatcher *
_dispatcher
-
double
_allMemory
-
QHash<WorkerProcess*, double>
_workerMemoryUsagesLastSeconds
-
qint64
-
class
WorkerProcess
: public QProcess A internal Shallot worker process driving one Shallot session.
Public Functions
-
QByteArray
wtoken
() The wtoken (used for association and security).
-
QUrl
rootUrl
() The worker root url.
-
void
request
(WebServerEngineRequest *request) Make a request to the worker.
-
qint64
workerPid
() Returns the process id of the worker.
-
qint64
memoryUsage
() Returns the current memory usage of this worker (in bytes).
Returns -1 if this is not supported on the target platform or it failed.
-
QDateTime
lastBrowserHeartbeat
() Returns when a browser was seen connected to this worker last time.
-
QDateTime
lastUserInteraction
() Returns when a user has interacted with this worker last time.
-
QString
clientHost
() Returns the client host this worker is serving.
It’s not guaranteed to have some specific content (maybe an ip address), but is equal for the same host, some one can count how many hosts work for one particular client host.
-
QString
preventCloseMessage
() Returns a reason message why this worker currently should not be closed (or
""
if closing is fine).See also isClosingInappropriate().
Note: This is reported asynchronously. You must not rely on its precise information, but solely use it for monitoring.
-
bool
isClosingFine
() Returns if it is fine to stop this worker (or if there is a good reason to not do).
See also preventCloseMessage().
Note: This is reported asynchronously. You must not rely on its precise information, but solely use it for monitoring.
Private Functions
-
WorkerProcess
(WebServerEngineDispatcher *dispatcher, QByteArray wtoken, QString clientHost, QStringList acceptedLanguages)
-
bool
waitOnline
() Waits until the worker is online and ready for requests (or dead).
-
void
initialize
(QString rooturl, qint64 pid) Initializes the worker instance (which exists on the dispatcher side!) by setting some final data.
-
void
gotBrowserHeartbeat
() Refreshes the browser heartbeat timestamp.
-
void
gotUserInteraction
(int value) Refreshes the user interaction timestamp.
-
void
setPreventCloseMessage
(QString message) Sets the preventCloseMessage (empty: closeable).
Private Members
-
WebServerEngineDispatcher *
_dispatcher
-
QByteArray
_wtoken
-
QUrl
_rooturl
-
QMutex
_mutex
-
QWaitCondition
_cnd_inited
-
qint64
_pid
= -1
-
QDateTime
_lastBrowserHeartbeat
-
QDateTime
_lastUserInteraction
-
QString
_clientHost
-
QString
_preventCloseMessage
-
QRegularExpression
_reProcStatus
Friends
- friend class WebServerEngineDispatcher
-
QByteArray
-
-
class
WebServerEngineMainModule
: public QObject, public sh::ui::web::WebModule - #include <webserverengine.h>
The web serve engine main module, providing some base services like events.
Public Functions
-
WebServerEngineMainModule
()
-
~WebServerEngineMainModule
()
-
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.
-
bool
rootCommand
(WebServerEngineRequest *request, QString webadapter) override Returns the root (‘index.html’) content. .
-
void
triggerEvent
(QString name, QString data) Triggers an event on browser side.
-
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 slot
cmd_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
-
qint64
lastRequestTime
()
Private Members
-
qint64
_lastRequestTime
-
QMutex
_mutex_lastRequestTime
-
QList<EventEntry*>
_eventEntries
-
quint64
_eventEntriesLastId
= 0
-
QMutex
_mutex_eventEntries
-
QWaitCondition
_eventEntriesCondition
-
EventEntryCleanupThread
_eventEntryCleanupThread
-
StopWhenIdleThread
_stopWhenIdleThread
Private Slots
-
void
cmd_dispatcher_toclient_heartbeat
(WebServerEngineRequest *request)
-
void
cmd_events_get_next
(WebServerEngineRequest *request)
Private Static Attributes
-
QRegularExpression
_restatic
-
class
EventEntry
Data for one occurred event.
Public Functions
-
EventEntry
(qint64 id, qint64 time, QString name, QString data)
Public Members
-
const qint64
id
-
const qint64
time
-
const QString
name
-
const QString
data
Friends
- friend class EventEntryCleanupThread
-
-
class
EventEntryCleanupThread
: public QThread Thread for cleaning up old EventEntry instances.
Public Functions
-
EventEntryCleanupThread
(WebServerEngineMainModule *module)
Private Members
-
WebServerEngineMainModule *
module
-
-
class
StopWhenIdleThread
: public QThread Thread for stopping the application if the remote side is gone.
Public Functions
-
StopWhenIdleThread
(WebServerEngineMainModule *module)
Private Members
-
WebServerEngineMainModule *
module
-
-
-
class
WebServerEngineRequest
- #include <webserverengine.h>
A web request in a WebServerEngine.
Override this together with WebServerEngine.
Public Functions
-
WebServerEngineRequest
(QString url, QString clientHost)
-
QUrl
url
() Returns the requested url.
Note: The url should be considered as opaque, since the exact structure depends on the engine implementation.
-
QString
clientHost
() Returns the client host address.
-
QString
path
() Returns the path part of the requested url.
Note: The url should be considered as opaque, since the exact structure depends on the engine implementation.
-
QString
data
(QString key) Returns data passed as parameter along with the request by
key
.
-
int
responseCode
() Returns the answered (http) response code.
-
QString
responseMimeType
() Returns the mimetype of the answer content.
-
QByteArray
response
() Returns the answer content.
-
bool
responseSet
() Returns if a response was set.
-
void
setResponse
(QByteArray response, QString mimetype, int responseCode = HTTP_OK) Sets the response.
-
void
setResponse
(QJsonArray response, int responseCode = HTTP_OK)
-
void
setResponse
(QJsonObject response, int responseCode = HTTP_OK)
-
QString
headerData
(QString key) = 0 Returns an http header value by key. .
-
QString
getCookie
(QString key) = 0 Returns an http cookie stored on browser side.
Note: This only works on dispatcher level and not in usual WebModule commands.
-
void
setCookie
(QString key, QString value, int maxAgeSecs = -1) = 0 Sets an http cookie to be returned to the browser side.
Note: This only works on dispatcher level and not in usual WebModule commands.
Public Static Attributes
-
const int
HTTP_OK
= 200
-
const int
HTTP_SEE_OTHER
= 303
-
const int
HTTP_NOT_FOUND
= 404
-
const int
HTTP_INTERNAL_SERVER_ERROR
= 500
-
const int
HTTP_BAD_GATEWAY
= 502
Private Members
-
QUrl
_url
-
QString
_clientHost
-
QString
_path
-
QMap<QString, QString>
_getdata
-
int
_responseCode
= HTTP_NOT_FOUND
-
QString
_responseMimeType
= "application/octet-stream"
-
QByteArray
_response
-
bool
_responseSet
= false
-
-
class
WebStoreProfileDialog
: public QObject, public sh::ui::web::WebDialog, public sh::ui::StoreProfileDialog - #include <webstoreprofiledialog.h>
Web based save settings dialog.
Public Functions
-
QList<SettingEntry>
checkedSettings
() override Returns the list of settings the user has checked to store.
-
QString
profileName
() override Returns the profile the user has chosen to store settings for.
-
bool
withSubDirectories
() override Returns if the user has chosen to apply the checked settings also for subdirectories.
-
QStringList
inheritsFrom
() override Returns the list of profiles the user has chosen to inherit from.
-
bool
hasGlobal
() override Returns if the user has chosen to apply the checked settings for each directory (instead of the current directory).
-
QVariant
dialogProperty
(QString dlgPropertyKey, QVariant deflt = QVariant()) Returns a dialog property value by key.
-
void
setDialogProperty
(QString dlgPropertyKey, QVariant value) Sets a dialog property value for a key.
-
QVariantHash
dialogResult
() Returns the dialog result as hash.
The browser side of a web dialog can ‘accept’ a dialog while closing by setting a non-empty dialog result. This mechanism allows browser side dialogs to return data to the backend. It’s up to the backend to interpret the content of this hash.
If the dialog was cancelled, or is still open, the returned hash is empty. See also wasClosed().
-
void
triggerDialogEvent
(QString name, QJsonObject data = QJsonObject()) Triggers a dialog event (at the browsers).
They in turn typically fetch some data again in order to refresh the ui.
-
void
setCloseableByUser
(bool v = true) Sets if this dialog shall be directly closeable by the user by the window decoration. Set to
false
if the user has to react on this dialog by clicking on some controls in the dialog body.This method must be called during construction.
-
bool
isCloseableByUser
() Returns if this dialog shall be directly closeable by the user by the window decoration.
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
-
std::shared_ptr<const sh::filesystem::Eurl>
eurl
() Returns the current directory this dialog shall work on.
-
qint64
dialogId
() Returns the dialog id.
Each instance has an id unique in the complete Shallot process lifetime.
Must be called in main thread.
-
bool
isInited
() Returns if this dialog is initialized.
Must be called in main thread.
-
bool
wasAccepted
() Returns if this dialog was ‘accepted’ by the user (typically by clicking some ‘OK’ button).
Must be called in main thread.
-
void
waitClosed
() Wait until the user closed the dialog in some way.
May be called in any thread.
-
void
close
() Closes the dialog.
Must be called in main thread.
-
bool
wasClosed
() Returns if this dialog was closed.
Must be called in main thread.
-
DialogManager *
manager
() Returns the DialogManager which hosts this dialog.
Private Slots
-
void
cmd__get__M
(WebServerEngineRequest *request)
-
void
cmd__store_mode__M
(WebServerEngineRequest *request)
-
QList<SettingEntry>
-
class
WebTuningDialog
: public QObject, public sh::ui::web::WebDialog, public sh::ui::TuningDialog - #include <webtuningdialog.h>
Web based tuning dialog.
Public Functions
-
WebTuningDialog
()
-
QVariant
dialogProperty
(QString dlgPropertyKey, QVariant deflt = QVariant()) Returns a dialog property value by key.
-
void
setDialogProperty
(QString dlgPropertyKey, QVariant value) Sets a dialog property value for a key.
-
QVariantHash
dialogResult
() Returns the dialog result as hash.
The browser side of a web dialog can ‘accept’ a dialog while closing by setting a non-empty dialog result. This mechanism allows browser side dialogs to return data to the backend. It’s up to the backend to interpret the content of this hash.
If the dialog was cancelled, or is still open, the returned hash is empty. See also wasClosed().
-
void
triggerDialogEvent
(QString name, QJsonObject data = QJsonObject()) Triggers a dialog event (at the browsers).
They in turn typically fetch some data again in order to refresh the ui.
-
void
setCloseableByUser
(bool v = true) Sets if this dialog shall be directly closeable by the user by the window decoration. Set to
false
if the user has to react on this dialog by clicking on some controls in the dialog body.This method must be called during construction.
-
bool
isCloseableByUser
() Returns if this dialog shall be directly closeable by the user by the window decoration.
-
QJsonObject
toJson
() override Returns the json respesentation as QJsonObject.
-
qint64
dialogId
() Returns the dialog id.
Each instance has an id unique in the complete Shallot process lifetime.
Must be called in main thread.
-
bool
isInited
() Returns if this dialog is initialized.
Must be called in main thread.
-
bool
wasAccepted
() Returns if this dialog was ‘accepted’ by the user (typically by clicking some ‘OK’ button).
Must be called in main thread.
-
void
waitClosed
() Wait until the user closed the dialog in some way.
May be called in any thread.
-
void
close
() Closes the dialog.
Must be called in main thread.
-
bool
wasClosed
() Returns if this dialog was closed.
Must be called in main thread.
-
DialogManager *
manager
() Returns the DialogManager which hosts this dialog.
Private Members
-
QMutex
_cfgvaluesmutex
-
QWaitCondition
_cfgvaluescondition
-
bool
_cfgvaluesinited
= false
-
QList<std::shared_ptr<sh::configuration::ConfigurationValue>>
_cfgvalues
Private Slots
-
void
cmd__change_configurationvalue
(WebServerEngineRequest *request)
-
void
cmd__get_configurationvalues
(WebServerEngineRequest *request)
Private Static Functions
-
QString
categoryToName
(sh::configuration::ConfigurationCategory category)
-
QString
valueTypeToName
(sh::configuration::ConfigurationValueType *valueType)
-
-
namespace
engines
Web server low-level engine implementations.
-
typedef QPair<QIcon, int>