CParamsManagerGuiCompBase.h
Go to the documentation of this file.
1 #ifndef iqtprm_CParamsManagerGuiCompBase_included
2 #define iqtprm_CParamsManagerGuiCompBase_included
3 
4 
5 //Qt includes
6 #include <QtCore/QtGlobal>
7 #if QT_VERSION >= 0x050000
8 #include <QtWidgets/QMenu>
9 #else
10 #include <QtGui/QMenu>
11 #endif
12 
13 // ACF includes
14 #include <ifile/IFilePersistence.h>
15 #include <iprm/IParamsManager.h>
16 #include <iqtgui/IIconProvider.h>
18 #include <iqt2d/IViewExtender.h>
19 #include <GeneratedFiles/iqtprm/ui_CParamsManagerGuiCompBase.h>
20 
21 
22 namespace iqtprm
23 {
24 
25 
28  Ui::CParamsManagerGuiCompBase, iprm::IParamsManager>,
29  virtual public iqt2d::IViewExtender
30 {
31  Q_OBJECT
32 
33 public:
35  Ui::CParamsManagerGuiCompBase,
37 
38  I_BEGIN_BASE_COMPONENT(CParamsManagerGuiCompBase);
39  I_REGISTER_INTERFACE(iqt2d::IViewExtender);
40  I_ASSIGN(m_allowAddRemoveAttrPtr, "AllowAddRemove", "If it is false, 'Add' and 'Remove' buttons will be always hidden", true, true);
41  I_ASSIGN(m_allowUpDownAttrPtr, "AllowUpDown", "If it is false, 'Up' and 'Down' buttons will be always hidden", true, true);
42  I_ASSIGN(m_supportEnablingAttrPtr, "AllowEnable", "If this option is activated, the single parameter sets can be enabled/disabled in the list", true, false);
43  I_ASSIGN(m_comboBoxViewAttrPtr, "CompactView", "Shows parameters list as a combo box", true, false);
44  I_ASSIGN(m_comboBoxEditableAttrPtr, "CompactViewComboEditable", "Combo box in compact mode is editable", true, true);
45  I_ASSIGN(m_iconProviderCompPtr, "IconProvider", "Icons for drop-down types menu", false, "IconProvider");
46  I_ASSIGN(m_paramsLoaderCompPtr, "ParamsLoader", "Loader for the parameter set", false, "ParamsLoader");
47  I_END_COMPONENT;
48 
50 
51  // reimplemented (iqt2d::IViewExtender)
52  virtual void AddItemsToScene(iqt2d::IViewProvider* providerPtr, int flags);
53  virtual void RemoveItemsFromScene(iqt2d::IViewProvider* providerPtr);
54 
55 protected Q_SLOTS:
56  void on_AddButton_clicked();
58  void on_UpButton_clicked();
59  void on_DownButton_clicked();
61  void on_ParamsTree_itemChanged(QTreeWidgetItem* item, int column);
63  void on_ParamsComboBox_editTextChanged(const QString& text);
66  void OnAddMenuOptionClicked(QAction* action);
67 
68 protected:
69  // abstract methods
70 
74  virtual imod::IObserver* GetObserverPtr(const iprm::IParamsSet* paramsSetPtr) const = 0;
75 
79  virtual iqtgui::IGuiObject* GetEditorGuiPtr(const iprm::IParamsSet* paramsSetPtr) const = 0;
80 
85 
86  void UpdateActions();
87  void UpdateTree();
88  void UpdateComboBox();
89  virtual void UpdateParamsView(int selectedIndex);
90  int GetSelectedIndex() const;
92  QByteArray GetSelectedParamsSetTypeId() const;
93  void InsertNewParamsSet(int typeIndex = -1);
94 
95  // reimplemented (iqtgui::TGuiObserverWrap)
96  virtual void OnGuiModelAttached();
97  virtual void OnGuiModelDetached();
98  virtual void UpdateGui(const istd::IChangeable::ChangeSet& changeSet);
99 
100  // reimplemented (iqtgui::CComponentBase)
101  virtual void OnGuiCreated();
102 
103  // reimplemented (imod::CSingleModelObserverBase)
104  virtual void AfterUpdate(imod::IModel* modelPtr, const istd::IChangeable::ChangeSet& changeSet);
105 
106 private:
107  void AttachCurrentExtender();
108  void DetachCurrentExtender();
109 
110 private:
111  I_ATTR(bool, m_allowAddRemoveAttrPtr);
112  I_ATTR(bool, m_allowUpDownAttrPtr);
113  I_ATTR(bool, m_supportEnablingAttrPtr);
114  I_ATTR(bool, m_comboBoxViewAttrPtr);
115  I_ATTR(bool, m_comboBoxEditableAttrPtr);
116  I_REF(iqt2d::IViewExtender, m_extenderCompPtr);
117  I_REF(iqtgui::IIconProvider, m_iconProviderCompPtr);
118  I_REF(ifile::IFilePersistence, m_paramsLoaderCompPtr);
119 
120  typedef QMap<int, QIcon> StateIconsMap;
121 
122  imod::IModel* m_lastConnectedModelPtr;
123  imod::IObserver* m_lastObserverPtr;
124  QMenu m_startVariableMenus;
125  QMap<QByteArray, int> m_factoryIconIndexMap;
126  StateIconsMap m_stateIconsMap;
127 
128  typedef QMap<iqt2d::IViewProvider*, int> ConnectedSceneFlags; // maps connected scene provider to connection flags
129  ConnectedSceneFlags m_connectedSceneFlags;
130 };
131 
132 
133 } // namespace iqtprm
134 
135 
136 #endif // !iqtprm_CParamsManagerGuiCompBase_included
137 
138 
virtual void AfterUpdate(imod::IModel *modelPtr, const istd::IChangeable::ChangeSet &changeSet)
This function will be called after update of the observer contents occures.
virtual iqt2d::IViewExtender * GetCurrentViewExtenderPtr() const
Get the currently active view extender.
Interface for GUI objects presenting its results using extern view objects.
Definition: IViewExtender.h:19
This interface provides acces to an icon.
Definition: IIconProvider.h:21
Manager of parameters set.
virtual iqtgui::IGuiObject * GetEditorGuiPtr(const iprm::IParamsSet *paramsSetPtr) const =0
Get the editor GUI for a given parameter set.
void on_ParamsComboBox_currentIndexChanged(int index)
virtual void RemoveItemsFromScene(iqt2d::IViewProvider *providerPtr)
Called when items should be removed from specified scene.
void InsertNewParamsSet(int typeIndex=-1)
virtual void OnGuiModelAttached()
Called when model is attached and GUI is created.
virtual void OnGuiModelDetached()
Called when model is detached or GUI is destroyed.
void on_ParamsTree_itemChanged(QTreeWidgetItem *item, int column)
void on_ParamsComboBox_editTextChanged(const QString &text)
iqtgui::TDesignerGuiObserverCompBase< Ui::CParamsManagerGuiCompBase, iprm::IParamsManager > BaseClass
Base class for all Qt GUI components.
Common interface for GUI objects using in component context.
Definition: IGuiObject.h:25
virtual void AddItemsToScene(iqt2d::IViewProvider *providerPtr, int flags)
Called when items should be added to specified scene.
Common interface for all classes implementing the Observer functionality in the Model/Observer design...
Definition: IObserver.h:24
QByteArray GetSelectedParamsSetTypeId() const
Common interface for model objects, that supports Model/Observer design pattern.
Definition: IModel.h:23
void OnAddMenuOptionClicked(QAction *action)
Set of change flags (its IDs).
Definition: IChangeable.h:30
virtual imod::IObserver * GetObserverPtr(const iprm::IParamsSet *paramsSetPtr) const =0
Get the observer for a given parameter set.
Interface providing loading and saving of data objects.
Interface for GUI objects managing view.
Definition: IViewProvider.h:24
Set of general parameters.
Definition: IParamsSet.h:23
virtual void UpdateParamsView(int selectedIndex)
virtual void OnGuiCreated()
Called just after GUI is initialized.
virtual void UpdateGui(const istd::IChangeable::ChangeSet &changeSet)
Do update of the GUI to reflect the state of model.

© 2007-2017 Witold Gantzke and Kirill Lepskiy