ACF $AcfVersion:0$
CFileSystemExplorerGuiComp.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QtGlobal>
7#if QT_VERSION >= 0x050000
8#include <QtCore/QItemSelectionModel>
9#include <QtWidgets/QTreeWidget>
10#include <QtWidgets/QFileIconProvider>
11#else
12#include <QtGui/QItemSelectionModel>
13#include <QtGui/QTreeWidget>
14#include <QtGui/QFileIconProvider>
15#endif
16
17#if QT_VERSION >= 0x050000 && QT_VERSION < 0x060000
18#include <QtWidgets/QFileSystemModel>
19#else
20#include <QtGui/QFileSystemModel>
21#endif
22
23// ACF includes
25#include <ifile/IFileTypeInfo.h>
29
30#include <GeneratedFiles/ifilegui/ui_CFileSystemExplorerGuiComp.h>
31
32
33namespace ifilegui
34{
35
36
45 public iqtgui::TDesignerGuiObserverCompBase<Ui::CFileSystemExplorerGuiComp, ifile::IFileNameParam>,
47{
48 Q_OBJECT
49public:
51 Ui::CFileSystemExplorerGuiComp, ifile::IFileNameParam> BaseClass;
52
53 I_BEGIN_COMPONENT(CFileSystemExplorerGuiComp);
54 I_ASSIGN(m_filterInfoCompPtr, "FilterInfo", "Provides information about supported files used to filter shown files", false, "FilterInfo");
55 I_ASSIGN(m_rootPathParamCompPtr, "RootPath", "Sets the root path", false, "RootPath");
56 I_ASSIGN_TO(m_rootPathParamModelCompPtr, m_rootPathParamCompPtr, false);
57 I_ASSIGN(m_showUserFilterAttrPtr, "ShowUserFilter", "If activated user filter line will be shown", true, false);
58 I_ASSIGN(m_showFileTypeAttrPtr, "ShowFileType", "Show file type description", true, false);
59 I_ASSIGN(m_showFileModificationTimeAttrPtr, "ShowFileModificationTime", "If activated file modification time stamp will be shown for each file", true, false);
60 I_ASSIGN(m_useSystemDecoratedIconsAttrPtr, "UseSystemDecoratedIcons", "If enabled, system decorated icons are used", false, false);
61 I_ASSIGN(m_allowOpenFileAttrPtr, "AllowOpenFile", "If enabled, the file will be opened by operation system shell", false, false);
62 I_END_COMPONENT;
63
65
66protected:
71 QStringList GetDefaultFilters() const;
72
73 void InvalidateFileSystemModel(const QString& currentFilePath);
75
76 // reimplemented (iqtgui::TGuiObserverWrap)
77 virtual void UpdateGui(const istd::IChangeable::ChangeSet& changeSet) override;
78
79 // reimplemented (iqtgui::CGuiComponentBase)
80 virtual void OnGuiCreated() override;
81
82 // reimplemented (imod::CMultiModelDispatcherBase)
83 virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet& changeSet) override;
84
85private Q_SLOTS:
86 void OnFilterChanged();
87 void OnNewDirLoaded(const QString& path);
88 void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
89 void OnDoubleClicked(const QModelIndex& index);
90
91private:
92 I_REF(ifile::IFileTypeInfo, m_filterInfoCompPtr);
93 I_REF(ifile::IFileNameParam, m_rootPathParamCompPtr);
94 I_REF(imod::IModel, m_rootPathParamModelCompPtr);
95 I_ATTR(bool, m_showUserFilterAttrPtr);
96 I_ATTR(bool, m_showFileTypeAttrPtr);
97 I_ATTR(bool, m_showFileModificationTimeAttrPtr);
98 I_ATTR(bool, m_useSystemDecoratedIconsAttrPtr);
99 I_ATTR(bool, m_allowOpenFileAttrPtr);
100
101 class FileIconProvider: public QFileIconProvider
102 {
103 public:
104 typedef QFileIconProvider BaseClass;
105
106 // reimplemented (QFileIconProvider)
107 virtual QIcon icon(const QFileInfo& fileInfo) const override;
108 };
109
110 iwidgets::CExtLineEdit* m_filterEditPtr;
111
112 FileIconProvider m_fileIconProvider;
113
114 QFileSystemModel m_fileSystemModel;
115};
116
117
118} // namespace ifilegui
119
120
121
122
Common interface for any file system item name (e.g directory, file or URL path)
Provide loading and saving of objects.
UI component for visualization of file system contents.
void InvalidateFileSystemModel(const QString &currentFilePath)
QStringList GetDefaultFilters() const
Get default list of filters.
virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet &changeSet) override
Called when some model observed by dispatcher will be changed.
virtual void UpdateGui(const istd::IChangeable::ChangeSet &changeSet) override
iqtgui::TDesignerGuiObserverCompBase< Ui::CFileSystemExplorerGuiComp, ifile::IFileNameParam > BaseClass
virtual void OnGuiCreated() override
Generic implementation of a data model changes notifier.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:25
Base class for all Qt GUI components.
Set of change flags (its IDs).
Definition IChangeable.h:36
Input editor with extended functionality.
GUI specific interfaces and components for file system access and representation.