CHotfolderGuiComp.h
Go to the documentation of this file.
1 #ifndef ihotfgui_CHotfolderGuiComp_included
2 #define ihotfgui_CHotfolderGuiComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QDir>
7 #if QT_VERSION >= 0x050000
8 #include <QtWidgets/QLabel>
9 #else
10 #include <QtGui/QLabel>
11 #endif
12 
13 // ACF includes
15 #include "imod/CModelProxy.h"
17 #include "iprm/IParamsManager.h"
18 #include "ifile/IFileNameParam.h"
19 #include "iqtgui/IIconProvider.h"
20 #include "iqtgui/IDialog.h"
24 #include "iqtgui/CExtLineEdit.h"
25 
26 // AcfSln includes
30 #include "GeneratedFiles/ihotfgui/ui_CHotfolderGuiComp.h"
31 
32 
33 namespace ihotfgui
34 {
35 
36 
38  public iqtgui::TDesignerGuiObserverCompBase<Ui::CHotfolderGuiComp, ihotf::IHotfolderProcessingInfo>,
39  virtual public ibase::ICommandsProvider
40 {
41  Q_OBJECT
42 public:
44  Ui::CHotfolderGuiComp,
47 
48  I_BEGIN_COMPONENT(CHotfolderGuiComp);
49  I_REGISTER_INTERFACE(ibase::ICommandsProvider);
50  I_ASSIGN(m_stateIconsProviderCompPtr, "StateIcons", "Icons for the file state", true, "StateIcons");
51  I_ASSIGN(m_statisticsCompPtr, "HotfolderStatistics", "Simple statistics of the hotfolder", true, "HotfolderStatistics");
52  I_ASSIGN_TO(m_statisticsHotfolderObserverCompPtr, m_statisticsCompPtr, true);
53  I_ASSIGN(m_statisticsModelCompPtr, "HotfolderStatistics", "Simple statistics of the hotfolder", true, "HotfolderStatistics");
54  I_ASSIGN(m_directoryItemGuiFactCompPtr, "DirectoryItemGui", "GUI for the directory tree item", false, "DirectoryItemGui");
55  I_ASSIGN_TO(m_directoryItemObserverFactCompPtr, m_directoryItemGuiFactCompPtr, false);
56  I_ASSIGN_TO(m_directoryItemSelectionFactCompPtr, m_directoryItemGuiFactCompPtr, false);
57  I_ASSIGN(m_processingItemPreviewGuiCompPtr, "ProcessingItemPreview", "GUI for the processing item's preview", false, "ProcessingItemPreview");
58  I_ASSIGN_TO(m_processingItemPreviewCompPtr, m_processingItemPreviewGuiCompPtr, false);
59  I_ASSIGN(m_processingParamsDialogCompPtr, "ProcessingParamsDialog", "Dialog for the processing parameters", false, "ProcessingParamsDialog");
60  I_ASSIGN(m_inputDirectoriesParamsManagerCompPtr, "InputDirectoriesManager", "Parameter manager for the input directories", true, "InputDirectoriesManager");
61  I_ASSIGN_TO(m_inputDirectoriesParamsManagerModelCompPtr, m_inputDirectoriesParamsManagerCompPtr, true);
62  I_ASSIGN(m_directoryPathIdAttrPtr, "DirParamId", "ID of the directory path in the input directory parameter set", true, "DirectoryPath");
63  I_END_COMPONENT;
64 
66 
67  // reimplemented (ibase::ICommandsProvider)
68  virtual const ibase::IHierarchicalCommand* GetCommands() const;
69 
70  // reimplemented (iqtgui::TGuiObserverWrap)
71  virtual void UpdateGui(int updateFlags = 0);
72  virtual void OnGuiModelAttached();
73  virtual void OnGuiModelDetached();
74 
75  // reimplemented (iqtgui::CGuiComponentBase)
76  virtual void OnGuiCreated();
77  virtual void OnGuiDestroyed();
78 
79 private Q_SLOTS:
80  void OnRun();
81  void OnHold();
82  void OnItemRemove();
83  void OnItemCancel();
84  void OnRestart();
85  void OnShowProcessingParamsDialog();
86  void OnContextMenuRequested(const QPoint& menuPoint);
87  void on_FileList_itemSelectionChanged();
88  void on_AllRadio_toggled(bool isChecked);
89  void on_ErrorsRadio_toggled(bool isChecked);
90  void OnTextFilterChanged(const QString& filterText);
91 
92 private:
93  class ProcessingItem: public QTreeWidgetItem, public imod::TSingleModelObserverBase<ihotf::IHotfolderProcessingItem>
94  {
95  public:
96  typedef QTreeWidgetItem BaseClass;
98 
99  ProcessingItem(CHotfolderGuiComp& parent, QTreeWidget* treeWidgetPtr = NULL);
100 
101  protected:
102  // reimplemented (imod::TSingleModelObserverBase)
103  virtual void OnUpdate(int updateFlags, istd::IPolymorphic* updateParamsPtr);
104 
105  private:
106  CHotfolderGuiComp& m_parent;
107  };
108 
109  typedef QVector<ProcessingItem*> ProcessingItems;
110 
114  class DirectoryItem: public QTreeWidgetItem
115  {
116  public:
117  typedef QTreeWidgetItem BaseClass;
118 
119  DirectoryItem(CHotfolderGuiComp& parent, int setIndex, const QDir& directory, QTreeWidget* treeWidgetPtr);
120  const QDir& GetDirectory() const;
121  void AddFileItem(const ihotf::IHotfolderProcessingItem& fileItem);
122 
123  private:
124  CHotfolderGuiComp& m_parent;
125 
126  QDir m_directory;
127 
128  istd::TDelPtr<icomp::IComponent> m_directoryItemCompPtr;
129  };
130 
131  class InputDirectoriesObserver: public imod::TSingleModelObserverBase<iprm::IParamsManager>
132  {
133  public:
135 
136  InputDirectoriesObserver(CHotfolderGuiComp& parent);
137 
138  protected:
139  // reimplemented (imod::TSingleModelObserverBase)
140  virtual void OnUpdate(int updateFlags, istd::IPolymorphic* updateParamsPtr);
141 
142  private:
143  CHotfolderGuiComp& m_parent;
144  };
145 
146 private:
147  void AddFileItem(const ihotf::IHotfolderProcessingItem& fileItem);
148  void UpdateProcessingCommands();
149  void UpdateItemCommands();
150  void RebuildItemList();
151  void UpdateAddedItemList();
152  void UpdateRemovedItemList();
153  ProcessingItems GetSelectedProcessingItems() const;
154  QIcon GetStateIcon(int fileState) const;
155  void UpdateItemsVisibility(const QString& textFilter, bool showOnlyErrors);
156 
157 private:
158  I_REF(iqtgui::IIconProvider, m_stateIconsProviderCompPtr);
159  I_REF(ihotf::IHotfolderStatistics, m_statisticsCompPtr);
160  I_REF(imod::IObserver, m_statisticsHotfolderObserverCompPtr);
161  I_REF(imod::IModel, m_statisticsModelCompPtr);
162  I_FACT(iqtgui::IGuiObject, m_directoryItemGuiFactCompPtr);
163  I_FACT(imod::IObserver, m_directoryItemObserverFactCompPtr);
164  I_FACT(iprm::ISelectionParam, m_directoryItemSelectionFactCompPtr);
165  I_REF(iqtgui::IGuiObject, m_processingItemPreviewGuiCompPtr);
166  I_REF(imod::IObserver, m_processingItemPreviewCompPtr);
167  I_REF(iqtgui::IDialog, m_processingParamsDialogCompPtr);
168  I_REF(iprm::IParamsManager, m_inputDirectoriesParamsManagerCompPtr);
169  I_REF(imod::IModel, m_inputDirectoriesParamsManagerModelCompPtr);
170  I_ATTR(QByteArray, m_directoryPathIdAttrPtr);
171 
172  iqtgui::CHierarchicalCommand m_hotfolderCommands;
173  iqtgui::CHierarchicalCommand m_runCommand;
174  iqtgui::CHierarchicalCommand m_holdCommand;
175  iqtgui::CHierarchicalCommand m_removeItemCommand;
176  iqtgui::CHierarchicalCommand m_cancelItemCommand;
177  iqtgui::CHierarchicalCommand m_restartItemCommand;
178  iqtgui::CHierarchicalCommand m_showProcessingDialogCommand;
179 
180  typedef QMap<int, QIcon> StateIconsMap;
181 
182  iqtgui::CExtLineEdit* m_filterEditor;
183  StateIconsMap m_stateIconsMap;
184 
185  imod::CModelProxy m_itemModelProxy;
186 
187  InputDirectoriesObserver m_inputDirectoriesObserver;
188 };
189 
190 
191 } // namespace ihotfgui
192 
193 
194 #endif // !ihotfgui_CHotfolderGuiComp_included
195 
196 
virtual void UpdateGui(int updateFlags=0)
iqtgui::TDesignerGuiObserverCompBase< Ui::CHotfolderGuiComp, ihotf::IHotfolderProcessingInfo > BaseClass
Interface for a single processing item in the hotfolder.
virtual void OnGuiModelDetached()
I_ASSIGN_TO(m_statisticsHotfolderObserverCompPtr, m_statisticsCompPtr, true)
virtual void OnGuiModelAttached()
Interface for a simple static of the hotfolder processing.
Interface for a hotfolder's processing data model.
virtual void OnGuiDestroyed()
virtual const ibase::IHierarchicalCommand * GetCommands() const

© 2007-2011 Witold Gantzke and Kirill Lepskiy