ACF $AcfVersion:0$
CFileNameParamGuiComp.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 && QT_VERSION < 0x060000
8#include <QtWidgets/QFileSystemModel>
9#else
10#include <QtGui/QFileSystemModel>
11#endif
12
13// ACF includes
14#include <ifile/IFileTypeInfo.h>
15
17
19
20#include <GeneratedFiles/iqtprm/ui_CFileNameParamGuiComp.h>
21
22
23namespace iqtprm
24{
25
26
28 Ui::CFileNameParamGuiComp,
29 ifile::IFileNameParam>
30{
31 Q_OBJECT
32
33public:
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
49protected:
50 // reimplemented (iqtgui::CGuiComponentBase)
51 virtual void OnGuiCreated() override;
52 virtual void OnGuiRetranslate() override;
53 virtual void OnGuiDesignChanged() override;
54
55 // reimplemented (iqtgui::TGuiObserverWrap)
56 virtual void OnGuiModelAttached() override;
57 virtual void UpdateModel() const override;
58 virtual void UpdateGui(const istd::IChangeable::ChangeSet& changeSet) override;
59
60protected Q_SLOTS:
62 void on_DirEdit_editTextChanged(const QString& text);
64
65private:
66 void SetPathToEditor(const QString& path) const;
67 void MakeSelectionHint(const QString& text) const;
68 QIcon GetFileIcon(const QString& filePath) const;
69 void OnPathEdited(const QString& path) const;
70 QString GetPathFromEditor() const;
71 bool IsLabelNeeded() const;
72
73private:
74 I_TEXTATTR(m_pathLabelAttrPtr);
75 I_TEXTATTR(m_startHintAttrPtr);
76 I_ATTR(bool, m_readOnlyAttrPtr);
77 I_ATTR(bool, m_filesComboAttrPtr);
78 I_ATTR(int, m_labelWidthAttrPtr);
79 I_ATTR(bool,m_showBrowseButtonAttrPtr);
80 I_REF(ifile::IFileTypeInfo, m_fileTypeInfoPtr);
81 I_REF(ifile::IFileNameParam, m_defaultDirPtr);
82
83 QFileSystemModel m_directoryModel;
84};
85
86
87} // namespace iqtprm
88
89
90
91
Common interface for any file system item name (e.g directory, file or URL path)
Provide loading and saving of objects.
Base class for all Qt GUI components.
virtual void OnGuiCreated() override
iqtgui::TDesignerGuiObserverCompBase< Ui::CFileNameParamGuiComp, ifile::IFileNameParam > BaseClass
virtual void OnGuiDesignChanged() override
virtual void OnGuiRetranslate() override
virtual void UpdateModel() const override
void on_DirEdit_editTextChanged(const QString &text)
virtual void UpdateGui(const istd::IChangeable::ChangeSet &changeSet) override
virtual void OnGuiModelAttached() override
Set of change flags (its IDs).
Definition IChangeable.h:36
#define I_TEXTATTR(member)
Declare translatable text attribute member.
This package contains Qt based implementations of standard parameter components.