CFileNameParamGuiComp.h
Go to the documentation of this file.
1 #ifndef iqtprm_CFileNameParamGuiComp_included
2 #define iqtprm_CFileNameParamGuiComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QtGlobal>
7 #if QT_VERSION >= 0x050000
8 #include <QtWidgets/QFileSystemModel>
9 #else
10 #include <QtGui/QFileSystemModel>
11 #endif
12 
13 // ACF includes
14 #include <ifile/IFileTypeInfo.h>
15 
16 #include <ifile/IFileNameParam.h>
17 
19 
20 #include <GeneratedFiles/iqtprm/ui_CFileNameParamGuiComp.h>
21 
22 
23 namespace iqtprm
24 {
25 
26 
28  Ui::CFileNameParamGuiComp,
29  ifile::IFileNameParam>
30 {
31  Q_OBJECT
32 
33 public:
35  Ui::CFileNameParamGuiComp,
37 
38  I_BEGIN_COMPONENT(CFileNameParamGuiComp);
39  I_ASSIGN(m_pathLabelAttrPtr, "PathLabel", "Label for the file editor", false, "Directory");
40  I_ASSIGN(m_startHintAttrPtr, "StartHint", "Start hint for the editor", false, "<Enter path>");
41  I_ASSIGN(m_fileTypeInfoPtr, "FileTypeInfo", "Allows to retrieve optional file type information for file selection dialog", false, "FileTypeInfo");
42  I_ASSIGN(m_readOnlyAttrPtr, "ReadOnly", "True if read only", true, false);
43  I_ASSIGN(m_filesComboAttrPtr, "FilesComboBox", "Show combobox with files", true, true);
44  I_ASSIGN(m_labelWidthAttrPtr, "LabelWidth", "Fixed label width (in pixels)", false, 100);
45  I_ASSIGN(m_defaultDirPtr, "DefaultPath", "Default path to search", false, "C:/");
46  I_ASSIGN(m_showBrowseButtonAttrPtr, "ShowBrowseButton", "If enabled, the browse button will be shown", true, true);
47  I_END_COMPONENT;
48 
49 protected:
50  // reimplemented (iqtgui::CGuiComponentBase)
51  virtual void OnGuiCreated();
52  virtual void OnGuiRetranslate();
53 
54  // reimplemented (iqtgui::TGuiObserverWrap)
55  virtual void OnGuiModelAttached();
56  virtual void UpdateModel() const;
57  virtual void UpdateGui(const istd::IChangeable::ChangeSet& changeSet);
58 
59 protected Q_SLOTS:
61  void on_DirEdit_editTextChanged(const QString& text);
62  void OnDirectoryUp();
63 
64 private:
65  void SetPathToEditor(const QString& path) const;
66  void MakeSelectionHint(const QString& text) const;
67  QIcon GetFileIcon(const QString& filePath) const;
68  void OnPathEdited(const QString& path) const;
69  QString GetPathFromEditor() const;
70  bool IsLabelNeeded() const;
71 
72 private:
73  I_TEXTATTR(m_pathLabelAttrPtr);
74  I_TEXTATTR(m_startHintAttrPtr);
75  I_ATTR(bool, m_readOnlyAttrPtr);
76  I_ATTR(bool, m_filesComboAttrPtr);
77  I_ATTR(int, m_labelWidthAttrPtr);
78  I_ATTR(bool,m_showBrowseButtonAttrPtr);
79  I_REF(ifile::IFileTypeInfo, m_fileTypeInfoPtr);
80  I_REF(ifile::IFileNameParam, m_defaultDirPtr);
81 
82  QFileSystemModel m_directoryModel;
83 };
84 
85 
86 } // namespace iqtprm
87 
88 
89 #endif // !iqtprm_CFileNameParamGuiComp_included
90 
91 
Provide loading and saving of objects.
Definition: IFileTypeInfo.h:22
virtual void UpdateGui(const istd::IChangeable::ChangeSet &changeSet)
Do update of the GUI to reflect the state of model.
virtual void OnGuiModelAttached()
Called when model is attached and GUI is created.
Common interface for any file system item name (e.g directory, file or URL path)
virtual void UpdateModel() const
Do update of the model to reflect the current contents of GUI.
Base class for all Qt GUI components.
iqtgui::TDesignerGuiObserverCompBase< Ui::CFileNameParamGuiComp, ifile::IFileNameParam > BaseClass
virtual void OnGuiCreated()
Called just after GUI is initialized.
virtual void OnGuiRetranslate()
Called from widget event filter when GUI should be retranslated.
void on_DirEdit_editTextChanged(const QString &text)
Set of change flags (its IDs).
Definition: IChangeable.h:30

© 2007-2017 Witold Gantzke and Kirill Lepskiy