CLogGuiComp.h
Go to the documentation of this file.
1 #ifndef iloggui_CLogGuiComp_included
2 #define iloggui_CLogGuiComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QTimer>
7 #if QT_VERSION >= 0x050000
8 #include <QtWidgets/QAction>
9 #else
10 #include <QtGui/QAction>
11 #endif
12 
13 // ACF includes
14 #include <ifile/IFilePersistence.h>
15 #include <iprm/CEnableableParam.h>
16 #include <ilog/CMessageContainer.h>
17 #include <ilog/CMessage.h>
19 #include <GeneratedFiles/iloggui/ui_CLogGuiComp.h>
20 
21 
22 namespace iloggui
23 {
24 
25 
30  public iqtgui::TDesignerGuiCompBase<Ui::CLogGuiComp>,
32 {
33  Q_OBJECT
34 
35 public:
38 
40  {
45  };
46 
47  I_BEGIN_COMPONENT(CLogGuiComp);
48  I_REGISTER_INTERFACE(ilog::IMessageConsumer);
49  I_REGISTER_SUBELEMENT(DiagnosticState);
50  I_REGISTER_SUBELEMENT_INTERFACE(DiagnosticState, iprm::IEnableableParam, ExtractDiagnosticState);
51  I_REGISTER_SUBELEMENT_INTERFACE(DiagnosticState, iser::ISerializable, ExtractDiagnosticState);
52  I_REGISTER_SUBELEMENT_INTERFACE(DiagnosticState, istd::IChangeable, ExtractDiagnosticState);
53  I_REGISTER_SUBELEMENT_INTERFACE(DiagnosticState, imod::IModel, ExtractDiagnosticState);
54  I_ASSIGN(m_fileLoaderCompPtr, "Exporter", "File loader used for log export", false, "Exporter");
55  I_ASSIGN(m_slaveMessageConsumerCompPtr, "SlaveMessageConsumer", "Slave message consumer", false, "SlaveMessageConsumer");
56  I_ASSIGN_TO(m_slaveMessageContainerCompPtr, m_slaveMessageConsumerCompPtr, false);
57  I_ASSIGN(m_allowDiagnosticMessagesAttrPtr, "AllowDiagnosticMessages", "If enabled the collecting of diagnostic messages and display of corresponding GUI elements is allowed", true, false);
58  I_ASSIGN(m_maxMessagesCountAttrPtr, "MaxMessageCount", "Maximal number of messages supported by the log", true, 1000);
59  I_ASSIGN(m_defaultModeAttrPtr, "DefaultMode", "Default display mode,\n 0 - info,\n 1 - warning,\n 2 - error", true, 0);
60  I_ASSIGN(m_showLogDescriptionAttrPtr, "ShowLogDescription", "Sets the log tables description visible", true, false);
61  I_ASSIGN(m_showMessageTextFilterAttrPtr, "ShowMessageTextFilter", "If enabled, the text filter for the messages will be shown", true, true);
62  I_ASSIGN(m_logTimeFormatAttrPtr, "TimeFormat", "Format of the date/time used for displaing message's time stamp", true, "");
63  I_END_COMPONENT;
64 
65  CLogGuiComp();
66 
67 protected:
69  {
74  };
75 
77  {
81  };
82 
83  enum DataRole
84  {
85  DR_CATEGORY = Qt::UserRole
86  };
87 
91  virtual QTreeWidgetItem* CreateGuiItem(const istd::IInformationProvider& message);
92 
96  virtual QIcon GetCategoryIcon(int category) const;
97 
101  virtual QIcon GetActionIcon(int functionType) const;
102 
106  virtual QString GetCategoryText(int category) const;
107 
108  // reimplemented (ilog::IMessageConsumer)
109  virtual bool IsMessageSupported(
110  int messageCategory = -1,
111  int messageId = -1,
112  const istd::IInformationProvider* messagePtr = NULL) const;
113  virtual void AddMessage(const MessagePtr& messagePtr);
114 
115  // reimplemented (ilog::IMessageContainer)
116  virtual void ClearMessages();
117 
118  // reimplemented (iqtgui::CGuiComponentBase)
119  virtual void OnGuiCreated();
120  virtual void OnGuiDestroyed();
121 
122  // reimplemented (icomp::CComponentBase)
123  virtual void OnComponentCreated();
124 
125 private:
126  void UpdateVisualStatus();
127  void UpdateItemVisibility(QTreeWidgetItem* itemPtr, const QString& filterText) const;
128  void GenerateMessageList();
129  void AddMessageToList(const MessagePtr& messagePtr);
130 
131 protected Q_SLOTS:
132  virtual void OnAddMessage(const MessagePtr& messagePtr);
133  virtual void OnMessageModeChanged();
134 
135  virtual void OnClearAction();
136  virtual void OnExportAction();
137 
138  void OnRemoveMessagesTimer();
139  void EnableDiagnosticMessages(bool state);
140 
141  void on_FilterText_textChanged(const QString& filterText);
142 
143 Q_SIGNALS:
144  void EmitAddMessage(const MessagePtr& messagePtr);
145 
146 protected:
147  QAction* m_infoActionPtr;
153 
154 private:
155  // static template methods for subelement access
156  template <class InterfaceType>
157  static InterfaceType* ExtractDiagnosticState(CLogGuiComp& component)
158  {
159  return &component.m_diagnosticState;
160  }
161 
162  I_REF(ifile::IFilePersistence, m_fileLoaderCompPtr);
163  I_REF(ilog::IMessageConsumer, m_slaveMessageConsumerCompPtr);
164  I_REF(ilog::IHierarchicalMessageContainer, m_slaveMessageContainerCompPtr);
165  I_ATTR(bool, m_allowDiagnosticMessagesAttrPtr);
166  I_ATTR(int, m_defaultModeAttrPtr);
167  I_ATTR(int, m_maxMessagesCountAttrPtr);
168  I_ATTR(bool, m_showLogDescriptionAttrPtr);
169  I_ATTR(bool, m_showMessageTextFilterAttrPtr);
170  I_ATTR(QString, m_logTimeFormatAttrPtr);
171 
172  int m_currentMessageMode;
173 
174  int m_statusCategory;
175 
176  QTimer m_removeMessagesTimer;
177 
179 };
180 
181 
182 } // namespace iloggui
183 
184 
185 #endif // !iloggui_CLogGuiComp_included
186 
Information about critical error - unnormal state of system, should never be returned.
ilog::CMessageContainer BaseClass2
Definition: CLogGuiComp.h:37
void on_FilterText_textChanged(const QString &filterText)
virtual void OnGuiDestroyed()
Called just before GUI is released.
QAction * m_exportActionPtr
Definition: CLogGuiComp.h:151
virtual void AddMessage(const MessagePtr &messagePtr)
Adds a message item to the container.
QAction * m_warningActionPtr
Definition: CLogGuiComp.h:148
iqtgui::TDesignerGuiCompBase< Ui::CLogGuiComp > BaseClass
Definition: CLogGuiComp.h:36
virtual void OnComponentCreated()
Base class for all Qt GUI components, which use the Qt designer's UI.
virtual QString GetCategoryText(int category) const
Get text corresponding to specified information category.
virtual QTreeWidgetItem * CreateGuiItem(const istd::IInformationProvider &message)
Create GUI item corresponding to specified message.
Common class for all classes which objects can be archived or restored from archive.
Definition: ISerializable.h:23
QAction * m_clearActionPtr
Definition: CLogGuiComp.h:150
virtual bool IsMessageSupported(int messageCategory=-1, int messageId=-1, const istd::IInformationProvider *messagePtr=NULL) const
Check if some messge is supported.
virtual void OnAddMessage(const MessagePtr &messagePtr)
Information about error, processing could not be done correctly.
Information is unimportant, for example can be used for diagnostic.
Message container displaying messages as log list.
Definition: CLogGuiComp.h:29
virtual QIcon GetCategoryIcon(int category) const
Get icons corresponding to specified information category.
virtual void OnGuiCreated()
Called just after GUI is initialized.
Common interface for data model objects, which can be changed.
Definition: IChangeable.h:24
Interface for objects which can be enabled/disabled.
void EmitAddMessage(const MessagePtr &messagePtr)
Common interface to define the hierarchical graph structures.
QAction * m_diagnosticModeActionPtr
Definition: CLogGuiComp.h:152
#define NULL
Definition: istd.h:64
virtual void OnClearAction()
virtual QIcon GetActionIcon(int functionType) const
Get icons corresponding to specified log action.
Common interface for a message container consuming information objects (messages).
virtual void OnExportAction()
Common interface for class providing some basic information object.
Common interface for model objects, that supports Model/Observer design pattern.
Definition: IModel.h:23
void EnableDiagnosticMessages(bool state)
QAction * m_infoActionPtr
Definition: CLogGuiComp.h:147
Interface providing loading and saving of data objects.
virtual void ClearMessages()
QAction * m_errorActionPtr
Definition: CLogGuiComp.h:149
istd::TSmartPtr< const istd::IInformationProvider > MessagePtr
virtual void OnMessageModeChanged()
Basic implementation of a message container.
Information about warning, processing could be done.

© 2007-2017 Witold Gantzke and Kirill Lepskiy