CSnapImageGuiComp.h
Go to the documentation of this file.
1 #ifndef iqtcam_CSnapImageGuiComp_included
2 #define iqtcam_CSnapImageGuiComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QTimer>
7 #if QT_VERSION >= 0x050000
8 #include <QtWidgets/QAction>
9 #include <QtWidgets/QMenu>
10 #else
11 #include <QtGui/QAction>
12 #include <QtGui/QMenu>
13 #endif
14 
15 // ACF includes
16 #include <ifile/IFilePersistence.h>
17 #include <imod/IModel.h>
18 #include <imod/IObserver.h>
19 #include <iimg/IBitmap.h>
21 #include <iprm/IParamsSet.h>
22 #include <iqtgui/IGuiObject.h>
25 
26 // ACF-Solutions includes
28 
29 #include <iqtcam/iqtcam.h>
30 
31 #include <GeneratedFiles/iqtcam/ui_CSnapImageGuiComp.h>
32 
33 
34 namespace iqtcam
35 {
36 
37 
41 class CSnapImageGuiComp: public iqt2d::TViewExtenderCompBase<iqtgui::TDesignerGuiCompBase<Ui::CSnapImageGuiComp, QWidget> >
42 {
43  Q_OBJECT
44 
45 public:
47 
48  I_BEGIN_COMPONENT(CSnapImageGuiComp);
49  I_ASSIGN(m_bitmapCompPtr, "Bitmap", "Bitmap will be shown", true, "Bitmap");
50  I_ASSIGN_TO(m_bitmapModelCompPtr, m_bitmapCompPtr, true);
51  I_ASSIGN(m_bitmapAcquisitionCompPtr, "BitmapAcquisition", "Bitmap acquision obje for image snap", false, "BitmapAcquisition");
52  I_ASSIGN(m_lookupTableCompPtr, "LookupTable", "Lookup table for pseudo colors in the image view", false, "LookupTable");
53  I_ASSIGN(m_bitmapLoaderCompPtr, "BitmapLoader", "Saves or loads bitmap to/from file", false, "BitmapLoader");
54  I_ASSIGN(m_allowBitmapLoadAttrPtr, "AllowBitmapLoad", "If true then loading of images is allowed", true, false);
55  I_ASSIGN(m_paramsLoaderCompPtr, "ParamsLoader", "Loads and saves parameters from and to file", false, "ParamsLoader");
56  I_ASSIGN(m_paramsSetCompPtr, "ParamsSet", "Parameters set", false, "ParamsSet");
57  I_ASSIGN_TO(m_paramsSetModelCompPtr, m_paramsSetCompPtr, false);
58  I_ASSIGN(m_paramsSetGuiCompPtr, "ParamsSetGui", "Shows parameter set", false, "ParamsSetGui");
59  I_ASSIGN_TO(m_paramsSetObserverCompPtr, m_paramsSetGuiCompPtr, false);
60  I_ASSIGN_TO(m_paramsSetExtenderCompPtr, m_paramsSetGuiCompPtr, false);
61  I_ASSIGN(m_liveIntervalAttrPtr, "LiveInterval", "Interval (in seconds) of acquisition in continuous mode", true, 0.04);
62  I_ASSIGN(m_allowSnapOnChangeAttrPtr, "AllowSnapOnChange", "If true then shows action for snap on parameters changed", false, false);
63  I_END_COMPONENT;
64 
66 
67  // reimplemented (iqt2d::IViewExtender)
68  virtual void AddItemsToScene(iqt2d::IViewProvider* providerPtr, int flags);
69  virtual void RemoveItemsFromScene(iqt2d::IViewProvider* providerPtr);
70 
71 protected:
73  {
74  public:
76 
77  protected:
78  // reimplemented (imod::CSingleModelObserverBase)
79  virtual void OnUpdate(const istd::IChangeable::ChangeSet& changeSet);
80 
81  private:
82  CSnapImageGuiComp& m_parent;
83  };
84 
85  bool SnapImage();
86  void UpdateButtonsState();
87 
88  // reimplemented (iqt2d::TViewExtenderCompBase)
89  virtual void CreateShapes(int sceneId, Shapes& result);
90 
91  // reimplemented (iqtgui::CGuiComponentBase)
92  virtual void OnGuiCreated();
93  virtual void OnGuiDestroyed();
94  virtual void OnGuiHidden();
95 
96  // reimplemented (icomp::CComponentBase)
97  virtual void OnComponentCreated();
98 
99 protected Q_SLOTS:
105  void OnIntervalSnap(bool checked);
106  void OnSnapOnChanges(bool checked);
107  void OnTimerReady();
108 
109 private:
110  I_REF(iimg::IBitmap, m_bitmapCompPtr);
111  I_REF(imod::IModel, m_bitmapModelCompPtr);
112  I_REF(icam::IBitmapAcquisition, m_bitmapAcquisitionCompPtr);
113  I_REF(icmm::IColorTransformation, m_lookupTableCompPtr);
114 
115  I_REF(ifile::IFilePersistence, m_bitmapLoaderCompPtr);
116  I_ATTR(bool, m_allowBitmapLoadAttrPtr);
117  I_REF(ifile::IFilePersistence, m_paramsLoaderCompPtr);
118 
119  I_REF(iprm::IParamsSet, m_paramsSetCompPtr);
120  I_REF(imod::IModel, m_paramsSetModelCompPtr);
121  I_REF(iqtgui::IGuiObject, m_paramsSetGuiCompPtr);
122  I_REF(imod::IObserver, m_paramsSetObserverCompPtr);
123  I_REF(iqt2d::IViewExtender, m_paramsSetExtenderCompPtr);
124 
125  I_ATTR(double, m_liveIntervalAttrPtr);
126  I_ATTR(bool, m_allowSnapOnChangeAttrPtr);
127 
128  QTimer m_timer;
129 
130  ParamsObserver m_paramsObserver;
131 };
132 
133 
134 } // namespace iqtcam
135 
136 
137 #endif // !iqtcam_CSnapImageGuiComp_included
138 
139 
iqt2d::TViewExtenderCompBase< iqtgui::TDesignerGuiCompBase< Ui::CSnapImageGuiComp, QWidget > > BaseClass
virtual void OnGuiHidden()
Bitmap acquisition processor.
ParamsObserver(CSnapImageGuiComp *parentPtr)
void OnIntervalSnap(bool checked)
virtual void OnGuiDestroyed()
virtual void CreateShapes(int sceneId, Shapes &result)
virtual void AddItemsToScene(iqt2d::IViewProvider *providerPtr, int flags)
virtual void OnComponentCreated()
void OnSnapOnChanges(bool checked)
virtual void OnGuiCreated()
virtual void RemoveItemsFromScene(iqt2d::IViewProvider *providerPtr)
virtual void OnUpdate(const istd::IChangeable::ChangeSet &changeSet)

© 2007-2017 Witold Gantzke and Kirill Lepskiy