Namespace sh::ui

namespace sh::ui

User interface.

This is the presentation layer. The classes directly from here are abstract; often even technically, but clearly from conceptual perspective. Find non-abstract user interface implementations in sub-namespaces.

Typedefs

typedef QList<sh::ui::FilePropertyDialogTabActionsView*> TabViewStructWidgets
typedef QPair<std::shared_ptr<sh::ui::FilePropertyDialogTab>, TabViewStructWidgets> TabViewStruct

Enums

enum ExceptionDialogResult

Enumeration of decisions the user can make in an ExceptionDialog.

Values:

enumerator Shutdown
enumerator Close
enumerator Cancel
enumerator Retry
enum FileViewMode

Values:

enumerator IconView
enumerator ListView
class _ActionExecutionInfoPanel_HelperQObject : public QObject
#include <actionexecutioninfopanel.h>

A helper for some signal/slot stuff of in ActionExecutionInfoPanel.

Public Functions

void _emit_clicked()
void _emit_visibilityChanged()

Signals

void clicked()
void visibilityChanged()
class _FilePropertyDialogTabActionsView_HelperQObject : public QObject
#include <filepropertydialogtabactionsview.h>

A helper for some signal/slot stuff of in FilePropertyDialogTabActionsView.

Public Functions

void _emit_buttonTriggered(int i)

Signals

void buttonTriggered(int i)
class _MainWindow_HelperQObject : public QObject
#include <mainwindow.h>

A helper for some signal/slot stuff of in MainWindow.

Public Functions

void _emit_currentDirectoryChanged()
void _emit_globalViewOptionsChanged()
void _emit_currentProfileChanged()
void _emit_currentFileViewChanged()
void _emit_fileViewCountChanged()
void _emit_fileViewOptionsChanged(int i)

Signals

void currentDirectoryChanged()
void globalViewOptionsChanged()
void currentProfileChanged()
void currentFileViewChanged()
void fileViewCountChanged()
void fileViewOptionsChanged(int)
class _SearchPanelConfiguration_HelperQObject : public QObject
#include <searchpanelconfiguration.h>

A helper for some signal/slot stuff of in SearchPanelConfiguration.

class AboutDialog : public sh::ui::Dialog
#include <aboutdialog.h>

The ‘About’ dialog.

Subclassed by sh::ui::qt::QtAboutDialog, sh::ui::web::WebAboutDialog

Public Functions

AboutDialog()
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 ActionExecutionInfoDialog : public sh::actions::ActionExecutionUserFeedback
#include <actionexecutioninfodialog.h>

Progress dialog for action executions.

Subclassed by sh::ui::qt::QtActionExecutionInfoDialog, sh::ui::web::WebActionExecutionInfoDialog

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

Public Functions

ActionExecutionInfoDialog(sh::actions::ActionExecutionInfo *info)
void setDetails(QString fv, QString fob, QString tv, QString tob) = 0

Sets the item details text (‘from a/foo.jpg’, ‘to b/foo.jpg’). .

void setHead(QString txt) = 0

Sets the header text. .

void setProgress(bool isDeterminate, quint64 done, quint64 all, QString text) = 0

Sets the progress. .

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

int messageBox(QString text, QList<QString> answers, QString icon = QString(), int defaultanswer = -1, int cancelanswer = -1, QList<QString> answericons = QList<QString>()) = 0
int inputBox(QString text, QList<QString> answers, QString *value, QString icon = QString(), int defaultanswer = -1, int cancelanswer = -1, int valuePreselectFrom = -1, int valuePreselectTo = -1) = 0
int multilineInputBox(QString text, QList<QString> answers, QString *value, QString icon = QString(), int defaultanswer = -1, int cancelanswer = -1) = 0
int simpleChooserGridform(QString text, GridformEntries *entries, QStringList answers, int defaultanswer = -1, int cancelanswer = -1) = 0
bool credentialsDialog(QString text, bool showDomain, bool showUsername, bool showPassword, bool showAnonymous, bool showRemember, QString *domain, QString *username, QString *password, bool *isAnonymous, bool *isRemember) = 0
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) = 0
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)
class ActionExecutionInfoPanel
#include <actionexecutioninfopanel.h>

Abstract class for a status bar info-panel for an action execution.

Subclassed by sh::ui::qt::QtActionExecutionInfoPanel, sh::ui::web::WebActionExecutionInfoPanel

Public Functions

void setLabel(QString s) = 0

Sets the label text. .

void setProgress(bool isProgressDeterminate, quint64 progressDone, quint64 progressAll) = 0

Sets the progress. .

void setForceForeground(bool v) = 0

Sets if the associated action is currently forced to be visible in foreground. .

void setPanelVisible(bool v) = 0

Sets if the panel is visible. .

void setWidth(int width) = 0

Sets the panel with (in pixels). .

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

~ActionExecutionInfoPanel()
class ColumnDimensions
#include <columndimensions.h>

Auxiliary data structure for persistent column dimensions.

It stores the width of a column whenever it changes and restores it when needed (mostly when Shallot starts).

Public Functions

ColumnDimensions(int index)

Constructed only by the infrastructure and made available otherwise.

void store()
bool remove()
void setWidth(QString col, int width)
int getWidth(QString col, int defaultval)

Public Members

int index

Private Functions

std::unique_ptr<QSettings> db()

Private Members

QHash<QString, int> dims
class Dialog : public std::enable_shared_from_this<Dialog>
#include <dialog.h>

Abstract subclass for Shallot dialogs (in child windows).

Subclasses of Dialog represent particular dialog types (like ManageBookmarksDialog).

For each ui mode, there typically is an implementation for all of these types, implementing one of this dialog types subclasses (mentioned before) and also some ui mode specific class.

Note: Unless stated otherwise, all methods must be called from main thread!

Note: It’s not allowed to show one web dialog instance more than once. After closing it, it’s sole use is to fetch answer data from it.

Note: You should not create instances directly. It’s required to use DialogManager::createAndShowDialog() for actually showing those dialogs. Even this should not be used directly, because call depends on the current ui mode. Use the show*() methods in sh::ui::MainWindow for creating dialogs in a ui mode independent way.

Subclassed by sh::ui::AboutDialog, sh::ui::ExceptionDialog, sh::ui::FilePropertyDialog, sh::ui::LogViewDialog, sh::ui::ManageBookmarksDialog, sh::ui::ManageProfilesDialog, sh::ui::OpenWithDialog, sh::ui::StoreProfileDialog, sh::ui::TuningDialog

Public Functions

Dialog()
~Dialog()
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 Functions

void setup(DialogManager *manager, qint64 dialogId)

Sets manager and id for this dialog (right after creation).

Private Members

DialogManager *_manager
qint64 _dialogId = -1
bool _closed = false
bool _inited = false

Friends

friend class MainWindow
friend class DialogManager
class DialogManager
#include <dialog.h>

Creates and drives dialogs (in child windows), i.e. instances of Dialog.

Subclass it for implementing the low level mechanisms for handling dialogs in a particular ui mode (e.g. qt, web).

The infrastructure will use one of this implementations for creating and managing most kinds of dialogs.

Subclassed by sh::ui::qt::QtDialogManager, sh::ui::web::WebDialogManager

Public Functions

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.

~DialogManager()

Private Functions

void closeDialog(std::shared_ptr<Dialog> dialog)

Closes this dialog, including internal bookkeeping.

Must be called in main thread.

void initAndShowDialog(std::shared_ptr<Dialog> dialog)

Initializes and shows a freshly created dialog.

Must be called in main thread.

bool wasAccepted(std::shared_ptr<Dialog> dialog) = 0

Returns if the dialog was ‘accepted’ by the user (typically by clicking some ‘OK’ button).

The result is undefined before the dialog was closed.

Must be called in main thread.

void waitClosed(std::shared_ptr<Dialog> dialog) = 0

Wait until the user closed the dialog in some way.

May be called in any thread.

void stopDialog(std::shared_ptr<Dialog> dialog) = 0

This method implements the ui mode specific mechanism for stopping (i.e. closing) a dialog.

Must be called in main thread.

void showDialog(std::shared_ptr<Dialog> dialog) = 0

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

Must be called in main thread.

Private Members

QHash<qint64, std::shared_ptr<Dialog>> _openDialogs
qint64 _nextDialogId = 0

Friends

friend class Dialog
class ExceptionDialog : public sh::ui::Dialog
#include <exceptiondialog.h>

The ‘Exception’ dialog.

Subclassed by sh::ui::qt::QtExceptionDialog, sh::ui::web::WebExceptionDialog

Public Functions

ExceptionDialog(QString error1, QString error2, QString details, QString icon, bool mayRetry, bool mayClose, bool mayCancel, bool showLoglabelAndDetails)

Parameters
  • error1: The 1st error text.

  • error2: The 2nd error text.

  • details: The error details.

  • icon: An icon (as name resolveable by sh::base::IconManager).

  • mayRetry: If it’s allowed to retry.

  • mayClose: If it’s allowed to just close and continue without closing Shallot.

  • mayCancel: If it’s allowed to cancel, i.e. throwing a sh::exceptions::CancelException.

  • showLoglabelAndDetails: If the dialog shall allow to read the details.

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.

ExceptionDialogResult answer() = 0

Returns the answer the user has given in this dialog.

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

QString _error1
QString _error2
QString _details
QString _icon
bool _mayRetry
bool _mayClose
bool _mayCancel
bool _showLoglabelAndDetails
class FilePropertyDialog : public sh::ui::Dialog
#include <filepropertydialog.h>

The ‘File Properties’ dialog.

Subclassed by sh::ui::qt::QtFilePropertyDialog, sh::ui::web::WebFilePropertyDialog

Public Functions

~FilePropertyDialog()
FilePropertyDialog(QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes)
void refresh() = 0

Refreshes the dialog content.

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.

sh::ui::FilePropertyDialogTabTableView *createTabViewTable() = 0

Creates a new tab view table sub-widget.

sh::ui::FilePropertyDialogTabTextView *createTabViewText() = 0

Creates a new tab view text sub-widget.

sh::ui::FilePropertyDialogTabIconTextBannerView *createTabViewIconTextBanner() = 0

Creates a new tab view icon text banner sub-widget.

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 Members

QList<std::shared_ptr<sh::filesystem::FilesystemNode>> _nodes
QList<TabViewStruct> _tabs

Private Static Attributes

QHash<int, std::shared_ptr<FilePropertyDialogTabFactory>> _propertytabs

Friends

friend class FilePropertyDialogTab
class FilePropertyDialogTab : public std::enable_shared_from_this<FilePropertyDialogTab>
#include <filepropertydialog.h>

Abstract base class for one tab in the Properties dialog (containing a list of widgets).

Subclass and register this class for providing additional content in the Properties dialog.

Register it by using the REGISTER_FILEPROPERTYDIALOGTAB macro (or by adding a FilePropertyDialogTabFactory via FilePropertyDialog::addTabFactory).

Subclassed by sh::filepropertydialogtabs::FilePropertyDialogTabExtendedAttributes, sh::filepropertydialogtabs::FilePropertyDialogTabGeneral, sh::filepropertydialogtabs::FilePropertyDialogTabUnixPermissions, sh::filepropertydialogtabs::FilePropertyDialogTabWindows, sh::scripting::api::ApiFilePropertyDialogTab

Public Functions

QString title() = 0

The tab title. .

QString titleWithoutMnemonic()

The tab title without mnemonic.

QList<QString> properties() = 0

Returns the list of property labels (one entry for each widget).

Each property is displayed with a header and a widget (created in createWidget) with some content (populated in updateWidget).

void populateWidget(int i, FilePropertyDialogTabActionsView *widget) = 0

Populates the tab widget for the i-th property.

Typically uses the FilePropertyDialog::create* methods to create sub-widgets.

See also dialog().

void updateWidget(int i, FilePropertyDialogTabActionsView *widget, sh::filesystem::Operation *op) = 0

Populates the widget for the i-th property with actual content. .

void refresh()

Refreshes the complete content.

Typically called after some user actions in a property widget require that all the other content must be refreshed.

QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes()

The nodes to show.

FilePropertyDialogTabActionsView *widgetAt(int i)

Returns the widget for the i-th property.

int widgetCount()

Returns the number of widgets.

std::shared_ptr<FilePropertyDialog> dialog()

Returns the associated dialog.

~FilePropertyDialogTab()

Private Members

std::weak_ptr<FilePropertyDialog> _dialog

Friends

friend class FilePropertyDialog
friend class FilePropertyDialogTabFactoryByFunction
friend class sh::scripting::api::ApiFilePropertyDialogTabFactory
class FilePropertyDialogTabActionsView
#include <filepropertydialogtabactionsview.h>

A tab view which shows a main widget in the main part and some buttons below.

Subclassed by sh::ui::qt::QtFilePropertyDialogTabActionsView, sh::ui::web::WebFilePropertyDialog::WebFilePropertyDialogTabActionsView

Public Functions

FilePropertyDialogTabActionsView()

Is intended to be directly constructed from everywhere.

FilePropertyDialogTabViewContent *content()

The main widget.

void setContent(FilePropertyDialogTabViewContent *cnt)

Sets the main widget. .

QList<QString> buttons()

The list of buttons.

void setButtons(QList<QString> buttons)

Sets the list of buttons. .

void setVisible(bool v) = 0

Sets the view visible or hidden. .

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

class FilePropertyDialogTabFactory
#include <filepropertydialog.h>

Abstract factory for creating property dialog tabs for the selected nodes.

Register an instance of this class with FilePropertyDialog::addTabFactory in order to make a property tab implementation available. See also FilePropertyDialogTabFactoryByFunction.

Subclassed by sh::scripting::api::ApiFilePropertyDialogTabFactory, sh::ui::FilePropertyDialogTabFactoryByFunction

Public Functions

std::shared_ptr<sh::ui::FilePropertyDialogTab> construct(std::shared_ptr<sh::ui::FilePropertyDialog> dialog) = 0

Constructs a fresh instance of a FilePropertyDialogTab implementation. .

~FilePropertyDialogTabFactory()

Public Static Attributes

const int REGISTER_FILEPROPERTYDIALOGTAB_INDEX_CORE = 10000

Base value for display indexes of core (i.e. maximum important) tabs.

Used in FilePropertyDialog::addTabFactory.

const int REGISTER_FILEPROPERTYDIALOGTAB_INDEX_VERYIMPORTANT = 20000

Base value for display indexes of very important tabs.

Used in FilePropertyDialog::addTabFactory.

const int REGISTER_FILEPROPERTYDIALOGTAB_INDEX_IMPORTANT = 30000

Base value for display indexes of important tabs.

Used in FilePropertyDialog::addTabFactory.

const int REGISTER_FILEPROPERTYDIALOGTAB_INDEX_NORMAL = 40000

Base value for display indexes of tabs with medium importance.

Used in FilePropertyDialog::addTabFactory.

const int REGISTER_FILEPROPERTYDIALOGTAB_INDEX_EXOTIC = 50000

Base value for display indexes of exotic (i.e. less important) tabs.

Used in FilePropertyDialog::addTabFactory.

class FilePropertyDialogTabFactoryByFunction : public sh::ui::FilePropertyDialogTabFactory
#include <filepropertydialog.h>

Implementation of FilePropertyDialogTabFactory for making custom FilePropertyDialogTab implementations available.

This implementation relies on an external factory function which must be provided to the constructor.

Used internally inside the REGISTER_FILEPROPERTYDIALOGTAB macro.

Public Functions

FilePropertyDialogTabFactoryByFunction(std::function<std::shared_ptr<sh::ui::FilePropertyDialogTab>()> fct)
std::shared_ptr<sh::ui::FilePropertyDialogTab> construct(std::shared_ptr<sh::ui::FilePropertyDialog> dialog)

Constructs a fresh instance of a FilePropertyDialogTab implementation. .

Public Static Attributes

const int REGISTER_FILEPROPERTYDIALOGTAB_INDEX_CORE = 10000

Base value for display indexes of core (i.e. maximum important) tabs.

Used in FilePropertyDialog::addTabFactory.

const int REGISTER_FILEPROPERTYDIALOGTAB_INDEX_VERYIMPORTANT = 20000

Base value for display indexes of very important tabs.

Used in FilePropertyDialog::addTabFactory.

const int REGISTER_FILEPROPERTYDIALOGTAB_INDEX_IMPORTANT = 30000

Base value for display indexes of important tabs.

Used in FilePropertyDialog::addTabFactory.

const int REGISTER_FILEPROPERTYDIALOGTAB_INDEX_NORMAL = 40000

Base value for display indexes of tabs with medium importance.

Used in FilePropertyDialog::addTabFactory.

const int REGISTER_FILEPROPERTYDIALOGTAB_INDEX_EXOTIC = 50000

Base value for display indexes of exotic (i.e. less important) tabs.

Used in FilePropertyDialog::addTabFactory.

Private Members

std::function< std::shared_ptr< sh::ui::FilePropertyDialogTab >)> fct
class FilePropertyDialogTabIconTextBannerView : public sh::ui::FilePropertyDialogTabViewContent
#include <filepropertydialogtabactionsview.h>

A tab view for showing texts and icons combined.

Subclassed by sh::ui::qt::QtFilePropertyDialogTabIconTextBannerView, sh::ui::web::WebFilePropertyDialog::WebFilePropertyDialogTabIconTextBannerView

Public Functions

FilePropertyDialogTabIconTextBannerView()

Is intended to be directly constructed from everywhere.

void clear() = 0

Clears the contents.

void insertIcon(QIcon icon, int sizePt = 24) = 0

Adds an icon.

void insertText(QString text) = 0

Adds a text.

class FilePropertyDialogTabTableView : public sh::ui::FilePropertyDialogTabViewContent
#include <filepropertydialogtabactionsview.h>

A tab view for showing key/value pairs.

Subclassed by sh::ui::qt::QtFilePropertyDialogTabTableView, sh::ui::web::WebFilePropertyDialog::WebFilePropertyDialogTabTableView

Public Types

typedef QPair<int, int> ItemIndex

Public Functions

FilePropertyDialogTabTableView()

Is intended to be directly constructed from everywhere.

void setContent(QList<QPair<QString, QString>> content) = 0

Sets the content.

QList<ItemIndex> getSelectedItems() = 0

Returns the selected cells.

QVariant getItemValue(int r, int c) = 0

Returns a value of a cell.

class FilePropertyDialogTabTextView : public sh::ui::FilePropertyDialogTabViewContent
#include <filepropertydialogtabactionsview.h>

A tab view for showing a text.

Subclassed by sh::ui::qt::QtFilePropertyDialogTabTextView, sh::ui::web::WebFilePropertyDialog::WebFilePropertyDialogTabTextView

Public Functions

FilePropertyDialogTabTextView()

Is intended to be directly constructed from everywhere.

void setContent(QString content) = 0

Sets the content.

class FilePropertyDialogTabViewContent
#include <filepropertydialogtabactionsview.h>

Abstract subclass for a tab view content.

Subclassed by sh::ui::FilePropertyDialogTabIconTextBannerView, sh::ui::FilePropertyDialogTabTableView, sh::ui::FilePropertyDialogTabTextView

Public Functions

FilePropertyDialogTabViewContent()
~FilePropertyDialogTabViewContent()
class FileView : public QObject
#include <fileview.h>

Abstract base class for a file view implementation (i.e. which shows the content of a directory somehow).

Subclassed by sh::ui::qt::QtFileViewControl, sh::ui::web::WebFileView

Public Functions

FileView()
~FileView()
sh::ui::ColumnDimensions *columndimensions() = 0

Returns the column dimensions handler. .

sh::tools::HistoryTracker<std::shared_ptr<const sh::filesystem::Eurl>> *historyTracker() = 0

Returns the history tracker. .

FileViewMode viewmode() = 0

Returns the view mode (icons, list, … ?). .

void setViewmode(FileViewMode m) = 0

Sets the view mode. .

int index() = 0

Returns the position of this file view within the panel. .

std::shared_ptr<sh::filesystem::FilesystemNode> node()

Returns the current directory.

void gotoDir(std::shared_ptr<sh::filesystem::FilesystemNode> node)

Jumps to a new current directory.

Implementations have to call the base class implementation inside.

sh::filesystem::SizeFormatting getSizeFormattingMode() = 0

Returns the mode how file sizes are formatted for displaying. .

void setSizeFormattingMode(sh::filesystem::SizeFormatting mode) = 0

Sets the mode how file sizes are formatted for displaying. .

bool hiddenFilesVisible() = 0

Returns if hidden files are visible. .

void setHiddenFilesVisible(bool v) = 0

Sets the visibility of hidden files. .

int iconDimension() = 0

Returns the icon size (in pixels). .

void setIconDimension(int v) = 0

Sets the icon size (in pixels). .

void setSort(int column, Qt::SortOrder order) = 0

Sets how to sort this view. .

int sortColumn() = 0

Returns the index of the current sort column. .

Qt::SortOrder sortOrder() = 0

Returns the current sort order. .

QList<std::shared_ptr<sh::filesystem::FilesystemNode>> selectedNodes() = 0

Returns the nodes which the user has selected in this fileview. .

void setSelection(const QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes) = 0

Sets the node selection of this fileview. .

QList<std::shared_ptr<sh::filesystem::FilesystemNode>> getAllVisibleNodes() = 0

Returns a list of all nodes currently listed in this file view. .

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 selectionChanged()

Triggered when the selection have changed.

void viewOptionChanged()

Triggered when some view options have changed.

Private Members

sh::filesystem::FilesystemModelFileviewProxy *_model = nullptr
std::shared_ptr<QObject> _visibleviewslifetimecanary = nullptr
std::shared_ptr<sh::filesystem::FilesystemNode> _node = nullptr
class LogViewDialog : public sh::ui::Dialog
#include <logviewdialog.h>

The ‘Log’ dialog..

Subclassed by sh::ui::qt::QtLogViewDialog, sh::ui::web::WebLogViewDialog

Public Functions

LogViewDialog(QString headtext, QString subheadtxt, sh::base::LogSeverity minseverity)

Parameters
  • headtext: The header text.

  • subheadtxt: The 2nd header text.

  • minseverity: The minimum message severity this dialog shows initially (the user can typically change that later on).

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 Members

QString _headtext
QString _subheadtxt
sh::base::LogSeverity _minseverity
class MainWindow
#include <mainwindow.h>

The abstract main window class. There is one instance of it, and it is also used for other ui parts (e.g. creating some dialogs, …).

Subclassed by sh::ui::qt::QtMainWindow, sh::ui::web::WebMainWindow

Public Functions

MainWindow()
~MainWindow()
void _initialize(sh::base::SingletonInitializer *singletonInitializer)

Initializes the main window. For custom initialization logic, see MainWindow.initialize. .

int fileViewCount() = 0

Returns the current number of file views. .

void addFileView(bool reinitialize = false) = 0

Adds a new file view. .

void removeFileView(int i) = 0

Removes a file view. .

sh::ui::FileView *currentFileView() = 0

Returns the file view which is currently active (i.e. focussed). .

sh::ui::FileView *getFileView(int i) = 0

Returns a file view by position index. .

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

void jumpToEurl(std::shared_ptr<const sh::filesystem::Eurl> eurl)

Let the current view jump to another location. .

void jumpToNode(std::shared_ptr<sh::filesystem::FilesystemNode> node) = 0

Let the current view jump to another location. .

void setTitlePattern(QString value)

Sets the window title pattern. .

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.

void setTreeVisible(bool v)

Sets the visibility of the directory tree. .

bool treeVisible()

Returns the visibility of the directory tree.

void setTreeSticky(bool v)

Sets if the directory tree should follow the active file view. .

bool treeSticky()

Returns if the directory tree follows the active file view.

void setFileDetailsPanelVisible(bool v)

Sets the visibility of the file details panel. .

bool fileDetailsPanelVisible()

Returns the visibility of the file details panel.

std::shared_ptr<sh::filesystem::FilesystemNode> currentDirectory() = 0

Gets the sh::filesystem::FilesystemNode selected in the current view. .

std::shared_ptr<sh::ui::ActionExecutionInfoPanel> addInfoPanel(int position, sh::actions::ActionExecutionInfo *info, QColor color = QColor()) = 0

Creates a new action execution panel.

Let this smart pointer die for removing it.

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.

void jumpbarSetTextMode() = 0

Sets the jumpbar to text input mode. .

void jumpbarSetButtonMode() = 0

Sets the jumpbar to button mode. .

bool jumpbarIsTextMode() = 0

Returns if the jumpbar is in text input mode. .

QString toolbarPosition() = 0

Returns the current toolbar position. .

void setToolbarPosition(QString pos) = 0

Sets the toolbar position. .

QString detailPanelPosition() = 0

Returns the current detail panel position. .

void setDetailPanelPosition(QString pos) = 0

Sets the detail panel position. .

std::shared_ptr<AboutDialog> showAboutDialog() = 0

Shows and returns an ‘About’ dialog. .

std::shared_ptr<ManageProfilesDialog> showManageProfilesDialog() = 0

Shows and returns a ‘Manage Saved Settings’ dialog. .

std::shared_ptr<OpenWithDialog> showOpenWithDialog(std::shared_ptr<sh::filesystem::FilesystemNode> node, QList<std::shared_ptr<sh::tools::filetypes::OpenMethod>> openMethods) = 0

Shows and returns a ‘Open With’ dialog. .

std::shared_ptr<StoreProfileDialog> showStoreProfileDialog(std::shared_ptr<const sh::filesystem::Eurl> eurl) = 0

Shows and returns a ‘Save Settings’ dialog. .

std::shared_ptr<TuningDialog> showTuningDialog() = 0

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) = 0

Shows and returns a ‘Log’ dialog. .

std::shared_ptr<ManageBookmarksDialog> showManageBookmarksDialog() = 0

Shows and returns a ‘Manage Bookmarks’ dialog. .

std::shared_ptr<FilePropertyDialog> showFilePropertyDialog(QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes) = 0

Shows and returns a ‘File Properties’ dialog. .

std::shared_ptr<ActionExecutionInfoDialog> createActionExecutionInfoDialog(sh::actions::ActionExecutionInfo *info) = 0

Creates an action execution dialog. .

std::shared_ptr<ActionExecutionInfoPanel> showErrorPanel()

Shows an error panel.

std::shared_ptr<DialogManager> dialogManager() = 0

Returns the DialogManager which creates and drives Dialogs for this main window.

You typically should not need to use it directly.

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 handleCloseAppRejected(QString rejectmsg) = 0

React on a rejected application close request (with some feedback message). .

void handleClosed()

Do some cleanup steps just when closing starts. Implementations must call base implementation!

bool isClosing()

Returns if the application is currently closing.

Public Static Functions

MainWindow *mainWindow()

Returns the instance of this singleton.

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

Private Functions

void _refreshIsCloseable()

Private Members

bool _closing = false
bool _treeSticky = true
bool _treeVisible = true
bool _detailsPanelVisible = true
QString _titlePattern
QList<std::shared_ptr<sh::ui::ActionExecutionInfoPanel>> _errorpanels
QString _currentProfile
QString _isCloseable
bool _thumbnailrequestongoing = false
bool _thumbnailrequestfollowup = false
int _thumbnailrequestfollowup_width = 0
int _thumbnailrequestfollowup_height = 0
std::function<void()> _thumbnailrequestfollowup_onBeforeRequest = nullptr
std::function<void(QIcon)> _thumbnailrequestfollowup_onArrived = nullptr
int _thumbnaillastreqwidth = 0
int _thumbnaillastreqheight = 0
quint64 _thumbnaillastrequestid = 0

Private Static Attributes

MainWindow *_mainWindow = nullptr
bool _mainWindow_runheadless = false
KillHelperThread *killthread = nullptr

Friends

friend class sh::exceptions::Exception
class KillHelperThread : public QThread

Helps application shutdown in some situations :).

Public Functions

void run()
class ManageBookmarksDialog : public sh::ui::Dialog
#include <managebookmarksdialog.h>

The ‘Manage Bookmarks’ dialog.

Subclassed by sh::ui::qt::QtManageBookmarksDialog, sh::ui::web::WebManageBookmarksDialog

Public Functions

ManageBookmarksDialog()
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 ManageProfilesDialog : public sh::ui::Dialog
#include <manageprofilesdialog.h>

The ‘Manage Saved Settings’ dialog.

Subclassed by sh::ui::qt::QtManageProfilesDialog, sh::ui::web::WebManageProfilesDialog

Public Functions

ManageProfilesDialog()
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 OpenWithDialog : public sh::ui::Dialog
#include <openwithdialog.h>

The ‘Open With’ dialog.

Subclassed by sh::ui::qt::QtOpenWithDialog, sh::ui::web::WebOpenWithDialog

Public Functions

OpenWithDialog(std::shared_ptr<sh::filesystem::FilesystemNode> node, QList<std::shared_ptr<sh::tools::filetypes::OpenMethod>> openMethods)

Parameters
  • node: The file which is later to be opened.

  • openMethods: The open-methods (programs for opening the file) to present for choice.

std::shared_ptr<sh::tools::filetypes::OpenMethod> chosenMethod() = 0

Returns the chosen open-method (program for opening the file).

bool rememberForMimetype() = 0

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() = 0

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() = 0

Returns if the chosen method is checked to be remembered for the same file in the future.

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 Members

std::shared_ptr<sh::filesystem::FilesystemNode> _node
QList<std::shared_ptr<sh::tools::filetypes::OpenMethod>> _openMethods
class SearchPanelAbstractEditor
#include <searchpanelconfiguration.h>

Abstract base class for editor widgets in a search panel.

Subclassed by sh::ui::SearchPanelDateTimeEditor, sh::ui::SearchPanelLabelEditor, sh::ui::SearchPanelSpacerEditor, sh::ui::SearchPanelTextEditor

Public Functions

SearchPanelAbstractEditor() = default
~SearchPanelAbstractEditor() = default
bool isWidgetEnabled() = 0

Returns if the widget is enabled. .

void setWidgetEnabled(bool v) = 0

Sets if the widget is enabled. .

class SearchPanelButton
#include <searchpanelconfiguration.h>

A button in the button bar of a search panel.

Subclassed by sh::ui::qt::QtSearchPanelButton

Public Functions

SearchPanelButton()
~SearchPanelButton()
void setButtonText(QString txt) = 0

Sets the button text. .

void setMenuSelection(int i) = 0

Sets the currently selected menu item (for buttons with menus). .

class SearchPanelConfiguration
#include <searchpanelconfiguration.h>

Configuration for a search panel population.

It is populated with ui controls by the chosen search criterion. Later on those controls are used for updating the configuration data.

Subclassed by sh::ui::qt::QtSearchPanelConfiguration

Public Functions

SearchPanelConfiguration()
~SearchPanelConfiguration()
SearchPanelButton *addMenuButton(QString text, QStringList menu, std::function<void(int)> onchanged) = 0

Adds and returns a button for a menu. .

SearchPanelButton *addActionButton(QString text, std::function<void()> action) = 0

Adds and returns a button for an action. .

SearchPanelTextEditor *addTextEditor() = 0

Adds and returns a text editor. .

SearchPanelDateTimeEditor *addDateTimeEditor() = 0

Adds and returns a date/time editor. .

SearchPanelLabelEditor *addLabel() = 0

Adds and returns a label. .

SearchPanelSpacerEditor *addSpacer() = 0

Adds and returns a spacer. .

SearchPanelAbstractEditor *getEditorAt(int i) = 0

Returns the editor widget at a given position. .

void onDestroyed(std::function<void()> fctQObject *owner = 0, )

Sets a handler for panel removal (optionally bound to an owner lifetime).

Public Members

_SearchPanelConfiguration_HelperQObject myqobject
class SearchPanelDateTimeEditor : public sh::ui::SearchPanelAbstractEditor
#include <searchpanelconfiguration.h>

A date/time picker for search panel usage.

Subclassed by sh::ui::qt::QtSearchPanelAbstractEditor< QDateTimeEdit, SearchPanelDateTimeEditor >

Public Functions

SearchPanelDateTimeEditor() = default
QDateTime datetime() = 0

Returns the selected date/time. .

void setDatetime(QDateTime s) = 0

Sets the selected date/time.

bool isWidgetEnabled() = 0

Returns if the widget is enabled. .

void setWidgetEnabled(bool v) = 0

Sets if the widget is enabled. .

class SearchPanelLabelEditor : public sh::ui::SearchPanelAbstractEditor
#include <searchpanelconfiguration.h>

A text label for search panel usage.

Subclassed by sh::ui::qt::QtSearchPanelAbstractEditor< QLabel, sh::ui::SearchPanelLabelEditor >

Public Functions

SearchPanelLabelEditor() = default
QString textContent() = 0

Returns the text content. .

void setTextContent(QString s) = 0

Sets the text content. .

SearchPanelAbstractEditor *focusProxyEditor() = 0

Returns the focus proxy widget (which focus gets redirected to in some situations). .

void setFocusProxyEditor(SearchPanelAbstractEditor *w) = 0

Sets the focus proxy widget (which focus gets redirected to in some situations). .

bool isWidgetEnabled() = 0

Returns if the widget is enabled. .

void setWidgetEnabled(bool v) = 0

Sets if the widget is enabled. .

class SearchPanelSpacerEditor : public sh::ui::SearchPanelAbstractEditor
#include <searchpanelconfiguration.h>

A spacer for search panel usage.

Subclassed by sh::ui::qt::QtSearchPanelAbstractEditor< QLabel, sh::ui::SearchPanelSpacerEditor >

Public Functions

SearchPanelSpacerEditor() = default
bool isWidgetEnabled() = 0

Returns if the widget is enabled. .

void setWidgetEnabled(bool v) = 0

Sets if the widget is enabled. .

class SearchPanelTextEditor : public sh::ui::SearchPanelAbstractEditor
#include <searchpanelconfiguration.h>

A single line text editor for search panel usage.

Subclassed by sh::ui::qt::QtSearchPanelAbstractEditor< QLineEdit, sh::ui::SearchPanelTextEditor >

Public Functions

SearchPanelTextEditor() = default
QString textContent() = 0

Returns the text content. .

void setTextContent(QString s) = 0

Sets the text content. .

QString placeholderDescription() = 0

Returns the placeholder description text (visible if field is empty). .

void setPlaceholderDescription(QString s) = 0

Sets the placeholder description text (visible if field is empty). .

bool isWidgetEnabled() = 0

Returns if the widget is enabled. .

void setWidgetEnabled(bool v) = 0

Sets if the widget is enabled. .

class StoreProfileDialog : public sh::ui::Dialog
#include <storeprofiledialog.h>

The ‘Save Settings’ dialog.

Subclassed by sh::ui::qt::QtStoreProfileDialog, sh::ui::web::WebStoreProfileDialog

Public Functions

StoreProfileDialog(std::shared_ptr<const sh::filesystem::Eurl> eurl)

Parameters
  • eurl: The current directory this dialog shall work on.

std::shared_ptr<const sh::filesystem::Eurl> eurl()

Returns the current directory this dialog shall work on.

QList<SettingEntry> checkedSettings() = 0

Returns the list of settings the user has checked to store.

QString profileName() = 0

Returns the profile the user has chosen to store settings for.

bool withSubDirectories() = 0

Returns if the user has chosen to apply the checked settings also for subdirectories.

QStringList inheritsFrom() = 0

Returns the list of profiles the user has chosen to inherit from.

bool hasGlobal() = 0

Returns if the user has chosen to apply the checked settings for each directory (instead of the current directory).

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

std::shared_ptr<const sh::filesystem::Eurl> _eurl
class SettingEntry
#include <storeprofiledialog.h>

A storable entry in a ‘Save Settings’ dialog.

Public Functions

SettingEntry(sh::settings::Setting *setting, int onlyInFileview = -1)
sh::settings::Setting *setting()

Returns the setting to store.

int fileview()

Returns the index of the file view to store this setting for (or -1 for all).

bool isForFileview()

Returns if this setting is to be stored for a particular file view (instead of for all).

Private Members

sh::settings::Setting *_setting
int _fileview
class TuningDialog : public sh::ui::Dialog
#include <tuningdialog.h>

The ‘Tuning’ dialog.

Subclassed by sh::ui::qt::QtTuningDialog, sh::ui::web::WebTuningDialog

Public Functions

TuningDialog()
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.

namespace qt

The Qt user interface implementation.

This is the default UI. It builds a desktop application based on the Qt gui components.

class LineEditWithKeyboardShortcuts : public QLineEdit
#include <qtjumpbar.h>

Helper widget of QtJumpBar.

Public Functions

LineEditWithKeyboardShortcuts(QWidget *parent = 0)

Signals

void enterPressed()
void escapePressed()
class QtAboutDialog : public sh::ui::qt::QtDialog, public sh::ui::AboutDialog
#include <qtaboutdialog.h>

Qt based about dialog.

Public Functions

QtAboutDialog()
~QtAboutDialog()
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

Ui::QtAboutDialog *ui

Private Slots

void on_btnClose_clicked()
void on_btnLicense_clicked()
void on_btnHomepage_clicked()
class QtActionExecutionInfoDialog : public QDialog, public sh::ui::ActionExecutionInfoDialog
#include <qtactionexecutioninfodialog.h>

Qt progress dialog for action executions.

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

Public Functions

QtActionExecutionInfoDialog(sh::actions::ActionExecutionInfo *info, QWidget *parent = 0)
~QtActionExecutionInfoDialog()
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)
void setLogicallyVisible(bool v)

Sets if this dialog is logically visible (i.e. set visible by the action). .

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

bool isLogicallyVisible()

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

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 _computevisibility()

Private Members

Ui::QtActionExecutionInfoDialog *ui
sh::ui::qt::feedbackpanels::FeedbackPanel *currentFeedbackPanel = 0

Private Slots

void on_btnCancel_clicked()
void on_btnBackground_clicked()
class QtActionExecutionInfoPanel : public QWidget, public sh::ui::ActionExecutionInfoPanel
#include <qtactionexecutioninfopanel.h>

Qt status bar info-panel for an action execution.

Public Functions

QtActionExecutionInfoPanel(sh::actions::ActionExecutionInfo *info, QColor color, QWidget *parent = 0)
void setLabel(QString s)

Sets the label text. .

void setWidth(int width)

Sets the panel with (in pixels). .

QSize sizeHint() const
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 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 _check_indeterminateanimationtimer_enable()

Private Members

QString lbl1
bool _progressDeterminate = false
int _indeterminateAnimationCounter = 0
int _width
QTimer *_indeterminateAnimationTimer
quint64 _progressAll
quint64 _progressDone
bool _isforeground_forced = false
sh::actions::ActionExecutionInfo *info
QPixmap gradient
QColor colorProgress2
QColor colorProgress1
QColor colorBase
QColor colorFrame
QColor colorText
QColor colorTextDark
class QtActionMenu : public QMenu
#include <qtactionmenu.h>

Qt based action menu used for context menus and in the toolbar.

Public Functions

QtActionMenu(QWidget *parent = 0)
void setHeader(QString t)
QList<QAction*> allActions()
void clearAllActions()
void removeActionAt(int i)
QAction *addNewAction(int i = -1)
QAction *addNewSubMenu(sh::ui::qt::QtActionMenu **qsubmenu, int i = -1)
QAction *addNewSeparator(int i = -1)
QAction *addNewHeader(int i = -1)
bool actionIsHeader(QAction *a)

Private Functions

void _observeAction(QAction *a)
void _correctMenuPosition()

Private Members

QColor brandingcolor
QFont _boldfont
QFont _normalfont
int _origMenuPosX = -1
int _origMenuPosY = -1
QString _header
int _cntInternalActions
class QtActionMenuHandler
#include <qtactionmenuhandler.h>

A handler which reflects the sh::actions objects to a graphical menu (and keeps that up-to-date).

Public Functions

QtActionMenuHandler(std::shared_ptr<sh::actions::ActionInstantiation> ai, std::shared_ptr<QtActionMenu> menu)

Private Functions

void _markDefault2()
void _append_actions(sh::ui::qt::QtActionMenu *menu, QList<std::shared_ptr<sh::actions::ActionInstantiation>> acts, std::shared_ptr<sh::actions::ActionCategory> category)

Private Members

QList<std::shared_ptr<sh::actions::ActionInstantiation>> selacts
QList<std::shared_ptr<sh::actions::ActionInstantiation>> diracts
QHash<QAction*, std::shared_ptr<sh::actions::AbstractActionItem>> qaction2action
std::weak_ptr<QtActionMenu> menu

Private Static Functions

std::shared_ptr<sh::actions::ActionActionItem> _getDefaultAction(QList<std::shared_ptr<sh::actions::AbstractActionItem>> actionList)
void _markDefault(std::weak_ptr<sh::actions::SubmenuActionItem> itmSubmenu, sh::ui::qt::QtActionMenu *menu)
QAction *_createAndConnectAction(sh::actions::AbstractActionItem *itm, sh::ui::qt::QtActionMenu *menu, std::function<void()> onchangedQObject *onchangedbuddy = 0, )
void _applyPropertiesToQAction(sh::actions::AbstractActionItem *itm, QAction *_widgetaction)
void _updateSubmenu(sh::actions::SubmenuActionItem *itm, QtActionMenu *menu, std::function<void()> onchanged = 0)

Friends

friend class QtToolbarButtonHandler
class QtDialog : public QDialog
#include <qtdialog.h>

Abstract base class for a qt based dialog. Typically used for also implementing some sh::ui::Dialog.

Subclassed by sh::ui::qt::QtAboutDialog, sh::ui::qt::QtExceptionDialog, sh::ui::qt::QtFilePropertyDialog, sh::ui::qt::QtLogViewDialog, sh::ui::qt::QtManageBookmarksDialog, sh::ui::qt::QtManageProfilesDialog, sh::ui::qt::QtOpenWithDialog, sh::ui::qt::QtStoreProfileDialog, sh::ui::qt::QtTuningDialog

Public Functions

QtDialog()
class QtDialogManager : public sh::ui::DialogManager
#include <qtdialog.h>

A DialogManager used in Qt ui.

Public Functions

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.

Private Functions

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.

class QtExceptionDialog : public sh::ui::qt::QtDialog, public sh::ui::ExceptionDialog
#include <qtexceptiondialog.h>

Qt based exception dialog.

Public Functions

QtExceptionDialog(QString error1, QString error2, QString details, QString icon, bool mayRetry, bool mayClose, bool mayCancel, bool showLoglabelAndDetails)
~QtExceptionDialog()
ExceptionDialogResult answer() override

Returns the answer the user has given in this dialog.

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 Members

Ui::QtExceptionDialog *ui
ExceptionDialogResult _answer = ExceptionDialogResult::Shutdown

Private Slots

void on_btnExit_clicked()
void on_btnClose_clicked()
void on_btnCancel_clicked()
void on_btnRetry_clicked()
void on_btnShowLog_clicked()
void on_btnExitAndSaveLog_clicked()
void on_btnShowDetails_toggled(bool checked)
class QtFileDetailsPanel : public QWidget
#include <qtfiledetailspanel.h>

The details panel.

Can be shown in the main window. It presents detail information about the selected file.

Public Functions

QtFileDetailsPanel(QWidget *parent = 0)
void setNodes(QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes)
void setOrientation(Qt::Orientation orientation)
QSize sizeHint() const override
~QtFileDetailsPanel()

Private Members

int PADDINGX
int PADDINGY
QList<std::shared_ptr<sh::filesystem::FilesystemNode>> _nodes
QList<std::shared_ptr<sh::paneldetails::PanelDetail>> _panelDetails
QList<DetailPlacement> _placements
QFont fontNormal
QFont fontBold
QPixmap _widgetimagecache
QTimer _widgetimagecachetimer
Qt::Orientation _orientation = Qt::Horizontal
class DetailPlacement
#include <qtfiledetailspanel.h>

Public Functions

DetailPlacement(int x, int y, int w, int h, QList<DetailRowPlacement> rowplacements, std::shared_ptr<sh::paneldetails::PanelDetail> detail)

Public Members

std::shared_ptr<sh::paneldetails::PanelDetail> detail
int x
int y
int w
int h
QList<DetailRowPlacement> rowplacements
class DetailRowPlacement
#include <qtfiledetailspanel.h>

Public Functions

DetailRowPlacement(int h, int contentx, int contenty, QList<int> elementwidths)
DetailRowPlacement() = default
DetailRowPlacement(const DetailRowPlacement&) = default

Public Members

int h
int contentx
int contenty
QList<int> elementwidths
class QtFileIconview : public QListView, public sh::ui::qt::QtFileView
#include <qtfileiconview.h>

Icon view for the contents of one directory.

Public Functions

QtFileIconview(QWidget *parent = 0)

Constructed only by the infrastructure and made available otherwise.

void setThumbDimension(double size)

Sets the size of the thumbnail image.

void setBackgroundColor(QString c)
QString backgroundColor()
QList<std::shared_ptr<sh::filesystem::FilesystemNode>> selectedNodes()
void setSelection(const QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes)
std::shared_ptr<sh::filesystem::FilesystemNode> node()
QList<std::shared_ptr<sh::filesystem::FilesystemNode>> getAllVisibleNodes()
void setSizeFormatting(sh::filesystem::SizeFormatting v)
void gotoDir(std::shared_ptr<sh::filesystem::FilesystemNode> n)
void setHiddenFilesVisible(bool value)
QThread *thread()
void configure(sh::ui::qt::QtFileViewControl *viewctrl)
void focus()
void setSort(int column, Qt::SortOrder order)
QObject *as_qobject()
QWidget *as_qwidget()
QAbstractItemView *as_qabstractitemview()
sh::ui::qt::QtFileViewControl *control()

Private Members

int _deleg_w = 0
int _deleg_h = 0
int _dsx = 0
int _dsy = 0
int _lineheight = 0
class QtFileList : public QTreeView, public sh::ui::qt::QtFileView
#include <qtfilelist.h>

List view for the contents of one directory.

Public Functions

QtFileList(QWidget *parent = 0)

Constructed only by the infrastructure and made available otherwise.

void setSort(int column, Qt::SortOrder order) override
void setBackgroundColor(QString c)
QString backgroundColor()
QList<std::shared_ptr<sh::filesystem::FilesystemNode>> selectedNodes()
void setSelection(const QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes)
std::shared_ptr<sh::filesystem::FilesystemNode> node()
QList<std::shared_ptr<sh::filesystem::FilesystemNode>> getAllVisibleNodes()
void setSizeFormatting(sh::filesystem::SizeFormatting v)
void gotoDir(std::shared_ptr<sh::filesystem::FilesystemNode> n)
void setHiddenFilesVisible(bool value)
QThread *thread()
void configure(sh::ui::qt::QtFileViewControl *viewctrl)
void focus()
QObject *as_qobject()
QWidget *as_qwidget()
QAbstractItemView *as_qabstractitemview()
sh::ui::qt::QtFileViewControl *control()

Private Functions

QString getColumnNameForIndex(int index)
void _adaptColumnWidth(int index)

Private Members

bool _skip_slot_sectionResized = false

Private Slots

void slot_sectionResized(int index, int oldsize, int newsize)

Private Static Attributes

std::shared_ptr<sh::configuration::ConfigurationValue> cfgvalFileListIconSize = sh::configuration::ConfigurationManager::instance()->registerConfigValue("sh::ui::qt::QtFileList.FileListIconSize", -1, sh::configuration::ConfigurationValue::valueTypeInteger(), QObject::tr("Icon size in file list panels"), sh::configuration::ConfigurationCategory::CategoryGUI, QString(), QObject::tr("For default size, set it to -1."))
class QtFilePropertyDialog : public sh::ui::qt::QtDialog, public sh::ui::FilePropertyDialog
#include <qtfilepropertydialog.h>

Qt based properties dialog.

Public Functions

~QtFilePropertyDialog()
QtFilePropertyDialog(QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes)

Constructed only by the infrastructure and made available otherwise.

void init(std::shared_ptr<Dialog> dialog) override

Executes custom stuff on initialization, e.g. for populating the dialog.

void refresh() override

Refreshes the dialog content.

sh::ui::FilePropertyDialogTabTableView *createTabViewTable() override

Creates a new tab view table sub-widget.

sh::ui::FilePropertyDialogTabTextView *createTabViewText() override

Creates a new tab view text sub-widget.

sh::ui::FilePropertyDialogTabIconTextBannerView *createTabViewIconTextBanner() override

Creates a new tab view icon text banner sub-widget.

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 Slots

void on_btnClose_clicked()
void on_btnRefresh_clicked()
void on_tabWidget_currentChanged(int index)
void selectTabByScrollPosition()

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 Members

Ui::QtFilePropertyDialog *ui
QList<QWidget*> _internaltabwidgets
QList<QString> _tabheads
int _skip_on_tabWidget_currentChanged = 0
int _skip_selectTabByScrollPosition = 0
QVBoxLayout *scrollAreaLayout

Friends

friend class FilePropertyDialogTab
class QtFilePropertyDialogTabActionsView : public QWidget, public sh::ui::FilePropertyDialogTabActionsView
#include <qtfilepropertydialogtabactionsview.h>

A tab view which shows a main widget in the main part and some buttons below.

Public Functions

QtFilePropertyDialogTabActionsView(QWidget *parent = 0)

Is intended to be directly constructed from everywhere.

void setContent(FilePropertyDialogTabViewContent *w)

Sets the main widget. .

void setButtons(QList<QString> buttons)

Sets the list of buttons. .

void setVisible(bool v)

Sets the view visible or hidden. .

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

class QtFilePropertyDialogTabIconTextBannerView : public QWidget, public sh::ui::FilePropertyDialogTabIconTextBannerView
#include <qtfilepropertydialogtabicontextbannerview.h>

Qt based FilePropertyDialogTabIconTextBannerView.

Public Functions

QtFilePropertyDialogTabIconTextBannerView(QWidget *parent = 0)
void clear()

Clears the contents.

void insertIcon(QIcon icon, int sizePt = 24)

Adds an icon.

void insertText(QString text)

Adds a text.

Private Members

QHBoxLayout *_layout
class QtFilePropertyDialogTabTableView : public QTableView, public sh::ui::FilePropertyDialogTabTableView
#include <qtfilepropertydialogtabtableview.h>

Qt based FilePropertyDialogTabTableView.

Public Types

typedef QPair<int, int> ItemIndex

Public Functions

QtFilePropertyDialogTabTableView(QWidget *parent = 0)
void setContent(QList<QPair<QString, QString>> content)

Sets the content.

QList<ItemIndex> getSelectedItems()

Returns the selected cells.

QVariant getItemValue(int r, int c)

Returns a value of a cell.

Private Functions

void createAndSetModel()
class QtFilePropertyDialogTabTextView : public QLabel, public sh::ui::FilePropertyDialogTabTextView
#include <qtfilepropertydialogtabtextview.h>

Qt based FilePropertyDialogTabTextView.

Public Functions

QtFilePropertyDialogTabTextView(QWidget *parent = 0)
void setContent(QString content)

Sets the content.

class QtFilesystemPanel : public QWidget
#include <qtfilesystempanel.h>

A splitted horizontal panel of file views.

Public Functions

QtFilesystemPanel(QWidget *parent = 0)
~QtFilesystemPanel()
void addView(bool reinitialize = false)
void removeView(int i)
sh::ui::FileView *currentView()
int currentViewIndex()
int viewsCount()
sh::ui::FileView *view(int i)
void selectFolder(std::shared_ptr<sh::filesystem::FilesystemNode> folder, int index = -1)
QList<std::shared_ptr<sh::filesystem::FilesystemNode>> selectedNodes()
void _emit_viewmodeChanged(int i)
void buildView(std::shared_ptr<sh::ui::qt::QtFileView> *list, sh::ui::qt::QtFileViewControl *viewctrl, bool isNew)
void setCustomWidget(int i, std::shared_ptr<QWidget> w)
std::shared_ptr<sh::ui::qt::QtFileView> viewwidget(int i)

Signals

void panelFolderActivated(std::shared_ptr<sh::filesystem::FilesystemNode> folder, bool realSwitch)
void panelCurrentViewChanged()
void panelViewmodeChanged(int i)
void panelViewOptionChanged(int i)
void panelViewCountChanged()
void panelSelectionChanged()

Private Members

Ui::QtFilesystemPanel *ui
std::shared_ptr<sh::ui::qt::QtFileView> activeView
QString activeColor
QString inactiveColor
QList<std::shared_ptr<sh::ui::qt::QtFileView>> _views
QList<QWidget*> _mainviews
QHash<QWidget*, std::shared_ptr<QWidget>> _customwidgets
QList<sh::ui::qt::QtFileViewControl*> _viewcontrols
bool _skip_eventfilter = false

Friends

friend class ui::qt::QtMainWindow
friend class ui::FileView
class QtFileView : public std::enable_shared_from_this<QtFileView>
#include <qtfileview.h>

Abstract base class for views for the contents of one directory.

Subclassed by sh::ui::qt::QtFileIconview, sh::ui::qt::QtFileList

Public Functions

QtFileView()

Constructed only by the infrastructure and made available otherwise.

~QtFileView()
void setBackgroundColor(QString c)
QString backgroundColor()
QList<std::shared_ptr<sh::filesystem::FilesystemNode>> selectedNodes()
void setSelection(const QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes)
std::shared_ptr<sh::filesystem::FilesystemNode> node()
QList<std::shared_ptr<sh::filesystem::FilesystemNode>> getAllVisibleNodes()
void setSizeFormatting(sh::filesystem::SizeFormatting v)
void gotoDir(std::shared_ptr<sh::filesystem::FilesystemNode> n)
void setHiddenFilesVisible(bool value)
QThread *thread()
void configure(sh::ui::qt::QtFileViewControl *viewctrl)
void focus()
void setSort(int column, Qt::SortOrder order)
QObject *as_qobject()
QWidget *as_qwidget()
QAbstractItemView *as_qabstractitemview()
sh::ui::qt::QtFileViewControl *control()

Private Members

sh::ui::qt::QtFileViewControl *_viewctrl = nullptr
QString _tmp_bgColor
QPoint _dragStartPosition
int _async_gotodir_index = 0
bool _dragIsValid = false
int _sort_column = 0
Qt::SortOrder _sort_order = Qt::AscendingOrder

Friends

friend class sh::actions::common::ActionHistoryNavigateForward
friend class sh::actions::common::ActionHistoryNavigateBackward
friend class sh::actions::common::ActionNavigateInHistory
friend class sh::ui::qt::QtFileViewControl
class EventFilter : public QObject

Public Functions

EventFilter(QObject *parent, QtFileView *fileview, sh::ui::qt::QtFileViewControl *fileviewctrl)
bool eventFilter(QObject *object, QEvent *event)

Private Members

QtFileView *fileview
sh::ui::qt::QtFileViewControl *fileviewctrl
class QtFileViewControl : public sh::ui::FileView
#include <qtfileviewcontrol.h>

Qt based file view.

Public Functions

QtFileViewControl(sh::ui::qt::QtFilesystemPanel *panel, int i)
~QtFileViewControl()
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. .

void gotoDir(std::shared_ptr<sh::filesystem::FilesystemNode> n) override

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

bool hiddenFilesVisible() override

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

void setSelection(const QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes) override

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

void emit_nodesActivated(QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes)
void emit_selectionChanged()
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 nodesActivated(QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes)
void selectionChanged()

Triggered when the selection have changed.

void viewOptionChanged()

Triggered when some view options have changed.

Private Functions

void setIndex(int i)

Private Members

sh::ui::qt::QtFilesystemPanel *_panel
int i
sh::ui::ColumnDimensions *_columndimensions
sh::tools::HistoryTracker<std::shared_ptr<const sh::filesystem::Eurl>> *_historyTracker
FileViewMode _viewmode = FileViewMode::ListView
bool _hiddenfilesvisible = false
int _icondimension = 0
int _sortColumn
Qt::SortOrder _sortOrder
sh::filesystem::SizeFormatting _sizeformattingmode = sh::filesystem::SizeFormatting::SizeFormattingModePrefixes

Friends

friend class sh::ui::qt::QtFilesystemPanel
class QtJumpBar : public QWidget
#include <qtjumpbar.h>

Button bar for navigating to places with parent-buttons and an text entry.

Public Functions

QtJumpBar(QWidget *parent = 0)
~QtJumpBar()
void setButtonMode()
void setTextMode()
bool isTextMode()
std::shared_ptr<sh::filesystem::FilesystemNode> node()
void setNode(std::shared_ptr<sh::filesystem::FilesystemNode> node)
QSize sizeHint() const

Signals

void nodeChanged()
void eurlRequested(std::shared_ptr<const sh::filesystem::Eurl> eurl)

Private Functions

void _buildButtons()

Private Members

std::shared_ptr<sh::filesystem::FilesystemNode> _node = 0
Ui::QtJumpBar *ui
bool _isTextMode

Private Slots

void on_btnOk_clicked()
void on_btnAbort_clicked()
class QtLinkButton : public QToolButton
#include <qtlinkbutton.h>

QToolButton with different look.

Subclassed by sh::ui::qt::QtSearchPanelButton

Public Functions

QtLinkButton(QWidget *parent = 0)
void setSizeByFactor(int f)
void setMenu(QStringList items, QString menuchangetxt = tr("(change)"))
void setSelectedMenuItem(int idx)

Signals

void menuItemSelected(int idx)

Private Members

QString _linkcolor
QStringList _menuitems
QString _menuchangetxt
class QtLogViewDialog : public sh::ui::qt::QtDialog, public sh::ui::LogViewDialog
#include <qtlogviewdialog.h>

Qt based log view dialog.

Public Functions

QtLogViewDialog(QString headtext, QString subheadtxt, base::LogSeverity minseverity)
~QtLogViewDialog()
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 Functions

void _reloadLog()
void setMinimumSeverity(sh::base::LogSeverity minseverity)

Private Members

Ui::QtLogViewDialog *ui

Private Slots

void on_btnClose_clicked()
void on_btnSaveToFile_clicked()
void on_btnSeverity_clicked()
class QtMainWindow : public QMainWindow, public sh::ui::MainWindow
#include <qtmainwindow.h>

The qt main window implementation.

Public Functions

QtMainWindow(QWidget *parent = 0)
~QtMainWindow()
void initialize() override

Initializes this main window. .

std::shared_ptr<DialogManager> dialogManager() override

Returns the DialogManager which creates and drives Dialogs 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). .

sh::ui::FileView *getFileView(int i) override

Returns a file view by position index. .

void jumpToNode(std::shared_ptr<sh::filesystem::FilesystemNode> node) override

Let the current view jump to another location. .

void setTitlePattern(QString value) override

Sets the window title pattern. .

void setTreeVisible(bool v) override

Sets the visibility of the directory tree. .

void setFileDetailsPanelVisible(bool v) override

Sets the visibility of the file details panel. .

std::shared_ptr<sh::filesystem::FilesystemNode> currentDirectory() override

Gets the sh::filesystem::FilesystemNode selected in the current view. .

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

std::shared_ptr<OpenWithDialog> showOpenWithDialog(std::shared_ptr<sh::filesystem::FilesystemNode> node, QList<std::shared_ptr<sh::tools::filetypes::OpenMethod>> openMethods) override

Shows and returns a ‘Open With’ dialog. .

std::shared_ptr<StoreProfileDialog> showStoreProfileDialog(std::shared_ptr<const sh::filesystem::Eurl> eurl) override

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

std::shared_ptr<FilePropertyDialog> showFilePropertyDialog(QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes) override

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 handleClosed() override

Do some cleanup steps just when closing starts. Implementations must call base implementation!

sh::ui::qt::QtUIStyle *uiStyle()

Gets a QtUIStyle instance, which helps for common ui styling.

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

void jumpToEurl(std::shared_ptr<const sh::filesystem::Eurl> eurl)

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.

void setTreeSticky(bool v)

Sets if the directory tree should follow the active file view. .

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.

bool isClosing()

Returns if the application is currently closing.

Public Static Functions

bool tryCreateMainWindow(MainWindow *&mainWindow)
QtMainWindow *mainWindow()
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).

Private Functions

void _setupGlobalShortcut(std::shared_ptr<sh::actions::AbstractActionItem> action)
void _setupGlobalShortcut_recursive(std::shared_ptr<sh::actions::SubmenuActionItem> submenu)
void _addPermanentActionToToolbar(std::shared_ptr<sh::actions::SubmenuActionItem> a, bool rightSide = false, bool preventDefaultAction = false)
void _refreshToolbar(std::shared_ptr<sh::actions::ActionInstantiation>)
void _jumpToNode(std::shared_ptr<sh::filesystem::FilesystemNode> node, int skip)
void _jumpToIndex(QModelIndex idx, int skip)
void _newToStatusbar_helper(sh::ui::qt::QtActionExecutionInfoPanel *w)
void _refresh_detailthumbnailvisibility()
void _thumbnail_resized()
void _resizethumbnail()
void _detailpanel_resized()
void _resizedetailpanel()
void requestDetailThumbnail(bool force = true)
void setStatusBarVisibility(bool v)

Private Members

Ui::QtMainWindow *ui
sh::ui::qt::QtFilesystemPanel *fspanel
sh::filesystem::FilesystemModelDirectoryTreeProxy *treemodel = 0
sh::ui::qt::QtJumpBar *jumpbar
QTimer _statusbar_timer
int _statusbar_fullheight
int _statusbar_targetheight = 0
QSet<sh::ui::qt::QtActionExecutionInfoPanel*> _statusbar_childs
std::shared_ptr<sh::filesystem::FilesystemNode> _currentDirectory = 0
bool _request_detailthumbnail_skip = false
int _thumbnailwidth = 0
Qt::Orientation _myorientation = Qt::Horizontal
sh::ui::qt::QtUIStyle *_uistyle = 0
QAction *_toolbarLeftRightSplitSeparator
QHash<QString, std::shared_ptr<sh::actions::common::ActionGroups>> actionGroupsActions
QList<QtToolbarButtonHandler*> toolbarButtonHandlers
std::shared_ptr<QtDialogManager> _dialogManager

Private Slots

void slot_detailbar_moved()
void slot_toolbar_moved()
void slot_statusbartimer()
void slot_treeview_collapsedexpanded(const QModelIndex &index)

Private Static Attributes

QtMainWindow *_qtMainWindow = nullptr

Friends

friend class QtToolbarButton
friend class QtFilesystemPanel
class MyFlexibleLabel : public QLabel
#include <qtmainwindow.h>

Needed internally in main window in order to have a label which really does not request any sizes.

Public Functions

MyFlexibleLabel(QWidget *parent = 0)
QSize sizeHint() const override
class QtManageBookmarksDialog : public sh::ui::qt::QtDialog, public sh::ui::ManageBookmarksDialog
#include <qtmanagebookmarksdialog.h>

Qt based manage bookmarks dialog.

Public Functions

QtManageBookmarksDialog()
~QtManageBookmarksDialog()
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 Functions

void readBookmarks()
void _refresh_values()
void _selectbookmark(QString id)
void _selectfolder(QStringList name)

Private Members

Ui::QtManageBookmarksDialog *ui

Private Slots

void on_btnClose_clicked()
void on_treeWidget_itemSelectionChanged()
void on_btnDelete_clicked()
void on_edtLabel_textChanged(const QString &arg1)
void on_edtLocation_textChanged(const QString &arg1)
void on_btnStore_clicked()
void on_btnNew_clicked()
void on_btnUp_clicked()
void on_btnDown_clicked()
void on_btnMove_clicked()
class QtManageProfilesDialog : public sh::ui::qt::QtDialog, public sh::ui::ManageProfilesDialog
#include <qtmanageprofilesdialog.h>

Qt based manage saved settings dialog.

Public Functions

QtManageProfilesDialog()
~QtManageProfilesDialog()
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 Functions

void _createProfileList()
void _createSettingsList()
void _createNodesList()

Private Members

Ui::QtManageProfilesDialog *ui
QStringListModel *_model
sh::settings::ProfileNode *_currentNode = 0
QHash<QListWidgetItem*, QString> _nodes

Private Slots

void on_comboBox_currentTextChanged(const QString &arg1)
void on_btnClose_clicked()
void on_btnDelNode_clicked()
void on_btnDelProfile_clicked()
void slot_listViewactivated(QListWidgetItem*, QListWidgetItem*)
class QtOpenWithDialog : public sh::ui::qt::QtDialog, public sh::ui::OpenWithDialog
#include <qtopenwithdialog.h>

Qt based open with dialog.

Public Functions

QtOpenWithDialog(std::shared_ptr<sh::filesystem::FilesystemNode> node, QList<std::shared_ptr<sh::tools::filetypes::OpenMethod>> openMethods)
~QtOpenWithDialog()
void setProgramList(QList<std::shared_ptr<sh::tools::filetypes::OpenMethod>> openMethods)
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.

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 Members

std::shared_ptr<sh::tools::filetypes::OpenMethod> _chosenMethod
std::shared_ptr<const sh::filesystem::Eurl> _rememberfordirectory
QAbstractItemModel *_listmodel
Ui::QtOpenWithDialog *ui

Private Slots

void on_btnCancel_clicked()
void on_btnOk_clicked()
void on_btnSelectOther_clicked()
void on_listView_activated(const QModelIndex &index)
void on_btnAnotherAncestor_clicked()
void on_chkRememberDir_toggled(bool checked)
class QtOpenWithDialogModel : public QStringListModel
#include <qtopenwithdialog.h>

Used internally in OpenWithDialogModel.

Public Functions

QtOpenWithDialogModel(QList<std::shared_ptr<sh::tools::filetypes::OpenMethod>> methods, QObject *parent = 0)
QVariant data(const QModelIndex &index, int role) const

Private Members

QList<std::shared_ptr<sh::tools::filetypes::OpenMethod>> _methods
class QtSearchPanel : public QWidget
#include <qtsearchpanel.h>

Search panel for usage in the Qt main window.

Public Functions

QtSearchPanel(std::shared_ptr<sh::filesystem::FilesystemNode> node, QWidget *parent = 0)
~QtSearchPanel()

Friends

friend class QtSearchPanelConfiguration
template<class T1, class T2>
class QtSearchPanelAbstractEditor : public T1, public T2
#include <qtsearchpanelconfiguration.h>

Helper for other Qt based search panel editors.

Public Functions

QtSearchPanelAbstractEditor(QWidget *parent = 0)
bool isWidgetEnabled()
void setWidgetEnabled(bool v)
class QtSearchPanelButton : public sh::ui::qt::QtLinkButton, public sh::ui::SearchPanelButton
#include <qtsearchpanelconfiguration.h>

Qt based SearchPanelButton.

Public Functions

QtSearchPanelButton(QWidget *parent = 0)
void setButtonText(QString txt)

Sets the button text. .

void setMenuSelection(int i)

Sets the currently selected menu item (for buttons with menus). .

void setSizeByFactor(int f)
void setMenu(QStringList items, QString menuchangetxt = tr("(change)"))
void setSelectedMenuItem(int idx)

Signals

void menuItemSelected(int idx)
class QtSearchPanelConfiguration : public sh::ui::SearchPanelConfiguration
#include <qtsearchpanelconfiguration.h>

Search panel configuration for usage in a Qt ui.

Public Functions

QtSearchPanelConfiguration(QtSearchPanel *owner, QHBoxLayout *editors)
SearchPanelButton *addMenuButton(QString text, QStringList menu, std::function<void(int)> onchanged)

Adds and returns a button for a menu. .

SearchPanelButton *addActionButton(QString text, std::function<void()> action)

Adds and returns a button for an action. .

SearchPanelTextEditor *addTextEditor()

Adds and returns a text editor. .

SearchPanelDateTimeEditor *addDateTimeEditor()

Adds and returns a date/time editor. .

SearchPanelLabelEditor *addLabel()

Adds and returns a label. .

SearchPanelSpacerEditor *addSpacer()

Adds and returns a spacer. .

SearchPanelAbstractEditor *getEditorAt(int i)

Returns the editor widget at a given position. .

void onDestroyed(std::function<void()> fctQObject *owner = 0, )

Sets a handler for panel removal (optionally bound to an owner lifetime).

Public Members

_SearchPanelConfiguration_HelperQObject myqobject

Private Members

QtSearchPanel *owner
QHBoxLayout *editors
class QtSearchPanelDateTimeEditor : public sh::ui::qt::QtSearchPanelAbstractEditor<QDateTimeEdit, SearchPanelDateTimeEditor>
#include <qtsearchpanelconfiguration.h>

Qt based SearchPanelDateTimeEditor.

Public Functions

QtSearchPanelDateTimeEditor(QWidget *parent = 0)
QDateTime datetime()

Returns the selected date/time. .

void setDatetime(QDateTime s)

Sets the selected date/time.

bool isWidgetEnabled()
void setWidgetEnabled(bool v)
class QtSearchPanelLabelEditor : public sh::ui::qt::QtSearchPanelAbstractEditor<QLabel, sh::ui::SearchPanelLabelEditor>
#include <qtsearchpanelconfiguration.h>

Qt based SearchPanelLabelEditor.

Public Functions

QtSearchPanelLabelEditor(QWidget *parent = 0)
QString textContent()

Returns the text content. .

void setTextContent(QString s)

Sets the text content. .

SearchPanelAbstractEditor *focusProxyEditor()

Returns the focus proxy widget (which focus gets redirected to in some situations). .

void setFocusProxyEditor(SearchPanelAbstractEditor *w)

Sets the focus proxy widget (which focus gets redirected to in some situations). .

bool isWidgetEnabled()
void setWidgetEnabled(bool v)
class QtSearchPanelSpacerEditor : public sh::ui::qt::QtSearchPanelAbstractEditor<QLabel, sh::ui::SearchPanelSpacerEditor>
#include <qtsearchpanelconfiguration.h>

Qt based SearchPanelSpacerEditor.

Public Functions

QtSearchPanelSpacerEditor(QWidget *parent = 0)
bool isWidgetEnabled()
void setWidgetEnabled(bool v)
class QtSearchPanelTextEditor : public sh::ui::qt::QtSearchPanelAbstractEditor<QLineEdit, sh::ui::SearchPanelTextEditor>
#include <qtsearchpanelconfiguration.h>

Qt based SearchPanelTextEditor.

Public Functions

QtSearchPanelTextEditor(QWidget *parent = 0)
QString textContent()

Returns the text content. .

void setTextContent(QString s)

Sets the text content. .

QString placeholderDescription()

Returns the placeholder description text (visible if field is empty). .

void setPlaceholderDescription(QString s)

Sets the placeholder description text (visible if field is empty). .

bool isWidgetEnabled()
void setWidgetEnabled(bool v)
class QtSettingUIFrame : public QFrame
#include <qtsettinguiframe.h>

User interface for one handling one setting.

Public Functions

QtSettingUIFrame(sh::settings::Setting *setting, bool withcheckbox, QString displayvalue, QString additionalCheck, QVariant additionalCheckValue, QWidget *parent = 0)
bool isChecked()
void setChecked(bool val)
void setAdditionalCheckVisible(bool v)
QVariant additionalCheckValue()

Private Members

QCheckBox *_checkbox = 0
QCheckBox *_additionalcheckbox = 0
QLabel *_additionalcheckboxlabel = 0
QWidget *_additionalcheckwidget = 0
QVariant _additionalCheckValue
class QtStoreProfileDialog : public sh::ui::qt::QtDialog, public sh::ui::StoreProfileDialog
#include <qtstoreprofiledialog.h>

Qt based save settings dialog.

Public Functions

QtStoreProfileDialog(std::shared_ptr<const sh::filesystem::Eurl> eurl)
~QtStoreProfileDialog()
QList<sh::ui::StoreProfileDialog::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).

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 Functions

void _settingsLevel(int level, bool persist = true)
void _setglobal(bool v)

Private Members

QHash<sh::ui::qt::QtSettingUIFrame*, std::shared_ptr<sh::settings::Setting>> _widgets
QHash<int, QLabel*> _headerlabels
QStringList _inheritProfileNameList
bool _global = false
Ui::QtStoreProfileDialog *ui
int _level

Private Slots

void on_btnAddProf_clicked()
void on_btnGlobal_clicked()
void on_btn22_clicked()
void on_toolButton_2_clicked()
void on_toolButton_clicked()
class QtToolbarButton : public QToolButton
#include <qttoolbarbutton.h>

A qt toolbar button implementation with optional submenu.

Public Types

enum Position

Values:

enumerator LEFT
enumerator RIGHT
enumerator TOP
enumerator BOTTOM

Public Functions

QtToolbarButton(QWidget *parent = 0)
void setText(const QString &text)
QString text() const
void setIcon(const QIcon &icon)
QIcon icon()
QSize sizeHint() const
void setButtonText(QString v)
QString buttonText()
void setButtonIcon(QIcon v)
QIcon buttonIcon()
void setButtonEnabled(bool v)
bool isButtonEnabled()
bool hasExpander()
void setSubmenu(QtActionMenu *menu)
QtActionMenu *submenu()
void setLocation(Position location)
void setClickAction(std::function<void()> action)
void unsetClickAction()
void trigger()
void openMenu()

Private Functions

void _calcDims()
void computeArrowAndDividerLineCoordinates()

Private Members

QString _text
QString _text1
QString _textWithoutMnemonic1
QString _text2
QString _textWithoutMnemonic2
QIcon _icon
bool _drawIconOnly = false
bool _hovered = false
bool _arrowhovered = false
sh::ui::qt::QtActionMenu *_menu = 0
std::function<void()> _clickAction
Position location
int tw1
int tworig1
int tw2
int tworig2
int twmax
int tworigmax
int th
int thorig
int iw
int ih
int iedim
int ew
int eh
const int textpad = 20
const int opad = 3
int expx1
int expx2
int expy1
int expy2
int xt
int yt1
int yt2
int xi
int yi
QPainterPath arrow
bool _drawmnemonics = false

Private Slots

void slot_clicked()

Friends

friend class sh::actions::ActionsManager
class QtToolbarButtonHandler
#include <qttoolbarbuttonhandler.h>

A handler which reflects the sh::actions objects to a graphical toolbar button (and keeps that up-to-date).

Public Functions

QtToolbarButtonHandler(std::shared_ptr<sh::actions::SubmenuActionItem> action, bool preventDefaultAction, QtToolbarButton *button, QAction *qaction)
~QtToolbarButtonHandler()

Private Functions

void _updateSubmenu()

Private Members

std::shared_ptr<sh::actions::SubmenuActionItem> action
QtActionMenu menu
bool preventDefaultAction
QtToolbarButton *button

Private Static Functions

void _applyPropertiesToButton(sh::actions::SubmenuActionItem *action, QtToolbarButton *button, QAction *qaction)
class QtTuningDialog : public sh::ui::qt::QtDialog, public sh::ui::TuningDialog
#include <qttuningdialog.h>

Qt based tuning dialog.

Public Functions

QtTuningDialog()
~QtTuningDialog()
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 Types

typedef QPair<QString, QWidget*> BoxWidgetByDesc

Private Functions

QString _changedlglabel(std::shared_ptr<sh::configuration::ConfigurationValue> cv)
void do_change(std::shared_ptr<sh::configuration::ConfigurationValue> cv)
void filterVisibility(QString s)

Private Members

Ui::QtTuningDialog *ui
QList<BoxWidgetByDesc> boxWidgetsByDesc

Private Slots

void on_btnCancel_clicked()
void on_lineEditSearchInt_textChanged(const QString &arg1)
void on_lineEditSearchExt_textChanged(const QString &arg1)
void on_lineEditSearchBehav_textChanged(const QString &arg1)
void on_lineEditSearchAppear_textChanged(const QString &arg1)
void on_tabWidget_currentChanged(int index)
class QtUIStyle
#include <qtuistyle.h>

Methods for applying the Shallot visible style.

See sh::ui::qt::QtMainWindow about how to get an instance.

Public Functions

QtUIStyle(sh::ui::qt::QtMainWindow *mainwnd)

Constructed only by the infrastructure and made available otherwise.

QColor windowColor()
QColor backgroundColor()
QColor inactiveBackgroundColor()
QColor windowColorHighlighted()
QColor windowColorHalfHighlighted()
QColor windowColorDarkened()
QColor windowColorLikeTitlebar()
QColor linkColor()
QColor titlebarColor()
QColor foregroundColor()
QColor foregroundColorLighter1()
QColor foregroundColorLighter2()
int fontSizeInPt(int r = 100)
QColor mix(float n1, QColor c1, QColor c2)
Sheet createSheet()

Private Members

sh::ui::qt::QtMainWindow *_mainWindow
class Sheet
#include <qtuistyle.h>

Public Functions

QString sheet()
Sheet customcss(QString css)
Sheet fontsize_byFactor(int f)
Sheet fontsize_header()
Sheet fontsize_smaller()
Sheet textcolor(QColor color)
Sheet textcolor_lighter1()
Sheet textcolor_lighter2()
Sheet background(QColor color, bool restrictQWidget = true)
Sheet background_highlighted(bool restrictQWidget = true)
Sheet background_halfhighlighted(bool restrictQWidget = true)
Sheet background_darkened(bool restrictQWidget = true)
Sheet background_liketitlebar(bool restrictQWidget = true)
Sheet applyTo(QWidget *widget)
Sheet bold()

Private Functions

Sheet(QtUIStyle *style, QString sheet)

Private Members

QString _sheet
QtUIStyle *_style

Friends

friend class QtUIStyle
namespace feedbackpanels

Qt user interface parts for user feedback in action execution dialogs.

Implementations of sh::ui::qt::feedbackpanels::FeedbackPanel are used for implementing parts of sh::ui::ActionExecutionInfoDialog.

Typedefs

typedef QPair<QString, QWidget*> GridFormRow
class Credentials : public sh::ui::qt::feedbackpanels::FeedbackPanel
#include <credentials.h>

FeedbackPanel for user login credentials (password based).

Public Functions

Credentials(QString domain, QString username, QString password, QString text, bool showDomain, bool showUsername, bool showPassword, bool showAnonymous, bool showRemember)
~Credentials()
void cancelRequested()
bool isClosed()
void waitUntilClosed()
int preferredHeight()

Public Members

QString domain
QString username
QString password
bool anonymous
bool remember
bool accepted

Signals

void wasClosed()

Private Members

Ui::Credentials *ui

Private Slots

void on_chkAnonymous_toggled(bool checked)
void on_pushButton_3_clicked()
void on_pushButton_4_clicked()
class FeedbackPanel : public QWidget
#include <feedbackpanel.h>

Abstract base class for a Qt helper widget used in action user feedback.

Subclassed by sh::ui::qt::feedbackpanels::Credentials, sh::ui::qt::feedbackpanels::GridForm, sh::ui::qt::feedbackpanels::MsgBox, sh::ui::qt::feedbackpanels::UnixPermissions

Public Functions

FeedbackPanel(QWidget *parent = 0)
bool isClosed()
void waitUntilClosed()
int preferredHeight()
void cancelRequested() = 0

Signals

void wasClosed()

Private Members

QMutex _mutex
QWaitCondition _closedcondition
bool _closed = false
class GridForm : public sh::ui::qt::feedbackpanels::FeedbackPanel
#include <gridform.h>

FeedbackPanel for grid based forms.

Public Functions

GridForm(QString text, QList<sh::ui::qt::feedbackpanels::GridFormRow> form, QStringList answers, int defaultanswer = -1, int cancelanswer = -1, QWidget *parent = 0)
~GridForm()
int preferredHeight()
void cancelRequested()
bool isClosed()
void waitUntilClosed()

Public Members

int answer = -1

Signals

void wasClosed()

Private Members

Ui::GridForm *ui
QHash<QPushButton*, int> btn2index
QPushButton *_cancelBtn = 0
QPushButton *_defaultBtn = 0

Private Slots

void slot_btnclicked()
class GridFormInnerSimpleChooser : public QWidget
#include <gridforminnersimplechooser.h>

Helper widget for a GridForm.

Public Functions

GridFormInnerSimpleChooser(sh::actions::ActionExecutionUserFeedback::Choices *choices, QWidget *parent = 0)
~GridFormInnerSimpleChooser()

Public Members

int answer = -1
QString text

Private Functions

bool eventFilter(QObject *obj, QEvent *event)

Private Members

QLineEdit *lineedit
sh::actions::ActionExecutionUserFeedback::Choices *choices
QVBoxLayout *mylayout
sh::actions::ActionExecutionUserFeedback::Choice *currentchoice = 0

Private Slots

void slot_chosen(int id)
void slot_textedited(QString t)
class MsgBox : public sh::ui::qt::feedbackpanels::FeedbackPanel
#include <msgbox.h>

FeedbackPanel for showing a message, some answer buttons, and optionally a text input box.

Public Functions

MsgBox(QString question, QList<QString> answers, QString icon = "", QString withInputBox = QString(), bool inputBoxMultiline = false, int defaultanswer = -1, int cancelanswer = -1, int valuePreselectFrom = -1, int valuePreselectTo = -1, QList<QString> answericons = QList<QString>(), QWidget *parent = 0)
~MsgBox()
void cancelRequested()
bool isClosed()
void waitUntilClosed()

Public Members

int answer = -1
QString text

Signals

void wasClosed()

Private Members

Ui::MsgBox *ui
QHash<QPushButton*, int> btn2index
QWidget *_initialFocusWidget = 0
QPushButton *_cancelBtn = 0
QPushButton *_defaultBtn = 0
bool _inputBoxMultiline
int _valuePreselectFrom
int _valuePreselectTo

Private Slots

void slot_btnclicked()
class UnixPermissions : public sh::ui::qt::feedbackpanels::FeedbackPanel
#include <unixpermissions.h>

FeedbackPanel for setting one set of unix filesystem permissions.

Public Functions

UnixPermissions(QWidget *parent = 0)
~UnixPermissions()
void cancelRequested()
void setflags(bool userMayRead, bool userMayWrite, bool userMayExecute, bool groupMayRead, bool groupMayWrite, bool groupMayExecute, bool othersMayRead, bool othersMayWrite, bool othersMayExecute, bool sticky, bool setuid, bool setgid)
void setusers(QStringList users, QString selecteduser)
void setgroups(QStringList groups, QString selectedgroup)
bool isClosed()
void waitUntilClosed()
int preferredHeight()

Public Members

bool accepted
bool userMayRead
bool userMayWrite
bool userMayExecute
bool groupMayRead
bool groupMayWrite
bool groupMayExecute
bool othersMayRead
bool othersMayWrite
bool othersMayExecute
bool sticky
bool setuid
bool setgid
QString user
QString group

Signals

void wasClosed()

Private Members

Ui::UnixPermissions *ui

Private Slots

void on_pushButton_clicked()
void on_pushButton_2_clicked()
namespace 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

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 _handleUserFeedback(QString kind, std::shared_ptr<UserFeedback> userfeedback)
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
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.

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

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

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

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

void gotoDir(std::shared_ptr<sh::filesystem::FilesystemNode> n) override

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

bool hiddenFilesVisible() override

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

void setSelection(const QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes) override

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()
void setSelectedNode(std::shared_ptr<sh::filesystem::FilesystemNode> node)
void setCheckedNodes(QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes)

Private Members

std::shared_ptr<sh::filesystem::FilesystemModelFileviewProxy> _model
qint64 _id
FileViewMode _viewmode = FileViewMode::ListView
sh::filesystem::SizeFormatting _sizeformatting = sh::filesystem::SizeFormatting::SizeFormattingModePrefixes
bool _hiddenFilesVisible = false
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)
int getFileViewIndex(sh::ui::FileView *fileview)
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 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

QList<std::shared_ptr<WebFileView>> _fileviews
int _icurrentfileview = 0

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

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

sh::ui::FileView *getFileView(int i) override

Returns a file view by position index. .

void jumpToNode(std::shared_ptr<sh::filesystem::FilesystemNode> node) override

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

std::shared_ptr<OpenWithDialog> showOpenWithDialog(std::shared_ptr<sh::filesystem::FilesystemNode> node, QList<std::shared_ptr<sh::tools::filetypes::OpenMethod>> openMethods) override

Shows and returns a ‘Open With’ dialog. .

std::shared_ptr<StoreProfileDialog> showStoreProfileDialog(std::shared_ptr<const sh::filesystem::Eurl> eurl) override

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

std::shared_ptr<FilePropertyDialog> showFilePropertyDialog(QList<std::shared_ptr<sh::filesystem::FilesystemNode>> nodes) override

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

void jumpToEurl(std::shared_ptr<const sh::filesystem::Eurl> eurl)

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 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<sh::ui::web::WebActionManager> actionManager()
void setCloseable(bool closeable, QString message = QString()) override

Sets the closeable state and message.

void setCurrentEurlByNode(std::shared_ptr<sh::filesystem::FilesystemNode> node)

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 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
class WebOpenWithDialog : public QObject, public sh::ui::web::WebDialog, public sh::ui::OpenWithDialog
#include <webopenwithdialog.h>

Web based open with dialog.

Public Functions

WebOpenWithDialog(std::shared_ptr<sh::filesystem::FilesystemNode> node, QList<std::shared_ptr<sh::tools::filetypes::OpenMethod>> openMethods)
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)
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.

void addAndPreserveModule(std::shared_ptr<sh::ui::web::WebModule> module)

Plugs a WebModule into the engine and holds a pointer to it. Unplug it by calling removeModule().

void addModule(std::shared_ptr<sh::ui::web::WebModule> module)

Plugs a WebModule into the engine. Unplug it by either delete module (drop all pointers to it) or by calling removeModule().

void removeModule(sh::ui::web::WebModule *module)

Unplugs a WebModule from the engine.

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
QList<std::weak_ptr<sh::ui::web::WebModule>> _modules
QList<std::shared_ptr<sh::ui::web::WebModule>> _smodules
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 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 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

Public Functions

JanitorThread(WebServerEngineDispatcher *dispatcher)
void run() override

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

See lastBrowserHeartbeat().

void gotUserInteraction(int value)

Refreshes the user interaction timestamp.

See lastUserInteraction().

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

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

WebStoreProfileDialog(std::shared_ptr<const sh::filesystem::Eurl> eurl)
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)
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)
QJsonObject configurationValueToJsonObject(std::shared_ptr<sh::configuration::ConfigurationValue> cfgval)
namespace engines

Web server low-level engine implementations.