Class sh::ui::web::WebFilePropertyDialog

class sh::ui::web::WebFilePropertyDialog : public QObject, public sh::ui::web::WebDialog, public sh::ui::FilePropertyDialog

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(QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes)
~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.

sh::ui::FilePropertyDialogTabActionsView *widgetAt(std::shared_ptr<FilePropertyDialogTab> tab, int i)

Returns the widget from a tab at a certain index.

int widgetCount(std::shared_ptr<FilePropertyDialogTab> tab)

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

void addTabFactory(int i, std::shared_ptr<FilePropertyDialogTabFactory> factory)

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 Members

int _cookie = 0
QTimer _refreshTimer
QList<WebFilePropertyDialogChild*> _childs

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.

QList<QString> buttons()

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