Class sh::ui::web::WebMainWindow

class sh::ui::web::WebMainWindow : public QObject, public sh::ui::MainWindow, public sh::ui::web::WebModule

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