ACF $AcfVersion:0$
CParamsManagerGuiCompBase.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/QTimer>
7#include <QtCore/QtGlobal>
8#if QT_VERSION >= 0x050000
9#include <QtWidgets/QMenu>
10#else
11#include <QtGui/QMenu>
12#endif
13
14// ACF includes
16#include <iprm/IParamsManager.h>
19#include <iqt2d/IViewExtender.h>
20#include <GeneratedFiles/iqtprm/ui_CParamsManagerGuiCompBase.h>
21
22
23namespace iqtprm
24{
25
26
29 Ui::CParamsManagerGuiCompBase, iprm::IParamsManager>,
30 virtual public iqt2d::IViewExtender
31{
32 Q_OBJECT
33
34public:
36 Ui::CParamsManagerGuiCompBase,
38
39 I_BEGIN_BASE_COMPONENT(CParamsManagerGuiCompBase);
40 I_REGISTER_INTERFACE(iqt2d::IViewExtender);
41 I_ASSIGN(m_allowAddRemoveAttrPtr, "AllowAddRemove", "If it is false, 'Add' and 'Remove' buttons will be always hidden", true, true);
42 I_ASSIGN(m_allowUpDownAttrPtr, "AllowUpDown", "If it is false, 'Up' and 'Down' buttons will be always hidden", true, true);
43 I_ASSIGN(m_supportEnablingAttrPtr, "AllowEnable", "If this option is activated, the single parameter sets can be enabled/disabled in the list", true, false);
44 I_ASSIGN(m_supportRenameAttrPtr, "SupportRename", "Allow change parameters name", true, true);
45 I_ASSIGN(m_comboBoxViewAttrPtr, "CompactView", "Shows parameters list as a combo box", true, false);
46 I_ASSIGN(m_comboBoxEditableAttrPtr, "CompactViewComboEditable", "Combo box in compact mode is editable", true, true);
47 I_ASSIGN(m_comboBoxHiddenAttrPtr, "CompactViewComboHidden", "Combo box in compact mode is hidden - basically disables user to change selection", true, false);
48 I_ASSIGN(m_iconProviderCompPtr, "IconProvider", "Icons for drop-down types menu", false, "IconProvider");
49 I_ASSIGN(m_paramsLoaderCompPtr, "ParamsLoader", "Loader for the parameter set", false, "ParamsLoader");
50 I_ASSIGN(m_supplementaryLabelTextAttrPtr, "CopyPasteInfoLabelText", "Text of info Label", false, "");
51 I_END_COMPONENT;
52
54
55 // reimplemented (iqt2d::IViewExtender)
56 virtual void AddItemsToScene(iqt2d::IViewProvider* providerPtr, int flags) override;
57 virtual void RemoveItemsFromScene(iqt2d::IViewProvider* providerPtr) override;
58
59protected Q_SLOTS:
67 void on_ParamsTree_itemChanged(QTreeWidgetItem* item, int column);
69 void on_ParamsComboBox_editTextChanged(const QString& text);
72 void OnAddMenuOptionClicked(QAction* action);
74
75protected:
76 int GetIndexByName(const QString& itemName) const;
77
78 // abstract methods
82 virtual imod::IObserver* GetObserverPtr(const iprm::IParamsSet* paramsSetPtr) const = 0;
83
87 virtual iqtgui::IGuiObject* GetEditorGuiPtr(const iprm::IParamsSet* paramsSetPtr) const = 0;
88
93
98
102 virtual void OnTreeItemAdded(iprm::IParamsManager* managerPtr,
103 const int paramSetIndex,
104 const iprm::IParamsSet* paramsSetPtr,
105 QTreeWidgetItem* paramsSetItemPtr)
106 {
107 Q_UNUSED(managerPtr);
108 Q_UNUSED(paramSetIndex);
109 Q_UNUSED(paramsSetPtr);
110 Q_UNUSED(paramsSetItemPtr);
111 }
112
117 virtual void CopyParamsSet(const int index);
118
123 virtual void PasteParamsSet(const int index = -1);
124
125
129 virtual void UpdateParamsView(int selectedIndex);
130 int GetSelectedIndex() const;
132 QByteArray GetSelectedParamsSetTypeId() const;
133 void InsertNewParamsSet(int typeIndex = -1);
134
135 bool CopyParamsSetToClipboard(iser::ISerializable* objectPtr, const char* type) const;
136 bool PasteParamsSetFromClipboard(iser::ISerializable* objectPtr, const char* type);
137
138 // reimplemented (iqtgui::TGuiObserverWrap)
139 virtual void OnGuiModelAttached() override;
140 virtual void OnGuiModelDetached() override;
141 virtual void UpdateGui(const istd::IChangeable::ChangeSet& changeSet) override;
142
143 // reimplemented (ibase::TDesignSchemaHandlerWrap)
144 virtual void OnDesignSchemaChanged(const QByteArray& themeId) override;
145
146 // reimplemented (iqtgui::CComponentBase)
147 virtual void OnGuiCreated() override;
148
149 // reimplemented (imod::CSingleModelObserverBase)
150 virtual void AfterUpdate(imod::IModel* modelPtr, const istd::IChangeable::ChangeSet& changeSet) override;
151
152private:
153 void AttachCurrentExtender();
154 void DetachCurrentExtender();
155 void UpdateIcons();
156
157private:
158 I_ATTR(bool, m_allowAddRemoveAttrPtr);
159 I_ATTR(bool, m_allowUpDownAttrPtr);
160 I_ATTR(bool, m_supportEnablingAttrPtr);
161 I_ATTR(bool, m_supportRenameAttrPtr);
162 I_ATTR(bool, m_comboBoxViewAttrPtr);
163 I_ATTR(bool, m_comboBoxEditableAttrPtr);
164 I_ATTR(bool, m_comboBoxHiddenAttrPtr);
165 I_REF(iqtgui::IIconProvider, m_iconProviderCompPtr);
166 I_REF(ifile::IFilePersistence, m_paramsLoaderCompPtr);
167 I_ATTR(QByteArray, m_supplementaryLabelTextAttrPtr);
168
169 typedef QMap<int, QIcon> StateIconsMap;
170
171 imod::IModel* m_lastConnectedModelPtr;
172 imod::IObserver* m_lastObserverPtr;
173 QMenu m_startVariableMenus;
174 QMap<QByteArray, int> m_factoryIconIndexMap;
175 StateIconsMap m_stateIconsMap;
176
177 typedef QMap<iqt2d::IViewProvider*, int> ConnectedSceneFlags; // maps connected scene provider to connection flags
178 ConnectedSceneFlags m_connectedSceneFlags;
179
180 static QString m_copyParamsSetName;
181 static int m_pasteIndex;
182
183 QTimer m_hideInfoLabelTimer;
184};
185
186
187} // namespace iqtprm
188
189
190
191
Interface providing loading and saving of data objects.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:25
Common interface for all classes implementing the Observer functionality in the Model/Observer design...
Definition IObserver.h:156
Manager of parameter sets.
Set of general parameters.
Definition IParamsSet.h:81
Interface for GUI objects presenting its results using extern view objects.
Interface for GUI objects managing view.
Common interface for GUI objects used in ACF component context.
Definition IGuiObject.h:133
This interface provides acces to an icon.
Base class for all Qt GUI components.
void on_ParamsTree_itemChanged(QTreeWidgetItem *item, int column)
void on_ParamsComboBox_editTextChanged(const QString &text)
virtual void AfterUpdate(imod::IModel *modelPtr, const istd::IChangeable::ChangeSet &changeSet) override
virtual void RemoveItemsFromScene(iqt2d::IViewProvider *providerPtr) override
Called when items should be removed from specified scene.
virtual void OnTreeItemAdded(iprm::IParamsManager *managerPtr, const int paramSetIndex, const iprm::IParamsSet *paramsSetPtr, QTreeWidgetItem *paramsSetItemPtr)
Callback for item decoration.
int GetIndexByName(const QString &itemName) const
virtual void OnGuiModelDetached() override
virtual void PasteParamsSet(const int index=-1)
Paste ParamsSet from Clipboard When reimplemented in MultiParamsManager, the paramsSetType should be ...
virtual iqt2d::IViewExtender * GetCurrentViewExtenderPtr() const
Get the currently active view extender.
virtual void OnGuiModelAttached() override
bool CopyParamsSetToClipboard(iser::ISerializable *objectPtr, const char *type) const
virtual iqtgui::IGuiObject * GetEditorGuiPtr(const iprm::IParamsSet *paramsSetPtr) const =0
Get the editor GUI for a given parameter set.
virtual void OnParameterSelectionChanged()
Callback for parameter selection.
virtual void UpdateParamsView(int selectedIndex)
bool PasteParamsSetFromClipboard(iser::ISerializable *objectPtr, const char *type)
void on_ParamsComboBox_currentIndexChanged(int index)
virtual void OnGuiCreated() override
virtual void OnDesignSchemaChanged(const QByteArray &themeId) override
QByteArray GetSelectedParamsSetTypeId() const
virtual void CopyParamsSet(const int index)
Copy ParamsSet (index) to Clipboard.
virtual imod::IObserver * GetObserverPtr(const iprm::IParamsSet *paramsSetPtr) const =0
Get the observer for a given parameter set.
iqtgui::TDesignerGuiObserverCompBase< Ui::CParamsManagerGuiCompBase, iprm::IParamsManager > BaseClass
virtual void AddItemsToScene(iqt2d::IViewProvider *providerPtr, int flags) override
Called when items should be added to specified scene.
void OnAddMenuOptionClicked(QAction *action)
virtual void UpdateGui(const istd::IChangeable::ChangeSet &changeSet) override
void InsertNewParamsSet(int typeIndex=-1)
Common class for all classes which objects can be archived or restored from archive.
Set of change flags (its IDs).
Definition IChangeable.h:36
This package contains Qt based implementations of standard parameter components.