Class sh::ui::qt::QtMainWindow

class sh::ui::qt::QtMainWindow : public QMainWindow, public sh::ui::MainWindow

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

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