ICF 3.1.1.10
Technical documentation of ICF Libraries
CPackageOverviewComp.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// Qt includes
10#include <QtCore/QDir>
11#include <QtWidgets/QTreeWidget>
12
13// ICF includes
19#include <idoc/IHelpViewer.h>
26
27#include <GeneratedFiles/icmpstr/ui_CPackageOverviewComp.h>
28
29
30namespace icmpstr
31{
32
33
35 public istdgui::TDesignerGuiObserverCompBase<Ui::CPackageOverviewComp, icomp::IRegistry>,
36 virtual public ibase::ICommandsProvider,
37 virtual public IAttributeSelectionObserver
38{
39 Q_OBJECT
40
41public:
43
44 I_BEGIN_COMPONENT(CPackageOverviewComp);
45 I_REGISTER_INTERFACE(ibase::ICommandsProvider);
46 I_REGISTER_INTERFACE(IAttributeSelectionObserver);
47 I_REGISTER_SUBELEMENT(LocalMetaInfoManager);
48 I_REGISTER_SUBELEMENT_INTERFACE(LocalMetaInfoManager, icomp::IMetaInfoManager, ExtractLocalMetaInfoManager);
49 I_REGISTER_SUBELEMENT_INTERFACE(LocalMetaInfoManager, imod::IModel, ExtractLocalMetaInfoManager);
50 I_REGISTER_SUBELEMENT_INTERFACE(LocalMetaInfoManager, istd::IChangeable, ExtractLocalMetaInfoManager);
51 I_REGISTER_SUBELEMENT_INTERFACE(LocalMetaInfoManager, istd::IPolymorphic, ExtractLocalMetaInfoManager);
52 I_ASSIGN(m_envManagerCompPtr, "EnvironmentManager", "Packages manager used to provide icon paths", true, "PackagesManager");
53 I_ASSIGN(m_consistInfoCompPtr, "ConsistencyInfo", "Allows to check consistency of registries and access to buffered icons", false, "ConsistencyInfo");
54 I_ASSIGN(m_quickHelpViewerCompPtr, "QuickHelpGui", "Show help of selected component using its address", false, "HelpViewer");
55 I_ASSIGN(m_documentManagerCompPtr, "DocumentManager", "Document manager allowing to load files on double click", false, "DocumentManager");
56 I_ASSIGN(m_configFilePathCompPtr, "ConfigFilePath", "Path of packages configuration file will be loaded, if enabled", false, "ConfigFilePath");
57 I_ASSIGN_TO(m_configFilePathModelCompPtr, m_configFilePathCompPtr, false);
58 I_END_COMPONENT;
59
61
62 // reimplemented (ibase::ICommandsProvider)
64
65 // reimplemented (icmpstr::IAttributeSelectionObserver)
66 void OnAttributeSelected(const icomp::IAttributeStaticInfo* attributeStaticInfoPtr) override;
67
68protected:
69 struct RootInfo
70 {
72 {
73 }
74
75 QTreeWidgetItem* itemPtr;
78 };
79
80 typedef QSet<QString> MetaInfoFilter;
81
82 void GenerateComponentTree(bool forceUpdate);
84 void UpdateSingleMetaInfoList(const MetaInfoFilter& filter, QComboBox& result);
85 void ReloadPackages(bool doForce);
87
92
97
98 RootInfo& EnsureRoot(const QByteArray& path, const icomp::CComponentAddress& address, const icomp::IComponentStaticInfo* staticInfoPtr);
99
101
102 // reimplemented (QObject)
103 bool eventFilter(QObject* sourcePtr, QEvent* eventPtr) override;
104
105 // reimplemented (istdgui::TGuiObserverWrap)
106 void UpdateGui(const istd::IChangeable::ChangeSet& changeSet) override;
107
108 // reimplemented (istdgui::CGuiComponentBase)
109 void OnGuiCreated() override;
110 void OnGuiDestroyed() override;
111 void OnRetranslate() override;
112 void OnGuiRetranslate() override;
113
114protected Q_SLOTS:
117 void on_PackagesList_itemExpanded(QTreeWidgetItem* item);
118 void on_PackagesList_itemClicked(QTreeWidgetItem* item, int column);
119 void on_PackagesList_itemDoubleClicked(QTreeWidgetItem* item, int column);
131
132private:
133 class PackageItemBase: public QTreeWidgetItem
134 {
135 public:
136 PackageItemBase(
137 CPackageOverviewComp& parent,
138 const QString& description,
139 const QIcon& icon = QIcon());
140
141 virtual const QString& GetDescription() const;
142
143 protected:
144 CPackageOverviewComp& m_parent;
145 QString m_description;
146 };
147
148 class PackageComponentItem: public PackageItemBase
149 {
150 public:
151 typedef PackageItemBase BaseClass;
152
153 PackageComponentItem(
154 CPackageOverviewComp& parent,
155 const icomp::CComponentAddress& address,
156 const icomp::IComponentStaticInfo* staticInfoPtr,
157 const QIcon& icon);
158
159 bool IsInterfaceSupported(const istd::CClassInfo& interfaceInfo) const;
160 const icomp::CComponentAddress& GetAddress() const;
161
162 private:
163 icomp::CComponentAddress m_address;
164 };
165
166 class PackageItem: public PackageItemBase
167 {
168 public:
169 typedef PackageItemBase BaseClass;
170
171 PackageItem(
172 CPackageOverviewComp& parent,
173 const QString& description,
174 const QIcon& icon = QIcon());
175 };
176
177 class ConfigObserver: public imod::CSingleModelObserverBase
178 {
179 public:
180 ConfigObserver(CPackageOverviewComp* parentPtr);
181
182 protected:
183 // reimplemented (imod::CSingleModelObserverBase)
184 virtual void OnUpdate(const istd::IChangeable::ChangeSet& changeSet);
185
186 private:
187 CPackageOverviewComp& m_parent;
188 };
189
190 class MetaInfoManager:
191 virtual public icomp::IMetaInfoManager,
193 {
194 public:
195 MetaInfoManager();
196
197 void UpdateLocalMetaInfoMap();
198
199 // reimplemented (icomp::IComponentListProvider)
200 ComponentAddresses GetComponentAddresses(int typeFlag = CTF_ALL) const override;
201
202 // reimplemented (icomp::IMetaInfoManager)
203 const icomp::IComponentStaticInfo* GetComponentMetaInfo(const icomp::CComponentAddress& address) const override;
204 const icomp::IComponentStaticInfo* GetPackageMetaInfo(const QByteArray& packageId) const override;
205
206 // reimplemented (icomp::IElementStaticInfo)
207 Ids GetMetaIds(MetaGroupId metaGroupId) const override;
208 const icomp::IComponentStaticInfo* GetEmbeddedComponentInfo(const QByteArray& embeddedId) const override;
209
210 CPackageOverviewComp* parentPtr;
211
212 private:
213 typedef std::map<QByteArray, std::unique_ptr<const icomp::IComponentStaticInfo> > IdToInfoMap;
214 IdToInfoMap m_idToInfoMap;
215 };
216
217 enum GruppingMode
218 {
219 GM_NONE,
220 GM_PACKAGE
221 };
222
223 I_REF(icomp::IComponentEnvironmentManager, m_envManagerCompPtr);
224 I_REF(IRegistryConsistInfo, m_consistInfoCompPtr);
225 I_REF(idoc::IHelpViewer, m_quickHelpViewerCompPtr);
226 I_REF(idoc::IDocumentManager, m_documentManagerCompPtr);
227 I_REF(ifile::IFileNameParam, m_configFilePathCompPtr);
228 I_REF(imod::IModel, m_configFilePathModelCompPtr);
229
231 istdgui::CHierarchicalCommand m_packagesCommand;
232 istdgui::CHierarchicalCommand m_reloadCommand;
233
234 std::map<QByteArray, RootInfo> m_roots;
235
236 ConfigObserver m_configObserver;
237
238 typedef QSet<QByteArray> InterfaceFilter;
239 InterfaceFilter m_interfaceFilter;
240 QStringList m_keywordsFilter;
241
242 QIcon m_realComponentIcon;
243 QIcon m_compositeComponentIcon;
244 QIcon m_mixedComponentIcon;
245 QIcon m_embeddedComponentIcon;
246
247 typedef QMap<QString, QTreeWidget*> CategoryWidgetsMap;
248 CategoryWidgetsMap m_categoryWidgetsMap;
249
251
252 imod::TModelWrap<MetaInfoManager> m_localMetaInfoManager;
253
254 template <class InterfaceType>
255 static InterfaceType* ExtractLocalMetaInfoManager(CPackageOverviewComp& component)
256 {
257 return &component.m_localMetaInfoManager;
258 }
259
260 int m_currentPackageGroupIndex;
261 std::unique_ptr<QPoint> m_starDragPositionPtr;
262
264};
265
266
267} // namespace icmpstr
268
269
Interface for a provider of the heriarchical commands.
QPixmap CreateComponentDragPixmap(const icomp::CComponentAddress &address) const
Create the drag preview for the component.
void on_InterfaceCB_currentIndexChanged(int index)
void OnGuiRetranslate() override
Called from widget event filter when GUI should be retranslated.
void OnGuiCreated() override
Called just after GUI is initialized.
void GenerateComponentTree(bool forceUpdate)
void on_PackagesList_itemDoubleClicked(QTreeWidgetItem *item, int column)
void OnGuiDestroyed() override
Called just before GUI is released.
void on_PackagesList_itemExpanded(QTreeWidgetItem *item)
icomp::IMetaInfoManager::ComponentAddresses GetFilteredComponentAdresses() const
Get a list of components that match the filter criteria.
RootInfo & EnsureRoot(const QByteArray &path, const icomp::CComponentAddress &address, const icomp::IComponentStaticInfo *staticInfoPtr)
void UpdateGui(const istd::IChangeable::ChangeSet &changeSet) override
void UpdateSingleMetaInfoList(const MetaInfoFilter &filter, QComboBox &result)
void OnAttributeSelected(const icomp::IAttributeStaticInfo *attributeStaticInfoPtr) override
void ReloadPackages(bool doForce)
void on_PackagesList_itemClicked(QTreeWidgetItem *item, int column)
void on_EnableFiltersButton_toggled(bool on)
void OnRetranslate() override
Called when non-GUI elements (like commands) should be retranslated.
const ibase::IHierarchicalCommand * GetCommands() const override
Get list of menu commands.
istdgui::TDesignerGuiObserverCompBase< Ui::CPackageOverviewComp, icomp::IRegistry > BaseClass
bool eventFilter(QObject *sourcePtr, QEvent *eventPtr) override
Represents global address of component.
Describe component attribute static information.
QSet< CComponentAddress > ComponentAddresses
This interface provide static information about component meta info.
Provide set of user actions needed to manage documents in MVC (Model View Controller) concept.
Allow to show help document to specified object or text.
Definition IHelpViewer.h:25
Common interface for any file system item name (e.g directory, file or URL path)
Basic implementation for a single model observer.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:29
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Definition TModelWrap.h:28
Represents platform independent type info and provide set of static class manipulation functions.
Definition CClassInfo.h:27
Set of change flags (its IDs).
Definition IChangeable.h:38
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
Common interface to define the hierarchical graph structures.
Implementation of hierarchical command based on QAction from Qt.
Base class for all Qt GUI components.
This package contains (Qt based) implementations of compositor components.

© Witold Gantzke and Kirill Lepskiy