CFileSystemExplorerGuiComp.h
Go to the documentation of this file.
1 #ifndef ifilegui_CFileSystemExplorerGuiComp_included
2 #define ifilegui_CFileSystemExplorerGuiComp_included
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/QFileSystemModel>
11 #include <QtWidgets/QFileIconProvider>
12 #else
13 #include <QtGui/QItemSelectionModel>
14 #include <QtGui/QTreeWidget>
15 #include <QtGui/QFileSystemModel>
16 #include <QtGui/QFileIconProvider>
17 #endif
18 
19 // ACF includes
21 #include <ifile/IFileTypeInfo.h>
22 #include <ifile/IFileNameParam.h>
24 #include <iwidgets/CExtLineEdit.h>
25 
26 #include <GeneratedFiles/ifilegui/ui_CFileSystemExplorerGuiComp.h>
27 
28 
29 namespace ifilegui
30 {
31 
32 
41  public iqtgui::TDesignerGuiObserverCompBase<Ui::CFileSystemExplorerGuiComp, ifile::IFileNameParam>,
43 {
44  Q_OBJECT
45 public:
47  Ui::CFileSystemExplorerGuiComp, ifile::IFileNameParam> BaseClass;
48 
49  I_BEGIN_COMPONENT(CFileSystemExplorerGuiComp);
50  I_ASSIGN(m_filterInfoCompPtr, "FilterInfo", "Provides information about supported files used to filter shown files", false, "FilterInfo");
51  I_ASSIGN(m_rootPathParamCompPtr, "RootPath", "Sets the root path", false, "RootPath");
52  I_ASSIGN_TO(m_rootPathParamModelCompPtr, m_rootPathParamCompPtr, false);
53  I_ASSIGN(m_showUserFilterAttrPtr, "ShowUserFilter", "If activated user filter line will be shown", true, false);
54  I_ASSIGN(m_showFileTypeAttrPtr, "ShowFileType", "Show file type description", true, false);
55  I_ASSIGN(m_showFileModificationTimeAttrPtr, "ShowFileModificationTime", "If activated file modification time stamp will be shown for each file", true, false);
56  I_ASSIGN(m_useSystemDecoratedIconsAttrPtr, "UseSystemDecoratedIcons", "If enabled, system decorated icons are used", false, false);
57  I_ASSIGN(m_allowOpenFileAttrPtr, "AllowOpenFile", "If enabled, the file will be opened by operation system shell", false, false);
58  I_END_COMPONENT;
59 
61 
62 protected:
67  QStringList GetDefaultFilters() const;
68 
69  void InvalidateFileSystemModel(const QString& currentFilePath);
70  void UpdateFileRoot();
71 
72  // reimplemented (iqtgui::TGuiObserverWrap)
73  virtual void UpdateGui(const istd::IChangeable::ChangeSet& changeSet);
74 
75  // reimplemented (iqtgui::CGuiComponentBase)
76  virtual void OnGuiCreated();
77 
78  // reimplemented (imod::CMultiModelDispatcherBase)
79  virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet& changeSet);
80 
81 private Q_SLOTS:
82  void OnFilterChanged();
83  void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
84  void OnDoubleClicked(const QModelIndex& index);
85 
86 private:
87  I_REF(ifile::IFileTypeInfo, m_filterInfoCompPtr);
88  I_REF(ifile::IFileNameParam, m_rootPathParamCompPtr);
89  I_REF(imod::IModel, m_rootPathParamModelCompPtr);
90  I_ATTR(bool, m_showUserFilterAttrPtr);
91  I_ATTR(bool, m_showFileTypeAttrPtr);
92  I_ATTR(bool, m_showFileModificationTimeAttrPtr);
93  I_ATTR(bool, m_useSystemDecoratedIconsAttrPtr);
94  I_ATTR(bool, m_allowOpenFileAttrPtr);
95 
96  class FileIconProvider: public QFileIconProvider
97  {
98  public:
99  typedef QFileIconProvider BaseClass;
100 
101  // reimplemented (QFileIconProvider)
102  virtual QIcon icon(const QFileInfo& fileInfo) const;
103  };
104 
105  iwidgets::CExtLineEdit* m_filterEditPtr;
106 
107  FileIconProvider m_fileIconProvider;
108 
109  QFileSystemModel m_fileSystemModel;
110 };
111 
112 
113 } // namespace ifilegui
114 
115 
116 #endif // !ifilegui_CFileSystemExplorerGuiComp_included
117 
118 
Input editor with extended functionality.
Definition: CExtLineEdit.h:31
iqtgui::TDesignerGuiObserverCompBase< Ui::CFileSystemExplorerGuiComp, ifile::IFileNameParam > BaseClass
Provide loading and saving of objects.
Definition: IFileTypeInfo.h:22
Generic implementation of a data model changes notifier.
virtual void UpdateGui(const istd::IChangeable::ChangeSet &changeSet)
Do update of the GUI to reflect the state of model.
QStringList GetDefaultFilters() const
Get default list of filters.
Common interface for any file system item name (e.g directory, file or URL path)
UI component for visualization of file system contents.
virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet &changeSet)
Base class for all Qt GUI components.
void InvalidateFileSystemModel(const QString &currentFilePath)
Common interface for model objects, that supports Model/Observer design pattern.
Definition: IModel.h:23
Set of change flags (its IDs).
Definition: IChangeable.h:30
virtual void OnGuiCreated()
Called just after GUI is initialized.

© 2007-2017 Witold Gantzke and Kirill Lepskiy