Class sh::ui::MainWindow

class sh::ui::MainWindow

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